Skip to content

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 ensure

Usage

majordomus worktree ensure [OPTIONS] <BRANCH>

Arguments

argumentvaluedefaultdescription
<BRANCH> <BRANCH> required The branch, full name
--base <REF> Start a new branch from this ref (default: the trunk)
--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)
  • 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

  • The canonical worktree, whether or not it exists yet

    `ensure` is `create` for a caller that does not care whether the worktree is already there: it creates it when it is absent and answers the existing one when it is present. What a script or an agent runs before starting on a branch.

    $ majordomus worktree create feature/improve-cli
    $ majordomus worktree ensure feature/improve-cli

    Verified by the example tests: exits 0; prints exists, -wt/feature/improve-cli.

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