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, creating the branch from --base (default: the trunk) when it does not exist. 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
- 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 worktreeVerified by the example tests: exits 0; prints branch, worktree, container.
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.