Files
archie/internal/webui/api_task_meta.go
T
sam 23e0895ea2 feat(tasks): serve the lifecycle presentation catalog from /api/task-meta
Archie owns the status and action vocabulary in internal/taskstate, but the
dashboard had to keep a hand-synced copy of the display labels, pill severities
and action confirm prompts -- so a new status or action silently rendered
wrong until someone edited the frontend.

- add taskstate.Statuses() and taskstate.ActionCatalog() so the rules and their
  presentation live in one place
- expose GET /api/task-meta returning {statuses, actions}
- add a client base/task-meta.js that fetches the catalog and exposes
  statusLabel/statusKind/statusIds/attentionStatusIds/actionFor, with a
  freeze-dried default snapshot so the dashboard renders instantly and keeps
  working when archied is unreachable
- tests for the catalog, the endpoint and the client accessors
2026-08-28 00:41:12 +00:00

20 lines
654 B
Go

package webui
import (
"net/http"
"github.com/samcharles93/archie-core/internal/taskstate"
)
// handleTaskMeta serves the lifecycle presentation catalog: the status
// vocabulary (with label, pill severity, "needs you" grouping) and the operator
// action controls (with label, button variant, confirm prompt). Everything the
// dashboard can present is derived here, so the frontend never has to keep a
// hand-synced copy of the vocabulary or the control set.
func (s *Server) handleTaskMeta(w http.ResponseWriter, _ *http.Request) {
writeJSON(w, map[string]any{
"statuses": taskstate.Statuses(),
"actions": taskstate.ActionCatalog(),
})
}