// Package main is the gaze CLI — the all-seeing eye of the Coven. // // Gaze answers inventory queries: file lists, tablet dumps, dependency // trees, reverse owner lookups, and SBOM exports. It is read-only by // design — the Warding keeps the data it inspects immutable. package main import ( "encoding/json" "flag" "fmt" "os" ) func main() { if len(os.Args) < 2 { usage() os.Exit(1) } switch os.Args[1] { case "install": install(os.Args[2:]) case "tablet": tablet(os.Args[2:]) case "depends": depends(os.Args[2:]) case "essence": essence(os.Args[2:]) case "whereis": whereis(os.Args[2:]) case "sbom": sbom(os.Args[2:]) case "help", "-h", "--help": usage() default: fmt.Fprintf(os.Stderr, "unknown subcommand: %s\n", os.Args[1]) os.Exit(2) } } func usage() { fmt.Print(`gaze — the all-seeing eye Usage: gaze install List every file owned by an Essence gaze tablet Show the y/n answers stored in the Tablet gaze depends Print the live dependency DAG gaze essence Show which spell+config produced this blob gaze whereis Reverse lookup: which spell owns this file gaze sbom [essence_id] Emit CycloneDX SBOM on stdout `) } func install(args []string) { fs := flag.NewFlagSet("install", flag.ExitOnError) _ = fs.Parse(args) if fs.NArg() < 1 { fmt.Fprintln(os.Stderr, "gaze install: missing spell name") os.Exit(2) } fmt.Printf("📜 Files owned by %s:\n (none — spell not cast yet)\n", fs.Arg(0)) } func tablet(args []string) { fs := flag.NewFlagSet("tablet", flag.ExitOnError) _ = fs.Parse(args) if fs.NArg() < 1 { fmt.Fprintln(os.Stderr, "gaze tablet: missing spell name") os.Exit(2) } fmt.Printf("📜 Tablet for %s: (no y/n answers recorded yet)\n", fs.Arg(0)) } func depends(args []string) { fs := flag.NewFlagSet("depends", flag.ExitOnError) _ = fs.Parse(args) if fs.NArg() < 1 { fmt.Fprintln(os.Stderr, "gaze depends: missing spell name") os.Exit(2) } fmt.Printf("📜 Dependency tree for %s: (empty grimoire)\n", fs.Arg(0)) } func essence(args []string) { fs := flag.NewFlagSet("essence", flag.ExitOnError) hashOnly := fs.Bool("hash-only", false, "print only the Merkle root") _ = fs.Parse(args) if fs.NArg() < 1 { fmt.Fprintln(os.Stderr, "gaze essence: missing essence id") os.Exit(2) } if *hashOnly { fmt.Println(fs.Arg(0)) return } fmt.Printf("📜 Essence %s: not found in Tomb\n", fs.Arg(0)) } func whereis(args []string) { fs := flag.NewFlagSet("whereis", flag.ExitOnError) _ = fs.Parse(args) if fs.NArg() < 1 { fmt.Fprintln(os.Stderr, "gaze whereis: missing file path") os.Exit(2) } fmt.Printf("📜 Owner of %s: orphaned (untracked)\n", fs.Arg(0)) } func sbom(args []string) { fs := flag.NewFlagSet("sbom", flag.ExitOnError) format := fs.String("format", "cyclonedx", "cyclonedx | spdx") _ = fs.Parse(args) out := map[string]interface{}{ "schema": "CycloneDX v1.4", "components": []interface{}{}, "format": *format, } enc := json.NewEncoder(os.Stdout) enc.SetIndent("", " ") _ = enc.Encode(out) }