29 lines
934 B
Go
29 lines
934 B
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 lists the discovered skills. Unwired returns an empty list.
|
|
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()})
|
|
}
|