A step-by-step guide to indexing, searching, and reviewing your codebase. From zero to code intelligence in under 10 minutes.
| Requirement | Minimum | How to Check |
|---|---|---|
| Node.js | >= 20.0.0 | node --version |
| pnpm | >= 9.0.0 | pnpm --version |
| Git | Any recent version | git --version |
| Disk Space | ~50 MB core + graph storage | Varies by codebase size |
If you don't have pnpm installed:
npm install -g pnpm@latest
# Or via corepack (Node.js >= 16.13):
corepack enable && corepack prepare pnpm@latest --activatepnpm add -g @code-analyzer/cli
# Verify installation
code-analyzer --versionExpected output:
Code Analyzer v1.0.0
Node: v20.11.0 | Platform: linux x64
npx @code-analyzer/cli analyze --repo .The first run downloads the package automatically. Subsequent runs are faster due to npx cache.
docker pull ghcr.io/agentix-e/code-analyzer:latest
# Run analysis on your project
docker run --rm -v $(pwd):/workspace ghcr.io/agentix-e/code-analyzer:latest \
code-analyzer analyze --repo /workspace
# Start MCP server via Docker
docker run --rm -v $(pwd):/workspace -p 3100:3100 \
ghcr.io/agentix-e/code-analyzer:latest \
code-analyzer mcp --transport http --port 3100Use Docker when you want a fully isolated environment or need to run Code Analyzer in CI/CD pipelines without installing Node.js.
Before your first analysis, initialize a configuration:
code-analyzer initThis creates a .code-analyzerrc file in your project root with sensible defaults. You'll be prompted to select:
- Which languages to analyze (TypeScript, Python, Go, Java, Kotlin, C#, Rust)
- Directories to exclude
- Review severity preferences
Expected output:
✓ Created .code-analyzerrc
✓ Detected 3 languages: typescript, python, go
✓ Configuration saved with 8 options
Run your first full analysis to build the knowledge graph:
code-analyzer analyze .What happens during analysis:
- File Discovery — Scans your project, respecting
.gitignoreand.code-analyzerignore - Parsing — Each source file is parsed by the appropriate language provider
- Graph Building — A 19-phase DAG pipeline constructs a knowledge graph with 33 entity types and 44 relationship types
- Indexing — Full-text and vector embeddings are generated for hybrid search
Expected output:
╔══════════════════════════════════════╗
║ Code Analyzer - Analysis Results ║
╠══════════════════════════════════════╣
║ Files analyzed: 1,247 ║
║ Lines of code: 87,342 ║
║ Nodes created: 4,521 ║
║ Relationships created: 18,330 ║
║ Graph size: 12.4 MB ║
║ Analysis time: 8.3s ║
╚══════════════════════════════════════╝
Languages detected: typescript (847 files), python (312 files), go (88 files)
Now that your codebase is indexed, search it:
# Keyword search
code-analyzer search "authentication"
# Semantic search (what does this code do?)
code-analyzer search "how does the login flow work" --semantic
# Search with filters
code-analyzer search "handler" --language typescript --type Function
# Cypher graph query
code-analyzer search --cypher "MATCH (f:Function) WHERE f.name CONTAINS 'auth' RETURN f.name, f.file"Expected output (keyword search):
Search: "authentication" (BM25, top 20 results)
1. auth/login.ts:42 — authenticateUser() [score: 0.892]
2. auth/middleware.ts:18 — authMiddleware() [score: 0.845]
3. services/token.ts:67 — refreshAuthToken() [score: 0.801]
4. types/auth.ts:5 — AuthConfig interface [score: 0.763]
...
Found 47 results in 0.12s
Get automated review feedback on your code:
# Review a single file
code-analyzer review src/auth/login.ts
# Review staged changes (before committing)
code-analyzer review src/ --diff
# Review entire directory against standards
code-analyzer review src/ --standard typescript-best-practicesExpected output:
Review: src/auth/login.ts
═══════════════════════════════
[CRITICAL] Line 42: Hardcoded secret - API key appears to be embedded in source
→ Move to environment variable or secrets manager
[HIGH] Line 67: Missing error handling - async function lacks try/catch
→ Wrap database call in try/catch with appropriate error response
[MEDIUM] Line 89: Function length exceeds threshold (52 lines)
→ Consider refactoring into smaller functions
[LOW] Line 12: Unused import 'crypto' detected
→ Remove unused import
Summary: 1 critical, 1 high, 1 medium, 1 low — 4 issues total
Code Analyzer exposes 45 tools via the Model Context Protocol (MCP), turning your AI coding agent into a code intelligence powerhouse.
The easiest way to set up MCP is with the agent detection command:
code-analyzer agent detectThis scans your environment for supported AI agents and shows what's available:
Agent Detection Results
═════════════════════════
✓ Claude Desktop detected — ~/Library/Application Support/Claude/claude_desktop_config.json
✓ Cursor detected — .cursor/mcp.json
✓ VS Code detected — Code Analyzer extension installed
✓ Windsurf detected — ~/.windsurf/mcp.json
Run 'code-analyzer agent configure' to set up all detected agents.
Then configure all detected agents at once:
code-analyzer agent configureExpected output:
✓ Configured Claude Desktop (38 tools)
✓ Configured Cursor (28 tools, analysis profile)
✓ Configured Windsurf (28 tools, analysis profile)
Restart your AI agents to begin using Code Analyzer tools.
If auto-detection doesn't work, configure manually. For Claude Desktop, add to claude_desktop_config.json:
{
"mcpServers": {
"code-analyzer": {
"command": "npx",
"args": ["-y", "@code-analyzer/mcp"],
"env": {
"CODE_ANALYZER_PROJECT_DIR": "/absolute/path/to/your/project"
}
}
}
}For Cursor, create .cursor/mcp.json in your project root:
{
"mcpServers": {
"code-analyzer": {
"command": "npx",
"args": ["-y", "@code-analyzer/mcp"],
"env": {
"CODE_ANALYZER_PROJECT_DIR": "${workspaceFolder}"
}
}
}
}After restarting your AI agent, you'll see a hammer icon in the chat interface, confirming the 45 MCP tools are available. See the MCP Tool Reference for the complete listing.
- Open VS Code
- Press
Ctrl+Shift+X(orCmd+Shift+Xon macOS) - Search for "Code Analyzer"
- Click Install
Alternatively, install from the VS Code Marketplace.
After installation, you should see:
- Activity Bar Icon — The Code Analyzer icon (magnifying glass over brackets) appears in the activity bar
- Status Bar Indicator — Shows "CA: Indexed" when a project is analyzed
- Output Panel — View → Output → "Code Analyzer" shows extension logs
| Feature | How to Access |
|---|---|
| Knowledge Graph Sidebar | Click the Code Analyzer icon in the activity bar |
| Copilot Chat Integration | Type @code-analyzer in Copilot Chat (requires GitHub Copilot) |
| Inline Review Comments | Hover over code to see AI review suggestions |
| Impact Analysis | Right-click a function → "Code Analyzer: Analyze Impact" |
| Command Palette | Ctrl+Shift+P → search "Code Analyzer" |
@code-analyzer /review — Review the current file
@code-analyzer /explain — Explain selected code
@code-analyzer /impact — Analyze impact of current function
@code-analyzer /find — Search for symbols
@code-analyzer /deps — Show dependencies
@code-analyzer /refactor — Suggest refactoring
@code-analyzer /test — Generate tests for current file
@code-analyzer /coverage — Show test coverage gaps
@code-analyzer /standards — Check against standards
Configure via Ctrl+, → search "Code Analyzer":
| Setting | Default | Description |
|---|---|---|
codeAnalyzer.indexOnOpen |
true |
Auto-index workspace when opened |
codeAnalyzer.languages |
["typescript","javascript"] |
Languages to analyze |
codeAnalyzer.autoReview |
false |
Automatically review on file save |
codeAnalyzer.ignorePatterns |
["node_modules","dist"] |
Patterns to skip |
The global install path isn't in your $PATH. Run:
pnpm setup
source ~/.bashrc # or ~/.zshrcOr use npx directly: npx @code-analyzer/cli analyze .
Check that:
- You're in a directory with supported source files (
.ts,.py,.go,.java, etc.) - Your files aren't excluded by
.gitignorepatterns - You've specified the right language:
code-analyzer analyze . --languages typescript
- Limit languages:
code-analyzer analyze . --languages typescript - Exclude generated files in
.code-analyzerrc:{ "excludePatterns": ["**/generated/**", "**/*.generated.*"] } - Set
CODE_ANALYZER_PARSE_WORKERS=8for more parallel workers
- Check for port conflicts:
lsof -i :3100 - Verify Node.js version:
node --version(must be >= 20) - Run directly to see errors:
npx @code-analyzer/mcp --transport http --port 3100
- Check the extension is activated: View → Output → select "Code Analyzer"
- Reload VS Code:
Ctrl+Shift+P→ "Developer: Reload Window" - Verify Node.js >= 20 is installed and on
$PATH
| Resource | Description |
|---|---|
| Configuration Reference | All config options and environment variables |
| MCP Tool Reference | Complete 45-tool reference for AI agents |
| Scenario Guides | Task-based workflows (PR review, CI/CD, monorepo) |
| Troubleshooting | Detailed solutions for common issues |
| Architecture | Deep dive into the system design |
| Language Support | Supported languages and feature matrix |