codebase-context exposes its tools as a local CLI so humans can:
- Onboard themselves onto an unfamiliar repo
- Debug what the MCP server is doing
- Use outputs in CI/scripts (via
--json)
Output depends on the repo you run it against. The examples below are illustrative (paths, counts, and detected frameworks will vary).
The CLI is intentionally single-project per invocation. MCP multi-project routing and trusted-root auto-discovery are only for the MCP server; the CLI still targets one root via
CODEBASE_ROOTor the current working directory.
# Run from a repo root, or set CODEBASE_ROOT explicitly:
CODEBASE_ROOT=/path/to/repo npx -y codebase-context status
# Every command supports --json (machine output). Human mode is default.
npx -y codebase-context patterns --jsonIf your terminal doesn’t render Unicode box-drawing cleanly:
CODEBASE_CONTEXT_ASCII=1 npx -y codebase-context patternsmetadata— tech stack overviewpatterns— team conventions + adoption/trendssearch --query <q>— ranked results; add--intent editfor a preflight cardrefs --symbol <name>— concrete reference evidencecycles— circular dependency detectionstatus— index status/progressreindex— rebuild index (full or incremental)style-guide— find style guide sections in docsmemory list|add|remove— manage team memory (stored in.codebase-context/memory.json)
npx -y codebase-context metadataExample output:
┌─ codebase-context [monorepo] ────────────────────────────────────────┐
│ │
│ Framework: Angular unknown Architecture: mixed │
│ 130 files · 24,211 lines · 1077 components │
│ │
│ Dependencies: @huggingface/transformers · @lancedb/lancedb · │
│ @modelcontextprotocol/sdk · @typescript-eslint/typescript-estree · │
│ chokidar · fuse.js (+14 more) │
│ │
└──────────────────────────────────────────────────────────────────────┘
npx -y codebase-context patternsExample output (truncated):
┌─ Team Patterns ──────────────────────────────────────────────────────┐
│ │
│ UNIT TEST FRAMEWORK │
│ USE: Vitest – 96% adoption │
│ alt CAUTION: Jest – 4% minority pattern │
│ │
│ STATE MANAGEMENT │
│ PREFER: RxJS – 63% adoption │
│ alt Redux-style store – 25% │
│ │
└──────────────────────────────────────────────────────────────────────┘
npx -y codebase-context search --query "file watcher" --intent edit --limit 3Example output (truncated):
┌─ Search: "file watcher" ─── intent: edit ────────────────────────────┐
│ Quality: ok (1.00) │
│ Ready to edit: YES │
│ │
│ Best example: index.ts │
└──────────────────────────────────────────────────────────────────────┘
1. src/core/file-watcher.ts:44-74
confidence: ██████████ 1.18
typescript module in file-watcher.ts: startFileWatcher :: (...)
npx -y codebase-context refs --symbol "startFileWatcher" --limit 10Example output (truncated):
┌─ startFileWatcher ─── 11 references ─── static analysis ─────────────┐
│ │
│ startFileWatcher │
│ │ │
│ ├─ file-watcher.test.ts:5 │
│ │ import { startFileWatcher } from '../src/core/file-watcher.... │
│ │
└──────────────────────────────────────────────────────────────────────┘
npx -y codebase-context cycles --scope srcExample output:
┌─ Circular Dependencies ──────────────────────────────────────────────┐
│ │
│ No cycles found · 98 files · 260 edges · 2.7 avg deps │
│ │
└──────────────────────────────────────────────────────────────────────┘
npx -y codebase-context statusExample output:
┌─ Index Status ───────────────────────────────────────────────────────┐
│ │
│ State: ready │
│ Root: /path/to/repo │
│ │
│ → Run `reindex` to re-index (`--incremental` skips unchanged). │
│ │
└──────────────────────────────────────────────────────────────────────┘
npx -y codebase-context reindex
npx -y codebase-context reindex --incremental --reason "changed watcher logic"MCP server mode: if you're running codebase-context as an MCP server (long-running process), the index auto-refreshes via a file watcher — you don't need to call
reindexbetween edits. Usereindexfor one-shot CLI runs or to force a full rebuild.
npx -y codebase-context style-guide --query "naming"Example output:
No style guides found.
Hint: Try broader terms like 'naming', 'patterns', 'testing', 'components'
npx -y codebase-context memory list
npx -y codebase-context memory list --query "watcher"
npx -y codebase-context memory add \
--type gotcha \
--category tooling \
--memory "Use pnpm, not npm" \
--reason "Workspace support and speed"
npx -y codebase-context memory remove <id>