@apart-tech/apart-intelligence 1.0.9 → 1.0.11
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/dist/commands/codebase.d.ts +3 -0
- package/dist/commands/codebase.d.ts.map +1 -0
- package/dist/commands/codebase.js +110 -0
- package/dist/commands/codebase.js.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +12 -11
- package/skills/capture/SKILL.md +54 -0
- package/skills/document/SKILL.md +98 -0
- package/skills/sync/SKILL.md +132 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codebase.d.ts","sourceRoot":"","sources":["../../src/commands/codebase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAmCpC,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,QAkI/C"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, copyFileSync } from "fs";
|
|
2
|
+
import { join, resolve } from "path";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
import prompts from "prompts";
|
|
5
|
+
const SKILLS = ["capture", "document", "sync"];
|
|
6
|
+
function findSkillsSource() {
|
|
7
|
+
// Skills are bundled in the published package under skills/
|
|
8
|
+
const pkgSkills = resolve(new URL(".", import.meta.url).pathname, "..", "..", "skills");
|
|
9
|
+
if (existsSync(pkgSkills))
|
|
10
|
+
return pkgSkills;
|
|
11
|
+
// Fallback for development: look in the repo root
|
|
12
|
+
const repoSkills = resolve(new URL(".", import.meta.url).pathname, "..", "..", "..", "..", ".claude", "skills");
|
|
13
|
+
if (existsSync(repoSkills))
|
|
14
|
+
return repoSkills;
|
|
15
|
+
throw new Error("Could not find bundled skills. Reinstall @apart-tech/apart-intelligence.");
|
|
16
|
+
}
|
|
17
|
+
export function codebaseCommand(program) {
|
|
18
|
+
const codebase = program
|
|
19
|
+
.command("codebase")
|
|
20
|
+
.description("Manage Apart Intelligence in a codebase");
|
|
21
|
+
codebase
|
|
22
|
+
.command("init")
|
|
23
|
+
.description("Install Apart Intelligence skills (capture, document, sync) into the current codebase")
|
|
24
|
+
.option("-y, --yes", "Skip confirmation prompt")
|
|
25
|
+
.action(async (opts) => {
|
|
26
|
+
const targetDir = process.cwd();
|
|
27
|
+
const claudeDir = join(targetDir, ".claude");
|
|
28
|
+
const skillsDir = join(claudeDir, "skills");
|
|
29
|
+
console.log(chalk.bold("\nApart Intelligence — Codebase Setup\n"));
|
|
30
|
+
// Check which skills already exist
|
|
31
|
+
const existing = SKILLS.filter((s) => existsSync(join(skillsDir, s, "SKILL.md")));
|
|
32
|
+
const toInstall = SKILLS.filter((s) => !existsSync(join(skillsDir, s, "SKILL.md")));
|
|
33
|
+
if (existing.length > 0) {
|
|
34
|
+
console.log(chalk.dim(" Already installed:"));
|
|
35
|
+
for (const s of existing) {
|
|
36
|
+
console.log(chalk.dim(` /${s}`));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
if (toInstall.length === 0) {
|
|
40
|
+
console.log(chalk.green("\n All skills are already installed.\n"));
|
|
41
|
+
process.exit(0);
|
|
42
|
+
}
|
|
43
|
+
console.log(" Skills to install:");
|
|
44
|
+
for (const s of toInstall) {
|
|
45
|
+
console.log(` ${chalk.cyan(`/${s}`)}`);
|
|
46
|
+
}
|
|
47
|
+
console.log();
|
|
48
|
+
if (!opts.yes) {
|
|
49
|
+
const { proceed } = await prompts({
|
|
50
|
+
type: "confirm",
|
|
51
|
+
name: "proceed",
|
|
52
|
+
message: `Install ${toInstall.length} skill(s) into ${chalk.dim(".claude/skills/")}?`,
|
|
53
|
+
initial: true,
|
|
54
|
+
});
|
|
55
|
+
if (!proceed) {
|
|
56
|
+
console.log(chalk.dim("Aborted."));
|
|
57
|
+
process.exit(0);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
// Find the source skills
|
|
61
|
+
let source;
|
|
62
|
+
try {
|
|
63
|
+
source = findSkillsSource();
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
console.error(chalk.red(err.message));
|
|
67
|
+
process.exit(1);
|
|
68
|
+
}
|
|
69
|
+
// Copy skills
|
|
70
|
+
for (const skill of toInstall) {
|
|
71
|
+
const srcFile = join(source, skill, "SKILL.md");
|
|
72
|
+
const destDir = join(skillsDir, skill);
|
|
73
|
+
const destFile = join(destDir, "SKILL.md");
|
|
74
|
+
if (!existsSync(srcFile)) {
|
|
75
|
+
console.error(chalk.yellow(` ⚠ Skill source not found: ${skill}, skipping`));
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
mkdirSync(destDir, { recursive: true });
|
|
79
|
+
copyFileSync(srcFile, destFile);
|
|
80
|
+
console.log(chalk.green(` ✓ /${skill}`));
|
|
81
|
+
}
|
|
82
|
+
console.log(chalk.bold("\n✓ Skills installed!\n"));
|
|
83
|
+
console.log(" Available commands in Claude Code:");
|
|
84
|
+
console.log(chalk.cyan(" /capture <knowledge> Quick-capture a decision, process, or policy"));
|
|
85
|
+
console.log(chalk.cyan(" /document [path|range] Generate docs from recent changes"));
|
|
86
|
+
console.log(chalk.cyan(" /sync [range] Incrementally sync code changes to the graph"));
|
|
87
|
+
console.log();
|
|
88
|
+
process.exit(0);
|
|
89
|
+
});
|
|
90
|
+
codebase
|
|
91
|
+
.command("status")
|
|
92
|
+
.description("Show which Apart Intelligence skills are installed")
|
|
93
|
+
.action(() => {
|
|
94
|
+
const skillsDir = join(process.cwd(), ".claude", "skills");
|
|
95
|
+
console.log(chalk.bold("\nApart Intelligence — Codebase Status\n"));
|
|
96
|
+
for (const skill of SKILLS) {
|
|
97
|
+
const installed = existsSync(join(skillsDir, skill, "SKILL.md"));
|
|
98
|
+
const icon = installed
|
|
99
|
+
? chalk.green("✓")
|
|
100
|
+
: chalk.dim("✗");
|
|
101
|
+
const label = installed
|
|
102
|
+
? chalk.white(`/${skill}`)
|
|
103
|
+
: chalk.dim(`/${skill}`);
|
|
104
|
+
console.log(` ${icon} ${label}`);
|
|
105
|
+
}
|
|
106
|
+
console.log();
|
|
107
|
+
process.exit(0);
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=codebase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codebase.js","sourceRoot":"","sources":["../../src/commands/codebase.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAe,MAAM,IAAI,CAAC;AACtE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,MAAM,MAAM,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;AAE/C,SAAS,gBAAgB;IACvB,4DAA4D;IAC5D,MAAM,SAAS,GAAG,OAAO,CACvB,IAAI,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,EACtC,IAAI,EACJ,IAAI,EACJ,QAAQ,CACT,CAAC;IACF,IAAI,UAAU,CAAC,SAAS,CAAC;QAAE,OAAO,SAAS,CAAC;IAE5C,kDAAkD;IAClD,MAAM,UAAU,GAAG,OAAO,CACxB,IAAI,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,EACtC,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,SAAS,EACT,QAAQ,CACT,CAAC;IACF,IAAI,UAAU,CAAC,UAAU,CAAC;QAAE,OAAO,UAAU,CAAC;IAE9C,MAAM,IAAI,KAAK,CACb,0EAA0E,CAC3E,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,OAAgB;IAC9C,MAAM,QAAQ,GAAG,OAAO;SACrB,OAAO,CAAC,UAAU,CAAC;SACnB,WAAW,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,0CAA0C,CAAC,CAAC,CAAC;QAEpE,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC3B,MAAM,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC;YACjE,MAAM,IAAI,GAAG,SAAS;gBACpB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;gBAClB,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACnB,MAAM,KAAK,GAAG,SAAS;gBACrB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,EAAE,CAAC;gBAC1B,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC;YAC3B,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,IAAI,KAAK,EAAE,CAAC,CAAC;QACpC,CAAC;QACD,OAAO,CAAC,GAAG,EAAE,CAAC;QAEd,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -27,6 +27,7 @@ import { loginCommand } from "./commands/login.js";
|
|
|
27
27
|
import { logoutCommand } from "./commands/logout.js";
|
|
28
28
|
import { whoamiCommand } from "./commands/whoami.js";
|
|
29
29
|
import { workspaceCommand } from "./commands/workspace.js";
|
|
30
|
+
import { codebaseCommand } from "./commands/codebase.js";
|
|
30
31
|
const require = createRequire(import.meta.url);
|
|
31
32
|
const { version } = require("../package.json");
|
|
32
33
|
const program = new Command();
|
|
@@ -60,5 +61,6 @@ loginCommand(program);
|
|
|
60
61
|
logoutCommand(program);
|
|
61
62
|
whoamiCommand(program);
|
|
62
63
|
workspaceCommand(program);
|
|
64
|
+
codebaseCommand(program);
|
|
63
65
|
program.parse();
|
|
64
66
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
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,OAAO,CAAC,CAAC;AACvB,YAAY,CAAC,OAAO,CAAC,CAAC;AACtB,aAAa,CAAC,OAAO,CAAC,CAAC;AACvB,cAAc,CAAC,OAAO,CAAC,CAAC;AACxB,iBAAiB,CAAC,OAAO,CAAC,CAAC;AAC3B,mBAAmB,CAAC,OAAO,CAAC,CAAC;AAC7B,cAAc,CAAC,OAAO,CAAC,CAAC;AACxB,eAAe,CAAC,OAAO,CAAC,CAAC;AACzB,gBAAgB,CAAC,OAAO,CAAC,CAAC;AAC1B,UAAU,CAAC,OAAO,CAAC,CAAC;AACpB,WAAW,CAAC,OAAO,CAAC,CAAC;AACrB,YAAY,CAAC,OAAO,CAAC,CAAC;AACtB,aAAa,CAAC,OAAO,CAAC,CAAC;AACvB,aAAa,CAAC,OAAO,CAAC,CAAC;AACvB,gBAAgB,CAAC,OAAO,CAAC,CAAC;AAC1B,eAAe,CAAC,OAAO,CAAC,CAAC;AAEzB,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,37 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apart-tech/apart-intelligence",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.11",
|
|
4
4
|
"description": "Apart Intelligence — the knowledge graph CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"ai": "dist/index.js"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
|
-
"dist"
|
|
10
|
+
"dist",
|
|
11
|
+
"skills"
|
|
11
12
|
],
|
|
12
13
|
"publishConfig": {
|
|
13
14
|
"access": "public"
|
|
14
15
|
},
|
|
15
|
-
"scripts": {
|
|
16
|
-
"build": "tsc",
|
|
17
|
-
"dev": "tsc --watch",
|
|
18
|
-
"lint": "tsc --noEmit",
|
|
19
|
-
"test": "vitest run"
|
|
20
|
-
},
|
|
21
16
|
"dependencies": {
|
|
22
17
|
"@prisma/client": "^6.6.0",
|
|
23
18
|
"@prisma/extension-accelerate": "^3.0.1",
|
|
24
|
-
"@apart-tech/intelligence-core": "^1.0.2",
|
|
25
19
|
"chalk": "^5.4.0",
|
|
26
20
|
"commander": "^13.0.0",
|
|
27
21
|
"prompts": "^2.4.2",
|
|
28
22
|
"dotenv": "^17.3.1",
|
|
29
23
|
"typescript": "^5.7.0",
|
|
30
|
-
"yaml": "^2.6.0"
|
|
24
|
+
"yaml": "^2.6.0",
|
|
25
|
+
"@apart-tech/intelligence-core": "1.0.2"
|
|
31
26
|
},
|
|
32
27
|
"devDependencies": {
|
|
33
28
|
"@types/node": "^25.5.0",
|
|
34
29
|
"@types/prompts": "^2.4.9",
|
|
35
30
|
"vitest": "^3.0.0"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "tsc",
|
|
34
|
+
"dev": "tsc --watch",
|
|
35
|
+
"lint": "tsc --noEmit",
|
|
36
|
+
"test": "vitest run"
|
|
36
37
|
}
|
|
37
|
-
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: capture
|
|
3
|
+
description: Quick-capture a decision, process, or knowledge node into the Apart Intelligence knowledge graph
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
allowed-tools: Bash
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# /capture — Quick Knowledge Capture
|
|
9
|
+
|
|
10
|
+
Capture a piece of knowledge (decision, process, policy, architecture note) into the Apart Intelligence knowledge graph.
|
|
11
|
+
|
|
12
|
+
## Input
|
|
13
|
+
|
|
14
|
+
The user provides `$ARGUMENTS` — a free-text description of what to capture.
|
|
15
|
+
|
|
16
|
+
## Steps
|
|
17
|
+
|
|
18
|
+
1. **Classify** the input into one of these node types based on content:
|
|
19
|
+
- `decision` — a choice that was made and why (e.g., "We chose Hono for the API framework because...")
|
|
20
|
+
- `process` — a workflow or procedure (e.g., "To deploy, run X then Y...")
|
|
21
|
+
- `policy` — a rule or constraint (e.g., "All API endpoints must validate input with Zod")
|
|
22
|
+
- `architecture` — a structural/design description (e.g., "The CLI uses a provider pattern for DB vs API access")
|
|
23
|
+
- `note` — anything that doesn't fit the above
|
|
24
|
+
|
|
25
|
+
2. **Generate a concise title** (under 80 characters) summarizing the knowledge.
|
|
26
|
+
|
|
27
|
+
3. **Check available domains** to find the best fit:
|
|
28
|
+
```bash
|
|
29
|
+
ai domains list -f json
|
|
30
|
+
```
|
|
31
|
+
Pick the most relevant domain slug, or omit if none fit.
|
|
32
|
+
|
|
33
|
+
4. **Create the node** via the CLI:
|
|
34
|
+
```bash
|
|
35
|
+
ai add "<content>" --type <type> --title "<title>" [-d <domain-slug>] -f json
|
|
36
|
+
```
|
|
37
|
+
Where `<content>` is the full user input (the `$ARGUMENTS`), expanded into a well-structured markdown body if the input is terse.
|
|
38
|
+
|
|
39
|
+
5. **Report the result** — show the node ID, type, title, and status. If the user might want to link this to other nodes, mention `ai edges add`.
|
|
40
|
+
|
|
41
|
+
## Example
|
|
42
|
+
|
|
43
|
+
User: `/capture We decided to use Hono instead of Express for the API server because it's lightweight, has native TypeScript support, and works well with Cloudflare Workers`
|
|
44
|
+
|
|
45
|
+
→ Type: `decision`
|
|
46
|
+
→ Title: "Use Hono over Express for API server"
|
|
47
|
+
→ Content: the full text above, formatted as markdown with rationale
|
|
48
|
+
→ Domain: `engineering/backend` (if it exists)
|
|
49
|
+
|
|
50
|
+
## Error Handling
|
|
51
|
+
|
|
52
|
+
- If `ai` is not found, tell the user to install or link the CLI (`npm link` from the project root or `npx ai`).
|
|
53
|
+
- If domain lookup fails, create the node without a domain.
|
|
54
|
+
- If node creation fails, show the full error output.
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: document
|
|
3
|
+
description: Analyze recent changes and generate documentation nodes in the knowledge graph
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
context: fork
|
|
6
|
+
allowed-tools: Bash, Read, Glob, Grep
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# /document — Generate Documentation Nodes from Changes
|
|
10
|
+
|
|
11
|
+
Analyze recent code changes and generate knowledge graph nodes for significant undocumented decisions, architecture, and processes.
|
|
12
|
+
|
|
13
|
+
## Input
|
|
14
|
+
|
|
15
|
+
`$ARGUMENTS` is optional:
|
|
16
|
+
- If a **path** is provided (e.g., `/document packages/api/`), scope analysis to that directory.
|
|
17
|
+
- If a **commit range** is provided (e.g., `/document abc123..HEAD`), use that range.
|
|
18
|
+
- If empty, default to the last 5 commits on the current branch.
|
|
19
|
+
|
|
20
|
+
## Steps
|
|
21
|
+
|
|
22
|
+
### 1. Determine Scope
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# If path provided, get recent changes in that path
|
|
26
|
+
git log --oneline -10 -- <path>
|
|
27
|
+
git diff HEAD~5 -- <path>
|
|
28
|
+
|
|
29
|
+
# If commit range provided
|
|
30
|
+
git log --oneline <range>
|
|
31
|
+
git diff <range>
|
|
32
|
+
|
|
33
|
+
# Default: last 5 commits
|
|
34
|
+
git log --oneline -5
|
|
35
|
+
git diff HEAD~5
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### 2. Analyze Changes
|
|
39
|
+
|
|
40
|
+
Read the diff output and identify changes that represent:
|
|
41
|
+
- **Architectural decisions** — new patterns, framework choices, structural changes
|
|
42
|
+
- **Process changes** — new workflows, deployment changes, CI/CD modifications
|
|
43
|
+
- **Significant refactors** — renamed concepts, reorganized modules, new abstractions
|
|
44
|
+
|
|
45
|
+
Skip routine changes: formatting, minor bug fixes, dependency bumps, test additions, config tweaks.
|
|
46
|
+
|
|
47
|
+
### 3. Search Existing Knowledge
|
|
48
|
+
|
|
49
|
+
For each significant change identified, search the knowledge graph to avoid duplicates:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
ai search "<description of change>" -f json
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
If a relevant node already exists, skip it or note it needs updating.
|
|
56
|
+
|
|
57
|
+
### 4. Create Nodes
|
|
58
|
+
|
|
59
|
+
For each undocumented significant change:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
ai add "<detailed markdown content>" --type <type> --title "<title>" [-d <domain-slug>] -f json
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
The content should be well-structured markdown explaining:
|
|
66
|
+
- What changed and why (if discernible from commits/code)
|
|
67
|
+
- Key files involved
|
|
68
|
+
- Impact on the rest of the codebase
|
|
69
|
+
|
|
70
|
+
### 5. Update Stale Nodes
|
|
71
|
+
|
|
72
|
+
For modified files that have existing module nodes, check if the module documentation is stale:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
ai search "<filename>" --types module -f json
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
If a module node exists and the file has changed significantly, update it:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
ai update <node-id> --content "<updated content>"
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### 6. Report Results
|
|
85
|
+
|
|
86
|
+
Summarize:
|
|
87
|
+
- Number of new nodes created (with IDs and titles)
|
|
88
|
+
- Number of existing nodes updated
|
|
89
|
+
- Changes that were skipped and why (already documented, too minor, etc.)
|
|
90
|
+
|
|
91
|
+
## Guidelines
|
|
92
|
+
|
|
93
|
+
- Be conservative — create fewer, higher-quality nodes rather than many low-value ones.
|
|
94
|
+
- Each node should stand alone as useful documentation.
|
|
95
|
+
- Use specific, searchable titles (not "Updated API" but "Add rate limiting middleware to API endpoints").
|
|
96
|
+
- Prefer `decision` type when the change reflects a choice between alternatives.
|
|
97
|
+
- Prefer `architecture` type for structural/design documentation.
|
|
98
|
+
- Prefer `process` type for workflow/deployment/operational documentation.
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sync
|
|
3
|
+
description: Incrementally update the knowledge graph from git changes (faster than full ai map)
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
context: fork
|
|
6
|
+
allowed-tools: Bash, Read
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# /sync — Incremental Knowledge Graph Sync
|
|
10
|
+
|
|
11
|
+
Update the knowledge graph based on git changes since the last sync. Faster than a full `ai map` for ongoing development.
|
|
12
|
+
|
|
13
|
+
## Input
|
|
14
|
+
|
|
15
|
+
`$ARGUMENTS` is optional:
|
|
16
|
+
- If a **commit range** is provided (e.g., `/sync abc123..HEAD`), use that range.
|
|
17
|
+
- If empty, determine the range from the sync-marker node.
|
|
18
|
+
|
|
19
|
+
## Steps
|
|
20
|
+
|
|
21
|
+
### 1. Find Last Sync Point
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
ai search "sync-marker" --types sync-marker -f json
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
- If a sync-marker node exists, extract the `commitSha` from its metadata — this is the base commit.
|
|
28
|
+
- If no sync-marker exists, this is the first sync. Use the base of the current branch or fall back to `HEAD~10`.
|
|
29
|
+
- If `$ARGUMENTS` provides a commit range, use that instead.
|
|
30
|
+
|
|
31
|
+
### 2. Get Changed Files
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
git diff <base>..HEAD --name-status
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Categorize files:
|
|
38
|
+
- **A** (Added) — new files to create module nodes for
|
|
39
|
+
- **M** (Modified) — existing files to update module nodes for
|
|
40
|
+
- **D** (Deleted) — files to archive module nodes for
|
|
41
|
+
|
|
42
|
+
### 3. Filter Files
|
|
43
|
+
|
|
44
|
+
Only process source files. Skip:
|
|
45
|
+
- Lock files (`pnpm-lock.yaml`, `package-lock.json`, `yarn.lock`)
|
|
46
|
+
- Config files (`.eslintrc`, `tsconfig.json`, `.prettierrc`, etc.)
|
|
47
|
+
- Test files (`**/*.test.*`, `**/*.spec.*`, `**/__tests__/**`)
|
|
48
|
+
- Generated files (`dist/`, `build/`, `.next/`, `node_modules/`)
|
|
49
|
+
- Markdown files, dotfiles, images, and other non-source assets
|
|
50
|
+
|
|
51
|
+
Include: `*.ts`, `*.tsx`, `*.js`, `*.jsx`, `*.py`, `*.go`, `*.rs`, `*.java` and similar source files.
|
|
52
|
+
|
|
53
|
+
### 4. Check Scale
|
|
54
|
+
|
|
55
|
+
If more than 30 source files changed, fall back to `ai map` for the affected directories instead of updating one-by-one:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
ai map <directory> [--domain <slug>]
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Then skip to step 8.
|
|
62
|
+
|
|
63
|
+
### 5. Handle Added Files
|
|
64
|
+
|
|
65
|
+
For each added source file:
|
|
66
|
+
|
|
67
|
+
1. Read the file to understand its purpose.
|
|
68
|
+
2. Create a module node:
|
|
69
|
+
```bash
|
|
70
|
+
ai add "<module documentation>" --type module --title "<project>/<relative-path>" --status approved -f json
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### 6. Handle Modified Files
|
|
74
|
+
|
|
75
|
+
For each modified source file:
|
|
76
|
+
|
|
77
|
+
1. Search for the existing module node:
|
|
78
|
+
```bash
|
|
79
|
+
ai search "<project>/<relative-path>" --types module -f json
|
|
80
|
+
```
|
|
81
|
+
2. If found, read the current file and update the node:
|
|
82
|
+
```bash
|
|
83
|
+
ai update <node-id> --content "<updated documentation>"
|
|
84
|
+
```
|
|
85
|
+
3. If not found, treat it like an added file (create a new module node).
|
|
86
|
+
|
|
87
|
+
### 7. Handle Deleted Files
|
|
88
|
+
|
|
89
|
+
For each deleted source file:
|
|
90
|
+
|
|
91
|
+
1. Search for the existing module node:
|
|
92
|
+
```bash
|
|
93
|
+
ai search "<project>/<relative-path>" --types module -f json
|
|
94
|
+
```
|
|
95
|
+
2. If found, archive it:
|
|
96
|
+
```bash
|
|
97
|
+
ai status <node-id> archived
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### 8. Update Sync Marker
|
|
101
|
+
|
|
102
|
+
Determine the current HEAD SHA:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
git rev-parse HEAD
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
If a sync-marker node already exists, update it:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
ai update <marker-id> --content "Last synced at $(date -u +%Y-%m-%dT%H:%M:%SZ)" -m '{"commitSha":"<HEAD-SHA>","syncedAt":"<timestamp>"}'
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
If no sync-marker exists, create one:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
ai add "Last synced at $(date -u +%Y-%m-%dT%H:%M:%SZ)" --type sync-marker --title "sync-marker" --status approved -m '{"commitSha":"<HEAD-SHA>","syncedAt":"<timestamp>"}' -f json
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### 9. Report Results
|
|
121
|
+
|
|
122
|
+
Summarize:
|
|
123
|
+
- Files processed: added / modified / deleted
|
|
124
|
+
- Nodes created / updated / archived
|
|
125
|
+
- Current sync point (commit SHA)
|
|
126
|
+
- Any errors or skipped files
|
|
127
|
+
|
|
128
|
+
## Notes
|
|
129
|
+
|
|
130
|
+
- The `--status approved` flag is used for sync-marker nodes so they don't clutter the draft queue.
|
|
131
|
+
- Module nodes created by sync use the default `draft` status so they can be reviewed.
|
|
132
|
+
- The project name for titles should match what `ai map` uses (typically the repo or directory name).
|