ai-spector 0.3.2 → 0.3.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/README.md +39 -283
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,315 +1,71 @@
|
|
|
1
1
|
# AI Spector
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Documentation workflow in **Cursor**: traceability graph, SRS / basic / detail design, driven by slash commands. The agent runs `ai-spector` CLI — you usually do not.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**Needs:** Node 20+, [Cursor](https://cursor.com), [uv](https://docs.astral.sh/uv/) (Graphify MCP after `init`).
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
## Installation
|
|
12
|
-
|
|
13
|
-
Package name: **`@kaopiz/ai-spector`**. The CLI binary is still `ai-spector`.
|
|
14
|
-
|
|
15
|
-
### Recommended — internal registry (Verdaccio)
|
|
16
|
-
|
|
17
|
-
Add scoped registry to your **app project** (not the monorepo package source):
|
|
18
|
-
|
|
19
|
-
```ini
|
|
20
|
-
# .npmrc in your app root
|
|
21
|
-
@kaopiz:registry=http://10.101.0.239:4873/
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
One-shot bootstrap (installs the package + runs `init`):
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
cd /path/to/your-app
|
|
28
|
-
npx --registry http://10.101.0.239:4873 @kaopiz/ai-spector-install
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
Or manual install:
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
npm install -D @kaopiz/ai-spector --registry http://10.101.0.239:4873
|
|
35
|
-
npx ai-spector init
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
**Local Verdaccio** (maintainers): use `http://localhost:4873` instead. See [devkit-mcp `docs/release-and-publish.md`](../../docs/release-and-publish.md).
|
|
39
|
-
|
|
40
|
-
> **Note:** `@kaopiz/ai-spector` must be **published** to Verdaccio first (`npm run publish:verdaccio` from the `devkit-mcp` monorepo). A 404 on install means the package is not on the registry yet.
|
|
41
|
-
|
|
42
|
-
### Offline — install from tarball
|
|
43
|
-
|
|
44
|
-
From the `devkit-mcp` monorepo:
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
npm run build -w @kaopiz/ai-spector
|
|
48
|
-
mkdir -p /tmp/packs
|
|
49
|
-
npm pack -w @kaopiz/ai-spector --pack-destination /tmp/packs
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
In your app:
|
|
53
|
-
|
|
54
|
-
```bash
|
|
55
|
-
npm install -D /tmp/packs/kaopiz-ai-spector-0.3.1.tgz
|
|
56
|
-
npx ai-spector init
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### With DevKit (optional)
|
|
60
|
-
|
|
61
|
-
AI Spector is **not** bundled in the default DevKit install. To add it when bootstrapping DevKit:
|
|
62
|
-
|
|
63
|
-
```bash
|
|
64
|
-
npx --registry http://10.101.0.239:4873 @kaopiz/devkit-install --with-ai-spector
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
### Local development — `npm link`
|
|
68
|
-
|
|
69
|
-
When hacking on the CLI in `devkit-mcp/packages/ai-spector`:
|
|
70
|
-
|
|
71
|
-
```bash
|
|
72
|
-
cd devkit-mcp/packages/ai-spector
|
|
73
|
-
npm run build
|
|
74
|
-
npm link # global ai-spector → this package
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
If `npm link` fails with `EEXIST`, remove an old global install first:
|
|
7
|
+
## Setup (once)
|
|
78
8
|
|
|
79
9
|
```bash
|
|
80
|
-
npm
|
|
81
|
-
npm link
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
Link into your app:
|
|
85
|
-
|
|
86
|
-
```bash
|
|
87
|
-
cd /path/to/your-app
|
|
88
|
-
npm link @kaopiz/ai-spector
|
|
10
|
+
npm install -D ai-spector
|
|
89
11
|
npx ai-spector init
|
|
90
12
|
```
|
|
91
13
|
|
|
92
|
-
|
|
14
|
+
1. Open the project in Cursor → reload **MCP** → enable **ai-spector** skills (`.cursor/skills/_skill-router.md`).
|
|
15
|
+
2. Put source material in `docs/data-source/`.
|
|
93
16
|
|
|
94
|
-
|
|
17
|
+
Re-init scaffold: `npx ai-spector init --force`. After upgrading the package: `npx ai-spector sync-cursor`.
|
|
95
18
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
```bash
|
|
99
|
-
npm install
|
|
100
|
-
npm run build -w @kaopiz/ai-spector
|
|
101
|
-
npm run ai-spector -- init -C /path/to/your-app
|
|
102
|
-
```
|
|
19
|
+
## Workflow
|
|
103
20
|
|
|
104
|
-
|
|
21
|
+
Use **slash commands** in chat (or natural language with skills on). Details: `.cursor/commands/_workflow.md`.
|
|
105
22
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
## How you work (Cursor-first)
|
|
109
|
-
|
|
110
|
-
### Once per project
|
|
111
|
-
|
|
112
|
-
After [installation](#installation), run **`init`** once (skip if you used `@kaopiz/ai-spector-install` — it runs init for you):
|
|
113
|
-
|
|
114
|
-
```bash
|
|
115
|
-
npx ai-spector init
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
Put your source files in `docs/data-source/`, open the folder in Cursor, **enable all ai-spector skills** (`.cursor/skills/` — see `_skill-router.md`), and **reload MCP** (init writes `.cursor/mcp.json` for Graphify). Init also copies SRS/basic/detail **templates** into `.ai-spector/templates/` so agents always find them in the project.
|
|
119
|
-
|
|
120
|
-
**Graphify requires:** [uv](https://docs.astral.sh/uv/) installed; package `graphifyy` is pulled via `uv tool run` on first MCP start.
|
|
121
|
-
|
|
122
|
-
### Skills (auto-routing)
|
|
123
|
-
|
|
124
|
-
You can use **slash commands** or **natural language** — Cursor picks a task skill from the `description` in each `SKILL.md`:
|
|
125
|
-
|
|
126
|
-
| Skill | Use when you ask about… |
|
|
127
|
-
|-------|-------------------------|
|
|
128
|
-
| `ai-spector` | Core rules, any docflow work |
|
|
129
|
-
| `ai-spector-graph` | Analyze, index, validate, impact, visualize, Graphify |
|
|
130
|
-
| `ai-spector-generate` | SRS, basic design, detail design generation |
|
|
131
|
-
| `ai-spector-resolve-comments` | Review comments, `comments/` threads, resolve C-001 |
|
|
132
|
-
|
|
133
|
-
Router reference: `.cursor/skills/_skill-router.md`. Slash commands still take priority when you type `/analyze`, etc.
|
|
134
|
-
|
|
135
|
-
### Slash commands
|
|
136
|
-
|
|
137
|
-
| You run | What happens |
|
|
138
|
-
|---------|----------------|
|
|
139
|
-
| **`/analyze`** | Graph skeleton, Graphify extract → `knowledge.json`, merge domain nodes, validate |
|
|
140
|
-
| **`/validate-graph`** | Checks the graph before generation |
|
|
141
|
-
| **`/generate-srs`** | SRS by DAG waves — graph-first context, `rendersTo` + `dependsOn` on output |
|
|
142
|
-
| **`/generate-basic-design`** | Basic design from graph + SRS (same targeting/waves pattern) |
|
|
143
|
-
| **`/generate-detail-design`** | Detail design from the graph |
|
|
144
|
-
| **`/index`** | Full refresh: registry/bootstrap, knowledge merge, **UC/F from markdown**, Graphify on changed paths, validate, doc indexes — run after **`/generate-srs`** |
|
|
145
|
-
| **`/summary`** | Optional searchable summaries under `.ai-spector/index/` only (not a full graph refresh) |
|
|
146
|
-
| **`/impact`** [what changed] | Regen scope from **your description**, git diff, selection, or path — agent resolves seeds (no node id required) |
|
|
147
|
-
| **`/resolve-comments`** [C-001 or file] | IDE: inbox table → plan/impact → propose/apply → **one commit** (doc + comment meta via amend) → push |
|
|
148
|
-
| **`/visualize-graph`** | Browser report: graph, knowledge, detail docs, sections, **`rendersTo`** to file paths |
|
|
149
|
-
|
|
150
|
-
**Typical path:**
|
|
23
|
+
### First run
|
|
151
24
|
|
|
152
25
|
```text
|
|
153
|
-
|
|
154
|
-
→
|
|
155
|
-
→
|
|
156
|
-
→
|
|
157
|
-
→ /generate-srs
|
|
158
|
-
→ /index
|
|
26
|
+
/analyze → Graphify + knowledge → graph
|
|
27
|
+
/validate-graph → check graph
|
|
28
|
+
/generate-srs → SRS from graph
|
|
29
|
+
/index → sync graph after generate
|
|
159
30
|
```
|
|
160
31
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
If a CLI step fails during a slash command, the agent should **stop**, show you the error, and help you fix it — not bypass the tool with manual edits. See `_cli-failures.md` in your project after `init`.
|
|
164
|
-
|
|
165
|
-
### Graphify MCP (configured on `init`)
|
|
166
|
-
|
|
167
|
-
`init` adds **`.cursor/mcp.json`** (Graphify) and updates **`.gitignore`** (Graphify cache, HTML reports, legacy `docs/data-source/graphify-out/`).
|
|
168
|
-
|
|
169
|
-
Graphify graph file:
|
|
170
|
-
|
|
171
|
-
`.ai-spector/.docflow/graph/graphify-out/graph.json`
|
|
172
|
-
|
|
173
|
-
Restart Cursor or reload MCP after init. If you still see **`docs/data-source/graphify-out/`**, that is an old Graphify default — delete it; see `docs/data-source/README.md`.
|
|
174
|
-
|
|
175
|
-
---
|
|
176
|
-
|
|
177
|
-
## What is the graph?
|
|
178
|
-
|
|
179
|
-
All structure and traceability live in one file:
|
|
180
|
-
|
|
181
|
-
`.ai-spector/graph/traceability.graph.json`
|
|
182
|
-
|
|
183
|
-
- Chapters and headings → **sections** in the graph
|
|
184
|
-
- Use cases, features, actors → **domain nodes** with links (`listedIn`, `satisfies`, …)
|
|
185
|
-
- Originating inputs under `docs/data-source/` → **`derivedFrom`** to repo-relative paths (and `graphify:<id>` when Graphify index matches)
|
|
186
|
-
- Generated markdown under `docs/srs/`, `docs/basic-design/`, etc. → linked by **`rendersTo`** (target is the **repo-relative file path**, not a node id)
|
|
187
|
-
- Per-UC / per-feature **detail files** → instance `document` nodes (`doc.srs.uc-UC-01`, …), **section** nodes with titles/snippets from generated markdown, **`definedIn`** / **`describedIn`** from domain nodes to those sections
|
|
188
|
-
|
|
189
|
-
**`/index`** (or `ai-spector index`) parses UC/F/actor ids from SRS and basic-design bodies and wires detail semantics without a full **`/analyze`**. **`/analyze`** is still required for rich Graphify MCP extract into `knowledge.json`.
|
|
190
|
-
|
|
191
|
-
**Graphify** (optional MCP) helps read `docs/data-source/` during **`/analyze`**. The graph remains canonical.
|
|
192
|
-
|
|
193
|
-
---
|
|
194
|
-
|
|
195
|
-
## Requirements
|
|
32
|
+
Then: `/generate-basic-design` → `/generate-detail-design` as needed.
|
|
196
33
|
|
|
197
|
-
|
|
198
|
-
- [Cursor](https://cursor.com)
|
|
199
|
-
- Graphify MCP for **`/analyze`** (optional for **`/index`** with `--skip-graphify`)
|
|
34
|
+
### Day to day
|
|
200
35
|
|
|
201
|
-
|
|
36
|
+
| When | Command |
|
|
37
|
+
|------|---------|
|
|
38
|
+
| New or changed data source | `/analyze` |
|
|
39
|
+
| Check graph | `/validate-graph` |
|
|
40
|
+
| Regenerate docs | `/generate-srs`, `/generate-basic-design`, `/generate-detail-design` |
|
|
41
|
+
| Edited docs or finished generate | `/index` |
|
|
42
|
+
| What to redo after a change | `/impact` |
|
|
43
|
+
| Review comments | `/resolve-comments` |
|
|
44
|
+
| Explore graph | `/visualize-graph` |
|
|
202
45
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
For package developers:
|
|
206
|
-
|
|
207
|
-
```bash
|
|
208
|
-
git clone <repo-url>
|
|
209
|
-
cd ai-spector
|
|
210
|
-
npm install && npm run build
|
|
211
|
-
npm run init:example
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
Open **`example/`** as the Cursor workspace, add files under `example/docs/data-source/`, then run **`/analyze`** → **`/generate-srs`** → **`/index`**.
|
|
215
|
-
|
|
216
|
-
See [example/README.md](example/README.md).
|
|
217
|
-
|
|
218
|
-
---
|
|
219
|
-
|
|
220
|
-
## Project layout (after init)
|
|
46
|
+
### Typical path
|
|
221
47
|
|
|
222
48
|
```text
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
.cursor/skills/ # ai-spector, ai-spector-graph, ai-spector-generate, ai-spector-resolve-comments
|
|
226
|
-
.ai-spector/
|
|
227
|
-
templates/ # SRS / basic_design / detail_design (from init)
|
|
228
|
-
graph/traceability.graph.json
|
|
229
|
-
.docflow/analysis/knowledge.json
|
|
230
|
-
index/ # optional summaries (/summary)
|
|
231
|
-
views/graph-knowledge.html # after /visualize-graph
|
|
232
|
-
docs/
|
|
233
|
-
data-source/ # your inputs
|
|
234
|
-
srs/ # generated (+ per-UC/F detail files)
|
|
235
|
-
basic-design/
|
|
49
|
+
docs/data-source/ → /analyze → /validate-graph → /generate-srs → /index
|
|
50
|
+
→ /generate-basic-design → /generate-detail-design
|
|
236
51
|
```
|
|
237
52
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
## Troubleshooting
|
|
241
|
-
|
|
242
|
-
| Symptom | What to try |
|
|
243
|
-
|---------|-------------|
|
|
244
|
-
| CLI error during a slash command | Read agent **Blocked** message; fix cause; re-run the **same** command — see `_cli-failures.md` |
|
|
245
|
-
| Validate fails on `rendersTo` | Ensure each generated doc has `rendersTo` from its template `doc.*` node to the real file path; run **`/index`** after **`/generate-srs`** |
|
|
246
|
-
| Stale UC/F or detail sections | **`/index`** (body extract + section `definedIn`); full knowledge refresh needs **`/analyze`** |
|
|
247
|
-
| Unsure what to regenerate | **`/impact`** (empty = git diff), or describe the change in plain language |
|
|
248
|
-
| Graphify unavailable | `ai-spector index --skip-graphify` |
|
|
53
|
+
## CLI (optional)
|
|
249
54
|
|
|
250
|
-
|
|
55
|
+
For scripts or debugging: `npx ai-spector index`, `graph validate`, `graph visualize --open`, `graph impact --git`. See `npx ai-spector --help`.
|
|
251
56
|
|
|
252
|
-
##
|
|
57
|
+
## If something breaks
|
|
253
58
|
|
|
254
|
-
|
|
59
|
+
| Issue | Fix |
|
|
60
|
+
|-------|-----|
|
|
61
|
+
| Graphify / MCP | Install `uv`, reload MCP — `.cursor/commands/_cli-failures.md` |
|
|
62
|
+
| Validate errors after edits | `/index` |
|
|
63
|
+
| Old slash commands | `npx ai-spector sync-cursor` |
|
|
255
64
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
| Doc | Topic |
|
|
259
|
-
|-----|--------|
|
|
260
|
-
| [workflow-overview.md](docs/design/workflow-overview.md) | Graph-centric design |
|
|
261
|
-
| [traceability-graph-redesign.md](docs/design/traceability-graph-redesign.md) | Schema and roadmap |
|
|
262
|
-
| [testing.md](docs/testing.md) | Vitest, `tests/` layout, `npm test`, mocking |
|
|
263
|
-
|
|
264
|
-
**Tests:** [Vitest](https://vitest.dev/) — mirror `src/` under `tests/` (e.g. `tests/graph/InMemoryGraph.test.ts`). Do not colocate tests in `src/`.
|
|
65
|
+
## Develop
|
|
265
66
|
|
|
266
67
|
```bash
|
|
267
|
-
npm install && npm run build
|
|
268
|
-
npm test # vitest run
|
|
269
|
-
npm run test:watch # during development
|
|
270
|
-
npm run init:example
|
|
68
|
+
npm install && npm run build && npm test
|
|
271
69
|
```
|
|
272
70
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
| Command | Purpose |
|
|
276
|
-
|---------|---------|
|
|
277
|
-
| `ai-spector init` | Scaffold project |
|
|
278
|
-
| `ai-spector analyze` | Section tree in graph (`--merge` if knowledge present) |
|
|
279
|
-
| `ai-spector index` | Graph bootstrap, knowledge merge, doc semantics, Graphify, validate, doc indexes |
|
|
280
|
-
| `ai-spector graphify update` | Graphify code graph → `.ai-spector/.../graphify-out/` |
|
|
281
|
-
| `ai-spector graph merge --from-knowledge` | Domain nodes from staging |
|
|
282
|
-
| `ai-spector graph validate` | Schema + rules (`rendersTo` may target file paths) |
|
|
283
|
-
| `ai-spector graph visualize [--open]` | HTML report (detail docs, sections, `rendersTo` edges) |
|
|
284
|
-
| `ai-spector graph query <id> --json` | Context for generation |
|
|
285
|
-
| `ai-spector graph impact` | Regen scope — `<id>` optional with `--file`, `--heading`, or `--git` |
|
|
286
|
-
| `ai-spector comments inbox` | Thread pick table for IDE chat — JSON has `idePresentation.markdown` (`--json`) |
|
|
287
|
-
| `ai-spector comments plan C-001` | Anchor excerpt + graph impact + resolve workflow hints |
|
|
288
|
-
| `ai-spector comments list` | Open/resolved threads under `comments/` (`--file`, `--status`, `--json`) |
|
|
289
|
-
| `ai-spector comments show <threadId>` | Thread meta, replies, events |
|
|
290
|
-
| `ai-spector comments resolve <threadId> --file <path>` | Local resolve: update `meta_data.json` + append `events.jsonl` |
|
|
291
|
-
|
|
292
|
-
**`ai-spector index` flags:** `--graph-only`, `--docs-only`, `--skip-graphify`, `--skip-docs`, `--skip-merge`, `--skip-doc-semantics`, `--force-graphify`, `--skip-validate`
|
|
293
|
-
|
|
294
|
-
Option: `-r <path>` to point at another project root.
|
|
295
|
-
|
|
296
|
-
---
|
|
297
|
-
|
|
298
|
-
## Publish (maintainers)
|
|
299
|
-
|
|
300
|
-
Published via the **`devkit-mcp`** monorepo to internal Verdaccio (not public npm):
|
|
301
|
-
|
|
302
|
-
```bash
|
|
303
|
-
cd devkit-mcp
|
|
304
|
-
cp .env.example .env # set DEFAULT_DEVKIT_REGISTRY
|
|
305
|
-
npm run pack:tarballs
|
|
306
|
-
DEVKIT_REGISTRY=http://10.101.0.239:4873 npm run publish:verdaccio
|
|
307
|
-
```
|
|
308
|
-
|
|
309
|
-
Packages: `@kaopiz/ai-spector`, `@kaopiz/ai-spector-install`. See [PUBLISHING.md](PUBLISHING.md) and [`docs/release-and-publish.md`](../../docs/release-and-publish.md).
|
|
310
|
-
|
|
311
|
-
---
|
|
312
|
-
|
|
313
|
-
## License
|
|
314
|
-
|
|
315
|
-
MIT — see [LICENSE](LICENSE).
|
|
71
|
+
MIT — [LICENSE](LICENSE).
|
package/package.json
CHANGED