Help us shape the future of Go! Take the 2026 Go Developer Survey

cmdinventory

command
v1.4.13 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Command cmdinventory prints the CLI's real command tree.

Purpose: make SPORT F02, the wiki, the parity matrix and the command

registry generated from the binary rather than hand-maintained.
Every previous count in the docs was typed by a human and had
drifted (F02 and the PRI both claimed 84 when the binary
registered more).

Inputs: -format json|markdown|names|registry|canon, -depth N (0 = top

level only), -hidden, -prose-from FILE (canon: keep the PROSE block
of an earlier Command-Canon.md).

Outputs: the command tree on stdout. json, markdown and names are

projections of the command registry (internal/cmdregistry) in the
historical inventory shape, byte-identical to the former walker.
registry writes the registry document itself (contract
cli.command-registry v1) behind a first `_generated` key, as the
v1.5 contract that .github/command-registry.json commits.
canon writes .github/wiki/Command-Canon.md: every old spelling,
its new path, kind, since and removal release (internal/canon rows).

Mode: the tool documents the v1.5 surface. run sets NSELF_V15=1 for

the duration of a render (compat.V15 reads the environment on every
call) and calls commands.PrepareTreeForGeneration before building
anything, so the tree is the relocated v1.5 tree with builtin
families only and never an installed plugin (generated output is
hermetic), whatever the ambient mode of the caller.
Entries with canon "plugin" are dropped from the inventory
projection: they are documented by their plugin, not by core.

Constraints: imports cmd/commands so the source of truth is the same cobra

registration the shipped binary uses and the same registry build
`nself help --json` serves; no separate parser to drift.
Read-only: never mutates the tree. The json format keeps HTML
escaping (the committed inventory has it); registry does not.

Jump to

Keyboard shortcuts

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