Documentation
¶
Overview ¶
Package cli is the aiwf binary's root-command assembly. cmd/aiwf/main.go is entry-only (per G-0107): main() calls Execute(os.Args[1:]) and exits with the returned code. Every verb is a Cobra subcommand registered from NewRootCmd; the verb bodies live under internal/cli/<verb>/.
Why this package exists separately from cmd/aiwf/: the cmd-package can only host the binary entry point. Other packages (notably internal/cli/doctor for --self-check) must be able to drive the dispatcher in-process, which is impossible across the cmd/aiwf boundary (no one can import a main package). The doctor.Dispatcher seam (wired by this package's init) is the bridge.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Version = "dev"
Version is the binary's reported version. The ldflags-stamped value (set by `make install` to `<branch>@<short-sha>[-dirty]`) takes precedence; when left at the default sentinel `"dev"`, the `aiwf version` verb falls back to runtime/debug.ReadBuildInfo via version.Current() so a `go install …@v0.1.0` binary correctly reports its tag.
The Makefile pins the ldflags target as `-X github.com/23min/aiwf/internal/cli.Version=…`.
Functions ¶
func Execute ¶
Execute is the in-process dispatcher: builds the Cobra root command tree, executes against the supplied args, returns the exit code. cmd/aiwf/main.go's main() is a thin shim that calls Execute(os.Args[1:]) and os.Exits with the result.
The doctor package's --self-check mode also reaches Execute via the doctor.Dispatcher seam (wired in init), so the dispatch path stays single-sourced.
Args here are everything after the binary name. AssertSupportedOS preflight runs here (and not in main) so the same guard fires for the doctor self-check path too. The command tree is built fresh per call so tests can drive Execute in parallel without shared mutable state.
func NewRootCmd ¶
NewRootCmd assembles the Cobra command tree. Every verb is a native Cobra command (E-14 left no passthrough adapters); each verb's flags are tab-completable per the drift-prevention rule in completion_drift_test.go.
Exported (rather than newRootCmd) because policy tests under internal/policies/ resolve top-level verb names by walking the AST of newRootCmd's AddCommand calls. The walker recognizes both `pkgIdent.NewCmd()` (subpackage) and `newXCmd()` (legacy) forms; keeping the entry point exported lets test callers in cmd/aiwf/ and any future cross-package consumer (binary integration tests, e.g.) build the tree the same way.
func ResolvedVersion ¶
func ResolvedVersion() string
ResolvedVersion returns the version to display in user output. Prefers the ldflags-stamped Version global when set to anything other than the default sentinel, otherwise defers to buildinfo via version.Current. The two paths surface different conventions for "no version known" (Version="dev" vs DevelVersion="(devel)"); we normalize by always returning the buildinfo-style value when no ldflags stamp is present, so `aiwf version` and `aiwf doctor`'s binary: row stay byte-coherent for the same binary.
Types ¶
This section is empty.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package add implements the `aiwf add` verb and its `aiwf add ac` subcommand (per-verb subpackage of M-0115; cmd/aiwf/main.go's newRootCmd wires it via NewCmd).
|
Package add implements the `aiwf add` verb and its `aiwf add ac` subcommand (per-verb subpackage of M-0115; cmd/aiwf/main.go's newRootCmd wires it via NewCmd). |
|
Package archive implements the `aiwf archive ` verb (per-verb subpackage of M-0116; cmd/aiwf/main.go's newRootCmd wires it via NewCmd).
|
Package archive implements the `aiwf archive ` verb (per-verb subpackage of M-0116; cmd/aiwf/main.go's newRootCmd wires it via NewCmd). |
|
Package authorize implements the `aiwf authorize ` verb (per-verb subpackage of M-0116; cmd/aiwf/main.go's newRootCmd wires it via NewCmd).
|
Package authorize implements the `aiwf authorize ` verb (per-verb subpackage of M-0116; cmd/aiwf/main.go's newRootCmd wires it via NewCmd). |
|
Package cancel implements the `aiwf cancel` verb.
|
Package cancel implements the `aiwf cancel` verb. |
|
Package check holds the check verb's body and the verb-level check-rule helpers that need git access.
|
Package check holds the check verb's body and the verb-level check-rule helpers that need git access. |
|
Package cliutil holds the verb-support kernel for aiwf's Cobra dispatchers: exit-code constants and the typed error shuttle, the post-verb apply path, identity resolution, flag re-ordering, repo locking, tree-loading with trunk-collision stamping, platform gating, and provenance gate-and-decorate plumbing.
|
Package cliutil holds the verb-support kernel for aiwf's Cobra dispatchers: exit-code constants and the typed error shuttle, the post-verb apply path, identity resolution, flag re-ordering, repo locking, tree-loading with trunk-collision stamping, platform gating, and provenance gate-and-decorate plumbing. |
|
testutil
Package testutil holds test-only helpers shared across the CLI test surface.
|
Package testutil holds test-only helpers shared across the CLI test surface. |
|
Package contract implements the `aiwf contract` verb and its subcommand graph (verify, bind, unbind, recipes, recipe show / install / remove).
|
Package contract implements the `aiwf contract` verb and its subcommand graph (verify, bind, unbind, recipes, recipe show / install / remove). |
|
Package doctor implements the `aiwf doctor` verb.
|
Package doctor implements the `aiwf doctor` verb. |
|
Package editbody implements the `aiwf edit-body` verb (per-verb subpackage of M-0115; cmd/aiwf/main.go's newRootCmd wires it via NewCmd).
|
Package editbody implements the `aiwf edit-body` verb (per-verb subpackage of M-0115; cmd/aiwf/main.go's newRootCmd wires it via NewCmd). |
|
Package history implements the `aiwf history ` verb (per-verb subpackage of M-0116; cmd/aiwf/main.go's newRootCmd wires it via NewCmd).
|
Package history implements the `aiwf history ` verb (per-verb subpackage of M-0116; cmd/aiwf/main.go's newRootCmd wires it via NewCmd). |
|
Package importcmd implements the `aiwf import` verb (per-verb subpackage of M-0116; directory and package are `importcmd` because `import` is a Go reserved word).
|
Package importcmd implements the `aiwf import` verb (per-verb subpackage of M-0116; directory and package are `importcmd` because `import` is a Go reserved word). |
|
Package initcmd implements the `aiwf init` verb (per-verb subpackage of M-0116; directory and package are `initcmd` because `init` is a special Go function name).
|
Package initcmd implements the `aiwf init` verb (per-verb subpackage of M-0116; directory and package are `initcmd` because `init` is a special Go function name). |
|
Package list implements the `aiwf list` verb (per-verb subpackage of M-0116; cmd/aiwf/main.go newRootCmd wires it via NewCmd).
|
Package list implements the `aiwf list` verb (per-verb subpackage of M-0116; cmd/aiwf/main.go newRootCmd wires it via NewCmd). |
|
Package milestone implements the `aiwf milestone` verb namespace.
|
Package milestone implements the `aiwf milestone` verb namespace. |
|
Package move implements the `aiwf move` verb (per-verb subpackage of M-0115; cmd/aiwf/main.go's newRootCmd wires it via NewCmd).
|
Package move implements the `aiwf move` verb (per-verb subpackage of M-0115; cmd/aiwf/main.go's newRootCmd wires it via NewCmd). |
|
Package promote implements the `aiwf promote` verb (per-verb subpackage of M-0115; cmd/aiwf/main.go's newRootCmd wires it via NewCmd).
|
Package promote implements the `aiwf promote` verb (per-verb subpackage of M-0115; cmd/aiwf/main.go's newRootCmd wires it via NewCmd). |
|
Package reallocate implements the `aiwf reallocate` verb (per-verb subpackage of M-0115; cmd/aiwf/main.go's newRootCmd wires it via NewCmd).
|
Package reallocate implements the `aiwf reallocate` verb (per-verb subpackage of M-0115; cmd/aiwf/main.go's newRootCmd wires it via NewCmd). |
|
Package rename implements the `aiwf rename` verb (per-verb subpackage of M-0115; cmd/aiwf/main.go's newRootCmd wires it via NewCmd).
|
Package rename implements the `aiwf rename` verb (per-verb subpackage of M-0115; cmd/aiwf/main.go's newRootCmd wires it via NewCmd). |
|
Package render implements the `aiwf render` verb (per-verb subpackage of M-0116; includes the Resolver moved from render_resolver.go).
|
Package render implements the `aiwf render` verb (per-verb subpackage of M-0116; includes the Resolver moved from render_resolver.go). |
|
Package retitle implements the `aiwf retitle ` verb (per-verb subpackage of M-0116; cmd/aiwf/main.go's newRootCmd wires it via NewCmd).
|
Package retitle implements the `aiwf retitle ` verb (per-verb subpackage of M-0116; cmd/aiwf/main.go's newRootCmd wires it via NewCmd). |
|
Package rewidth implements the `aiwf rewidth` verb (per-verb subpackage of M-0116; cmd/aiwf/main.go newRootCmd wires it via NewCmd).
|
Package rewidth implements the `aiwf rewidth` verb (per-verb subpackage of M-0116; cmd/aiwf/main.go newRootCmd wires it via NewCmd). |
|
Package schema implements the `aiwf schema ` verb (per-verb subpackage of M-0116; cmd/aiwf/main.go's newRootCmd wires it via NewCmd).
|
Package schema implements the `aiwf schema ` verb (per-verb subpackage of M-0116; cmd/aiwf/main.go's newRootCmd wires it via NewCmd). |
|
Package show implements the `aiwf show` verb (per-verb subpackage of M-0116; includes the show-scopes helpers moved from show_scopes.go).
|
Package show implements the `aiwf show` verb (per-verb subpackage of M-0116; includes the show-scopes helpers moved from show_scopes.go). |
|
Package status implements the `aiwf status` verb (per-verb subpackage of M-0116).
|
Package status implements the `aiwf status` verb (per-verb subpackage of M-0116). |
|
Package template implements the `aiwf template ` verb (per-verb subpackage of M-0116; cmd/aiwf/main.go's newRootCmd wires it via NewCmd).
|
Package template implements the `aiwf template ` verb (per-verb subpackage of M-0116; cmd/aiwf/main.go's newRootCmd wires it via NewCmd). |
|
Package update implements the `aiwf update ` verb (per-verb subpackage of M-0116; cmd/aiwf/main.go's newRootCmd wires it via NewCmd).
|
Package update implements the `aiwf update ` verb (per-verb subpackage of M-0116; cmd/aiwf/main.go's newRootCmd wires it via NewCmd). |
|
Package upgrade implements the `aiwf upgrade` verb (per-verb subpackage of M-0116; cmd/aiwf/main.go newRootCmd wires it via NewCmd).
|
Package upgrade implements the `aiwf upgrade` verb (per-verb subpackage of M-0116; cmd/aiwf/main.go newRootCmd wires it via NewCmd). |
|
Package whoami implements the `aiwf whoami ` verb (per-verb subpackage of M-0116; cmd/aiwf/main.go's newRootCmd wires it via NewCmd).
|
Package whoami implements the `aiwf whoami ` verb (per-verb subpackage of M-0116; cmd/aiwf/main.go's newRootCmd wires it via NewCmd). |