Files
cad-atlas/internal/web/handler.go
T
mathiasandClaude Opus 4.8 5c6a4ab232
CD / Detect unsubstituted template (push) Successful in 1s
CD / Lint / Test / Vet (push) Has been skipped
CD / Build & Import (push) Has been skipped
CD / Deploy via GitOps (push) Has been skipped
feat: Phase A — serve static CAD Atlas viz + self-contained context
Wire the reel-style CAD workflow atlas (signal→pod) as the served page via
go:embed. Fill PROJECT.md/README with the 9-stage workflow, three governance
gates (Ed25519 admission / dispatch-allow / var-go Oath), phase map A→C,
dogfooding model, brain deep-links and external references.

Fixes two template-go-web latent bugs surfaced by dogfooding:
- templ version skew: go.mod pinned v0.2.778 vs templ@latest generator
- .gitignore pattern *.templ.go did not match generated *_templ.go

Verified: go build · vet · golangci-lint (0 issues) · go test green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-19 10:34:23 +02:00

33 lines
925 B
Go

package web
import (
"context"
_ "embed"
"net/http"
)
// atlasHTML is the Phase-A static hero visualization. Phase C replaces this
// self-contained file with a Templ view hydrated from live CAD trace data
// (assessor-loop ledger, session_log, Gitea run API, Flux events).
//
//go:embed static/cad-atlas.html
var atlasHTML []byte
// NewHandler serves the CAD Atlas. Root ("/") returns the static atlas;
// /api/hello is a leftover template probe kept until Phase C wires real endpoints.
func NewHandler() http.Handler {
mux := http.NewServeMux()
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path != "/" {
http.NotFound(w, r)
return
}
w.Header().Set("Content-Type", "text/html; charset=utf-8")
_, _ = w.Write(atlasHTML)
})
mux.HandleFunc("/api/hello", func(w http.ResponseWriter, r *http.Request) {
_ = Hello("world").Render(context.Background(), w)
})
return mux
}