code-graph-llm 3.0.1 β 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 +50 -68
- package/index.js +108 -111
- package/llm-agent-project-learnings.md +2 -1
- package/llm-code-graph.md +2 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,97 +1,79 @@
|
|
|
1
|
-
# CODE-GRAPH (v3.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.
|
|
6
|
-
- **
|
|
7
|
-
- **
|
|
8
|
-
- **
|
|
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
|
|
11
|
+
## π οΈ The Code-Graph Skills
|
|
12
12
|
|
|
13
|
-
Code-Graph
|
|
13
|
+
Code-Graph provides two primary skills that can be installed independently or together (default).
|
|
14
14
|
|
|
15
|
-
### 1. **Structural Mapping (`
|
|
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
|
-
* **
|
|
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 (`
|
|
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
|
-
* **
|
|
23
|
-
* **Agent Benefit:** Enables "Cross-Session Memory." If an agent fixes a
|
|
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
|
-
|
|
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
|
|
60
|
-
| **Cursor** | `code-graph cursor
|
|
61
|
-
| **Gemini CLI** | `code-graph gemini
|
|
62
|
-
| **Codex** | `code-graph codex
|
|
63
|
-
| **OpenCode** | `code-graph opencode
|
|
64
|
-
| **GitHub Copilot CLI** | `code-graph copilot
|
|
65
|
-
| **VS Code Copilot Chat** | `code-graph vscode
|
|
66
|
-
| **Aider
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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
|
|
86
|
-
| **Cursor** | Writes
|
|
87
|
-
| **Gemini CLI** | Copies
|
|
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
|
|
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
|
-
| **
|
|
93
|
-
| **
|
|
94
|
-
| **
|
|
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> [
|
|
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]
|
|
337
|
+
async install(p, s) {
|
|
338
|
+
console.log(`[Code-Graph] Running install-skills (${s}) for ${p}...`);
|
|
338
339
|
try {
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
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]
|
|
344
|
+
console.error(`[Code-Graph] install-skills failed for ${p}: ${err.message}`);
|
|
391
345
|
}
|
|
392
346
|
}
|
|
393
347
|
|
|
394
|
-
async
|
|
395
|
-
const section = `\n## πΊοΈ
|
|
396
|
-
|
|
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
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
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
|
|
427
|
-
|
|
428
|
-
const
|
|
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
|
-
|
|
434
|
-
|
|
435
|
-
|
|
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
|
|
439
|
-
|
|
440
|
-
|
|
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
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
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
|
-
|
|
450
|
-
|
|
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
|
-
- 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 [
|
|
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]
|