The repo prelude shared by most CLI subcommands: an open
Repository, its working directory, and the resolved
Config. Owned values so call sites keep borrowing &repo,
&workdir, &config exactly as they did when the triplet was
inlined.
Subcommands of gwm aliases (issue #86). Read-only for now —
declarative editing of the alias set stays in TOML files where
users can grep / diff / version-control them. A future add /
remove could land if real usage justifies it.
Discriminator for gwm hooks install <kind>. A ValueEnum (rather
than a free-form string) so clap rejects typos at parse time
(gwm hooks install commit-msge → “invalid value … expected one
of: commit-msg”) rather than letting the installer fail with a
less-actionable error.
Subcommands of gwm hooks (issue #85). The split anticipates
future hook variants (pre-push, pre-commit); for now only
install commit-msg is wired up, which is the directly-load-bearing
surface for the auto-prefix workflow.
Subcommands of gwm labels. The split is intentional: list is
read-only and safe to run in CI; push mutates the remote and
therefore gets --dry-run / --prune flags of its own.
Subcommands of gwm milestones. Mirrors LabelsAction: list is
read-only and safe to run in CI; push mutates the remote and
therefore gets --dry-run / --prune flags of its own.
Output format for commands that have only a human-readable text form
and a machine-readable JSON form (gwm path, gwm doctor — issue #38).
Distinct from ListFormat, which also carries the names variant.
Subcommands of gwm trust (issue #95). All three are read-only or
purely local — no network, no git mutation — so they’re safe to
surface in CI as inspection helpers.
Build the gwm status --json payload — a stable, hand-built schema for
scripting (frozen by tests/contract_tests.rs, documented in
docs/schema/status.schema.json, issue #317). Pure: returns the value so
the contract test can pin its shape without spawning the binary or hitting
GitHub. print-ing is the caller’s job.
Render one journal entry as a single line for gwm history. Shape:
<ago> <kind> <worktree> [(undone)]. Extracted as a pure
function so the formatter is unit-testable without spinning up a
real journal (see cli_format_tests.rs).
Render the would-do plan for gwm prune --dry-run (issue #31).
Extracted from cmd_prune so the formatter is unit-testable on
arbitrary PrunableEntry fixtures (non-ASCII names / paths
without needing a real repo). Pure function: trailing newline
included; empty input still emits the canonical
“0 worktree(s) to prune” line so piped consumers get a stable
signal instead of empty stdout.
Render the would-do plan for gwm remove --dry-run (issue #31).
Extracted from cmd_remove so the formatter is unit-testable
without spinning up a real worktree. Pure function: takes the
resolved name + path + branch, returns a multi-line string
(trailing newline included).
Render a successful SyncReport as a single ✓ status line. The
error paths (dirty tree, missing upstream, conflicts) surface as
GwmError and are printed by main’s top-level handler, so this
only ever formats the success cases.
Like repo_context, but tolerates a missing or malformed
.gwm.toml by falling back to Config::default. The repo and
workdir gates stay strict — only the config load is lenient.
Used by gwm doctor, which must run even when the config it is
about to diagnose is broken.