codebase-analyzer-mcp 1.0.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/.claude-plugin/marketplace.json +31 -0
- package/.claude-plugin/plugin.json +29 -0
- package/AGENTS.md +112 -0
- package/CLAUDE.md +150 -0
- package/LICENSE +21 -0
- package/README.md +252 -0
- package/agents/analysis/architecture-analyzer.md +115 -0
- package/agents/analysis/dataflow-tracer.md +120 -0
- package/agents/analysis/pattern-detective.md +110 -0
- package/agents/research/codebase-explorer.md +106 -0
- package/commands/analyze.md +74 -0
- package/commands/compare.md +66 -0
- package/commands/explore.md +64 -0
- package/commands/patterns.md +75 -0
- package/commands/trace.md +65 -0
- package/dist/cli/index.js +73758 -0
- package/dist/mcp/server.js +70931 -0
- package/package.json +75 -0
- package/skills/add-mcp-tool/SKILL.md +209 -0
- package/skills/codebase-analysis/SKILL.md +128 -0
- package/skills/codebase-analysis/references/api-reference.md +201 -0
- package/skills/debugging-analysis/SKILL.md +213 -0
package/package.json
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "codebase-analyzer-mcp",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Multi-layer codebase analysis with Gemini AI. MCP server + Claude plugin with progressive disclosure.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/mcp/server.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"cba": "dist/cli/index.js",
|
|
9
|
+
"codebase-analyzer": "dist/cli/index.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist/cli",
|
|
13
|
+
"dist/mcp",
|
|
14
|
+
"agents",
|
|
15
|
+
"commands",
|
|
16
|
+
"skills",
|
|
17
|
+
".claude-plugin",
|
|
18
|
+
"CLAUDE.md",
|
|
19
|
+
"AGENTS.md"
|
|
20
|
+
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "bun run build:js && bun run build:bin",
|
|
23
|
+
"build:js": "bun build src/mcp/server.ts --outfile dist/mcp/server.js --target node && bun build src/cli/index.ts --outfile dist/cli/index.js --target node && echo '#!/usr/bin/env node' | cat - dist/cli/index.js > /tmp/cba.js && mv /tmp/cba.js dist/cli/index.js",
|
|
24
|
+
"build:bin": "bun build src/cli/index.ts --compile --outfile dist/cba",
|
|
25
|
+
"build:bin:all": "bun run build:bin:macos && bun run build:bin:linux && bun run build:bin:windows",
|
|
26
|
+
"build:bin:macos": "bun build src/cli/index.ts --compile --target=bun-darwin-arm64 --outfile dist/cba-macos-arm64 && bun build src/cli/index.ts --compile --target=bun-darwin-x64 --outfile dist/cba-macos-x64",
|
|
27
|
+
"build:bin:linux": "bun build src/cli/index.ts --compile --target=bun-linux-x64 --outfile dist/cba-linux-x64 && bun build src/cli/index.ts --compile --target=bun-linux-arm64 --outfile dist/cba-linux-arm64",
|
|
28
|
+
"build:bin:windows": "bun build src/cli/index.ts --compile --target=bun-windows-x64 --outfile dist/cba-windows-x64.exe",
|
|
29
|
+
"dev": "bun --watch src/cli/index.ts",
|
|
30
|
+
"start": "bun dist/mcp/server.js",
|
|
31
|
+
"typecheck": "tsc --noEmit",
|
|
32
|
+
"test": "bun test",
|
|
33
|
+
"cli": "bun src/cli/index.ts",
|
|
34
|
+
"cba": "bun src/cli/index.ts",
|
|
35
|
+
"prepublishOnly": "bun run build:js"
|
|
36
|
+
},
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "git+https://github.com/jkcorrea/codebase-analyzer-mcp.git"
|
|
40
|
+
},
|
|
41
|
+
"homepage": "https://github.com/jkcorrea/codebase-analyzer-mcp#readme",
|
|
42
|
+
"bugs": {
|
|
43
|
+
"url": "https://github.com/jkcorrea/codebase-analyzer-mcp/issues"
|
|
44
|
+
},
|
|
45
|
+
"author": "jkcorrea",
|
|
46
|
+
"keywords": [
|
|
47
|
+
"mcp",
|
|
48
|
+
"gemini",
|
|
49
|
+
"codebase",
|
|
50
|
+
"analyzer",
|
|
51
|
+
"architecture",
|
|
52
|
+
"patterns",
|
|
53
|
+
"claude",
|
|
54
|
+
"ai",
|
|
55
|
+
"progressive-disclosure",
|
|
56
|
+
"tree-sitter"
|
|
57
|
+
],
|
|
58
|
+
"license": "MIT",
|
|
59
|
+
"engines": {
|
|
60
|
+
"node": ">=20"
|
|
61
|
+
},
|
|
62
|
+
"dependencies": {
|
|
63
|
+
"@google/genai": "^1.38.0",
|
|
64
|
+
"@modelcontextprotocol/sdk": "^1.25.3",
|
|
65
|
+
"commander": "^14.0.2",
|
|
66
|
+
"glob": "^13.0.0",
|
|
67
|
+
"web-tree-sitter": "^0.26.3",
|
|
68
|
+
"zod": "^4.3.6"
|
|
69
|
+
},
|
|
70
|
+
"devDependencies": {
|
|
71
|
+
"@types/bun": "latest",
|
|
72
|
+
"@types/node": "^25.1.0",
|
|
73
|
+
"typescript": "^5.9.3"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: add-mcp-tool
|
|
3
|
+
description: This skill guides adding new MCP tools to the codebase-analyzer server. Use when extending the analyzer with new capabilities like new analysis types, query tools, or integrations.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Adding MCP Tools
|
|
7
|
+
|
|
8
|
+
## Quick Start
|
|
9
|
+
|
|
10
|
+
To add a new MCP tool:
|
|
11
|
+
|
|
12
|
+
1. Create `src/mcp/tools/your-tool.ts`
|
|
13
|
+
2. Export from `src/mcp/tools/index.ts`
|
|
14
|
+
3. Register in `src/mcp/server.ts`
|
|
15
|
+
4. Add CLI command (optional)
|
|
16
|
+
5. Run `pnpm build`
|
|
17
|
+
|
|
18
|
+
## Step 1: Create Tool File
|
|
19
|
+
|
|
20
|
+
Create `src/mcp/tools/your-tool.ts`:
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
import { z } from "zod";
|
|
24
|
+
import { resolveSource } from "../../core/repo-loader.js";
|
|
25
|
+
|
|
26
|
+
// Schema for MCP tool parameters
|
|
27
|
+
export const yourToolSchema = {
|
|
28
|
+
source: z
|
|
29
|
+
.string()
|
|
30
|
+
.describe("Local path or GitHub URL to the repository"),
|
|
31
|
+
yourParam: z
|
|
32
|
+
.string()
|
|
33
|
+
.optional()
|
|
34
|
+
.describe("Description of parameter"),
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export type YourToolInput = {
|
|
38
|
+
source: string;
|
|
39
|
+
yourParam?: string;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// Execute function
|
|
43
|
+
export async function executeYourTool(input: YourToolInput): Promise<object> {
|
|
44
|
+
const { source, yourParam } = input;
|
|
45
|
+
|
|
46
|
+
// Resolve source (handles GitHub URLs)
|
|
47
|
+
const { repoPath, cleanup } = await resolveSource(source);
|
|
48
|
+
|
|
49
|
+
try {
|
|
50
|
+
// Your implementation here
|
|
51
|
+
const result = {
|
|
52
|
+
// Your result structure
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
return result;
|
|
56
|
+
} finally {
|
|
57
|
+
// Clean up temp directory if GitHub clone
|
|
58
|
+
if (cleanup) await cleanup();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Step 2: Export from Index
|
|
64
|
+
|
|
65
|
+
Add to `src/mcp/tools/index.ts`:
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
export {
|
|
69
|
+
yourToolSchema,
|
|
70
|
+
executeYourTool,
|
|
71
|
+
type YourToolInput,
|
|
72
|
+
} from "./your-tool.js";
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Step 3: Register in Server
|
|
76
|
+
|
|
77
|
+
Add to `src/mcp/server.ts`:
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
import {
|
|
81
|
+
yourToolSchema,
|
|
82
|
+
executeYourTool,
|
|
83
|
+
} from "./tools/index.js";
|
|
84
|
+
|
|
85
|
+
server.tool(
|
|
86
|
+
"your_tool_name",
|
|
87
|
+
"Description of what the tool does",
|
|
88
|
+
{
|
|
89
|
+
source: yourToolSchema.source,
|
|
90
|
+
yourParam: yourToolSchema.yourParam,
|
|
91
|
+
},
|
|
92
|
+
async ({ source, yourParam }) => {
|
|
93
|
+
try {
|
|
94
|
+
const result = await executeYourTool({ source, yourParam });
|
|
95
|
+
return {
|
|
96
|
+
content: [{
|
|
97
|
+
type: "text" as const,
|
|
98
|
+
text: JSON.stringify(result, null, 2),
|
|
99
|
+
}],
|
|
100
|
+
};
|
|
101
|
+
} catch (error) {
|
|
102
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
103
|
+
return {
|
|
104
|
+
content: [{
|
|
105
|
+
type: "text" as const,
|
|
106
|
+
text: `Error: ${message}`,
|
|
107
|
+
}],
|
|
108
|
+
isError: true,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Step 4: Add CLI Command (Optional)
|
|
116
|
+
|
|
117
|
+
Add to `src/cli/index.ts`:
|
|
118
|
+
|
|
119
|
+
```typescript
|
|
120
|
+
program
|
|
121
|
+
.command("your-command")
|
|
122
|
+
.description("What this command does")
|
|
123
|
+
.argument("<source>", "Local path or GitHub URL")
|
|
124
|
+
.option("-p, --param <value>", "Your parameter")
|
|
125
|
+
.action(async (source: string, options) => {
|
|
126
|
+
try {
|
|
127
|
+
const { executeYourTool } = await import("../mcp/tools/your-tool.js");
|
|
128
|
+
const result = await executeYourTool({
|
|
129
|
+
source,
|
|
130
|
+
yourParam: options.param,
|
|
131
|
+
});
|
|
132
|
+
console.log(JSON.stringify(result, null, 2));
|
|
133
|
+
} catch (error) {
|
|
134
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
135
|
+
process.exit(1);
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Step 5: Add Types (If Needed)
|
|
141
|
+
|
|
142
|
+
Add to `src/types.ts`:
|
|
143
|
+
|
|
144
|
+
```typescript
|
|
145
|
+
export interface YourToolResult {
|
|
146
|
+
// Define your result structure
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Patterns to Follow
|
|
151
|
+
|
|
152
|
+
### Use Existing Layers
|
|
153
|
+
|
|
154
|
+
If your tool does analysis, consider using existing layers:
|
|
155
|
+
|
|
156
|
+
```typescript
|
|
157
|
+
import { surfaceAnalysis } from "../../core/layers/index.js";
|
|
158
|
+
|
|
159
|
+
const surface = await surfaceAnalysis(repoPath, { exclude });
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Handle Partial Failures
|
|
163
|
+
|
|
164
|
+
Don't throw on every error - capture and continue:
|
|
165
|
+
|
|
166
|
+
```typescript
|
|
167
|
+
const warnings: string[] = [];
|
|
168
|
+
const failures: { area: string; error: string }[] = [];
|
|
169
|
+
|
|
170
|
+
try {
|
|
171
|
+
// risky operation
|
|
172
|
+
} catch (error) {
|
|
173
|
+
failures.push({
|
|
174
|
+
area: "operation-name",
|
|
175
|
+
error: error.message
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return { result, warnings, failures };
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Respect Token Budget
|
|
183
|
+
|
|
184
|
+
Check budget before expensive operations:
|
|
185
|
+
|
|
186
|
+
```typescript
|
|
187
|
+
if (estimatedTokens > tokenBudget) {
|
|
188
|
+
warnings.push(`Estimated tokens (${estimatedTokens}) exceeds budget`);
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## Testing
|
|
193
|
+
|
|
194
|
+
After adding:
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
pnpm build
|
|
198
|
+
pnpm cba your-command ./test-repo
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## Checklist
|
|
202
|
+
|
|
203
|
+
- [ ] Tool file created with schema and execute function
|
|
204
|
+
- [ ] Exported from index.ts
|
|
205
|
+
- [ ] Registered in server.ts
|
|
206
|
+
- [ ] CLI command added (if applicable)
|
|
207
|
+
- [ ] Types added to types.ts (if needed)
|
|
208
|
+
- [ ] `pnpm build` passes
|
|
209
|
+
- [ ] Tool works via MCP and CLI
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: codebase-analysis
|
|
3
|
+
description: This skill teaches how to effectively analyze codebases using the codebase-analyzer MCP tools. Use when exploring new repositories, understanding architecture, detecting patterns, or tracing data flow.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Codebase Analysis
|
|
7
|
+
|
|
8
|
+
## Quick Start
|
|
9
|
+
|
|
10
|
+
Analyze any codebase with progressive disclosure:
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
mcp__codebase-analyzer__analyze_repo(source: ".", depth: "standard")
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Analysis Depths
|
|
17
|
+
|
|
18
|
+
| Depth | Speed | Cost | Use When |
|
|
19
|
+
|-------|-------|------|----------|
|
|
20
|
+
| `surface` | Fast | Free | Quick overview, file structure |
|
|
21
|
+
| `standard` | Medium | Low | Understanding architecture, symbols |
|
|
22
|
+
| `deep` | Slow | High | Full semantic analysis with AI |
|
|
23
|
+
|
|
24
|
+
**Rule of thumb:** Start with surface, upgrade if needed.
|
|
25
|
+
|
|
26
|
+
## Core Tools
|
|
27
|
+
|
|
28
|
+
### 1. Analyze Repository
|
|
29
|
+
|
|
30
|
+
```javascript
|
|
31
|
+
mcp__codebase-analyzer__analyze_repo({
|
|
32
|
+
source: ".", // Local path or GitHub URL
|
|
33
|
+
depth: "standard", // surface | standard | deep
|
|
34
|
+
focus: ["src/api"], // Optional: focus areas
|
|
35
|
+
exclude: ["node_modules"], // Optional: exclude patterns
|
|
36
|
+
tokenBudget: 800000, // Optional: max tokens
|
|
37
|
+
includeSemantics: false // Optional: enable AI analysis
|
|
38
|
+
})
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**Returns:**
|
|
42
|
+
- `repositoryMap`: Files, languages, structure
|
|
43
|
+
- `summary`: Architecture type, patterns, complexity
|
|
44
|
+
- `sections`: Expandable areas for drill-down
|
|
45
|
+
- `forAgent`: Quick summary and next steps
|
|
46
|
+
|
|
47
|
+
### 2. Expand Section
|
|
48
|
+
|
|
49
|
+
After analysis, drill into specific sections:
|
|
50
|
+
|
|
51
|
+
```javascript
|
|
52
|
+
mcp__codebase-analyzer__expand_section({
|
|
53
|
+
analysisId: "analysis_xxx", // From analyze_repo result
|
|
54
|
+
sectionId: "module_src_api", // Section ID to expand
|
|
55
|
+
depth: "detail" // detail | full
|
|
56
|
+
})
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### 3. Find Patterns
|
|
60
|
+
|
|
61
|
+
Detect design and architecture patterns:
|
|
62
|
+
|
|
63
|
+
```javascript
|
|
64
|
+
mcp__codebase-analyzer__find_patterns({
|
|
65
|
+
source: ".",
|
|
66
|
+
patternTypes: ["singleton", "factory", "repository"] // Optional filter
|
|
67
|
+
})
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Available patterns:** singleton, factory, observer, strategy, decorator, adapter, facade, repository, dependency-injection, event-driven, pub-sub, middleware, mvc, mvvm, clean-architecture, hexagonal, cqrs, saga
|
|
71
|
+
|
|
72
|
+
### 4. Trace Dataflow
|
|
73
|
+
|
|
74
|
+
Follow data through the system:
|
|
75
|
+
|
|
76
|
+
```javascript
|
|
77
|
+
mcp__codebase-analyzer__trace_dataflow({
|
|
78
|
+
source: ".",
|
|
79
|
+
from: "user login", // Entry point
|
|
80
|
+
to: "database" // Optional destination
|
|
81
|
+
})
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### 5. Get Capabilities
|
|
85
|
+
|
|
86
|
+
Check what's available:
|
|
87
|
+
|
|
88
|
+
```javascript
|
|
89
|
+
mcp__codebase-analyzer__get_analysis_capabilities()
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Workflow Patterns
|
|
93
|
+
|
|
94
|
+
### New Codebase Orientation
|
|
95
|
+
|
|
96
|
+
1. Run surface analysis
|
|
97
|
+
2. Review repository map and entry points
|
|
98
|
+
3. Expand interesting modules
|
|
99
|
+
4. Run pattern detection if architecture unclear
|
|
100
|
+
|
|
101
|
+
### Security Review
|
|
102
|
+
|
|
103
|
+
1. Trace dataflow from external inputs
|
|
104
|
+
2. Check for anti-patterns
|
|
105
|
+
3. Map trust boundaries
|
|
106
|
+
|
|
107
|
+
### Understanding Legacy Code
|
|
108
|
+
|
|
109
|
+
1. Deep analysis with semantics
|
|
110
|
+
2. Pattern detection for architecture
|
|
111
|
+
3. Expand each major module
|
|
112
|
+
|
|
113
|
+
## Guidelines
|
|
114
|
+
|
|
115
|
+
**DO:**
|
|
116
|
+
- Start cheap (surface), escalate if needed
|
|
117
|
+
- Use `focus` to limit scope for large repos
|
|
118
|
+
- Check `expansionCost` before expanding sections
|
|
119
|
+
- Use `forAgent.suggestedNextSteps`
|
|
120
|
+
|
|
121
|
+
**DON'T:**
|
|
122
|
+
- Run deep analysis on first request
|
|
123
|
+
- Ignore token budget warnings
|
|
124
|
+
- Expand all sections at once
|
|
125
|
+
|
|
126
|
+
## References
|
|
127
|
+
|
|
128
|
+
For detailed API documentation, see [references/api-reference.md](./references/api-reference.md).
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
# API Reference
|
|
2
|
+
|
|
3
|
+
Complete reference for codebase-analyzer MCP tools.
|
|
4
|
+
|
|
5
|
+
## analyze_repo
|
|
6
|
+
|
|
7
|
+
Full architectural analysis with progressive disclosure.
|
|
8
|
+
|
|
9
|
+
### Parameters
|
|
10
|
+
|
|
11
|
+
| Parameter | Type | Required | Default | Description |
|
|
12
|
+
|-----------|------|----------|---------|-------------|
|
|
13
|
+
| `source` | string | Yes | - | Local path or GitHub URL |
|
|
14
|
+
| `depth` | enum | No | "standard" | surface, standard, deep |
|
|
15
|
+
| `focus` | string[] | No | - | Paths to focus on |
|
|
16
|
+
| `exclude` | string[] | No | - | Glob patterns to exclude |
|
|
17
|
+
| `tokenBudget` | number | No | 800000 | Max tokens for analysis |
|
|
18
|
+
| `includeSemantics` | boolean | No | false | Enable LLM analysis |
|
|
19
|
+
|
|
20
|
+
### Response
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
{
|
|
24
|
+
analysisId: string; // Use for expand_section
|
|
25
|
+
version: 2;
|
|
26
|
+
timestamp: string;
|
|
27
|
+
source: string;
|
|
28
|
+
depth: "surface" | "standard" | "deep";
|
|
29
|
+
tokenCost: number;
|
|
30
|
+
durationMs: number;
|
|
31
|
+
|
|
32
|
+
repositoryMap: {
|
|
33
|
+
name: string;
|
|
34
|
+
languages: Array<{
|
|
35
|
+
language: string;
|
|
36
|
+
fileCount: number;
|
|
37
|
+
percentage: number;
|
|
38
|
+
extensions: string[];
|
|
39
|
+
}>;
|
|
40
|
+
fileCount: number;
|
|
41
|
+
totalSize: number;
|
|
42
|
+
estimatedTokens: number;
|
|
43
|
+
entryPoints: string[];
|
|
44
|
+
structure: DirectoryNode;
|
|
45
|
+
readme?: string;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
summary: {
|
|
49
|
+
architectureType: string;
|
|
50
|
+
primaryPatterns: string[];
|
|
51
|
+
techStack: string[];
|
|
52
|
+
complexity: "low" | "medium" | "high";
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
sections: Array<{
|
|
56
|
+
id: string;
|
|
57
|
+
title: string;
|
|
58
|
+
type: "module" | "pattern" | "datamodel" | "api" | "custom";
|
|
59
|
+
summary: string;
|
|
60
|
+
canExpand: boolean;
|
|
61
|
+
expansionCost: {
|
|
62
|
+
detail: number;
|
|
63
|
+
full: number;
|
|
64
|
+
};
|
|
65
|
+
}>;
|
|
66
|
+
|
|
67
|
+
forAgent: {
|
|
68
|
+
quickSummary: string;
|
|
69
|
+
keyInsights: string[];
|
|
70
|
+
suggestedNextSteps: string[];
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
warnings?: string[];
|
|
74
|
+
partialFailures?: Array<{
|
|
75
|
+
layer: string;
|
|
76
|
+
error: string;
|
|
77
|
+
}>;
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## expand_section
|
|
82
|
+
|
|
83
|
+
Expand a section from previous analysis.
|
|
84
|
+
|
|
85
|
+
### Parameters
|
|
86
|
+
|
|
87
|
+
| Parameter | Type | Required | Description |
|
|
88
|
+
|-----------|------|----------|-------------|
|
|
89
|
+
| `analysisId` | string | Yes | From analyze_repo result |
|
|
90
|
+
| `sectionId` | string | Yes | Section ID to expand |
|
|
91
|
+
| `depth` | enum | No | "detail" or "full" (default: detail) |
|
|
92
|
+
|
|
93
|
+
### Response
|
|
94
|
+
|
|
95
|
+
```typescript
|
|
96
|
+
{
|
|
97
|
+
section: ExpandableSection | null;
|
|
98
|
+
error?: string;
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## find_patterns
|
|
103
|
+
|
|
104
|
+
Detect patterns in codebase.
|
|
105
|
+
|
|
106
|
+
### Parameters
|
|
107
|
+
|
|
108
|
+
| Parameter | Type | Required | Description |
|
|
109
|
+
|-----------|------|----------|-------------|
|
|
110
|
+
| `source` | string | Yes | Local path or GitHub URL |
|
|
111
|
+
| `patternTypes` | string[] | No | Filter to specific patterns |
|
|
112
|
+
|
|
113
|
+
### Available Pattern Types
|
|
114
|
+
|
|
115
|
+
**Design Patterns:**
|
|
116
|
+
- `singleton` - Single instance pattern
|
|
117
|
+
- `factory` - Object creation abstraction
|
|
118
|
+
- `observer` - Event subscription pattern
|
|
119
|
+
- `strategy` - Interchangeable algorithms
|
|
120
|
+
- `decorator` - Dynamic behavior extension
|
|
121
|
+
- `adapter` - Interface compatibility
|
|
122
|
+
- `facade` - Simplified interface
|
|
123
|
+
- `repository` - Data access abstraction
|
|
124
|
+
- `dependency-injection` - Inversion of control
|
|
125
|
+
|
|
126
|
+
**Architectural Patterns:**
|
|
127
|
+
- `event-driven` - Event-based architecture
|
|
128
|
+
- `pub-sub` - Publish-subscribe messaging
|
|
129
|
+
- `middleware` - Request processing chain
|
|
130
|
+
- `mvc` - Model-View-Controller
|
|
131
|
+
- `mvvm` - Model-View-ViewModel
|
|
132
|
+
- `clean-architecture` - Dependency rule layers
|
|
133
|
+
- `hexagonal` - Ports and adapters
|
|
134
|
+
- `cqrs` - Command Query Responsibility Segregation
|
|
135
|
+
- `saga` - Distributed transaction pattern
|
|
136
|
+
|
|
137
|
+
### Response
|
|
138
|
+
|
|
139
|
+
```typescript
|
|
140
|
+
{
|
|
141
|
+
patterns: Array<{
|
|
142
|
+
name: string;
|
|
143
|
+
type: "architectural" | "design" | "anti-pattern";
|
|
144
|
+
confidence: number; // 0-1
|
|
145
|
+
locations: string[]; // File paths
|
|
146
|
+
description: string;
|
|
147
|
+
}>;
|
|
148
|
+
summary: string;
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## trace_dataflow
|
|
153
|
+
|
|
154
|
+
Trace data flow through the system.
|
|
155
|
+
|
|
156
|
+
### Parameters
|
|
157
|
+
|
|
158
|
+
| Parameter | Type | Required | Description |
|
|
159
|
+
|-----------|------|----------|-------------|
|
|
160
|
+
| `source` | string | Yes | Local path or GitHub URL |
|
|
161
|
+
| `from` | string | Yes | Entry point (function, file, or description) |
|
|
162
|
+
| `to` | string | No | Destination to trace to |
|
|
163
|
+
|
|
164
|
+
### Response
|
|
165
|
+
|
|
166
|
+
```typescript
|
|
167
|
+
{
|
|
168
|
+
entryPoint: string;
|
|
169
|
+
destination?: string;
|
|
170
|
+
steps: Array<{
|
|
171
|
+
location: string;
|
|
172
|
+
operation: string;
|
|
173
|
+
dataShape?: string;
|
|
174
|
+
}>;
|
|
175
|
+
securityObservations: string[];
|
|
176
|
+
recommendations: string[];
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## get_analysis_capabilities
|
|
181
|
+
|
|
182
|
+
List available analysis options.
|
|
183
|
+
|
|
184
|
+
### Parameters
|
|
185
|
+
|
|
186
|
+
None.
|
|
187
|
+
|
|
188
|
+
### Response
|
|
189
|
+
|
|
190
|
+
```typescript
|
|
191
|
+
{
|
|
192
|
+
layers: string[];
|
|
193
|
+
depths: string[];
|
|
194
|
+
supportedLanguages: string[];
|
|
195
|
+
tools: Array<{
|
|
196
|
+
name: string;
|
|
197
|
+
description: string;
|
|
198
|
+
parameters: string[];
|
|
199
|
+
}>;
|
|
200
|
+
}
|
|
201
|
+
```
|