Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

243 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Code Analyzer

Code intelligence platform. Understand, search, and review code at depth — powered by an MCP server for AI agents, a VS Code extension with Copilot Chat integration, a Web Dashboard, and a standalone CLI.

Status: v0.1.0 CI Coverage OpenSSF Scorecard Node.js TypeScript License: MIT

Note on coverage: The 55% badge reflects the codebase after iterative refactoring (I1-I8). Test organization is in progress; target is >=80% with organized integration tests.


Overview

Code Analyzer is a code intelligence platform that helps developers understand, search, and review code at depth. It includes:

  • Knowledge Graph: Models source code as a typed property graph with 33 node types and 44 relationship types
  • MCP Server: Exposes 45 tools to AI coding agents via the Model Context Protocol
  • VS Code Extension: Integrates with Copilot Chat for real-time code intelligence
  • Web Dashboard: Provides 6 interactive views for exploring your codebase
  • CLI: Standalone command-line interface for analysis, search, and review

Install

# Install via npm
npm install -g @code-analyzer/cli

# Initialize a project
cd your-project
code-analyzer init

Usage

# Index your codebase
code-analyzer analyze .

# Search your codebase
code-analyzer search "authentication"

# Review code for issues
code-analyzer review src/

# Auto-detect and configure your AI agent
code-analyzer agent detect
code-analyzer agent configure

Features

Checkmarks indicate features verified through automated tests.

Capability Status
Knowledge Graph (33 node types, 43 relationship types) Verified — unit tested
19-Phase Analysis Pipeline Verified — integration tested
20-Language Parsing (tree-sitter + regex fallback) Verified — unit tested
Scope Resolution (3-tier: same-file, cross-file, namespace) Verified — unit tested
PR Review (50+ heuristic rules, 6 categories) Verified — integration tested
Cypher Query Engine (lexer → parser → planner → executor) Verified — unit tested
MCP Server (39 tools, 15 resources, 5 prompts) Verified — integration tested
VS Code Extension (15 Copilot Chat slash commands) Verified — unit tested
Web Dashboard (6 interactive views) Verified — integration tested
GitHub Integration (webhooks, check runs, cross-repo PR) Verified — integration tested
AI Agent Auto-Detection (12 agents) Verified — unit tested
RBAC (5 roles, 25 permissions) Verified — unit tested
Secret Scanner (16 patterns) Verified — unit tested
Impact Analysis (BFS-based change propagation) Verified — integration tested
Cross-Repo Analysis (federated search, contract detection) Verified — integration tested
Taint Analysis (source → sink path tracking) Verified — unit tested
Graph Store (in-memory + SQLite with FTS5) Verified — unit tested
Rate Limiting (sliding window) Verified — unit tested
Health Checks + Graceful Shutdown Verified — integration tested
Benchmark Framework (ca-bench, real-world PR suite) Verified — benchmark tested

Architecture

The platform is structured as a 10-package pnpm monorepo with clear separation of concerns:

+---------------------------------------------------------------+
|                    Presentation Layer                         |
|     CLI        |  VS Code Extension (15 slash commands)      |
|     Web Dashboard (6 views)                                   |
+---------------------------------------------------------------+
|                     Integration Layer                         |
|    MCP Server (39 tools)  |  HTTP REST API  |  Webhooks      |
+---------------------------------------------------------------+
|                     Service Layer                             |
|    Review Engine  |  Search (BM25 + vector)  |  Standards    |
+---------------------------------------------------------------+
|                    Intelligence Layer                         |
|  50+ Rules (CWE)  |  Cross-Repo  |  Impact  |  Embeddings    |
+---------------------------------------------------------------+
|                    Analysis Engine                            |
|  20 Parsers  |  19-Phase DAG  |  Scope Resolution  |  Graph  |
+---------------------------------------------------------------+
|                   Infrastructure Layer                       |
|  Graph Store (SQLite)  |  Git Ops  |  Worker Pool            |
+---------------------------------------------------------------+
|                    Foundation Layer                           |
|   Config  |  Logging  |  Errors  |  RBAC  |  Metrics         |
+---------------------------------------------------------------+

Package Structure

Package Description
@code-analyzer/shared Types (33 node labels, 43 edges, 43 consts), constants, validation, utilities
@code-analyzer/core Foundation: config, logging, errors, i18n, metrics, agent detection, security, RBAC, audit
@code-analyzer/infra Infrastructure: graph stores (in-memory, SQLite), file discovery, git operations, concurrency
@code-analyzer/analyzer Analysis: 20-language parsers, 19-phase DAG pipeline, scope resolution, auto-index/watch
@code-analyzer/intelligence Intelligence: 50+ review rules, cross-repo, impact analysis, embeddings, taint analysis
@code-analyzer/mcp MCP server: 39 tools, 15 resources, 5 prompts, Cypher engine, middleware
@code-analyzer/server HTTP REST API server with webhook support, rate limiting, graceful shutdown
@code-analyzer/cli CLI: init, analyze, search, review, status, agent commands
@code-analyzer/vscode VS Code extension with Copilot Chat participant (15 slash commands)
@code-analyzer/web Web Dashboard with 6 interactive views

Benchmarks

Code Analyzer achieves competitive results with zero LLM token cost on internal test suites:

Metric Code Analyzer SonarQube CodeRabbit
Precision 79.4% 72% 58%
Recall 73.0% 48% 52%
F1 Score 0.761 0.576 0.549
Noise Rate 0.3x 0.8x 2.1x
Cost $0 API cost API cost

Important caveat: Benchmarks are based on internal test suites (37 ground-truth issues). Independent validation with a larger dataset (200+ PRs, 1500+ issues) is planned for v0.2.0. Competitor numbers are from published documentation and may differ in direct comparison.

Full benchmark report →


Documentation


Development

# Install dependencies
pnpm install

# Run unit tests
pnpm test

# Run integration tests
pnpm test:integration

# Run benchmarks
pnpm test:bench

# Build all packages
pnpm build

# Lint and typecheck
pnpm lint && pnpm typecheck

Deployment

# Docker Compose (recommended)
docker compose up -d

# Docker (single container)
docker build -t code-analyzer:latest .
docker run -d -p 3000:3000 code-analyzer:latest

# Kubernetes
kubectl apply -f k8s/

# Homebrew (macOS)
brew install code-analyzer

See DEPLOYMENT.md for full deployment documentation including resource requirements, health checks, environment variables, and Kubernetes manifests.


Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines on how to contribute, set up your development environment, and submit pull requests.


License

MIT (c) Lambertyan

About

No description, website, or topics provided.

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages