ai-spector 0.1.3 → 0.1.4

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
@@ -15,7 +15,9 @@ npm install ai-spector
15
15
  npx ai-spector init
16
16
  ```
17
17
 
18
- Put your source files in `docs/data-source/`, open the folder in Cursor, and turn on the **ai-spector** skill.
18
+ Put your source files in `docs/data-source/`, open the folder in Cursor, turn on the **ai-spector** skill, and **reload MCP** (init writes `.cursor/mcp.json` for Graphify).
19
+
20
+ **Graphify requires:** [uv](https://docs.astral.sh/uv/) installed; package `graphifyy` is pulled via `uv tool run` on first MCP start.
19
21
 
20
22
  ### Then use slash commands
21
23
 
@@ -43,9 +45,15 @@ Command details live in `.cursor/commands/` after `init` (start with `_workflow.
43
45
 
44
46
  If a CLI step fails during a slash command, the agent should **stop**, show you the error, and help you fix it — not bypass the tool with manual edits. See `_cli-failures.md` in your project after `init`.
45
47
 
46
- ### Why is `docs/data-source/graphify-out/` there?
48
+ ### Graphify MCP (configured on `init`)
49
+
50
+ `init` adds **`.cursor/mcp.json`** (Graphify) and updates **`.gitignore`** (Graphify cache, HTML reports, legacy `docs/data-source/graphify-out/`).
51
+
52
+ Graphify graph file:
53
+
54
+ `.ai-spector/.docflow/graph/graphify-out/graph.json`
47
55
 
48
- That folder is from **Graphify MCP** during **`/analyze`**, not from `npx ai-spector analyze`. AI Spector’s files live under `.ai-spector/` (especially `knowledge.json` and the traceability graph). You can delete `graphify-out/`; new projects gitignore it. See `docs/data-source/README.md` after `init`.
56
+ Restart Cursor or reload MCP after init. If you still see **`docs/data-source/graphify-out/`**, that is an old Graphify default delete it; see `docs/data-source/README.md`.
49
57
 
50
58
  ---
51
59
 
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,wBAAsB,OAAO,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAiD9D"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,wBAAsB,OAAO,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAyD9D"}
@@ -2,6 +2,8 @@ import { mkdir, writeFile } from "node:fs/promises";
2
2
  import { join, resolve } from "node:path";
3
3
  import { scaffoldBundleRoot } from "../config/load.js";
4
4
  import { copyTree, pathExists, writeJson } from "../util/fs.js";
