-
Notifications
You must be signed in to change notification settings - Fork 49
Replace engine.custom-agent field with imports-based agent files #2838
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
6271f75
c6d27b9
b2283f0
24d0f68
2188b18
02dc867
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -101,6 +101,7 @@ type ImportsResult struct { | |||||
| MergedNetwork string // Merged network configuration from all imports | ||||||
| MergedPermissions string // Merged permissions configuration from all imports | ||||||
| ImportedFiles []string // List of imported file paths (for manifest) | ||||||
| AgentFile string // Path to custom agent file (if imported) | ||||||
| } | ||||||
|
|
||||||
| // ExtractFrontmatterFromContent parses YAML frontmatter from markdown content string | ||||||
|
|
@@ -411,6 +412,7 @@ func ProcessImportsFromFrontmatterWithManifest(frontmatter map[string]any, baseD | |||||
| var engines []string | ||||||
| var safeOutputs []string | ||||||
| var processedFiles []string | ||||||
| var agentFile string // Track custom agent file | ||||||
|
|
||||||
| for _, importPath := range imports { | ||||||
| // Handle section references (file.md#Section) | ||||||
|
|
@@ -440,6 +442,38 @@ func ProcessImportsFromFrontmatterWithManifest(frontmatter map[string]any, baseD | |||||
| // Add to list of processed files (use original importPath for manifest) | ||||||
| processedFiles = append(processedFiles, importPath) | ||||||
|
|
||||||
| // Check if this is a custom agent file (any markdown file under .github/agents) | ||||||
| isAgentFile := strings.Contains(fullPath, "/.github/agents/") && strings.HasSuffix(strings.ToLower(fullPath), ".md") | ||||||
| if isAgentFile { | ||||||
| if agentFile != "" { | ||||||
| // Multiple agent files found - error | ||||||
| return nil, fmt.Errorf("multiple agent files found in imports: '%s' and '%s'. Only one agent file is allowed per workflow", agentFile, importPath) | ||||||
|
||||||
| return nil, fmt.Errorf("multiple agent files found in imports: '%s' and '%s'. Only one agent file is allowed per workflow", agentFile, importPath) | |
| return nil, fmt.Errorf("multiple agent files found in imports: '%s' and '%s'. Only one agent file is allowed per workflow", agentFile, fullPath) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,4 +11,4 @@ | |
| "sha": "2028fbc5c25fe9cf00d9f06a71cc4710d4507903" | ||
| } | ||
| } | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The agent file detection logic may fail for Windows paths or paths that don't use Unix-style separators. Consider using
filepath.Separatororstrings.Contains(filepath.ToSlash(fullPath), \"/.github/agents/\")for cross-platform compatibility.