@shanyucoder/flowgrid 0.1.11 → 0.1.12
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/adapters/shared/resolve-hub-id.mjs +5 -1
- package/dist/docs/mcp/tools.js +59 -6
- package/dist/docs/mcp/tools.js.map +1 -1
- package/dist/docs/scan/screen-to-flows.d.ts +3 -0
- package/dist/docs/scan/screen-to-flows.js +18 -0
- package/dist/docs/scan/screen-to-flows.js.map +1 -0
- package/engines/docs/lib/render-bundle-markdown.mjs +19 -0
- package/engines/docs/lib/render-design-markdown.mjs +56 -0
- package/engines/docs/lib/screen-to-flows-index.mjs +121 -0
- package/engines/docs/vitepress/surfaces-nav.mjs +7 -0
- package/engines/spec/lib/audit-bundle-gaps.mjs +15 -3
- package/engines/spec/lib/audit-interaction-cases.mjs +185 -0
- package/engines/spec/lib/bundle-ir.mjs +7 -0
- package/engines/spec/lib/bundle-schema.mjs +1 -0
- package/engines/spec/lib/interaction-cases.mjs +46 -0
- package/engines/spec/split-bundle.mjs +1 -1
- package/harness/docs/extracts/agent-design-context.md +124 -0
- package/harness/docs/extracts/extract-registry.docs.json +6 -3
- package/harness/docs/skills/api-spec/SKILL.md +4 -0
- package/harness/docs/skills/grill-dev/SKILL.md +22 -9
- package/harness/docs/skills/spec/SKILL.md +8 -5
- package/harness/docs/skills/user-flow/SKILL.md +4 -2
- package/harness/fe/skills/prototype/SKILL.md +22 -10
- package/package.json +1 -1
- package/templates/shared/bundle-authoring.md +2 -1
- package/templates/shared/default-layout.ejs +47 -2
- package/templates/shared/feature.bundle.yaml +29 -1
- package/templates/shared/tpl-runtime-sequence.md +56 -0
|
@@ -7,6 +7,13 @@
|
|
|
7
7
|
const hasStories = !!spec.userStories;
|
|
8
8
|
const hasNfr = spec.nfr && String(spec.nfr).trim();
|
|
9
9
|
const hasUserFlows = spec.userFlows && String(spec.userFlows).trim();
|
|
10
|
+
const icBlock = spec.interactionCases;
|
|
11
|
+
const icItems = icBlock && Array.isArray(icBlock.items) ? icBlock.items : [];
|
|
12
|
+
const hasInteractionCases =
|
|
13
|
+
icBlock &&
|
|
14
|
+
(icBlock.policy === 'skip' ||
|
|
15
|
+
icItems.length > 0 ||
|
|
16
|
+
(icBlock.policy === 'required' && icItems.length === 0));
|
|
10
17
|
const qaOpen = spec['Q&A'] && String(spec['Q&A']).trim();
|
|
11
18
|
const hasEntities = spec.entities && (Array.isArray(spec.entities) ? spec.entities.length : true);
|
|
12
19
|
const pageSections = spec.sections || spec.design?.sections || [];
|
|
@@ -34,8 +41,9 @@
|
|
|
34
41
|
if (hasNonGoals) addToc('Out of scope', 'scope-out');
|
|
35
42
|
if (hasStories) addToc('User stories & requirements', 'user-stories--screen-journey');
|
|
36
43
|
addToc('Data & integrations / API', 'data-integrations');
|
|
37
|
-
if (hasUserFlows) addToc('
|
|
44
|
+
if (hasUserFlows) addToc('Linked user flows (FLOW)', 'user-flows');
|
|
38
45
|
if (hasNfr) addToc('Non-functional (NFR)', 'nfr');
|
|
46
|
+
if (hasInteractionCases) addToc('Interaction cases', 'interaction-cases');
|
|
39
47
|
if (hasState) addToc('State & permissions matrix', 'state--permission-matrix');
|
|
40
48
|
if (hasListColumns) addToc('List columns', 'list-columns');
|
|
41
49
|
if (hasListExtras) addToc('Filters & pagination', 'list-filters-pagination');
|
|
@@ -213,7 +221,11 @@ Backend contract: `api/<seq>/01-backend-spec.yaml` on the same function leaf (no
|
|
|
213
221
|
<% } %>
|
|
214
222
|
|
|
215
223
|
<% if (hasUserFlows) { %>
|
|
216
|
-
##
|
|
224
|
+
## Linked user flows (FLOW) {#user-flows}
|
|
225
|
+
|
|
226
|
+
Use product journey docs (`FLOW-*.md`) — include §6 sequence. Convention per line:
|
|
227
|
+
|
|
228
|
+
`FLOW-<id> — role: entry|step-N-*|exit — screens: W-* … (this leaf)`
|
|
217
229
|
|
|
218
230
|
<%= spec.userFlows %>
|
|
219
231
|
|
|
@@ -226,6 +238,39 @@ Backend contract: `api/<seq>/01-backend-spec.yaml` on the same function leaf (no
|
|
|
226
238
|
|
|
227
239
|
<% } %>
|
|
228
240
|
|
|
241
|
+
<% if (hasInteractionCases) { %>
|
|
242
|
+
## Interaction cases {#interaction-cases}
|
|
243
|
+
|
|
244
|
+
<% if (icBlock.policy === 'skip') { %>
|
|
245
|
+
_Screen interaction sequences skipped:_ <%= icBlock.skipReason || '(no reason given)' %>
|
|
246
|
+
|
|
247
|
+
<% } else { %>
|
|
248
|
+
> Sequence diagrams: [design.md](./design.md) (generated). Authoring: `interactionCases` on `*.bundle.yaml`.
|
|
249
|
+
|
|
250
|
+
<% for (const item of icItems) { %>
|
|
251
|
+
### <%= item.id || 'IC-?' %> {#<%= String(item.id || 'ic').toLowerCase() %>}
|
|
252
|
+
|
|
253
|
+
<% if (item.title) { %>**<%= item.title %>**
|
|
254
|
+
|
|
255
|
+
<% } %>
|
|
256
|
+
<% if (item.description) { %>
|
|
257
|
+
<%= item.description %>
|
|
258
|
+
|
|
259
|
+
<% } %>
|
|
260
|
+
<% if (item.links && typeof item.links === 'object') { %>
|
|
261
|
+
| Link | Value |
|
|
262
|
+
| --- | --- |
|
|
263
|
+
<% for (const [k, v] of Object.entries(item.links)) { %>
|
|
264
|
+
| `<%= k %>` | <%= v %> |
|
|
265
|
+
<% } %>
|
|
266
|
+
|
|
267
|
+
<% } %>
|
|
268
|
+
[View sequence diagram](./design.md#<%= String(item.id || 'ic').toLowerCase() %>)
|
|
269
|
+
|
|
270
|
+
<% } %>
|
|
271
|
+
<% } %>
|
|
272
|
+
<% } %>
|
|
273
|
+
|
|
229
274
|
<%
|
|
230
275
|
const page = {
|
|
231
276
|
nav: spec.nav || spec.design?.nav,
|
|
@@ -26,7 +26,35 @@ nonGoals: |
|
|
|
26
26
|
- [VD: không export Excel tại màn list — defer QA/debt]
|
|
27
27
|
|
|
28
28
|
userFlows: |
|
|
29
|
-
-
|
|
29
|
+
- FLOW-checkout — role: step-3-ops — screens: W-ADM-ORD-01 (this leaf)
|
|
30
|
+
# Journey SSOT: FLOW-*.md (§6 sequenceDiagram) — read via userFlows before codegen
|
|
31
|
+
|
|
32
|
+
# Optional — màn nhiều state / case trên một W-* (L2). Không thay FLOW-*.md.
|
|
33
|
+
# interactionCases:
|
|
34
|
+
# policy: required
|
|
35
|
+
# items:
|
|
36
|
+
# - id: IC-SUBMIT-HAPPY
|
|
37
|
+
# title: "Lưu từ DRAFT"
|
|
38
|
+
# description: |
|
|
39
|
+
# User bấm Lưu; form hợp lệ; chuyển trạng thái.
|
|
40
|
+
# links:
|
|
41
|
+
# actionId: btn_save_record
|
|
42
|
+
# recordStatus: DRAFT
|
|
43
|
+
# sequenceDiagram: |
|
|
44
|
+
# sequenceDiagram
|
|
45
|
+
# actor U as User
|
|
46
|
+
# participant W as [W-ADM-ORD-01]
|
|
47
|
+
# U->>W: Submit
|
|
48
|
+
# - id: IC-SUBMIT-409
|
|
49
|
+
# title: "Conflict"
|
|
50
|
+
# description: |
|
|
51
|
+
# Optimistic lock conflict — giữ form, reload.
|
|
52
|
+
# links:
|
|
53
|
+
# actionId: btn_save_record
|
|
54
|
+
# sequenceDiagram: |
|
|
55
|
+
# sequenceDiagram
|
|
56
|
+
# U->>W: Submit
|
|
57
|
+
# W-->>U: 409 message
|
|
30
58
|
|
|
31
59
|
nfr: |
|
|
32
60
|
- **Hiệu năng:** [VD: danh sách < 2s với 10k bản ghi — phân trang server]
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
---
|
|
2
|
+
page-id: W-XXX-DOMAIN-01
|
|
3
|
+
title: "Runtime sequence — <feature title>"
|
|
4
|
+
status: draft
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Runtime sequence — `<page-id>`
|
|
8
|
+
|
|
9
|
+
> SSOT for **tech review** (BE/FE). Journey context: link `FLOW-*` from bundle `userFlows`.
|
|
10
|
+
> Authoring: `ir/runtime-sequence.md` or `api/<seq>/02-runtime-sequence.md` — not this generated copy.
|
|
11
|
+
|
|
12
|
+
## Scope
|
|
13
|
+
|
|
14
|
+
- **In this diagram:** …
|
|
15
|
+
- **Out of scope:** …
|
|
16
|
+
|
|
17
|
+
## Preconditions & state
|
|
18
|
+
|
|
19
|
+
| State / gate | Rule |
|
|
20
|
+
| --- | --- |
|
|
21
|
+
| e.g. `DRAFT` | User may edit until submit |
|
|
22
|
+
|
|
23
|
+
## Sequence
|
|
24
|
+
|
|
25
|
+
```mermaid
|
|
26
|
+
sequenceDiagram
|
|
27
|
+
autonumber
|
|
28
|
+
actor U as User
|
|
29
|
+
participant W as [W-XXX-DOMAIN-01]
|
|
30
|
+
participant API as [API-XXX-DOMAIN-01]
|
|
31
|
+
participant Svc as DomainService
|
|
32
|
+
participant DB as Database
|
|
33
|
+
|
|
34
|
+
U->>W: Open screen
|
|
35
|
+
W->>API: Load (GET …)
|
|
36
|
+
API->>Svc: fetch
|
|
37
|
+
Svc->>DB: query
|
|
38
|
+
DB-->>Svc: rows
|
|
39
|
+
Svc-->>API: DTO
|
|
40
|
+
API-->>W: 200 + body
|
|
41
|
+
W-->>U: Render
|
|
42
|
+
|
|
43
|
+
alt Validation error
|
|
44
|
+
API-->>W: 422 field errors
|
|
45
|
+
W-->>U: Inline messages
|
|
46
|
+
else Conflict
|
|
47
|
+
API-->>W: 409
|
|
48
|
+
W-->>U: Toast + stay
|
|
49
|
+
end
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Traceability
|
|
53
|
+
|
|
54
|
+
| Step | Endpoint / action | Tables / events |
|
|
55
|
+
| --- | --- | --- |
|
|
56
|
+
| 1 | `endpoints[].id` … | … |
|