cli

package
v1.4.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 10, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package cli wires together the CLI commands.

Index

Constants

View Source
const SchemaVersion = "1"

SchemaVersion is the stable JSON output schema version. Bump when the envelope shape changes in a backwards-incompatible way.

Variables

View Source
var Version = "dev"

Version is set at build time via -ldflags; defaults to "dev" for local builds.

Functions

func BuildGraph added in v1.1.2

func BuildGraph(absRoot string) (*graph.Graph, error)

func PrintJSON added in v1.4.10

func PrintJSON(env Envelope) int

PrintJSON serialises env to stdout as indented JSON and always exits cleanly (exit 0) unless Status is "error", in which case it exits 1. This function never returns.

func Run

func Run(args []string) int

Run is the entrypoint called from main.

Types

type Envelope added in v1.4.10

type Envelope struct {
	SchemaVersion string `json:"schema_version"`
	Command       string `json:"command"`
	Query         string `json:"query,omitempty"`
	// Status is "ok" (results found), "empty" (no results, symbol/query valid),
	// or "error" (hard failure — graph missing, parse error, etc.).
	Status  string      `json:"status"`
	Count   int         `json:"count,omitempty"`
	Results interface{} `json:"results,omitempty"`
	Error   string      `json:"error,omitempty"`
}

Envelope is the top-level JSON wrapper for all --json output. schema_version lets agents pin to a known schema and detect changes.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL