ai-spector 0.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.
Files changed (168) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +150 -0
  3. package/dist/cli.d.ts +3 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +173 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/commands/analyze.d.ts +9 -0
  8. package/dist/commands/analyze.d.ts.map +1 -0
  9. package/dist/commands/analyze.js +62 -0
  10. package/dist/commands/analyze.js.map +1 -0
  11. package/dist/commands/bootstrap.d.ts +4 -0
  12. package/dist/commands/bootstrap.d.ts.map +1 -0
  13. package/dist/commands/bootstrap.js +58 -0
  14. package/dist/commands/bootstrap.js.map +1 -0
  15. package/dist/commands/graph-impact.d.ts +10 -0
  16. package/dist/commands/graph-impact.d.ts.map +1 -0
  17. package/dist/commands/graph-impact.js +31 -0
  18. package/dist/commands/graph-impact.js.map +1 -0
  19. package/dist/commands/graph-merge.d.ts +11 -0
  20. package/dist/commands/graph-merge.d.ts.map +1 -0
  21. package/dist/commands/graph-merge.js +88 -0
  22. package/dist/commands/graph-merge.js.map +1 -0
  23. package/dist/commands/graph-query.d.ts +10 -0
  24. package/dist/commands/graph-query.d.ts.map +1 -0
  25. package/dist/commands/graph-query.js +31 -0
  26. package/dist/commands/graph-query.js.map +1 -0
  27. package/dist/commands/graph-visualize.d.ts +10 -0
  28. package/dist/commands/graph-visualize.d.ts.map +1 -0
  29. package/dist/commands/graph-visualize.js +72 -0
  30. package/dist/commands/graph-visualize.js.map +1 -0
  31. package/dist/commands/init.d.ts +6 -0
  32. package/dist/commands/init.d.ts.map +1 -0
  33. package/dist/commands/init.js +47 -0
  34. package/dist/commands/init.js.map +1 -0
  35. package/dist/commands/validate.d.ts +10 -0
  36. package/dist/commands/validate.d.ts.map +1 -0
  37. package/dist/commands/validate.js +89 -0
  38. package/dist/commands/validate.js.map +1 -0
  39. package/dist/config/load.d.ts +21 -0
  40. package/dist/config/load.d.ts.map +1 -0
  41. package/dist/config/load.js +77 -0
  42. package/dist/config/load.js.map +1 -0
  43. package/dist/config/types.d.ts +22 -0
  44. package/dist/config/types.d.ts.map +1 -0
  45. package/dist/config/types.js +2 -0
  46. package/dist/config/types.js.map +1 -0
  47. package/dist/graph/InMemoryGraph.d.ts +20 -0
  48. package/dist/graph/InMemoryGraph.d.ts.map +1 -0
  49. package/dist/graph/InMemoryGraph.js +181 -0
  50. package/dist/graph/InMemoryGraph.js.map +1 -0
  51. package/dist/graph/defaults.d.ts +10 -0
  52. package/dist/graph/defaults.d.ts.map +1 -0
  53. package/dist/graph/defaults.js +10 -0
  54. package/dist/graph/defaults.js.map +1 -0
  55. package/dist/graph/impact.d.ts +32 -0
  56. package/dist/graph/impact.d.ts.map +1 -0
  57. package/dist/graph/impact.js +88 -0
  58. package/dist/graph/impact.js.map +1 -0
  59. package/dist/graph/knowledge.d.ts +53 -0
  60. package/dist/graph/knowledge.d.ts.map +1 -0
  61. package/dist/graph/knowledge.js +79 -0
  62. package/dist/graph/knowledge.js.map +1 -0
  63. package/dist/graph/load.d.ts +4 -0
  64. package/dist/graph/load.d.ts.map +1 -0
  65. package/dist/graph/load.js +12 -0
  66. package/dist/graph/load.js.map +1 -0
  67. package/dist/graph/loadGraph.d.ts +3 -0
  68. package/dist/graph/loadGraph.d.ts.map +1 -0
  69. package/dist/graph/loadGraph.js +7 -0
  70. package/dist/graph/loadGraph.js.map +1 -0
  71. package/dist/graph/merge.d.ts +15 -0
  72. package/dist/graph/merge.d.ts.map +1 -0
  73. package/dist/graph/merge.js +63 -0
  74. package/dist/graph/merge.js.map +1 -0
  75. package/dist/graph/query.d.ts +18 -0
  76. package/dist/graph/query.d.ts.map +1 -0
  77. package/dist/graph/query.js +132 -0
  78. package/dist/graph/query.js.map +1 -0
  79. package/dist/registry/build.d.ts +3 -0
  80. package/dist/registry/build.d.ts.map +1 -0
  81. package/dist/registry/build.js +53 -0
  82. package/dist/registry/build.js.map +1 -0
  83. package/dist/registry/slug.d.ts +4 -0
  84. package/dist/registry/slug.d.ts.map +1 -0
  85. package/dist/registry/slug.js +16 -0
  86. package/dist/registry/slug.js.map +1 -0
  87. package/dist/types.d.ts +45 -0
  88. package/dist/types.d.ts.map +1 -0
  89. package/dist/types.js +2 -0
  90. package/dist/types.js.map +1 -0
  91. package/dist/util/fs.d.ts +6 -0
  92. package/dist/util/fs.d.ts.map +1 -0
  93. package/dist/util/fs.js +24 -0
  94. package/dist/util/fs.js.map +1 -0
  95. package/dist/util/paths.d.ts +16 -0
  96. package/dist/util/paths.d.ts.map +1 -0
  97. package/dist/util/paths.js +19 -0
  98. package/dist/util/paths.js.map +1 -0
  99. package/dist/visualize/html.d.ts +13 -0
  100. package/dist/visualize/html.d.ts.map +1 -0
  101. package/dist/visualize/html.js +374 -0
  102. package/dist/visualize/html.js.map +1 -0
  103. package/dist/visualize/stats.d.ts +21 -0
  104. package/dist/visualize/stats.d.ts.map +1 -0
  105. package/dist/visualize/stats.js +45 -0
  106. package/dist/visualize/stats.js.map +1 -0
  107. package/documents.json +64 -0
  108. package/package.json +65 -0
  109. package/scaffold/.ai-spector/.docflow/config/analyze.graphify.json +40 -0
  110. package/scaffold/.ai-spector/.docflow/config/completeness-rules.basic-design.json +18 -0
  111. package/scaffold/.ai-spector/.docflow/config/completeness-rules.detail-design.json +57 -0
  112. package/scaffold/.ai-spector/.docflow/config/completeness-rules.srs.json +72 -0
  113. package/scaffold/.ai-spector/.docflow/config/dag.basic-design.json +38 -0
  114. package/scaffold/.ai-spector/.docflow/config/dag.detail-design.json +64 -0
  115. package/scaffold/.ai-spector/.docflow/config/dag.srs.json +87 -0
  116. package/scaffold/.ai-spector/.docflow/config/data-source.json +5 -0
  117. package/scaffold/.ai-spector/.docflow/config/index.docs.json +22 -0
  118. package/scaffold/.ai-spector/.docflow/config/workflow.dependencies.json +271 -0
  119. package/scaffold/.ai-spector/.docflow/extract/patch.example.json +20 -0
  120. package/scaffold/.ai-spector/.docflow/state.json +11 -0
  121. package/scaffold/.ai-spector/docflow.config.json +7 -0
  122. package/scaffold/.ai-spector/index/README.md +18 -0
  123. package/scaffold/.ai-spector/index/basic-design.md +5 -0
  124. package/scaffold/.ai-spector/index/srs.md +5 -0
  125. package/scaffold/.cursor/commands/_cli-failures.md +110 -0
  126. package/scaffold/.cursor/commands/_graph.md +48 -0
  127. package/scaffold/.cursor/commands/_prerequisites.md +48 -0
  128. package/scaffold/.cursor/commands/_workflow.md +50 -0
  129. package/scaffold/.cursor/commands/analyze.md +92 -0
  130. package/scaffold/.cursor/commands/generate-basic-design.md +26 -0
  131. package/scaffold/.cursor/commands/generate-detail-design.md +19 -0
  132. package/scaffold/.cursor/commands/generate-srs.md +63 -0
  133. package/scaffold/.cursor/commands/graph-impact.md +45 -0
  134. package/scaffold/.cursor/commands/index-docs.md +36 -0
  135. package/scaffold/.cursor/commands/sync-graph.md +30 -0
  136. package/scaffold/.cursor/commands/validate-graph.md +28 -0
  137. package/scaffold/.cursor/commands/visualize-graph.md +24 -0
  138. package/scaffold/.cursor/skills/ai-spector/SKILL.md +39 -0
  139. package/scaffold/docs/data-source/README.md +7 -0
  140. package/schemas/rules.impact.json +17 -0
  141. package/schemas/rules.traceability.json +30 -0
  142. package/schemas/schema.extract-patch.json +19 -0
  143. package/schemas/schema.graph.json +83 -0
  144. package/schemas/schema.knowledge.json +107 -0
  145. package/templates/basic_design/db-design-template.md +177 -0
  146. package/templates/basic_design/detail-api-template.md +278 -0
  147. package/templates/basic_design/detail-screen-template.md +281 -0
  148. package/templates/basic_design/list-api-template.md +130 -0
  149. package/templates/basic_design/list-screen-template.md +242 -0
  150. package/templates/detail_design/common/architecture-overview-template.md +302 -0
  151. package/templates/detail_design/common/deployment-infrastructure-template.md +461 -0
  152. package/templates/detail_design/common/error-handling-patterns-template.md +460 -0
  153. package/templates/detail_design/common/integration-patterns-template.md +410 -0
  154. package/templates/detail_design/common/performance-standards-template.md +406 -0
  155. package/templates/detail_design/common/security-patterns-template.md +395 -0
  156. package/templates/detail_design/feature-detail-design-template.md +773 -0
  157. package/templates/detail_design/feature-list-template.md +39 -0
  158. package/templates/srs/1-introduction.md +58 -0
  159. package/templates/srs/2-overall-description.md +91 -0
  160. package/templates/srs/3-use-case-detail-template.md +142 -0
  161. package/templates/srs/3-use-cases.md +53 -0
  162. package/templates/srs/4-system-feature-detail-template.md +131 -0
  163. package/templates/srs/4-system-features-list-template.md +39 -0
  164. package/templates/srs/5-data-requirements.md +59 -0
  165. package/templates/srs/6-external-interfaces.md +56 -0
  166. package/templates/srs/7-quality-attributes.md +74 -0
  167. package/templates/srs/8-internationalization.md +36 -0
  168. package/templates/srs/9-other-requirements.md +46 -0
