ai-spector 0.4.2 → 0.4.4
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/README.md +0 -1
- package/scaffold/cursor/skills/_skill-router.md +2 -4
- package/scaffold/cursor/skills/ai-spector/SKILL.md +1 -2
- package/scaffold/cursor/skills/ai-spector/references/cli-failures.md +43 -167
- package/scaffold/cursor/skills/ai-spector/references/context-management.md +157 -0
- package/scaffold/cursor/skills/ai-spector/references/generate-graph.md +6 -1
- package/scaffold/cursor/skills/ai-spector/references/generate-workflow.md +45 -105
- package/scaffold/cursor/skills/ai-spector/references/project-conventions.md +0 -1
- package/scaffold/cursor/skills/ai-spector-generate/SKILL.md +3 -7
- package/scaffold/cursor/skills/ai-spector-generate-basic-design/SKILL.md +18 -16
- package/scaffold/cursor/skills/ai-spector-generate-basic-design/references/bd-context/api-detail.md +27 -0
- package/scaffold/cursor/skills/ai-spector-generate-basic-design/references/bd-context/api-list.md +26 -0
- package/scaffold/cursor/skills/ai-spector-generate-basic-design/references/bd-context/db-design.md +22 -0
- package/scaffold/cursor/skills/ai-spector-generate-basic-design/references/bd-context/screen-detail.md +26 -0
- package/scaffold/cursor/skills/ai-spector-generate-basic-design/references/bd-context/screen-list.md +27 -0
- package/scaffold/cursor/skills/ai-spector-generate-basic-design/references/runbook.md +16 -1
- package/scaffold/cursor/skills/ai-spector-generate-prototype/SKILL.md +17 -26
- package/scaffold/cursor/skills/ai-spector-generate-prototype/references/prototype-graph-context.md +115 -0
- package/scaffold/cursor/skills/ai-spector-generate-prototype/references/runbook.md +31 -2
- package/scaffold/cursor/skills/ai-spector-generate-prototype/references/theme-picker.md +2 -0
- package/scaffold/cursor/skills/ai-spector-generate-srs/SKILL.md +22 -20
- package/scaffold/cursor/skills/ai-spector-generate-srs/references/runbook.md +17 -0
- package/scaffold/cursor/skills/ai-spector-generate-srs/references/srs-context/data-requirements.md +10 -0
- package/scaffold/cursor/skills/ai-spector-generate-srs/references/srs-context/external-interfaces.md +10 -0
- package/scaffold/cursor/skills/ai-spector-generate-srs/references/srs-context/feature-detail.md +20 -0
- package/scaffold/cursor/skills/ai-spector-generate-srs/references/srs-context/introduction.md +12 -0
- package/scaffold/cursor/skills/ai-spector-generate-srs/references/srs-context/overall-description.md +11 -0
- package/scaffold/cursor/skills/ai-spector-generate-srs/references/srs-context/quality-attributes.md +11 -0
- package/scaffold/cursor/skills/ai-spector-generate-srs/references/srs-context/use-case-detail.md +26 -0
- package/scaffold/cursor/skills/ai-spector-graph/SKILL.md +1 -2
- package/scaffold/cursor/skills/ai-spector-generate-detail-design/SKILL.md +0 -33
- package/scaffold/cursor/skills/ai-spector-generate-detail-design/references/runbook.md +0 -60
|
@@ -1,128 +1,68 @@
|
|
|
1
|
-
# Document generation workflow
|
|
1
|
+
# Document generation workflow
|
|
2
2
|
|
|
3
|
-
Used by
|
|
3
|
+
Used by SRS and basic design skills.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
| Layer-specific DAG, intent tables, waves | each skill’s `references/runbook.md` |
|
|
5
|
+
**References (load when needed):**
|
|
6
|
+
- Graph queries / merge / ingest → [generate-graph.md](./generate-graph.md)
|
|
7
|
+
- Context compaction / sub-agents → [context-management.md](./context-management.md)
|
|
8
|
+
- CLI failures → [cli-failures.md](./cli-failures.md)
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
## Language check (before first write)
|
|
12
11
|
|
|
13
|
-
|
|
12
|
+
Read `.ai-spector/.docflow/config/language.json`. If `documentLanguage` is empty or missing, load [language-picker.md](./language-picker.md) and run the picker. All content in the chosen language; IDs, paths, code never translated.
|
|
14
13
|
|
|
15
|
-
|
|
14
|
+
## Context hygiene (always)
|
|
16
15
|
|
|
17
|
-
1.
|
|
18
|
-
2.
|
|
19
|
-
3.
|
|
16
|
+
1. Only read files listed in `projectionPaths` — no `docs/**` glob.
|
|
17
|
+
2. Raw graph JSON stays in the sub-agent, not main context.
|
|
18
|
+
3. After writing a file, record path + status only; discard content.
|
|
19
|
+
4. For runs of 5+ files: compact after every wave + every 5 per-domain files. Load [context-management.md](./context-management.md) for the sub-agent pattern.
|
|
20
20
|
|
|
21
|
-
##
|
|
21
|
+
## Scope
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
| Case | User input | Behavior |
|
|
24
|
+
|---|---|---|
|
|
25
|
+
| **1 — All** | "generate all SRS" | Every DAG node. Skip `good` files unless user asked to regenerate. |
|
|
26
|
+
| **2 — Explicit** | file paths in chat | Map → DAG nodes → dependency closure. Same wave only. |
|
|
27
|
+
| **3 — Words** | "API list and screens" | Scope table → user confirms → generate. No write before yes. |
|
|
26
28
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
Each generate command defines its DAG and intent hints. The pattern is always:
|
|
30
|
-
|
|
31
|
-
| Case | User input | Agent behavior |
|
|
32
|
-
|------|------------|----------------|
|
|
33
|
-
| **1 — All** | “generate all SRS” / full layer | Plan every DAG node (+ per-domain expansions). Respect `good` on disk unless user asked to regenerate. |
|
|
34
|
-
| **2 — Explicit paths** | paths in chat (`docs/…/file.md`) | Map paths → DAG nodes → seeds. Include **dependency closure**. Batch only within the same wave. |
|
|
35
|
-
| **3 — Words** | “API list and screens” | Proposed scope table → **user confirms** → generate. **Do not write until approved.** |
|
|
36
|
-
|
|
37
|
-
Paths are repo-relative. Mixed args: treat paths as case 2, free text as case 3.
|
|
38
|
-
|
|
39
|
-
## Case 3 — confirm before write (mandatory)
|
|
40
|
-
|
|
41
|
-
1. Parse the request against that command’s `dag.*.json`, `dag.*.graph-seeds.json`, and graph domain nodes.
|
|
42
|
-
2. Build a **proposed scope** table (columns: DAG id, output path, seed, reason, prerequisites / deps).
|
|
43
|
-
3. Include **dependency closure** — ancestors that are `missing_file` / `missing_content` run in earlier waves unless the user skips deps.
|
|
44
|
-
4. Ask:
|
|
45
|
-
|
|
46
|
-
```text
|
|
47
|
-
I plan to generate the following (N items, waves X–Y). Prerequisites run first.
|
|
48
|
-
Reply **yes** to proceed, **no** to cancel, or edit the list.
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
5. **Stop** without explicit **yes**. Do not write on assumption.
|
|
52
|
-
6. If ambiguous (e.g. “features” = list vs all detail files), ask **one** clarifying question before the table.
|
|
53
|
-
|
|
54
|
-
Command-specific phrase → DAG mappings live in each `generate-*.md` (not here).
|
|
55
|
-
|
|
56
|
-
## Prerequisites (all DAG generate commands)
|
|
57
|
-
|
|
58
|
-
1. Merged graph — normally after **analyze** (data-source ingest).
|
|
59
|
-
2. Gate:
|
|
60
|
-
|
|
61
|
-
```bash
|
|
62
|
-
ai-spector graph validate
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
On errors, pause and follow recovery in [cli-failures.md](./cli-failures.md).
|
|
66
|
-
|
|
67
|
-
3. `workflow.dependencies.json` entry for that command (SRS minimum, etc.).
|
|
29
|
+
Case 3: build scope table (DAG id, output path, seed, reason, deps) → ask → stop until confirmed.
|
|
68
30
|
|
|
69
31
|
## Plan (once per invocation)
|
|
70
32
|
|
|
71
|
-
1.
|
|
72
|
-
2. Topological sort
|
|
73
|
-
3. Map
|
|
74
|
-
4. Classify disk
|
|
75
|
-
5. Assign
|
|
76
|
-
|
|
77
|
-
## Per wave, then per target
|
|
33
|
+
1. Select targets (case 1/2/3).
|
|
34
|
+
2. Topological sort + dependency closure.
|
|
35
|
+
3. Map DAG nodes → seeds via `dag.*.graph-seeds.json`.
|
|
36
|
+
4. Classify disk: `good` | `missing_content` | `missing_file`.
|
|
37
|
+
5. Assign waves; present wave table.
|
|
78
38
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
### Wave checklist
|
|
39
|
+
## Wave checklist
|
|
82
40
|
|
|
83
41
|
```
|
|
84
|
-
- [ ]
|
|
85
|
-
- [ ]
|
|
42
|
+
- [ ] Targets for this wave identified (parallel OK within wave only)
|
|
43
|
+
- [ ] Per target: delegate graph queries to sub-agent; receive ≤400-word summary
|
|
44
|
+
- [ ] Load matching srs-context/ or bd-context/ section for this doc type
|
|
86
45
|
- [ ] Read template from .ai-spector/templates/ — never invent structure
|
|
87
|
-
- [ ] Write file
|
|
88
|
-
- [ ] Merge projection patch (rendersTo + dependsOn) for
|
|
89
|
-
- [ ] ai-spector graph validate
|
|
90
|
-
- [ ] ai-spector index
|
|
46
|
+
- [ ] Write file from summary + template
|
|
47
|
+
- [ ] Merge projection patch (rendersTo + dependsOn) for the wave
|
|
48
|
+
- [ ] ai-spector graph validate
|
|
49
|
+
- [ ] ai-spector index (basic design: every wave; SRS: see runbook)
|
|
50
|
+
- [ ] /compact with plan summary before next wave
|
|
91
51
|
```
|
|
92
52
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
Details: [generate-graph.md](./generate-graph.md) § C–E.
|
|
96
|
-
|
|
97
|
-
1. **Query** — dependency seeds (depth 2) + target seed (depth 4); `graph impact` when regenerating.
|
|
98
|
-
2. **Read** — `projectionPaths` and cited `docs/data-source/**` only; no glob of entire `docs/`.
|
|
99
|
-
3. **Write** — from DAG template; graph-backed UC/F/API/screen names only.
|
|
100
|
-
4. **Ingest** — merge patch; validate before leaving the wave.
|
|
101
|
-
|
|
102
|
-
**Forbidden:** targets from different waves in one batch; next wave before merge + validate; skipping `rendersTo` on generated docs.
|
|
103
|
-
|
|
104
|
-
### Log (optional)
|
|
105
|
-
|
|
106
|
-
Append one line per target to `.ai-spector/.docflow/logs/generate-<layer>.log` (create dir if needed): timestamp, seed, path, validate OK.
|
|
107
|
-
|
|
108
|
-
## Finish (end of command)
|
|
109
|
-
|
|
110
|
-
1. `ai-spector graph validate`
|
|
111
|
-
2. `ai-spector index` if not already run after the last wave (required for SRS — see `generate-srs.md`)
|
|
112
|
-
3. Suggest the command doc’s summary command (`/summary srs`, `/summary basic-design`, …) when listed there
|
|
113
|
-
4. Optional: `/visualize-graph` for review
|
|
114
|
-
|
|
115
|
-
Index flags: `--skip-doc-semantics` to skip UC/F body parsing; `--graph-only` for structure + merge only.
|
|
53
|
+
Per target: Delegate → Receive summary → Write → Log path/status → Ingest.
|
|
116
54
|
|
|
117
55
|
## Guardrails
|
|
118
56
|
|
|
119
|
-
-
|
|
120
|
-
-
|
|
121
|
-
-
|
|
122
|
-
-
|
|
123
|
-
-
|
|
124
|
-
-
|
|
57
|
+
- Parallel only within a wave.
|
|
58
|
+
- Sub-agent per target — never reuse a previous target's summary.
|
|
59
|
+
- No raw graph JSON in main context.
|
|
60
|
+
- No speculative reads — projectionPaths only.
|
|
61
|
+
- Case 3 requires explicit yes before any write.
|
|
62
|
+
- On CLI failure → load [cli-failures.md](./cli-failures.md).
|
|
125
63
|
|
|
126
|
-
##
|
|
64
|
+
## Finish
|
|
127
65
|
|
|
128
|
-
|
|
66
|
+
1. `ai-spector graph validate`
|
|
67
|
+
2. `ai-spector index` if not already run after last wave
|
|
68
|
+
3. Suggest summary command when runbook lists one
|
|
@@ -16,7 +16,6 @@ Missing templates → `npx ai-spector init --force`.
|
|
|
16
16
|
| Source input | `docs/data-source/` |
|
|
17
17
|
| SRS | `docs/srs/` |
|
|
18
18
|
| Basic design | `docs/basic-design/` |
|
|
19
|
-
| Detail design | `docs/detail-design/` |
|
|
20
19
|
| HTML prototype | `prototype/src/` |
|
|
21
20
|
|
|
22
21
|
## Document language
|
|
@@ -2,20 +2,16 @@
|
|
|
2
2
|
name: ai-spector-generate
|
|
3
3
|
description: >-
|
|
4
4
|
Routes ambiguous document-generation requests to the correct AI Spector layer skill (SRS, basic
|
|
5
|
-
design,
|
|
6
|
-
|
|
7
|
-
detail design, or prototype HTML.
|
|
5
|
+
design, or HTML prototype). Use only when the user says generate docs or generate requirements
|
|
6
|
+
without naming a layer. Do not use when the request clearly targets SRS, screens, APIs, or prototype HTML.
|
|
8
7
|
---
|
|
9
8
|
|
|
10
9
|
# AI Spector — Generate (router)
|
|
11
10
|
|
|
12
|
-
Ask one question or infer from context, then **switch skill** and read that skill
|
|
11
|
+
Ask one question or infer from context, then **switch skill** and read that skill's runbook:
|
|
13
12
|
|
|
14
13
|
| Layer | Skill |
|
|
15
14
|
|-------|-------|
|
|
16
15
|
| Requirements / SRS | `ai-spector-generate-srs` |
|
|
17
16
|
| Screens, APIs, DB | `ai-spector-generate-basic-design` |
|
|
18
|
-
| Implementation detail | `ai-spector-generate-detail-design` |
|
|
19
17
|
| HTML mockups | `ai-spector-generate-prototype` |
|
|
20
|
-
|
|
21
|
-
**Core:** [../ai-spector/SKILL.md](../ai-spector/SKILL.md) · **Pipeline:** [../../WORKFLOW.md](../../WORKFLOW.md)
|
|
@@ -4,31 +4,33 @@ description: >-
|
|
|
4
4
|
Generates or updates basic design documents from the traceability graph and SRS: screen list and
|
|
5
5
|
screen details, API list and endpoint details, database design under docs/basic-design/. Use when
|
|
6
6
|
the user asks for basic design, wireframes, screen map, API design, ERD, or list-screens.md. Do not
|
|
7
|
-
use for SRS-only work,
|
|
7
|
+
use for SRS-only work, HTML prototype, or graph analyze/index without doc generation.
|
|
8
8
|
paths:
|
|
9
9
|
- "docs/basic-design/**"
|
|
10
10
|
- ".ai-spector/templates/basic_design/**"
|
|
11
11
|
---
|
|
12
12
|
|
|
13
|
-
#
|
|
14
|
-
|
|
15
|
-
**Core:** [../ai-spector/SKILL.md](../ai-spector/SKILL.md)
|
|
16
|
-
|
|
17
|
-
## Required reading
|
|
13
|
+
# Generate Basic Design
|
|
18
14
|
|
|
15
|
+
## Load at start
|
|
19
16
|
1. [references/runbook.md](references/runbook.md)
|
|
20
17
|
2. [../ai-spector/references/generate-workflow.md](../ai-spector/references/generate-workflow.md)
|
|
21
|
-
3. [../ai-spector/references/generate-graph.md](../ai-spector/references/generate-graph.md) § perEndpoint / perScreen
|
|
22
18
|
|
|
23
|
-
##
|
|
19
|
+
## Load when needed
|
|
24
20
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
21
|
+
| Situation | Load |
|
|
22
|
+
|---|---|
|
|
23
|
+
| Language not set | [../ai-spector/references/language-picker.md](../ai-spector/references/language-picker.md) |
|
|
24
|
+
| Writing DB design | [references/bd-context/db-design.md](references/bd-context/db-design.md) |
|
|
25
|
+
| Writing API list | [references/bd-context/api-list.md](references/bd-context/api-list.md) |
|
|
26
|
+
| Writing API detail (per endpoint) | [references/bd-context/api-detail.md](references/bd-context/api-detail.md) |
|
|
27
|
+
| Writing screen list | [references/bd-context/screen-list.md](references/bd-context/screen-list.md) |
|
|
28
|
+
| Writing screen detail (per screen) | [references/bd-context/screen-detail.md](references/bd-context/screen-detail.md) |
|
|
29
|
+
| Graph queries / merge | [../ai-spector/references/generate-graph.md](../ai-spector/references/generate-graph.md) |
|
|
30
|
+
| CLI fails | [../ai-spector/references/cli-failures.md](../ai-spector/references/cli-failures.md) |
|
|
31
|
+
| Run of 5+ files | [../ai-spector/references/context-management.md](../ai-spector/references/context-management.md) |
|
|
31
32
|
|
|
32
|
-
##
|
|
33
|
+
## On CLI failure
|
|
34
|
+
Pause. Report full output. Offer fix + retry. Details in cli-failures.md.
|
|
33
35
|
|
|
34
|
-
|
|
36
|
+
"basic design", "screen list", "API list", "wireframe for login" → this skill.
|
package/scaffold/cursor/skills/ai-spector-generate-basic-design/references/bd-context/api-detail.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Graph → API Detail (per endpoint)
|
|
2
|
+
|
|
3
|
+
Queries:
|
|
4
|
+
```bash
|
|
5
|
+
ai-spector graph query <F-xx> --direction both --depth 4 --edges CONTEXT --json
|
|
6
|
+
ai-spector graph query <UC-xx> --direction both --depth 3 --edges CONTEXT --json
|
|
7
|
+
ai-spector graph query <entityId> --direction both --depth 2 --edges CONTEXT --json
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
| Template section | Graph source |
|
|
11
|
+
|---|---|
|
|
12
|
+
| **Summary / Operation ID** | UC `name`; camelCase from method + entity |
|
|
13
|
+
| **Source Requirement** | F-xx id + name; UC-xx id + name |
|
|
14
|
+
| **Auth** | Actor `authRequired`; UC precondition `authenticated` |
|
|
15
|
+
| **Path params** | Entity field `pk: true`; UC flow step passing an id |
|
|
16
|
+
| **Query params** | UC filter/search flow steps; F-xx filter requirements |
|
|
17
|
+
| **Request body** | F-xx `inputData` → name, type, required, validation; UC `mainFlow` input steps |
|
|
18
|
+
| **Response 2xx** | F-xx `outputData` + entity `fields` for returned object |
|
|
19
|
+
| **Response 400** | F-xx `errorHandling` validation; entity field constraints |
|
|
20
|
+
| **Response 401/403** | Actor auth; UC precondition violations |
|
|
21
|
+
| **Response 404** | UC exception "resource not found" |
|
|
22
|
+
| **Response 409** | UC exception "already exists" / "conflict" |
|
|
23
|
+
| **§2 Data Model** | Entity `fields`; `relatesTo` edges for nested objects |
|
|
24
|
+
| **§3 Error Codes** | All UC exception flows + F-xx error handling → HTTP codes |
|
|
25
|
+
| **§4 Rate Limiting** | NFR nodes tagged `rateLimit` or `performance` |
|
|
26
|
+
|
|
27
|
+
**Rule:** Every request field → F-xx `inputData` or UC flow input. Every response field → entity `fields` or F-xx `outputData`. No invented fields.
|
package/scaffold/cursor/skills/ai-spector-generate-basic-design/references/bd-context/api-list.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Graph → API List
|
|
2
|
+
|
|
3
|
+
Queries:
|
|
4
|
+
```bash
|
|
5
|
+
ai-spector graph query doc.bd.list-api --direction both --depth 3 --edges CONTEXT --json
|
|
6
|
+
ai-spector graph query doc.srs.6-external-interfaces --direction both --depth 2 --edges DEPS --json
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Derive each endpoint — **no invented endpoints**:
|
|
10
|
+
|
|
11
|
+
| Endpoint rule | Graph evidence required |
|
|
12
|
+
|---|---|
|
|
13
|
+
| GET list | `dataEntity` + UC with list/search flow |
|
|
14
|
+
| GET detail | `dataEntity` + UC with single-record read |
|
|
15
|
+
| POST create | `dataEntity` + UC with create/submit flow |
|
|
16
|
+
| PUT/PATCH update | `dataEntity` + UC with edit flow |
|
|
17
|
+
| DELETE | `dataEntity` + UC with delete/archive flow |
|
|
18
|
+
| Auth (login/logout) | Actor node + auth UC |
|
|
19
|
+
|
|
20
|
+
| Column | Graph source |
|
|
21
|
+
|---|---|
|
|
22
|
+
| **Method** | Action type: GET/POST/PUT/DELETE |
|
|
23
|
+
| **Path** | Entity name + UC slug; plural snake_case collections |
|
|
24
|
+
| **Summary** | UC `name` or F-xx `name` |
|
|
25
|
+
| **Auth required** | Actor `authRequired`; UC precondition `authenticated` |
|
|
26
|
+
| **Source F-xx / UC-xx** | F-xx and UC-xx nodes that `satisfies` this endpoint |
|
package/scaffold/cursor/skills/ai-spector-generate-basic-design/references/bd-context/db-design.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Graph → DB Design
|
|
2
|
+
|
|
3
|
+
Queries:
|
|
4
|
+
```bash
|
|
5
|
+
ai-spector graph query doc.bd.db-design --direction both --depth 4 --edges CONTEXT --json
|
|
6
|
+
ai-spector graph query <entityId> --direction both --depth 3 --edges CONTEXT --json # per entity
|
|
7
|
+
ai-spector graph query doc.srs.5-data-requirements --direction both --depth 2 --edges DEPS --json
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
| Template section | Graph source |
|
|
11
|
+
|---|---|
|
|
12
|
+
| **§1 DBMS** | NFR nodes tagged `infrastructure` or `database`; data-source mentions |
|
|
13
|
+
| **§2 ERD entities** | All `dataEntity` nodes → table names (snake_case) |
|
|
14
|
+
| **§2 ERD relationships** | `relatesTo` / `dependsOn` edges between entities → cardinality from edge `label` |
|
|
15
|
+
| **§3 Table list** | All `dataEntity` nodes → `description` |
|
|
16
|
+
| **§4 Fields** | Entity `fields` array → name, type, required, constraints, default |
|
|
17
|
+
| **§4 Primary key** | Field with `pk: true` or id convention |
|
|
18
|
+
| **§4 Foreign keys** | `relatesTo` / `dependsOn` edges → FK = `<target>_id` unless node specifies |
|
|
19
|
+
| **§4 Indexes** | Entity `indexes` array; NFR performance constraints on this entity |
|
|
20
|
+
| **§4 Constraints** | Field `validationRules` + NFR constraint nodes |
|
|
21
|
+
|
|
22
|
+
**Rule:** Every table → `dataEntity` node. Every FK → edge. No tables without graph backing.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Graph → Screen Detail (per screen)
|
|
2
|
+
|
|
3
|
+
Queries:
|
|
4
|
+
```bash
|
|
5
|
+
ai-spector graph query doc.bd.screen-<slug> --direction both --depth 4 --edges CONTEXT --json
|
|
6
|
+
ai-spector graph query <UC-xx> --direction both --depth 4 --edges CONTEXT --json
|
|
7
|
+
ai-spector graph query <F-xx> --direction both --depth 3 --edges CONTEXT --json
|
|
8
|
+
ai-spector graph query <api-node> --direction both --depth 2 --edges DEPS --json
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
| Template section | Graph source |
|
|
12
|
+
|---|---|
|
|
13
|
+
| **Purpose / User Role** | UC `name` + description; actor node name(s) |
|
|
14
|
+
| **§1.1 Wireframe components** | UC `mainFlow` actor actions → form/button/list; UC `postconditions` → success state |
|
|
15
|
+
| **§1.2 Layout** | Input steps → form; output steps → display/table; nav steps → breadcrumb/back |
|
|
16
|
+
| **§1.3 Form fields** | API request body (F-xx `inputData`) → one input per field |
|
|
17
|
+
| **§1.3 Table columns** | API response body (entity `fields`) → one column per field |
|
|
18
|
+
| **§1.3 Buttons** | UC `mainFlow` action verbs → button labels |
|
|
19
|
+
| **§1.4 Primary actions** | UC `mainFlow` actor steps |
|
|
20
|
+
| **§1.4 Navigation** | UC `postconditions` target; `list-screens.md` §2 flow |
|
|
21
|
+
| **§1.5 Field validation** | F-xx `inputData.validationRules`; entity field constraints |
|
|
22
|
+
| **§1.5 Defaults** | F-xx `inputData.defaultValue`; entity field `default` |
|
|
23
|
+
| **Error / empty states** | UC `exceptionFlows` → one state per exception; API 404 → empty; API 400 → inline |
|
|
24
|
+
| **Role sections** | Multiple actors → mark each section with actor role |
|
|
25
|
+
|
|
26
|
+
**Rule:** Every form field → API request or F-xx `inputData`. Every column → API response or entity field. Every button label → UC flow verb. No invented content.
|
package/scaffold/cursor/skills/ai-spector-generate-basic-design/references/bd-context/screen-list.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Graph → Screen List
|
|
2
|
+
|
|
3
|
+
Queries:
|
|
4
|
+
```bash
|
|
5
|
+
ai-spector graph query doc.bd.list-screen --direction both --depth 3 --edges CONTEXT --json
|
|
6
|
+
ai-spector graph query doc.srs.3-use-cases --direction both --depth 2 --edges DEPS --json
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Derive each screen — **no invented screens**:
|
|
10
|
+
|
|
11
|
+
| Screen rule | Graph evidence |
|
|
12
|
+
|---|---|
|
|
13
|
+
| One screen per UC with actor-facing interaction steps | UC `mainFlow` with actor actions |
|
|
14
|
+
| List/dashboard per browsable entity | `dataEntity` + UC with list/search flow |
|
|
15
|
+
| Detail/form per creatable or editable entity | `dataEntity` + UC with create/edit flow |
|
|
16
|
+
| Auth screens | Actor node + login/auth UC |
|
|
17
|
+
| Role variants | Multiple actors on same UC → separate screens or role tabs |
|
|
18
|
+
|
|
19
|
+
| Column | Graph source |
|
|
20
|
+
|---|---|
|
|
21
|
+
| **Screen ID** | S-xx sequentially |
|
|
22
|
+
| **Screen Name** | UC name or entity name + action |
|
|
23
|
+
| **Purpose** | UC one-line description |
|
|
24
|
+
| **User Role** | Actor node(s) satisfying this UC |
|
|
25
|
+
| **Related F-xx / UC-xx** | UC and F-xx nodes this screen satisfies |
|
|
26
|
+
|
|
27
|
+
**§2 Navigation Flow:** UC `postconditions` → target screen after action completes.
|
|
@@ -8,6 +8,7 @@ Generate basic design markdown **from the traceability graph** and upstream SRS.
|
|
|
8
8
|
|-----------------|----------|
|
|
9
9
|
| Scope cases, waves, merge, finish, guardrails | [generate-workflow.md](../../ai-spector/references/generate-workflow.md) |
|
|
10
10
|
| Graph query, ingest, perEndpoint/perScreen | [generate-graph.md](../../ai-spector/references/generate-graph.md) |
|
|
11
|
+
| **Graph → template section mapping** | **[bd-context/](./bd-context/) — load the matching section file before writing each doc type** |
|
|
11
12
|
|
|
12
13
|
**Upstream:** SRS on disk (minimum per `workflow.dependencies.json`). Do not invent APIs/screens not grounded in graph + SRS.
|
|
13
14
|
|
|
@@ -43,6 +44,20 @@ Templates: `.ai-spector/templates/basic_design/`
|
|
|
43
44
|
|
|
44
45
|
**Reindex every wave (mandatory):** `graph merge` does not parse markdown bodies. Without index after wave 0, wave 1 cannot expand endpoint rows; without index after wave 1, wave 2 cannot expand Screen Index rows.
|
|
45
46
|
|
|
47
|
+
## Graph context (required before writing each file)
|
|
48
|
+
|
|
49
|
+
After running queries ([generate-graph.md](../../ai-spector/references/generate-graph.md) § C), load the matching file from `bd-context/` for the doc type being written:
|
|
50
|
+
|
|
51
|
+
| Writing | Load |
|
|
52
|
+
|---|---|
|
|
53
|
+
| DB design | `bd-context/db-design.md` |
|
|
54
|
+
| API list | `bd-context/api-list.md` |
|
|
55
|
+
| API detail (per endpoint) | `bd-context/api-detail.md` |
|
|
56
|
+
| Screen list | `bd-context/screen-list.md` |
|
|
57
|
+
| Screen detail (per screen) | `bd-context/screen-detail.md` |
|
|
58
|
+
|
|
59
|
+
Every endpoint, table, and screen must trace to graph nodes. No invented structure.
|
|
60
|
+
|
|
46
61
|
## Basic-design-specific write rules
|
|
47
62
|
|
|
48
63
|
- **List chapters first** — names from `api-list.md` / `list-screens.md` tables; not one file per `F-xx`.
|
|
@@ -74,7 +89,7 @@ Execution checklist: [generate-workflow.md](../../ai-spector/references/generate
|
|
|
74
89
|
## Finish
|
|
75
90
|
|
|
76
91
|
- Last wave already ran validate + index → final validate only; else run both again.
|
|
77
|
-
- Suggest **`/summary basic-design`**
|
|
92
|
+
- Suggest **`/summary basic-design`** when workflow lists it.
|
|
78
93
|
|
|
79
94
|
Log: `.ai-spector/.docflow/logs/generate-basic-design.log`.
|
|
80
95
|
|
|
@@ -5,38 +5,29 @@ description: >-
|
|
|
5
5
|
Use when the user asks for HTML prototype, screen mockups, or prototype/src files. When no theme is
|
|
6
6
|
stored, recommends 3 best-fit themes from project context, opens preview samples in the browser,
|
|
7
7
|
and waits for the user to choose before setup. Uses stored preference on subsequent runs. Do not use
|
|
8
|
-
for markdown SRS/basic
|
|
8
|
+
for markdown SRS/basic design only, or graph operations without HTML output.
|
|
9
9
|
paths:
|
|
10
10
|
- "prototype/**"
|
|
11
11
|
---
|
|
12
12
|
|
|
13
|
-
#
|
|
13
|
+
# Generate Prototype
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
## Load at start
|
|
16
|
+
1. [references/runbook.md](references/runbook.md)
|
|
16
17
|
|
|
17
|
-
##
|
|
18
|
+
## Load when needed
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
| Situation | Load |
|
|
21
|
+
|---|---|
|
|
22
|
+
| Language not set | [../ai-spector/references/language-picker.md](../ai-spector/references/language-picker.md) |
|
|
23
|
+
| No theme stored — **must confirm before setup** | [references/theme-picker.md](references/theme-picker.md) |
|
|
24
|
+
| No basic auth stored | [references/auth-picker.md](references/auth-picker.md) |
|
|
25
|
+
| Before writing each screen HTML | [references/prototype-graph-context.md](references/prototype-graph-context.md) |
|
|
26
|
+
| Run of 5+ screens | [../ai-spector/references/context-management.md](../ai-spector/references/context-management.md) |
|
|
27
|
+
| CLI fails | [../ai-spector/references/cli-failures.md](../ai-spector/references/cli-failures.md) |
|
|
22
28
|
|
|
23
|
-
##
|
|
29
|
+
## On CLI failure
|
|
30
|
+
Pause. Report full output. Offer fix + retry. Details in cli-failures.md.
|
|
24
31
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
- [ ] list-screens + screen detail docs exist
|
|
28
|
-
- [ ] basic auth resolved (config basicAuth + prototype/htpasswd → **auth picker if none**)
|
|
29
|
-
- [ ] theme resolved (request → theme.json → manifest → config → **theme picker if none**)
|
|
30
|
-
- [ ] if picker: 3 recommendations + previews opened + user confirmed before setup
|
|
31
|
-
- [ ] prototype setup (with --theme when needed; persists when user named a theme)
|
|
32
|
-
- [ ] one .html per screen; prototypeStem from manifest
|
|
33
|
-
- [ ] prototype manifest && prototype validate --strict
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
## Natural language
|
|
37
|
-
|
|
38
|
-
“HTML prototype”, “mockup screens”, “prototype with stripe theme” → this skill.
|
|
39
|
-
|
|
40
|
-
“Help me pick a theme”, “what theme fits my app?”, “show me theme options” → [theme-picker.md](references/theme-picker.md) (even before generating).
|
|
41
|
-
|
|
42
|
-
Constraints: `prototype/CLAUDE.md` in the project repo.
|
|
32
|
+
"HTML prototype", "mockup screens", "prototype with stripe theme" → this skill.
|
|
33
|
+
"Help me pick a theme" → load theme-picker.md directly.
|
package/scaffold/cursor/skills/ai-spector-generate-prototype/references/prototype-graph-context.md
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# Graph context for prototype generation
|
|
2
|
+
|
|
3
|
+
Run these queries **before writing each screen's HTML**. The graph holds the authoritative spec — screen detail docs often summarize it; the graph has the full picture.
|
|
4
|
+
|
|
5
|
+
Skip this document only when the graph has zero nodes for the screen (brand-new project with no graph yet). In that case, note the gap and generate from screen detail doc alone.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Step 1 — Screen node + neighborhood
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
ai-spector graph query doc.bd.screen-<slug> --direction both --depth 4 --edges CONTEXT --json
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
What to extract from the result:
|
|
16
|
+
|
|
17
|
+
| Field / edge | Use in HTML |
|
|
18
|
+
|---|---|
|
|
19
|
+
| `satisfies` → F-xx nodes | Business rules, field constraints, success/error states |
|
|
20
|
+
| `satisfies` → UC-xx nodes | Actor roles, preconditions, flow steps, postconditions |
|
|
21
|
+
| `dependsOn` → `doc.bd.api-*` nodes | Form fields, request params, response columns |
|
|
22
|
+
| `contains` → section nodes | Section headings and subsections already defined |
|
|
23
|
+
| `tracesTo` → SRS nodes | NFR constraints (e.g. required, max length, format) |
|
|
24
|
+
|
|
25
|
+
If `doc.bd.screen-<slug>` is not found in the graph, try `screen-<slug>` or the screenId from `list-screens.md`.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Step 2 — Feature detail (per linked F-xx)
|
|
30
|
+
|
|
31
|
+
For each F-xx found in Step 1 `satisfies` edges:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
ai-spector graph query F-<n> --direction both --depth 3 --edges CONTEXT --json
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Extract:
|
|
38
|
+
- **Functional requirements** listed under the feature → must-have UI behaviours
|
|
39
|
+
- **Field definitions** (`rendersTo` → docs if present)
|
|
40
|
+
- **Business rules** (validation, conditional visibility, permissions)
|
|
41
|
+
- **Actor** that performs / views this feature → drives role-based UI variants
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Step 3 — Use-case detail (per linked UC-xx)
|
|
46
|
+
|
|
47
|
+
For each UC-xx found in Step 1 `satisfies` edges:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
ai-spector graph query UC-<n> --direction both --depth 3 --edges CONTEXT --json
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Extract:
|
|
54
|
+
- **Primary actor** → who the screen is for; if multiple actors, plan role tabs or conditional sections
|
|
55
|
+
- **Preconditions** → what state must be shown before the main action (e.g. "must be logged in" → redirect guard state)
|
|
56
|
+
- **Main flow steps** → maps directly to the interactive sequence in the HTML (form → submit → result)
|
|
57
|
+
- **Alternative / exception flows** → error states and empty states to include
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Step 4 — API endpoint detail (per linked API)
|
|
62
|
+
|
|
63
|
+
For each `doc.bd.api-*` node found in Step 1 `dependsOn` edges:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
ai-spector graph query doc.bd.api-<slug> --direction both --depth 2 --edges DEPS --json
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Extract:
|
|
70
|
+
- **Request body fields** → form inputs (name, type, required/optional, format hints)
|
|
71
|
+
- **Response body fields** → table columns, card properties, display labels
|
|
72
|
+
- **HTTP method + path** → drives the form `action` hint and confirmation copy
|
|
73
|
+
- **Error codes** → error message copy and UI states (404 → empty state, 400 → inline validation, 401 → redirect)
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Step 5 — Actor / permission check
|
|
78
|
+
|
|
79
|
+
If the screen serves multiple actors (e.g. Admin + End User):
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
ai-spector graph query <actorId> --direction both --depth 2 --edges CONTEXT --json
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Use actor data to:
|
|
86
|
+
- Render role-specific sections (admin actions gated behind a permission check visual)
|
|
87
|
+
- Show the correct navigation items for each role
|
|
88
|
+
- Label buttons and headings with the actor's natural language (not just "user")
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Synthesis — before writing the HTML
|
|
93
|
+
|
|
94
|
+
Compile answers to these questions from the query results. Do **not** invent answers not grounded in graph data — leave a `<!-- TODO: not in spec -->` comment instead.
|
|
95
|
+
|
|
96
|
+
| Question | Source |
|
|
97
|
+
|---|---|
|
|
98
|
+
| What fields does the form have? | API request body (Step 4) |
|
|
99
|
+
| What columns / data does the list/detail show? | API response body (Step 4) |
|
|
100
|
+
| What validation rules apply? | F-xx business rules (Step 2) |
|
|
101
|
+
| What error states must exist? | UC exception flows (Step 3) + API error codes (Step 4) |
|
|
102
|
+
| What empty state must exist? | UC preconditions + API 404 handling |
|
|
103
|
+
| Which actors see what? | Actor roles (Step 3 + 5) |
|
|
104
|
+
| What is the navigation target after the main action? | UC postconditions + `list-screens.md` §2 flow |
|
|
105
|
+
| Any NFR constraints (length limits, formats)? | SRS `tracesTo` nodes (Step 1) |
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Accuracy rules
|
|
110
|
+
|
|
111
|
+
1. **Every form field must trace to** an API request field, an F-xx field definition, or a UC data requirement. Remove any field that has no graph backing.
|
|
112
|
+
2. **Every table column must trace to** an API response field or a data entity property. No invented columns.
|
|
113
|
+
3. **Every button / action must trace to** a UC main flow step or F-xx functional requirement. Label it with the spec's language, not generic copy ("Save" is fine only if the spec says save; use the spec's verb if it differs).
|
|
114
|
+
4. **Error and empty states are mandatory** when the UC has exception flows or the API returns error codes. A screen with only the happy-path is incomplete.
|
|
115
|
+
5. **Role-based sections are mandatory** when more than one actor satisfies the screen. Use a visual separator or tab — do not silently drop one actor's view.
|