codemap-ai 0.1.2 → 0.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
@@ -2,157 +2,113 @@
2
2
 
3
3
  AI-powered codebase knowledge graph generator with Claude Code integration.
4
4
 
5
- **CodeMap** scans your codebase, builds a knowledge graph of all functions, classes, imports, and their relationships, then generates Claude Code skills that help the AI understand your project.
6
-
7
- ## Features
8
-
9
- - **Multi-language support**: Python, TypeScript, JavaScript (more coming)
10
- - **Knowledge graph**: SQLite-based graph of code relationships
11
- - **Auto-generated skills**: Creates Claude Code skills from your codebase
12
- - **Impact analysis**: See what files are affected by changes
13
- - **Web visualization**: Interactive D3 force-directed graph
14
- - **MCP server**: Direct integration with Claude Code
5
+ **One command to understand your entire codebase.**
15
6
 
16
7
  ## Quick Start
17
8
 
18
9
  ```bash
19
- # Scan your project
20
- npx codemap-ai scan /path/to/project
21
-
22
- # Generate Claude Code skills
23
- npx codemap-ai generate-skills /path/to/project
10
+ # Initialize everything in one command
11
+ npx codemap-ai init
24
12
 
25
- # Start visualization server
26
- npx codemap-ai serve /path/to/project
13
+ # That's it! Now use skills in Claude Code:
14
+ # /architecture - Project overview
15
+ # /patterns - Code conventions
16
+ # /impact - Change analysis
27
17
  ```
28
18
 
29
- ## Commands
19
+ ## What It Does
30
20
 
31
- ### `codemap scan [path]`
21
+ 1. **Scans** your codebase using Tree-sitter (Python, TypeScript, JavaScript)
22
+ 2. **Builds** a knowledge graph of all functions, classes, imports, and calls
23
+ 3. **Generates** Claude Code skills that understand your project
24
+ 4. **Connects** to Claude Code via MCP for intelligent queries
32
25
 
33
- Scan a codebase and build the knowledge graph.
26
+ ## Installation
34
27
 
35
28
  ```bash
36
- codemap scan .
37
- codemap scan /path/to/project --clean
38
- codemap scan . --include "src/**/*.ts" --exclude "**/*.test.ts"
39
- ```
29
+ # Option 1: Use directly with npx (recommended)
30
+ npx codemap-ai init
40
31
 
41
- Options:
42
- - `-o, --output <dir>` - Output directory (default: `.codemap`)
43
- - `--include <patterns...>` - Glob patterns to include
44
- - `--exclude <patterns...>` - Glob patterns to exclude
45
- - `--clean` - Clear existing data before scanning
46
-
47
- ### `codemap generate-skills [path]`
48
-
49
- Generate Claude Code skills from the knowledge graph.
50
-
51
- ```bash
52
- codemap generate-skills .
53
- codemap generate-skills . --name "My Project"
32
+ # Option 2: Install globally
33
+ npm install -g codemap-ai
34
+ codemap init
54
35
  ```
55
36
 
56
- This creates skills in `.claude/skills/codemap/`:
57
- - `/architecture` - Project structure overview
58
- - `/patterns` - Common code patterns
59
- - `/dependencies` - Dependency explorer
60
- - `/impact` - Change impact analysis
61
- - `/navigate` - Code navigation helper
37
+ ## Commands
62
38
 
63
- ### `codemap affected <target>`
39
+ ### `codemap init` (Recommended)
64
40
 
65
- Show files that would be affected by changes.
41
+ **One command that does everything:**
66
42
 
67
43
  ```bash
68
- codemap affected src/auth/login.ts
69
- codemap affected UserService
70
- codemap affected handleSubmit --depth 3
44
+ npx codemap-ai init /path/to/project --name "My Project"
71
45
  ```
72
46
 
73
- ### `codemap stats`
74
-
75
- Show statistics about the analyzed codebase.
47
+ This will:
48
+ 1. Scan your codebase and build the knowledge graph
49
+ 2. Generate Claude Code skills
50
+ 3. Add the MCP server to Claude Code
76
51
 
77
- ```bash
78
- codemap stats
79
- ```
52
+ Options:
53
+ - `--name <name>` - Project name for skill descriptions
54
+ - `--skip-mcp` - Skip adding MCP server (just scan + skills)
80
55
 
81
- ### `codemap serve [path]`
56
+ ### `codemap serve`
82
57
 
83
- Start the web visualization server.
58
+ Start the web visualization:
84
59
 
85
60
  ```bash
86
- codemap serve .
87
- codemap serve . --port 8080
61
+ npx codemap-ai serve
88
62
  ```
89
63
 
90
- Opens an interactive graph at `http://localhost:3333`.
64
+ Opens an interactive graph at `http://localhost:3333`
91
65
 
92
- ### `codemap mcp-server`
66
+ ### `codemap stats`
93
67
 
94
- Start the MCP server for Claude Code integration.
68
+ Show codebase statistics:
95
69
 
96
70
  ```bash
97
- # Add to Claude Code
98
- claude mcp add codemap -- npx codemap-ai mcp-server --path /path/to/project
99
-
100
- # Or run directly
101
- codemap mcp-server --path .
71
+ npx codemap-ai stats
102
72
  ```
103
73
 
104
- ## MCP Tools
74
+ ### `codemap affected <target>`
105
75
 
106
- When connected to Claude Code, these tools become available:
76
+ Analyze what files would be affected by changes:
107
77
 
108
- - `codemap_search` - Search for functions, classes, files
109
- - `codemap_callers` - Find all callers of a function
110
- - `codemap_dependencies` - Get import/dependency info
111
- - `codemap_impact` - Analyze change impact
112
- - `codemap_stats` - Get codebase statistics
113
- - `codemap_file_contents` - List contents of a file
78
+ ```bash
79
+ npx codemap-ai affected src/auth/login.ts
80
+ npx codemap-ai affected UserService
81
+ ```
114
82
 
115
83
  ## Generated Skills
116
84
 
117
- After running `generate-skills`, Claude Code can use these commands:
85
+ After initialization, these skills are available in Claude Code:
118
86
 
119
- ### `/architecture`
120
- Shows project structure, statistics, and key directories.
121
-
122
- ### `/patterns`
123
- Explains common patterns, key classes, and coding conventions.
124
-
125
- ### `/dependencies [module]`
126
- Explores what a module imports and what imports it.
127
-
128
- ### `/impact [file or function]`
129
- Analyzes what would be affected by changes.
130
-
131
- ### `/navigate [query]`
132
- Finds and navigates to specific code.
133
-
134
- ## Programmatic Usage
135
-
136
- ```typescript
137
- import { scan, generateSkills, scanAndGenerate } from 'codemap-ai';
138
-
139
- // Scan only
140
- const { analysis, dbPath } = await scan('/path/to/project');
141
-
142
- // Generate skills from existing scan
143
- const skills = generateSkills('/path/to/project', 'My Project');
144
-
145
- // Scan and generate in one step
146
- const result = await scanAndGenerate('/path/to/project', 'My Project');
147
- ```
87
+ | Skill | Description |
88
+ |-------|-------------|
89
+ | `/architecture` | Project overview, stats, directory structure |
90
+ | `/patterns` | Key classes, common functions, conventions |
91
+ | `/impact <file>` | What's affected by changes to a file |
92
+ | `/navigate <query>` | Find code by name |
93
+ | `/dependencies <file>` | Import/export relationships |
148
94
 
149
95
  ## How It Works
150
96
 
151
- 1. **Parsing**: Uses Tree-sitter to parse source files into ASTs
152
- 2. **Graph Building**: Extracts nodes (files, functions, classes) and edges (imports, calls, extends)
153
- 3. **Storage**: Stores everything in a SQLite database for fast queries
154
- 4. **Skill Generation**: Analyzes the graph to create helpful Claude Code skills
155
- 5. **MCP Server**: Exposes graph queries as MCP tools
97
+ ```
98
+ ┌──────────────┐ ┌─────────────┐ ┌──────────────┐
99
+ │ Your Code │ ───► Tree-sitter ───► Knowledge │
100
+ .ts/.py/.js │ │ Parser │ │ Graph (SQLite)│
101
+ └──────────────┘ └─────────────┘ └──────────────┘
102
+
103
+ ┌───────────────────────────┼───────────────────────────┐
104
+ │ │ │
105
+ ▼ ▼ ▼
106
+ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
107
+ │ Skills │ │ MCP Server │ │ Web UI │
108
+ │ /impact │ │ codemap_* │ │ Graph Viz │
109
+ │ /patterns │ │ tools │ │ │
110
+ └─────────────┘ └─────────────┘ └─────────────┘
111
+ ```
156
112
 
157
113
  ## Supported Languages
158
114
 
@@ -164,18 +120,37 @@ const result = await scanAndGenerate('/path/to/project', 'My Project');
164
120
  | Go | 🚧 | 🚧 | 🚧 | 🚧 |
165
121
  | Rust | 🚧 | 🚧 | 🚧 | 🚧 |
166
122
 
167
- ## Configuration
123
+ ## Advanced Usage
124
+
125
+ ### Individual Commands
168
126
 
169
- Create a `codemap.config.json` in your project root:
127
+ If you prefer step-by-step:
170
128
 
