Expand description
Subcommand implementations. Each top-level command is its own module.
Dispatch lives in main.rs; business logic lives in library
crates; this module is the thin presentation shim.
Modules§
- add
mkit add <path>/mkit add .— stage a file (or the whole worktree) into.mkit/index.add -padditionally stages individual hunks interactively (seerun_patch).- attest
mkit attest— produce a signed DSSE attestation for a commit.- attest_
factory - Factory helpers for building a
Signerfrom CLI / config inputs. - bisect
mkit bisect start|good|bad|reset|skip|run— binary-search a history for the commit that introduced a regression. Backing state + search logic live inmkit_core::ops::bisect.- blame
mkit blame [-w] [-M] [-C] [--ignore-rev <rev>] [--ignore-revs-file <file>] [--ignore-rev-precise] [--first-parent] [--reverse] [<rev>] [-L <range>] <file>— line-level attribution.- branch
mkit branch— list / create / delete branches.- cat
mkit cat <hash>— decode and print an object by its hash.- cat_
file mkit cat-file (-t | -s | -p) <object>— inspect an object, likegit cat-file.- checkout
mkit checkout <branch>— switch HEAD to a branch and materialise the branch tip’s tree into the working directory.- cherry_
pick mkit cherry-pick <commit> | --continue | --abort— replay a single commit onto HEAD, with a resolvable-conflict workflow (#177).- clean
mkit clean— remove untracked files from the worktree (likegit clean).- clone
mkit clone <url> [<dir>]— initialise a new repo and pull from the URL. The destination defaults to the final path segment of the URL when<dir>is omitted.- commit
mkit commit— build a signed commit object from the staging index.- config_
cmd mkit config— show or set values.- conflict
- Shared CLI helpers for the resolvable-conflict workflow (#177).
- diff
mkit diff— show changes as a unified patch.- fetch
mkit fetch [<remote>]— likepullbut does NOT move HEAD. Downloads every object reachable from each remote ref and updates therefs/remotes/<remote>/<name>tracking refs.- for_
each_ ref mkit for-each-ref [--format=<fmt>] [<pattern>...]— iterate refs with an optional format string, likegit for-each-ref.- gc
mkit gc— reclaim unreachable objects (mark-and-sweep prune).- git
mkit git— the git bridge subcommands (featuregit-bridge): deterministic export to git mirrors (SPEC-GIT-BRIDGE) and, as the phases land, importer-signed import (SPEC-GIT-IMPORT).- git_
import mkit git import/mkit git fetch/mkit git pull— the importer-signed git→mkit direction (SPEC-GIT-IMPORT; featuregit-bridge).- git_
tools mkit git verify/status/format-patch(featuregit-bridge): bridge-state inspection and audit.- hash_
cmd mkit hash <file>— hash a file as a blob, store it, print the hash.- init
mkit init— create a fresh repository rooted at the current dir.- key
mkit keykeystore management commands.- keygen
mkit keygen— generate a fresh signing key for one of the three attestation algorithms.- log
mkit log [<rev>] [<A>..<B> | <A>...<B>]— walk commit history.- ls_
files mkit ls-files [-s] [-z] [--others] [--ignored] [--exclude-standard]— list files in the index or untracked worktree files, likegit ls-files.- ls_tree
mkit ls-tree [-r] [-z] <tree-ish> [<path>...]— list the entries of a tree, likegit ls-tree.- mcp
mkit mcp— a local Model Context Protocol server over stdio.- merge
mkit merge <branch> | --continue | --abort— merge a branch into HEAD, with a resolvable-conflict workflow (#177).- merge_
base mkit merge-base [--is-ancestor] <a> <b>— print the best common ancestor of two commits, or test ancestry. Reuses the merge engine’sfind_merge_base/is_ancestor(the algorithms already powermerge/rebase). Object ids are full 64-hex BLAKE3 (the documented hash-length divergence); everything else matches git.- mv
mkit mv <source>... <dest>— move or rename tracked paths, staging the change (likegit mv).- pack_
shard mkit pack-shard <hash>— encode an existing pack into Reed-Solomon shards plus a manifest.- pull
mkit pull [<remote>]— fetch refs from the configured remote (named, or the flat default) and fast-forward the current branch.- push
mkit push— push refs/packs to a remote with CAS safety.- rebase
mkit rebase [-i] <revspec> | --continue | --abort | --skip— replay commits onto a different base. The target is resolved through the shared revspec resolver, so a branch, tag,HEAD~n, or full/short hash all work.- ref_cmd
mkit ref list [--pattern <glob>]/mkit ref cat <name>— stable ref-inspection plumbing (#652).- reflog
mkit reflog [<ref>]— read-only view over the persisted ref-history journal (issue #231).- remote
mkit remote— show / add / set the configured remote.- reset
mkit reset [--soft|--mixed] [<commit>]— move the current branch (or detached HEAD) to<commit>, optionally resetting the index.- restore
mkit restore [--staged] [--worktree] [--source <rev>] [-f] <path>...— discard worktree changes for path(s), or unstage them.- rev_
list mkit rev-list [--count] <rev>— list the commit ids reachable from<rev>in reverse-chronological (topological) order, or just their count. Reuseslog’s ordered walk so ordering matchesmkit log. Object ids are full 64-hex BLAKE3 (the documented divergence).- rev_
parse mkit rev-parse [--verify] [--short[=N]] [--abbrev-ref] [--show-toplevel] [<rev>...]— resolve revisions to object ids, likegit rev-parse.- revert
mkit revert <commit> | --continue | --abort— create a new commit that undoes a previous commit, with the resolvable-conflict workflow.- revspec
- Shared revision-spec resolver (issue #227, parent #226).
- rm
mkit rm <pathspec>...— remove paths from the worktree and stage the deletion for the next commit.- self_
update mkit self— self-management of an installer-managed mkit binary.- serve
mkit serve <path>— speak the mkit-rpc SSH protocol on stdin/stdout against a local repository.- show
mkit show [<object>...]— display objects (defaultHEAD).- show_
ref mkit show-ref [--heads] [--tags]— list refs as<hash> <refname>, likegit show-ref. Output is sorted by full ref name; the hash is a 64-hex BLAKE3 id (vs git’s 40-hex SHA-1).- sparse_
checkout mkit sparse-checkout set|list|disable|reapply— manage the sparse checkout pattern set at.mkit/sparse-checkout. Pattern parsing + tree-materialisation live inmkit_core::ops::restore.- stash
mkit stash save|list|pop|drop|show— stash working-directory changes. Backing logic lives inmkit_core::ops::stash.- status
mkit status— show working-tree changes relative to HEAD.- summary
- Shared git-shaped post-commit summary: the
[<branch> <hash>] <subject>headline, the diffstat, and thecreate/delete modetrailers. Used by commit / cherry-pick / revert / merge so their human output matches git’s. All lines go to the caller-provided writer (the commands route it to stderr, per mkit’s channel rule). - switch
mkit switch— git’s modern branch-switch UX, a thin front-end overmkit checkout.switch <branch>switches to an existing branch;switch -c <new> [<start>]creates a branch and switches to it;switch -C <new> [<start>]creates-or-resets it. All the safety guards and output strings come fromcheckoutunchanged.- symbolic_
ref mkit symbolic-ref [--short] <name> [<ref>]— read or write a symbolic ref (currently onlyHEAD), likegit symbolic-ref.- tag
mkit tag— list / create / delete tags.- tree
mkit tree— snapshot the working directory as a tree object, printing the resulting tree hash.- trust
mkit trust— manage the commit-history allowed-signers file thatmkit verify --trustedcross-checks a commit/remix/tag’ssigneragainst.- trust_
roots - Shared trust-roots TOML file model.
- update_
ref mkit update-ref [-d] <ref> [<newvalue> [<oldvalue>]]— low-level guarded ref write/delete, likegit update-ref.- verify
mkit verify <rev>— verify the signature on a commit, remix, or signed tag.- verify_
attest mkit verify-attest— verify every attestation attached to a commit.- worktree
mkit worktree— manage linked working trees (#493 Phase 2).
Constants§
- WORKTREES_
REGISTRY_ LOCK - Basename of the common-dir lock serialising linked-worktree
registry mutations (
worktree add/remove/prune), the branch-checkout guard + HEAD-write critical sections (checkout/switch,branch -d/-m), and gc’s freeze of the worktree set. Distinct fromWORKTREE_LOCK, which guards ONE tree’s worktree/index state. - WORKTREE_
LOCK - Basename of the repo-level lock that serialises worktree/index
read-modify-write commands (
add,rm,commit,merge,checkout,rebase,cherry-pick,stash,sparse-checkout).
Functions§
- acquire_
worktree_ lock - Acquire the shared worktree/index lock for this worktree.
- acquire_
worktrees_ registry_ lock - Acquire the shared worktree-registry lock (common dir).
- delete_
ref_ dropping_ history mkit branch -mhelper: deletes the OLD name’s ref after a rename and, on--features history-mmrbuilds, also destroys its history-MMR journal partition (issue #648).- delete_
ref_ dropping_ history_ if_ matches - CAS-guarded sibling of
delete_ref_dropping_history(issue #658): only deletesbranch(and, on--features history-mmrbuilds, destroys its journal) if its current value is exactlyexpected. - delete_
ref_ recording_ history mkit branch -d/-Dhelper: deletes a branch ref and, on--features history-mmrbuilds, also destroys its history-MMR journal partition (issue #648). Refuses the checked-out branch, same as plainrefs::delete_ref_safe.- ensure_
restore_ safe - Refuse a destructive restore when the index/worktree contains user work.
- ensure_
restore_ safe_ with_ options - Refuse a destructive restore when affected index/worktree paths contain user work.
- head_
branch_ name - Current branch name for recovery logging — empty for a detached HEAD or an unreadable/symbolic-only HEAD.
- not_
yet_ ported - Shared helper: emit a “not yet wired” notice and return the tempfail exit code. Commands whose backing state-machines haven’t been wired into the CLI yet say so honestly rather than pretending to work.
- open_
store_ configured - batched default when the config cannot be read — a broken config must not change write semantics silently, and Batch is the default contract.
- read_
or_ seed_ index_ from_ head - Read the index, seeding an absent/empty one from HEAD when possible.
- record_
superseded - Record
superseded(the old branch tip a history-rewriting op is about to replace) in the recovery log somkit gckeeps it recoverable. - resolve_
layout - Resolve the
RepoLayouta command operates on (#493 Phase 1): pointer-following discovery. A.mkitDIRECTORY (or none at all) resolves to the classic single-worktree layout exactly as before; a.mkitpointer FILE resolves to the linked tree’s split layout. On a broken pointer the error has already been printed and the returned code is the exit status to propagate — a broken linked tree must never silently operate on the wrong directory. Command code must obtain its layout HERE and never construct one ad hoc. - restore_
worktree_ and_ index - Materialise
tree_hashand align the index while preserving.mkitignoreentries. - stage_
removed_ tombstones - After staging a
result_tree(which, being a tree, omits removed paths), addRemovedtombstones to the index for every path present inbase_treebut absent fromresult_tree. - sync_
index_ to_ tree - Rewrite
.mkit/indexso it exactly mirrorstree_hash. - usage_
error - Shared helper: print a usage error and return the USAGE exit code.
- write_
ref_ recording_ history - CLI-side ref-write helper that records every advance in the
branch’s history MMR when
history-mmris enabled.