5
+ import { ensureGraphifyMcpConfig } from "../util/mcp.js";
6
+ import { ensureAiSpectorGitignore } from "../util/gitignore.js";
5
7
  export async function runInit(opts) {
6
8
  const root = resolve(opts.targetDir);
7
9
  const marker = join(root, ".ai-spector", "docflow.config.json");
@@ -15,6 +17,7 @@ export async function runInit(opts) {
15
17
  ".ai-spector/registry",
16
18
  ".ai-spector/.docflow/analysis",
17
19
  ".ai-spector/.docflow/extract",
20
+ ".ai-spector/.docflow/graph/graphify-out",
18
21
  ".ai-spector/views",
19
22
  "docs/srs",
20
23
  "docs/basic-design",
@@ -34,13 +37,19 @@ export async function runInit(opts) {
34
37
  if (!(await pathExists(gitkeep))) {
35
38
  await writeFile(gitkeep, "");
36
39
  }
40
+ const mcpPath = await ensureGraphifyMcpConfig(root);
41
+ const gitignorePath = await ensureAiSpectorGitignore(root);
37
42
  console.log(`Initialized AI Spector project at ${root}`);
38
43
  console.log("");
44
+ console.log(` MCP → ${mcpPath} (Graphify server added/updated)`);
45
+ console.log(` gitignore → ${gitignorePath} (ai-spector block added/updated)`);
46
+ console.log("");
39
47
  console.log("Next steps (Cursor):");
40
48
  console.log(" 1. Open this folder in Cursor");
41
- console.log(" 2. Enable the ai-spector skill (.cursor/skills/ai-spector/)");
42
- console.log(" 3. Add files under docs/data-source/");
43
- console.log(" 4. Run /analyze → /validate-graph → /generate-srs");
49
+ console.log(" 2. Reload MCP (Settings MCP) or restart Cursor — needs uv + graphifyy");
50
+ console.log(" 3. Enable the ai-spector skill (.cursor/skills/ai-spector/)");
51
+ console.log(" 4. Add files under docs/data-source/");
52
+ console.log(" 5. Run /analyze → /validate-graph → /generate-srs");
44
53
  console.log("");
45
54
  console.log("See .cursor/commands/_workflow.md — you do not need other CLI commands.");
46
55
  }
@@ -1 +1 @@
1
- {"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAOhE,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,IAAiB;IAC7C,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACrC,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,EAAE,aAAa,EAAE,qBAAqB,CAAC,CAAC;IAEhE,IAAI,MAAM,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;QAC5C,MAAM,IAAI,KAAK,CACb,gCAAgC,MAAM,6CAA6C,CACpF,CAAC;IACJ,CAAC;IAED,MAAM,QAAQ,GAAG,kBAAkB,EAAE,CAAC;IACtC,MAAM,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAE/B,MAAM,IAAI,GAAG;QACX,mBAAmB;QACnB,sBAAsB;QACtB,+BAA+B;QAC/B,8BAA8B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,CAAC,CAAC;IACvE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,yEAAyE,CAAC,CAAC;AACzF,CAAC"}
@@ -0,0 +1,9 @@
1
+ export declare const GITIGNORE_BEGIN = "# >>> ai-spector (begin)";
2
+ export declare const GITIGNORE_END = "# <<< ai-spector (end)";
3
+ /** Lines merged into the project root .gitignore on init. */
4
+ export declare const AI_SPECTOR_GITIGNORE_LINES: readonly ["# >>> ai-spector (begin)", "# Graphify MCP + local reports (see .cursor/mcp.json)", "docs/data-source/graphify-out/", ".ai-spector/.docflow/graph/graphify-index/", ".ai-spector/.docflow/graph/graphify-out/", ".ai-spector/views/", "# <<< ai-spector (end)", ""];
5
+ /**
6
+ * Ensure project root `.gitignore` includes the ai-spector block.
7
+ */
8
+ export declare function ensureAiSpectorGitignore(projectRoot: string): Promise<string>;
9
+ //# sourceMappingURL=gitignore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitignore.d.ts","sourceRoot":"","sources":["../../src/util/gitignore.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,eAAe,6BAA6B,CAAC;AAC1D,eAAO,MAAM,aAAa,2BAA2B,CAAC;AAEtD,6DAA6D;AAC7D,eAAO,MAAM,0BAA0B,gRAS7B,CAAC;AAqBX;;GAEG;AACH,wBAAsB,wBAAwB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAenF"}
@@ -0,0 +1,48 @@
1
+ import { readFile, writeFile } from "node:fs/promises";
2
+ import { join } from "node:path";
3
+ import { pathExists } from "./fs.js";
4
+ export const GITIGNORE_BEGIN = "# >>> ai-spector (begin)";
5
+ export const GITIGNORE_END = "# <<< ai-spector (end)";
6
+ /** Lines merged into the project root .gitignore on init. */
7
+ export const AI_SPECTOR_GITIGNORE_LINES = [
8
+ GITIGNORE_BEGIN,
9
+ "# Graphify MCP + local reports (see .cursor/mcp.json)",
10
+ "docs/data-source/graphify-out/",
11
+ ".ai-spector/.docflow/graph/graphify-index/",
12
+ ".ai-spector/.docflow/graph/graphify-out/",
13
+ ".ai-spector/views/",
14
+ GITIGNORE_END,
15
+ "",
16
+ ];
17
+ function buildBlock() {
18
+ return `${AI_SPECTOR_GITIGNORE_LINES.join("\n")}`;
19
+ }
20
+ function replaceOrAppendBlock(existing, block) {
21
+ const begin = existing.indexOf(GITIGNORE_BEGIN);
22
+ const end = existing.indexOf(GITIGNORE_END);
23
+ if (begin !== -1 && end !== -1 && end > begin) {
24
+ const before = existing.slice(0, begin);
25
+ const after = existing.slice(end + GITIGNORE_END.length);
26
+ return `${before}${block}${after.replace(/^\n/, "")}`;
27
+ }
28
+ const trimmed = existing.replace(/\s*$/, "");
29
+ const separator = trimmed.length > 0 ? "\n\n" : "";
30
+ return `${trimmed}${separator}${block}`;
31
+ }
32
+ /**
33
+ * Ensure project root `.gitignore` includes the ai-spector block.
34
+ */
35
+ export async function ensureAiSpectorGitignore(projectRoot) {
36
+ const gitignorePath = join(projectRoot, ".gitignore");
37
+ const block = buildBlock();
38
+ let existing = "";
39
+ if (await pathExists(gitignorePath)) {
40
+ existing = await readFile(gitignorePath, "utf8");
41
+ }
42
+ const next = replaceOrAppendBlock(existing, block);
43
+ if (next !== existing) {
44
+ await writeFile(gitignorePath, next.endsWith("\n") ? next : `${next}\n`, "utf8");
45
+ }
46
+ return gitignorePath;
47
+ }
48
+ //# sourceMappingURL=gitignore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitignore.js","sourceRoot":"","sources":["../../src/util/gitignore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,MAAM,CAAC,MAAM,eAAe,GAAG,0BAA0B,CAAC;AAC1D,MAAM,CAAC,MAAM,aA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,EAAE,YAAY,CAAC,CAAC;IACtD,MAAM,KAAK,GAAG,UAAU,EAAE,CAAC;IAE3B,IAAI,QAAQ,GAAG,EAAE,CAAC;IAClB,IAAI,MAAM,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC;QACpC,QAAQ,GAAG,MAAM,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;IACnD,CAAC;IAED,MAAM,IAAI,GAAG,oBAAoB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IACnD,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;QACtB,MAAM,SAAS,CAAC,aAAa,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,EAAE,MAAM,CAAC,CAAC;IACnF,CAAC;IAED,OAAO,aAAa,CAAC;AACvB,CAAC"}
@@ -0,0 +1,16 @@
1
+ export interface CursorMcpConfig {
2
+ mcpServers?: Record<string, McpServerEntry>;
3
+ }
4
+ export interface McpServerEntry {
5
+ command: string;
6
+ args?: string[];
7
+ env?: Record<string, string>;
8
+ }
9
+ /** Graph JSON path relative to workspace (Cursor expands ${workspaceFolder}). */
10
+ export declare const GRAPHIFY_GRAPH_ARG = "${workspaceFolder}/.ai-spector/.docflow/graph/graphify-out/graph.json";
11
+ export declare function graphifyMcpServerEntry(): McpServerEntry;
12
+ /**
13
+ * Ensure `.cursor/mcp.json` includes the Graphify server without removing other servers.
14
+ */
15
+ export declare function ensureGraphifyMcpConfig(projectRoot: string): Promise<string>;
16
+ //# sourceMappingURL=mcp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/util/mcp.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,eAAe;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;CAC7C;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B;AAED,iFAAiF;AACjF,eAAO,MAAM,kBAAkB,0EAC0C,CAAC;AAE1E,wBAAgB,sBAAsB,IAAI,cAAc,CAcvD;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAmBlF"}
@@ -0,0 +1,41 @@
1
+ import { join } from "node:path";
2
+ import { pathExists, readJson, writeJson } from "./fs.js";
3
+ /** Graph JSON path relative to workspace (Cursor expands ${workspaceFolder}). */
4
+ export const GRAPHIFY_GRAPH_ARG = "${workspaceFolder}/.ai-spector/.docflow/graph/graphify-out/graph.json";
5
+ export function graphifyMcpServerEntry() {
6
+ return {
7
+ command: "uv",
8
+ args: [
9
+ "tool",
10
+ "run",
11
+ "--from",
12
+ "graphifyy",
13
+ "python",
14
+ "-m",
15
+ "graphify.serve",
16
+ GRAPHIFY_GRAPH_ARG,
17
+ ],
18
+ };
19
+ }
20
+ /**
21
+ * Ensure `.cursor/mcp.json` includes the Graphify server without removing other servers.
22
+ */
23
+ export async function ensureGraphifyMcpConfig(projectRoot) {
24
+ const mcpPath = join(projectRoot, ".cursor", "mcp.json");
25
+ let config = { mcpServers: {} };
26
+ if (await pathExists(mcpPath)) {
27
+ try {
28
+ config = await readJson(mcpPath);
29
+ }
30
+ catch {
31
+ config = { mcpServers: {} };
32
+ }
33
+ }
34
+ if (!config.mcpServers) {
35
+ config.mcpServers = {};
36
+ }
37
+ config.mcpServers.graphify = graphifyMcpServerEntry();
38
+ await writeJson(mcpPath, config);
39
+ return mcpPath;
40
+ }
41
+ //# sourceMappingURL=mcp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../src/util/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAY1D,iFAAiF;AACjF,MAAM,CAAC,MAAM,kBAAkB,GAC7B,uEAAuE,CAAC;AAE1E,MAAM,UAAU,sBAAsB;IACpC,OAAO;QACL,OAAO,EAAE,IAAI;QACb,IAAI,EAAE;YACJ,MAAM;YACN,KAAK;YACL,QAAQ;YACR,WAAW;YACX,QAAQ;YACR,IAAI;YACJ,gBAAgB;YAChB,kBAAkB;SACnB;KACF,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,WAAmB;IAC/D,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;IACzD,IAAI,MAAM,GAAoB,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC;IAEjD,IAAI,MAAM,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QAC9B,IAAI,CAAC;YACH,MAAM,GAAG,MAAM,QAAQ,CAAkB,OAAO,CAAC,CAAC;QACpD,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,GAAG,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC;QAC9B,CAAC;IACH,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;QACvB,MAAM,CAAC,UAAU,GAAG,EAAE,CAAC;IACzB,CAAC;IAED,MAAM,CAAC,UAAU,CAAC,QAAQ,GAAG,sBAAsB,EAAE,CAAC;IACtD,MAAM,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACjC,OAAO,OAAO,CAAC;AACjB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-spector",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Cursor-first documentation workflow: traceability graph, SRS/basic/detail design templates, and ai-spector CLI",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -3,6 +3,7 @@
3
3
  "graphify": {
4
4
  "indexPath": ".ai-spector/.docflow/graph/graphify-index",
5
5
  "outputPath": ".ai-spector/.docflow/graph/graphify-out",
6
+ "graphJsonPath": ".ai-spector/.docflow/graph/graphify-out/graph.json",
6
7
  "defaultDataSource": "docs/data-source",
7
8
  "include": [
8
9
  "docs/data-source"
@@ -11,7 +11,7 @@ npm install ai-spector
11
11
  npx ai-spector init
12
12
  ```
13
13
 
14
- Add source material under `docs/data-source/`, open the project in Cursor, and enable the **ai-spector** skill.
14
+ Add source material under `docs/data-source/`, open the project in Cursor, **reload MCP** (Graphify is in `.cursor/mcp.json` from `init`), and enable the **ai-spector** skill.
15
15
 
16
16
  ## Day-to-day (slash commands only)
17
17
 
@@ -29,10 +29,11 @@ Creates section/document nodes from templates. Do not ask the user to run this s
29
29
  ### A. Extract (Graphify MCP)
30
30
 
31
31
  1. Load `data-source.json`, `analyze.graphify.json`.
32
- 2. **Graphify paths (mandatory):**
32
+ 2. **Graphify paths (mandatory — set by `ai-spector init` in `.cursor/mcp.json`):**
33
+ - MCP graph file: `.ai-spector/.docflow/graph/graphify-out/graph.json`
33
34
  - Index: `.ai-spector/.docflow/graph/graphify-index` (`graphify.indexPath`)
34
- - Output: `.ai-spector/.docflow/graph/graphify-out` (`graphify.outputPath`)
35
- - **Do not** write under `docs/data-source/graphify-out/` — that is not AI Spector’s store; if Graphify created it, treat as disposable scratch or move into `.ai-spector/.docflow/graph/`.
35
+ - Output dir: `.ai-spector/.docflow/graph/graphify-out` (`graphify.outputPath`)
36
+ - **Do not** use `docs/data-source/graphify-out/` — legacy Graphify default; delete or gitignore if present.
36
37
  3. Resolve paths → `scope.json` → `sources`.
37
38
  4. Build/update Graphify index for that scope.
38
39
  5. Query / fallback to extract:
@@ -0,0 +1,17 @@
1
+ {
2
+ "mcpServers": {
3
+ "graphify": {
4
+ "command": "uv",
5
+ "args": [
6
+ "tool",
7
+ "run",
8
+ "--from",
9
+ "graphifyy",
10
+ "python",
11
+ "-m",
12
+ "graphify.serve",
13
+ "${workspaceFolder}/.ai-spector/.docflow/graph/graphify-out/graph.json"
14
+ ]
15
+ }
16
+ }
17
+ }
@@ -7,6 +7,8 @@ description: "Cursor-first docs: user runs slash commands; agent runs CLI; on CL
7
7
 
8
8
  **Workflow:** `.cursor/commands/_workflow.md` — user only runs `npx ai-spector init` once, then slash commands.
9
9
 
10
+ **Graphify MCP:** `init` configures `.cursor/mcp.json` → graph file at `.ai-spector/.docflow/graph/graphify-out/graph.json` (not `docs/data-source/graphify-out/`).
11
+
10
12
  ## CLI failure rule (non-negotiable)
11
13
 
12
14
  When `ai-spector` exits non-zero or required `--json` is missing/invalid:
@@ -13,6 +13,4 @@ If you see `docs/data-source/graphify-out/`, it was created by **Graphify MCP**
13
13
  | `.ai-spector/.docflow/graph/graphify-out` | Preferred Graphify output (see `analyze.graphify.json`) |
14
14
  | `.ai-spector/.docflow/analysis/knowledge.json` | **AI Spector staging** → merged into the traceability graph |
15
15
 
16
- You can **delete** `graphify-out/` under `docs/data-source/`; it is gitignored. The agent should write extract results to `knowledge.json`, not rely on that folder.
17
-
18
16
  Override inputs: `/analyze path/to/other-folder`