code-graph-llm 3.0.0 β†’ 3.1.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
@@ -1,97 +1,79 @@
1
- # CODE-GRAPH (v3.0.0)
1
+ # CODE-GRAPH (v3.1.0)
2
2
 
3
3
  A language-agnostic, ultra-compact codebase mapper and **agent memory system** designed specifically for LLM agents. It optimizes context and token usage while enabling agents to learn from their own mistakes across sessions.
4
4
 
5
- ## πŸš€ New in v3.0: Major Version Upgrade
6
- - **Project Initializer:** Automated bootstrapping with `code-graph init`.
7
- - **Intelligent Reflection:** Deduplication and categorization in `llm-agent-project-learnings.md`.
8
- - **Commit Advisories:** Soft-nudge git hooks to remind agents of missing reflections.
5
+ ## πŸš€ New in v3.1: Selective Skill Architecture
6
+ - **Segregated Skills:** Choose between `projectmap`, `reflections`, or both.
7
+ - **Enhanced Platform Support:** Standardized `install-skills` for 15+ platforms.
8
+ - **Granular Controls:** Selective installation/uninstallation supported.
9
9
  - **Production-Ready Core:** Refactored Service-based architecture with full async support.
10
10
 
11
- ## πŸ› οΈ The Code-Graph Skillset
11
+ ## πŸ› οΈ The Code-Graph Skills
12
12
 
13
- Code-Graph transforms your codebase into an agent-friendly environment using five core skills:
13
+ Code-Graph provides two primary skills that can be installed independently or together (default).
14
14
 
15
- ### 1. **Structural Mapping (`generate`)**
15
+ ### 1. **Structural Mapping (`projectmap`)**
16
16
  * **What it does:** Scans your project for symbols (classes, functions, interfaces) and builds a dense dependency graph (`imports`, `requires`, `inheritance`).
17
- * **How to use:** Run `code-graph generate`. This creates `llm-code-graph.md`, which agents use as their "Source of Truth" for navigation.
18
- * **Agent Benefit:** Prevents "hallucinating" file paths and reduces token usage by giving the agent a compact map instead of raw file content.
17
+ * **Skill Goal:** High-level architectural awareness and navigation.
18
+ * **Agent Benefit:** Prevents "hallucinating" file paths and reduces token usage by giving the agent a compact map (`llm-code-graph.md`) instead of raw file content.
19
19
 
20
- ### 2. **Memory Persistence (`reflect`)**
20
+ ### 2. **Memory Persistence (`reflections`)**
21
21
  * **What it does:** Logs non-obvious fixes, environment quirks, and architectural lessons into `llm-agent-project-learnings.md`.
22
- * **How to use:** `code-graph reflect <CATEGORY> "The lesson learned"`.
23
- * **Agent Benefit:** Enables "Cross-Session Memory." If an agent fixes a Windows-specific bug in one session, the next agent reads the reflection and avoids the same pitfall.
24
-
25
- ### 3. **Automated Integration (`install-skills`)**
26
- * **What it does:** Bridges the gap between the graph and your LLM platform (Claude, Cursor, Gemini, etc.).
27
- * **How to use:** `code-graph <platform> install`.
28
- * **Agent Benefit:** Installs **Tool Hooks** and **Always-On Rules** that force the agent to consult the graph before using search tools. It effectively "bakes" the graph into the agent's internal loop.
29
-
30
- ### 4. **Self-Healing Sync (`install-hook`)**
31
- * **What it does:** Installs a Git pre-commit hook to keep the map and memory in sync with code changes.
32
- * **How to use:** `code-graph install-hook`.
33
- * **Agent Benefit:** Ensures the agent is never working with an outdated map. It also nudges the agent to record a reflection if significant code changed but no lesson was logged.
34
-
35
- ### 5. **Real-Time Context (`watch`)**
36
- * **What it does:** Monitors your filesystem and rebuilds the graph instantly as you or the agent edits code.
37
- * **How to use:** `code-graph watch`.
38
- * **Agent Benefit:** Vital for long-running agent sessions where the project structure is rapidly evolving.
39
-
40
- ---
41
-
42
- ## 🧠 Workflow: The Reflection Cycle
43
-
44
- To get the most out of Code-Graph, force your agent to follow this **Strict Protocol** (defined in `llm-agent-rules.md`):
45
-
46
- 1. **PRE-TASK (Read):** The agent MUST read `llm-agent-project-learnings.md` to check for existing pitfalls and `llm-code-graph.md` to locate the relevant "God Nodes" (core logic).
47
- 2. **EXECUTION (Monitor):** During the task, the agent monitors for "Learned Moments"β€”failures, unexpected OS behaviors, or complex regex fixes.
48
- 3. **POST-TASK (Reflect):** If a lesson was learned, the agent MUST run `code-graph reflect`.
49
- 4. **COMMIT (Sync):** Upon commit, the Git hook automatically runs `code-graph generate` to update the map for the next agent.
22
+ * **Skill Goal:** Persistent project memory across sessions.
23
+ * **Agent Benefit:** Enables "Cross-Session Memory." If an agent fixes a bug in one session, the next agent reads the reflection and avoids the same pitfall.
50
24
 
51
25
  ---
52
26
 
53
27
  ## πŸš€ Automated Agent Integration
54
28
 
55
- After generating a graph, you can automatically configure your favorite LLM agent to use it by running the matching install command.
29
+ Configure your agent to use these skills by running the `install-skills` command. **Both skills are installed by default.**
56
30
 
57
31
  | Platform | Command |
58
32
  | :--- | :--- |
59
- | **Claude Code** | `code-graph claude install` |
60
- | **Cursor** | `code-graph cursor install` |
61
- | **Gemini CLI** | `code-graph gemini install` |
62
- | **Codex** | `code-graph codex install` |
63
- | **OpenCode** | `code-graph opencode install` |
64
- | **GitHub Copilot CLI** | `code-graph copilot install` |
65
- | **VS Code Copilot Chat** | `code-graph vscode install` |
66
- | **Aider** | `code-graph aider install` |
67
- | **OpenClaw** | `code-graph openclaw install` |
68
- | **Factory Droid** | `code-graph droid install` |
69
- | **Trae** | `code-graph trae install` |
70
- | **Hermes** | `code-graph hermes install` |
71
- | **Kiro IDE/CLI** | `code-graph kiro install` |
72
- | **Google Antigravity** | `code-graph antigravity install` |
73
-
74
- ### What this does:
75
- - **Always-on Rules:** Writes project-level rule files (e.g., `CLAUDE.md`, `.cursor/rules/`, `AGENTS.md`) telling the agent to read `llm-code-graph.md` before answering architecture questions.
76
- - **Pre-Tool Hooks:** For platforms that support it (Claude, Codex, Gemini, OpenCode), it installs hooks that fire before every file-search or bash call, injecting a reminder to check the graph first. This prevents the agent from grepping every file when a high-level map already exists.
77
- - **Global Skills:** Copies the Code-Graph skill to the platform's global skill directory for persistence across projects.
78
-
79
- **Uninstall** by replacing `install` with `uninstall` (e.g., `code-graph claude uninstall`).
33
+ | **Claude Code** | `code-graph install-skills claude` |
34
+ | **Cursor** | `code-graph install-skills cursor` |
35
+ | **Gemini CLI** | `code-graph install-skills gemini` |
36
+ | **Codex** | `code-graph install-skills codex` |
37
+ | **OpenCode** | `code-graph install-skills opencode` |
38
+ | **GitHub Copilot CLI** | `code-graph install-skills copilot` |
39
+ | **VS Code Copilot Chat** | `code-graph install-skills vscode` |
40
+ | **Aider / Trae / etc.** | `code-graph install-skills <platform>` |
41
+
42
+ ### Selective Installation
43
+ You can choose to install or uninstall specific skills:
44
+
45
+ ```bash
46
+ # Install only the project map
47
+ code-graph install-skills gemini projectmap
48
+
49
+ # Install only reflections
50
+ code-graph install-skills cursor reflections
51
+
52
+ # Uninstall only reflections
53
+ code-graph uninstall-skills claude reflections
54
+ ```
55
+
56
+ **Uninstall all skills** by using `uninstall-skills <platform>`.
57
+
58
+
59
+ ## 🧠 Workflow: The Reflection Cycle
80
60
 
81
61
  ### Skill Installation Details
82
62
 
83
63
  | Platform | Action Taken | Directory / Files |
84
64
  | :--- | :--- | :--- |
