mvtk
AI-optimized developer toolkit — structured JSONL output for every dev workflow
mvtk is a command-line toolkit built for AI agents and developers who need machine-readable, structured output — not ANSI color codes, not paginators, not noise. Every record is a JSON Line. Every command respects a token budget. Every result is parseable, composable, and consistent.
Think of it as the Unix toolkit reimagined for the age of LLMs:
grep,cat,git diff,blame,tree— but all speaking JSONL.
Install
Or grab a pre-built binary from Releases.
Commands
| Command | What it does |
|---|---|
mvtk grep |
Parallel regex search — context lines, tally, unique, symbol context, diff-filter |
mvtk read |
Read files as numbered JSONL lines — --fn, --outline, --from/--to block extraction |
mvtk tree |
Directory tree as JSONL entries with sizes, timestamps, language stats |
mvtk diff |
Parse git diff into structured hunk + file_changed records |
mvtk changes |
Semantic diff — which functions changed, not which lines |
mvtk ctx |
What does this file import? Who imports it? |
mvtk blame |
Per-line git blame as JSONL with author, commit, timestamp |
mvtk symbols |
Extract all function/struct/class/type declarations across a codebase |
mvtk metrics |
LOC, function counts, complexity, blank/comment ratios per file |
mvtk deps |
Import/dependency graph — edges, kinds (std/external/internal) |
mvtk todos |
Find TODO/FIXME/HACK/UNWRAP/SAFETY comments with optional blame |
mvtk refs |
Find every call site / usage of a symbol |
mvtk stash |
Structured git stash list with timestamps and affected files |
mvtk test |
Run tests (Go/Rust/Node) and emit structured pass/fail records |
mvtk lint |
Run cargo clippy, eslint, or ruff — emit structured diagnostics |
Quick Start
Search
# Find all TODO comments with surrounding context
# Count how often each error type appears
# Show only lines changed since HEAD
# Block extraction between two patterns
Read
# Read with line numbers
# Extract a function (parser-based)
# Extract any block by regex (works in ANY language)
# Extract a markdown section
# Read outline of symbols only (no content)
Understand a codebase
# What does auth.go import, and who imports it?
# What symbols changed in the last commit?
# Show largest files by function count
# Show the dependency graph
AI-friendly flags
Every command supports:
Output Format
All output is JSON Lines — one record per line, no color, no paging.
{"type":"match","file":"src/main.rs","line":42,"col":5,"content":" run(opts)?;","pattern":"run"}
{"type":"fn","file":"src/lib.rs","name":"run","signature":"pub fn run(opts: &Opts)","start_line":10,"end_line":45,"lines":[...]}
{"type":"block","file":"README.md","from_pattern":"^## Install","to_pattern":"^## ","start_line":12,"end_line":18,"lines":[...]}
{"type":"summary","files_searched":12,"matched":3,"elapsed_ms":14,"truncated":false}
Record types: match · fn · block · outline · line · hunk · file_changed · symbol · metric · dep · todo · ref · blame · stash · test · lint · import · importer · change · summary · warning · error
Library Usage
mvtk is also a library crate. Every subcommand is independently callable — no clap, no I/O assumptions.
[]
= "1.0"
use ;
use ;
use Emitter;
// Read a file as JSONL records
let opts = ReadOpts ;
let mut em = capturing; // 8192 token budget
run?;
let records = em.into_records; // Vec<serde_json::Value>
// Extract a block by regex
let opts = ReadOpts ;
Module map:
mvtk::cmd::grep — parallel search
mvtk::cmd::read — file reader + block extractor
mvtk::cmd::tree — directory walker
mvtk::cmd::diff — git diff parser
mvtk::cmd::changes — semantic diff
mvtk::cmd::ctx — import graph
mvtk::cmd::blame — git blame
mvtk::cmd::symbols — symbol extractor
mvtk::cmd::metrics — LOC/complexity
mvtk::cmd::deps — dependency graph
mvtk::cmd::todos — comment scanner
mvtk::cmd::refs — usage finder
mvtk::cmd::stash — stash lister
mvtk::cmd::test — test runner
mvtk::cmd::lint — linter bridge
mvtk::output — Emitter<W>, record types
mvtk::symbol — language-agnostic outline
mvtk::util — walkers, git helpers, token counting
mvtk read --from/--to
The universal fallback when --fn can't parse your language.
# Swift (parser doesn't cover methods)
# Python class method
# Markdown section (exclusive: don't include the next header)
# TOML config block
# All matching blocks in one file
Rules:
--fromonly → start at match, read to EOF--toonly → read from line 1 until match- Both → first
--from, then first--toafter it (both inclusive) --to-exclusive→ exclude the--toline itself--all→ return every block in the file- No match → warning record + exit 1
Why mvtk?
Standard tools weren't designed for AI consumers:
| Problem | Standard tools | mvtk |
|---|---|---|
| ANSI escape codes | Everywhere | Never |
| Pagination | less by default |
None |
| Token budgets | Not a concept | --max-tokens |
| Structured output | Rarely | Always JSONL |
| Binary file noise | Silently included | Auto-excluded |
| Context windows | Not a concern | First-class |
| Language-aware extraction | grep doesn't know functions | --fn, --outline, --from/--to |
License
Non-Commercial Copyleft License — free for personal and open-source use. Modifications must be shared and credit the original author. Commercial use requires a separate agreement.