majordomus worktree
The branch-to-worktree topology: where every linked worktree belongs (`<repo>-wt/<branch>`), where each one is, and the lifecycle — create, migrate, repair, guard
majordomus worktree
Usage
majordomus worktree [OPTIONS] [COMMAND]Commands
- majordomus worktree status Where this call is — branch, worktree, canonical or not, uncommitted work — and how many errors the whole topology carries; exit 10 when this worktree is out of place
- majordomus worktree list Every registered worktree with its standing, one line each; exit 10 when the topology has an error
- majordomus worktree topology The whole topology: repository, container, trunk, every worktree, every branch without a worktree, every diagnostic; exit 10 when it has an error
- majordomus worktree root Print the container every linked worktree belongs under, and nothing else: `cd "$(majordomus worktree root)"`
- majordomus worktree path Print the canonical path of a branch, and nothing else: `cd "$(majordomus worktree path feature/x)"`. Derived from the name; the branch need not exist
- majordomus worktree inspect One branch: its canonical path, whether it exists, what occupies the path, the worktree holding it, and what stands in the way
- majordomus worktree create Create the canonical worktree of a branch. A branch that does not exist here is fetched from the trunk's remote and taken up when the remote has it; otherwise it is created from --base, else from the remote's trunk fetched now (the local trunk only when the remote cannot be read, and then said, with how far behind). The path is derived; none may be given
- majordomus worktree ensure The canonical worktree of a branch: created when absent, answered when present, refused when the branch is checked out somewhere else
- majordomus worktree migrate Bring every misplaced worktree to its canonical path, dirty state included, with a fingerprint taken before and after each move; --plan shows the steps and changes nothing
- majordomus worktree validate Every error of the topology, and nothing else; exit 10 when there is one
- majordomus worktree doctor Every diagnostic of the topology, errors, warnings and facts, each with its code and remedy; exit 10 when there is an error
- majordomus worktree guard May a mutation proceed from here? Exit 0 in a canonical worktree, in the primary checkout on the trunk, or detached; exit 10 with the reason otherwise. What the pre-commit hook asks
- majordomus worktree repair Drop git's registrations of worktrees whose directories are gone, and repair the administrative links of the ones that exist. Deletes no directory
- majordomus worktree remove Remove one linked worktree by branch or path. Never the primary checkout, never a branch, never uncommitted work without --force
- majordomus worktree cleanup The branches merged into the trunk whose worktree is clean or absent: what could be removed. Removes nothing without --remove
- majordomus worktree uncommitted Every linked worktree holding uncommitted work: how many paths, how old the oldest change, what holds it (an active task, an open episode, a process inside) and whether it is abandoned, with the command that would put it on a remote ref. Reads every worktree and writes none
- majordomus worktree trunk How far this checkout and the local trunk are from the remote trunk, as of the last fetch, judged against the policy's checkout.trunk_distance: current, lagging, stale, unjudged or unmeasured, with the commands that bring it current. Fetches nothing; exit 10 when stale
- majordomus worktree branches Every local branch, one per line, for a shell completion that wants the live set
Arguments
| argument | value | default | description |
|---|---|---|---|
| --repo | <PATH> | — | Start the search for the repository root here (default: the current directory) (accepted by every subcommand) |
| --discovery | vcs | filesystem | vcs | How declarative files are enumerated (accepted by every subcommand)
|
| --strict | flag | — | Refuse to proceed when any file of the layer carries an error diagnostic (accepted by every subcommand) |
| --share | <DIR> | — | The tool distribution's share directory (kinds.yaml, schemas/); default: $MAJORDOMUS_SHARE, then the repository's own share/, then the one beside the executable (accepted by every subcommand) |
| --format | text | json | text | Output shape (accepted by every subcommand)
|
Examples
-
Where am I, and is that where I belong?
`worktree` with nothing after it answers the question a worker asks before starting: which branch this is, whether this directory is that branch's canonical worktree (or the primary checkout on the trunk), what is uncommitted here, and how many errors the whole topology carries. The same answer from the primary checkout and from four directories deep inside a linked worktree.
$ majordomus worktreeWhat it asserts: exits 0; prints branch, worktree, container.
Tested by apps/majordomus-cli/tests/cli_examples.rs, which runs the command against the built executable and asserts what the page states.
Where this comes from
Declared once in apps/majordomus-cli/src/cli.rs: clap for the structure, typed Rust metadata beside it for the examples. This page, majordomus worktree --help, docs/generated/cli.md and docs/generated/cli.json are projections of that one declaration.
The whole command line on one page: the registry's command-line page. The task lifecycle (init, start, finish, doctor, ...) belongs to the shell tool, a different program: Commands and its specification.