85
- | **Claude Code** | Adds instructions to `CLAUDE.md` and installs a `preToolUse` hook for `glob` and `grep`. | `.claude/settings.json` |
86
- | **Cursor** | Writes a global rule with `alwaysApply: true`. | `.cursor/rules/code-graph.mdc` |
87
- | **Gemini CLI** | Copies skill globally and adds a `beforeTool` hook for `read_file`. | `~/.gemini/skills/code-graph/SKILL.md`, `.gemini/settings.json`, `GEMINI.md` |
65
+ | **Claude Code** | Adds instructions to `CLAUDE.md` and installs `preToolUse` hooks for `glob` and `grep`. | `.claude/settings.json` |
66
+ | **Cursor** | Writes global rules with `alwaysApply: true`. | `.cursor/rules/projectmap.mdc`, `.cursor/rules/reflections.mdc` |
67
+ | **Gemini CLI** | Copies skills globally and adds `beforeTool` hooks for `read_file` and `run_shell_command`. | `~/.gemini/skills/projectmap/SKILL.md`, `~/.gemini/skills/reflections/SKILL.md`, `GEMINI.md` |
88
68
  | **Codex** | Updates `AGENTS.md` and installs a `preToolUse` hook for `bash`. | `.codex/hooks.json` |
89
69
  | **OpenCode** | Registers a plugin that fires before `bash` tool calls. | `.opencode/plugins/code-graph.js`, `opencode.json`, `AGENTS.md` |
90
- | **GitHub Copilot CLI** | Copies the Code-Graph skill to the global skill directory. | `~/.copilot/skills/code-graph/SKILL.md` |
70
+ | **GitHub Copilot CLI** | Copies skills globally for persistence. | `~/.copilot/skills/projectmap/SKILL.md`, `~/.copilot/skills/reflections/SKILL.md` |
91
71
  | **VS Code Copilot** | Writes session-persistent instructions. | `.github/copilot-instructions.md` |
92
- | **Aider / Trae / etc.** | Updates `AGENTS.md` and copies skill to global platform directory. | `~/.<platform>/skills/code-graph/SKILL.md`, `AGENTS.md` |
93
- | **Kiro IDE/CLI** | Writes global skill and steering file for automatic inclusion. | `.kiro/skills/code-graph/SKILL.md`, `.kiro/steering/code-graph.md` |
94
- | **Antigravity** | Writes always-on rules and registers a slash command workflow. | `.agent/rules/code-graph.md`, `.agent/workflows/code-graph.md` |
72
+ | **Roo Code** | Injects instructions into project rule files. | `.clinerules`, `.roomodes` |
73
+ | **IntelliJ / JetBrains** | Adds architectural context to a discoverable file. | `AGENTS.md` |
74
+ | **Aider / Trae / etc.** | Updates `AGENTS.md` and copies skills globally. | `~/.<platform>/skills/projectmap/SKILL.md`, `~/.<platform>/skills/reflections/SKILL.md`, `AGENTS.md` |
75
+ | **Kiro IDE/CLI** | Writes global skills and steering files. | `.kiro/skills/projectmap/SKILL.md`, `.kiro/skills/reflections/SKILL.md`, `.kiro/steering/code-graph.md` |
76
+ | **Antigravity** | Writes always-on rules and registers workflow commands. | `.agent/rules/projectmap.md`, `.agent/rules/reflections.md`, `.agent/workflows/code-graph.md` |
95
77
 
96
78
  ### How agents use it:
97
79
  1. **Direct Instructions:** Most platforms are configured to read project-level files (`CLAUDE.md`, `AGENTS.md`, `GEMINI.md`, etc.) automatically. These files tell the agent: "Before searching files, read `llm-code-graph.md`."
package/index.js CHANGED
@@ -323,131 +323,128 @@ class SkillManager {
323
323
  this.home = os.homedir();
324
324
  }
325
325
 
