ai-spector 0.3.0 → 0.3.2

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 (84) hide show
  1. package/README.md +136 -14
  2. package/dist/cli.js +97 -0
  3. package/dist/cli.js.map +1 -1
  4. package/dist/commands/comments.d.ts +41 -0
  5. package/dist/commands/comments.d.ts.map +1 -0
  6. package/dist/commands/comments.js +138 -0
  7. package/dist/commands/comments.js.map +1 -0
  8. package/dist/commands/init.d.ts +4 -0
  9. package/dist/commands/init.d.ts.map +1 -1
  10. package/dist/commands/init.js +22 -5
  11. package/dist/commands/init.js.map +1 -1
  12. package/dist/commands/sync-cursor.d.ts +6 -0
  13. package/dist/commands/sync-cursor.d.ts.map +1 -0
  14. package/dist/commands/sync-cursor.js +18 -0
  15. package/dist/commands/sync-cursor.js.map +1 -0
  16. package/dist/comments/anchor.d.ts +16 -0
  17. package/dist/comments/anchor.d.ts.map +1 -0
  18. package/dist/comments/anchor.js +59 -0
  19. package/dist/comments/anchor.js.map +1 -0
  20. package/dist/comments/inbox.d.ts +83 -0
  21. package/dist/comments/inbox.d.ts.map +1 -0
  22. package/dist/comments/inbox.js +180 -0
  23. package/dist/comments/inbox.js.map +1 -0
  24. package/dist/comments/paths.d.ts +12 -0
  25. package/dist/comments/paths.d.ts.map +1 -0
  26. package/dist/comments/paths.js +54 -0
  27. package/dist/comments/paths.js.map +1 -0
  28. package/dist/comments/plan.d.ts +20 -0
  29. package/dist/comments/plan.d.ts.map +1 -0
  30. package/dist/comments/plan.js +62 -0
  31. package/dist/comments/plan.js.map +1 -0
  32. package/dist/comments/storage.d.ts +30 -0
  33. package/dist/comments/storage.d.ts.map +1 -0
  34. package/dist/comments/storage.js +272 -0
  35. package/dist/comments/storage.js.map +1 -0
  36. package/dist/comments/types.d.ts +54 -0
  37. package/dist/comments/types.d.ts.map +1 -0
  38. package/dist/comments/types.js +2 -0
  39. package/dist/comments/types.js.map +1 -0
  40. package/dist/config/load.d.ts +2 -0
  41. package/dist/config/load.d.ts.map +1 -1
  42. package/dist/config/load.js +4 -0
  43. package/dist/config/load.js.map +1 -1
  44. package/dist/graph/detail-sections.js +1 -1
  45. package/dist/graph/detail-sections.js.map +1 -1
  46. package/dist/graph/doc-extract.d.ts +9 -3
  47. package/dist/graph/doc-extract.d.ts.map +1 -1
  48. package/dist/graph/doc-extract.js +86 -58
  49. package/dist/graph/doc-extract.js.map +1 -1
  50. package/dist/postinstall.d.ts +3 -0
  51. package/dist/postinstall.d.ts.map +1 -0
  52. package/dist/postinstall.js +44 -0
  53. package/dist/postinstall.js.map +1 -0
  54. package/documents-basic-design.json +1 -1
  55. package/package.json +3 -5
  56. package/scaffold/.ai-spector/.docflow/config/dag.basic-design.graph-seeds.json +11 -7
  57. package/scaffold/.ai-spector/.docflow/config/dag.basic-design.json +1 -1
  58. package/scaffold/{.cursor → cursor}/commands/_generate-graph.md +10 -2
  59. package/scaffold/{.cursor → cursor}/commands/_workflow.md +7 -3
  60. package/scaffold/{.cursor → cursor}/commands/generate-basic-design.md +27 -17
  61. package/scaffold/cursor/commands/resolve-comments.md +145 -0
  62. package/scaffold/cursor/skills/_skill-router.md +22 -0
  63. package/scaffold/cursor/skills/ai-spector/SKILL.md +47 -0
  64. package/scaffold/cursor/skills/ai-spector-generate/SKILL.md +41 -0
  65. package/scaffold/cursor/skills/ai-spector-graph/SKILL.md +39 -0
  66. package/scaffold/cursor/skills/ai-spector-resolve-comments/SKILL.md +42 -0
  67. package/templates/basic_design/detail-api-template.md +2 -2
  68. package/templates/basic_design/detail-screen-template.md +2 -2
  69. package/scaffold/.cursor/skills/ai-spector/SKILL.md +0 -62
  70. /package/scaffold/{.cursor → cursor}/commands/_cli-failures.md +0 -0
  71. /package/scaffold/{.cursor → cursor}/commands/_graph.md +0 -0
  72. /package/scaffold/{.cursor → cursor}/commands/_prerequisites.md +0 -0
  73. /package/scaffold/{.cursor → cursor}/commands/analyze.md +0 -0
  74. /package/scaffold/{.cursor → cursor}/commands/generate-detail-design.md +0 -0
  75. /package/scaffold/{.cursor → cursor}/commands/generate-srs.md +0 -0
  76. /package/scaffold/{.cursor → cursor}/commands/graph-impact.md +0 -0
  77. /package/scaffold/{.cursor → cursor}/commands/impact.md +0 -0
  78. /package/scaffold/{.cursor → cursor}/commands/index.md +0 -0
  79. /package/scaffold/{.cursor → cursor}/commands/link-graph.md +0 -0
  80. /package/scaffold/{.cursor → cursor}/commands/summary.md +0 -0
  81. /package/scaffold/{.cursor → cursor}/commands/sync-graph.md +0 -0
  82. /package/scaffold/{.cursor → cursor}/commands/validate-graph.md +0 -0
  83. /package/scaffold/{.cursor → cursor}/commands/visualize-graph.md +0 -0
  84. /package/scaffold/{.cursor → cursor}/mcp.json +0 -0
