Files
markitect-tool/docs/cli-reference.md
2026-05-14 22:05:34 +02:00

1063 lines
20 KiB
Markdown

# Markitect CLI Reference
Generated from the Click command tree.
## `mkt`
Markdown-native toolkit for structured knowledge artifacts.
```text
mkt [OPTIONS] COMMAND [ARGS]...
```
Parameters:
- `--version` - Show the version and exit.
## `mkt ast`
Inspect parsed Markdown ASTs and parser summaries.
```text
ast [OPTIONS] COMMAND [ARGS]...
```
## `mkt ast show`
Show a parsed Markdown AST without requiring a cache.
```text
show [OPTIONS] FILE
```
Parameters:
- `FILE` - Required.
- `--format` -
## `mkt ast stats`
Summarize parsed Markdown AST shape and token distribution.
```text
stats [OPTIONS] FILE
```
Parameters:
- `FILE` - Required.
- `--format` -
## `mkt backend`
Inspect optional backend manifests and snapshot identities.
```text
backend [OPTIONS] COMMAND [ARGS]...
```
## `mkt backend inspect`
Inspect one backend manifest and optional compatibility check.
```text
inspect [OPTIONS] BACKEND_ID
```
Parameters:
- `BACKEND_ID` - Required.
- `--path` - Backend manifest file or directory. Defaults to .markitect/backends and .markitect/backend.yaml.
- `--require` - Required capability to check. May be repeated.
- `--format` -
## `mkt backend list`
List registered optional backend manifests.
```text
list [OPTIONS]
```
Parameters:
- `--path` - Backend manifest file or directory. Defaults to .markitect/backends and .markitect/backend.yaml.
- `--capability` - Only show backends that declare this capability.
- `--format` -
## `mkt backend refresh-plan`
Plan cheap-first snapshot and index refresh work.
```text
refresh-plan [OPTIONS] PATHS...
```
Parameters:
- `PATHS` - Required.
- `--root` - Root used for relative source paths.
- `--state` - YAML/JSON snapshot state file from a previous backend run.
- `--no-recursive` - Do not recurse into directories.
- `--verify-hashes` - Hash metadata-changed files to avoid unnecessary parse/index work.
- `--parse-option` - Parse option included in the identity comparison.
- `--contract-hash` - Optional contract hash included in identity comparison.
- `--format` -
## `mkt backend snapshot-id`
Compute a read-only content-addressed snapshot identity for a file.
```text
snapshot-id [OPTIONS] FILE
```
Parameters:
- `FILE` - Required.
- `--parse-option` - Parse option included in the snapshot identity hash.
- `--contract-hash` - Optional contract hash included in the snapshot identity.
- `--format` -
## `mkt cache`
Fingerprint Markdown files and detect changed inputs.
```text
cache [OPTIONS] COMMAND [ARGS]...
```
## `mkt cache build`
Build or refresh a lightweight Markdown cache manifest.
```text
build [OPTIONS] PATHS...
```
Parameters:
- `PATHS` - Required.
- `--root` - Root used for relative cache paths.
- `--cache-path` - Cache manifest path. Defaults to .markitect/cache/manifest.json under root.
- `--no-recursive` - Do not recurse into directories.
- `--dry-run` - Report manifest without writing it.
- `--format` -
## `mkt cache fingerprint`
Fingerprint one Markdown file.
```text
fingerprint [OPTIONS] FILE
```
Parameters:
- `FILE` - Required.
- `--root` - Root used for relative cache paths.
- `--format` -
## `mkt cache index`
Build or refresh the local SQLite snapshot/index store.
```text
index [OPTIONS] PATHS...
```
Parameters:
- `PATHS` - Required.
- `--root` - Root used for relative index paths.
- `--index-path` - SQLite index path. Defaults to .markitect/cache/index.sqlite3 under root.
- `--no-recursive` - Do not recurse into directories.
- `--no-verify-hashes` - Do not hash metadata-changed files before parsing.
- `--parse-option` - Parse option included in the snapshot identity hash.
- `--contract-hash` - Optional contract hash included in snapshot identity.
- `--format` -
## `mkt cache init`
Initialize the local SQLite snapshot/index store.
```text
init [OPTIONS]
```
Parameters:
- `--root` - Root used for the default local index path.
- `--index-path` - SQLite index path. Defaults to .markitect/cache/index.sqlite3 under root.
- `--format` -
## `mkt cache query`
Run a selector or JSONPath query over indexed document snapshots.
```text
query [OPTIONS] SELECTOR
```
Parameters:
- `SELECTOR` - Required.
- `--root` - Root used for the default local index path.
- `--index-path` - SQLite index path. Defaults to .markitect/cache/index.sqlite3 under root.
- `--path` - Restrict query to one or more indexed relative paths.
- `--policy` - Local label policy file used to filter results.
- `--subject` - Policy subject id.
- `--policy-mode` - Override policy mode for this query.
- `--engine` - Query engine to use.
- `--format` -
## `mkt cache status`
Report changed, new, unchanged, and deleted Markdown files.
```text
status [OPTIONS] PATHS...
```
Parameters:
- `PATHS` - Required.
- `--root` - Root used for relative cache paths.
- `--cache-path` - Cache manifest path. Defaults to .markitect/cache/manifest.json under root.
- `--no-recursive` - Do not recurse into directories.
- `--format` -
## `mkt class`
Resolve deterministic content classes.
```text
class [OPTIONS] COMMAND [ARGS]...
```
## `mkt class resolve`
Resolve content class inheritance and merged slots.
```text
resolve [OPTIONS] CLASS_FILE CLASS_NAME
```
Parameters:
- `CLASS_FILE` - Required.
- `CLASS_NAME` - Required.
- `--format` -
## `mkt completion`
Generate shell completion for Bash, Zsh, or Fish.
```text
completion [OPTIONS] {bash|zsh|fish}
```
Parameters:
- `SHELL` - Required.
- `--program-name` - Installed executable name used by the shell completion script.
- `--instructions` - Print installation instructions instead of the completion script.
## `mkt compose`
Compose multiple Markdown files into one document.
```text
compose [OPTIONS] FILES...
```
Parameters:
- `FILES` - Required.
- `--title` - Add a top-level title before composed files.
- `--heading-delta` - Shift heading levels in each input before composing.
- `--include-frontmatter` - Keep each input file's frontmatter in the composed body.
- `--output` - Write composed Markdown to a file.
- `--format` -
## `mkt context`
Pack and activate agent working-memory context.
```text
context [OPTIONS] COMMAND [ARGS]...
```
## `mkt context activate`
Activate a saved context package as Markdown working memory.
```text
activate [OPTIONS] PACKAGE
```
Parameters:
- `PACKAGE` - Required.
- `--root` - Root used for the local context registry.
- `--target` - Thread/workspace activation target.
- `--max-items` - Maximum context items to activate.
- `--max-tokens` - Approximate maximum activation tokens.
- `--reserve-tokens` - Token reserve inside max tokens.
- `--policy` - Local label policy file used to re-check items before activation.
- `--subject` - Policy subject id.
- `--policy-mode` - Override policy mode while activating.
- `--action` - Policy action used while activating.
- `--format` -
## `mkt context deactivate`
Deactivate a recorded context activation.
```text
deactivate [OPTIONS] ACTIVATION_ID
```
Parameters:
- `ACTIVATION_ID` - Required.
- `--root` - Root used for the local context registry.
- `--format` -
## `mkt context explain`
Explain context package contents, retrieval, budget, and policy metadata.
```text
explain [OPTIONS] PACKAGE
```
Parameters:
- `PACKAGE` - Required.
- `--root` - Root used for the local context registry.
- `--format` -
## `mkt context list`
List locally saved context packages.
```text
list [OPTIONS]
```
Parameters:
- `--root` - Root used for the local context registry.
- `--format` -
## `mkt context pack`
Create an inspectable context package from a query, search, or manifest.
```text
pack [OPTIONS] QUERY_OR_MANIFEST
```
Parameters:
- `QUERY_OR_MANIFEST` - Required.
- `--source` - Markdown source file to query directly. May be repeated.
- `--root` - Root used for relative paths and the local context registry.
- `--index-path` - SQLite index path. Defaults to .markitect/cache/index.sqlite3 under root.
- `--search` - Treat the argument as an FTS search query.
- `--path` - Restrict indexed query/search to relative paths.
- `--engine` - Query engine for selector packages.
- `--limit` - Maximum FTS search matches.
- `--title` - Package title.
- `--intent` - Package intent statement.
- `--project` - Project namespace.
- `--user` - User namespace.
- `--agent` - Agent namespace.
- `--thread` - Thread namespace.
- `--task` - Task namespace.
- `--namespace` - Custom namespace key.
- `--max-items` - Maximum context items to include.
- `--max-tokens` - Approximate maximum package tokens.
- `--reserve-tokens` - Token reserve inside max tokens.
- `--policy` - Local label policy file used to filter package items.
- `--subject` - Policy subject id.
- `--policy-mode` - Override policy mode while packing.
- `--action` - Policy action used while packing.
- `--output` - Write package to this file.
- `--no-save` - Do not save to the local context registry.
- `--format` -
## `mkt context refresh`
Refresh a package by re-running its retrieval recipes.
```text
refresh [OPTIONS] PACKAGE
```
Parameters:
- `PACKAGE` - Required.
- `--root` - Root used for the local context registry.
- `--policy` - Local label policy file used to filter refreshed package items.
- `--subject` - Policy subject id.
- `--policy-mode` - Override policy mode while refreshing.
- `--action` - Policy action used while refreshing.
- `--no-save` - Do not save the refreshed package.
- `--format` -
## `mkt contract`
Work with Markdown document contracts.
```text
contract [OPTIONS] COMMAND [ARGS]...
```
## `mkt contract check`
Check a Markdown file against a Markdown document contract.
```text
check [OPTIONS] FILE
```
Parameters:
- `FILE` - Required.
- `--contract` - Required.
- `--format` -
- `--context` - YAML or JSON runtime context used for field prefill and dynamic rules.
## `mkt contract form-state`
Evaluate UI-neutral form state for a document contract.
```text
form-state [OPTIONS] FILE
```
Parameters:
- `FILE` - Required.
- `--contract` - Required.
- `--context` - YAML or JSON runtime context used for field prefill and dynamic rules.
- `--format` -
## `mkt contract validate`
Validate that a Markdown contract file is well formed.
```text
validate [OPTIONS] CONTRACT_FILE
```
Parameters:
- `CONTRACT_FILE` - Required.
- `--format` -
## `mkt docs`
Generate CLI and API reference documentation.
```text
docs [OPTIONS] COMMAND [ARGS]...
```
## `mkt docs api`
Generate a compact Markdown API reference from public exports.
```text
api [OPTIONS]
```
Parameters:
- `--output` - Write generated Markdown reference to this file.
## `mkt docs cli`
Generate a Markdown command reference from the Click command tree.
```text
cli [OPTIONS]
```
Parameters:
- `--output` - Write generated Markdown reference to this file.
## `mkt explode`
Explode a Markdown file into reversible section files.
```text
explode [OPTIONS] FILE
```
Parameters:
- `FILE` - Required.
- `--output-dir` - Directory to write exploded Markdown files and manifest into. Required.
- `--variant` -
- `--force` - Allow writing into a non-empty output directory.
- `--format` -
## `mkt extension`
Inspect built-in extension descriptors and CLI affordances.
```text
extension [OPTIONS] COMMAND [ARGS]...
```
## `mkt extension commands`
List CLI commands declared by built-in extension descriptors.
```text
commands [OPTIONS]
```
Parameters:
- `--format` -
## `mkt extension inspect`
Inspect one built-in extension descriptor.
```text
inspect [OPTIONS] EXTENSION_ID
```
Parameters:
- `EXTENSION_ID` - Required.
- `--format` -
## `mkt extension list`
List built-in extension descriptors.
```text
list [OPTIONS]
```
Parameters:
- `--kind` - Only show extensions of this kind.
- `--format` -
## `mkt extract`
Extract text or Markdown content from structured Markdown.
```text
extract [OPTIONS] FILE SELECTOR
```
Parameters:
- `FILE` - Required.
- `SELECTOR` - Required.
- `--engine` - Query engine to use.
- `--format` -
## `mkt function`
Inspect and execute deterministic document functions.
```text
function [OPTIONS] COMMAND [ARGS]...
```
## `mkt function check`
Validate document function calls without rendering.
```text
check [OPTIONS] FILE
```
Parameters:
- `FILE` - Required.
- `--allow` - Only allow this function id. May be repeated.
- `--forbid` - Forbid this function id. May be repeated.
- `--format` -
## `mkt function list`
List registered document functions.
```text
list [OPTIONS]
```
Parameters:
- `--namespace` - Only list functions in one namespace.
- `--format` -
## `mkt function render`
Render deterministic document function calls in a Markdown file.
```text
render [OPTIONS] FILE
```
Parameters:
- `FILE` - Required.
- `--format` -
## `mkt generate`
Generate Markdown from contracts, rules, or external hooks.
```text
generate [OPTIONS] COMMAND [ARGS]...
```
## `mkt generate rules`
Run a Markdown/YAML generation plan.
```text
rules [OPTIONS] RULES_FILE
```
Parameters:
- `RULES_FILE` - Required.
- `--output-dir` - Directory used for relative output paths in the plan.
- `--dry-run` - Render without writing output files.
- `--format` -
## `mkt generate stub`
Generate a Markdown stub from a document contract.
```text
stub [OPTIONS]
```
Parameters:
- `--contract` - Markdown document contract to generate from. Required.
- `--data` - Optional JSON/YAML data for frontmatter values.
- `--set` - Set generation data. Dot paths create nested mappings.
- `--include-optional` - Include optional contract sections.
- `--output` - Write generated Markdown to a file.
- `--format` -
## `mkt implode`
Implode a Markdown directory created by `mkt explode`.
```text
implode [OPTIONS] DIRECTORY
```
Parameters:
- `DIRECTORY` - Required.
- `--manifest` - Manifest path. Defaults to markitect-explode.yaml in the input directory.
- `--output` - Write imploded Markdown to a file.
- `--format` -
## `mkt include`
Resolve Markdown include markers in a document.
```text
include [OPTIONS] FILE
```
Parameters:
- `FILE` - Required.
- `--base-dir` - Directory includes must stay within. Defaults to the input file directory.
- `--max-depth` - Maximum recursive include depth.
- `--output` - Write resolved Markdown to a file.
- `--format` -
## `mkt metrics`
Report practical size and complexity metrics for a Markdown file.
```text
metrics [OPTIONS] FILE
```
Parameters:
- `FILE` - Required.
- `--format` -
## `mkt parse`
Parse a Markdown file into a structured representation.
```text
parse [OPTIONS] FILE
```
Parameters:
- `FILE` - Required.
- `--format` -
## `mkt policy`
Check local access policy decisions.
```text
policy [OPTIONS] COMMAND [ARGS]...
```
## `mkt policy check`
Authorize one subject/action/object tuple with local label policy.
```text
check [OPTIONS] SUBJECT ACTION OBJECT_ID
```
Parameters:
- `SUBJECT` - Required.
- `ACTION` - Required.
- `OBJECT_ID` - Required.
- `--policy` - Local label policy file.
- `--label` - Object policy label. May be repeated.
- `--path` - Object path for path ACL and path-label rules.
- `--trust-zone` - Object trust zone.
- `--policy-mode` - Override policy mode for this check.
- `--format` -
## `mkt policy resource-manifest`
Inspect a Markitect flex-auth resource registration manifest.
```text
resource-manifest [OPTIONS] MANIFEST_FILE
```
Parameters:
- `MANIFEST_FILE` - Required.
- `--format` -
## `mkt policy subject`
Map enterprise identity claims into a Markitect policy subject.
```text
subject [OPTIONS] CLAIMS_FILE
```
Parameters:
- `CLAIMS_FILE` - Required.
- `--policy-map` - Enterprise policy map file. Required.
- `--group` - Additional resolved group. May be repeated.
- `--environment` - Validation environment for issuer safety checks.
- `--format` -
## `mkt process`
Run deterministic fenced-block processors in a Markdown file.
```text
process [OPTIONS] FILE
```
Parameters:
- `FILE` - Required.
- `--root` - Root used for relative processor references.
- `--format` -
## `mkt query`
Query structured Markdown content with a small selector.
```text
query [OPTIONS] FILE SELECTOR
```
Parameters:
- `FILE` - Required.
- `SELECTOR` - Required.
- `--engine` - Query engine to use.
- `--format` -
## `mkt ref`
Resolve namespaced Markdown content references.
```text
ref [OPTIONS] COMMAND [ARGS]...
```
## `mkt ref resolve`
Resolve a content reference using a Markdown document as context.
```text
resolve [OPTIONS] CONTEXT_FILE REFERENCE
```
Parameters:
- `CONTEXT_FILE` - Required.
- `REFERENCE` - Required.
- `--root` - Root that relative paths and namespaces must stay within.
- `--format` -
## `mkt schema`
Work with Markdown schema files.
```text
schema [OPTIONS] COMMAND [ARGS]...
```
## `mkt schema validate`
Validate that a Markdown schema contains a well-formed JSON Schema.
```text
validate [OPTIONS] SCHEMA_FILE
```
Parameters:
- `SCHEMA_FILE` - Required.
- `--format` -
## `mkt search`
Search the local SQLite index with FTS5.
```text
search [OPTIONS] TEXT
```
Parameters:
- `TEXT` - Required.
- `--root` - Root used for the default local index path.
- `--index-path` - SQLite index path. Defaults to .markitect/cache/index.sqlite3 under root.
- `--limit` -
- `--policy` - Local label policy file used to filter results.
- `--subject` - Policy subject id.
- `--policy-mode` - Override policy mode for this search.
- `--format` -
## `mkt source`
Inspect source-format adapters and normalize sources.
```text
source [OPTIONS] COMMAND [ARGS]...
```
## `mkt source adapters`
List discovered read-only source adapters.
```text
adapters [OPTIONS]
```
Parameters:
- `--format` -
## `mkt source inspect`
Inspect a local source without full Markdown conversion.
```text
inspect [OPTIONS] SOURCE_PATH
```
Parameters:
- `SOURCE_PATH` - Required.
- `--adapter` - Explicit source adapter id.
- `--option` - Adapter-specific option. May be repeated.
- `--format` -
## `mkt source normalize`
Normalize a local source into canonical Markdown.
```text
normalize [OPTIONS] SOURCE_PATH
```
Parameters:
- `SOURCE_PATH` - Required.
- `--adapter` - Explicit source adapter id.
- `--option` - Adapter-specific option. May be repeated.
- `--output` - Write normalized output to this file.
- `--format` -
## `mkt tangle`
Tangle named Markdown code chunks into target files.
```text
tangle [OPTIONS] FILE
```
Parameters:
- `FILE` - Required.
- `--output-dir` - Write tangled files under this directory. Omit for dry JSON/YAML/text output.
- `--format` -
## `mkt template`
Render and inspect deterministic Markdown templates.
```text
template [OPTIONS] COMMAND [ARGS]...
```
## `mkt template inspect`
Inspect variables required by a template.
```text
inspect [OPTIONS] TEMPLATE_FILE
```
Parameters:
- `TEMPLATE_FILE` - Required.
- `--format` -
## `mkt template render`
Render a Markdown template with structured data.
```text
render [OPTIONS] TEMPLATE_FILE
```
Parameters:
- `TEMPLATE_FILE` - Required.
- `--data` - JSON, YAML, or CSV data file. CSV must contain one record for render.
- `--set` - Set a template data value. Dot paths create nested mappings.
- `--lenient` - Keep unresolved placeholders instead of failing.
- `--output` - Write rendered Markdown to a file.
- `--format` -
## `mkt transform`
Apply deterministic transforms to a Markdown file.
```text
transform [OPTIONS] FILE
```
Parameters:
- `FILE` - Required.
- `--strip-frontmatter` - Remove YAML frontmatter.
- `--set` - Set a frontmatter value. Dot paths create nested mappings.
- `--heading-delta` - Shift ATX heading levels, clamped to 1..6.
- `--extract` - Replace content with selector output.
- `--output` - Write transformed Markdown to a file.
- `--format` -
## `mkt validate`
Validate a Markdown file against a Markdown schema file.
```text
validate [OPTIONS] FILE
```
Parameters:
- `FILE` - Required.
- `--schema` - Required.
- `--format` -
## `mkt weave`
Weave Markdown documentation with a deterministic chunk index.
```text
weave [OPTIONS] FILE
```
Parameters:
- `FILE` - Required.
- `--output` - Write woven Markdown to a file.
- `--format` -
## `mkt workflow`
Inspect, plan, and run declarative Markdown workflows.
```text
workflow [OPTIONS] COMMAND [ARGS]...
```
## `mkt workflow inspect`
Inspect a workflow definition without executing steps.
```text
inspect [OPTIONS] WORKFLOW_FILE
```
Parameters:
- `WORKFLOW_FILE` - Required.
- `--format` -
## `mkt workflow plan`
Run a workflow in dry-run mode and report planned outputs.
```text
plan [OPTIONS] WORKFLOW_FILE
```
Parameters:
- `WORKFLOW_FILE` - Required.
- `--output-dir` - Output root for path-safety checks. No files are written in plan mode.
- `--format` -
## `mkt workflow run`
Run a deterministic Markdown workflow.
```text
run [OPTIONS] WORKFLOW_FILE
```
Parameters:
- `WORKFLOW_FILE` - Required.
- `--output-dir` - Output root for workflow outputs. Defaults to the workflow directory.
- `--dry-run` - Execute without writing output files.
- `--format` -