codebase-analyzer-mcp 2.1.2 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -3,30 +3,11 @@
3
3
  [![npm](https://img.shields.io/npm/v/codebase-analyzer-mcp)](https://www.npmjs.com/package/codebase-analyzer-mcp)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
5
 
6
- Analyze any codebase with Gemini AI. Progressive disclosure keeps costs low - start with free structural analysis, drill into semantic details only when needed.
6
+ MCP server for codebase analysis with Gemini AI. Progressive disclosure keeps costs low start with free structural analysis, drill into semantic details only when needed.
7
7
 
8
8
  ## Install
9
9
 
10
- ### Option 1: Claude Code Plugin (recommended)
11
-
12
- ```bash
13
- claude /plugin install jaykaycodes/codebase-analyzer-mcp
14
- ```
15
-
16
- This gives you MCP tools + agents + the `/cba:analyze` command. Just ask questions naturally.
17
-
18
- **Gemini API key (optional):** Enables semantic analysis, pattern detection, and dataflow tracing. Without it, you still get structural analysis.
19
-
20
- ```bash
21
- mkdir -p ~/.config/codebase-analyzer
22
- echo '{"geminiApiKey":"YOUR_KEY"}' > ~/.config/codebase-analyzer/config.json
23
- ```
24
-
25
- Get a free key at https://aistudio.google.com/apikey
26
-
27
- ### Option 2: Standalone MCP Server
28
-
29
- Add to `~/.mcp.json`:
10
+ Add to your MCP config (`~/.mcp.json` for Claude Code):
30
11
 
31
12
  ```json
32
13
  {
@@ -42,20 +23,23 @@ Add to `~/.mcp.json`:
42
23
  }
43
24
  ```
44
25
 
45
- Restart Claude Code, then use `analyze_repo`, `query_repo`, etc.
26
+ Restart Claude Code. The tools will be available immediately.
46
27
 
47
- ### Option 3: CLI
28
+ **Gemini API key** is optional — enables semantic analysis, pattern detection, and dataflow tracing. Without it, you still get structural analysis. Get a free key at https://aistudio.google.com/apikey
48
29
 
49
- ```bash
50
- npx codebase-analyzer-mcp analyze . # Standard analysis
51
- npx codebase-analyzer-mcp analyze . -d surface # Fast, free overview
52
- npx codebase-analyzer-mcp analyze . -d deep -s # Full semantic analysis
53
- npx codebase-analyzer-mcp query . "how is auth handled?" # Ask a question
54
- npx codebase-analyzer-mcp patterns . # Find design patterns
55
- npx codebase-analyzer-mcp dataflow . "user login" # Trace data flow
56
- ```
30
+ ## Tools
31
+
32
+ | Tool | Description | Requires Gemini |
33
+ |------|-------------|:---:|
34
+ | `analyze_repo` | Full analysis with progressive disclosure | No |
35
+ | `query_repo` | Ask questions about a codebase | Optional |
36
+ | `expand_section` | Drill into specific analysis sections | No |
37
+ | `read_files` | Read source files from a cached analysis | No |
38
+ | `find_patterns` | Detect design/architecture patterns | Yes |
39
+ | `trace_dataflow` | Trace data flow through the system | Yes |
40
+ | `get_analysis_capabilities` | List supported languages and options | No |
57
41
 
58
- ## What It Does
42
+ ## Analysis Layers
59
43
 
60
44
  | Layer | Cost | What You Get |
61
45
  |-------|------|--------------|
@@ -63,38 +47,18 @@ npx codebase-analyzer-mcp dataflow . "user login" # Trace data fl
63
47
  | **Structural** | Free | Symbols, imports, complexity (via tree-sitter) |
64
48
  | **Semantic** | Gemini | Architecture insights, pattern detection |
65
49
 
66
- Analysis results include expandable sections - you only pay for what you drill into.
67
-
68
- ## MCP Tools
69
-
70
- | Tool | Description |
71
- |------|-------------|
72
- | `analyze_repo` | Full analysis with progressive disclosure |
73
- | `query_repo` | Ask questions about a codebase |
74
- | `expand_section` | Drill into specific sections |
75
- | `read_files` | Read source files from a cached analysis |
76
- | `find_patterns` | Detect design/architecture patterns |
77
- | `trace_dataflow` | Trace data flow through the system |
78
- | `get_analysis_capabilities` | List supported languages and analysis options |
79
-
80
- ## Plugin Components
50
+ Results include expandable sections you only pay for what you drill into.
81
51
 
82
- ### Command
52
+ ## CLI
83
53
 
54
+ ```bash
55
+ npx codebase-analyzer-mcp analyze . # Standard analysis
56
+ npx codebase-analyzer-mcp analyze . -d surface # Fast, free overview
57
+ npx codebase-analyzer-mcp analyze . -d deep -s # Full semantic analysis
58
+ npx codebase-analyzer-mcp query . "how is auth handled?" # Ask a question
59
+ npx codebase-analyzer-mcp patterns . # Find design patterns
60
+ npx codebase-analyzer-mcp dataflow . "user login" # Trace data flow
84
61
  ```
85
- /cba:analyze [source] [--depth surface|standard|deep] [--focus <paths>]
86
- ```
87
-
88
- ### Agents
89
-
90
- | Agent | Purpose |
91
- |-------|---------|
92
- | `architecture-analyzer` | Full codebase architecture analysis |
93
- | `pattern-detective` | Design/anti-pattern detection |
94
- | `dataflow-tracer` | Data flow tracing through systems |
95
- | `codebase-explorer` | Quick exploration and Q&A |
96
-
97
- Agents are routed automatically based on your question.
98
62
 
99
63
  ## Development
100
64
 
@@ -102,8 +66,7 @@ Agents are routed automatically based on your question.
102
66
  git clone https://github.com/jaykaycodes/codebase-analyzer-mcp.git
103
67
  cd codebase-analyzer-mcp
104
68
  bun install
105
- bun run build # Build dist/
106
- bun run dev # Watch mode
69
+ bun run build
107
70
  ```
108
71
 
109
72
  For local MCP testing, create `.mcp.json` at repo root:
package/dist/cli/index.js CHANGED
@@ -44251,8 +44251,8 @@ var package_default;
44251
44251
  var init_package = __esm(() => {
44252
44252
  package_default = {
44253
44253
  name: "codebase-analyzer-mcp",
44254
- version: "2.1.2",
44255
- description: "Multi-layer codebase analysis with Gemini AI. MCP server + Claude plugin with progressive disclosure.",
44254
+ version: "2.2.0",
44255
+ description: "Multi-layer codebase analysis MCP server with Gemini AI and progressive disclosure.",
44256
44256
  type: "module",
44257
44257
  main: "dist/mcp/server.js",
44258
44258
  packageManager: "bun@1.3.8",
@@ -44262,13 +44262,7 @@ var init_package = __esm(() => {
44262
44262
  },
44263
44263
  files: [
44264
44264
  "dist/cli",
44265
- "dist/mcp",
44266
- "agents",
44267
- "commands",
44268
- "skills",
44269
- ".claude-plugin",
44270
- "CLAUDE.md",
44271
- "AGENTS.md"
44265
+ "dist/mcp"
44272
44266
  ],
44273
44267
  scripts: {
44274
44268
  build: "bun scripts/build.ts",
@@ -44277,7 +44271,7 @@ var init_package = __esm(() => {
44277
44271
  typecheck: "tsc --noEmit",
44278
44272
  test: "bun test",
44279
44273
  cli: "bun src/cli/index.ts",
44280
- version: "bun scripts/sync-version.ts && git add .",
44274
+ version: "git add .",
44281
44275
  postversion: "git push --follow-tags",
44282
44276
  prepublishOnly: "bun run build"
44283
44277
  },
@@ -71136,8 +71136,8 @@ function buildFallbackAnswer(question, analysisId, cached2, scored, fileContents
71136
71136
  // package.json
71137
71137
  var package_default = {
71138
71138
  name: "codebase-analyzer-mcp",
71139
- version: "2.1.2",
71140
- description: "Multi-layer codebase analysis with Gemini AI. MCP server + Claude plugin with progressive disclosure.",
71139
+ version: "2.2.0",
71140
+ description: "Multi-layer codebase analysis MCP server with Gemini AI and progressive disclosure.",
71141
71141
  type: "module",
71142
71142
  main: "dist/mcp/server.js",
71143
71143
  packageManager: "bun@1.3.8",
@@ -71147,13 +71147,7 @@ var package_default = {
71147
71147
  },
71148
71148
  files: [
71149
71149
  "dist/cli",
71150
- "dist/mcp",
71151
- "agents",
71152
- "commands",
71153
- "skills",
71154
- ".claude-plugin",
71155
- "CLAUDE.md",
71156
- "AGENTS.md"
71150
+ "dist/mcp"
71157
71151
  ],
71158
71152
  scripts: {
71159
71153
  build: "bun scripts/build.ts",
@@ -71162,7 +71156,7 @@ var package_default = {
71162
71156
  typecheck: "tsc --noEmit",
71163
71157
  test: "bun test",
71164
71158
  cli: "bun src/cli/index.ts",
71165
- version: "bun scripts/sync-version.ts && git add .",
71159
+ version: "git add .",
71166
71160
  postversion: "git push --follow-tags",
71167
71161
  prepublishOnly: "bun run build"
71168
71162
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "codebase-analyzer-mcp",
3
- "version": "2.1.2",
4
- "description": "Multi-layer codebase analysis with Gemini AI. MCP server + Claude plugin with progressive disclosure.",
3
+ "version": "2.2.0",
4
+ "description": "Multi-layer codebase analysis MCP server with Gemini AI and progressive disclosure.",
5
5
  "type": "module",
6
6
  "main": "dist/mcp/server.js",
7
7
  "packageManager": "bun@1.3.8",
@@ -11,13 +11,7 @@
11
11
  },
12
12
  "files": [
13
13
  "dist/cli",
14
- "dist/mcp",
15
- "agents",
16
- "commands",
17
- "skills",
18
- ".claude-plugin",
19
- "CLAUDE.md",
20
- "AGENTS.md"
14
+ "dist/mcp"
21
15
  ],
22
16
  "scripts": {
23
17
  "build": "bun scripts/build.ts",
@@ -26,7 +20,7 @@
26
20
  "typecheck": "tsc --noEmit",
27
21
  "test": "bun test",
28
22
  "cli": "bun src/cli/index.ts",
29
- "version": "bun scripts/sync-version.ts && git add .",
23
+ "version": "git add .",
30
24
  "postversion": "git push --follow-tags",
31
25
  "prepublishOnly": "bun run build"
32
26
  },
@@ -1,34 +0,0 @@
1
- {
2
- "name": "codebase-analyzer",
3
- "owner": {
4
- "name": "Jake Correa",
5
- "url": "https://github.com/jaykaycodes"
6
- },
7
- "metadata": {
8
- "description": "Multi-layer codebase analysis tools",
9
- "version": "2.1.2"
10
- },
11
- "plugins": [
12
- {
13
- "name": "codebase-analyzer",
14
- "description": "Multi-layer codebase analysis with Gemini AI. 4 agents, 1 command, 1 skill for architecture analysis, pattern detection, and dataflow tracing.",
15
- "version": "2.1.2",
16
- "author": {
17
- "name": "Jake Correa",
18
- "url": "https://github.com/jaykaycodes"
19
- },
20
- "homepage": "https://github.com/jaykaycodes/codebase-analyzer-mcp",
21
- "tags": [
22
- "codebase-analysis",
23
- "architecture",
24
- "patterns",
25
- "gemini",
26
- "mcp"
27
- ],
28
- "source": {
29
- "source": "github",
30
- "repo": "jaykaycodes/codebase-analyzer-mcp"
31
- }
32
- }
33
- ]
34
- }
@@ -1,32 +0,0 @@
1
- {
2
- "name": "codebase-analyzer",
3
- "version": "2.1.2",
4
- "description": "Multi-layer codebase analysis with Gemini AI. 4 agents, 1 command, 1 skill for architecture analysis, pattern detection, and dataflow tracing.",
5
- "author": {
6
- "name": "Jake Correa",
7
- "url": "https://github.com/jaykaycodes"
8
- },
9
- "homepage": "https://github.com/jaykaycodes/codebase-analyzer-mcp",
10
- "license": "MIT",
11
- "keywords": [
12
- "codebase-analysis",
13
- "architecture",
14
- "patterns",
15
- "gemini",
16
- "mcp",
17
- "progressive-disclosure",
18
- "tree-sitter"
19
- ],
20
- "mcpServers": {
21
- "codebase-analyzer": {
22
- "type": "stdio",
23
- "command": "node",
24
- "args": [
25
- "${CLAUDE_PLUGIN_ROOT}/dist/mcp/server.js"
26
- ],
27
- "env": {
28
- "GEMINI_API_KEY": "${GEMINI_API_KEY}"
29
- }
30
- }
31
- }
32
- }
package/AGENTS.md DELETED
@@ -1,112 +0,0 @@
1
- # Agent Instructions
2
-
3
- This repository is both an MCP server and a Claude plugin for multi-layer codebase analysis.
4
-
5
- ## Working Agreement
6
-
7
- - **Branching:** Feature branches for non-trivial changes
8
- - **Safety:** No destructive git commands, no deleting user data
9
- - **Testing:** Run `pnpm build` after changes - TypeScript errors break everything
10
- - **Architecture:** Respect layer separation (surface → structural → semantic)
11
- - **Counts:** When adding agents/commands/skills, update plugin.json description
12
-
13
- ## Repository Structure
14
-
15
- ```
16
- codebase-analyzer-mcp/
17
- ├── .claude-plugin/
18
- │ └── plugin.json # Plugin metadata
19
- ├── agents/
20
- │ ├── analysis/ # Analysis agents
21
- │ └── research/ # Research agents
22
- ├── commands/ # Slash commands
23
- ├── skills/ # Context-loaded skills
24
- ├── src/
25
- │ ├── mcp/ # MCP server + tools
26
- │ ├── cli/ # CLI interface
27
- │ └── core/ # Analysis engine
28
- │ └── layers/ # Surface, structural, semantic
29
- └── docs/ # Documentation
30
- ```
31
-
32
- ## Key Decisions
33
-
34
- | Decision | Rationale |
35
- |----------|-----------|
36
- | Gemini for semantic | Keep Claude context clean |
37
- | Tree-sitter for parsing | Fast AST without LLM |
38
- | Progressive disclosure | Minimize initial context cost |
39
- | Plugin + MCP | Both distribution paths |
40
-
41
- ## Layer Responsibilities
42
-
43
- **Surface Layer** (`src/core/layers/surface.ts`)
44
- - File enumeration, language detection
45
- - Entry points, module identification
46
- - NO LLM calls
47
-
48
- **Structural Layer** (`src/core/layers/structural.ts`)
49
- - Tree-sitter parsing
50
- - Symbol extraction
51
- - Import/export mapping
52
- - NO LLM calls
53
-
54
- **Semantic Layer** (`src/core/layers/semantic.ts`)
55
- - Gemini API calls
56
- - Architecture detection
57
- - Pattern recognition
58
- - EXPENSIVE - opt-in only
59
-
60
- ## Code Patterns
61
-
62
- **Partial failures:** Capture in `warnings[]` or `partialFailures[]`, don't throw
63
-
64
- **Token budget:** Check before expensive operations, warn if exceeded
65
-
66
- **Logging:** Use `logger` from `src/core/logger.ts`
67
-
68
- ## Plugin Component Guidelines
69
-
70
- ### Agents
71
-
72
- - Place in `agents/[category]/` by purpose
73
- - YAML frontmatter: `name`, `description` with examples
74
- - Description explains when to use the agent
75
- - Use haiku model for efficiency
76
-
77
- ### Commands
78
-
79
- - Place in `commands/`
80
- - Set `user-invocable: true`
81
- - Document usage, options, examples
82
- - Show workflow and implementation
83
-
84
- ### Skills
85
-
86
- - Directory in `skills/[name]/`
87
- - SKILL.md is entry point (<500 lines)
88
- - references/ for detailed docs
89
- - Description in third person
90
-
91
- ## Updating Plugin Counts
92
-
93
- After adding/removing components:
94
-
95
- ```bash
96
- # Count components
97
- ls agents/**/*.md | wc -l # agents
98
- ls commands/*.md | wc -l # commands
99
- ls -d skills/*/ | wc -l # skills
100
-
101
- # Update description in .claude-plugin/plugin.json
102
- ```
103
-
104
- Format: `"X agents, Y commands, Z skills"`
105
-
106
- ## Testing Checklist
107
-
108
- - [ ] `pnpm build` succeeds
109
- - [ ] `pnpm cba capabilities` returns JSON
110
- - [ ] `pnpm cba analyze . -d surface -q` works
111
- - [ ] New agent/command/skill follows patterns
112
- - [ ] plugin.json counts match actual files
package/CLAUDE.md DELETED
@@ -1,160 +0,0 @@
1
- # Codebase Analyzer MCP
2
-
3
- Multi-layer codebase analysis with Gemini AI. Both an MCP server and a Claude plugin.
4
-
5
- ## Philosophy
6
-
7
- **Progressive Disclosure**: Start cheap (surface), reveal more on demand. Don't analyze everything upfront.
8
-
9
- **Budget Awareness**: Track tokens. Surface is free, structural is cheap, semantic is expensive.
10
-
11
- **Graceful Degradation**: Partial failures don't break analysis. Capture warnings, continue.
12
-
13
- **Agent-First Design**: Output structured for AI agents - expandable sections, cost estimates, next steps.
14
-
15
- ## Quick Start
16
-
17
- ```bash
18
- pnpm install && pnpm build
19
- ```
20
-
21
- ## Plugin Components
22
-
23
- | Component | Count | Purpose |
24
- |-----------|-------|---------|
25
- | Agents | 4 | Specialized analysis tasks |
26
- | Commands | 1 | User-invocable actions |
27
- | Skills | 1 | Context-loaded guidance |
28
- | MCP Server | 1 | Tool interface for Claude |
29
-
30
- ### Agents
31
-
32
- | Agent | Purpose |
33
- |-------|---------|
34
- | `architecture-analyzer` | Full codebase architecture analysis |
35
- | `pattern-detective` | Design/anti-pattern detection |
36
- | `dataflow-tracer` | Data flow tracing through systems |
37
- | `codebase-explorer` | Quick exploration and Q&A |
38
-
39
- ### Commands
40
-
41
- | Command | Usage |
42
- |---------|-------|
43
- | `/cba:analyze` | Analyze a codebase |
44
-
45
- ### Skills
46
-
47
- | Skill | Purpose |
48
- |-------|---------|
49
- | `cba:codebase-analysis` | How to use the MCP tools |
50
-
51
- ## Architecture
52
-
53
- See [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) for system design.
54
-
55
- ## Key Paths
56
-
57
- | Path | Purpose |
58
- |------|---------|
59
- | `.claude-plugin/plugin.json` | Plugin metadata |
60
- | `agents/` | Agent definitions |
61
- | `commands/` | Slash commands |
62
- | `skills/` | Context-loaded skills |
63
- | `src/mcp/server.ts` | MCP server entry |
64
- | `src/mcp/tools/` | MCP tool definitions |
65
- | `src/cli/index.ts` | CLI interface |
66
- | `src/core/orchestrator.ts` | Analysis coordination |
67
- | `src/core/layers/` | Analysis layers |
68
-
69
- ## MCP Tools
70
-
71
- | Tool | Purpose | Cost |
72
- |------|---------|------|
73
- | `analyze_repo` | Full analysis with expandable sections | Varies |
74
- | `query_repo` | Ask questions about a codebase | Medium |
75
- | `expand_section` | Drill into specific sections | Low |
76
- | `read_files` | Read source files from cached analysis | None |
77
- | `find_patterns` | Pattern detection | Medium |
78
- | `trace_dataflow` | Data flow tracing | Medium |
79
- | `get_analysis_capabilities` | List capabilities | None |
80
-
81
- ## Analysis Depth
82
-
83
- | Depth | What It Does | LLM Cost |
84
- |-------|--------------|----------|
85
- | `surface` | File enumeration, languages, entry points | ~0 |
86
- | `standard` | + structural analysis with Tree-sitter | Low |
87
- | `deep` | + semantic analysis with Gemini | High |
88
-
89
- ## Adding Components
90
-
91
- ### Adding a New MCP Tool
92
-
93
- 1. Create `src/mcp/tools/your-tool.ts` (schema + execute)
94
- 2. Export from `src/mcp/tools/index.ts`
95
- 3. Register in `src/mcp/server.ts`
96
- 4. Add CLI command in `src/cli/index.ts` (optional)
97
- 5. `pnpm build`
98
-
99
- ### Adding an Agent
100
-
101
- 1. Create `agents/[category]/your-agent.md`
102
- 2. Use YAML frontmatter: name, description
103
- 3. Include examples in description
104
- 4. Update plugin.json description count
105
-
106
- ### Adding a Command
107
-
108
- 1. Create `commands/your-command.md`
109
- 2. Set `user-invocable: true` in frontmatter
110
- 3. Document usage, examples, workflow
111
- 4. Update plugin.json description count
112
-
113
- ### Adding a Skill
114
-
115
- 1. Create `skills/your-skill/SKILL.md`
116
- 2. Add references/ for detailed docs
117
- 3. Keep SKILL.md under 500 lines
118
- 4. Update plugin.json description count
119
-
120
- ## Environment
121
-
122
- ```bash
123
- GEMINI_API_KEY=... # Required for semantic analysis
124
- ```
125
-
126
- ## Releasing
127
-
128
- Uses npm trusted publishing (OIDC) - no NPM_TOKEN secret needed.
129
-
130
- 1. Bump version: `npm version patch` (or minor/major)
131
- 2. Sync version to plugin.json: `bun run version:sync`
132
- 3. Push with tags: `git push && git push --tags`
133
-
134
- CI automatically publishes to npm when version changes on main.
135
-
136
- **Trusted publisher config:** npm package must be linked to `jaykaycodes/codebase-analyzer-mcp` in npm settings (Settings → Publishing access → Add GitHub Actions as publisher).
137
-
138
- **Requirements:** npm >= 11.5.1 (CI updates npm automatically). See [npm trusted publishing docs](https://docs.npmjs.com/trusted-publishers/).
139
-
140
- ## Key Learnings
141
-
142
- _This section captures learnings as we work on this repository._
143
-
144
- ### 2026-01-28: Source name extraction for GitHub URLs
145
-
146
- When analyzing GitHub repos, temp clone directory name (cba-XXXXX) was shown instead of repo name. Fixed by extracting owner/repo from GitHub URLs before resolving to local path and passing `sourceName` through analysis chain.
147
-
148
- **Pattern:** Preserve user-facing identifiers separately from internal paths.
149
-
150
- ### 2026-01-28: Property name consistency between types and usage
151
-
152
- Multiple bugs from accessing wrong property names (l.name vs l.language, totalFiles vs fileCount).
153
-
154
- **Pattern:** When adding new types, grep for all usages of old patterns and update together.
155
-
156
- ### 2026-01-28: Plugin architecture for agentic development
157
-
158
- Adopted compound-engineering patterns: agents for specialized tasks, commands for user actions, skills for context-loaded guidance. Makes the repo self-documenting for Claude.
159
-
160
- **Pattern:** Structure repos as plugins even for MCP servers - the documentation patterns apply.
@@ -1,115 +0,0 @@
1
- ---
2
- name: cba:architecture-analyzer
3
- description: "Use this agent when you need to understand a codebase's architecture, identify patterns, and get a high-level overview. This agent uses the codebase-analyzer MCP to perform multi-layer analysis with progressive disclosure - starting cheap and drilling down as needed.\n\n<example>Context: User wants to understand a new codebase.\nuser: \"Help me understand the architecture of this repo\"\nassistant: \"I'll use the architecture-analyzer agent to analyze the codebase structure and patterns.\"\n<commentary>Since the user wants architectural understanding, use architecture-analyzer to run progressive analysis.</commentary></example>\n\n<example>Context: User is evaluating a library.\nuser: \"What patterns does this library use?\"\nassistant: \"Let me use the architecture-analyzer agent to detect patterns in this codebase.\"\n<commentary>Pattern detection is a core capability of architecture-analyzer.</commentary></example>"
4
- model: haiku
5
- ---
6
-
7
- You are an expert software architect specializing in codebase analysis. Your mission is to help users understand codebases quickly and thoroughly using the codebase-analyzer MCP tools.
8
-
9
- ## Analysis Strategy
10
-
11
- ### Step 1: Surface Analysis (Always Start Here)
12
-
13
- Run a surface-level analysis first - it's fast and free:
14
-
15
- ```
16
- mcp__codebase-analyzer__analyze_repo(source: "<path>", depth: "surface")
17
- ```
18
-
19
- This gives you:
20
- - Repository map (files, languages, structure)
21
- - Entry points
22
- - Module identification
23
- - Complexity score
24
-
25
- ### Step 2: Evaluate Complexity
26
-
27
- Based on surface analysis:
28
- - **Low complexity (<30)**: Surface may be enough
29
- - **Medium complexity (30-60)**: Standard depth recommended
30
- - **High complexity (>60)**: Consider deep analysis with semantics
31
-
32
- ### Step 3: Standard Analysis (If Needed)
33
-
34
- For structural understanding:
35
-
36
- ```
37
- mcp__codebase-analyzer__analyze_repo(source: "<path>", depth: "standard")
38
- ```
39
-
40
- Adds:
41
- - Symbol extraction (functions, classes, types)
42
- - Import/export relationships
43
- - Complexity metrics per module
44
-
45
- ### Step 4: Expand Sections (On Demand)
46
-
47
- Don't expand everything. Ask the user what they want to explore:
48
-
49
- ```
50
- mcp__codebase-analyzer__expand_section(analysisId: "<id>", sectionId: "<section>", depth: "detail")
51
- ```
52
-
53
- ### Step 5: Pattern Detection (If Relevant)
54
-
55
- For specific pattern questions:
56
-
57
- ```
58
- mcp__codebase-analyzer__find_patterns(source: "<path>", patternTypes: ["singleton", "factory", "repository"])
59
- ```
60
-
61
- ### Step 6: Deep Semantic Analysis (Expensive - Ask First)
62
-
63
- Only use with explicit permission:
64
-
65
- ```
66
- mcp__codebase-analyzer__analyze_repo(source: "<path>", depth: "deep", includeSemantics: true)
67
- ```
68
-
69
- This uses Gemini API and costs tokens.
70
-
71
- ## Output Format
72
-
73
- Structure your findings as:
74
-
75
- ```markdown
76
- ## Architecture Overview
77
-
78
- **Type:** [monolith/microservices/serverless/etc]
79
- **Complexity:** [low/medium/high] (score: X)
80
- **Primary Language:** [language] (X%)
81
-
82
- ## Key Patterns
83
-
84
- 1. **[Pattern Name]** - [where it's used]
85
- 2. ...
86
-
87
- ## Module Structure
88
-
89
- - `[module]` - [purpose]
90
- - ...
91
-
92
- ## Entry Points
93
-
94
- - `[file]` - [what it does]
95
-
96
- ## Recommendations
97
-
98
- - [What to explore next]
99
- - [Potential concerns]
100
- ```
101
-
102
- ## Guidelines
103
-
104
- **DO:**
105
- - Start with surface analysis (free)
106
- - Let complexity guide depth decisions
107
- - Ask before running expensive operations
108
- - Present expandable sections for user choice
109
- - Focus on what the user asked about
110
-
111
- **DON'T:**
112
- - Run deep analysis without asking
113
- - Expand all sections upfront
114
- - Dump raw JSON to user
115
- - Ignore the token budget