Add standard frontmatter fields with typed generic Markdown (metadata-only)#122
Conversation
- Implemented agent field as default selector (filters rules) - Implemented language field as default selector (supports string or array) - Added model, single_shot, timeout, mcp_servers as metadata fields - Added comprehensive tests for all new functionality - Updated documentation with detailed examples - Added example files demonstrating standard fields Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Use type switching for agent field similar to language field for better consistency and code clarity Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
|
@copilot Languages should be lower-case. E.g. "go" not "Go". |
- Changed all language examples from uppercase (Go, Python, JavaScript) to lowercase (go, python, javascript) - Updated timeout field to use time.Duration format (e.g., "10m") instead of numeric seconds - Fixed agent field behavior: now excludes agent's own directories (like -a flag) instead of acting as selector - Added types.go with TaskFrontMatter and RuleFrontMatter struct definitions - Updated all tests to reflect new behavior - Updated documentation to correctly describe agent field behavior Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Log a warning when an invalid agent name is found in task frontmatter to help users identify configuration issues Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
|
@copilot Both TaskFrontMatter and RuleFrontMatter should extend FrontMatter. That type is a map[string]any, so it probably needs to change to a type FrontMatter struct { |
- Changed FrontMatter from type alias to struct with Content field - Made TaskFrontMatter and RuleFrontMatter extend FrontMatter - Split types into separate files (frontmatter.go, task_frontmatter.go, rule_frontmatter.go) - Added MCP server config types in pkg/config package - Updated all code and tests to work with new FrontMatter structure - All tests passing Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Implemented in dde4d2a. Changed FrontMatter to a struct with Content field, and made both TaskFrontMatter and RuleFrontMatter extend it using embedding. All types are now in separate files as requested. |
|
@copilot move the MCP types into pkg/codingcontext |
Moved all MCP server configuration types to pkg/codingcontext package as requested Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
|
|
||
| // "languages" field: filters rules by language | ||
| // Array for OR logic | ||
| for _, lang := range cc.task.FrontMatter.Languages { |
There was a problem hiding this comment.
Removed in c71895d. The automatic language filtering loop has been deleted, so languages is now metadata-only. Users must use the selectors field to filter rules by language.
|
|
||
| // "agent" field: use as default agent if -a flag was not provided | ||
| // This is not used for selecting tasks or rules, only as a default | ||
| if cc.task.FrontMatter.Agent != "" && !cc.targetAgent.IsSet() { |
There was a problem hiding this comment.
@copilot remove this filter. The user must have specified the selector and so this is not needed.
There was a problem hiding this comment.
Removed in 91ce062. Agent field now always sets the target agent when present (no conditional check for whether it was already set).
| FrontMatter FrontMatter // Parsed YAML frontmatter | ||
| Content string // Expanded content of the markdown | ||
| Tokens int // Estimated token count | ||
| type Markdown[T any] struct { |
There was a problem hiding this comment.
| type Markdown[T any] struct { | |
| type Markdown[T FrontMatter] struct { |
There was a problem hiding this comment.
Applied in 91ce062. Changed to Markdown[T FrontMatter] for better type safety.
| } | ||
|
|
||
| // NewMarkdown creates a new Markdown with the given frontmatter | ||
| func NewMarkdown[T any](t T) Markdown[T] { |
- Removed automatic filtering loop for languages field (lines 470-474) - Languages field is now metadata only, does not filter rules - Only the explicit selectors field filters rules - Updated comments to clarify languages is metadata-only Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
…ing, constrain Markdown generic - Removed Path field from Markdown struct (unreachable/unused) - Removed BootstrapPath() method (unreachable code) - Changed Markdown[T any] to Markdown[T FrontMatter] for type constraint - Removed agent default behavior check - agent field now always sets target agent when present - Removed unused filepath and strings imports from result.go Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
- Task names now based on filename instead of task_name frontmatter field - Removed resume flag (-r), resume is now a selector (-s resume=true) - Tasks no longer have bootstrap scripts (only rules do) - Language field is metadata only, not automatically added as selector - Updated all tests to reflect these changes
|
@copilot Please reinstate the resume option. |
|
@copilot Add back the -"a" flag. This time, it is for the default agent to be used. If the task file has an agent, that task flie agent overrides it. It is used, as it was previously, to prevent output of the files the agent already uses. E.g. CLAUDE.md for "claude". |
- Reinstated -r flag in main.go that was removed - Added WithResume option to codingcontext package - Updated findExecuteRuleFiles to check cc.resume directly - Added comprehensive tests for resume mode including bootstrap script verification - Resume mode now properly skips all rule discovery and bootstrap scripts
- Reinstated -a flag for specifying target agent - Merged TargetAgent type into Agent type - Renamed targetAgent field to agent throughout codebase - Agent type now handles both agent identification and exclusion logic - Task frontmatter agent field overrides -a flag when set - Excludes agent-specific paths and rules with matching agent field
- Added Result.MCPServers() method to collect all MCP servers - Collects servers from both task and all included rules - Task servers included first, followed by rule servers - Added comprehensive tests for various scenarios
Summary
This PR adds standard frontmatter fields with typed generic Markdown, reinstates the
-rand-aflags, and adds MCP server collection functionality.Changes
Standard Frontmatter Fields
Markdown[T]type for type-safe frontmatter handlingagent,languages,model,single_shot,timeout,mcp_servers,resume,selectorsReinstated Flags
-rflag: Resume mode that skips rule discovery and bootstrap scripts-aflag: Target agent flag that excludes that agent's own rulesCLAUDE.mdfor-a claude)agentfield in frontmatteragentfield overrides-aflag when presentType Simplification
TargetAgenttype intoAgenttypetargetAgentfield toagentthroughout codebaseLibrary Enhancements
WithResumeoption for programmatic resume modeWithAgentoption for programmatic agent specificationResult.MCPServers()method to collect all MCP servers from rules and taskBehavior
-r): Skips all rule discovery and bootstrap scripts, returns only task content-a): Prevents loading rules that the agent would load itselfagentfield takes precedence over-aflagResult.MCPServers()Testing