ai-spector 0.2.4 → 0.2.6

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.
Files changed (49) hide show
  1. package/dist/cli.js +30 -0
  2. package/dist/cli.js.map +1 -1
  3. package/dist/commands/graph-merge.d.ts +2 -0
  4. package/dist/commands/graph-merge.d.ts.map +1 -1
  5. package/dist/commands/graph-merge.js +9 -2
  6. package/dist/commands/graph-merge.js.map +1 -1
  7. package/dist/commands/graph-report.d.ts +7 -0
  8. package/dist/commands/graph-report.d.ts.map +1 -0
  9. package/dist/commands/graph-report.js +39 -0
  10. package/dist/commands/graph-report.js.map +1 -0
  11. package/dist/commands/index.d.ts.map +1 -1
  12. package/dist/commands/index.js +45 -0
  13. package/dist/commands/index.js.map +1 -1
  14. package/dist/graph/bundles.d.ts +32 -0
  15. package/dist/graph/bundles.d.ts.map +1 -0
  16. package/dist/graph/bundles.js +109 -0
  17. package/dist/graph/bundles.js.map +1 -0
  18. package/dist/graph/defaults.d.ts +11 -0
  19. package/dist/graph/defaults.d.ts.map +1 -1
  20. package/dist/graph/defaults.js +11 -0
  21. package/dist/graph/defaults.js.map +1 -1
  22. package/dist/graph/detail-sections.d.ts.map +1 -1
  23. package/dist/graph/detail-sections.js +17 -4
  24. package/dist/graph/detail-sections.js.map +1 -1
  25. package/dist/graph/doc-extract.d.ts +7 -1
  26. package/dist/graph/doc-extract.d.ts.map +1 -1
  27. package/dist/graph/doc-extract.js +195 -44
  28. package/dist/graph/doc-extract.js.map +1 -1
  29. package/dist/graph/layer-audit.d.ts +48 -0
  30. package/dist/graph/layer-audit.d.ts.map +1 -0
  31. package/dist/graph/layer-audit.js +229 -0
  32. package/dist/graph/layer-audit.js.map +1 -0
  33. package/dist/graph/merge.d.ts +5 -1
  34. package/dist/graph/merge.d.ts.map +1 -1
  35. package/dist/graph/merge.js +70 -3
  36. package/dist/graph/merge.js.map +1 -1
  37. package/dist/graph/provenance.d.ts.map +1 -1
  38. package/dist/graph/provenance.js +9 -4
  39. package/dist/graph/provenance.js.map +1 -1
  40. package/dist/index/doc-semantics.d.ts.map +1 -1
  41. package/dist/index/doc-semantics.js +6 -1
  42. package/dist/index/doc-semantics.js.map +1 -1
  43. package/dist/types.d.ts +3 -2
  44. package/dist/types.d.ts.map +1 -1
  45. package/package.json +1 -1
  46. package/scaffold/.ai-spector/.docflow/extract/semantic-links.patch.example.json +17 -0
  47. package/scaffold/.cursor/commands/index.md +3 -1
  48. package/scaffold/.cursor/commands/link-graph.md +43 -0
  49. package/schemas/schema.graph.json +11 -3
@@ -0,0 +1,43 @@
1
+ # /link-graph — semantic meaning edges (agent + CLI)
2
+
3
+ Add **meaning (agent)** edges (`relatesTo`) that CLI/index cannot infer. Do **not** edit `traceability.graph.json` by hand.
4
+
5
+ ## Prerequisites
6
+
7
+ - `ai-spector index` completed (spec sections + `derivedFrom` when possible)
8
+ - Seed id (e.g. `UC-03`) or `--file` + heading
9
+
10
+ ## Steps
11
+
12
+ 1. **Query graph (CLI)**
13
+
14
+ ```bash
15
+ npx ai-spector graph query <SEED> --direction both --depth 3 --json
16
+ npx ai-spector graph report --json
17
+ ```
18
+
19
+ 2. **Read sources** — Only open paths from `derivedFrom` / `sourceRef` on the seed; read matching `docs/data-source/**` excerpts and relevant SRS `###` sections.
20
+
21
+ 3. **Write patch** — Save edges to:
22
+
23
+ `.ai-spector/.docflow/extract/semantic-links.patch.json`
24
+
25
+ Use the example format in `semantic-links.patch.example.json`. Rules:
26
+
27
+ - **Edges only** by default (`nodes: []`)
28
+ - Allowed type: `relatesTo` (optional `role`: `evidence`, `usesEntity`, …)
29
+ - Use **existing** node ids from query output only
30
+ - Do **not** create new `document` or `section` nodes
31
+
32
+ 4. **Merge + validate (CLI)**
33
+
34
+ ```bash
35
+ npx ai-spector graph merge --semantic
36
+ npx ai-spector graph validate
37
+ ```
38
+
39
+ 5. Show the user a short summary: edges added, seed, and whether `graph report` still lists domains needing links.
40
+
41
+ ## Failures
42
+
43
+ See `.cursor/commands/_cli-failures.md`. If merge rejects an edge, fix the patch ids/types and re-run merge.
@@ -20,6 +20,8 @@
20
20
  "nodeType": {
21
21
  "type": "string",
22
22
  "enum": [
23
+ "bundle",
24
+ "sourceFile",
23
25
  "document",
24
26
  "section",
25
27
  "table",
@@ -46,7 +48,8 @@
46
48
  "requires",
47
49
  "tracesTo",
48
50
  "derivedFrom",
49
- "rendersTo"
51
+ "rendersTo",
52
+ "relatesTo"
50
53
  ]
51
54
  },
52
55
  "node": {
@@ -59,13 +62,18 @@
59
62
  "template": { "type": "string" },
60
63
  "output": { "type": "string" },
61
64
  "outputPattern": { "type": "string" },
62
- "perDomain": { "type": "string", "enum": ["useCase", "feature"] },
65
+ "perDomain": {
66
+ "type": "string",
67
+ "enum": ["useCase", "feature", "apiDetail", "screenDetail"]
68
+ },
63
69
  "documentId": { "type": "string" },
64
70
  "heading": { "type": "string" },
65
71
  "level": { "type": "integer", "minimum": 2, "maximum": 6 },
66
72
  "order": { "type": "integer", "minimum": 0 },
67
73
  "title": { "type": "string" },
68
- "slug": { "type": "string" }
74
+ "slug": { "type": "string" },
75
+ "role": { "type": "string", "enum": ["source", "business", "spec"] },
76
+ "path": { "type": "string" }
69
77
  }
70
78
  },
71
79
  "edge": {