@@ -28,7 +28,7 @@ Arguments are **file paths** (case 2) or **free-text** (case 3). Paths are under
28
28
  | # | DAG id | Output | Query seed | Reason | Prerequisites |
29
29
  |---|--------|--------|------------|--------|---------------|
30
30
  | 1 | `bd.list-api` | `docs/basic-design/api-list.md` | `doc.srs.6-external-interfaces` | “API list” | SRS §6 if missing |
31
- | 2 | `bd.detail-api` | `docs/basic-design/api/…` | `F-01`, | “APIs for feature X” | `bd.list-api`, SRS features |
31
+ | 2 | `bd.detail-api` | `docs/basic-design/api/…` | rows in `api-list.md` §3 | “API detail for each endpoint” | `bd.list-api`, SRS §6 |
32
32
 
33
33
  3. Include **dependency closure** from `dag.basic-design.json` and missing SRS files (minimum: introduction + features per `workflow.dependencies.json`).
34
34
  4. Ask:
@@ -39,7 +39,7 @@ Reply **yes** to proceed, **no** to cancel, or edit the list.
39
39
  ```
40
40
 
41
41
  5. **Stop** without user confirmation.
42
- 6. Clarify ambiguity early (e.g. “all API details” = every `F-xx` vs one feature; “screens” = list vs all screen detail files).
42
+ 6. Clarify ambiguity early (e.g. “all API details” = every endpoint row in `api-list.md` vs one endpoint; “screens” = list vs every row in Screen Index).
43
43
 
44
44
  ### Intent → DAG hints
45
45
 
@@ -47,10 +47,11 @@ Reply **yes** to proceed, **no** to cancel, or edit the list.
47
47
  |------------------------|------------------------|
48
48
  | database, DB, ERD, data model | `bd.db-design` → `db-design.md` |
49
49
  | API list, endpoints overview | `bd.list-api` → `api-list.md` |
50
- | API detail, per endpoint, REST | `bd.detail-api` → `docs/basic-design/api/` (per feature / endpoint) |
51
- | screen list, UI list | `bd.list-screen` → `screens/list-screens.md` |
52
- | screen detail, wireframe, per screen | `bd.detail-screen` → `docs/basic-design/screens/` |
53
- | one feature, F-01, checkout | `F-01` seeds for api/screen detail under that feature |
50
+ | API detail, per endpoint, REST | `bd.detail-api` → `docs/basic-design/api/` (one file per endpoint row in `api-list.md` §3) |
51
+ | screen list, UI list | `bd.list-screen` → `docs/basic-design/list-screens.md` |
52
+ | screen detail, wireframe, per screen | `bd.detail-screen` → `docs/basic-design/screens/` (one file per Screen Index row) |
53
+ | one endpoint, POST /checkout | that endpoint’s row in `api-list.md` matching `api/<slug>.md` |
54
+ | one screen, login, dashboard | that screen’s row in `list-screens.md` → matching `screens/<slug>.md` |
54
55
  | everything, full basic design | Case 1 — full DAG |
55
56
 
56
57
  ## Prerequisites
@@ -81,9 +82,10 @@ ai-spector graph validate
81
82
  2. Topological sort selected nodes + dependency ancestors (`bd.detail-api` after `bd.list-api`, etc.).
82
83
  3. Map seeds via `dag.basic-design.graph-seeds.json`:
83
84
  - Chapter artifacts → `documentNodes` id for ingest + SRS seed for **query**
84
- - `perEndpoint` / `perScreen` one target per `feature` (`F-xx`) from graph
85
+ - `perEndpoint` after `api-list.md` exists, one target per **endpoint row** in §3 Endpoint Summary (not per `F-xx`); output slug from method + path (e.g. `post-checkout.md`)
86
+ - `perScreen` → after `list-screens.md` exists, one target per **Screen Index** row (not per feature); output slug from screen name (e.g. `login.md`)
85
87
  4. Classify disk: `good` | `missing_content` | `missing_file`.
86
- 5. **Waves** — e.g. wave 0: `bd.db-design`, `bd.list-api`, `bd.list-screen` in parallel; wave 1: `bd.detail-api`; wave 2: `bd.detail-screen`.
88
+ 5. **Waves** — wave 0: `bd.db-design`, `bd.list-api`, `bd.list-screen` in parallel; wave 1: all `bd.detail-api` files in parallel; wave 2: all `bd.detail-screen` files in parallel. **After each wave:** merge + validate, then **`ai-spector index`** so list tables, section trees, and detail `doc.bd.*` nodes are in the graph before the next wave plans targets.
87
89
 
88
90
  ### 3. Per wave, then per target
89
91
 
@@ -97,7 +99,9 @@ ai-spector graph validate
97
99
  #### 3b. Write
98
100
 
99
101
  - Read DAG `template` files under **`.ai-spector/templates/`** (e.g. `.ai-spector/templates/basic_design/list-screen-template.md`). Missing folder → user must run `npx ai-spector init`.
100
- - Align API/screen names with graph `feature` titles and SRS feature detail files.
102
+ - **List chapters first** — endpoint and screen names come from `api-list.md` and `list-screens.md` tables; detail files reference SRS/features via Source Requirement when relevant, not one file per `F-xx`.
103
+ - **API detail** — one endpoint per file under `docs/basic-design/api/`; use `detail-api-template.md` for a single `METHOD /path` block.
104
+ - **Screen detail** — one screen per file under `docs/basic-design/screens/`; use `detail-screen-template.md` for a single `## N. Screen:` section.
101
105
 
