ai-spector 0.5.2 → 0.5.3
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/package.json +1 -1
- package/scaffold/cursor/skills/ai-spector/SKILL.md +5 -1
- package/scaffold/cursor/skills/ai-spector/references/cli-reference.md +392 -0
- package/scaffold/cursor/skills/ai-spector/references/generate-workflow.md +31 -6
- package/scaffold/cursor/skills/ai-spector/references/graph.md +14 -20
- package/scaffold/cursor/skills/ai-spector-generate-basic-design/references/runbook.md +1 -1
- package/scaffold/cursor/skills/ai-spector-generate-srs/references/runbook.md +1 -1
- package/scaffold/cursor/skills/ai-spector-graph/SKILL.md +1 -0
- package/scaffold/cursor/skills/ai-spector-lang-status/SKILL.md +15 -0
package/package.json
CHANGED
|
@@ -25,9 +25,11 @@ When `npx ai-spector` exits non-zero, required `--json` is invalid, or a require
|
|
|
25
25
|
|
|
26
26
|
| Item | Path |
|
|
27
27
|
|------|------|
|
|
28
|
+
| Config (languages, paths) | `.ai-spector/docflow.config.json` |
|
|
28
29
|
| Graph | `.ai-spector/graph/traceability.graph.json` |
|
|
29
30
|
| Query | `npx ai-spector graph query <id> --json` |
|
|
30
31
|
| Templates | `.ai-spector/templates/` |
|
|
32
|
+
| Doc output | `docs/srs/{lang.code}/` · `docs/basic-design/{lang.code}/` |
|
|
31
33
|
|
|
32
34
|
## Route to a task skill
|
|
33
35
|
|
|
@@ -38,10 +40,12 @@ When `npx ai-spector` exits non-zero, required `--json` is invalid, or a require
|
|
|
38
40
|
| Basic design | `ai-spector-generate-basic-design` |
|
|
39
41
|
| Prototype | `ai-spector-generate-prototype` |
|
|
40
42
|
| Comments | `ai-spector-resolve-comments` |
|
|
43
|
+
| Translation status / stale languages | `ai-spector-lang-status` |
|
|
41
44
|
| “Generate docs” (vague) | `ai-spector-generate` |
|
|
42
45
|
|
|
43
46
|
When a task skill applies, read its `references/` runbook fully before acting.
|
|
44
47
|
|
|
45
48
|
## More
|
|
46
49
|
|
|
47
|
-
[references/
|
|
50
|
+
- [references/cli-reference.md](references/cli-reference.md) — full command reference (all options + examples)
|
|
51
|
+
- [references/project-conventions.md](references/project-conventions.md)
|
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
# AI Spector CLI Reference
|
|
2
|
+
|
|
3
|
+
Complete command reference for AI agents. Run all commands from the project root with `npx ai-spector`.
|
|
4
|
+
|
|
5
|
+
**On any failure:** pause, report exit code + stderr, do not guess. Load [cli-failures.md](./cli-failures.md).
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Quick lookup
|
|
10
|
+
|
|
11
|
+
| Goal | Command |
|
|
12
|
+
|---|---|
|
|
13
|
+
| Initialize a new project | `npx ai-spector init` |
|
|
14
|
+
| Add a language | `npx ai-spector lang add <code>` |
|
|
15
|
+
| Refresh graph + indexes | `npx ai-spector index` |
|
|
16
|
+
| Prepare graph structure only | `npx ai-spector index --graph-only` |
|
|
17
|
+
| Rebuild doc indexes only | `npx ai-spector index --docs-only` |
|
|
18
|
+
| Query a node's subgraph | `npx ai-spector graph query <id> --json` |
|
|
19
|
+
| Impact analysis from a node | `npx ai-spector graph impact <id> --json` |
|
|
20
|
+
| Impact from git diff | `npx ai-spector graph impact --git --json` |
|
|
21
|
+
| Merge knowledge into graph | `npx ai-spector graph merge --from-knowledge` |
|
|
22
|
+
| Validate graph | `npx ai-spector graph validate` |
|
|
23
|
+
| Graph health report | `npx ai-spector graph report --json` |
|
|
24
|
+
| Visualize graph in browser | `npx ai-spector graph visualize --open` |
|
|
25
|
+
| List review comments | `npx ai-spector comments list --json` |
|
|
26
|
+
| Comment triage inbox | `npx ai-spector comments inbox --json` |
|
|
27
|
+
| Resolve a comment thread | `npx ai-spector comments resolve <threadId>` |
|
|
28
|
+
| Refresh Cursor skills | `npx ai-spector sync-cursor` |
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## `init`
|
|
33
|
+
|
|
34
|
+
Scaffold a new project: creates `.ai-spector/`, `docs/srs/{lang}/`, `docs/basic-design/{lang}/`, Cursor skills.
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npx ai-spector init [options]
|
|
38
|
+
|
|
39
|
+
Options:
|
|
40
|
+
-l, --languages <codes> Comma-separated language codes (default: "en")
|
|
41
|
+
e.g. --languages en,jp,vi
|
|
42
|
+
-f, --force Overwrite existing scaffold files
|
|
43
|
+
-C, --cwd <path> Target directory (default: current dir)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**Examples:**
|
|
47
|
+
```bash
|
|
48
|
+
npx ai-spector init # English only
|
|
49
|
+
npx ai-spector init --languages en,jp,vi # three languages
|
|
50
|
+
npx ai-spector init --force # re-scaffold in place
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**What it writes:**
|
|
54
|
+
- `.ai-spector/docflow.config.json` — project config including `languages[]`
|
|
55
|
+
- `docs/srs/{lang}/` and `docs/basic-design/{lang}/` for each language
|
|
56
|
+
- `.cursor/skills/` — Cursor agent skills
|
|
57
|
+
- `.ai-spector/templates/` — SRS + basic design templates
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## `lang add`
|
|
62
|
+
|
|
63
|
+
Add a language to an already-initialized project at any time.
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
npx ai-spector lang add <code> [options]
|
|
67
|
+
|
|
68
|
+
Arguments:
|
|
69
|
+
code BCP-47 language code: en, jp, ja, vi, zh, ko, fr, de, es, pt
|
|
70
|
+
|
|
71
|
+
Options:
|
|
72
|
+
--label <label> Override display name (inferred from built-in map if omitted)
|
|
73
|
+
-C, --cwd <path> Project root (default: current dir)
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**Examples:**
|
|
77
|
+
```bash
|
|
78
|
+
npx ai-spector lang add jp
|
|
79
|
+
npx ai-spector lang add vi --label Vietnamese
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**What it does:**
|
|
83
|
+
1. Creates `docs/srs/{code}/` and `docs/basic-design/{code}/`
|
|
84
|
+
2. Appends `{ code, label }` to `languages[]` in `docflow.config.json`
|
|
85
|
+
3. Registers `translationOf` edges in the graph for all existing primary document nodes
|
|
86
|
+
4. Prints: "Run `npx ai-spector index` to refresh the full graph."
|
|
87
|
+
|
|
88
|
+
After running, always follow with `npx ai-spector index`.
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## `index`
|
|
93
|
+
|
|
94
|
+
Full refresh: section registry → graph bootstrap → knowledge merge → doc-semantic merge → provenance → bundles → validate → doc indexes.
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
npx ai-spector index [options]
|
|
98
|
+
|
|
99
|
+
Options:
|
|
100
|
+
--graph-only Registry + bootstrap + merge + validate only (no doc indexes)
|
|
101
|
+
--docs-only Rebuild .ai-spector/index/*.md only (no graph changes)
|
|
102
|
+
--skip-docs Skip doc indexes (graph steps still run)
|
|
103
|
+
--skip-merge Skip merging knowledge.json
|
|
104
|
+
--skip-doc-semantics Skip parsing docs body for UC/F/actor ids
|
|
105
|
+
--skip-validate Skip graph validate
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
**Typical agent usage:**
|
|
109
|
+
```bash
|
|
110
|
+
npx ai-spector index # after any doc write
|
|
111
|
+
npx ai-spector index --graph-only # when only graph state matters
|
|
112
|
+
npx ai-spector index --skip-merge # when knowledge.json is stale/missing
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
**Output:** prints a step-by-step summary table. Each step shows `✓ ok`, `○ skipped`, or `✗ failed`.
|
|
116
|
+
|
|
117
|
+
**Multi-language behaviour:** automatically creates `doc:{lang.code}:{docId}` nodes and `translationOf` edges for each secondary language configured in `docflow.config.json`.
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## `graph query`
|
|
122
|
+
|
|
123
|
+
Return the subgraph and projection paths for a node. Always run before writing a document section.
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
npx ai-spector graph query <nodeId> [options]
|
|
127
|
+
|
|
128
|
+
Arguments:
|
|
129
|
+
nodeId Node id from the traceability graph
|
|
130
|
+
|
|
131
|
+
Options:
|
|
132
|
+
-d, --direction <dir> out | in | both (default: "both")
|
|
133
|
+
--depth <n> Traversal depth (default: 2)
|
|
134
|
+
-e, --edges <types> Comma-separated edge types
|
|
135
|
+
--json JSON output (required for agent use)
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**Examples:**
|
|
139
|
+
```bash
|
|
140
|
+
npx ai-spector graph query UC-01 --json
|
|
141
|
+
npx ai-spector graph query doc.srs.use-cases --direction out --depth 3 --json
|
|
142
|
+
npx ai-spector graph query srs-overview --edges contains,partOf --json
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
**JSON output shape:**
|
|
146
|
+
```jsonc
|
|
147
|
+
{
|
|
148
|
+
"origin": { "id": "...", "type": "..." },
|
|
149
|
+
"nodes": [...],
|
|
150
|
+
"edges": [...],
|
|
151
|
+
"projectionPaths": ["docs/srs/en/03-use-cases.md", ...]
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Use `projectionPaths` to know which files to read. Do not glob `docs/**`.
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## `graph impact`
|
|
160
|
+
|
|
161
|
+
Compute which nodes/documents need regeneration or review after a change. Also surfaces stale translation nodes.
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
npx ai-spector graph impact [id] [options]
|
|
165
|
+
|
|
166
|
+
Arguments:
|
|
167
|
+
id Node id (optional when using --file, --heading, or --git)
|
|
168
|
+
|
|
169
|
+
Options:
|
|
170
|
+
--file <path> Resolve origin from repo-relative doc path
|
|
171
|
+
--heading <text> Resolve section by heading (combine with --file)
|
|
172
|
+
--git Seeds from current git diff (staged + unstaged)
|
|
173
|
+
--change <type> Change type label (default: "content_change")
|
|
174
|
+
-o, --output <path> Write impact JSON to file
|
|
175
|
+
--json Print JSON
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
**Examples:**
|
|
179
|
+
```bash
|
|
180
|
+
npx ai-spector graph impact UC-01 --json
|
|
181
|
+
npx ai-spector graph impact --file docs/srs/en/03-use-cases.md --json
|
|
182
|
+
npx ai-spector graph impact --file docs/srs/en/03-use-cases.md --heading "3.2 List Use Case" --json
|
|
183
|
+
npx ai-spector graph impact --git --json
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
**JSON output shape:**
|
|
187
|
+
```jsonc
|
|
188
|
+
{
|
|
189
|
+
"origin": { "id": "...", "type": "...", "change": "content_change" },
|
|
190
|
+
"affected": {
|
|
191
|
+
"regenerate": [{ "id": "...", "type": "document", "projectionPath": "..." }],
|
|
192
|
+
"review": [{ "id": "...", "type": "section", "projectionPath": "..." }]
|
|
193
|
+
},
|
|
194
|
+
"staleTranslations": [ // present when secondary-language nodes are affected
|
|
195
|
+
{ "id": "doc:jp:srs-use-cases", "type": "document", "reason": "translationOf srs-use-cases" }
|
|
196
|
+
]
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
`staleTranslations` lists secondary-language document nodes whose primary counterpart changed — they need re-translation, not re-generation from graph.
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## `graph merge`
|
|
205
|
+
|
|
206
|
+
Merge a domain patch or `knowledge.json` into the traceability graph (upsert nodes + edges).
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
npx ai-spector graph merge [file] [options]
|
|
210
|
+
|
|
211
|
+
Options:
|
|
212
|
+
--from-knowledge Read .ai-spector/.docflow/analysis/knowledge.json
|
|
213
|
+
--semantic Merge semantic-links patch (agent meaning edges)
|
|
214
|
+
-g, --graph <path> Graph path override
|
|
215
|
+
-o, --write-patch <p> Write normalized patch before merge
|
|
216
|
+
--no-validate Skip validate after merge
|
|
217
|
+
--dry-run Stats only, no save
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
**Examples:**
|
|
221
|
+
```bash
|
|
222
|
+
npx ai-spector graph merge --from-knowledge # after /analyze
|
|
223
|
+
npx ai-spector graph merge patch.json # manual patch file
|
|
224
|
+
npx ai-spector graph merge --from-knowledge --dry-run # preview
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Do not hand-edit `traceability.graph.json` for domain nodes — always merge via this command.
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
## `graph validate`
|
|
232
|
+
|
|
233
|
+
Validate graph against JSON schema and traceability rules.
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
npx ai-spector graph validate [options]
|
|
237
|
+
|
|
238
|
+
Options:
|
|
239
|
+
-g, --graph <path> Graph path override
|
|
240
|
+
-s, --schema <path> Schema path override
|
|
241
|
+
--registry <path> Registry path
|
|
242
|
+
--rules <path> Rules manifest path
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
Run after every merge or doc write. Exit code 0 = valid (warnings may still print).
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
## `graph report`
|
|
250
|
+
|
|
251
|
+
Layer health report: structure, spec instances, hubs, provenance, semantic links.
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
npx ai-spector graph report [options]
|
|
255
|
+
|
|
256
|
+
Options:
|
|
257
|
+
-g, --graph <path> Graph path override
|
|
258
|
+
--json JSON output
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
Useful for diagnosing missing provenance or empty domain layers.
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
## `graph visualize`
|
|
266
|
+
|
|
267
|
+
Generate an HTML report to explore the graph in a browser.
|
|
268
|
+
|
|
269
|
+
```bash
|
|
270
|
+
npx ai-spector graph visualize [options]
|
|
271
|
+
|
|
272
|
+
Options:
|
|
273
|
+
--open Open in default browser after generating
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
## `comments`
|
|
279
|
+
|
|
280
|
+
Git-backed review comment threads. Comments live under `comments/{logical_path}/`.
|
|
281
|
+
|
|
282
|
+
### `comments inbox`
|
|
283
|
+
|
|
284
|
+
Triage list of open threads, formatted for Cursor chat.
|
|
285
|
+
|
|
286
|
+
```bash
|
|
287
|
+
npx ai-spector comments inbox --json
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
Output: JSON with `idePresentation.markdown` table, each row has thread id, anchor, status.
|
|
291
|
+
|
|
292
|
+
### `comments list`
|
|
293
|
+
|
|
294
|
+
Raw list of threads with optional filters.
|
|
295
|
+
|
|
296
|
+
```bash
|
|
297
|
+
npx ai-spector comments list [options]
|
|
298
|
+
|
|
299
|
+
Options:
|
|
300
|
+
--file <path> Filter by logical file path (e.g. srs/01-overview)
|
|
301
|
+
--json JSON output
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### `comments plan`
|
|
305
|
+
|
|
306
|
+
Resolve plan for a thread: anchor excerpt, graph impact, IDE workflow hints.
|
|
307
|
+
|
|
308
|
+
```bash
|
|
309
|
+
npx ai-spector comments plan [threadId] [options]
|
|
310
|
+
|
|
311
|
+
Options:
|
|
312
|
+
--json JSON output
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
### `comments show`
|
|
316
|
+
|
|
317
|
+
Thread detail: metadata, replies, events.
|
|
318
|
+
|
|
319
|
+
```bash
|
|
320
|
+
npx ai-spector comments show <threadId>
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
### `comments resolve`
|
|
324
|
+
|
|
325
|
+
Mark a thread resolved.
|
|
326
|
+
|
|
327
|
+
```bash
|
|
328
|
+
npx ai-spector comments resolve <threadId>
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
---
|
|
332
|
+
|
|
333
|
+
## `sync-cursor`
|
|
334
|
+
|
|
335
|
+
Refresh `.cursor/skills/` from the bundled scaffold without re-initializing the whole project.
|
|
336
|
+
|
|
337
|
+
```bash
|
|
338
|
+
npx ai-spector sync-cursor [-C <path>]
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
Use when a new version of `ai-spector` ships updated skills.
|
|
342
|
+
|
|
343
|
+
---
|
|
344
|
+
|
|
345
|
+
## Output paths (multi-language)
|
|
346
|
+
|
|
347
|
+
All document output paths follow:
|
|
348
|
+
|
|
349
|
+
```
|
|
350
|
+
docs/srs/{lang.code}/{filename}
|
|
351
|
+
docs/basic-design/{lang.code}/{filename}
|
|
352
|
+
docs/basic-design/{lang.code}/api/{slug}.md
|
|
353
|
+
docs/basic-design/{lang.code}/screens/{slug}.md
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
Primary language is the **first** entry in `languages[]` inside `docflow.config.json`. Secondary languages are translated from the finished primary file — never generated independently from the graph.
|
|
357
|
+
|
|
358
|
+
---
|
|
359
|
+
|
|
360
|
+
## Common sequences
|
|
361
|
+
|
|
362
|
+
**After analyzing data source:**
|
|
363
|
+
```bash
|
|
364
|
+
npx ai-spector graph merge --from-knowledge
|
|
365
|
+
npx ai-spector graph validate
|
|
366
|
+
npx ai-spector index --skip-merge
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
**After writing any doc file:**
|
|
370
|
+
```bash
|
|
371
|
+
npx ai-spector graph validate
|
|
372
|
+
npx ai-spector index
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
**After adding a language:**
|
|
376
|
+
```bash
|
|
377
|
+
npx ai-spector lang add jp
|
|
378
|
+
npx ai-spector index
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
**Before writing a section (query context):**
|
|
382
|
+
```bash
|
|
383
|
+
npx ai-spector graph query <seedNodeId> --json
|
|
384
|
+
# → read projectionPaths, write section, then:
|
|
385
|
+
npx ai-spector graph merge patch.json
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
**Check translation staleness:**
|
|
389
|
+
```bash
|
|
390
|
+
npx ai-spector graph impact --git --json
|
|
391
|
+
# → inspect staleTranslations[] in output
|
|
392
|
+
```
|
|
@@ -71,18 +71,43 @@ Case 3: build scope table (DAG id, output path, seed, reason, deps) → ask →
|
|
|
71
71
|
- [ ] Load matching srs-context/ or bd-context/ section for this doc type
|
|
72
72
|
- [ ] Read template from .ai-spector/templates/ — never invent structure
|
|
73
73
|
- [ ] Write primary language file from summary + template
|
|
74
|
-
- [ ]
|
|
75
|
-
For each secondary language (can parallelize across languages):
|
|
76
|
-
Read the finished primary file from disk
|
|
77
|
-
Translate prose to target language (IDs/paths/code unchanged)
|
|
78
|
-
Write to docs/{docType}/{lang.code}/{filename}
|
|
74
|
+
- [ ] [PAUSE — translation prompt] (see below)
|
|
79
75
|
- [ ] Merge projection patch (rendersTo + dependsOn) for the wave
|
|
80
76
|
- [ ] npx ai-spector graph validate
|
|
81
77
|
- [ ] npx ai-spector index (basic design: every wave; SRS: see runbook)
|
|
82
78
|
- [ ] /compact with plan summary before next wave
|
|
83
79
|
```
|
|
84
80
|
|
|
85
|
-
Per target: Delegate → Receive summary → Write primary → Translate
|
|
81
|
+
Per target: Delegate → Receive summary → Write primary → Translation prompt → Translate if approved → Log path/status → Ingest.
|
|
82
|
+
|
|
83
|
+
## Translation prompt (mandatory pause after each primary file write)
|
|
84
|
+
|
|
85
|
+
After writing or updating **any primary language file**, and when secondary languages are configured in `docflow.config.json`, you **must** stop and ask:
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
I've updated `docs/{docType}/{primaryLang.code}/{filename}`.
|
|
89
|
+
|
|
90
|
+
This project also has translations configured: {secondaryLangs joined by ", "}.
|
|
91
|
+
Do you want me to update the translation(s) now?
|
|
92
|
+
|
|
93
|
+
1. Yes, update all translations now
|
|
94
|
+
2. Yes, but only: [user can name specific languages]
|
|
95
|
+
3. No, I'll handle translations separately
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**Wait for the user's reply before proceeding.**
|
|
99
|
+
|
|
100
|
+
- **Reply 1 or 2** → for each approved secondary language: read the finished primary file, translate prose, write to `docs/{docType}/{lang.code}/{filename}`. Then continue the checklist.
|
|
101
|
+
- **Reply 3** → note which files have stale translations (so the user can run `ai-spector-lang-status` later), then continue the checklist without translating.
|
|
102
|
+
|
|
103
|
+
### When to skip the prompt
|
|
104
|
+
|
|
105
|
+
Skip the prompt (proceed directly to translation) only when the user has **already pre-approved** translations in this session with a phrase like:
|
|
106
|
+
- "generate everything in all languages"
|
|
107
|
+
- "update all translations automatically"
|
|
108
|
+
- "yes to all translations"
|
|
109
|
+
|
|
110
|
+
If pre-approved, translate immediately after each primary write without asking again for the rest of the session.
|
|
86
111
|
|
|
87
112
|
## Guardrails
|
|
88
113
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# Graph CLI (for agents)
|
|
2
2
|
|
|
3
|
-
**Users do not run these.** Slash commands invoke CLI.
|
|
3
|
+
**Users do not run these.** Slash commands invoke CLI. **On failure:** [cli-failures.md](./cli-failures.md).
|
|
4
|
+
**Full command reference (all commands + options + examples):** [cli-reference.md](./cli-reference.md).
|
|
4
5
|
|
|
5
6
|
Run from project root: always `npx ai-spector …` (see [project-conventions.md](./project-conventions.md)).
|
|
6
7
|
|
|
@@ -10,7 +11,7 @@ Run from project root: always `npx ai-spector …` (see [project-conventions.md]
|
|
|
10
11
|
2. If non-zero or `--json` is unparseable → **pause**; report and offer fix / workaround / pause per `cli-failures.md`.
|
|
11
12
|
3. On success, use CLI output only — do not re-derive graph state in the agent.
|
|
12
13
|
|
|
13
|
-
## Commands
|
|
14
|
+
## Commands (quick)
|
|
14
15
|
|
|
15
16
|
```bash
|
|
16
17
|
npx ai-spector analyze
|
|
@@ -21,6 +22,8 @@ npx ai-spector graph query <nodeId> --json
|
|
|
21
22
|
npx ai-spector graph impact <nodeId> --json
|
|
22
23
|
npx ai-spector graph impact --file <path> [--heading <text>] --json
|
|
23
24
|
npx ai-spector graph impact --git --json
|
|
25
|
+
npx ai-spector index
|
|
26
|
+
npx ai-spector lang add <code> # add a language (e.g. jp, vi)
|
|
24
27
|
```
|
|
25
28
|
|
|
26
29
|
## `graph query`
|
|
@@ -28,40 +31,31 @@ npx ai-spector graph impact --git --json
|
|
|
28
31
|
```bash
|
|
29
32
|
npx ai-spector graph query <seedId> --direction both --depth 4 --json
|
|
30
33
|
npx ai-spector graph query <depDocId> --edges rendersTo,dependsOn,listedIn,satisfies --depth 2 --json
|
|
31
|
-
npx ai-spector graph impact <seedId> --change content_change --json
|
|
32
34
|
```
|
|
33
35
|
|
|
34
|
-
**Generate:** query **before** write; **`graph merge`** projection patch **after** each file (`rendersTo` + `dependsOn`). See
|
|
36
|
+
**Generate:** query **before** write; **`graph merge`** projection patch **after** each file (`rendersTo` + `dependsOn`). See [generate-graph.md](./generate-graph.md).
|
|
35
37
|
|
|
36
|
-
Use `projectionPaths`, `nodes`, `edges` from JSON. **If command fails or JSON invalid:** stop — do not glob `docs
|
|
38
|
+
Use `projectionPaths`, `nodes`, `edges` from JSON. **If command fails or JSON invalid:** stop — do not glob `docs/**`.
|
|
37
39
|
|
|
38
|
-
**If success but empty domain nodes:** report to user; suggest `/analyze` — still no folder-wide
|
|
40
|
+
**If success but empty domain nodes:** report to user; suggest `/analyze` — still no folder-wide reads.
|
|
39
41
|
|
|
40
42
|
## `graph impact`
|
|
41
43
|
|
|
42
|
-
Resolve the seed in the agent (see `/impact`), then:
|
|
43
|
-
|
|
44
44
|
```bash
|
|
45
45
|
npx ai-spector graph impact <nodeId> --change content_change --json
|
|
46
|
+
npx ai-spector graph impact --file docs/srs/en/03-use-cases.md --heading "3.2 List Use Case" --json
|
|
47
|
+
npx ai-spector graph impact --git --change content_change --json
|
|
46
48
|
```
|
|
47
49
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
npx ai-spector graph impact --file docs/srs/3-use-cases.md --heading "3.2 List Use Case" --json
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
Current working tree (staged + unstaged vs `HEAD`, or unstaged + `--cached` before first commit):
|
|
50
|
+
Note: doc file paths now always include a language subfolder: `docs/srs/{lang.code}/{filename}`.
|
|
55
51
|
|
|
56
|
-
|
|
57
|
-
npx ai-spector graph impact --git --change content_change --json
|
|
58
|
-
```
|
|
52
|
+
The JSON output includes a `staleTranslations` array when secondary-language documents are affected. Those nodes need **re-translation from the primary file**, not re-generation from the graph.
|
|
59
53
|
|
|
60
|
-
If
|
|
54
|
+
If impact fails, do not guess scope — show CLI output and fix.
|
|
61
55
|
|
|
62
56
|
## `graph merge`
|
|
63
57
|
|
|
64
|
-
Called from `/analyze`. On merge/validate failure, do not patch `traceability.graph.json` by hand
|
|
58
|
+
Called from `/analyze`. On merge/validate failure, do not patch `traceability.graph.json` by hand — fix `knowledge.json` or section ids and re-run merge.
|
|
65
59
|
|
|
66
60
|
## Narrow fallback (success only)
|
|
67
61
|
|
|
@@ -48,7 +48,7 @@ docs/basic-design/jp/api/post-checkout.md
|
|
|
48
48
|
|
|
49
49
|
Never write directly to `docs/basic-design/{filename}` — the language subfolder is always required.
|
|
50
50
|
|
|
51
|
-
**Multi-language order:** generate the primary language file first (from graph + template).
|
|
51
|
+
**Multi-language order:** generate the primary language file first (from graph + template). After writing it, follow the **translation prompt** from [generate-workflow.md](../../ai-spector/references/generate-workflow.md#translation-prompt-mandatory-pause-after-each-primary-file-write) — ask the user whether to update translations before continuing. Secondary languages are always translated from the finished primary file, never generated independently from the graph.
|
|
52
52
|
|
|
53
53
|
## Waves (reference)
|
|
54
54
|
|
|
@@ -48,7 +48,7 @@ docs/srs/vi/01-introduction.md ← Vietnamese
|
|
|
48
48
|
|
|
49
49
|
Never write directly to `docs/srs/{filename}` — the language subfolder is always required.
|
|
50
50
|
|
|
51
|
-
**Multi-language order:** generate the primary language file first (from graph + template).
|
|
51
|
+
**Multi-language order:** generate the primary language file first (from graph + template). After writing it, follow the **translation prompt** from [generate-workflow.md](../../ai-spector/references/generate-workflow.md#translation-prompt-mandatory-pause-after-each-primary-file-write) — ask the user whether to update translations before continuing. Secondary languages are always translated from the finished primary file, never generated independently from the graph.
|
|
52
52
|
|
|
53
53
|
## Waves (reference)
|
|
54
54
|
|
|
@@ -42,6 +42,7 @@ Read **one** runbook under `references/` for the user’s intent, then execute i
|
|
|
42
42
|
|
|
43
43
|
## Shared references
|
|
44
44
|
|
|
45
|
+
- [../ai-spector/references/cli-reference.md](../ai-spector/references/cli-reference.md) — full CLI options + examples
|
|
45
46
|
- [../ai-spector/references/graph.md](../ai-spector/references/graph.md)
|
|
46
47
|
- [../ai-spector/references/generate-graph.md](../ai-spector/references/generate-graph.md)
|
|
47
48
|
- [references/graph-commands.md](references/graph-commands.md)
|
|
@@ -45,6 +45,21 @@ After the table, list actionable items:
|
|
|
45
45
|
- Files that are MISSING: "Generate: `docs/srs/jp/02-actors.md`"
|
|
46
46
|
- Files that are STALE: "Update: `docs/basic-design/vi/db-design.md` (primary changed 2026-06-01, translation last updated 2026-05-10)"
|
|
47
47
|
|
|
48
|
+
## After any primary file edit (outside of generate skills)
|
|
49
|
+
|
|
50
|
+
If the user edits a primary language file directly (not via a generate skill), and secondary languages are configured, ask:
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
You've edited `docs/{docType}/{primaryLang.code}/{filename}`.
|
|
54
|
+
Do you want me to update the translation(s) now?
|
|
55
|
+
|
|
56
|
+
1. Yes, update all translations now
|
|
57
|
+
2. Yes, but only: [specific languages]
|
|
58
|
+
3. No — I'll handle it later
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Wait for reply. On yes: read the updated primary file and re-translate to each approved secondary language. On no: note the file as stale so the user can run `ai-spector-lang-status` later.
|
|
62
|
+
|
|
48
63
|
## Updating stale translations
|
|
49
64
|
|
|
50
65
|
If the user says "update stale JP" or "regenerate missing VI docs":
|