Files
archie/internal/webui/api_skills.go
T
sam 96e5d7b84b refactor: strip doc and issue narration from code comments
Remove PRD/doc paths, bead IDs, phase notes and deleted-test references
from comments; drop test-only hooks left by the test deletion. Includes
in-progress archied bootstrap, gateway and query changes.
2026-10-03 21:47:46 +10:00

34 lines
1.2 KiB
Go

package webui
import "net/http"
// SkillView is one catalogued skill as shown on the dashboard's Skills page:
// what it does, in plain language, and where it was discovered.
type SkillView struct {
Name string `json:"name"`
Description string `json:"description"`
Workflow string `json:"workflow,omitempty"`
Source string `json:"source"`
}
// SkillCatalog is the webui-owned source of the dashboard's skill
// catalogue. It is deliberately a view over already-discovered entries, not
// the discovery machinery: the cataloguer (internal/skill) drags the agent
// toolchain in, and the UI process must not link it.
// Whoever owns the runtime -- the daemon, via its config -- supplies an
// adapter at bootstrap; an unwired catalog degrades to an empty page.
type SkillCatalog interface {
Skills() []SkillView
}
// handleSkills reports the skill catalogue -- what Archie can actually do,
// beyond what is in the source. It answers the same question a fresh
// operator would ask by reading internal/skill/, without the reading.
func (s *Server) handleSkills(w http.ResponseWriter, r *http.Request) {
if s.Skills == nil {
writeJSON(w, map[string]any{"skills": []SkillView{}})
return
}
writeJSON(w, map[string]any{"skills": s.Skills.Skills()})
}