102
106
  #### 3c. Ingest (mandatory before next wave)
103
107
 
@@ -121,9 +125,14 @@ Merge patch (include `documentNodes` from `dag.basic-design.graph-seeds.json` wh
121
125
  ```bash
122
126
  ai-spector graph merge .ai-spector/.docflow/extract/projection-patch.json
123
127
  ai-spector graph validate
128
+ ai-spector index
124
129
  ```
125
130
 
126
- Per-domain file: `rendersTo` from `F-xx` or `doc.bd.*` to actual path; `tracesTo` / `references` to SRS or API list as appropriate.
131
+ **Reindex every wave (mandatory):** run `ai-spector index` after merge + validate for that wave — not only at the end. Wave 0 index parses list-chapter sections (`doc.bd.list-api`, `doc.bd.list-screen`, `doc.bd.db-design`) from disk; wave 1+ index adds per-endpoint / per-screen `doc.bd.api-*` / `doc.bd.screen-*` nodes and `contains` edges from list chapters. Without reindex, wave 1 cannot reliably expand endpoint rows from `api-list.md` §3, and wave 2 cannot expand Screen Index rows from `list-screens.md`.
132
+
133
+ Use `ai-spector index --skip-graphify` when only markdown under `docs/basic-design/` changed (typical). Use `--force-graphify` only when `docs/data-source/` code paths must rebuild.
134
+
135
+ Per-endpoint / per-screen file: `rendersTo` from `doc.bd.api-*` or `doc.bd.screen-*` to actual path; `contains` from `doc.bd.list-api` / `doc.bd.list-screen`; optional `tracesTo` from related `F-xx` when Source Requirement cites a feature.
127
136
 
128
137
  #### 3d. Log
129
138
 
@@ -131,20 +140,21 @@ Append `.ai-spector/.docflow/logs/generate-basic-design.log`.
131
140
 
132
141
  ### 4. Finish
133
142
 
134
- - Final `graph validate`.
143
+ - If the last wave already ran `graph validate` + `ai-spector index`, a final validate is enough; otherwise run both again.
135
144
  - Suggest **`/summary basic-design`** (required by workflow before detail design).
136
145
 
137
146
  ## Waves (reference)
138
147
 
139
- | Wave | DAG nodes (parallel within wave) |
140
- |------|----------------------------------|
141
- | 0 | `bd.db-design`, `bd.list-api`, `bd.list-screen` |
142
- | 1 | `bd.detail-api` (+ per-feature API files) |
143
- | 2 | `bd.detail-screen` (+ per-feature screen files) |
148
+ | Wave | DAG nodes (parallel within wave) | After wave |
149
+ |------|----------------------------------|------------|
150
+ | 0 | `bd.db-design`, `bd.list-api`, `bd.list-screen` | merge → validate → **`ai-spector index`** |
151
+ | 1 | `bd.detail-api` (+ one file per api-list endpoint row) | merge → validate → **`ai-spector index`** |
152
+ | 2 | `bd.detail-screen` (+ one file per Screen Index row) | merge → validate → **`ai-spector index`** |
144
153
 
145
154
  ## Guardrails
146
155
 
147
- - **Parallel only within a wave** — never `bd.detail-api` before `bd.list-api` is ingested.
156
+ - **Parallel only within a wave** — never `bd.detail-api` before `bd.list-api` is ingested and **indexed**.
157
+ - **Reindex after every wave** — `graph merge` alone does not parse markdown bodies; `ai-spector index` is required before the next wave.
148
158
  - **Every target** gets `graph query` + dependency queries.
149
159
  - **Case 3** requires explicit user **yes** before writes.
150
160
  - Do not overwrite `good` without user intent.
@@ -0,0 +1,145 @@
1
+ # /resolve-comments
2
+
3
+ IDE-first workflow (Cursor) for **git-backed review comments** under `comments/`. Web reviewers create threads; you resolve locally: inbox in chat → pick thread → impact → propose edit → apply → commit (doc + resolve meta) → push.
4
+
5
+ No Writer API — storage is git-only (`meta_data.json` + `events.jsonl`).
6
+
7
+ ## Usage
8
+
9
+ | You say | Agent does |
10
+ |---------|------------|
11
+ | `/resolve-comments` | Inbox table in chat → wait for your pick |
12
+ | `/resolve-comments C-001` | Plan + impact for pick **C-001** |
13
+ | `/resolve-comments srs/01-overview` | Inbox filtered to that file |
14
+
15
+ ## IDE workflow (agent — follow in order)
16
+
17
+ ### Phase 0 — Sync
18
+
19
+ ```bash
20
+ git pull
21
+ ```
22
+
23
+ ### Phase 1 — Show thread pick list in chat (user selects)
24
+
25
+ ```bash
26
+ ai-spector comments inbox --json
27
+ ```
28
+
29
+ **IDE presentation (required):**
30
+
31
+ 1. Read `idePresentation.markdown` from JSON — render **only that markdown table** in chat.
32
+ 2. Follow `idePresentation.rules`: **one row per open thread**, not per reply; **no raw JSON**; **no thread uuids** in user-facing text.
33
+ 3. Use **pick ids** (`C-001`, `C-002`, …) for selection.
34
+
35
+ Example table (from CLI):
36
+
37
+ | Pick | Document | Lines | Lang | Reviewer ask |
38
+ |------|----------|-------|------|--------------|
39
+ | **C-001** | `docs/srs/01-overview.md` | 12-14 | EN | Please clarify… |
40
+
41
+ **Stop and ask:** “Which thread should we resolve? Reply with **C-00N**.”
42
+
43
+ Do not start editing until the user picks (unless they already passed `C-001` in the slash command).
44
+
45
+ **Do not use** `comments list` for user selection — use **`comments inbox`** only.
46
+
47
+ ### Phase 2 — Plan + impact (after pick)
48
+
49
+ ```bash
50
+ ai-spector comments plan C-001 --json
51
+ ```
52
+
53
+ **Show in chat:** full thread comments, anchored doc text, impact summary, regen targets.
54
+
55
+ ### Phase 3 — Propose edit (user approval required)
56
+
57
+ 1. Quote anchored lines + reviewer ask
58
+ 2. Propose concrete markdown change
59
+ 3. Ask: **“Apply this edit?”** — wait for explicit approval
60
+
61
+ ### Phase 4 — Apply edit
62
+
63
+ Edit `anchor.docPath` at lines `startLine`–`endLine`. Show diff summary in chat.
64
+
65
+ ### Phase 5 — Resolve status + single git commit (doc + comment meta)
66
+
67
+ Each resolve must land in git with **both** the **document fix** and **comment thread metadata** — never commit only `comments/` without the changed doc file.
68
+
69
+ **Steps:**
70
+
71
+ ```bash
72
+ # 1) Stage and commit doc fix first (establishes resolvedInCommitSha target)
73
+ git add docs/srs/....md
74
+ git commit -m "fix(docs): address comment C-001 on srs/01-overview lines 12-14"
75
+
76
+ # 2) Write resolve meta pointing at that doc commit
77
+ ai-spector comments resolve <threadId> --file srs/01-overview \
78
+ --expected-version <v from plan> --json
79
+
80
+ # 3) Stage comment meta AND re-include doc in the same final commit
81
+ git add comments/srs/01-overview/<threadId>/ docs/srs/....md
82
+ git commit --amend -m "fix(docs): address comment C-001 on srs/01-overview lines 12-14
83
+
84
+ Resolved thread <threadId>. Pick C-001."
85
+
86
+ git push
87
+ ```
88
+
89
+ **Why amend:** `comments resolve` needs HEAD after the doc commit for `resolvedInCommitSha`. Amending folds `meta_data.json` + `events.jsonl` into the **same commit** as the doc change so one push contains the full resolve.
90
+
91
+ **Commit must include:**
92
+
93
+ | Path | Content |
94
+ |------|---------|
95
+ | `docs/…` | Edited document (the fix) |
96
+ | `comments/…/{thread_id}/meta_data.json` | `status: resolved`, `resolvedInCommitSha`, … |
97
+ | `comments/…/{thread_id}/events.jsonl` | append `resolved` event |
98
+
99
+ **Never:** `git add` only `comments/` while doc changes stay unstaged or uncommitted.
100
+
101
+ If HEAD moved before resolve, pass `--commit-sha <doc-fix-sha>` explicitly.
102
+
103
+ ### Phase 6 — Optional follow-up
104
+
105
+ ```bash
106
+ ai-spector index
107
+ ```
108
+
109
+ Or targeted `/generate-srs` / `/generate-basic-design` when plan lists regen targets.
110
+
111
+ ## Multi-thread session
112
+
113
+ Re-run `comments inbox --json` → show `idePresentation.markdown` → ask for next pick.
114
+
115
+ ## Chat presentation rules
116
+
117
+ - Inbox: **`idePresentation.markdown` table only** (threads, not replies)
118
+ - Plan/impact: full detail after pick
119
+ - Commits: **doc file + comment meta together** (amend pattern above)
120
+ - Pick ids in chat; thread ids only in CLI args
121
+
122
+ ## CLI reference
123
+
124
+ | Command | Purpose |
125
+ |---------|---------|
126
+ | `comments inbox [--json]` | Thread pick list + `idePresentation` for chat |
127
+ | `comments plan C-001 [--json]` | Anchor excerpt + graph impact |
128
+ | `comments resolve <threadId> --file <path> [--expected-version]` | Update meta before final amend commit |
129
+
130
+ ## Guardrails
131
+
132
+ - No Writer API
133
+ - No resolve before doc edit is applied
134
+ - No commit with only metadata — **always include changed doc file**
135
+ - No push until amend commit contains doc + `comments/…/thread/`
136
+
137
+ ## If blocked
138
+
139
+ See [_cli-failures.md](./_cli-failures.md).
140
+
141
+ | Issue | Fix |
142
+ |-------|-----|
143
+ | Unknown C-00N | Re-run `comments inbox --json` |
144
+ | Stale version | Re-run `comments plan`, refresh `--expected-version` |
145
+ | Doc missing from commit | `git status` — stage `docs/…` before amend |
@@ -0,0 +1,22 @@
1
+ # AI Spector skill router
2
+
3
+ Cursor loads skills by **description** when the user does not use a slash command. Enable **all** skills under `.cursor/skills/` after `init`.
4
+
5
+ ## Skills
6
+
7
+ | Skill folder | When Cursor should use it |
8
+ |--------------|---------------------------|
9
+ | `ai-spector` | Any ai-spector / docflow / `.ai-spector` project work; shared CLI rules |
10
+ | `ai-spector-graph` | Analyze, index, validate, impact, visualize, Graphify, knowledge.json, regen scope |
11
+ | `ai-spector-generate` | Generate or update SRS, basic design, detail design under `docs/` |
12
+ | `ai-spector-resolve-comments` | Review comments in `comments/`, resolve threads, C-001 pick list |
13
+
14
+ ## Slash commands (explicit)
15
+
16
+ When the user runs `/analyze`, `/generate-srs`, `/resolve-comments`, etc., read the matching file in `.cursor/commands/` — skills and commands share the same rules.
17
+
18
+ ## Priority
19
+
20
+ 1. Explicit slash command → `commands/<name>.md`
21
+ 2. Natural language → task skill above + same command doc when one exists
22
+ 3. Ambiguous → `ai-spector` core + ask which task (graph vs generate vs comments)
@@ -0,0 +1,47 @@
1
+ ---
2
+ name: ai-spector
3
+ description: >-
4
+ AI Spector docflow core — traceability graph, .ai-spector project, CLI failure rules, templates.
5
+ Use when working in an ai-spector project but task is unclear; read _skill-router.md to pick a task skill.
6
+ ---
7
+
8
+ # AI Spector (core)
9
+
10
+ Shared rules for **all** ai-spector work. For a specific task, also load the matching task skill (see router below).
11
+
12
+ **Workflow index:** `.cursor/commands/_workflow.md`
13
+ **Skill router:** `.cursor/skills/_skill-router.md`
14
+
15
+ ## CLI failure rule (non-negotiable)
16
+
17
+ When `ai-spector` exits non-zero or required `--json` is missing/invalid:
18
+
19
+ 1. **Stop** — no generate, no bulk `docs/srs/**` reads, no hand-editing the whole graph.
20
+ 2. **Report** per `.cursor/commands/_cli-failures.md` (verbatim CLI output + fix steps).
21
+ 3. **Fix**, then **re-run the same CLI**.
22
+
23
+ Never bypass CLI with manual graph edits or invented content.
24
+
25
+ ## Graphify MCP
26
+
27
+ `init` writes `.cursor/mcp.json` → graph at `.ai-spector/.docflow/graph/graphify-out/graph.json`.
28
+
29
+ ## Heart of the system
30
+
31
+ `.ai-spector/graph/traceability.graph.json` — context via `ai-spector graph query <id> --json`.
32
+
33
+ Run CLI from project root; prefer `npx ai-spector` if not on PATH.
34
+
35
+ ## Task skills (auto-routing)
36
+
37
+ | User intent | Skill | Command doc |
38
+ |-------------|-------|---------------|
39
+ | Analyze, index, validate, impact, visualize graph | `ai-spector-graph` | `commands/analyze.md`, `index.md`, `impact.md`, … |
40
+ | Generate SRS / basic design / detail design | `ai-spector-generate` | `commands/generate-*.md` |
41
+ | Resolve review comments under `comments/` | `ai-spector-resolve-comments` | `commands/resolve-comments.md` |
42
+
43
+ When the user uses a **slash command** (`/analyze`, `/generate-srs`, `/resolve-comments`), follow that command file directly — skills reinforce the same rules.
44
+
45
+ ## Templates
46
+
47
+ Read from `.ai-spector/templates/` before any generation. Missing templates → `npx ai-spector init --force`.
@@ -0,0 +1,41 @@
1
+ ---
2
+ name: ai-spector-generate
3
+ description: >-
4
+ AI Spector document generation — SRS, basic design, detail design from traceability graph.
5
+ Use for /generate-srs, /generate-basic-design, /generate-detail-design, or when user asks to
6
+ generate, write, or update requirements specs, SRS chapters, basic design, detail design, or docs under docs/srs docs/basic-design.
7
+ ---
8
+
9
+ # AI Spector — Generate
10
+
11
+ **Core rules:** `.cursor/skills/ai-spector/SKILL.md`
12
+ **Graph context:** `.cursor/commands/_generate-graph.md`, `_graph.md`
13
+
14
+ ## Route to command doc
15
+
16
+ | Trigger | Read first | Notes |
17
+ |---------|------------|-------|
18
+ | `/generate-srs`, SRS, requirements spec | `commands/generate-srs.md` | DAG waves, `graph query`, templates in `.ai-spector/templates/srs/` |
19
+ | `/generate-basic-design`, screens, APIs, DB design | `commands/generate-basic-design.md` | `templates/basic_design/` |
20
+ | `/generate-detail-design` | `commands/generate-detail-design.md` | `templates/detail_design/` |
21
+
22
+ ## Before generating
23
+
24
+ 1. **`ai-spector graph validate`** should pass (or run `/validate-graph` first).
25
+ 2. **Read the template** from `.ai-spector/templates/` — never guess structure.
26
+ 3. After each wave: **`graph merge`** projection patch with `rendersTo` + `dependsOn`.
27
+ 4. After SRS generation: recommend **`/index`**.
28
+
29
+ ## Natural language → command
30
+
31
+ | User says | Action |
32
+ |-----------|--------|
33
+ | "generate SRS", "write requirements", "create use case docs" | `generate-srs.md` |
34
+ | "basic design", "screen list", "API design doc" | `generate-basic-design.md` |
35
+ | "detail design", "feature detail doc" | `generate-detail-design.md` |
36
+
37
+ Confirm scope when user describes generation in natural language (not explicit paths).
38
+
39
+ ## Generate discipline
40
+
41
+ Accuracy over speed — batch only same-wave independent targets; merge + validate after each wave.
@@ -0,0 +1,39 @@
1
+ ---
2
+ name: ai-spector-graph
3
+ description: >-
4
+ AI Spector graph operations — analyze docs/data-source, index refresh, validate traceability graph,
5
+ impact/regen scope, visualize graph, link semantic edges. Use for /analyze, /index, /validate-graph,
6
+ /impact, /visualize-graph, or when user asks about traceability graph, knowledge.json, Graphify, or what to regenerate.
7
+ ---
8
+
9
+ # AI Spector — Graph
10
+
11
+ **Core rules:** `.cursor/skills/ai-spector/SKILL.md` (CLI failure, graph path).
12
+
13
+ ## Route to command doc
14
+
15
+ | Trigger | Read first | CLI |
16
+ |---------|------------|-----|
17
+ | `/analyze`, ingest data-source, extract knowledge | `commands/analyze.md` | `ai-spector analyze` → graphify → merge → validate |
18
+ | `/index`, refresh graph after edits | `commands/index.md` | `ai-spector index` |
19
+ | `/validate-graph`, graph errors | `commands/validate-graph.md` | `ai-spector graph validate` |
20
+ | `/impact`, what breaks, regen scope, git diff impact | `commands/impact.md` | `ai-spector graph impact … --json` |
21
+ | `/visualize-graph`, explore graph in browser | `commands/visualize-graph.md` | `ai-spector graph visualize --open` |
22
+ | `/link-graph`, semantic relatesTo edges | `commands/link-graph.md` | `graph merge --semantic` |
23
+ | `/sync-graph` | `commands/sync-graph.md` | per command |
24
+ | `/summary` (index summaries only) | `commands/summary.md` | index build under `.ai-spector/index/` |
25
+
26
+ ## Natural language → command
27
+
28
+ | User says | Action |
29
+ |-----------|--------|
30
+ | "analyze my data source", "run analyze" | `/analyze` flow → `analyze.md` |
31
+ | "refresh the graph", "re-index" | `/index` → `index.md` |
32
+ | "validate graph", "graph has errors" | `/validate-graph` |
33
+ | "what's the impact", "what do I need to regenerate" | `/impact` → `impact.md` |
34
+ | "show the graph", "visualize traceability" | `/visualize-graph` |
35
+
36
+ ## References
37
+
38
+ - Graph CLI details: `commands/_graph.md`
39
+ - Generate graph patches: `commands/_generate-graph.md`
@@ -0,0 +1,42 @@
1
+ ---
2
+ name: ai-spector-resolve-comments
3
+ description: >-
4
+ AI Spector git-backed review comment resolve — list open threads, pick C-001, plan with impact,
5
+ propose doc fix, commit doc + comment meta. Use for /resolve-comments, comments/ folder,
6
+ meta_data.json, reviewer comments on SRS/basic design, or "resolve this comment thread".
7
+ ---
8
+
9
+ # AI Spector — Resolve comments
10
+
11
+ **Core rules:** `.cursor/skills/ai-spector/SKILL.md`
12
+ **Full workflow:** `.cursor/commands/resolve-comments.md` (follow step-by-step)
13
+
14
+ ## Quick flow
15
+
16
+ 1. `git pull`
17
+ 2. `ai-spector comments inbox --json` → show **`idePresentation.markdown`** only (thread table, pick ids)
18
+ 3. User picks **C-00N** → `ai-spector comments plan C-00N --json` (impact + anchor)
19
+ 4. Propose edit → user approves → apply to `docs/…`
20
+ 5. Commit doc → `comments resolve` → amend commit with **doc + `comments/…/thread/`** → push
21
+
22
+ ## CLI
23
+
24
+ | Step | Command |
25
+ |------|---------|
26
+ | Inbox | `ai-spector comments inbox --json` |
27
+ | Plan | `ai-spector comments plan C-001 --json` |
28
+ | Resolve meta | `ai-spector comments resolve <threadId> --file <logical_path> --expected-version <v>` |
29
+
30
+ ## Natural language → this skill
31
+
32
+ | User says | Action |
33
+ |-----------|--------|
34
+ | "resolve comments", "fix review comments", "open comment threads" | Start inbox flow |
35
+ | "address C-001", "resolve thread on srs/…" | `plan` then edit + commit |
36
+ | "comments under comments/" | Git-only F-05 flow — no Writer API |
37
+
38
+ ## Guardrails
39
+
40
+ - Inbox: thread table only — no raw JSON or thread uuids in chat
41
+ - Commit must include **changed doc file** and comment meta (amend pattern in `resolve-comments.md`)
42
+ - No resolve before doc fix is applied
@@ -1,6 +1,6 @@
1
- # API Detail: <Project Name>
1
+ # API Detail: <METHOD /path>
2
2
 
3
- > This document specifies detailed request/response schemas, path/query parameters, and error handling for each API endpoint. For the endpoint list and overview, see the API List document.
3
+ > **One endpoint per file** under `docs/basic-design/api/<slug>.md` (slug from method + path, e.g. `post-checkout.md`). For the endpoint list and overview, see `docs/basic-design/api-list.md`.
4
4
 
5
5
  **Source Requirements:** SRS Section 4 (System Features), Section 6.2 (Software Interfaces)
6
6
 
@@ -1,6 +1,6 @@
1
- # Screen Detail:
1
+ # Screen Detail: <Screen Name>
2
2
 
3
- > This document provides detailed layout, component, and interaction specifications for each screen. For the screen map and design system, see the Screen Map (List Screen) document. Use one section per screen; duplicate the structure below for each screen in the Screen Index.
3
+ > **One screen per file** under `docs/basic-design/screens/<slug>.md`. For the screen map and design system, see `docs/basic-design/list-screens.md`. Use a single `## 1. Screen:` section in this file.
4
4
 
5
5
  **Source Requirements:** SRS Section 6.1 (User Interfaces)
6
6
 
@@ -1,62 +0,0 @@
1
- ---
2
- name: ai-spector
3
- description: "Cursor-first docs: user runs slash commands; agent runs CLI; on CLI failure stop and help fix — no manual bypass."
4
- ---
5
-
6
- # AI Spector Skill
7
-
8
- **Workflow:** `.cursor/commands/_workflow.md` — user only runs `npx ai-spector init` once, then slash commands.
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
-
12
- ## CLI failure rule (non-negotiable)
13
-
14
- When `ai-spector` exits non-zero or required `--json` is missing/invalid:
15
-
16
- 1. **Stop** — no generate, no bulk `docs/srs/**` reads, no hand-editing the whole graph.
17
- 2. **Report** using the format in `.cursor/commands/_cli-failures.md` (verbatim CLI output + plain fix steps).
18
- 3. **Fix** the root cause, then **re-run the same CLI** and continue the slash command.
19
-
20
- Never ignore CLI errors and “work around” with index files, manual BFS, or inventing graph content. See `_cli-failures.md` for forbidden fallbacks.
21
-
22
- ## Slash commands (user)
23
-
24
- | Command | Agent runs CLI |
25
- |---------|----------------|
26
- | `/analyze` | `analyze` → `graphify update` → Graphify MCP extract → `graph merge` → `graph validate` |
27
- | `/index` | `ai-spector index` — rebuild graph structure, re-merge knowledge, Graphify storage, doc indexes |
28
- | `/summary` | Build `.ai-spector/index/*.md` summaries (optional; graph is primary for generation) |
29
- | `/validate-graph` | `graph validate` |
30
- | `/visualize-graph` | `graph visualize --open` |
31
- | `/generate-srs` | All DAG, explicit paths, or natural-language scope (confirm before gen) → waves → query → write → merge |
32
- | `/impact` | Empty args → git diff + seeds; else resolve → `graph impact <id> --json` (optional `--git` / `--file` / `--heading`) |
33
- | `/generate-basic-design` | Same as SRS: all / paths / request (**confirm**) → waves → query → merge (`dag.basic-design.*`) |
34
- | `/generate-detail-design` | `graph query` per target |
35
-
36
- Run CLI from **project workspace root**; prefer `npx ai-spector` if the binary is not on PATH.
37
-
38
- ## Heart of the system
39
-
40
- `.ai-spector/graph/traceability.graph.json`
41
-
42
- Context: **`ai-spector graph query <seedId> --json`** — depth 4 for targets, depth 2 for DAG deps; use `projectionPaths`. After each generated file: **`graph merge`** projection patch with `rendersTo` + `dependsOn`. Details: `_generate-graph.md`, `_graph.md`.
43
-
44
- **Generate:** accuracy over speed — batch only same-wave independent targets; merge + validate after each wave.
45
-
46
- ## Templates (mandatory path)
47
-
48
- `npx ai-spector init` copies bundled templates to **`.ai-spector/templates/`** (see `docflow.config.json` → `paths.templates`).
49
-
50
- Before `/generate-srs`, `/generate-basic-design`, or `/generate-detail-design`:
51
-
52
- 1. **Read** the template file from `.ai-spector/templates/` (DAG `template` field is relative to that root, e.g. `srs/1-introduction.md`, `basic_design/list-screen-template.md`).
53
- 2. **Preserve** the template’s headings and section order in the output under `docs/`.
54
- 3. If `.ai-spector/templates/` is missing, tell the user to run **`npx ai-spector init`** (or `init --force` to refresh) — do not guess structure from memory or search `node_modules`.
55
-
56
- | Kind | Directory |
57
- |------|-----------|
58
- | SRS | `.ai-spector/templates/srs/` |
59
- | Basic design | `.ai-spector/templates/basic_design/` |
60
- | Detail design | `.ai-spector/templates/detail_design/` |
61
-
62
- Optional index: `.ai-spector/templates/README.md`.
File without changes
File without changes
File without changes
File without changes