mdt_cli
the CLI for mdt (manage markdown templates)
[![Crate][crate-image]][crate-link] [![Docs][docs-image]][docs-link] [![Status][ci-status-image]][ci-status-link] [![Coverage][coverage-image]][coverage-link] [![Unlicense][unlicense-image]][unlicense-link]
mdt helps library and tool maintainers keep README sections, source-doc comments, and docs-site content synchronized across a project. Define content once with comment-based template tags, then reuse it across markdown files, code documentation comments, READMEs, mdbook docs, and more so your docs do not drift.
Installation
- Install with npm:
- Or run it without installing:
- Or download a prebuilt binary from the latest GitHub release
- Or install with Cargo:
CLI Commands
mdt init [--path <dir>]— Create a sample.templates/template.t.mdfile and startermdt.toml.mdt check [--path <dir>] [--verbose]— Verify all target blocks are up-to-date. Exits non-zero if any are stale.mdt update [--path <dir>] [--verbose] [--dry-run]— Update all target blocks with latest source content.mdt info [--path <dir>]— Print project diagnostics and cache observability metrics.mdt doctor [--path <dir>] [--format text|json]— Run health checks with actionable hints, including cache validity and efficiency.mdt assist <assistant> [--format text|json]— Print an official assistant setup profile with MCP config and repo-local guidance.mdt lsp— Start the mdt language server (LSP) for editor integration. Communicates over stdin/stdout.mdt mcp— Start the mdt MCP server for AI assistants. Communicates over stdin/stdout.
Diagnostics Workflow
- Run
mdt infofirst to inspect project shape, diagnostics totals, and cache reuse telemetry. - Run
mdt doctorwhen you need actionable health checks and remediation hints (config/data/layout/cache). - Use
MDT_CACHE_VERIFY_HASH=1when troubleshooting cache consistency issues and comparing reuse behavior.
Template Syntax
Source tag (defines a template block in *.t.md definition files):
Content to inject
Target tag (marks where content should be injected):
This content gets replaced
Inline tag (source-free interpolation using configured data):
Current version: <!-- {~version:"{{ package.version }}"} -->0.0.0<!-- {/version} -->
Filters and pipes: Template values support pipe-delimited transformers:
Available transformers: trim, trimStart, trimEnd, indent, prefix, suffix, linePrefix, lineSuffix, wrap, codeBlock, code, replace, if.
[crate-image]: https://img.shields.io/crates/v/mdt_cli.svg [crate-link]: https://crates.io/crates/mdt_cli [docs-image]: https://docs.rs/mdt_cli/badge.svg [docs-link]: https://docs.rs/mdt_cli/ [ci-status-image]: https://github.com/ifiokjr/mdt/workflows/ci/badge.svg [ci-status-link]: https://github.com/ifiokjr/mdt/actions?query=workflow:ci [coverage-image]: https://codecov.io/gh/ifiokjr/mdt/branch/main/graph/badge.svg [coverage-link]: https://codecov.io/gh/ifiokjr/mdt [unlicense-image]: https://img.shields.io/badge/license-Unlicence-blue.svg [unlicense-link]: https://opensource.org/license/unlicense