Artifact ba314bb3420a90ddc747e2de13aec4a8a0cf5f8123ee6aef34f4a231284f8e9e:
- File
cmd/quarry/main.go
— part of check-in
[cfd3f85ff3]
at
2026-08-14 22:29:35
on branch trunk
— OpenAPI reflector over the registry (dagnats 0.0.13)
quarry spec subcommand, RegisterAll with meta.version, required Op.Doc, validate rules feed schemas; make spec-lint via vacuum. (user: dmestas, size: 1131) [annotate] [blame] [check-ins using]
// quarry is a multi-repository forge for zit. See docs/rfcs/. package main import ( "encoding/json" "fmt" "os" "craftdesign.group/quarry/internal/api" "craftdesign.group/quarry/internal/ops" ) // version is stamped at build time; every page footer and the API report it // (0001 Principle 1). var version = "0.0.0-dev" func main() { if len(os.Args) > 1 { switch os.Args[1] { case "version": fmt.Println("quarry", version) return case "spec": if err := printSpec(os.Stdout); err != nil { fmt.Fprintln(os.Stderr, "quarry:", err) os.Exit(1) } return } } fmt.Fprintln(os.Stderr, "usage: quarry version|spec (serve arrives with phase 1)") os.Exit(2) } // printSpec emits the OpenAPI document generated from the full registry — // the same registry serve will run, so the spec cannot drift (0001 §9). func printSpec(w *os.File) error { r := ops.NewRegistry() if err := api.RegisterAll(r, version); err != nil { return err } spec, err := ops.Spec(r, "quarry", version) if err != nil { return err } enc := json.NewEncoder(w) enc.SetIndent("", " ") return enc.Encode(spec) }