Skip to main content

Module commands

Module commands 

Source
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 -p additionally stages individual hunks interactively (see run_patch).
attest
mkit attest — produce a signed DSSE attestation for a commit.
attest_factory
Factory helpers for building a Signer from CLI / config inputs.
bisect
mkit bisect start|good|bad|reset|skip — binary-search a history for the commit that introduced a regression. Backing state + search logic live in mkit_core::ops::bisect.
blame
mkit blame <file> — line-level attribution against HEAD.
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, like git 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 (like git 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>] — like pull but does NOT move HEAD. Downloads every object reachable from each remote ref and updates the refs/remotes/<remote>/<name> tracking refs.
for_each_ref
mkit for-each-ref [--format=<fmt>] [<pattern>...] — iterate refs with an optional format string, like git for-each-ref.
gc
mkit gc — reclaim unreachable objects (mark-and-sweep prune).
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 key keystore 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, like git ls-files.
ls_tree
mkit ls-tree [-r] [-z] <tree-ish> [<path>...] — list the entries of a tree, like git 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).
mv
mkit mv <source>... <dest> — move or rename tracked paths, staging the change (like git mv).
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.
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_parse
mkit rev-parse [--verify] [--short[=N]] [--abbrev-ref] [--show-toplevel] [<rev>...] — resolve revisions to object ids, like git 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.
serve
mkit serve <path> — speak the mkit-rpc SSH protocol on stdin/stdout against a local repository.
show
mkit show [<object>...] — display objects (default HEAD).
show_ref
mkit show-ref [--heads] [--tags] — list refs as <hash> <refname>, like git 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 in mkit_core::ops::restore.
stash
mkit stash save|list|pop|drop|show — stash working-directory changes. Backing logic lives in mkit_core::ops::stash.
status
mkit status — show working-tree changes relative to HEAD.
symbolic_ref
mkit symbolic-ref [--short] <name> [<ref>] — read or write a symbolic ref (currently only HEAD), like git 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.
update_ref
mkit update-ref [-d] <ref> [<newvalue> [<oldvalue>]] — low-level guarded ref write/delete, like git 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.

Constants§

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 the repo rooted at root.
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
Open the object store for a mutating command, honoring the repo’s configured durability schedule (durability.objects, see crate::config::Config::object_sync_policy). Falls back to the 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 so mkit gc keeps it recoverable.
restore_worktree_and_index
Materialise tree_hash and align the index while preserving .mkitignore entries.
sync_index_to_tree
Rewrite .mkit/index so it exactly mirrors tree_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-mmr is enabled.