A local, LLM-powered codebase analysis tool. Runs a four-phase pipeline against any TypeScript/JavaScript project and produces two deliverables: a coding-standards document (standards.md) and a prioritized refactor strategy (refactor-strategy.md), both grounded in cross-file analysis of your codebase.
Extends code-analyzer with optional GitNexus integration — when a .gitnexus/ knowledge graph is present, the pipeline uses structural graph data to group related files together and inject accurate dependency lists into the analysis.
- Node.js 20+
- LM Studio running locally with a supported model loaded (see Models)
- GitNexus (optional, but recommended) —
npm install -g gitnexus— enables graph-enriched analysis
git clone https://github.com/cflury4784/code-analyzer-plus
cd code-analyzer+
npm install
npm run buildTo install globally (makes the code-analyzer command available system-wide):
# Recommended for local development — symlinks the project directory,
# so changes are live immediately after npm run build
npm link
# Production install — copies the current build into the global npm prefix
npm run build && npm install -g .If a previous version of code-analyzer is globally installed, remove it first:
npm uninstall -g code-analyzerNavigate to the project you want to analyze, then run:
cd /path/to/your/project
node /path/to/code-analyzer+/dist/index.jsOr if installed globally:
cd /path/to/your/project
code-analyzerOn first run, the tool:
- Checks for a
.gitnexus/index in the target project — prompts to continue without it if absent - Verifies LM Studio is running and the model is loaded (auto-loads if needed)
- Discovers source files and creates
code-analysis/manifest.json - Runs all four phases sequentially, writing results to
code-analysis/
If the target project has been indexed by GitNexus (npx gitnexus analyze), code-analyzer+ automatically:
- Refreshes the index before the pipeline starts (
npx gitnexus analyze) - Index phase — injects graph-derived
dependencies(actual import paths from the AST) into each file's index entry instead of asking the LLM to infer them - Analyze phase — groups files by their community cluster (modules that import each other heavily) instead of naive byte-size grouping; related files are analyzed together, improving cross-file pattern detection
Without a .gitnexus/ index, the tool falls back to the original behavior: byte-based batching, LLM-inferred dependencies, no impact context. The fallback is transparent — no features are removed, only enrichment is skipped.
cd /path/to/your/project
npm install -g gitnexus # if not already installed
npx gitnexus analyzeThen run code-analyzer+ — it picks up the index automatically.
| Phase | Output | What happens |
|---|---|---|
| 1 — Index | code-analysis/index/ |
Each file is summarized: responsibilities, UI patterns, duplication candidates, inconsistencies. With GitNexus: accurate dependencies injected from the import graph. |
| 2 — Analyze | code-analysis/analyzer/ |
Index entries are grouped and cross-analyzed for patterns, shared anti-patterns, and architectural inconsistencies. With GitNexus: files grouped by community cluster. |
| 2.5 — Dedup | code-analysis/dedup/ |
Duplicate findings across analyze batches are merged and deduplicated. |
| 3 — Aggregate | code-analysis/aggregate/ |
All findings consolidated into two deliverables: standards.md (a coding-standards document) and refactor-strategy.md (a prioritized, phased refactor strategy). This is the final phase. |
Results accumulate in code-analysis/ inside the target project. Logs are written to code-analysis/logs/run.log.
--model-override <name> Use a specific model key (default: qwen3.6-35b-a3b)
--phase <name> Run only one phase: index | analyze | dedup | aggregate
--resume Resume an in-progress phase (skip completed batches)
--max-batch-size <bytes> Max bytes per index batch (default: 8000)
--timeout <seconds> Per-batch LLM timeout (default: 600)
--num-ctx <tokens> Context window size (default: 32000)
--skip-preflight Skip LM Studio model-ready check
--version / -v Print version and exit
Run only the aggregate phase (assumes index/analyze/dedup are done):
node dist/index.js --phase aggregateResume a failed index phase:
node dist/index.js --phase index --resumeUse a smaller model with a tighter context window:
node dist/index.js --model-override qwen/qwen3.5-9b --num-ctx 16000The tool uses LM Studio's local inference API. Supported model keys:
| Key | Quant | Min RAM |
|---|---|---|
qwen3.6-35b-a3b (default) |
Q3_K_S | 30 GB |
qwen3.6-27b-mtp |
Q3_K_M | 24 GB |
qwen/qwen3.5-9b |
— | 18 GB |
At startup, the tool checks whether the model is loaded in LM Studio and loads it automatically if not. Ensure LM Studio's local server is running on port 1234 (the default).
code-analysis/
├── manifest.json # pipeline state — batch tracking and phase status
├── logs/
│ └── run.log
├── index/
│ └── batch-001.json # per-file summaries
├── analyzer/
│ └── group-001.json # cross-file analysis
├── dedup/
│ └── dedup-001.json
└── aggregate/
├── standards.md # generated coding-standards document
└── refactor-strategy.md # generated prioritized refactor strategy
The two files under aggregate/ are the tool's final deliverables.
The aggregate phase produces two documents in code-analysis/aggregate/:
standards.md— an opinionated coding-standards document inferred from the patterns and inconsistencies found across your codebase (naming conventions, architectural rules, patterns to enforce or avoid).refactor-strategy.md— a prioritized, phased refactor strategy. Phases are ordered by severity and by how many independent analysis passes converged on each finding, so the highest-confidence, highest-impact work surfaces first.
Both are grounded in the cross-file analysis from the earlier phases — they are outputs, not inputs you supply.
The manifest tracks the status of every batch. If a run is interrupted:
node dist/index.js --resumeThis skips completed batches and retries failed ones. To reset a specific phase and re-run it from scratch:
node dist/index.js --phase analyze(Omitting --resume resets the phase before running it.)
npm run dev # run via tsx (no build step)
npm test # vitest in watch mode
npm run test:run # single test run
npm run build # tsc compile to dist/