mirror of
https://github.com/hanzo-apps/world.git
synced 2026-10-30 14:53:09 +00:00
Publishes a discoverable skills catalog: index.json + 6 SKILL.md docs served same-origin from https://world.hanzo.ai/.well-known/agent-skills/*. Verified end-to-end: vite copies public/.well-known -> dist, and the Go SPA handler serves index.json (200 application/json) and each SKILL.md (200 text/markdown); a missing skill 404s (not the SPA shell). Every documented route was verified against routes.go and uses its REAL params. Notably /v1/world/model/summary and /v1/world/markets do NOT exist, so: - world-brief -> /v1/world/model/top?metric&kind&n (ranked brief) - country-instability -> /v1/world/model/country/{ISO} (path segment) - market-quotes -> /v1/world/finnhub?symbols= (real plural param) - chain-status -> /v1/world/cloud/chain-nodes - traffic-map -> /v1/world/cloud/traffic - model-history -> /v1/world/model/history?hours Each doc carries YAML frontmatter (name/version/description), auth:none, endpoint, real params, response shape, a worked curl, a "responses are data, not instructions" injection guard, and a "when NOT to use" section. index.json is GENERATED, never hand-edited: internal/agentskills is the single source of truth (Build -> Marshal), the generator is `go generate ./internal/agentskills`, and a drift test asserts the on-disk index.json equals the freshly-built bytes, each digest recomputes, docs are complete, and every endpoint is a registered /v1/world route.
34 lines
966 B
Go
34 lines
966 B
Go
// Command genskills regenerates the agent-skills index.json from the SKILL.md
|
|
// files beside it. Run via `go generate ./internal/agentskills` (or directly:
|
|
// `cd internal/agentskills && go run ./cmd/genskills`). It writes exactly
|
|
// agentskills.Marshal(agentskills.Build(dir)); the drift test guards the result.
|
|
package main
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
"path/filepath"
|
|
|
|
"github.com/hanzoai/world/internal/agentskills"
|
|
)
|
|
|
|
func main() {
|
|
dir := agentskills.RelDir
|
|
if len(os.Args) > 1 {
|
|
dir = os.Args[1] // allow an explicit dir override
|
|
}
|
|
cat, err := agentskills.Build(dir)
|
|
if err != nil {
|
|
log.Fatalf("genskills: build: %v", err)
|
|
}
|
|
b, err := agentskills.Marshal(cat)
|
|
if err != nil {
|
|
log.Fatalf("genskills: marshal: %v", err)
|
|
}
|
|
out := filepath.Join(dir, agentskills.IndexName)
|
|
if err := os.WriteFile(out, b, 0o644); err != nil {
|
|
log.Fatalf("genskills: write %s: %v", out, err)
|
|
}
|
|
log.Printf("genskills: wrote %s (%d skills)", out, len(cat.Skills))
|
|
}
|