cli/

directory
v0.182.4 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: Apache-2.0

README

CLI command packages

This directory is the target home for WB's shared CLI contracts, root composition, and isolated command families. The first extraction is cmdlayout; the remaining executable is being migrated incrementally under the command-family plan.

Command packages own argument parsing, option translation, result rendering and CLI error classification. Existing internal packages own operations. Keep the dependency direction from root composition to command family to operation; families must not import root composition or call sibling commands to perform work.

Shared contracts belong in internal/cli/shared, a leaf package that imports neither command families nor root composition. internal/cli can compose families without creating a cycle through their shared invocation/error types.

Each command factory owns fresh state. Read inherited flag values at execution time so defaults captured during construction do not discard user overrides. Use narrow functions or small consumer-owned interfaces for effectful operations. Production wiring belongs in the composition layer; deterministic command tests inject those same dependencies.

Test argument-to-option translation, invalid input, delegated failures, findings, output/report errors and invocation isolation in each command package. Use parallel tests and a family-local execution helper where possible. Real Git, filesystem, daemon and process tests belong at the operation boundary, with a small genuine executable journey suite to check wiring. Do not duplicate every command test at the root or introduce shared test helpers that import all command families.

When real read-only tests need the same repository, create it once in a parent test and reuse it across subtests. Finish setup before parallel subtests start, give each subtest its own command, options and output buffers, and use the parent's t.TempDir or t.Cleanup so cleanup runs after parallel children finish. Confirm the operation does not write files, Git metadata, configuration, caches or reports before sharing the directory. Mutating tests need their own writable fixture. Prefer injected operations for argument and rendering tests so they need no repository setup at all.

Extract complete command families and their tests together. Shared helpers should have concrete consumers and one tested contract; avoid a generic command engine, copied per-family exit policies, and broad interfaces over unrelated services. Every extracted command package must have 100% statement coverage. Root tests can still be invalidated by an importing family change, so they must remain cheap; package boundaries alone do not guarantee faster CI.

Directories

Path Synopsis
Package cmdagent owns agent arguments and report presentation.
Package cmdagent owns agent arguments and report presentation.
Package cmdbranch owns branch command arguments and report presentation.
Package cmdbranch owns branch command arguments and report presentation.
Package cmdcockpit binds Cockpit arguments and output to narrow operations.
Package cmdcockpit binds Cockpit arguments and output to narrow operations.
Package cmddisk binds disk-report arguments to the disk collection operation.
Package cmddisk binds disk-report arguments to the disk collection operation.
Package cmdfleet owns fleet command arguments and presentation.
Package cmdfleet owns fleet command arguments and presentation.
Package cmdmigrate owns migration argument policy and command-local presentation.
Package cmdmigrate owns migration argument policy and command-local presentation.
Package cmdrepo constructs the complete single-repository command family.
Package cmdrepo constructs the complete single-repository command family.
Package cmdstream constructs all stream verbs with isolated operation bindings.
Package cmdstream constructs all stream verbs with isolated operation bindings.
Package cmdtask binds task arguments and presentation to task workflows.
Package cmdtask binds task arguments and presentation to task workflows.
Package cmdversion renders version metadata supplied by the build domain.
Package cmdversion renders version metadata supplied by the build domain.
Package cmdwait owns the complete wait command registry and presentation.
Package cmdwait owns the complete wait command registry and presentation.
Package cmdworker owns worker command arguments and announcements.
Package cmdworker owns worker command arguments and announcements.
Package sessionview renders the concrete session-move result used by session and task commands.
Package sessionview renders the concrete session-move result used by session and task commands.
Package shared defines the small contracts used by independent CLI families.
Package shared defines the small contracts used by independent CLI families.
Package statusview presents reusable local repository status commands.
Package statusview presents reusable local repository status commands.

Jump to

Keyboard shortcuts

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