CLI tool providing structural code intelligence for LLM agents working with TypeScript projects.
LLM agents waste context window budget on:
- regex search: noisy, misses structural patterns, returns irrelevant matches
- manual patching: opening files one by one, applying changes per callsite — slow, incomplete
- reading full files: implementation detail floods context when only the public API matters
Three tool categories exposed as CLI subcommands:
Read code through declarations and type signatures, not raw file contents.
astkit nav declarations <file>— list exported signatures (no bodies)astkit nav definition <file> <line> <character>— go to definitionastkit nav references <file> <line> <character>— find all references
Structural pattern matching that understands code syntax.
astkit search <pattern> [scope]— syntactic structural searchastkit search --type <type-query> [scope]— type-aware search (TS compiler)
Structural code transformation using pattern matching.
astkit patch <pattern> <replacement> [scope]— structural rewriteastkit patch --dry-run <pattern> <replacement> [scope]— preview changes
- Compact output. Every byte lands in a context window. No ANSI, no decoration.
- JSON by default. Structured output for programmatic consumption.
- Span-based addressing. Everything speaks in
file:line:characterorfile:startLine-endLine. - Scoped operations. Every command accepts file/directory scope.
- Dry-run for patches. Preview what changes before committing them.
- Runtime-agnostic. Uses standard Node.js APIs (
node:fs,node:path). Works with Node and Bun.
| Concern | Choice | Notes |
|---|---|---|
| Code navigation | TypeScript compiler API | Language service for declarations, definitions, references |
| Structural patching | @claudiu-ceia/combine |
Comby-inspired structural matching/rewriting |
| Structural search | TBD | Likely ast-grep or tree-sitter queries |
| CLI framework | stricli |
Zero deps, TS-first, nested subcommands, lazy loading |
| Target runtime | Node.js >=22.12 / Bun | No runtime-specific APIs in the tool itself |
npm package with a bin entry point. Users install as a devDependency or run via npx/bunx. Uses the target project's own typescript installation for accurate type resolution.
bun installbun run astkit -- <command> [args]bun test- Use standard Node.js APIs — not Bun-specific builtins (
Bun.file,bun:sqlite, etc.) - Use
bun testwithimport { test, expect } from "bun:test"for tests - TypeScript strict mode
- Prefer small, focused modules — one command per file
- Use conventional commit messages (e.g.,
feat: add nav declarations command,fix: correct line/character parsing in nav definition)