326
- async execute(platform, action) {
327
- if (!platform) return console.error('[Code-Graph] Platform required. Usage: code-graph <platform> [install|uninstall]');
326
+ async execute(platform, action, skill) {
327
+ if (!platform) return console.error('[Code-Graph] Platform required. Usage: code-graph install-skills <platform> [projectmap|reflections]');
328
328
  const p = platform.toLowerCase();
329
- const act = (action || 'install').toLowerCase();
329
+ const act = (action || 'install-skills').toLowerCase();
330
+ const s = (skill || 'all').toLowerCase();
330
331
 
331
- if (act === 'install') await this.install(p);
332
- else if (act === 'uninstall') await this.uninstall(p);
333
- else console.error(`[Code-Graph] Unknown action: ${act}`);
332
+ if (act === 'install-skills') await this.install(p, s);
333
+ else if (act === 'uninstall-skills') await this.uninstall(p, s);
334
+ else console.error(`[Code-Graph] Unknown action: ${act}. Use install-skills or uninstall-skills.`);
334
335
  }
335
336
 
336
- async install(p) {
337
- console.log(`[Code-Graph] Installing skill for ${p}...`);
337
+ async install(p, s) {
338
+ console.log(`[Code-Graph] Running install-skills (${s}) for ${p}...`);
338
339
  try {
339
- switch (p) {
340
- case 'claude': await this.installClaude(); break;
341
- case 'codex': await this.installCodex(); break;
342
- case 'opencode': await this.installOpenCode(); break;
343
- case 'cursor': await this.installCursor(); break;
344
- case 'gemini': await this.installGemini(); break;
345
- case 'aider':
346
- case 'openclaw':
347
- case 'droid':
348
- case 'trae':
349
- case 'trae-cn':
350
- case 'hermes':
351
- await this.installGenericAgent(p);
352
- break;
353
- case 'kiro': await this.installKiro(); break;
354
- case 'antigravity': await this.installAntigravity(); break;
355
- case 'copilot': await this.installCopilot(); break;
356
- case 'vscode': await this.installVSCode(); break;
357
- default: return console.error(`[Code-Graph] Unsupported platform: ${p}`);
358
- }
359
- console.log(`[Code-Graph] Successfully installed ${p} skill.`);
360
- } catch (err) {
361
- console.error(`[Code-Graph] Installation failed for ${p}: ${err.message}`);
362
- }
363
- }
364
-
365
- async uninstall(p) {
366
- console.log(`[Code-Graph] Uninstalling skill for ${p}...`);
367
- // Simplification: just remove the primary files
368
- try {
369
- switch (p) {
370
- case 'claude': await this.removeFile('CLAUDE.md'); break;
371
- case 'codex': await this.removeFile('AGENTS.md'); break;
372
- case 'opencode': await this.removeFile('AGENTS.md'); break;
373
- case 'cursor': await this.removeFile('.cursor/rules/code-graph.mdc'); break;
374
- case 'gemini': await this.removeFile('GEMINI.md'); break;
375
- case 'aider':
376
- case 'openclaw':
377
- case 'droid':
378
- case 'trae':
379
- case 'trae-cn':
380
- case 'hermes':
381
- await this.removeFile('AGENTS.md');
382
- break;
383
- case 'kiro': await this.removeFile('.kiro/steering/code-graph.md'); break;
384
- case 'antigravity': await this.removeFile('.agent/rules/code-graph.md'); break;
385
- case 'copilot': await fsp.rm(path.join(this.home, '.copilot', 'skills', 'code-graph'), { recursive: true, force: true }); break;
386
- case 'vscode': await this.removeFile('.github/copilot-instructions.md'); break;
387
- }
388
- console.log(`[Code-Graph] Successfully uninstalled ${p} skill.`);
340
+ if (s === 'all' || s === 'projectmap') await this.installProjectMap(p);
341
+ if (s === 'all' || s === 'reflections') await this.installReflections(p);
342
+ console.log(`[Code-Graph] Successfully completed install-skills for ${p}.`);
389
343
  } catch (err) {
390
- console.error(`[Code-Graph] Uninstallation failed: ${err.message}`);
344
+ console.error(`[Code-Graph] install-skills failed for ${p}: ${err.message}`);
391
345
  }
392
346
  }
393
347
 
394
- async installClaude() {
395
- const section = `\n## πŸ—ΊοΈ Code-Graph Integration\nBefore answering architecture questions, read \`${CONFIG.MAP_FILE}\` for god nodes and community structure. This ensures high-level context before searching raw files.\n`;
396
- await this.appendToFile('CLAUDE.md', section);
397
- await this.writeJson('.claude/settings.json', { hooks: { preToolUse: [{ tools: ['glob', 'grep'], message: `code-graph: Knowledge graph exists. Read ${CONFIG.MAP_FILE} before searching raw files.` }] } });
398
- }
399
-
400
- async installCodex() {
401
- const section = `\n## πŸ—ΊοΈ Code-Graph Navigation\nAlways check for \`${CONFIG.MAP_FILE}\` to understand project structure before using bash tools.\n`;
402
- await this.appendToFile('AGENTS.md', section);
403
- await this.writeJson('.codex/hooks.json', { hooks: { preToolUse: [{ tools: ['bash'], message: `code-graph: Knowledge graph exists. Read ${CONFIG.MAP_FILE} for architectural context.` }] } });
404
- }
405
-
406
- async installOpenCode() {
407
- await this.appendToFile('AGENTS.md', `\n## πŸ—ΊοΈ Code-Graph\nRead \`${CONFIG.MAP_FILE}\` for high-level mapping.\n`);
408
- const plugin = `export default { name: 'code-graph', beforeExecute: (tool) => { if (tool.name === 'bash') return "code-graph: Read ${CONFIG.MAP_FILE} for god nodes."; } };`;
409
- await this.writeFile('.opencode/plugins/code-graph.js', plugin);
410
- await this.writeJson('opencode.json', { plugins: ['./.opencode/plugins/code-graph.js'] });
411
- }
348
+ async installProjectMap(p) {
349
+ const section = `\n## πŸ—ΊοΈ Skill: ProjectMap\nBefore answering architecture questions, read \`${CONFIG.MAP_FILE}\` for god nodes and structural context. This ensures high-level awareness before searching raw files.\n`;
350
+ const skillContent = `# ProjectMap Skill\nUse \`${CONFIG.MAP_FILE}\` for project navigation and architectural awareness.\n`;
412
351
 
413
- async installCursor() {
414
- const content = `---\ndescription: Always use knowledge graph for navigation.\nalwaysApply: true\n---\n# Code-Graph\n- Read \`${CONFIG.MAP_FILE}\` before searching.\n- Prioritize god nodes for architecture.\n- Adhere to \`${CONFIG.RULES_FILE}\`.\n`;
415
- await this.writeFile('.cursor/rules/code-graph.mdc', content);
416
- }
417
-
418
- async installGemini() {
419
- const skillPath = path.join(this.home, '.gemini', 'skills', 'code-graph', 'SKILL.md');
420
- await fsp.mkdir(path.dirname(skillPath), { recursive: true });
421
- await fsp.writeFile(skillPath, `# Code-Graph Skill\nUse \`${CONFIG.MAP_FILE}\` for navigation.\n`);
422
- await this.appendToFile('GEMINI.md', `\n## πŸ—ΊοΈ Code-Graph\nRead \`${CONFIG.MAP_FILE}\` before file-read tools.\n`);
423
- await this.writeJson('.gemini/settings.json', { hooks: { beforeTool: [{ tools: ['read_file'], message: `code-graph: Knowledge graph exists. Read ${CONFIG.MAP_FILE}.` }] } });
352
+ switch (p) {
353
+ case 'claude':
354
+ await this.appendToFile('CLAUDE.md', section);
355
+ await this.writeJson('.claude/settings.json', { hooks: { preToolUse: [{ tools: ['glob', 'grep'], message: `Skill(ProjectMap): Knowledge graph exists. Read ${CONFIG.MAP_FILE} before searching raw files.` }] } });
356
+ break;
357
+ case 'cursor':
358
+ await this.writeFile('.cursor/rules/projectmap.mdc', `---\ndescription: Use knowledge graph for navigation.\nalwaysApply: true\n---\n# ProjectMap\nRead \`${CONFIG.MAP_FILE}\` to locate core logic and dependencies.\n`);
359
+ break;
360
+ case 'gemini':
361
+ await this.installGlobalSkill('gemini', 'projectmap', skillContent);
362
+ await this.appendToFile('GEMINI.md', section);
363
+ await this.writeJson('.gemini/settings.json', { hooks: { beforeTool: [{ tools: ['read_file'], message: `Skill(ProjectMap): Read ${CONFIG.MAP_FILE} for structural context.` }] } });
364
+ break;
365
+ case 'copilot':
366
+ await this.installGlobalSkill('copilot', 'projectmap', skillContent);
367
+ break;
368
+ case 'vscode':
369
+ await this.appendToFile('.github/copilot-instructions.md', section);
370
+ break;
371
+ case 'roocode':
372
+ await this.appendToFile('.clinerules', section);
373
+ await this.appendToFile('.roomodes', section);
374
+ break;
375
+ default:
376
+ await this.appendToFile('AGENTS.md', section);
377
+ await this.installGlobalSkill(p, 'projectmap', skillContent);
378
+ }
424
379
  }
425
380
 
426
- async installGenericAgent(p) {
427
- await this.appendToFile('AGENTS.md', `\n## πŸ—ΊοΈ Code-Graph\nRead \`${CONFIG.MAP_FILE}\` for structural context.\n`);
428
- const globalPath = path.join(this.home, `.${p}`, 'skills', 'code-graph', 'SKILL.md');
429
- await fsp.mkdir(path.dirname(globalPath), { recursive: true });
430
- await fsp.writeFile(globalPath, `# Code-Graph Skill for ${p}\n`);
431
- }
381
+ async installReflections(p) {
382
+ const section = `\n## 🧠 Skill: Reflections\nFollow the reflection cycle: Read \`${CONFIG.REFLECTIONS_FILE}\` for past lessons and run \`code-graph reflect\` after any bug fix or failure.\n`;
383
+ const skillContent = `# Reflections Skill\nUse \`${CONFIG.REFLECTIONS_FILE}\` to persist and retrieve project-specific lessons and environment quirks.\n`;
432
384
 
433
- async installKiro() {
434
- await this.writeFile('.kiro/skills/code-graph/SKILL.md', `# Code-Graph Skill\n`);
435
- await this.writeFile('.kiro/steering/code-graph.md', `inclusion: always\n# Code-Graph\nRead \`${CONFIG.MAP_FILE}\`.\n`);
385
+ switch (p) {
386
+ case 'claude':
387
+ await this.appendToFile('CLAUDE.md', section);
388
+ break;
389
+ case 'cursor':
390
+ await this.writeFile('.cursor/rules/reflections.mdc', `---\ndescription: Mandatory reflection cycle.\nalwaysApply: true\n---\n# Reflections\nFollow \`${CONFIG.RULES_FILE}\`. Update \`${CONFIG.REFLECTIONS_FILE}\` after every fix.\n`);
391
+ break;
392
+ case 'gemini':
393
+ await this.installGlobalSkill('gemini', 'reflections', skillContent);
394
+ await this.appendToFile('GEMINI.md', section);
395
+ await this.writeJson('.gemini/settings.json', { hooks: { beforeTool: [{ tools: ['run_shell_command'], message: `Skill(Reflections): Remember to run 'code-graph reflect' after identifying a fix or quirk.` }] } });
396
+ break;
397
+ case 'copilot':
398
+ await this.installGlobalSkill('copilot', 'reflections', skillContent);
399
+ break;
400
+ case 'vscode':
401
+ await this.appendToFile('.github/copilot-instructions.md', section);
402
+ break;
403
+ case 'roocode':
404
+ const rules = `\n# Reflections Protocol\nStrictly follow the reflection cycle in \`${CONFIG.RULES_FILE}\`. Persist lessons to \`${CONFIG.REFLECTIONS_FILE}\`.\n`;
405
+ await this.appendToFile('.clinerules', rules);
406
+ await this.appendToFile('.roomodes', rules);
407
+ break;
408
+ default:
409
+ await this.appendToFile('AGENTS.md', section);
410
+ await this.installGlobalSkill(p, 'reflections', skillContent);
411
+ }
436
412
  }
437
413
 
438
- async installAntigravity() {
439
- await this.writeFile('.agent/rules/code-graph.md', `# Code-Graph Rules\nAlways read \`${CONFIG.MAP_FILE}\`.\n`);
440
- await this.writeFile('.agent/workflows/code-graph.md', `# Code-Graph Workflow\nRegisters /code-graph\n`);
414
+ async installGlobalSkill(platform, skillName, content) {
415
+ const skillPath = path.join(this.home, `.${platform}`, 'skills', skillName, 'SKILL.md');
416
+ try {
417
+ await fsp.mkdir(path.dirname(skillPath), { recursive: true });
418
+ await fsp.writeFile(skillPath, content);
419
+ } catch (e) {
420
+ // Ignore errors for platforms that don't support global skills
421
+ }
441
422
  }
442
423
 
443
- async installCopilot() {
444
- const skillPath = path.join(this.home, '.copilot', 'skills', 'code-graph', 'SKILL.md');
445
- await fsp.mkdir(path.dirname(skillPath), { recursive: true });
446
- await fsp.writeFile(skillPath, `# Code-Graph Skill\nUse \`${CONFIG.MAP_FILE}\`.\n`);
447
- }
424
+ async uninstall(p, s) {
425
+ console.log(`[Code-Graph] Running uninstall-skills (${s}) for ${p}...`);
426
+ try {
427
+ if (s === 'all' || s === 'projectmap') {
428
+ await this.removeFile('.cursor/rules/projectmap.mdc');
429
+ await fsp.rm(path.join(this.home, `.${p}`, 'skills', 'projectmap'), { recursive: true, force: true });
430
+ }
431
+ if (s === 'all' || s === 'reflections') {
432
+ await this.removeFile('.cursor/rules/reflections.mdc');
433
+ await fsp.rm(path.join(this.home, `.${p}`, 'skills', 'reflections'), { recursive: true, force: true });
434
+ }
448
435
 
449
- async installVSCode() {
450
- await this.appendToFile('.github/copilot-instructions.md', `\n## πŸ—ΊοΈ Code-Graph\nAlways read \`${CONFIG.MAP_FILE}\` for architectural context.\n`);
436
+ if (s === 'all') {
437
+ const filesToRemove = [
438
+ 'CLAUDE.md', 'GEMINI.md', 'AGENTS.md', '.clinerules', '.roomodes',
439
+ '.github/copilot-instructions.md'
440
+ ];
441
+ for (const f of filesToRemove) await this.removeFile(f);
442
+ }
443
+
444
+ console.log(`[Code-Graph] Successfully completed uninstall-skills for ${p}.`);
445
+ } catch (err) {
446
+ console.error(`[Code-Graph] uninstall-skills failed for ${p}: ${err.message}`);
447
+ }
451
448
  }
452
449
 
453
450
  async appendToFile(filename, content) {
@@ -489,7 +486,7 @@ async function main() {
489
486
  const cwd = process.cwd();
490
487
 
491
488
  try {
492
- const platforms = ['claude', 'codex', 'opencode', 'cursor', 'gemini', 'aider', 'openclaw', 'droid', 'trae', 'trae-cn', 'hermes', 'kiro', 'antigravity', 'copilot', 'vscode'];
489
+ const platforms = ['claude', 'codex', 'opencode', 'cursor', 'gemini', 'aider', 'openclaw', 'droid', 'trae', 'trae-cn', 'hermes', 'kiro', 'antigravity', 'copilot', 'vscode', 'roocode', 'intellij'];
493
490
 
494
491
  switch (command || 'generate') {
495
492
  case 'generate':
@@ -506,16 +503,16 @@ async function main() {
506
503
  await installGitHook(cwd);
507
504
  break;
508
505
  case 'install-skills':
509
- await new SkillManager(cwd).execute(args[0], args[1]);
506
+ await new SkillManager(cwd).execute(args[0], args[1], args[2]);
510
507
  break;
511
508
  case 'watch':
512
509
  startWatcher(cwd);
513
510
  break;
514
511
  default:
515
512
  if (platforms.includes(command?.toLowerCase())) {
516
- await new SkillManager(cwd).execute(command, args[0]);
513
+ await new SkillManager(cwd).execute(command, args[0], args[1]);
517
514
  } else {
518
- console.log('Usage: code-graph [generate|init|reflect|install-hook|watch|install-skills <platform>]');
515
+ console.log('Usage: code-graph [generate|init|reflect|install-hook|watch|install-skills <platform> [install|uninstall] [projectmap|reflections]]');
519
516
  }
520
517
  }
521
518
  } catch (err) {
@@ -12,4 +12,5 @@
12
12
  - [STYLE] Always include dependency counts (↑N ↓M) in `llm-code-graph.md` to help prioritize architectural understanding.
13
13
 
14
14
  - [TOOLING: 2026-04-15] Added reflect command to simplify LLM memory updates.
15
- - [TOOLING: 2026-04-16] Upgraded to v3.0.0: Unified agent renaming (llm-agent-*) and added `install-skills` for automated platform integration (Claude, Cursor, Gemini, etc.).
15
+ - [TOOLING: 2026-04-16] Upgraded to v3.0.0: Unified agent renaming (llm-agent-*) and added `install-skills` for automated platform integration (Claude, Cursor, Gemini, etc.).
16
+ - [TOOLING: 2026-04-16] Upgraded to v3.1.0: Segregated skills into `projectmap` and `reflections`, enabling selective installation and standardizing on `install-skills` command.
package/llm-code-graph.md CHANGED
@@ -4,13 +4,12 @@
4
4
  > Legend: [CORE] Entry Point, (↑N) Outgoing Deps, (↓M) Incoming Dependents
5
5
  > Notation: syms: [Name [Signature/Context]], desc: File Summary, [TAG: Context]
6
6
 
7
- - [CORE] index.js (↑8 ↓1) [TODO: |FIXME|BUG|DEPRECATED):?\s*(.*)/i,, bug: s or complex regex pitfalls., bug: s or version deprecations., bug: ,"] | desc: !usrbinenv node
8
- - syms: [CONFIG [=], CodeParser [--- Core Services --- Handles extraction of symbols, edges, and metadata from source code.], ProjectInitializer [Scaffolds the initial agent-agnostic rule and reflection files.], ProjectMapper [Manages the project mapping and file generation.], ReflectionManager [Manages project reflections and lessons learned.], SUPPORTED_EXTENSIONS [: [], SkillManager [Manages platform-specific skills and agent integrations.], add [(context ? `${display} [${context}]` : display)], appendToFile [('CLAUDE.md', section)], execute [(platform, action)], extract [(content)], init [(cwd)], install [|uninstall]')], installAntigravity [()], installClaude [()], installCodex [()], installCopilot [()], installCursor [()], installGemini [()], installGenericAgent [(p)], installGitHook [(cwd)], installKiro [()], installOpenCode [()], installVSCode [()], main [|app|server|cli)\./i.test(path.basename(relPath))], processFile [(fullPath, relPath)], removeFile [('CLAUDE.md')], uninstall []')], walk [(dir, ig)], writeFile [(path.join(this.cwd, CONFIG.MAP_FILE)], writeJson [('.claude/settings.json', { hooks: { preToolUse: [{ tools: ['glob', 'grep'], message: `code-graph: Knowledge graph exists. Read ${CONFIG.MAP_FILE} before searching raw files.` }] } })]]
7
+ - [CORE] index.js (↑7 ↓1) [TODO: |FIXME|BUG|DEPRECATED):?\s*(.*)/i,, bug: s or complex regex pitfalls., bug: s or version deprecations., bug: fix or failure.\n`;, bug: ,"] | desc: !usrbinenv node
8
+ - syms: [CONFIG [=], CodeParser [--- Core Services --- Handles extraction of symbols, edges, and metadata from source code.], ProjectInitializer [Scaffolds the initial agent-agnostic rule and reflection files.], ProjectMapper [Manages the project mapping and file generation.], ReflectionManager [Manages project reflections and lessons learned.], SUPPORTED_EXTENSIONS [: [], SkillManager [Manages platform-specific skills and agent integrations.], add [(context ? `${display} [${context}]` : display)], appendToFile [('CLAUDE.md', section)], execute [(platform, action, skill)], extract [(content)], init [(cwd)], install [-skills <platform> [projectmap|reflections]')], installGitHook [(cwd)], installGlobalSkill [('gemini', 'projectmap', skillContent)], installProjectMap [(p)], installReflections [(p)], main [|app|server|cli)\./i.test(path.basename(relPath))], processFile [(fullPath, relPath)], removeFile [('.cursor/rules/projectmap.mdc')], uninstall [-skills') await this.uninstall(p, s)], walk [(dir, ig)], writeFile [(path.join(this.cwd, CONFIG.MAP_FILE)], writeJson [('.claude/settings.json', { hooks: { preToolUse: [{ tools: ['glob', 'grep'], message: `Skill(ProjectMap)]]
9
9
  - [CORE] test/index.test.js (↑10 ↓0) | desc:
10
10
  - syms: []
11
11
 
12
12
  ## GRAPH EDGES
13
- [index.js] -> [imports] -> [bash]
14
13
  [index.js] -> [imports] -> [chokidar]
15
14
  [index.js] -> [imports] -> [fs]
16
15
  [index.js] -> [imports] -> [ignore]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "code-graph-llm",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "description": "Compact, language-agnostic codebase mapper for LLM token efficiency.",
5
5
  "main": "index.js",
6
6
  "bin": {