@@ -0,0 +1,57 @@
1
+ {
2
+ "version": 1,
3
+ "defaultChecks": {
4
+ "disallowPlaceholders": [
5
+ "<",
6
+ "TODO",
7
+ "TBD"
8
+ ],
9
+ "requireNonEmptyTables": true,
10
+ "validateMarkdownLinks": true
11
+ },
12
+ "rules": [
13
+ {
14
+ "target": "feature-list.md",
15
+ "requiredHeadings": [
16
+ "# Detail Design: Feature List",
17
+ "## 1. List of Features"
18
+ ]
19
+ },
20
+ {
21
+ "target": "common/architecture-overview.md",
22
+ "requiredHeadings": [
23
+ "# Architecture Overview"
24
+ ]
25
+ },
26
+ {
27
+ "target": "common/security-patterns.md",
28
+ "requiredHeadings": [
29
+ "# Security Patterns"
30
+ ]
31
+ },
32
+ {
33
+ "target": "common/error-handling-patterns.md",
34
+ "requiredHeadings": [
35
+ "# Error Handling Patterns"
36
+ ]
37
+ },
38
+ {
39
+ "target": "common/performance-standards.md",
40
+ "requiredHeadings": [
41
+ "# Performance Standards"
42
+ ]
43
+ },
44
+ {
45
+ "target": "common/integration-patterns.md",
46
+ "requiredHeadings": [
47
+ "# Integration Patterns"
48
+ ]
49
+ },
50
+ {
51
+ "target": "common/deployment-infrastructure.md",
52
+ "requiredHeadings": [
53
+ "# Deployment and Infrastructure"
54
+ ]
55
+ }
56
+ ]
57
+ }
@@ -0,0 +1,72 @@
1
+ {
2
+ "version": 1,
3
+ "defaultChecks": {
4
+ "disallowPlaceholders": [
5
+ "<",
6
+ "TODO",
7
+ "TBD"
8
+ ],
9
+ "requireNonEmptyTables": true,
10
+ "validateMarkdownLinks": true
11
+ },
12
+ "rules": [
13
+ {
14
+ "target": "1-introduction.md",
15
+ "requiredHeadings": [
16
+ "## 1. Introduction",
17
+ "### 1.1 Document Purpose",
18
+ "### 1.3 Project Scope"
19
+ ]
20
+ },
21
+ {
22
+ "target": "2-overall-description.md",
23
+ "requiredHeadings": [
24
+ "## 2. Overall Description"
25
+ ]
26
+ },
27
+ {
28
+ "target": "3-use-cases.md",
29
+ "requiredHeadings": [
30
+ "## 3. Use Cases",
31
+ "### 3.1 Use Case Diagrams",
32
+ "### 3.2 List Use Case"
33
+ ]
34
+ },
35
+ {
36
+ "target": "4-system-features.md",
37
+ "requiredHeadings": [
38
+ "## 4. System Features"
39
+ ]
40
+ },
41
+ {
42
+ "target": "5-data-requirements.md",
43
+ "requiredHeadings": [
44
+ "## 5. Data Requirements"
45
+ ]
46
+ },
47
+ {
48
+ "target": "6-external-interfaces.md",
49
+ "requiredHeadings": [
50
+ "## 6. External Interface Requirements"
51
+ ]
52
+ },
53
+ {
54
+ "target": "7-quality-attributes.md",
55
+ "requiredHeadings": [
56
+ "## 7. Quality Attributes"
57
+ ]
58
+ },
59
+ {
60
+ "target": "8-internationalization.md",
61
+ "requiredHeadings": [
62
+ "## 8. Internationalization and Localization"
63
+ ]
64
+ },
65
+ {
66
+ "target": "9-other-requirements.md",
67
+ "requiredHeadings": [
68
+ "## 9. Other Requirements"
69
+ ]
70
+ }
71
+ ]
72
+ }
@@ -0,0 +1,38 @@
1
+ {
2
+ "version": 1,
3
+ "root": "docs/basic-design",
4
+ "nodes": [
5
+ {
6
+ "id": "bd.db-design",
7
+ "template": "basic_design/db-design-template.md",
8
+ "output": "db-design.md",
9
+ "dependsOn": []
10
+ },
11
+ {
12
+ "id": "bd.list-api",
13
+ "template": "basic_design/list-api-template.md",
14
+ "output": "api-list.md",
15
+ "dependsOn": []
16
+ },
17
+ {
18
+ "id": "bd.detail-api",
19
+ "template": "basic_design/detail-api-template.md",
20
+ "output": "api/",
21
+ "dependsOn": ["bd.list-api"],
22
+ "mode": "perEndpoint"
23
+ },
24
+ {
25
+ "id": "bd.list-screen",
26
+ "template": "basic_design/list-screen-template.md",
27
+ "output": "screens/list-screens.md",
28
+ "dependsOn": []
29
+ },
30
+ {
31
+ "id": "bd.detail-screen",
32
+ "template": "basic_design/detail-screen-template.md",
33
+ "output": "screens/",
34
+ "dependsOn": ["bd.list-screen"],
35
+ "mode": "perScreen"
36
+ }
37
+ ]
38
+ }
@@ -0,0 +1,64 @@
1
+ {
2
+ "version": 1,
3
+ "root": "docs/detail-design",
4
+ "nodes": [
5
+ {
6
+ "id": "dd.common.architecture-overview",
7
+ "template": "detail_design/common/architecture-overview-template.md",
8
+ "output": "common/architecture-overview.md",
9
+ "dependsOn": []
10
+ },
11
+ {
12
+ "id": "dd.common.security-patterns",
13
+ "template": "detail_design/common/security-patterns-template.md",
14
+ "output": "common/security-patterns.md",
15
+ "dependsOn": []
16
+ },
17
+ {
18
+ "id": "dd.common.error-handling",
19
+ "template": "detail_design/common/error-handling-patterns-template.md",
20
+ "output": "common/error-handling-patterns.md",
21
+ "dependsOn": []
22
+ },
23
+ {
24
+ "id": "dd.common.performance-standards",
25
+ "template": "detail_design/common/performance-standards-template.md",
26
+ "output": "common/performance-standards.md",
27
+ "dependsOn": []
28
+ },
29
+ {
30
+ "id": "dd.common.integration-patterns",
31
+ "template": "detail_design/common/integration-patterns-template.md",
32
+ "output": "common/integration-patterns.md",
33
+ "dependsOn": []
34
+ },
35
+ {
36
+ "id": "dd.common.deployment",
37
+ "template": "detail_design/common/deployment-infrastructure-template.md",
38
+ "output": "common/deployment-infrastructure.md",
39
+ "dependsOn": []
40
+ },
41
+ {
42
+ "id": "dd.feature-list",
43
+ "template": "detail_design/feature-list-template.md",
44
+ "output": "feature-list.md",
45
+ "dependsOn": [
46
+ "dd.common.architecture-overview",
47
+ "dd.common.security-patterns",
48
+ "dd.common.error-handling",
49
+ "dd.common.performance-standards",
50
+ "dd.common.integration-patterns",
51
+ "dd.common.deployment"
52
+ ]
53
+ },
54
+ {
55
+ "id": "dd.feature-details",
56
+ "template": "detail_design/feature-detail-design-template.md",
57
+ "output": "features/",
58
+ "dependsOn": [
59
+ "dd.feature-list"
60
+ ],
61
+ "mode": "perFeature"
62
+ }
63
+ ]
64
+ }
@@ -0,0 +1,87 @@
1
+ {
2
+ "version": 1,
3
+ "root": "docs/srs",
4
+ "nodes": [
5
+ {
6
+ "id": "srs.introduction",
7
+ "template": "srs/1-introduction.md",
8
+ "output": "1-introduction.md",
9
+ "dependsOn": []
10
+ },
11
+ {
12
+ "id": "srs.overall-description",
13
+ "template": "srs/2-overall-description.md",
14
+ "output": "2-overall-description.md",
15
+ "dependsOn": []
16
+ },
17
+ {
18
+ "id": "srs.use-cases",
19
+ "template": "srs/3-use-cases.md",
20
+ "output": "3-use-cases.md",
21
+ "dependsOn": [
22
+ "srs.introduction",
23
+ "srs.overall-description"
24
+ ]
25
+ },
26
+ {
27
+ "id": "srs.features-list",
28
+ "template": "srs/4-system-features-list-template.md",
29
+ "output": "4-system-features.md",
30
+ "dependsOn": [
31
+ "srs.use-cases"
32
+ ]
33
+ },
34
+ {
35
+ "id": "srs.feature-details",
36
+ "template": "srs/4-system-feature-detail-template.md",
37
+ "output": "features/",
38
+ "dependsOn": [
39
+ "srs.features-list"
40
+ ],
41
+ "mode": "perFeature"
42
+ },
43
+ {
44
+ "id": "srs.data-requirements",
45
+ "template": "srs/5-data-requirements.md",
46
+ "output": "5-data-requirements.md",
47
+ "dependsOn": [
48
+ "srs.feature-details"
49
+ ]
50
+ },
51
+ {
52
+ "id": "srs.external-interfaces",
53
+ "template": "srs/6-external-interfaces.md",
54
+ "output": "6-external-interfaces.md",
55
+ "dependsOn": [
56
+ "srs.feature-details"
57
+ ]
58
+ },
59
+ {
60
+ "id": "srs.quality-attributes",
61
+ "template": "srs/7-quality-attributes.md",
62
+ "output": "7-quality-attributes.md",
63
+ "dependsOn": [
64
+ "srs.data-requirements",
65
+ "srs.external-interfaces"
66
+ ]
67
+ },
68
+ {
69
+ "id": "srs.internationalization",
70
+ "template": "srs/8-internationalization.md",
71
+ "output": "8-internationalization.md",
72
+ "dependsOn": [
73
+ "srs.data-requirements",
74
+ "srs.external-interfaces"
75
+ ]
76
+ },
77
+ {
78
+ "id": "srs.other-requirements",
79
+ "template": "srs/9-other-requirements.md",
80
+ "output": "9-other-requirements.md",
81
+ "dependsOn": [
82
+ "srs.data-requirements",
83
+ "srs.external-interfaces"
84
+ ]
85
+ }
86
+ ]
87
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "version": 1,
3
+ "defaultRoot": "docs/data-source",
4
+ "description": "Primary input materials for /analyze, /generate-srs, and /generate-basic-design (specs, notes, exports, diagrams, legacy docs)."
5
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "version": 1,
3
+ "outputs": {
4
+ "srs": ".ai-spector/index/srs.md",
5
+ "basicDesign": ".ai-spector/index/basic-design.md"
6
+ },
7
+ "sources": {
8
+ "srs": {
9
+ "root": "docs/srs",
10
+ "dag": ".ai-spector/.docflow/config/dag.srs.json",
11
+ "glob": "**/*.md"
12
+ },
13
+ "basicDesign": {
14
+ "root": "docs/basic-design",
15
+ "glob": "**/*.md"
16
+ }
17
+ },
18
+ "entryFormat": {
19
+ "heading": "## File: {basename}",
20
+ "fields": ["location", "metadata", "summary"]
21
+ }
22
+ }
@@ -0,0 +1,271 @@
1
+ {
2
+ "version": 1,
3
+ "indexes": {
4
+ "srs": ".ai-spector/index/srs.md",
5
+ "basicDesign": ".ai-spector/index/basic-design.md"
6
+ },
7
+ "indexPlaceholderMarkers": ["not yet run", "No entries yet"],
8
+ "messageFormat": {
9
+ "title": "Cannot run {command}",
10
+ "sections": ["missing", "doFirst", "optionalNext", "why"]
11
+ },
12
+ "steps": {
13
+ "analyze": {
14
+ "command": "/analyze",
15
+ "requires": [],
16
+ "checks": [
17
+ {
18
+ "id": "data-source-dir",
19
+ "type": "pathExists",
20
+ "path": "docs/data-source",
21
+ "fail": "Directory docs/data-source/ does not exist."
22
+ },
23
+ {
24
+ "id": "data-source-inputs",
25
+ "type": "hasFiles",
26
+ "path": "docs/data-source",
27
+ "glob": "**/*",
28
+ "min": 1,
29
+ "ignore": ["README.md", ".gitkeep"],
30
+ "fail": "No input files in docs/data-source/ (only README or empty folder)."
31
+ }
32
+ ],
33
+ "onSuccess": {
34
+ "optionalNext": ["/validate-graph", "/generate-srs"]
35
+ }
36
+ },
37
+ "validate-graph": {
38
+ "command": "/validate-graph",
39
+ "requires": ["analyze"],
40
+ "checks": [
41
+ {
42
+ "id": "graph-file",
43
+ "type": "pathExists",
44
+ "path": ".ai-spector/graph/traceability.graph.json",
45
+ "fail": "Missing traceability graph — run ai-spector analyze first."
46
+ }
47
+ ],
48
+ "onSuccess": {
49
+ "optionalNext": ["/generate-srs"]
50
+ }
51
+ },
52
+ "generate-srs": {
53
+ "command": "/generate-srs",
54
+ "requires": ["analyze"],
55
+ "checks": [
56
+ {
57
+ "id": "analysis-last-run",
58
+ "type": "stateNotNull",
59
+ "field": "analysis.lastRunAt",
60
+ "fail": "Analysis has never completed (analysis.lastRunAt is null)."
61
+ },
62
+ {
63
+ "id": "graph-file",
64
+ "type": "pathExists",
65
+ "path": ".ai-spector/graph/traceability.graph.json",
66
+ "fail": "Missing traceability graph — run ai-spector analyze and /analyze."
67
+ },
68
+ {
69
+ "id": "graph-merged",
70
+ "type": "stateNotNull",
71
+ "field": "analysis.graphMergedAt",
72
+ "fail": "Knowledge not merged into graph — run /analyze and commit domain nodes to traceability.graph.json."
73
+ },
74
+ {
75
+ "id": "knowledge-file",
76
+ "type": "pathExists",
77
+ "path": ".ai-spector/.docflow/analysis/knowledge.json",
78
+ "fail": "Missing knowledge.json — run /analyze first."
79
+ }
80
+ ],
81
+ "usesGraph": true,
82
+ "onBlock": {
83
+ "doFirst": [
84
+ "Add or update files in docs/data-source/",
85
+ "Run ai-spector analyze",
86
+ "Run /analyze (merge into graph)",
87
+ "Run /validate-graph"
88
+ ]
89
+ },
90
+ "onSuccess": {
91
+ "optionalNext": ["/index-docs srs", "/generate-basic-design"],
92
+ "why": "Use graph_neighbors for downstream generate; index is optional fallback."
93
+ }
94
+ },
95
+ "index-docs-srs": {
96
+ "command": "/index-docs srs",
97
+ "requires": [],
98
+ "checks": [
99
+ {
100
+ "id": "srs-any-files",
101
+ "type": "hasFiles",
102
+ "path": "docs/srs",
103
+ "glob": "**/*.md",
104
+ "min": 0,
105
+ "warnIfBelow": 1,
106
+ "warn": "No SRS files under docs/srs/ yet — index will be empty."
107
+ }
108
+ ],
109
+ "onWarn": {
110
+ "doFirst": ["/generate-srs"],
111
+ "why": "Indexing is allowed but summaries need generated SRS files."
112
+ }
113
+ },
114
+ "generate-basic-design": {
115
+ "command": "/generate-basic-design",
116
+ "requires": ["analyze", "generate-srs-minimum"],
117
+ "checks": [
118
+ {
119
+ "id": "analysis-last-run",
120
+ "type": "stateNotNull",
121
+ "field": "analysis.lastRunAt",
122
+ "fail": "Analysis has never completed."
123
+ },
124
+ {
125
+ "id": "knowledge-populated",
126
+ "type": "jsonAnyNonEmpty",
127
+ "path": ".ai-spector/.docflow/analysis/knowledge.json",
128
+ "keys": ["actors", "useCases", "features", "functionalRequirements"],
129
+ "fail": "knowledge.json is empty or missing — run /analyze first."
130
+ },
131
+ {
132
+ "id": "srs-minimum",
133
+ "type": "allPathsExist",
134
+ "paths": [
135
+ "docs/srs/1-introduction.md",
136
+ "docs/srs/4-system-features.md"
137
+ ],
138
+ "fail": "Minimum SRS outputs missing (need introduction and system features list)."
139
+ },
140
+ {
141
+ "id": "srs-index-file",
142
+ "type": "pathExists",
143
+ "path": ".ai-spector/index/srs.md",
144
+ "fail": "SRS index missing at .ai-spector/index/srs.md — run /index-docs srs first."
145
+ },
146
+ {
147
+ "id": "srs-index-populated",
148
+ "type": "indexPopulated",
149
+ "path": ".ai-spector/index/srs.md",
150
+ "fail": "SRS index is empty or placeholder — run /index-docs srs after SRS files exist."
151
+ }
152
+ ],
153
+ "usesGraph": true,
154
+ "usesIndex": [".ai-spector/index/srs.md"],
155
+ "onBlock": {
156
+ "doFirst": [
157
+ "Run /validate-graph",
158
+ "Run /generate-srs until minimum SRS exists",
159
+ "Use graph_neighbors from target feature ids"
160
+ ],
161
+ "optionalNext": ["/index-docs basic-design"]
162
+ },
163
+ "onSuccess": {
164
+ "requiredNext": ["/index-docs basic-design"],
165
+ "why": "Refresh .ai-spector/index/basic-design.md before /generate-detail-design."
166
+ }
167
+ },
168
+ "index-docs-basic-design": {
169
+ "command": "/index-docs basic-design",
170
+ "requires": [],
171
+ "checks": [
172
+ {
173
+ "id": "basic-design-any-files",
174
+ "type": "hasFiles",
175
+ "path": "docs/basic-design",
176
+ "glob": "**/*.md",
177
+ "min": 0,
178
+ "warnIfBelow": 1,
179
+ "warn": "No basic design files under docs/basic-design/ yet."
180
+ }
181
+ ],
182
+ "onWarn": {
183
+ "doFirst": ["/generate-basic-design"],
184
+ "why": "Indexing is allowed but summaries need generated basic design files."
185
+ }
186
+ },
187
+ "generate-detail-design": {
188
+ "command": "/generate-detail-design",
189
+ "requires": ["analyze", "generate-srs-minimum"],
190
+ "checks": [
191
+ {
192
+ "id": "analysis-last-run",
193
+ "type": "stateNotNull",
194
+ "field": "analysis.lastRunAt",
195
+ "fail": "Analysis has never completed."
196
+ },
197
+ {
198
+ "id": "knowledge-populated",
199
+ "type": "jsonAnyNonEmpty",
200
+ "path": ".ai-spector/.docflow/analysis/knowledge.json",
201
+ "keys": ["features", "functionalRequirements"],
202
+ "fail": "knowledge.json lacks feature/requirement data — run /analyze first."
203
+ },
204
+ {
205
+ "id": "srs-minimum",
206
+ "type": "allPathsExist",
207
+ "paths": [
208
+ "docs/srs/1-introduction.md",
209
+ "docs/srs/4-system-features.md"
210
+ ],
211
+ "fail": "Required SRS files missing for detail design."
212
+ },
213
+ {
214
+ "id": "srs-index-populated",
215
+ "type": "indexPopulated",
216
+ "path": ".ai-spector/index/srs.md",
217
+ "fail": "SRS index not built — run /index-docs srs before detail design."
218
+ },
219
+ {
220
+ "id": "basic-design-index-when-outputs-exist",
221
+ "type": "indexPopulatedIfSourceHasFiles",
222
+ "indexPath": ".ai-spector/index/basic-design.md",
223
+ "sourcePath": "docs/basic-design",
224
+ "sourceGlob": "**/*.md",
225
+ "fail": "Basic design outputs exist but .ai-spector/index/basic-design.md is missing or placeholder — run /index-docs basic-design."
226
+ }
227
+ ],
228
+ "usesGraph": true,
229
+ "usesIndex": [
230
+ ".ai-spector/index/srs.md",
231
+ ".ai-spector/index/basic-design.md"
232
+ ],
233
+ "onBlock": {
234
+ "doFirst": [
235
+ "Run /validate-graph",
236
+ "Run /generate-srs",
237
+ "graph_neighbors from feature seeds",
238
+ "Run /generate-basic-design if needed"
239
+ ],
240
+ "optionalNext": []
241
+ }
242
+ },
243
+ "index-docs": {
244
+ "command": "/index-docs",
245
+ "requires": [],
246
+ "checks": [],
247
+ "onWarn": {
248
+ "note": "Runs even when outputs are empty; warns per collection when no files found."
249
+ }
250
+ }
251
+ },
252
+ "pipeline": [
253
+ "analyze",
254
+ "generate-srs",
255
+ "index-docs-srs",
256
+ "generate-basic-design",
257
+ "index-docs-basic-design",
258
+ "generate-detail-design"
259
+ ],
260
+ "graphUsage": {
261
+ "rule": "Before opening docs under docs/srs/ or docs/basic-design/, run graph_neighbors from the task seed id and load only projectionPaths and referenced sources from the result. See .cursor/commands/_graph.md.",
262
+ "validateBeforeGenerate": "/validate-graph",
263
+ "afterEdit": "/graph-impact",
264
+ "reconcileProjections": "/sync-graph"
265
+ },
266
+ "indexUsage": {
267
+ "rule": "Fallback only when graph domain nodes are missing or graph_neighbors returns an empty subgraph. Otherwise prefer graphUsage.rule.",
268
+ "afterGenerateSrs": "/index-docs srs",
269
+ "afterGenerateBasicDesign": "/index-docs basic-design"
270
+ }
271
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "version": 1,
3
+ "nodes": [
4
+ { "id": "UC-01", "type": "useCase", "title": "Place order", "priority": "High" },
5
+ { "id": "F-01", "type": "feature", "title": "Checkout" }
6
+ ],
7
+ "edges": [
8
+ {
9
+ "type": "listedIn",
10
+ "from": "UC-01",
11
+ "to": "sec.srs.3-use-cases.l3.3.32-list-use-case"
12
+ },
13
+ {
14
+ "type": "listedIn",
15
+ "from": "F-01",
16
+ "to": "sec.srs.4-system-features.l3.3.42-list-of-system-features"
17
+ },
18
+ { "type": "satisfies", "from": "F-01", "to": "UC-01" }
19
+ ]
20
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "version": 1,
3
+ "initializedAt": null,
4
+ "analysis": {
5
+ "lastRunAt": null,
6
+ "graphPreparedAt": null
7
+ },
8
+ "index": {
9
+ "lastRunAt": null
10
+ }
11
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 1,
3
+ "paths": {
4
+ "graph": ".ai-spector/graph/traceability.graph.json",
5
+ "registry": ".ai-spector/registry/section-registry.json"
6
+ }
7
+ }
@@ -0,0 +1,18 @@
1
+ # Document indexes
2
+
3
+ Generated by `/index-docs` into this folder only. Do not edit by hand — re-run after SRS or basic design changes.
4
+
5
+ | File | Source root | Required before |
6
+ |------|-------------|-----------------|
7
+ | `srs.md` | `docs/srs/` | `/generate-basic-design`, `/generate-detail-design` |
8
+ | `basic-design.md` | `docs/basic-design/` | `/generate-detail-design` (when basic design outputs exist) |
9
+
10
+ ## How downstream commands use indexes
11
+
12
+ 1. Read the index file(s) here first.
13
+ 2. Choose relevant entries by `summary` and `metadata` (topics, `dependsOn`, `relatedSrs`).
14
+ 3. Open only the `location` paths listed — not the whole `docs/srs/` or `docs/basic-design/` tree.
15
+
16
+ Placeholder text (`not yet run`, `No entries yet`) means `/index-docs` must be run before generation commands will proceed.
17
+
18
+ Input materials live in `docs/data-source/` (not indexed here).