generated from mathias/template-go-web
The atlas no longer hand-maintains its content. Authored data lives in one place (internal/atlas/atlas.json); the Go layer overlays sourced facts and serves the result at /api/atlas.json; the frontend fetches + renders (inline arrays kept only as an offline fallback). First generated source: the CI/CD stage's nodes are parsed from the repo's own .gitea/workflows/cd.yml — so the viz shows the pipeline that actually runs (guard/check/build/deploy), dropping the aspirational var-go/oath-gate node that isn't wired yet. That's the point: it can't drift from the real pipeline. New internal/atlas package (JobsFromWorkflow, Build) built test-first. Adds gopkg.in/yaml.v3 (justified: parsing the workflow YAML; stdlib has no YAML). Verified: go build/vet/lint(0)/test green; /api/atlas.json → 9 stages, CI = real jobs; frontend renders from the fetch (screenshot). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
16 lines
436 B
Go
16 lines
436 B
Go
package atlas
|
|
|
|
import _ "embed"
|
|
|
|
// DataJSON is the authored atlas content (substrate + stage narrative).
|
|
// Sourced/generated facts are overlaid onto it at Build time.
|
|
//
|
|
//go:embed atlas.json
|
|
var DataJSON []byte
|
|
|
|
// Default builds the atlas from the embedded authored data, overlaying the
|
|
// given CI workflow (for the stage marked generate:ci-jobs).
|
|
func Default(workflow []byte) (Atlas, error) {
|
|
return Build(DataJSON, workflow)
|
|
}
|