Analyze one or more Go packages (or a specific function) and report all observable side effects each function produces.
Side effects are categorized into priority tiers (P0–P4) from the side effect taxonomy. Use --classify to attach contractual classification labels (mechanical signals only). For document-enhanced classification, use the /gaze command in OpenCode (full mode).
gaze analyze [packages...] [flags]
| Argument | Required | Description |
|---|---|---|
packages... |
Yes (at least one) | One or more Go package import paths, relative paths, or patterns (e.g., ./internal/crap, ./..., github.com/foo/bar) |
At least one package argument is required. Wildcard patterns like ./... are expanded to all matching packages.
| Flag | Short | Type | Default | Description |
|---|---|---|---|---|
--format |
string |
text |
Output format: text or json |
|
--function |
-f |
string |
"" (all exported) |
Analyze a specific function by name |
--include-unexported |
bool |
false |
Include unexported (lowercase) functions in analysis | |
--interactive |
-i |
bool |
false |
Launch interactive TUI (Bubble Tea) for browsing results |
--classify |
bool |
false |
Classify side effects as contractual, incidental, or ambiguous | |
--verbose |
-v |
bool |
false |
Print full signal breakdown (implies --classify) |
--config |
string |
"" (search CWD) |
Path to .gaze.yaml config file |
|
--contractual-threshold |
int |
-1 (from config or 80) |
Override contractual confidence threshold | |
--incidental-threshold |
int |
-1 (from config or 50) |
Override incidental confidence threshold |
The following flags interact with .gaze.yaml:
| Flag | Config Key | Behavior |
|---|---|---|
--config |
— | Specifies the config file path. If omitted, Gaze searches for .gaze.yaml in the current working directory. |
--contractual-threshold |
classification.thresholds.contractual |
Overrides the config value when set. Valid range: 1–99. Must be greater than the incidental threshold. |
--incidental-threshold |
classification.thresholds.incidental |
Overrides the config value when set. Valid range: 1–99. Must be less than the contractual threshold. |
The --classify and --verbose flags trigger classification, which loads the config file. Without these flags, the config file is not read.
See Configuration Reference for all .gaze.yaml options.
gaze analyze ./internal/crapFunction: Formula
Package: github.com/unbound-force/gaze/internal/crap
Signature: func Formula(complexity int, coveragePct float64) float64
Location: internal/crap/crap.go:152:1
Side Effects:
[P0] ReturnValue: returns float64 value (se-a1b2c3d4)
gaze analyze ./internal/crap --classifySide effects are labeled contractual, incidental, or ambiguous based on mechanical signal analysis.
gaze analyze ./internal/crap -f Formula --verboseShows the full signal breakdown for each side effect, including individual signal sources (interface, visibility, caller, naming, godoc) and their weight contributions.
gaze analyze ./...Expands ./... to all packages in the module and reports side effects for every exported function across all packages.
gaze analyze ./internal/crap ./internal/loadergaze analyze ./internal/crap --format=json | jq '.results[0].side_effects'The JSON output conforms to the Analysis JSON Schema. Use gaze schema to print the full schema.
- Side Effects — the 37 effect types and 5 priority tiers
- Classification — how contractual/incidental labels are computed
- JSON Schemas — schema reference for
--format=jsonoutput - Configuration —
.gaze.yamloptions gaze schema— print the embedded JSON Schemagaze quality— assess how well tests cover the detected side effects