I published contextpack-cli recently. It solves a problem I kept hitting: pasting a repo into an LLM one file at a time and blowing the context window on node_modules and lockfiles.
It respects nested .gitignore and .ignore files, ranks source code above tests, redacts common secret formats, and supports --task, --diff, --profile and JSON output. Zero runtime dependencies, MIT licensed.
Honest caveat: token counts are local estimates (~±15%), not exact tokenizer counts. Feedback welcome.
When using AI coding agents (Claude Code, Cursor, VS Code Copilot) on medium/large Node.js repos, they usually start by walking directories and reading 15–25 files just to trace imports and recent changes—burning tokens and context before editing anything.
I wanted a lightweight, zero-config indexer that turns a repo into a structured map (.project.md, .project-map.json, .project-map.md) so the agent queries topology first and only reads the relevant files.
How it works under the hood
File & Module Indexing: Walks the repo (skipping node_modules, dist, build, .git, etc.), infers modules/roles/tags, and detects stack/entrypoints (package.json, frameworks).
Import Topology Graph: Extracts ES import/export ... from, dynamic import(), CommonJS require(), and Python imports into dependencies and usedBy adjacency lists + a Mermaid diagram in .project.md.
Git Hotspot Signal: Uses git log via execFileSync to track recently modified files and commit reasons, boosting them in task-relevance ranking.
Safety & Testing: Enforces lexical + realpathSync symlink-traversal checks on read_files_sparse and write_and_log, validates tool args, and tests the MCP handlers end-to-end with InMemoryTransport in Jest (--experimental-vm-modules).
Feedback from Node/TS folks is very welcome—especially around supporting tsconfig.json path aliases (@/...) or monorepo workspaces (pnpm-workspace.yaml / npm workspaces) in the topology resolver!