Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/glossary-maintainer.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions .github/workflows/release.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/workflows/speckit-dispatcher.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/workflows/technical-doc-writer.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions pkg/workflow/engine_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func GetBaseInstallationSteps(config EngineInstallConfig, workflowData *Workflow
// This is used by the Copilot CLI which expects agent identifiers, not full paths.
//
// Parameters:
// - agentFile: The relative path to the agent file (e.g., ".github/agents/test-agent.md")
// - agentFile: The relative path to the agent file (e.g., ".github/agents/test-agent.md" or ".github/agents/test-agent.agent.md")
//
// Returns:
// - string: The agent identifier (e.g., "test-agent")
Expand All @@ -85,6 +85,9 @@ func GetBaseInstallationSteps(config EngineInstallConfig, workflowData *Workflow
//
// identifier := ExtractAgentIdentifier(".github/agents/my-agent.md")
// // Returns: "my-agent"
//
// identifier := ExtractAgentIdentifier(".github/agents/my-agent.agent.md")
// // Returns: "my-agent"
func ExtractAgentIdentifier(agentFile string) string {
engineHelpersLog.Printf("Extracting agent identifier from: %s", agentFile)
// Extract the base filename from the path
Expand All @@ -94,8 +97,11 @@ func ExtractAgentIdentifier(agentFile string) string {
filename = agentFile[lastSlash+1:]
}

// Remove the .md extension using TrimSuffix (unconditionally safe)
// Remove extensions in order: .agent.md, then .md, then .agent
// This handles all possible agent file naming conventions
filename = strings.TrimSuffix(filename, ".agent.md")
filename = strings.TrimSuffix(filename, ".md")
filename = strings.TrimSuffix(filename, ".agent")

return filename
}
Expand Down
30 changes: 30 additions & 0 deletions pkg/workflow/engine_helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,36 @@ func TestExtractAgentIdentifier(t *testing.T) {
input: ".github/agents/test-agent",
expected: "test-agent",
},
{
name: "custom agent file with .agent.md extension",
input: ".github/agents/speckit-dispatcher.agent.md",
expected: "speckit-dispatcher",
},
{
name: "custom agent file simple path",
input: ".github/agents/test-agent.agent.md",
expected: "test-agent",
},
{
name: "custom agent file with path",
input: "../agents/technical-doc-writer.agent.md",
expected: "technical-doc-writer",
},
{
name: "custom agent file with underscores",
input: ".github/agents/my_custom_agent.agent.md",
expected: "my_custom_agent",
},
{
name: "agent file with only .agent extension",
input: ".github/agents/test-agent.agent",
expected: "test-agent",
},
{
name: "agent file with .agent extension in path",
input: "../agents/my-agent.agent",
expected: "my-agent",
},
}

for _, tt := range tests {
Expand Down