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
15 changes: 5 additions & 10 deletions components/backend/handlers/content.go
Original file line number Diff line number Diff line change
Expand Up @@ -511,17 +511,12 @@ func ContentWorkflowMetadata(c *gin.Context) {
displayName = commandName
}

// Extract short command (last segment after final dot)
shortCommand := commandName
if lastDot := strings.LastIndex(commandName, "."); lastDot != -1 {
shortCommand = commandName[lastDot+1:]
}

// Use full command name as slash command (e.g., /speckit.rfe.start)
commands = append(commands, map[string]interface{}{
"id": commandName,
"name": displayName,
"description": metadata["description"],
"slashCommand": "/" + shortCommand,
"slashCommand": "/" + commandName,
"icon": metadata["icon"],
})
}
Expand Down Expand Up @@ -648,9 +643,9 @@ func parseAmbientConfig(workflowDir string) *AmbientConfig {

// findActiveWorkflowDir finds the active workflow directory for a session
func findActiveWorkflowDir(sessionName string) string {
// Workflows are stored at {StateBaseDir}/sessions/{session-name}/workspace/workflows/{workflow-name}
// The runner creates this nested structure
workflowsBase := filepath.Join(StateBaseDir, "sessions", sessionName, "workspace", "workflows")
// Workflows are stored at {StateBaseDir}/workflows/{workflow-name}
// The runner clones workflows to /workspace/workflows/ at runtime
workflowsBase := filepath.Join(StateBaseDir, "workflows")

entries, err := os.ReadDir(workflowsBase)
if err != nil {
Expand Down
11 changes: 6 additions & 5 deletions components/backend/handlers/content_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -830,12 +830,13 @@ var _ = Describe("Content Handler", Label(test_constants.LabelUnit, test_constan
})

It("Should parse workflow metadata when available", func() {
// Create test workflow structure
sessionDir := filepath.Join(tempStateDir, "sessions", "test-session", "workspace", "workflows", "test-workflow")
claudeDir := filepath.Join(sessionDir, ".claude")
// Create test workflow structure at StateBaseDir/workflows/{workflow-name}
// findActiveWorkflowDir looks in StateBaseDir/workflows/ for directories with .claude subdirectory
workflowDir := filepath.Join(tempStateDir, "workflows", "test-workflow")
claudeDir := filepath.Join(workflowDir, ".claude")
commandsDir := filepath.Join(claudeDir, "commands")
agentsDir := filepath.Join(claudeDir, "agents")
ambientDir := filepath.Join(sessionDir, ".ambient")
ambientDir := filepath.Join(workflowDir, ".ambient")

err := os.MkdirAll(commandsDir, 0755)
Expect(err).NotTo(HaveOccurred())
Expand Down Expand Up @@ -917,7 +918,7 @@ This is a test agent.

slashCommandInterface, exists := command["slashCommand"]
Expect(exists).To(BeTrue(), "Command should contain 'slashCommand' field")
Expect(slashCommandInterface).To(Equal("/command"))
Expect(slashCommandInterface).To(Equal("/test.command"))

iconInterface, exists := command["icon"]
Expect(exists).To(BeTrue(), "Command should contain 'icon' field")
Expand Down
Loading
Loading