171
- ```json
172
- {
173
- "include": ["src/**/*.ts", "lib/**/*.py"],
174
- "exclude": ["**/*.test.ts", "**/node_modules/**"],
175
- "languages": ["typescript", "python"]
176
- }
129
+ ```bash
130
+ # Step 1: Scan
131
+ npx codemap-ai scan /path/to/project
132
+
133
+ # Step 2: Generate skills
134
+ npx codemap-ai generate-skills /path/to/project --name "My Project"
135
+
136
+ # Step 3: Add MCP server (optional, for database queries)
137
+ claude mcp add codemap -- npx codemap-ai mcp-server --path /path/to/project
177
138
  ```
178
139
 
140
+ ### MCP Tools
141
+
142
+ When the MCP server is connected, Claude Code gains these tools:
143
+
144
+ - `codemap_search` - Search functions, classes, files
145
+ - `codemap_callers` - Find who calls a function
146
+ - `codemap_dependencies` - Get import relationships
147
+ - `codemap_impact` - Analyze change impact
148
+ - `codemap_stats` - Get codebase statistics
149
+
150
+ ## Author
151
+
152
+ Sahan Nishshanka (Hub.KI GmbH)
153
+
179
154
  ## License
180
155
 
181
156
  MIT
package/dist/cli.js CHANGED
@@ -1298,5 +1298,122 @@ program.command("mcp-server").description("Start the MCP server for Claude Code
1298
1298
  process.env.CODEMAP_DB_PATH = join3(resolve2(options.path), ".codemap", "graph.db");
1299
1299
  await import("./server-TBIVIIUJ.js");
1300
1300
  });
1301
+ program.command("init").description("Initialize CodeMap: scan, generate skills, and add MCP server to Claude Code").argument("[path]", "Path to the project root", ".").option("--name <name>", "Project name for skill descriptions").option("--skip-mcp", "Skip adding MCP server to Claude Code").action(async (path, options) => {
1302
+ const rootPath = resolve2(path);
1303
+ const projectName = options.name || basename2(rootPath);
1304
+ console.log(chalk.blue.bold("\n \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557"));
1305
+ console.log(chalk.blue.bold(" \u2551 CodeMap Initialization \u2551"));
1306
+ console.log(chalk.blue.bold(" \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D\n"));
1307
+ console.log(chalk.gray(` Project: ${projectName}`));
1308
+ console.log(chalk.gray(` Path: ${rootPath}
1309
+ `));
1310
+ console.log(chalk.cyan(" Step 1/3: Scanning codebase...\n"));
1311
+ const outputDir = join3(rootPath, ".codemap");
1312
+ if (!existsSync2(outputDir)) {
1313
+ mkdirSync2(outputDir, { recursive: true });
1314
+ }
1315
+ const dbPath = join3(outputDir, "graph.db");
1316
+ const storage = new GraphStorage(dbPath);
1317
+ const config = {
1318
+ rootPath,
1319
+ include: DEFAULT_CONFIG.include,
1320
+ exclude: DEFAULT_CONFIG.exclude,
1321
+ languages: DEFAULT_CONFIG.languages,
1322
+ dbPath,
1323
+ skillsOutputDir: join3(rootPath, ".claude", "skills")
1324
+ };
1325
+ const builder = new GraphBuilder(storage, config);
1326
+ const spinner = ora("Discovering files...").start();
1327
+ builder.setProgressCallback((progress) => {
1328
+ switch (progress.phase) {
1329
+ case "discovering":
1330
+ spinner.text = "Discovering files...";
1331
+ break;
1332
+ case "parsing":
1333
+ spinner.text = `Parsing (${progress.current}/${progress.total}): ${progress.currentFile}`;
1334
+ break;
1335
+ case "resolving":
1336
+ spinner.text = "Resolving cross-file references...";
1337
+ break;
1338
+ case "complete":
1339
+ spinner.succeed(chalk.green("Scan complete!"));
1340
+ break;
1341
+ }
1342
+ });
1343
+ try {
1344
+ const result = await builder.scan();
1345
+ console.log(chalk.gray(`
1346
+ Found ${result.totalNodes} code elements in ${result.files.length} files
1347
+ `));
1348
+ console.log(chalk.cyan(" Step 2/3: Generating Claude Code skills...\n"));
1349
+ const skillSpinner = ora("Generating skills...").start();
1350
+ const generator = new SkillGenerator(storage, {
1351
+ projectName,
1352
+ outputDir: join3(rootPath, ".claude", "skills"),
1353
+ includeArchitecture: true,
1354
+ includePatterns: true,
1355
+ includeDependencies: true
1356
+ });
1357
+ const skills = generator.generateAll();
1358
+ skillSpinner.succeed(chalk.green(`Generated ${skills.length} skills`));
1359
+ for (const skill of skills) {
1360
+ console.log(chalk.gray(` /${skill.name} - ${skill.description}`));
1361
+ }
1362
+ storage.close();
1363
+ if (!options.skipMcp) {
1364
+ console.log(chalk.cyan("\n Step 3/3: Adding MCP server to Claude Code...\n"));
1365
+ const mcpSpinner = ora("Configuring MCP server...").start();
1366
+ try {
1367
+ const { execSync } = await import("child_process");
1368
+ try {
1369
+ execSync("which claude", { stdio: "pipe" });
1370
+ } catch {
1371
+ mcpSpinner.warn(chalk.yellow("Claude CLI not found. Skipping MCP setup."));
1372
+ console.log(chalk.gray(" To add manually later, run:"));
1373
+ console.log(chalk.cyan(` claude mcp add codemap -- npx codemap-ai mcp-server --path ${rootPath}
1374
+ `));
1375
+ return;
1376
+ }
1377
+ const mcpCommand = `claude mcp add codemap -- npx codemap-ai mcp-server --path "${rootPath}"`;
1378
+ try {
1379
+ execSync(mcpCommand, { stdio: "pipe" });
1380
+ mcpSpinner.succeed(chalk.green("MCP server added to Claude Code!"));
1381
+ } catch (error) {
1382
+ if (error.message?.includes("already exists")) {
1383
+ mcpSpinner.warn(chalk.yellow("MCP server 'codemap' already configured"));
1384
+ } else {
1385
+ mcpSpinner.warn(chalk.yellow("Could not auto-add MCP server"));
1386
+ console.log(chalk.gray(" To add manually, run:"));
1387
+ console.log(chalk.cyan(` claude mcp add codemap -- npx codemap-ai mcp-server --path ${rootPath}
1388
+ `));
1389
+ }
1390
+ }
1391
+ } catch {
1392
+ mcpSpinner.warn(chalk.yellow("Could not configure MCP server automatically"));
1393
+ console.log(chalk.gray(" To add manually, run:"));
1394
+ console.log(chalk.cyan(` claude mcp add codemap -- npx codemap-ai mcp-server --path ${rootPath}
1395
+ `));
1396
+ }
1397
+ } else {
1398
+ console.log(chalk.gray("\n Skipping MCP setup (--skip-mcp flag)\n"));
1399
+ }
1400
+ console.log(chalk.green.bold("\n \u2713 CodeMap initialized successfully!\n"));
1401
+ console.log(chalk.white(" Available commands:"));
1402
+ console.log(chalk.gray(" codemap serve - Start web visualization"));
1403
+ console.log(chalk.gray(" codemap stats - Show codebase statistics"));
1404
+ console.log(chalk.gray(" codemap affected <file> - Analyze impact of changes\n"));
1405
+ console.log(chalk.white(" Available skills (type in Claude Code):"));
1406
+ console.log(chalk.gray(" /architecture - Project overview"));
1407
+ console.log(chalk.gray(" /patterns - Code patterns and conventions"));
1408
+ console.log(chalk.gray(" /impact <file> - Change impact analysis"));
1409
+ console.log(chalk.gray(" /navigate - Find code in codebase"));
1410
+ console.log(chalk.gray(" /dependencies - Explore imports/exports\n"));
1411
+ } catch (error) {
1412
+ spinner.fail(chalk.red("Initialization failed"));
1413
+ console.error(error);
1414
+ storage.close();
1415
+ process.exit(1);
1416
+ }
1417
+ });
1301
1418
  program.parse();
1302
1419
  //# sourceMappingURL=cli.js.map
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/cli.ts","../src/graph/builder.ts","../src/parsers/base.ts","../src/parsers/typescript.ts","../src/parsers/python.ts","../src/parsers/index.ts","../src/skills/generator.ts","../src/types.ts"],"sourcesContent":["/**\n * CodeMap CLI - Main entry point\n */\n\nimport { Command } from \"commander\";\nimport { resolve, join, basename } from \"path\";\nimport { existsSync, mkdirSync, readFileSync } from \"fs\";\nimport chalk from \"chalk\";\nimport ora from \"ora\";\nimport { GraphBuilder, GraphStorage } from \"./graph/index.js\";\nimport { SkillGenerator } from \"./skills/index.js\";\nimport { DEFAULT_CONFIG } from \"./types.js\";\nimport type { CodeMapConfig } from \"./types.js\";\n\n// Import parsers to register them\nimport \"./parsers/index.js\";\n\nconst program = new Command();\n\nprogram\n .name(\"codemap\")\n .description(\"AI-powered codebase knowledge graph generator with Claude Code integration\")\n .version(\"0.1.0\");\n\n// ============ Scan Command ============\n\nprogram\n .command(\"scan\")\n .description(\"Scan a codebase and build the knowledge graph\")\n .argument(\"[path]\", \"Path to the project root\", \".\")\n .option(\"-o, --output <dir>\", \"Output directory for database\", \".codemap\")\n .option(\"--include <patterns...>\", \"Glob patterns to include\")\n .option(\"--exclude <patterns...>\", \"Glob patterns to exclude\")\n .option(\"--clean\", \"Clear existing data before scanning\")\n .action(async (path: string, options) => {\n const rootPath = resolve(path);\n const outputDir = resolve(rootPath, options.output);\n\n console.log(chalk.blue.bold(\"\\n CodeMap Scanner\\n\"));\n console.log(chalk.gray(` Project: ${rootPath}`));\n console.log(chalk.gray(` Output: ${outputDir}\\n`));\n\n // Create output directory\n if (!existsSync(outputDir)) {\n mkdirSync(outputDir, { recursive: true });\n }\n\n const dbPath = join(outputDir, \"graph.db\");\n\n // Initialize storage\n const storage = new GraphStorage(dbPath);\n\n if (options.clean) {\n storage.clear();\n console.log(chalk.yellow(\" Cleared existing data\\n\"));\n }\n\n // Build config\n const config: CodeMapConfig = {\n rootPath,\n include: options.include || DEFAULT_CONFIG.include!,\n exclude: options.exclude || DEFAULT_CONFIG.exclude!,\n languages: DEFAULT_CONFIG.languages!,\n dbPath,\n skillsOutputDir: join(rootPath, \".claude\", \"skills\", \"codemap\"),\n };\n\n // Create builder with progress\n const builder = new GraphBuilder(storage, config);\n const spinner = ora(\"Discovering files...\").start();\n\n builder.setProgressCallback((progress) => {\n switch (progress.phase) {\n case \"discovering\":\n spinner.text = \"Discovering files...\";\n break;\n case \"parsing\":\n spinner.text = `Parsing (${progress.current}/${progress.total}): ${progress.currentFile}`;\n break;\n case \"resolving\":\n spinner.text = \"Resolving cross-file references...\";\n break;\n case \"complete\":\n spinner.succeed(chalk.green(\"Scan complete!\"));\n break;\n }\n });\n\n try {\n const result = await builder.scan();\n\n console.log(chalk.blue(\"\\n Results:\\n\"));\n console.log(` ${chalk.bold(\"Files:\")} ${result.files.length}`);\n console.log(` ${chalk.bold(\"Nodes:\")} ${result.totalNodes}`);\n console.log(` ${chalk.bold(\"Edges:\")} ${result.totalEdges}`);\n console.log(` ${chalk.bold(\"Languages:\")} ${Object.keys(result.languages).join(\", \")}`);\n\n console.log(chalk.gray(`\\n Database saved to: ${dbPath}\\n`));\n console.log(chalk.cyan(\" Run 'codemap generate-skills' to create Claude Code skills\"));\n console.log(chalk.cyan(\" Run 'codemap serve' to start the web visualization\\n\"));\n } catch (error) {\n spinner.fail(chalk.red(\"Scan failed\"));\n console.error(error);\n process.exit(1);\n } finally {\n storage.close();\n }\n });\n\n// ============ Generate Skills Command ============\n\nprogram\n .command(\"generate-skills\")\n .description(\"Generate Claude Code skills from the knowledge graph\")\n .argument(\"[path]\", \"Path to the project root\", \".\")\n .option(\"-o, --output <dir>\", \"Output directory for skills\", \".claude/skills\")\n .option(\"--name <name>\", \"Project name for skill descriptions\")\n .option(\"--no-architecture\", \"Skip architecture skill\")\n .option(\"--no-patterns\", \"Skip patterns skill\")\n .option(\"--no-dependencies\", \"Skip dependencies skill\")\n .action(async (path: string, options) => {\n const rootPath = resolve(path);\n const dbPath = join(rootPath, \".codemap\", \"graph.db\");\n\n if (!existsSync(dbPath)) {\n console.error(chalk.red(\"\\n Error: No graph database found.\"));\n console.error(chalk.gray(\" Run 'codemap scan' first to analyze your codebase.\\n\"));\n process.exit(1);\n }\n\n const outputDir = resolve(rootPath, options.output);\n const projectName = options.name || basename(rootPath);\n\n console.log(chalk.blue.bold(\"\\n Generating Claude Code Skills\\n\"));\n console.log(chalk.gray(` Project: ${projectName}`));\n console.log(chalk.gray(` Output: ${outputDir}\\n`));\n\n const storage = new GraphStorage(dbPath);\n\n const generator = new SkillGenerator(storage, {\n projectName,\n outputDir,\n includeArchitecture: options.architecture !== false,\n includePatterns: options.patterns !== false,\n includeDependencies: options.dependencies !== false,\n });\n\n const skills = generator.generateAll();\n\n console.log(chalk.green(` Generated ${skills.length} skills:\\n`));\n for (const skill of skills) {\n console.log(` ${chalk.cyan(`/${skill.name}`)} - ${skill.description}`);\n }\n\n console.log(chalk.gray(`\\n Skills written to: ${outputDir}`));\n console.log(chalk.cyan(\"\\n Claude Code can now use these skills automatically!\\n\"));\n\n storage.close();\n });\n\n// ============ Stats Command ============\n\nprogram\n .command(\"stats\")\n .description(\"Show statistics about the analyzed codebase\")\n .argument(\"[path]\", \"Path to the project root\", \".\")\n .action(async (path: string) => {\n const rootPath = resolve(path);\n const dbPath = join(rootPath, \".codemap\", \"graph.db\");\n\n if (!existsSync(dbPath)) {\n console.error(chalk.red(\"\\n Error: No graph database found.\"));\n console.error(chalk.gray(\" Run 'codemap scan' first to analyze your codebase.\\n\"));\n process.exit(1);\n }\n\n const storage = new GraphStorage(dbPath);\n const stats = storage.getStats();\n const analyzedAt = storage.getMeta(\"analyzedAt\");\n\n console.log(chalk.blue.bold(\"\\n Codebase Statistics\\n\"));\n console.log(` ${chalk.bold(\"Last analyzed:\")} ${analyzedAt || \"unknown\"}`);\n console.log();\n console.log(` ${chalk.bold(\"Total files:\")} ${stats.totalFiles}`);\n console.log(` ${chalk.bold(\"Total nodes:\")} ${stats.totalNodes}`);\n console.log(` ${chalk.bold(\"Total edges:\")} ${stats.totalEdges}`);\n\n console.log(chalk.blue(\"\\n By Type:\\n\"));\n for (const [type, count] of Object.entries(stats.nodesByType)) {\n console.log(` ${chalk.gray(\"-\")} ${type}: ${count}`);\n }\n\n console.log(chalk.blue(\"\\n By Language:\\n\"));\n for (const [lang, count] of Object.entries(stats.languages)) {\n console.log(` ${chalk.gray(\"-\")} ${lang}: ${count}`);\n }\n\n console.log(chalk.blue(\"\\n Relationships:\\n\"));\n for (const [type, count] of Object.entries(stats.edgesByType)) {\n console.log(` ${chalk.gray(\"-\")} ${type}: ${count}`);\n }\n\n console.log();\n storage.close();\n });\n\n// ============ Affected Command ============\n\nprogram\n .command(\"affected\")\n .description(\"Show files that would be affected by changes to a target\")\n .argument(\"<target>\", \"File path or function/class name\")\n .option(\"-d, --depth <n>\", \"Maximum dependency depth to follow\", \"2\")\n .option(\"-p, --path <path>\", \"Project root path\", \".\")\n .action(async (target: string, options) => {\n const rootPath = resolve(options.path);\n const dbPath = join(rootPath, \".codemap\", \"graph.db\");\n\n if (!existsSync(dbPath)) {\n console.error(chalk.red(\"\\n Error: No graph database found.\"));\n console.error(chalk.gray(\" Run 'codemap scan' first to analyze your codebase.\\n\"));\n process.exit(1);\n }\n\n const storage = new GraphStorage(dbPath);\n const depth = parseInt(options.depth, 10);\n\n console.log(chalk.blue.bold(`\\n Impact Analysis: ${target}\\n`));\n\n // Find the target\n const nodes = storage.searchNodes(target);\n if (nodes.length === 0) {\n console.log(chalk.yellow(` No matches found for \"${target}\"\\n`));\n storage.close();\n return;\n }\n\n const targetNode = nodes[0];\n console.log(\n chalk.gray(` Target: ${targetNode.name} (${targetNode.type}) in ${targetNode.filePath}\\n`)\n );\n\n // Find affected files\n const affected: Set<string> = new Set();\n\n // Check who imports this file\n const importers = storage.getFilesThatImport(\n targetNode.filePath.replace(/\\.(ts|tsx|js|jsx|py)$/, \"\")\n );\n for (const imp of importers) {\n affected.add(imp);\n }\n\n // Check callers\n const callers = storage.getCallers(targetNode.name);\n for (const caller of callers) {\n affected.add(caller.filePath);\n }\n\n const affectedList = [...affected].filter((f) => f !== targetNode.filePath);\n\n if (affectedList.length === 0) {\n console.log(chalk.green(\" No affected files found\\n\"));\n } else {\n console.log(chalk.yellow(` Affected files (${affectedList.length}):\\n`));\n for (const file of affectedList) {\n console.log(` ${chalk.gray(\"-\")} ${file}`);\n }\n console.log();\n }\n\n storage.close();\n });\n\n// ============ Serve Command ============\n\nprogram\n .command(\"serve\")\n .description(\"Start the web visualization server\")\n .argument(\"[path]\", \"Path to the project root\", \".\")\n .option(\"-p, --port <port>\", \"Port to run the server on\", \"3333\")\n .action(async (path: string, options) => {\n const rootPath = resolve(path);\n const dbPath = join(rootPath, \".codemap\", \"graph.db\");\n\n if (!existsSync(dbPath)) {\n console.error(chalk.red(\"\\n Error: No graph database found.\"));\n console.error(chalk.gray(\" Run 'codemap scan' first to analyze your codebase.\\n\"));\n process.exit(1);\n }\n\n console.log(chalk.blue.bold(\"\\n CodeMap Visualization Server\\n\"));\n\n // Dynamically import and start the server\n const { startServer } = await import(\"./web/server.js\");\n startServer(dbPath, parseInt(options.port, 10));\n });\n\n// ============ MCP Server Command ============\n\nprogram\n .command(\"mcp-server\")\n .description(\"Start the MCP server for Claude Code integration\")\n .option(\"-p, --path <path>\", \"Project root path\", \".\")\n .action(async (options) => {\n process.env.CODEMAP_PROJECT_ROOT = resolve(options.path);\n process.env.CODEMAP_DB_PATH = join(resolve(options.path), \".codemap\", \"graph.db\");\n\n // Dynamically import and run the MCP server\n await import(\"./mcp/server.js\");\n });\n\n// Parse and run\nprogram.parse();\n","/**\n * Graph builder - scans codebase and builds the knowledge graph\n */\n\nimport { readFileSync, statSync } from \"fs\";\nimport { glob } from \"glob\";\nimport { join, relative, resolve } from \"path\";\nimport { parserRegistry } from \"../parsers/index.js\";\nimport { GraphStorage } from \"./storage.js\";\nimport type { CodeMapConfig, FileAnalysis, ProjectAnalysis } from \"../types.js\";\n\nexport interface ScanProgress {\n total: number;\n current: number;\n currentFile: string;\n phase: \"discovering\" | \"parsing\" | \"resolving\" | \"complete\";\n}\n\nexport type ProgressCallback = (progress: ScanProgress) => void;\n\nexport class GraphBuilder {\n private storage: GraphStorage;\n private config: CodeMapConfig;\n private onProgress?: ProgressCallback;\n\n constructor(storage: GraphStorage, config: CodeMapConfig) {\n this.storage = storage;\n this.config = config;\n }\n\n setProgressCallback(callback: ProgressCallback): void {\n this.onProgress = callback;\n }\n\n async scan(): Promise<ProjectAnalysis> {\n const rootPath = resolve(this.config.rootPath);\n\n // Phase 1: Discover files\n this.emitProgress({ total: 0, current: 0, currentFile: \"\", phase: \"discovering\" });\n\n const files = await this.discoverFiles(rootPath);\n\n // Phase 2: Parse files\n const fileAnalyses: FileAnalysis[] = [];\n let current = 0;\n\n for (const filePath of files) {\n current++;\n this.emitProgress({\n total: files.length,\n current,\n currentFile: relative(rootPath, filePath),\n phase: \"parsing\",\n });\n\n try {\n const analysis = this.parseFile(filePath);\n if (analysis) {\n fileAnalyses.push(analysis);\n this.storage.insertFileAnalysis(analysis);\n }\n } catch (error) {\n console.error(`Error parsing ${filePath}:`, error);\n }\n }\n\n // Phase 3: Resolve cross-file references\n this.emitProgress({\n total: files.length,\n current: files.length,\n currentFile: \"\",\n phase: \"resolving\",\n });\n this.resolveReferences();\n\n // Store metadata\n const languages: Record<string, number> = {};\n for (const analysis of fileAnalyses) {\n languages[analysis.language] = (languages[analysis.language] || 0) + 1;\n }\n\n const stats = this.storage.getStats();\n\n this.storage.setMeta(\"rootPath\", rootPath);\n this.storage.setMeta(\"analyzedAt\", new Date().toISOString());\n this.storage.setMeta(\"totalFiles\", String(files.length));\n\n this.emitProgress({\n total: files.length,\n current: files.length,\n currentFile: \"\",\n phase: \"complete\",\n });\n\n return {\n rootPath,\n files: fileAnalyses,\n totalNodes: stats.totalNodes,\n totalEdges: stats.totalEdges,\n languages,\n analyzedAt: new Date().toISOString(),\n };\n }\n\n private async discoverFiles(rootPath: string): Promise<string[]> {\n const patterns = this.config.include;\n const ignorePatterns = this.config.exclude;\n\n const allFiles: string[] = [];\n\n for (const pattern of patterns) {\n const matches = await glob(pattern, {\n cwd: rootPath,\n absolute: true,\n ignore: ignorePatterns,\n nodir: true,\n });\n allFiles.push(...matches);\n }\n\n // Deduplicate and filter by supported extensions\n const supportedExts = new Set(parserRegistry.getSupportedExtensions());\n const uniqueFiles = [...new Set(allFiles)].filter((f) => {\n const ext = f.substring(f.lastIndexOf(\".\"));\n return supportedExts.has(ext);\n });\n\n return uniqueFiles.sort();\n }\n\n private parseFile(filePath: string): FileAnalysis | null {\n const parser = parserRegistry.getForFile(filePath);\n if (!parser) {\n return null;\n }\n\n const content = readFileSync(filePath, \"utf-8\");\n return parser.parse(filePath, content);\n }\n\n private resolveReferences(): void {\n // Get all edges with unresolved references\n const allEdges = this.storage.getAllEdges();\n const allNodes = this.storage.getAllNodes();\n\n // Build a map of node names to node IDs\n const nodeNameMap = new Map<string, string[]>();\n for (const node of allNodes) {\n const existing = nodeNameMap.get(node.name) || [];\n existing.push(node.id);\n nodeNameMap.set(node.name, existing);\n }\n\n // Resolve references\n for (const edge of allEdges) {\n if (edge.targetId.startsWith(\"ref:\")) {\n const refName = edge.targetId.substring(4);\n const candidates = nodeNameMap.get(refName);\n\n if (candidates && candidates.length > 0) {\n // For now, take the first match (could be smarter with scope resolution)\n // Update the edge in storage\n // Note: In a more complete implementation, we'd update the edge in the DB\n }\n }\n }\n }\n\n private emitProgress(progress: ScanProgress): void {\n if (this.onProgress) {\n this.onProgress(progress);\n }\n }\n}\n\nexport { GraphStorage };\n","/**\n * Base parser interface and utilities\n */\n\nimport type { FileAnalysis, GraphNode, GraphEdge, ImportInfo, ExportInfo } from \"../types.js\";\n\nexport interface Parser {\n language: string;\n extensions: string[];\n parse(filePath: string, content: string): FileAnalysis;\n}\n\nexport abstract class BaseParser implements Parser {\n abstract language: string;\n abstract extensions: string[];\n\n protected nodeIdCounter = 0;\n protected edgeIdCounter = 0;\n\n abstract parse(filePath: string, content: string): FileAnalysis;\n\n protected generateNodeId(filePath: string, name: string, line: number): string {\n return `${filePath}:${name}:${line}`;\n }\n\n protected generateEdgeId(): string {\n return `edge_${++this.edgeIdCounter}`;\n }\n\n protected createNode(\n type: GraphNode[\"type\"],\n name: string,\n filePath: string,\n startLine: number,\n endLine: number,\n metadata?: Record<string, unknown>\n ): GraphNode {\n return {\n id: this.generateNodeId(filePath, name, startLine),\n type,\n name,\n filePath,\n startLine,\n endLine,\n language: this.language,\n metadata,\n };\n }\n\n protected createEdge(\n type: GraphEdge[\"type\"],\n sourceId: string,\n targetId: string,\n metadata?: Record<string, unknown>\n ): GraphEdge {\n return {\n id: this.generateEdgeId(),\n type,\n sourceId,\n targetId,\n metadata,\n };\n }\n\n protected createEmptyAnalysis(filePath: string): FileAnalysis {\n return {\n filePath,\n language: this.language,\n nodes: [],\n edges: [],\n imports: [],\n exports: [],\n };\n }\n}\n\n/**\n * Registry for all parsers\n */\nexport class ParserRegistry {\n private parsers: Map<string, Parser> = new Map();\n private extensionMap: Map<string, Parser> = new Map();\n\n register(parser: Parser): void {\n this.parsers.set(parser.language, parser);\n for (const ext of parser.extensions) {\n this.extensionMap.set(ext, parser);\n }\n }\n\n getByLanguage(language: string): Parser | undefined {\n return this.parsers.get(language);\n }\n\n getByExtension(extension: string): Parser | undefined {\n // Normalize extension (remove leading dot if present)\n const ext = extension.startsWith(\".\") ? extension : `.${extension}`;\n return this.extensionMap.get(ext);\n }\n\n getForFile(filePath: string): Parser | undefined {\n const ext = filePath.substring(filePath.lastIndexOf(\".\"));\n return this.getByExtension(ext);\n }\n\n getSupportedExtensions(): string[] {\n return Array.from(this.extensionMap.keys());\n }\n\n getSupportedLanguages(): string[] {\n return Array.from(this.parsers.keys());\n }\n}\n\nexport const parserRegistry = new ParserRegistry();\n","/**\n * TypeScript/JavaScript parser using Tree-sitter\n */\n\nimport Parser from \"tree-sitter\";\nimport TypeScript from \"tree-sitter-typescript\";\nimport JavaScript from \"tree-sitter-javascript\";\nimport { BaseParser } from \"./base.js\";\nimport type { FileAnalysis, GraphNode, GraphEdge, ImportInfo, ExportInfo } from \"../types.js\";\n\nexport class TypeScriptParser extends BaseParser {\n language = \"typescript\";\n extensions = [\".ts\", \".tsx\"];\n\n private parser: Parser;\n\n constructor() {\n super();\n this.parser = new Parser();\n this.parser.setLanguage(TypeScript.typescript);\n }\n\n parse(filePath: string, content: string): FileAnalysis {\n const analysis = this.createEmptyAnalysis(filePath);\n\n // Use TSX parser for .tsx files\n if (filePath.endsWith(\".tsx\")) {\n this.parser.setLanguage(TypeScript.tsx);\n } else {\n this.parser.setLanguage(TypeScript.typescript);\n }\n\n const tree = this.parser.parse(content);\n const lines = content.split(\"\\n\");\n\n // Create file node\n const fileNode = this.createNode(\n \"file\",\n filePath.split(\"/\").pop() || filePath,\n filePath,\n 1,\n lines.length\n );\n analysis.nodes.push(fileNode);\n\n // Walk the tree\n this.walkTree(tree.rootNode, filePath, analysis, fileNode.id);\n\n return analysis;\n }\n\n private walkTree(\n node: Parser.SyntaxNode,\n filePath: string,\n analysis: FileAnalysis,\n parentId: string\n ): void {\n switch (node.type) {\n case \"import_statement\":\n this.handleImport(node, analysis);\n break;\n\n case \"export_statement\":\n this.handleExport(node, filePath, analysis, parentId);\n break;\n\n case \"function_declaration\":\n case \"arrow_function\":\n case \"function_expression\":\n this.handleFunction(node, filePath, analysis, parentId);\n break;\n\n case \"class_declaration\":\n this.handleClass(node, filePath, analysis, parentId);\n break;\n\n case \"method_definition\":\n this.handleMethod(node, filePath, analysis, parentId);\n break;\n\n case \"call_expression\":\n this.handleCall(node, filePath, analysis, parentId);\n break;\n\n case \"variable_declaration\":\n this.handleVariable(node, filePath, analysis, parentId);\n break;\n }\n\n // Recurse into children\n for (const child of node.children) {\n this.walkTree(child, filePath, analysis, parentId);\n }\n }\n\n private handleImport(node: Parser.SyntaxNode, analysis: FileAnalysis): void {\n const sourceNode = node.childForFieldName(\"source\");\n if (!sourceNode) return;\n\n const source = sourceNode.text.replace(/['\"]/g, \"\");\n const specifiers: string[] = [];\n let isDefault = false;\n let isNamespace = false;\n\n // Find import clause\n for (const child of node.children) {\n if (child.type === \"import_clause\") {\n for (const clauseChild of child.children) {\n if (clauseChild.type === \"identifier\") {\n specifiers.push(clauseChild.text);\n isDefault = true;\n } else if (clauseChild.type === \"namespace_import\") {\n isNamespace = true;\n const nameNode = clauseChild.childForFieldName(\"name\");\n if (nameNode) specifiers.push(nameNode.text);\n } else if (clauseChild.type === \"named_imports\") {\n for (const importSpec of clauseChild.children) {\n if (importSpec.type === \"import_specifier\") {\n const name = importSpec.childForFieldName(\"name\");\n if (name) specifiers.push(name.text);\n }\n }\n }\n }\n }\n }\n\n analysis.imports.push({\n source,\n specifiers,\n isDefault,\n isNamespace,\n line: node.startPosition.row + 1,\n });\n }\n\n private handleExport(\n node: Parser.SyntaxNode,\n filePath: string,\n analysis: FileAnalysis,\n parentId: string\n ): void {\n const isDefault = node.children.some((c) => c.type === \"default\");\n\n // Find what's being exported\n for (const child of node.children) {\n if (child.type === \"function_declaration\") {\n const nameNode = child.childForFieldName(\"name\");\n if (nameNode) {\n analysis.exports.push({\n name: nameNode.text,\n isDefault,\n line: node.startPosition.row + 1,\n });\n }\n this.handleFunction(child, filePath, analysis, parentId);\n } else if (child.type === \"class_declaration\") {\n const nameNode = child.childForFieldName(\"name\");\n if (nameNode) {\n analysis.exports.push({\n name: nameNode.text,\n isDefault,\n line: node.startPosition.row + 1,\n });\n }\n this.handleClass(child, filePath, analysis, parentId);\n } else if (child.type === \"identifier\") {\n analysis.exports.push({\n name: child.text,\n isDefault,\n line: node.startPosition.row + 1,\n });\n }\n }\n }\n\n private handleFunction(\n node: Parser.SyntaxNode,\n filePath: string,\n analysis: FileAnalysis,\n parentId: string\n ): void {\n let name = \"anonymous\";\n const nameNode = node.childForFieldName(\"name\");\n if (nameNode) {\n name = nameNode.text;\n }\n\n const funcNode = this.createNode(\n \"function\",\n name,\n filePath,\n node.startPosition.row + 1,\n node.endPosition.row + 1,\n {\n async: node.children.some((c) => c.type === \"async\"),\n generator: node.children.some((c) => c.text === \"*\"),\n }\n );\n\n analysis.nodes.push(funcNode);\n\n // Add contains edge from parent\n analysis.edges.push(\n this.createEdge(\"contains\", parentId, funcNode.id)\n );\n }\n\n private handleClass(\n node: Parser.SyntaxNode,\n filePath: string,\n analysis: FileAnalysis,\n parentId: string\n ): void {\n const nameNode = node.childForFieldName(\"name\");\n if (!nameNode) return;\n\n const classNode = this.createNode(\n \"class\",\n nameNode.text,\n filePath,\n node.startPosition.row + 1,\n node.endPosition.row + 1\n );\n\n analysis.nodes.push(classNode);\n\n // Add contains edge\n analysis.edges.push(\n this.createEdge(\"contains\", parentId, classNode.id)\n );\n\n // Check for extends\n for (const child of node.children) {\n if (child.type === \"class_heritage\") {\n const extendsClause = child.children.find((c) => c.type === \"extends_clause\");\n if (extendsClause) {\n const baseClass = extendsClause.children.find((c) => c.type === \"identifier\");\n if (baseClass) {\n // Create a reference edge (will be resolved later)\n analysis.edges.push(\n this.createEdge(\"extends\", classNode.id, `ref:${baseClass.text}`, {\n unresolvedName: baseClass.text,\n })\n );\n }\n }\n }\n }\n\n // Process class body for methods\n const body = node.childForFieldName(\"body\");\n if (body) {\n for (const member of body.children) {\n if (member.type === \"method_definition\") {\n this.handleMethod(member, filePath, analysis, classNode.id);\n }\n }\n }\n }\n\n private handleMethod(\n node: Parser.SyntaxNode,\n filePath: string,\n analysis: FileAnalysis,\n parentId: string\n ): void {\n const nameNode = node.childForFieldName(\"name\");\n if (!nameNode) return;\n\n const methodNode = this.createNode(\n \"method\",\n nameNode.text,\n filePath,\n node.startPosition.row + 1,\n node.endPosition.row + 1,\n {\n static: node.children.some((c) => c.type === \"static\"),\n async: node.children.some((c) => c.type === \"async\"),\n }\n );\n\n analysis.nodes.push(methodNode);\n\n // Add contains edge\n analysis.edges.push(\n this.createEdge(\"contains\", parentId, methodNode.id)\n );\n }\n\n private handleCall(\n node: Parser.SyntaxNode,\n filePath: string,\n analysis: FileAnalysis,\n parentId: string\n ): void {\n const funcNode = node.childForFieldName(\"function\");\n if (!funcNode) return;\n\n let calledName = \"\";\n if (funcNode.type === \"identifier\") {\n calledName = funcNode.text;\n } else if (funcNode.type === \"member_expression\") {\n // Get the full member expression (e.g., \"console.log\")\n calledName = funcNode.text;\n }\n\n if (calledName) {\n analysis.edges.push(\n this.createEdge(\"calls\", parentId, `ref:${calledName}`, {\n unresolvedName: calledName,\n line: node.startPosition.row + 1,\n })\n );\n }\n }\n\n private handleVariable(\n node: Parser.SyntaxNode,\n filePath: string,\n analysis: FileAnalysis,\n parentId: string\n ): void {\n for (const child of node.children) {\n if (child.type === \"variable_declarator\") {\n const nameNode = child.childForFieldName(\"name\");\n const valueNode = child.childForFieldName(\"value\");\n\n if (nameNode && nameNode.type === \"identifier\") {\n // Check if it's a function expression or arrow function\n if (\n valueNode &&\n (valueNode.type === \"arrow_function\" ||\n valueNode.type === \"function_expression\")\n ) {\n const funcNode = this.createNode(\n \"function\",\n nameNode.text,\n filePath,\n node.startPosition.row + 1,\n node.endPosition.row + 1,\n {\n kind: node.children[0]?.text || \"const\",\n }\n );\n analysis.nodes.push(funcNode);\n analysis.edges.push(\n this.createEdge(\"contains\", parentId, funcNode.id)\n );\n }\n }\n }\n }\n }\n}\n\nexport class JavaScriptParser extends TypeScriptParser {\n language = \"javascript\";\n extensions = [\".js\", \".jsx\", \".mjs\", \".cjs\"];\n\n constructor() {\n super();\n // Override to use JavaScript grammar\n (this as any).parser = new Parser();\n (this as any).parser.setLanguage(JavaScript);\n }\n\n parse(filePath: string, content: string): FileAnalysis {\n // Use base implementation but mark as javascript\n const analysis = super.parse(filePath, content);\n analysis.language = \"javascript\";\n for (const node of analysis.nodes) {\n node.language = \"javascript\";\n }\n return analysis;\n }\n}\n","/**\n * Python parser using Tree-sitter\n */\n\nimport Parser from \"tree-sitter\";\nimport Python from \"tree-sitter-python\";\nimport { BaseParser } from \"./base.js\";\nimport type { FileAnalysis, GraphNode, GraphEdge, ImportInfo, ExportInfo } from \"../types.js\";\n\nexport class PythonParser extends BaseParser {\n language = \"python\";\n extensions = [\".py\"];\n\n private parser: Parser;\n\n constructor() {\n super();\n this.parser = new Parser();\n this.parser.setLanguage(Python);\n }\n\n parse(filePath: string, content: string): FileAnalysis {\n const analysis = this.createEmptyAnalysis(filePath);\n const tree = this.parser.parse(content);\n const lines = content.split(\"\\n\");\n\n // Create file node\n const fileNode = this.createNode(\n \"file\",\n filePath.split(\"/\").pop() || filePath,\n filePath,\n 1,\n lines.length\n );\n analysis.nodes.push(fileNode);\n\n // Walk the tree\n this.walkTree(tree.rootNode, filePath, analysis, fileNode.id);\n\n return analysis;\n }\n\n private walkTree(\n node: Parser.SyntaxNode,\n filePath: string,\n analysis: FileAnalysis,\n parentId: string\n ): void {\n switch (node.type) {\n case \"import_statement\":\n this.handleImport(node, analysis);\n break;\n\n case \"import_from_statement\":\n this.handleFromImport(node, analysis);\n break;\n\n case \"function_definition\":\n this.handleFunction(node, filePath, analysis, parentId);\n return; // Don't recurse into function body for top-level analysis\n\n case \"class_definition\":\n this.handleClass(node, filePath, analysis, parentId);\n return; // Don't recurse, class handler will process methods\n\n case \"call\":\n this.handleCall(node, filePath, analysis, parentId);\n break;\n }\n\n // Recurse into children\n for (const child of node.children) {\n this.walkTree(child, filePath, analysis, parentId);\n }\n }\n\n private handleImport(node: Parser.SyntaxNode, analysis: FileAnalysis): void {\n // import foo, bar, baz\n for (const child of node.children) {\n if (child.type === \"dotted_name\") {\n analysis.imports.push({\n source: child.text,\n specifiers: [child.text.split(\".\").pop() || child.text],\n isDefault: false,\n isNamespace: true,\n line: node.startPosition.row + 1,\n });\n } else if (child.type === \"aliased_import\") {\n const nameNode = child.childForFieldName(\"name\");\n const aliasNode = child.childForFieldName(\"alias\");\n if (nameNode) {\n analysis.imports.push({\n source: nameNode.text,\n specifiers: [aliasNode?.text || nameNode.text],\n isDefault: false,\n isNamespace: true,\n line: node.startPosition.row + 1,\n });\n }\n }\n }\n }\n\n private handleFromImport(node: Parser.SyntaxNode, analysis: FileAnalysis): void {\n // from foo import bar, baz\n const moduleNode = node.childForFieldName(\"module_name\");\n if (!moduleNode) return;\n\n const source = moduleNode.text;\n const specifiers: string[] = [];\n\n for (const child of node.children) {\n if (child.type === \"import_prefix\") {\n // Handle relative imports (from . import x, from .. import y)\n continue;\n }\n\n if (child.type === \"dotted_name\" && child !== moduleNode) {\n specifiers.push(child.text);\n } else if (child.type === \"aliased_import\") {\n const nameNode = child.childForFieldName(\"name\");\n if (nameNode) {\n specifiers.push(nameNode.text);\n }\n } else if (child.type === \"wildcard_import\") {\n specifiers.push(\"*\");\n }\n }\n\n if (specifiers.length === 0) {\n // Check for named imports in different structure\n for (const child of node.children) {\n if (child.type === \"import_list\" || child.type === \"import_from_specifier\") {\n for (const spec of child.children) {\n if (spec.type === \"dotted_name\" || spec.type === \"identifier\") {\n specifiers.push(spec.text);\n }\n }\n }\n }\n }\n\n analysis.imports.push({\n source,\n specifiers,\n isDefault: false,\n isNamespace: specifiers.includes(\"*\"),\n line: node.startPosition.row + 1,\n });\n }\n\n private handleFunction(\n node: Parser.SyntaxNode,\n filePath: string,\n analysis: FileAnalysis,\n parentId: string\n ): void {\n const nameNode = node.childForFieldName(\"name\");\n if (!nameNode) return;\n\n const name = nameNode.text;\n\n // Check for decorators\n const decorators: string[] = [];\n let currentNode = node.previousSibling;\n while (currentNode?.type === \"decorator\") {\n const decoratorName = currentNode.children.find(\n (c) => c.type === \"identifier\" || c.type === \"attribute\"\n );\n if (decoratorName) {\n decorators.push(decoratorName.text);\n }\n currentNode = currentNode.previousSibling;\n }\n\n // Check if async\n const isAsync = node.children.some((c) => c.type === \"async\");\n\n const funcNode = this.createNode(\n \"function\",\n name,\n filePath,\n node.startPosition.row + 1,\n node.endPosition.row + 1,\n {\n async: isAsync,\n decorators,\n isPrivate: name.startsWith(\"_\"),\n isDunder: name.startsWith(\"__\") && name.endsWith(\"__\"),\n }\n );\n\n analysis.nodes.push(funcNode);\n analysis.edges.push(this.createEdge(\"contains\", parentId, funcNode.id));\n\n // Parse function body for calls\n const body = node.childForFieldName(\"body\");\n if (body) {\n this.parseBodyForCalls(body, filePath, analysis, funcNode.id);\n }\n\n // If not private, consider it exported\n if (!name.startsWith(\"_\")) {\n analysis.exports.push({\n name,\n isDefault: false,\n line: node.startPosition.row + 1,\n });\n }\n }\n\n private handleClass(\n node: Parser.SyntaxNode,\n filePath: string,\n analysis: FileAnalysis,\n parentId: string\n ): void {\n const nameNode = node.childForFieldName(\"name\");\n if (!nameNode) return;\n\n const name = nameNode.text;\n\n // Check for base classes\n const bases: string[] = [];\n const argumentList = node.children.find((c) => c.type === \"argument_list\");\n if (argumentList) {\n for (const arg of argumentList.children) {\n if (arg.type === \"identifier\" || arg.type === \"attribute\") {\n bases.push(arg.text);\n }\n }\n }\n\n const classNode = this.createNode(\n \"class\",\n name,\n filePath,\n node.startPosition.row + 1,\n node.endPosition.row + 1,\n {\n bases,\n isPrivate: name.startsWith(\"_\"),\n }\n );\n\n analysis.nodes.push(classNode);\n analysis.edges.push(this.createEdge(\"contains\", parentId, classNode.id));\n\n // Add extends edges\n for (const base of bases) {\n analysis.edges.push(\n this.createEdge(\"extends\", classNode.id, `ref:${base}`, {\n unresolvedName: base,\n })\n );\n }\n\n // Parse class body for methods\n const body = node.childForFieldName(\"body\");\n if (body) {\n for (const child of body.children) {\n if (child.type === \"function_definition\") {\n this.handleMethod(child, filePath, analysis, classNode.id);\n }\n }\n }\n\n // Consider non-private classes as exports\n if (!name.startsWith(\"_\")) {\n analysis.exports.push({\n name,\n isDefault: false,\n line: node.startPosition.row + 1,\n });\n }\n }\n\n private handleMethod(\n node: Parser.SyntaxNode,\n filePath: string,\n analysis: FileAnalysis,\n classId: string\n ): void {\n const nameNode = node.childForFieldName(\"name\");\n if (!nameNode) return;\n\n const name = nameNode.text;\n\n // Check for decorators\n const decorators: string[] = [];\n let currentNode = node.previousSibling;\n while (currentNode?.type === \"decorator\") {\n const decoratorName = currentNode.children.find(\n (c) => c.type === \"identifier\" || c.type === \"attribute\"\n );\n if (decoratorName) {\n decorators.push(decoratorName.text);\n }\n currentNode = currentNode.previousSibling;\n }\n\n const isStatic = decorators.includes(\"staticmethod\");\n const isClassMethod = decorators.includes(\"classmethod\");\n const isProperty = decorators.includes(\"property\");\n const isAsync = node.children.some((c) => c.type === \"async\");\n\n const methodNode = this.createNode(\n \"method\",\n name,\n filePath,\n node.startPosition.row + 1,\n node.endPosition.row + 1,\n {\n async: isAsync,\n decorators,\n static: isStatic,\n classmethod: isClassMethod,\n property: isProperty,\n isPrivate: name.startsWith(\"_\"),\n isDunder: name.startsWith(\"__\") && name.endsWith(\"__\"),\n }\n );\n\n analysis.nodes.push(methodNode);\n analysis.edges.push(this.createEdge(\"contains\", classId, methodNode.id));\n\n // Parse method body for calls\n const body = node.childForFieldName(\"body\");\n if (body) {\n this.parseBodyForCalls(body, filePath, analysis, methodNode.id);\n }\n }\n\n private handleCall(\n node: Parser.SyntaxNode,\n filePath: string,\n analysis: FileAnalysis,\n parentId: string\n ): void {\n const funcNode = node.childForFieldName(\"function\");\n if (!funcNode) return;\n\n let calledName = \"\";\n if (funcNode.type === \"identifier\") {\n calledName = funcNode.text;\n } else if (funcNode.type === \"attribute\") {\n // Get the full attribute access (e.g., \"self.method\", \"module.func\")\n calledName = funcNode.text;\n }\n\n if (calledName && !calledName.startsWith(\"self.\")) {\n // Skip self.x calls as they're internal\n analysis.edges.push(\n this.createEdge(\"calls\", parentId, `ref:${calledName}`, {\n unresolvedName: calledName,\n line: node.startPosition.row + 1,\n })\n );\n }\n }\n\n private parseBodyForCalls(\n body: Parser.SyntaxNode,\n filePath: string,\n analysis: FileAnalysis,\n parentId: string\n ): void {\n const walkForCalls = (node: Parser.SyntaxNode): void => {\n if (node.type === \"call\") {\n this.handleCall(node, filePath, analysis, parentId);\n }\n for (const child of node.children) {\n walkForCalls(child);\n }\n };\n walkForCalls(body);\n }\n}\n","/**\n * Parser registry and exports\n */\n\nexport { BaseParser, ParserRegistry, parserRegistry } from \"./base.js\";\nexport { TypeScriptParser, JavaScriptParser } from \"./typescript.js\";\nexport { PythonParser } from \"./python.js\";\n\nimport { parserRegistry } from \"./base.js\";\nimport { TypeScriptParser, JavaScriptParser } from \"./typescript.js\";\nimport { PythonParser } from \"./python.js\";\n\n// Register all parsers\nexport function registerAllParsers(): void {\n parserRegistry.register(new TypeScriptParser());\n parserRegistry.register(new JavaScriptParser());\n parserRegistry.register(new PythonParser());\n}\n\n// Auto-register on import\nregisterAllParsers();\n","/**\n * Skill Generator - Creates Claude Code skills based on codebase analysis\n */\n\nimport { mkdirSync, writeFileSync, existsSync } from \"fs\";\nimport { join, dirname, basename } from \"path\";\nimport { GraphStorage } from \"../graph/storage.js\";\nimport type { GeneratedSkill, SkillConfig } from \"../types.js\";\n\nexport class SkillGenerator {\n private storage: GraphStorage;\n private config: SkillConfig;\n\n constructor(storage: GraphStorage, config: SkillConfig) {\n this.storage = storage;\n this.config = config;\n }\n\n /**\n * Generate all skills and write to .claude/skills/\n */\n generateAll(): GeneratedSkill[] {\n const skills: GeneratedSkill[] = [];\n\n // 1. Architecture overview skill\n if (this.config.includeArchitecture) {\n skills.push(this.generateArchitectureSkill());\n }\n\n // 2. Codebase patterns skill\n if (this.config.includePatterns) {\n skills.push(this.generatePatternsSkill());\n }\n\n // 3. Dependency explorer skill\n if (this.config.includeDependencies) {\n skills.push(this.generateDependencySkill());\n }\n\n // 4. Impact analysis skill (always generate)\n skills.push(this.generateImpactAnalysisSkill());\n\n // 5. Code navigation skill (always generate)\n skills.push(this.generateNavigationSkill());\n\n // Write all skills to disk\n this.writeSkills(skills);\n\n return skills;\n }\n\n private generateArchitectureSkill(): GeneratedSkill {\n const stats = this.storage.getStats();\n const rootPath = this.storage.getMeta(\"rootPath\") || \"\";\n\n // Get file structure by analyzing paths\n const allNodes = this.storage.getNodesByType(\"file\");\n const directories = new Map<string, number>();\n\n for (const node of allNodes) {\n const relativePath = node.filePath.replace(rootPath, \"\").replace(/^\\//, \"\");\n const parts = relativePath.split(\"/\");\n if (parts.length > 1) {\n const topDir = parts[0];\n directories.set(topDir, (directories.get(topDir) || 0) + 1);\n }\n }\n\n // Sort directories by file count\n const sortedDirs = [...directories.entries()]\n .sort((a, b) => b[1] - a[1])\n .slice(0, 10);\n\n const dirList = sortedDirs\n .map(([dir, count]) => `- \\`${dir}/\\` (${count} files)`)\n .join(\"\\n\");\n\n const langList = Object.entries(stats.languages)\n .map(([lang, count]) => `- ${lang}: ${count} files`)\n .join(\"\\n\");\n\n const content = `---\nname: architecture\ndescription: Overview of ${this.config.projectName} architecture and structure\nuser-invocable: true\n---\n\n# ${this.config.projectName} Architecture\n\n## Project Statistics\n- **Total files**: ${stats.totalFiles}\n- **Functions/Methods**: ${stats.nodesByType.function || 0} functions, ${stats.nodesByType.method || 0} methods\n- **Classes**: ${stats.nodesByType.class || 0}\n- **Import relationships**: ${stats.edgesByType.imports || 0}\n- **Call relationships**: ${stats.edgesByType.calls || 0}\n\n## Languages\n${langList}\n\n## Directory Structure\n${dirList}\n\n## Key Patterns\nWhen working with this codebase:\n1. Check the main directories above for feature organization\n2. Use the \\`/impact\\` skill to understand changes\n3. Use the \\`/navigate\\` skill to find specific code\n\n## Getting Started\nTo understand a specific area, ask questions like:\n- \"What does the ${sortedDirs[0]?.[0] || \"src\"} directory contain?\"\n- \"How is authentication handled?\"\n- \"What are the main entry points?\"\n`;\n\n return {\n name: \"architecture\",\n description: `Overview of ${this.config.projectName} architecture`,\n content,\n filePath: join(this.config.outputDir, \"architecture\", \"SKILL.md\"),\n };\n }\n\n private generatePatternsSkill(): GeneratedSkill {\n const stats = this.storage.getStats();\n\n // Analyze common patterns from the graph\n const classes = this.storage.getNodesByType(\"class\");\n const functions = this.storage.getNodesByType(\"function\");\n\n // Find classes with many methods (likely important)\n const classDetails = classes.map((cls) => {\n const methods = this.storage.getEdgesFrom(cls.id).filter((e) => e.type === \"contains\");\n return { ...cls, methodCount: methods.length };\n }).sort((a, b) => b.methodCount - a.methodCount);\n\n const topClasses = classDetails.slice(0, 5);\n const classList = topClasses\n .map((c) => `- \\`${c.name}\\` (${c.methodCount} methods) - [${basename(c.filePath)}](${c.filePath}#L${c.startLine})`)\n .join(\"\\n\");\n\n // Find most-called functions\n const callEdges = this.storage.getEdgesByType(\"calls\");\n const callCounts = new Map<string, number>();\n for (const edge of callEdges) {\n const target = edge.targetId.replace(\"ref:\", \"\");\n callCounts.set(target, (callCounts.get(target) || 0) + 1);\n }\n\n const mostCalled = [...callCounts.entries()]\n .sort((a, b) => b[1] - a[1])\n .slice(0, 10);\n\n const calledList = mostCalled\n .map(([name, count]) => `- \\`${name}\\` (called ${count} times)`)\n .join(\"\\n\");\n\n const content = `---\nname: patterns\ndescription: Common patterns and conventions in ${this.config.projectName}\n---\n\n# Codebase Patterns\n\n## Key Classes\nThese are the most substantial classes in the codebase:\n${classList || \"No classes found\"}\n\n## Most Used Functions\nThese functions are called most frequently:\n${calledList || \"No call data available\"}\n\n## Conventions Detected\n\n### File Organization\n${stats.nodesByType.file ? `- ${stats.totalFiles} files organized across the project` : \"\"}\n${stats.languages.typescript ? \"- TypeScript is used for type safety\" : \"\"}\n${stats.languages.python ? \"- Python follows standard module patterns\" : \"\"}\n\n### Code Structure\n- Functions: ${stats.nodesByType.function || 0}\n- Classes: ${stats.nodesByType.class || 0}\n- Methods: ${stats.nodesByType.method || 0}\n\n## When Making Changes\n1. Follow existing naming conventions\n2. Check similar files for patterns\n3. Use \\`/impact\\` to verify affected areas\n`;\n\n return {\n name: \"patterns\",\n description: `Common patterns in ${this.config.projectName}`,\n content,\n filePath: join(this.config.outputDir, \"patterns\", \"SKILL.md\"),\n };\n }\n\n private generateDependencySkill(): GeneratedSkill {\n const content = `---\nname: dependencies\ndescription: Explore dependencies and imports in ${this.config.projectName}\ncontext: fork\nagent: Explore\n---\n\n# Dependency Explorer\n\nWhen analyzing dependencies for $ARGUMENTS:\n\n## Steps\n1. **Find the target file/module**\n - Search for files matching the query\n - Identify the main module or component\n\n2. **Analyze imports**\n - What does this file import?\n - Are there circular dependencies?\n\n3. **Analyze dependents**\n - What files import this module?\n - How deep is the dependency chain?\n\n4. **Provide summary**\n - List direct dependencies\n - List files that depend on this\n - Highlight any concerns (circular deps, too many dependents)\n\n## Query the CodeMap database\nIf the codemap MCP server is available, use these queries:\n- Get imports: Query the imports table for the file\n- Get dependents: Find files that import this module\n- Get call graph: Find functions that call into this module\n\n## Output Format\n\\`\\`\\`\nDependencies for [target]:\n\nIMPORTS (what this uses):\n- module1 (from ./path)\n- module2 (from package)\n\nIMPORTED BY (what uses this):\n- file1.ts (lines X-Y)\n- file2.ts (lines X-Y)\n\nDEPENDENCY DEPTH: N levels\n\\`\\`\\`\n`;\n\n return {\n name: \"dependencies\",\n description: `Explore dependencies in ${this.config.projectName}`,\n content,\n filePath: join(this.config.outputDir, \"dependencies\", \"SKILL.md\"),\n };\n }\n\n private generateImpactAnalysisSkill(): GeneratedSkill {\n const content = `---\nname: impact\ndescription: Analyze the impact of changes to a file or function\ndisable-model-invocation: true\n---\n\n# Impact Analysis\n\nAnalyze what would be affected by changes to $ARGUMENTS.\n\n## Analysis Steps\n\n1. **Identify the target**\n - Find the file, function, or class being modified\n - Note its current state and purpose\n\n2. **Find direct dependents**\n - What files import this module?\n - What functions call this function?\n - What classes extend this class?\n\n3. **Find indirect dependents**\n - Follow the chain: if A depends on B, and B is our target, A is affected\n - Go up to 3 levels deep\n\n4. **Categorize impact**\n - **Breaking changes**: Signature changes, removed exports\n - **Behavioral changes**: Logic changes that may affect callers\n - **Safe changes**: Internal refactors, added functionality\n\n5. **Generate checklist**\n\n## Output Format\n\n\\`\\`\\`markdown\n# Impact Analysis: [target]\n\n## Direct Impact\n- [ ] file1.ts - uses [specific function/import]\n- [ ] file2.ts - extends [class]\n\n## Indirect Impact\n- [ ] file3.ts - imports file1.ts which uses [target]\n\n## Recommended Actions\n1. Update tests in [test files]\n2. Check [specific callers] for compatibility\n3. Update documentation in [docs]\n\n## Risk Level: [LOW/MEDIUM/HIGH]\n[Explanation of risk assessment]\n\\`\\`\\`\n`;\n\n return {\n name: \"impact\",\n description: \"Analyze impact of code changes\",\n content,\n filePath: join(this.config.outputDir, \"impact\", \"SKILL.md\"),\n };\n }\n\n private generateNavigationSkill(): GeneratedSkill {\n const stats = this.storage.getStats();\n\n const content = `---\nname: navigate\ndescription: Navigate to specific code in ${this.config.projectName}\n---\n\n# Code Navigation\n\nFind and navigate to code matching $ARGUMENTS.\n\n## Available Queries\n\n### By Type\n- \"find class [name]\" - Locate a class definition\n- \"find function [name]\" - Locate a function\n- \"find file [pattern]\" - Find files matching pattern\n- \"find imports of [module]\" - Find all imports of a module\n\n### By Relationship\n- \"callers of [function]\" - Who calls this function?\n- \"callees of [function]\" - What does this function call?\n- \"subclasses of [class]\" - Classes that extend this\n- \"implementers of [interface]\" - Classes implementing interface\n\n### By Location\n- \"in [directory]\" - Filter to specific directory\n- \"in [file]\" - Show contents of file\n\n## Codebase Stats\n- ${stats.totalFiles} files to search\n- ${stats.nodesByType.function || 0} functions\n- ${stats.nodesByType.class || 0} classes\n- ${stats.nodesByType.method || 0} methods\n\n## Output Format\nFor each match, provide:\n- File path with line number link\n- Brief description of what it does\n- Related code (callers/callees if relevant)\n`;\n\n return {\n name: \"navigate\",\n description: `Navigate ${this.config.projectName} codebase`,\n content,\n filePath: join(this.config.outputDir, \"navigate\", \"SKILL.md\"),\n };\n }\n\n private writeSkills(skills: GeneratedSkill[]): void {\n for (const skill of skills) {\n const dir = dirname(skill.filePath);\n if (!existsSync(dir)) {\n mkdirSync(dir, { recursive: true });\n }\n writeFileSync(skill.filePath, skill.content, \"utf-8\");\n }\n }\n}\n","/**\n * Core types for CodeMap\n */\n\n// ============ Graph Node Types ============\n\nexport type NodeType =\n | \"file\"\n | \"function\"\n | \"class\"\n | \"method\"\n | \"variable\"\n | \"module\"\n | \"import\";\n\nexport interface GraphNode {\n id: string;\n type: NodeType;\n name: string;\n filePath: string;\n startLine: number;\n endLine: number;\n language: string;\n metadata?: Record<string, unknown>;\n}\n\n// ============ Graph Edge Types ============\n\nexport type EdgeType =\n | \"imports\"\n | \"calls\"\n | \"extends\"\n | \"implements\"\n | \"contains\"\n | \"uses\"\n | \"exports\";\n\nexport interface GraphEdge {\n id: string;\n type: EdgeType;\n sourceId: string;\n targetId: string;\n metadata?: Record<string, unknown>;\n}\n\n// ============ Analysis Results ============\n\nexport interface FileAnalysis {\n filePath: string;\n language: string;\n nodes: GraphNode[];\n edges: GraphEdge[];\n imports: ImportInfo[];\n exports: ExportInfo[];\n}\n\nexport interface ImportInfo {\n source: string;\n specifiers: string[];\n isDefault: boolean;\n isNamespace: boolean;\n line: number;\n}\n\nexport interface ExportInfo {\n name: string;\n isDefault: boolean;\n line: number;\n}\n\n// ============ Project Analysis ============\n\nexport interface ProjectAnalysis {\n rootPath: string;\n files: FileAnalysis[];\n totalNodes: number;\n totalEdges: number;\n languages: Record<string, number>;\n analyzedAt: string;\n}\n\n// ============ Query Results ============\n\nexport interface AffectedFile {\n filePath: string;\n reason: string;\n depth: number;\n connections: string[];\n}\n\nexport interface CallChain {\n caller: GraphNode;\n callee: GraphNode;\n filePath: string;\n line: number;\n}\n\n// ============ Skill Generation ============\n\nexport interface GeneratedSkill {\n name: string;\n description: string;\n content: string;\n filePath: string;\n}\n\nexport interface SkillConfig {\n projectName: string;\n outputDir: string;\n includeArchitecture: boolean;\n includePatterns: boolean;\n includeDependencies: boolean;\n}\n\n// ============ Configuration ============\n\nexport interface CodeMapConfig {\n rootPath: string;\n include: string[];\n exclude: string[];\n languages: string[];\n dbPath: string;\n skillsOutputDir: string;\n}\n\nexport const DEFAULT_CONFIG: Partial<CodeMapConfig> = {\n include: [\"**/*.ts\", \"**/*.tsx\", \"**/*.js\", \"**/*.jsx\", \"**/*.py\"],\n exclude: [\n \"**/node_modules/**\",\n \"**/dist/**\",\n \"**/build/**\",\n \"**/.git/**\",\n \"**/venv/**\",\n \"**/__pycache__/**\",\n \"**/.next/**\",\n ],\n languages: [\"typescript\", \"javascript\", \"python\"],\n};\n\n// ============ MCP Types ============\n\nexport interface MCPToolResult {\n content: Array<{\n type: \"text\";\n text: string;\n }>;\n}\n\nexport interface MCPResource {\n uri: string;\n name: string;\n description: string;\n mimeType: string;\n}\n"],"mappings":";;;;;;;AAIA,SAAS,eAAe;AACxB,SAAS,WAAAA,UAAS,QAAAC,OAAM,YAAAC,iBAAgB;AACxC,SAAS,cAAAC,aAAY,aAAAC,kBAA+B;AACpD,OAAO,WAAW;AAClB,OAAO,SAAS;;;ACJhB,SAAS,oBAA8B;AACvC,SAAS,YAAY;AACrB,SAAe,UAAU,eAAe;;;ACMjC,IAAe,aAAf,MAA4C;AAAA,EAIvC,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAIhB,eAAe,UAAkB,MAAc,MAAsB;AAC7E,WAAO,GAAG,QAAQ,IAAI,IAAI,IAAI,IAAI;AAAA,EACpC;AAAA,EAEU,iBAAyB;AACjC,WAAO,QAAQ,EAAE,KAAK,aAAa;AAAA,EACrC;AAAA,EAEU,WACR,MACA,MACA,UACA,WACA,SACA,UACW;AACX,WAAO;AAAA,MACL,IAAI,KAAK,eAAe,UAAU,MAAM,SAAS;AAAA,MACjD;AAAA,MACA;AAAA,MACA;A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I;AAAA,EACd;AAEA,UAAQ,MAAM;AAChB,CAAC;AAIH,QACG,QAAQ,OAAO,EACf,YAAY,oCAAoC,EAChD,SAAS,UAAU,4BAA4B,GAAG,EAClD,OAAO,qBAAqB,6BAA6B,MAAM,EAC/D,OAAO,OAAO,MAAc,YAAY;AACvC,QAAM,WAAWD,SAAQ,IAAI;AAC7B,QAAM,SAASG,MAAK,UAAU,YAAY,UAAU;AAEpD,MAAI,CAACF,YAAW,MAAM,GAAG;AACvB,YAAQ,MAAM,MAAM,IAAI,qCAAqC,CAAC;AAC9D,YAAQ,MAAM,MAAM,KAAK,wDAAwD,CAAC;AAClF,YAAQ,KAAK,CAAC;AAAA,EAChB;AAEA,UAAQ,IAAI,MAAM,KAAK,KAAK,oCAAoC,CAAC;AAGjE,QAAM,EAAE,YAAY,IAAI,MAAM,OAAO,sBAAiB;AACtD,cAAY,QAAQ,SAAS,QAAQ,MAAM,EAAE,CAAC;AAChD,CAAC;AAIH,QACG,QAAQ,YAAY,EACpB,YAAY,kDAAkD,EAC9D,OAAO,qBAAqB,qBAAqB,GAAG,EACpD,OAAO,OAAO,YAAY;AACzB,UAAQ,IAAI,uBAAuBD,SAAQ,QAAQ,IAAI;AACvD,UAAQ,IAAI,kBAAkBG,MAAKH,SAAQ,QAAQ,IAAI,GAAG,YAAY,UAAU;AAGhF,QAAM,OAAO,sBAAiB;AAChC,CAAC;AAGH,QAAQ,MAAM;","names":["resolve","join","basename","existsSync","mkdirSync","Parser","Parser","join","resolve","existsSync","mkdirSync","join","basename"]}
1
+ {"version":3,"sources":["../src/cli.ts","../src/graph/builder.ts","../src/parsers/base.ts","../src/parsers/typescript.ts","../src/parsers/python.ts","../src/parsers/index.ts","../src/skills/generator.ts","../src/types.ts"],"sourcesContent":["/**\n * CodeMap CLI - Main entry point\n */\n\nimport { Command } from \"commander\";\nimport { resolve, join, basename } from \"path\";\nimport { existsSync, mkdirSync, readFileSync } from \"fs\";\nimport chalk from \"chalk\";\nimport ora from \"ora\";\nimport { GraphBuilder, GraphStorage } from \"./graph/index.js\";\nimport { SkillGenerator } from \"./skills/index.js\";\nimport { DEFAULT_CONFIG } from \"./types.js\";\nimport type { CodeMapConfig } from \"./types.js\";\n\n// Import parsers to register them\nimport \"./parsers/index.js\";\n\nconst program = new Command();\n\nprogram\n .name(\"codemap\")\n .description(\"AI-powered codebase knowledge graph generator with Claude Code integration\")\n .version(\"0.1.0\");\n\n// ============ Scan Command ============\n\nprogram\n .command(\"scan\")\n .description(\"Scan a codebase and build the knowledge graph\")\n .argument(\"[path]\", \"Path to the project root\", \".\")\n .option(\"-o, --output <dir>\", \"Output directory for database\", \".codemap\")\n .option(\"--include <patterns...>\", \"Glob patterns to include\")\n .option(\"--exclude <patterns...>\", \"Glob patterns to exclude\")\n .option(\"--clean\", \"Clear existing data before scanning\")\n .action(async (path: string, options) => {\n const rootPath = resolve(path);\n const outputDir = resolve(rootPath, options.output);\n\n console.log(chalk.blue.bold(\"\\n CodeMap Scanner\\n\"));\n console.log(chalk.gray(` Project: ${rootPath}`));\n console.log(chalk.gray(` Output: ${outputDir}\\n`));\n\n // Create output directory\n if (!existsSync(outputDir)) {\n mkdirSync(outputDir, { recursive: true });\n }\n\n const dbPath = join(outputDir, \"graph.db\");\n\n // Initialize storage\n const storage = new GraphStorage(dbPath);\n\n if (options.clean) {\n storage.clear();\n console.log(chalk.yellow(\" Cleared existing data\\n\"));\n }\n\n // Build config\n const config: CodeMapConfig = {\n rootPath,\n include: options.include || DEFAULT_CONFIG.include!,\n exclude: options.exclude || DEFAULT_CONFIG.exclude!,\n languages: DEFAULT_CONFIG.languages!,\n dbPath,\n skillsOutputDir: join(rootPath, \".claude\", \"skills\", \"codemap\"),\n };\n\n // Create builder with progress\n const builder = new GraphBuilder(storage, config);\n const spinner = ora(\"Discovering files...\").start();\n\n builder.setProgressCallback((progress) => {\n switch (progress.phase) {\n case \"discovering\":\n spinner.text = \"Discovering files...\";\n break;\n case \"parsing\":\n spinner.text = `Parsing (${progress.current}/${progress.total}): ${progress.currentFile}`;\n break;\n case \"resolving\":\n spinner.text = \"Resolving cross-file references...\";\n break;\n case \"complete\":\n spinner.succeed(chalk.green(\"Scan complete!\"));\n break;\n }\n });\n\n try {\n const result = await builder.scan();\n\n console.log(chalk.blue(\"\\n Results:\\n\"));\n console.log(` ${chalk.bold(\"Files:\")} ${result.files.length}`);\n console.log(` ${chalk.bold(\"Nodes:\")} ${result.totalNodes}`);\n console.log(` ${chalk.bold(\"Edges:\")} ${result.totalEdges}`);\n console.log(` ${chalk.bold(\"Languages:\")} ${Object.keys(result.languages).join(\", \")}`);\n\n console.log(chalk.gray(`\\n Database saved to: ${dbPath}\\n`));\n console.log(chalk.cyan(\" Run 'codemap generate-skills' to create Claude Code skills\"));\n console.log(chalk.cyan(\" Run 'codemap serve' to start the web visualization\\n\"));\n } catch (error) {\n spinner.fail(chalk.red(\"Scan failed\"));\n console.error(error);\n process.exit(1);\n } finally {\n storage.close();\n }\n });\n\n// ============ Generate Skills Command ============\n\nprogram\n .command(\"generate-skills\")\n .description(\"Generate Claude Code skills from the knowledge graph\")\n .argument(\"[path]\", \"Path to the project root\", \".\")\n .option(\"-o, --output <dir>\", \"Output directory for skills\", \".claude/skills\")\n .option(\"--name <name>\", \"Project name for skill descriptions\")\n .option(\"--no-architecture\", \"Skip architecture skill\")\n .option(\"--no-patterns\", \"Skip patterns skill\")\n .option(\"--no-dependencies\", \"Skip dependencies skill\")\n .action(async (path: string, options) => {\n const rootPath = resolve(path);\n const dbPath = join(rootPath, \".codemap\", \"graph.db\");\n\n if (!existsSync(dbPath)) {\n console.error(chalk.red(\"\\n Error: No graph database found.\"));\n console.error(chalk.gray(\" Run 'codemap scan' first to analyze your codebase.\\n\"));\n process.exit(1);\n }\n\n const outputDir = resolve(rootPath, options.output);\n const projectName = options.name || basename(rootPath);\n\n console.log(chalk.blue.bold(\"\\n Generating Claude Code Skills\\n\"));\n console.log(chalk.gray(` Project: ${projectName}`));\n console.log(chalk.gray(` Output: ${outputDir}\\n`));\n\n const storage = new GraphStorage(dbPath);\n\n const generator = new SkillGenerator(storage, {\n projectName,\n outputDir,\n includeArchitecture: options.architecture !== false,\n includePatterns: options.patterns !== false,\n includeDependencies: options.dependencies !== false,\n });\n\n const skills = generator.generateAll();\n\n console.log(chalk.green(` Generated ${skills.length} skills:\\n`));\n for (const skill of skills) {\n console.log(` ${chalk.cyan(`/${skill.name}`)} - ${skill.description}`);\n }\n\n console.log(chalk.gray(`\\n Skills written to: ${outputDir}`));\n console.log(chalk.cyan(\"\\n Claude Code can now use these skills automatically!\\n\"));\n\n storage.close();\n });\n\n// ============ Stats Command ============\n\nprogram\n .command(\"stats\")\n .description(\"Show statistics about the analyzed codebase\")\n .argument(\"[path]\", \"Path to the project root\", \".\")\n .action(async (path: string) => {\n const rootPath = resolve(path);\n const dbPath = join(rootPath, \".codemap\", \"graph.db\");\n\n if (!existsSync(dbPath)) {\n console.error(chalk.red(\"\\n Error: No graph database found.\"));\n console.error(chalk.gray(\" Run 'codemap scan' first to analyze your codebase.\\n\"));\n process.exit(1);\n }\n\n const storage = new GraphStorage(dbPath);\n const stats = storage.getStats();\n const analyzedAt = storage.getMeta(\"analyzedAt\");\n\n console.log(chalk.blue.bold(\"\\n Codebase Statistics\\n\"));\n console.log(` ${chalk.bold(\"Last analyzed:\")} ${analyzedAt || \"unknown\"}`);\n console.log();\n console.log(` ${chalk.bold(\"Total files:\")} ${stats.totalFiles}`);\n console.log(` ${chalk.bold(\"Total nodes:\")} ${stats.totalNodes}`);\n console.log(` ${chalk.bold(\"Total edges:\")} ${stats.totalEdges}`);\n\n console.log(chalk.blue(\"\\n By Type:\\n\"));\n for (const [type, count] of Object.entries(stats.nodesByType)) {\n console.log(` ${chalk.gray(\"-\")} ${type}: ${count}`);\n }\n\n console.log(chalk.blue(\"\\n By Language:\\n\"));\n for (const [lang, count] of Object.entries(stats.languages)) {\n console.log(` ${chalk.gray(\"-\")} ${lang}: ${count}`);\n }\n\n console.log(chalk.blue(\"\\n Relationships:\\n\"));\n for (const [type, count] of Object.entries(stats.edgesByType)) {\n console.log(` ${chalk.gray(\"-\")} ${type}: ${count}`);\n }\n\n console.log();\n storage.close();\n });\n\n// ============ Affected Command ============\n\nprogram\n .command(\"affected\")\n .description(\"Show files that would be affected by changes to a target\")\n .argument(\"<target>\", \"File path or function/class name\")\n .option(\"-d, --depth <n>\", \"Maximum dependency depth to follow\", \"2\")\n .option(\"-p, --path <path>\", \"Project root path\", \".\")\n .action(async (target: string, options) => {\n const rootPath = resolve(options.path);\n const dbPath = join(rootPath, \".codemap\", \"graph.db\");\n\n if (!existsSync(dbPath)) {\n console.error(chalk.red(\"\\n Error: No graph database found.\"));\n console.error(chalk.gray(\" Run 'codemap scan' first to analyze your codebase.\\n\"));\n process.exit(1);\n }\n\n const storage = new GraphStorage(dbPath);\n const depth = parseInt(options.depth, 10);\n\n console.log(chalk.blue.bold(`\\n Impact Analysis: ${target}\\n`));\n\n // Find the target\n const nodes = storage.searchNodes(target);\n if (nodes.length === 0) {\n console.log(chalk.yellow(` No matches found for \"${target}\"\\n`));\n storage.close();\n return;\n }\n\n const targetNode = nodes[0];\n console.log(\n chalk.gray(` Target: ${targetNode.name} (${targetNode.type}) in ${targetNode.filePath}\\n`)\n );\n\n // Find affected files\n const affected: Set<string> = new Set();\n\n // Check who imports this file\n const importers = storage.getFilesThatImport(\n targetNode.filePath.replace(/\\.(ts|tsx|js|jsx|py)$/, \"\")\n );\n for (const imp of importers) {\n affected.add(imp);\n }\n\n // Check callers\n const callers = storage.getCallers(targetNode.name);\n for (const caller of callers) {\n affected.add(caller.filePath);\n }\n\n const affectedList = [...affected].filter((f) => f !== targetNode.filePath);\n\n if (affectedList.length === 0) {\n console.log(chalk.green(\" No affected files found\\n\"));\n } else {\n console.log(chalk.yellow(` Affected files (${affectedList.length}):\\n`));\n for (const file of affectedList) {\n console.log(` ${chalk.gray(\"-\")} ${file}`);\n }\n console.log();\n }\n\n storage.close();\n });\n\n// ============ Serve Command ============\n\nprogram\n .command(\"serve\")\n .description(\"Start the web visualization server\")\n .argument(\"[path]\", \"Path to the project root\", \".\")\n .option(\"-p, --port <port>\", \"Port to run the server on\", \"3333\")\n .action(async (path: string, options) => {\n const rootPath = resolve(path);\n const dbPath = join(rootPath, \".codemap\", \"graph.db\");\n\n if (!existsSync(dbPath)) {\n console.error(chalk.red(\"\\n Error: No graph database found.\"));\n console.error(chalk.gray(\" Run 'codemap scan' first to analyze your codebase.\\n\"));\n process.exit(1);\n }\n\n console.log(chalk.blue.bold(\"\\n CodeMap Visualization Server\\n\"));\n\n // Dynamically import and start the server\n const { startServer } = await import(\"./web/server.js\");\n startServer(dbPath, parseInt(options.port, 10));\n });\n\n// ============ MCP Server Command ============\n\nprogram\n .command(\"mcp-server\")\n .description(\"Start the MCP server for Claude Code integration\")\n .option(\"-p, --path <path>\", \"Project root path\", \".\")\n .action(async (options) => {\n process.env.CODEMAP_PROJECT_ROOT = resolve(options.path);\n process.env.CODEMAP_DB_PATH = join(resolve(options.path), \".codemap\", \"graph.db\");\n\n // Dynamically import and run the MCP server\n await import(\"./mcp/server.js\");\n });\n\n// ============ Init Command (All-in-One) ============\n\nprogram\n .command(\"init\")\n .description(\"Initialize CodeMap: scan, generate skills, and add MCP server to Claude Code\")\n .argument(\"[path]\", \"Path to the project root\", \".\")\n .option(\"--name <name>\", \"Project name for skill descriptions\")\n .option(\"--skip-mcp\", \"Skip adding MCP server to Claude Code\")\n .action(async (path: string, options) => {\n const rootPath = resolve(path);\n const projectName = options.name || basename(rootPath);\n\n console.log(chalk.blue.bold(\"\\n ╔═══════════════════════════════════════╗\"));\n console.log(chalk.blue.bold(\" ║ CodeMap Initialization ║\"));\n console.log(chalk.blue.bold(\" ╚═══════════════════════════════════════╝\\n\"));\n console.log(chalk.gray(` Project: ${projectName}`));\n console.log(chalk.gray(` Path: ${rootPath}\\n`));\n\n // Step 1: Scan\n console.log(chalk.cyan(\" Step 1/3: Scanning codebase...\\n\"));\n\n const outputDir = join(rootPath, \".codemap\");\n if (!existsSync(outputDir)) {\n mkdirSync(outputDir, { recursive: true });\n }\n\n const dbPath = join(outputDir, \"graph.db\");\n const storage = new GraphStorage(dbPath);\n\n const config: CodeMapConfig = {\n rootPath,\n include: DEFAULT_CONFIG.include!,\n exclude: DEFAULT_CONFIG.exclude!,\n languages: DEFAULT_CONFIG.languages!,\n dbPath,\n skillsOutputDir: join(rootPath, \".claude\", \"skills\"),\n };\n\n const builder = new GraphBuilder(storage, config);\n const spinner = ora(\"Discovering files...\").start();\n\n builder.setProgressCallback((progress) => {\n switch (progress.phase) {\n case \"discovering\":\n spinner.text = \"Discovering files...\";\n break;\n case \"parsing\":\n spinner.text = `Parsing (${progress.current}/${progress.total}): ${progress.currentFile}`;\n break;\n case \"resolving\":\n spinner.text = \"Resolving cross-file references...\";\n break;\n case \"complete\":\n spinner.succeed(chalk.green(\"Scan complete!\"));\n break;\n }\n });\n\n try {\n const result = await builder.scan();\n console.log(chalk.gray(`\\n Found ${result.totalNodes} code elements in ${result.files.length} files\\n`));\n\n // Step 2: Generate Skills\n console.log(chalk.cyan(\" Step 2/3: Generating Claude Code skills...\\n\"));\n\n const skillSpinner = ora(\"Generating skills...\").start();\n\n const generator = new SkillGenerator(storage, {\n projectName,\n outputDir: join(rootPath, \".claude\", \"skills\"),\n includeArchitecture: true,\n includePatterns: true,\n includeDependencies: true,\n });\n\n const skills = generator.generateAll();\n skillSpinner.succeed(chalk.green(`Generated ${skills.length} skills`));\n\n for (const skill of skills) {\n console.log(chalk.gray(` /${skill.name} - ${skill.description}`));\n }\n\n storage.close();\n\n // Step 3: Add MCP Server to Claude Code\n if (!options.skipMcp) {\n console.log(chalk.cyan(\"\\n Step 3/3: Adding MCP server to Claude Code...\\n\"));\n\n const mcpSpinner = ora(\"Configuring MCP server...\").start();\n\n try {\n const { execSync } = await import(\"child_process\");\n\n // Check if claude command exists\n try {\n execSync(\"which claude\", { stdio: \"pipe\" });\n } catch {\n mcpSpinner.warn(chalk.yellow(\"Claude CLI not found. Skipping MCP setup.\"));\n console.log(chalk.gray(\" To add manually later, run:\"));\n console.log(chalk.cyan(` claude mcp add codemap -- npx codemap-ai mcp-server --path ${rootPath}\\n`));\n return;\n }\n\n // Add MCP server\n const mcpCommand = `claude mcp add codemap -- npx codemap-ai mcp-server --path \"${rootPath}\"`;\n\n try {\n execSync(mcpCommand, { stdio: \"pipe\" });\n mcpSpinner.succeed(chalk.green(\"MCP server added to Claude Code!\"));\n } catch (error: any) {\n // Check if already exists\n if (error.message?.includes(\"already exists\")) {\n mcpSpinner.warn(chalk.yellow(\"MCP server 'codemap' already configured\"));\n } else {\n mcpSpinner.warn(chalk.yellow(\"Could not auto-add MCP server\"));\n console.log(chalk.gray(\" To add manually, run:\"));\n console.log(chalk.cyan(` claude mcp add codemap -- npx codemap-ai mcp-server --path ${rootPath}\\n`));\n }\n }\n } catch {\n mcpSpinner.warn(chalk.yellow(\"Could not configure MCP server automatically\"));\n console.log(chalk.gray(\" To add manually, run:\"));\n console.log(chalk.cyan(` claude mcp add codemap -- npx codemap-ai mcp-server --path ${rootPath}\\n`));\n }\n } else {\n console.log(chalk.gray(\"\\n Skipping MCP setup (--skip-mcp flag)\\n\"));\n }\n\n // Done!\n console.log(chalk.green.bold(\"\\n ✓ CodeMap initialized successfully!\\n\"));\n console.log(chalk.white(\" Available commands:\"));\n console.log(chalk.gray(\" codemap serve - Start web visualization\"));\n console.log(chalk.gray(\" codemap stats - Show codebase statistics\"));\n console.log(chalk.gray(\" codemap affected <file> - Analyze impact of changes\\n\"));\n console.log(chalk.white(\" Available skills (type in Claude Code):\"));\n console.log(chalk.gray(\" /architecture - Project overview\"));\n console.log(chalk.gray(\" /patterns - Code patterns and conventions\"));\n console.log(chalk.gray(\" /impact <file> - Change impact analysis\"));\n console.log(chalk.gray(\" /navigate - Find code in codebase\"));\n console.log(chalk.gray(\" /dependencies - Explore imports/exports\\n\"));\n\n } catch (error) {\n spinner.fail(chalk.red(\"Initialization failed\"));\n console.error(error);\n storage.close();\n process.exit(1);\n }\n });\n\n// Parse and run\nprogram.parse();\n","/**\n * Graph builder - scans codebase and builds the knowledge graph\n */\n\nimport { readFileSync, statSync } from \"fs\";\nimport { glob } from \"glob\";\nimport { join, relative, resolve } from \"path\";\nimport { parserRegistry } from \"../parsers/index.js\";\nimport { GraphStorage } from \"./storage.js\";\nimport type { CodeMapConfig, FileAnalysis, ProjectAnalysis } from \"../types.js\";\n\nexport interface ScanProgress {\n total: number;\n current: number;\n currentFile: string;\n phase: \"discovering\" | \"parsing\" | \"resolving\" | \"complete\";\n}\n\nexport type ProgressCallback = (progress: ScanProgress) => void;\n\nexport class GraphBuilder {\n private storage: GraphStorage;\n private config: CodeMapConfig;\n private onProgress?: ProgressCallback;\n\n constructor(storage: GraphStorage, config: CodeMapConfig) {\n this.storage = storage;\n this.config = config;\n }\n\n setProgressCallback(callback: ProgressCallback): void {\n this.onProgress = callback;\n }\n\n async scan(): Promise<ProjectAnalysis> {\n const rootPath = resolve(this.config.rootPath);\n\n // Phase 1: Discover files\n this.emitProgress({ total: 0, current: 0, currentFile: \"\", phase: \"discovering\" });\n\n const files = await this.discoverFiles(rootPath);\n\n // Phase 2: Parse files\n const fileAnalyses: FileAnalysis[] = [];\n let current = 0;\n\n for (const filePath of files) {\n current++;\n this.emitProgress({\n total: files.length,\n current,\n currentFile: relative(rootPath, filePath),\n phase: \"parsing\",\n });\n\n try {\n const analysis = this.parseFile(filePath);\n if (analysis) {\n fileAnalyses.push(analysis);\n this.storage.insertFileAnalysis(analysis);\n }\n } catch (error) {\n console.error(`Error parsing ${filePath}:`, error);\n }\n }\n\n // Phase 3: Resolve cross-file references\n this.emitProgress({\n total: files.length,\n current: files.length,\n currentFile: \"\",\n phase: \"resolving\",\n });\n this.resolveReferences();\n\n // Store metadata\n const languages: Record<string, number> = {};\n for (const analysis of fileAnalyses) {\n languages[analysis.language] = (languages[analysis.language] || 0) + 1;\n }\n\n const stats = this.storage.getStats();\n\n this.storage.setMeta(\"rootPath\", rootPath);\n this.storage.setMeta(\"analyzedAt\", new Date().toISOString());\n this.storage.setMeta(\"totalFiles\", String(files.length));\n\n this.emitProgress({\n total: files.length,\n current: files.length,\n currentFile: \"\",\n phase: \"complete\",\n });\n\n return {\n rootPath,\n files: fileAnalyses,\n totalNodes: stats.totalNodes,\n totalEdges: stats.totalEdges,\n languages,\n analyzedAt: new Date().toISOString(),\n };\n }\n\n private async discoverFiles(rootPath: string): Promise<string[]> {\n const patterns = this.config.include;\n const ignorePatterns = this.config.exclude;\n\n const allFiles: string[] = [];\n\n for (const pattern of patterns) {\n const matches = await glob(pattern, {\n cwd: rootPath,\n absolute: true,\n ignore: ignorePatterns,\n nodir: true,\n });\n allFiles.push(...matches);\n }\n\n // Deduplicate and filter by supported extensions\n const supportedExts = new Set(parserRegistry.getSupportedExtensions());\n const uniqueFiles = [...new Set(allFiles)].filter((f) => {\n const ext = f.substring(f.lastIndexOf(\".\"));\n return supportedExts.has(ext);\n });\n\n return uniqueFiles.sort();\n }\n\n private parseFile(filePath: string): FileAnalysis | null {\n const parser = parserRegistry.getForFile(filePath);\n if (!parser) {\n return null;\n }\n\n const content = readFileSync(filePath, \"utf-8\");\n return parser.parse(filePath, content);\n }\n\n private resolveReferences(): void {\n // Get all edges with unresolved references\n const allEdges = this.storage.getAllEdges();\n const allNodes = this.storage.getAllNodes();\n\n // Build a map of node names to node IDs\n const nodeNameMap = new Map<string, string[]>();\n for (const node of allNodes) {\n const existing = nodeNameMap.get(node.name) || [];\n existing.push(node.id);\n nodeNameMap.set(node.name, existing);\n }\n\n // Resolve references\n for (const edge of allEdges) {\n if (edge.targetId.startsWith(\"ref:\")) {\n const refName = edge.targetId.substring(4);\n const candidates = nodeNameMap.get(refName);\n\n if (candidates && candidates.length > 0) {\n // For now, take the first match (could be smarter with scope resolution)\n // Update the edge in storage\n // Note: In a more complete implementation, we'd update the edge in the DB\n }\n }\n }\n }\n\n private emitProgress(progress: ScanProgress): void {\n if (this.onProgress) {\n this.onProgress(progress);\n }\n }\n}\n\nexport { GraphStorage };\n","/**\n * Base parser interface and utilities\n */\n\nimport type { FileAnalysis, GraphNode, GraphEdge, ImportInfo, ExportInfo } from \"../types.js\";\n\nexport interface Parser {\n language: string;\n extensions: string[];\n parse(filePath: string, content: string): FileAnalysis;\n}\n\nexport abstract class BaseParser implements Parser {\n abstract language: string;\n abstract extensions: string[];\n\n protected nodeIdCounter = 0;\n protected edgeIdCounter = 0;\n\n abstract parse(filePath: string, content: string): FileAnalysis;\n\n protected generateNodeId(filePath: string, name: string, line: number): string {\n return `${filePath}:${name}:${line}`;\n }\n\n protected generateEdgeId(): string {\n return `edge_${++this.edgeIdCounter}`;\n }\n\n protected createNode(\n type: GraphNode[\"type\"],\n name: string,\n filePath: string,\n startLine: number,\n endLine: number,\n metadata?: Record<string, unknown>\n ): GraphNode {\n return {\n id: this.generateNodeId(filePath, name, startLine),\n type,\n name,\n filePath,\n startLine,\n endLine,\n language: this.language,\n metadata,\n };\n }\n\n protected createEdge(\n type: GraphEdge[\"type\"],\n sourceId: string,\n targetId: string,\n metadata?: Record<string, unknown>\n ): GraphEdge {\n return {\n id: this.generateEdgeId(),\n type,\n sourceId,\n targetId,\n metadata,\n };\n }\n\n protected createEmptyAnalysis(filePath: string): FileAnalysis {\n return {\n filePath,\n language: this.language,\n nodes: [],\n edges: [],\n imports: [],\n exports: [],\n };\n }\n}\n\n/**\n * Registry for all parsers\n */\nexport class ParserRegistry {\n private parsers: Map<string, Parser> = new Map();\n private extensionMap: Map<string, Parser> = new Map();\n\n register(parser: Parser): void {\n this.parsers.set(parser.language, parser);\n for (const ext of parser.extensions) {\n this.extensionMap.set(ext, parser);\n }\n }\n\n getByLanguage(language: string): Parser | undefined {\n return this.parsers.get(language);\n }\n\n getByExtension(extension: string): Parser | undefined {\n // Normalize extension (remove leading dot if present)\n const ext = extension.startsWith(\".\") ? extension : `.${extension}`;\n return this.extensionMap.get(ext);\n }\n\n getForFile(filePath: string): Parser | undefined {\n const ext = filePath.substring(filePath.lastIndexOf(\".\"));\n return this.getByExtension(ext);\n }\n\n getSupportedExtensions(): string[] {\n return Array.from(this.extensionMap.keys());\n }\n\n getSupportedLanguages(): string[] {\n return Array.from(this.parsers.keys());\n }\n}\n\nexport const parserRegistry = new ParserRegistry();\n","/**\n * TypeScript/JavaScript parser using Tree-sitter\n */\n\nimport Parser from \"tree-sitter\";\nimport TypeScript from \"tree-sitter-typescript\";\nimport JavaScript from \"tree-sitter-javascript\";\nimport { BaseParser } from \"./base.js\";\nimport type { FileAnalysis, GraphNode, GraphEdge, ImportInfo, ExportInfo } from \"../types.js\";\n\nexport class TypeScriptParser extends BaseParser {\n language = \"typescript\";\n extensions = [\".ts\", \".tsx\"];\n\n private parser: Parser;\n\n constructor() {\n super();\n this.parser = new Parser();\n this.parser.setLanguage(TypeScript.typescript);\n }\n\n parse(filePath: string, content: string): FileAnalysis {\n const analysis = this.createEmptyAnalysis(filePath);\n\n // Use TSX parser for .tsx files\n if (filePath.endsWith(\".tsx\")) {\n this.parser.setLanguage(TypeScript.tsx);\n } else {\n this.parser.setLanguage(TypeScript.typescript);\n }\n\n const tree = this.parser.parse(content);\n const lines = content.split(\"\\n\");\n\n // Create file node\n const fileNode = this.createNode(\n \"file\",\n filePath.split(\"/\").pop() || filePath,\n filePath,\n 1,\n lines.length\n );\n analysis.nodes.push(fileNode);\n\n // Walk the tree\n this.walkTree(tree.rootNode, filePath, analysis, fileNode.id);\n\n return analysis;\n }\n\n private walkTree(\n node: Parser.SyntaxNode,\n filePath: string,\n analysis: FileAnalysis,\n parentId: string\n ): void {\n switch (node.type) {\n case \"import_statement\":\n this.handleImport(node, analysis);\n break;\n\n case \"export_statement\":\n this.handleExport(node, filePath, analysis, parentId);\n break;\n\n case \"function_declaration\":\n case \"arrow_function\":\n case \"function_expression\":\n this.handleFunction(node, filePath, analysis, parentId);\n break;\n\n case \"class_declaration\":\n this.handleClass(node, filePath, analysis, parentId);\n break;\n\n case \"method_definition\":\n this.handleMethod(node, filePath, analysis, parentId);\n break;\n\n case \"call_expression\":\n this.handleCall(node, filePath, analysis, parentId);\n break;\n\n case \"variable_declaration\":\n this.handleVariable(node, filePath, analysis, parentId);\n break;\n }\n\n // Recurse into children\n for (const child of node.children) {\n this.walkTree(child, filePath, analysis, parentId);\n }\n }\n\n private handleImport(node: Parser.SyntaxNode, analysis: FileAnalysis): void {\n const sourceNode = node.childForFieldName(\"source\");\n if (!sourceNode) return;\n\n const source = sourceNode.text.replace(/['\"]/g, \"\");\n const specifiers: string[] = [];\n let isDefault = false;\n let isNamespace = false;\n\n // Find import clause\n for (const child of node.children) {\n if (child.type === \"import_clause\") {\n for (const clauseChild of child.children) {\n if (clauseChild.type === \"identifier\") {\n specifiers.push(clauseChild.text);\n isDefault = true;\n } else if (clauseChild.type === \"namespace_import\") {\n isNamespace = true;\n const nameNode = clauseChild.childForFieldName(\"name\");\n if (nameNode) specifiers.push(nameNode.text);\n } else if (clauseChild.type === \"named_imports\") {\n for (const importSpec of clauseChild.children) {\n if (importSpec.type === \"import_specifier\") {\n const name = importSpec.childForFieldName(\"name\");\n if (name) specifiers.push(name.text);\n }\n }\n }\n }\n }\n }\n\n analysis.imports.push({\n source,\n specifiers,\n isDefault,\n isNamespace,\n line: node.startPosition.row + 1,\n });\n }\n\n private handleExport(\n node: Parser.SyntaxNode,\n filePath: string,\n analysis: FileAnalysis,\n parentId: string\n ): void {\n const isDefault = node.children.some((c) => c.type === \"default\");\n\n // Find what's being exported\n for (const child of node.children) {\n if (child.type === \"function_declaration\") {\n const nameNode = child.childForFieldName(\"name\");\n if (nameNode) {\n analysis.exports.push({\n name: nameNode.text,\n isDefault,\n line: node.startPosition.row + 1,\n });\n }\n this.handleFunction(child, filePath, analysis, parentId);\n } else if (child.type === \"class_declaration\") {\n const nameNode = child.childForFieldName(\"name\");\n if (nameNode) {\n analysis.exports.push({\n name: nameNode.text,\n isDefault,\n line: node.startPosition.row + 1,\n });\n }\n this.handleClass(child, filePath, analysis, parentId);\n } else if (child.type === \"identifier\") {\n analysis.exports.push({\n name: child.text,\n isDefault,\n line: node.startPosition.row + 1,\n });\n }\n }\n }\n\n private handleFunction(\n node: Parser.SyntaxNode,\n filePath: string,\n analysis: FileAnalysis,\n parentId: string\n ): void {\n let name = \"anonymous\";\n const nameNode = node.childForFieldName(\"name\");\n if (nameNode) {\n name = nameNode.text;\n }\n\n const funcNode = this.createNode(\n \"function\",\n name,\n filePath,\n node.startPosition.row + 1,\n node.endPosition.row + 1,\n {\n async: node.children.some((c) => c.type === \"async\"),\n generator: node.children.some((c) => c.text === \"*\"),\n }\n );\n\n analysis.nodes.push(funcNode);\n\n // Add contains edge from parent\n analysis.edges.push(\n this.createEdge(\"contains\", parentId, funcNode.id)\n );\n }\n\n private handleClass(\n node: Parser.SyntaxNode,\n filePath: string,\n analysis: FileAnalysis,\n parentId: string\n ): void {\n const nameNode = node.childForFieldName(\"name\");\n if (!nameNode) return;\n\n const classNode = this.createNode(\n \"class\",\n nameNode.text,\n filePath,\n node.startPosition.row + 1,\n node.endPosition.row + 1\n );\n\n analysis.nodes.push(classNode);\n\n // Add contains edge\n analysis.edges.push(\n this.createEdge(\"contains\", parentId, classNode.id)\n );\n\n // Check for extends\n for (const child of node.children) {\n if (child.type === \"class_heritage\") {\n const extendsClause = child.children.find((c) => c.type === \"extends_clause\");\n if (extendsClause) {\n const baseClass = extendsClause.children.find((c) => c.type === \"identifier\");\n if (baseClass) {\n // Create a reference edge (will be resolved later)\n analysis.edges.push(\n this.createEdge(\"extends\", classNode.id, `ref:${baseClass.text}`, {\n unresolvedName: baseClass.text,\n })\n );\n }\n }\n }\n }\n\n // Process class body for methods\n const body = node.childForFieldName(\"body\");\n if (body) {\n for (const member of body.children) {\n if (member.type === \"method_definition\") {\n this.handleMethod(member, filePath, analysis, classNode.id);\n }\n }\n }\n }\n\n private handleMethod(\n node: Parser.SyntaxNode,\n filePath: string,\n analysis: FileAnalysis,\n parentId: string\n ): void {\n const nameNode = node.childForFieldName(\"name\");\n if (!nameNode) return;\n\n const methodNode = this.createNode(\n \"method\",\n nameNode.text,\n filePath,\n node.startPosition.row + 1,\n node.endPosition.row + 1,\n {\n static: node.children.some((c) => c.type === \"static\"),\n async: node.children.some((c) => c.type === \"async\"),\n }\n );\n\n analysis.nodes.push(methodNode);\n\n // Add contains edge\n analysis.edges.push(\n this.createEdge(\"contains\", parentId, methodNode.id)\n );\n }\n\n private handleCall(\n node: Parser.SyntaxNode,\n filePath: string,\n analysis: FileAnalysis,\n parentId: string\n ): void {\n const funcNode = node.childForFieldName(\"function\");\n if (!funcNode) return;\n\n let calledName = \"\";\n if (funcNode.type === \"identifier\") {\n calledName = funcNode.text;\n } else if (funcNode.type === \"member_expression\") {\n // Get the full member expression (e.g., \"console.log\")\n calledName = funcNode.text;\n }\n\n if (calledName) {\n analysis.edges.push(\n this.createEdge(\"calls\", parentId, `ref:${calledName}`, {\n unresolvedName: calledName,\n line: node.startPosition.row + 1,\n })\n );\n }\n }\n\n private handleVariable(\n node: Parser.SyntaxNode,\n filePath: string,\n analysis: FileAnalysis,\n parentId: string\n ): void {\n for (const child of node.children) {\n if (child.type === \"variable_declarator\") {\n const nameNode = child.childForFieldName(\"name\");\n const valueNode = child.childForFieldName(\"value\");\n\n if (nameNode && nameNode.type === \"identifier\") {\n // Check if it's a function expression or arrow function\n if (\n valueNode &&\n (valueNode.type === \"arrow_function\" ||\n valueNode.type === \"function_expression\")\n ) {\n const funcNode = this.createNode(\n \"function\",\n nameNode.text,\n filePath,\n node.startPosition.row + 1,\n node.endPosition.row + 1,\n {\n kind: node.children[0]?.text || \"const\",\n }\n );\n analysis.nodes.push(funcNode);\n analysis.edges.push(\n this.createEdge(\"contains\", parentId, funcNode.id)\n );\n }\n }\n }\n }\n }\n}\n\nexport class JavaScriptParser extends TypeScriptParser {\n language = \"javascript\";\n extensions = [\".js\", \".jsx\", \".mjs\", \".cjs\"];\n\n constructor() {\n super();\n // Override to use JavaScript grammar\n (this as any).parser = new Parser();\n (this as any).parser.setLanguage(JavaScript);\n }\n\n parse(filePath: string, content: string): FileAnalysis {\n // Use base implementation but mark as javascript\n const analysis = super.parse(filePath, content);\n analysis.language = \"javascript\";\n for (const node of analysis.nodes) {\n node.language = \"javascript\";\n }\n return analysis;\n }\n}\n","/**\n * Python parser using Tree-sitter\n */\n\nimport Parser from \"tree-sitter\";\nimport Python from \"tree-sitter-python\";\nimport { BaseParser } from \"./base.js\";\nimport type { FileAnalysis, GraphNode, GraphEdge, ImportInfo, ExportInfo } from \"../types.js\";\n\nexport class PythonParser extends BaseParser {\n language = \"python\";\n extensions = [\".py\"];\n\n private parser: Parser;\n\n constructor() {\n super();\n this.parser = new Parser();\n this.parser.setLanguage(Python);\n }\n\n parse(filePath: string, content: string): FileAnalysis {\n const analysis = this.createEmptyAnalysis(filePath);\n const tree = this.parser.parse(content);\n const lines = content.split(\"\\n\");\n\n // Create file node\n const fileNode = this.createNode(\n \"file\",\n filePath.split(\"/\").pop() || filePath,\n filePath,\n 1,\n lines.length\n );\n analysis.nodes.push(fileNode);\n\n // Walk the tree\n this.walkTree(tree.rootNode, filePath, analysis, fileNode.id);\n\n return analysis;\n }\n\n private walkTree(\n node: Parser.SyntaxNode,\n filePath: string,\n analysis: FileAnalysis,\n parentId: string\n ): void {\n switch (node.type) {\n case \"import_statement\":\n this.handleImport(node, analysis);\n break;\n\n case \"import_from_statement\":\n this.handleFromImport(node, analysis);\n break;\n\n case \"function_definition\":\n this.handleFunction(node, filePath, analysis, parentId);\n return; // Don't recurse into function body for top-level analysis\n\n case \"class_definition\":\n this.handleClass(node, filePath, analysis, parentId);\n return; // Don't recurse, class handler will process methods\n\n case \"call\":\n this.handleCall(node, filePath, analysis, parentId);\n break;\n }\n\n // Recurse into children\n for (const child of node.children) {\n this.walkTree(child, filePath, analysis, parentId);\n }\n }\n\n private handleImport(node: Parser.SyntaxNode, analysis: FileAnalysis): void {\n // import foo, bar, baz\n for (const child of node.children) {\n if (child.type === \"dotted_name\") {\n analysis.imports.push({\n source: child.text,\n specifiers: [child.text.split(\".\").pop() || child.text],\n isDefault: false,\n isNamespace: true,\n line: node.startPosition.row + 1,\n });\n } else if (child.type === \"aliased_import\") {\n const nameNode = child.childForFieldName(\"name\");\n const aliasNode = child.childForFieldName(\"alias\");\n if (nameNode) {\n analysis.imports.push({\n source: nameNode.text,\n specifiers: [aliasNode?.text || nameNode.text],\n isDefault: false,\n isNamespace: true,\n line: node.startPosition.row + 1,\n });\n }\n }\n }\n }\n\n private handleFromImport(node: Parser.SyntaxNode, analysis: FileAnalysis): void {\n // from foo import bar, baz\n const moduleNode = node.childForFieldName(\"module_name\");\n if (!moduleNode) return;\n\n const source = moduleNode.text;\n const specifiers: string[] = [];\n\n for (const child of node.children) {\n if (child.type === \"import_prefix\") {\n // Handle relative imports (from . import x, from .. import y)\n continue;\n }\n\n if (child.type === \"dotted_name\" && child !== moduleNode) {\n specifiers.push(child.text);\n } else if (child.type === \"aliased_import\") {\n const nameNode = child.childForFieldName(\"name\");\n if (nameNode) {\n specifiers.push(nameNode.text);\n }\n } else if (child.type === \"wildcard_import\") {\n specifiers.push(\"*\");\n }\n }\n\n if (specifiers.length === 0) {\n // Check for named imports in different structure\n for (const child of node.children) {\n if (child.type === \"import_list\" || child.type === \"import_from_specifier\") {\n for (const spec of child.children) {\n if (spec.type === \"dotted_name\" || spec.type === \"identifier\") {\n specifiers.push(spec.text);\n }\n }\n }\n }\n }\n\n analysis.imports.push({\n source,\n specifiers,\n isDefault: false,\n isNamespace: specifiers.includes(\"*\"),\n line: node.startPosition.row + 1,\n });\n }\n\n private handleFunction(\n node: Parser.SyntaxNode,\n filePath: string,\n analysis: FileAnalysis,\n parentId: string\n ): void {\n const nameNode = node.childForFieldName(\"name\");\n if (!nameNode) return;\n\n const name = nameNode.text;\n\n // Check for decorators\n const decorators: string[] = [];\n let currentNode = node.previousSibling;\n while (currentNode?.type === \"decorator\") {\n const decoratorName = currentNode.children.find(\n (c) => c.type === \"identifier\" || c.type === \"attribute\"\n );\n if (decoratorName) {\n decorators.push(decoratorName.text);\n }\n currentNode = currentNode.previousSibling;\n }\n\n // Check if async\n const isAsync = node.children.some((c) => c.type === \"async\");\n\n const funcNode = this.createNode(\n \"function\",\n name,\n filePath,\n node.startPosition.row + 1,\n node.endPosition.row + 1,\n {\n async: isAsync,\n decorators,\n isPrivate: name.startsWith(\"_\"),\n isDunder: name.startsWith(\"__\") && name.endsWith(\"__\"),\n }\n );\n\n analysis.nodes.push(funcNode);\n analysis.edges.push(this.createEdge(\"contains\", parentId, funcNode.id));\n\n // Parse function body for calls\n const body = node.childForFieldName(\"body\");\n if (body) {\n this.parseBodyForCalls(body, filePath, analysis, funcNode.id);\n }\n\n // If not private, consider it exported\n if (!name.startsWith(\"_\")) {\n analysis.exports.push({\n name,\n isDefault: false,\n line: node.startPosition.row + 1,\n });\n }\n }\n\n private handleClass(\n node: Parser.SyntaxNode,\n filePath: string,\n analysis: FileAnalysis,\n parentId: string\n ): void {\n const nameNode = node.childForFieldName(\"name\");\n if (!nameNode) return;\n\n const name = nameNode.text;\n\n // Check for base classes\n const bases: string[] = [];\n const argumentList = node.children.find((c) => c.type === \"argument_list\");\n if (argumentList) {\n for (const arg of argumentList.children) {\n if (arg.type === \"identifier\" || arg.type === \"attribute\") {\n bases.push(arg.text);\n }\n }\n }\n\n const classNode = this.createNode(\n \"class\",\n name,\n filePath,\n node.startPosition.row + 1,\n node.endPosition.row + 1,\n {\n bases,\n isPrivate: name.startsWith(\"_\"),\n }\n );\n\n analysis.nodes.push(classNode);\n analysis.edges.push(this.createEdge(\"contains\", parentId, classNode.id));\n\n // Add extends edges\n for (const base of bases) {\n analysis.edges.push(\n this.createEdge(\"extends\", classNode.id, `ref:${base}`, {\n unresolvedName: base,\n })\n );\n }\n\n // Parse class body for methods\n const body = node.childForFieldName(\"body\");\n if (body) {\n for (const child of body.children) {\n if (child.type === \"function_definition\") {\n this.handleMethod(child, filePath, analysis, classNode.id);\n }\n }\n }\n\n // Consider non-private classes as exports\n if (!name.startsWith(\"_\")) {\n analysis.exports.push({\n name,\n isDefault: false,\n line: node.startPosition.row + 1,\n });\n }\n }\n\n private handleMethod(\n node: Parser.SyntaxNode,\n filePath: string,\n analysis: FileAnalysis,\n classId: string\n ): void {\n const nameNode = node.childForFieldName(\"name\");\n if (!nameNode) return;\n\n const name = nameNode.text;\n\n // Check for decorators\n const decorators: string[] = [];\n let currentNode = node.previousSibling;\n while (currentNode?.type === \"decorator\") {\n const decoratorName = currentNode.children.find(\n (c) => c.type === \"identifier\" || c.type === \"attribute\"\n );\n if (decoratorName) {\n decorators.push(decoratorName.text);\n }\n currentNode = currentNode.previousSibling;\n }\n\n const isStatic = decorators.includes(\"staticmethod\");\n const isClassMethod = decorators.includes(\"classmethod\");\n const isProperty = decorators.includes(\"property\");\n const isAsync = node.children.some((c) => c.type === \"async\");\n\n const methodNode = this.createNode(\n \"method\",\n name,\n filePath,\n node.startPosition.row + 1,\n node.endPosition.row + 1,\n {\n async: isAsync,\n decorators,\n static: isStatic,\n classmethod: isClassMethod,\n property: isProperty,\n isPrivate: name.startsWith(\"_\"),\n isDunder: name.startsWith(\"__\") && name.endsWith(\"__\"),\n }\n );\n\n analysis.nodes.push(methodNode);\n analysis.edges.push(this.createEdge(\"contains\", classId, methodNode.id));\n\n // Parse method body for calls\n const body = node.childForFieldName(\"body\");\n if (body) {\n this.parseBodyForCalls(body, filePath, analysis, methodNode.id);\n }\n }\n\n private handleCall(\n node: Parser.SyntaxNode,\n filePath: string,\n analysis: FileAnalysis,\n parentId: string\n ): void {\n const funcNode = node.childForFieldName(\"function\");\n if (!funcNode) return;\n\n let calledName = \"\";\n if (funcNode.type === \"identifier\") {\n calledName = funcNode.text;\n } else if (funcNode.type === \"attribute\") {\n // Get the full attribute access (e.g., \"self.method\", \"module.func\")\n calledName = funcNode.text;\n }\n\n if (calledName && !calledName.startsWith(\"self.\")) {\n // Skip self.x calls as they're internal\n analysis.edges.push(\n this.createEdge(\"calls\", parentId, `ref:${calledName}`, {\n unresolvedName: calledName,\n line: node.startPosition.row + 1,\n })\n );\n }\n }\n\n private parseBodyForCalls(\n body: Parser.SyntaxNode,\n filePath: string,\n analysis: FileAnalysis,\n parentId: string\n ): void {\n const walkForCalls = (node: Parser.SyntaxNode): void => {\n if (node.type === \"call\") {\n this.handleCall(node, filePath, analysis, parentId);\n }\n for (const child of node.children) {\n walkForCalls(child);\n }\n };\n walkForCalls(body);\n }\n}\n","/**\n * Parser registry and exports\n */\n\nexport { BaseParser, ParserRegistry, parserRegistry } from \"./base.js\";\nexport { TypeScriptParser, JavaScriptParser } from \"./typescript.js\";\nexport { PythonParser } from \"./python.js\";\n\nimport { parserRegistry } from \"./base.js\";\nimport { TypeScriptParser, JavaScriptParser } from \"./typescript.js\";\nimport { PythonParser } from \"./python.js\";\n\n// Register all parsers\nexport function registerAllParsers(): void {\n parserRegistry.register(new TypeScriptParser());\n parserRegistry.register(new JavaScriptParser());\n parserRegistry.register(new PythonParser());\n}\n\n// Auto-register on import\nregisterAllParsers();\n","/**\n * Skill Generator - Creates Claude Code skills based on codebase analysis\n */\n\nimport { mkdirSync, writeFileSync, existsSync } from \"fs\";\nimport { join, dirname, basename } from \"path\";\nimport { GraphStorage } from \"../graph/storage.js\";\nimport type { GeneratedSkill, SkillConfig } from \"../types.js\";\n\nexport class SkillGenerator {\n private storage: GraphStorage;\n private config: SkillConfig;\n\n constructor(storage: GraphStorage, config: SkillConfig) {\n this.storage = storage;\n this.config = config;\n }\n\n /**\n * Generate all skills and write to .claude/skills/\n */\n generateAll(): GeneratedSkill[] {\n const skills: GeneratedSkill[] = [];\n\n // 1. Architecture overview skill\n if (this.config.includeArchitecture) {\n skills.push(this.generateArchitectureSkill());\n }\n\n // 2. Codebase patterns skill\n if (this.config.includePatterns) {\n skills.push(this.generatePatternsSkill());\n }\n\n // 3. Dependency explorer skill\n if (this.config.includeDependencies) {\n skills.push(this.generateDependencySkill());\n }\n\n // 4. Impact analysis skill (always generate)\n skills.push(this.generateImpactAnalysisSkill());\n\n // 5. Code navigation skill (always generate)\n skills.push(this.generateNavigationSkill());\n\n // Write all skills to disk\n this.writeSkills(skills);\n\n return skills;\n }\n\n private generateArchitectureSkill(): GeneratedSkill {\n const stats = this.storage.getStats();\n const rootPath = this.storage.getMeta(\"rootPath\") || \"\";\n\n // Get file structure by analyzing paths\n const allNodes = this.storage.getNodesByType(\"file\");\n const directories = new Map<string, number>();\n\n for (const node of allNodes) {\n const relativePath = node.filePath.replace(rootPath, \"\").replace(/^\\//, \"\");\n const parts = relativePath.split(\"/\");\n if (parts.length > 1) {\n const topDir = parts[0];\n directories.set(topDir, (directories.get(topDir) || 0) + 1);\n }\n }\n\n // Sort directories by file count\n const sortedDirs = [...directories.entries()]\n .sort((a, b) => b[1] - a[1])\n .slice(0, 10);\n\n const dirList = sortedDirs\n .map(([dir, count]) => `- \\`${dir}/\\` (${count} files)`)\n .join(\"\\n\");\n\n const langList = Object.entries(stats.languages)\n .map(([lang, count]) => `- ${lang}: ${count} files`)\n .join(\"\\n\");\n\n const content = `---\nname: architecture\ndescription: Overview of ${this.config.projectName} architecture and structure\nuser-invocable: true\n---\n\n# ${this.config.projectName} Architecture\n\n## Project Statistics\n- **Total files**: ${stats.totalFiles}\n- **Functions/Methods**: ${stats.nodesByType.function || 0} functions, ${stats.nodesByType.method || 0} methods\n- **Classes**: ${stats.nodesByType.class || 0}\n- **Import relationships**: ${stats.edgesByType.imports || 0}\n- **Call relationships**: ${stats.edgesByType.calls || 0}\n\n## Languages\n${langList}\n\n## Directory Structure\n${dirList}\n\n## Key Patterns\nWhen working with this codebase:\n1. Check the main directories above for feature organization\n2. Use the \\`/impact\\` skill to understand changes\n3. Use the \\`/navigate\\` skill to find specific code\n\n## Getting Started\nTo understand a specific area, ask questions like:\n- \"What does the ${sortedDirs[0]?.[0] || \"src\"} directory contain?\"\n- \"How is authentication handled?\"\n- \"What are the main entry points?\"\n`;\n\n return {\n name: \"architecture\",\n description: `Overview of ${this.config.projectName} architecture`,\n content,\n filePath: join(this.config.outputDir, \"architecture\", \"SKILL.md\"),\n };\n }\n\n private generatePatternsSkill(): GeneratedSkill {\n const stats = this.storage.getStats();\n\n // Analyze common patterns from the graph\n const classes = this.storage.getNodesByType(\"class\");\n const functions = this.storage.getNodesByType(\"function\");\n\n // Find classes with many methods (likely important)\n const classDetails = classes.map((cls) => {\n const methods = this.storage.getEdgesFrom(cls.id).filter((e) => e.type === \"contains\");\n return { ...cls, methodCount: methods.length };\n }).sort((a, b) => b.methodCount - a.methodCount);\n\n const topClasses = classDetails.slice(0, 5);\n const classList = topClasses\n .map((c) => `- \\`${c.name}\\` (${c.methodCount} methods) - [${basename(c.filePath)}](${c.filePath}#L${c.startLine})`)\n .join(\"\\n\");\n\n // Find most-called functions\n const callEdges = this.storage.getEdgesByType(\"calls\");\n const callCounts = new Map<string, number>();\n for (const edge of callEdges) {\n const target = edge.targetId.replace(\"ref:\", \"\");\n callCounts.set(target, (callCounts.get(target) || 0) + 1);\n }\n\n const mostCalled = [...callCounts.entries()]\n .sort((a, b) => b[1] - a[1])\n .slice(0, 10);\n\n const calledList = mostCalled\n .map(([name, count]) => `- \\`${name}\\` (called ${count} times)`)\n .join(\"\\n\");\n\n const content = `---\nname: patterns\ndescription: Common patterns and conventions in ${this.config.projectName}\n---\n\n# Codebase Patterns\n\n## Key Classes\nThese are the most substantial classes in the codebase:\n${classList || \"No classes found\"}\n\n## Most Used Functions\nThese functions are called most frequently:\n${calledList || \"No call data available\"}\n\n## Conventions Detected\n\n### File Organization\n${stats.nodesByType.file ? `- ${stats.totalFiles} files organized across the project` : \"\"}\n${stats.languages.typescript ? \"- TypeScript is used for type safety\" : \"\"}\n${stats.languages.python ? \"- Python follows standard module patterns\" : \"\"}\n\n### Code Structure\n- Functions: ${stats.nodesByType.function || 0}\n- Classes: ${stats.nodesByType.class || 0}\n- Methods: ${stats.nodesByType.method || 0}\n\n## When Making Changes\n1. Follow existing naming conventions\n2. Check similar files for patterns\n3. Use \\`/impact\\` to verify affected areas\n`;\n\n return {\n name: \"patterns\",\n description: `Common patterns in ${this.config.projectName}`,\n content,\n filePath: join(this.config.outputDir, \"patterns\", \"SKILL.md\"),\n };\n }\n\n private generateDependencySkill(): GeneratedSkill {\n const content = `---\nname: dependencies\ndescription: Explore dependencies and imports in ${this.config.projectName}\ncontext: fork\nagent: Explore\n---\n\n# Dependency Explorer\n\nWhen analyzing dependencies for $ARGUMENTS:\n\n## Steps\n1. **Find the target file/module**\n - Search for files matching the query\n - Identify the main module or component\n\n2. **Analyze imports**\n - What does this file import?\n - Are there circular dependencies?\n\n3. **Analyze dependents**\n - What files import this module?\n - How deep is the dependency chain?\n\n4. **Provide summary**\n - List direct dependencies\n - List files that depend on this\n - Highlight any concerns (circular deps, too many dependents)\n\n## Query the CodeMap database\nIf the codemap MCP server is available, use these queries:\n- Get imports: Query the imports table for the file\n- Get dependents: Find files that import this module\n- Get call graph: Find functions that call into this module\n\n## Output Format\n\\`\\`\\`\nDependencies for [target]:\n\nIMPORTS (what this uses):\n- module1 (from ./path)\n- module2 (from package)\n\nIMPORTED BY (what uses this):\n- file1.ts (lines X-Y)\n- file2.ts (lines X-Y)\n\nDEPENDENCY DEPTH: N levels\n\\`\\`\\`\n`;\n\n return {\n name: \"dependencies\",\n description: `Explore dependencies in ${this.config.projectName}`,\n content,\n filePath: join(this.config.outputDir, \"dependencies\", \"SKILL.md\"),\n };\n }\n\n private generateImpactAnalysisSkill(): GeneratedSkill {\n const content = `---\nname: impact\ndescription: Analyze the impact of changes to a file or function\ndisable-model-invocation: true\n---\n\n# Impact Analysis\n\nAnalyze what would be affected by changes to $ARGUMENTS.\n\n## Analysis Steps\n\n1. **Identify the target**\n - Find the file, function, or class being modified\n - Note its current state and purpose\n\n2. **Find direct dependents**\n - What files import this module?\n - What functions call this function?\n - What classes extend this class?\n\n3. **Find indirect dependents**\n - Follow the chain: if A depends on B, and B is our target, A is affected\n - Go up to 3 levels deep\n\n4. **Categorize impact**\n - **Breaking changes**: Signature changes, removed exports\n - **Behavioral changes**: Logic changes that may affect callers\n - **Safe changes**: Internal refactors, added functionality\n\n5. **Generate checklist**\n\n## Output Format\n\n\\`\\`\\`markdown\n# Impact Analysis: [target]\n\n## Direct Impact\n- [ ] file1.ts - uses [specific function/import]\n- [ ] file2.ts - extends [class]\n\n## Indirect Impact\n- [ ] file3.ts - imports file1.ts which uses [target]\n\n## Recommended Actions\n1. Update tests in [test files]\n2. Check [specific callers] for compatibility\n3. Update documentation in [docs]\n\n## Risk Level: [LOW/MEDIUM/HIGH]\n[Explanation of risk assessment]\n\\`\\`\\`\n`;\n\n return {\n name: \"impact\",\n description: \"Analyze impact of code changes\",\n content,\n filePath: join(this.config.outputDir, \"impact\", \"SKILL.md\"),\n };\n }\n\n private generateNavigationSkill(): GeneratedSkill {\n const stats = this.storage.getStats();\n\n const content = `---\nname: navigate\ndescription: Navigate to specific code in ${this.config.projectName}\n---\n\n# Code Navigation\n\nFind and navigate to code matching $ARGUMENTS.\n\n## Available Queries\n\n### By Type\n- \"find class [name]\" - Locate a class definition\n- \"find function [name]\" - Locate a function\n- \"find file [pattern]\" - Find files matching pattern\n- \"find imports of [module]\" - Find all imports of a module\n\n### By Relationship\n- \"callers of [function]\" - Who calls this function?\n- \"callees of [function]\" - What does this function call?\n- \"subclasses of [class]\" - Classes that extend this\n- \"implementers of [interface]\" - Classes implementing interface\n\n### By Location\n- \"in [directory]\" - Filter to specific directory\n- \"in [file]\" - Show contents of file\n\n## Codebase Stats\n- ${stats.totalFiles} files to search\n- ${stats.nodesByType.function || 0} functions\n- ${stats.nodesByType.class || 0} classes\n- ${stats.nodesByType.method || 0} methods\n\n## Output Format\nFor each match, provide:\n- File path with line number link\n- Brief description of what it does\n- Related code (callers/callees if relevant)\n`;\n\n return {\n name: \"navigate\",\n description: `Navigate ${this.config.projectName} codebase`,\n content,\n filePath: join(this.config.outputDir, \"navigate\", \"SKILL.md\"),\n };\n }\n\n private writeSkills(skills: GeneratedSkill[]): void {\n for (const skill of skills) {\n const dir = dirname(skill.filePath);\n if (!existsSync(dir)) {\n mkdirSync(dir, { recursive: true });\n }\n writeFileSync(skill.filePath, skill.content, \"utf-8\");\n }\n }\n}\n","/**\n * Core types for CodeMap\n */\n\n// ============ Graph Node Types ============\n\nexport type NodeType =\n | \"file\"\n | \"function\"\n | \"class\"\n | \"method\"\n | \"variable\"\n | \"module\"\n | \"import\";\n\nexport interface GraphNode {\n id: string;\n type: NodeType;\n name: string;\n filePath: string;\n startLine: number;\n endLine: number;\n language: string;\n metadata?: Record<string, unknown>;\n}\n\n// ============ Graph Edge Types ============\n\nexport type EdgeType =\n | \"imports\"\n | \"calls\"\n | \"extends\"\n | \"implements\"\n | \"contains\"\n | \"uses\"\n | \"exports\";\n\nexport interface GraphEdge {\n id: string;\n type: EdgeType;\n sourceId: string;\n targetId: string;\n metadata?: Record<string, unknown>;\n}\n\n// ============ Analysis Results ============\n\nexport interface FileAnalysis {\n filePath: string;\n language: string;\n nodes: GraphNode[];\n edges: GraphEdge[];\n imports: ImportInfo[];\n exports: ExportInfo[];\n}\n\nexport interface ImportInfo {\n source: string;\n specifiers: string[];\n isDefault: boolean;\n isNamespace: boolean;\n line: number;\n}\n\nexport interface ExportInfo {\n name: string;\n isDefault: boolean;\n line: number;\n}\n\n// ============ Project Analysis ============\n\nexport interface ProjectAnalysis {\n rootPath: string;\n files: FileAnalysis[];\n totalNodes: number;\n totalEdges: number;\n languages: Record<string, number>;\n analyzedAt: string;\n}\n\n// ============ Query Results ============\n\nexport interface AffectedFile {\n filePath: string;\n reason: string;\n depth: number;\n connections: string[];\n}\n\nexport interface CallChain {\n caller: GraphNode;\n callee: GraphNode;\n filePath: string;\n line: number;\n}\n\n// ============ Skill Generation ============\n\nexport interface GeneratedSkill {\n name: string;\n description: string;\n content: string;\n filePath: string;\n}\n\nexport interface SkillConfig {\n projectName: string;\n outputDir: string;\n includeArchitecture: boolean;\n includePatterns: boolean;\n includeDependencies: boolean;\n}\n\n// ============ Configuration ============\n\nexport interface CodeMapConfig {\n rootPath: string;\n include: string[];\n exclude: string[];\n languages: string[];\n dbPath: string;\n skillsOutputDir: string;\n}\n\nexport const DEFAULT_CONFIG: Partial<CodeMapConfig> = {\n include: [\"**/*.ts\", \"**/*.tsx\", \"**/*.js\", \"**/*.jsx\", \"**/*.py\"],\n exclude: [\n \"**/node_modules/**\",\n \"**/dist/**\",\n \"**/build/**\",\n \"**/.git/**\",\n \"**/venv/**\",\n \"**/__pycache__/**\",\n \"**/.next/**\",\n ],\n languages: [\"typescript\", \"javascript\", \"python\"],\n};\n\n// ============ MCP Types ============\n\nexport interface MCPToolResult {\n content: Array<{\n type: \"text\";\n text: string;\n }>;\n}\n\nexport interface MCPResource {\n uri: string;\n name: string;\n description: string;\n mimeType: string;\n}\n"],"mappings":";;;;;;;AAIA,SAAS,eAAe;AACxB,SAAS,WAAAA,UAAS,QAAAC,OAAM,YAAAC,iBAAgB;AACxC,SAAS,cAAAC,aAAY,aAAAC,kBAA+B;AACpD,OAAO,WAAW;AAClB,OAAO,SAAS;;;ACJhB,SAAS,oBAA8B;AACvC,SAAS,YAAY;AACrB,SAAe,UAAU,eAAe;;;ACMjC,IAAe,aAAf,MAA4C;AAAA,EAIvC,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAIhB,eAAe,UAAkB,MAAc,MAAsB;AAC7E,WAAO,GAAG,QAAQ,IAAI,IAAI,IAAI,IAAI;AAAA,EACpC;AAAA,EAEU,iBAAyB;AACjC,WAAO,QAAQ,EAAE,KAAK,aAAa;AAAA,EACrC;AAAA,EAEU,WACR,MACA,MACA,UACA,WACA,SACA,UACW;AACX,WAAO;AAAA,MACL,IAAI,KAAK,eAAe,UAAU,MAAM,SAAS;AAAA,MACjD;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,UAAU,KAAK;AAAA,MACf;AAAA,IACF;AAAA,EACF;AAAA,EAEU,WACR,MACA,UACA,UACA,UACW;AACX,WA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,OAAO,8CAA8C,CAAC;AAC5E,gBAAQ,IAAI,MAAM,KAAK,2BAA2B,CAAC;AACnD,gBAAQ,IAAI,MAAM,KAAK,kEAAkE,QAAQ;AAAA,CAAI,CAAC;AAAA,MACxG;AAAA,IACF,OAAO;AACL,cAAQ,IAAI,MAAM,KAAK,4CAA4C,CAAC;AAAA,IACtE;AAGA,YAAQ,IAAI,MAAM,MAAM,KAAK,gDAA2C,CAAC;AACzE,YAAQ,IAAI,MAAM,MAAM,uBAAuB,CAAC;AAChD,YAAQ,IAAI,MAAM,KAAK,sDAAsD,CAAC;AAC9E,YAAQ,IAAI,MAAM,KAAK,uDAAuD,CAAC;AAC/E,YAAQ,IAAI,MAAM,KAAK,2DAA2D,CAAC;AACnF,YAAQ,IAAI,MAAM,MAAM,2CAA2C,CAAC;AACpE,YAAQ,IAAI,MAAM,KAAK,wCAAwC,CAAC;AAChE,YAAQ,IAAI,MAAM,KAAK,qDAAqD,CAAC;AAC7E,YAAQ,IAAI,MAAM,KAAK,8CAA8C,CAAC;AACtE,YAAQ,IAAI,MAAM,KAAK,6CAA6C,CAAC;AACrE,YAAQ,IAAI,MAAM,KAAK,iDAAiD,CAAC;AAAA,EAE3E,SAAS,OAAO;AACd,YAAQ,KAAK,MAAM,IAAI,uBAAuB,CAAC;AAC/C,YAAQ,MAAM,KAAK;AACnB,YAAQ,MAAM;AACd,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF,CAAC;AAGH,QAAQ,MAAM;","names":["resolve","join","basename","existsSync","mkdirSync","Parser","Parser","join","resolve","existsSync","mkdirSync","join","basename"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codemap-ai",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "description": "AI-powered codebase knowledge graph generator with Claude Code skills integration",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",