Skip to content

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 create

Usage

majordomus worktree create [OPTIONS] [BRANCH]

Arguments

argumentvaluedefaultdescription
<BRANCH> <BRANCH> — The branch, full name (`feature/improve-cli`)
--base <REF> — Start a new branch from this ref. Never fetched: it must resolve locally
--issue <ID> — Name the branch after this issue of .ai/repo/project/issues: `feature/<id>-<slug>`, the form the topology reads the issue back from
--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)
  • vcs — Tracked files, through the version-control index (the layer's contract); a layer none of which is tracked is read from the work tree
  • filesystem — A walk of the work tree with the same glob semantics; untracked files included
--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)
  • text — Lines for a person
  • json — One JSON document, deterministic

Examples

  • Start work on a branch without deciding where it goes

    Creates the branch `feature/improve-cli` from the trunk and checks it out in a new worktree at `<repository>-wt/feature/improve-cli`. No path is given and none may be: the destination follows from the repository's identity and the branch name, so the same command in the same repository always produces the same path — from the primary checkout, and from inside another worktree.

    $ majordomus worktree create feature/improve-cli

    What it asserts: exits 0; prints -wt/feature/improve-cli, feature/improve-cli (new.

    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 create --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.

Searches the titles and descriptions of every page this site publishes.