@shanyucoder/flowgrid 0.1.11 → 0.1.13

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 (83) hide show
  1. package/adapters/shared/resolve-hub-id.mjs +5 -1
  2. package/dist/docs/mcp/tools.js +59 -6
  3. package/dist/docs/mcp/tools.js.map +1 -1
  4. package/dist/docs/scan/screen-to-flows.d.ts +3 -0
  5. package/dist/docs/scan/screen-to-flows.js +18 -0
  6. package/dist/docs/scan/screen-to-flows.js.map +1 -0
  7. package/engines/docs/lib/render-bundle-markdown.mjs +19 -0
  8. package/engines/docs/lib/render-design-markdown.mjs +56 -0
  9. package/engines/docs/lib/screen-to-flows-index.mjs +121 -0
  10. package/engines/docs/vitepress/surfaces-nav.mjs +7 -0
  11. package/engines/spec/lib/audit-bundle-gaps.mjs +15 -3
  12. package/engines/spec/lib/audit-interaction-cases.mjs +186 -0
  13. package/engines/spec/lib/bundle-ir.mjs +7 -0
  14. package/engines/spec/lib/bundle-schema.mjs +1 -0
  15. package/engines/spec/lib/interaction-cases.mjs +46 -0
  16. package/engines/spec/split-bundle.mjs +1 -1
  17. package/harness/be/adapters/dotnet-integration/skills/framework-rules-be/SKILL.md +2 -2
  18. package/harness/be/adapters/fastapi/skills/framework-rules-be/SKILL.md +3 -3
  19. package/harness/be/adapters/laravel/skills/framework-rules-be/SKILL.md +3 -3
  20. package/harness/be/skills/api/SKILL.md +4 -4
  21. package/harness/be/skills/api-unit/SKILL.md +4 -4
  22. package/harness/be/skills/audit-api/SKILL.md +3 -3
  23. package/harness/be/skills/grill-api-unit/SKILL.md +2 -2
  24. package/harness/common/rules/artifactgraph.mdc +2 -2
  25. package/harness/common/rules/cross-repo-index.mdc +2 -2
  26. package/harness/common/rules/platform-code-size.mdc +5 -5
  27. package/harness/common/rules/team-flow-harness-state.mdc +4 -4
  28. package/harness/common/skills/business-impact-review/SKILL.md +1 -1
  29. package/harness/common/skills/configure-repo-maps/SKILL.md +1 -1
  30. package/harness/common/skills/docs-mark/SKILL.md +4 -4
  31. package/harness/docs/extracts/agent-design-context.md +136 -0
  32. package/harness/docs/extracts/extract-registry.docs.json +9 -3
  33. package/harness/docs/extracts/ir-read-only.md +42 -0
  34. package/harness/docs/rules/agent-compliance.mdc +5 -1
  35. package/harness/docs/rules/docs-hub.mdc +6 -6
  36. package/harness/docs/rules/flowgrid-process.mdc +5 -5
  37. package/harness/docs/rules/team-flow-grill.mdc +1 -1
  38. package/harness/docs/rules/team-flow-spec.mdc +5 -5
  39. package/harness/docs/skills/adopt/SKILL.md +1 -1
  40. package/harness/docs/skills/api/SKILL.md +2 -2
  41. package/harness/docs/skills/api-spec/SKILL.md +4 -0
  42. package/harness/docs/skills/build-templates/SKILL.md +1 -1
  43. package/harness/docs/skills/call-external/SKILL.md +1 -1
  44. package/harness/docs/skills/cross-entity-service/SKILL.md +1 -1
  45. package/harness/docs/skills/db-erd/SKILL.md +2 -2
  46. package/harness/docs/skills/grill/SKILL.md +1 -1
  47. package/harness/docs/skills/grill-api-spec/SKILL.md +3 -3
  48. package/harness/docs/skills/grill-bqa/SKILL.md +2 -2
  49. package/harness/docs/skills/grill-dev/SKILL.md +31 -13
  50. package/harness/docs/skills/grill-docs/SKILL.md +2 -2
  51. package/harness/docs/skills/grill-hub-prd/SKILL.md +1 -1
  52. package/harness/docs/skills/openapi/SKILL.md +3 -3
  53. package/harness/docs/skills/risk-register/SKILL.md +8 -8
  54. package/harness/docs/skills/spec/SKILL.md +20 -12
  55. package/harness/docs/skills/update-spec/SKILL.md +17 -7
  56. package/harness/docs/skills/user-flow/SKILL.md +4 -2
  57. package/harness/fe/adapters/dotnet-line/skills/framework-rules/SKILL.md +2 -2
  58. package/harness/fe/adapters/nextjs/skills/framework-rules/SKILL.md +2 -2
  59. package/harness/fe/adapters/nuxt4/skills/framework-rules/SKILL.md +2 -2
  60. package/harness/fe/rules/cross-repo-index-routing.mdc +1 -1
  61. package/harness/fe/rules/flowgrid-test-optional-accelerators.mdc +3 -3
  62. package/harness/fe/rules/team-flow-prototype.mdc +13 -13
  63. package/harness/fe/rules/team-flow-unit.mdc +6 -6
  64. package/harness/fe/skills/grill-prototype/SKILL.md +2 -2
  65. package/harness/fe/skills/grill-test/SKILL.md +1 -1
  66. package/harness/fe/skills/grill-unit/SKILL.md +2 -2
  67. package/harness/fe/skills/grill-wire/SKILL.md +1 -1
  68. package/harness/fe/skills/model/SKILL.md +4 -4
  69. package/harness/fe/skills/prototype/SKILL.md +23 -11
  70. package/harness/fe/skills/test/SKILL.md +3 -3
  71. package/harness/fe/skills/unit/SKILL.md +4 -4
  72. package/harness/fe/skills/wire/SKILL.md +5 -5
  73. package/harness/shared/rules/flowgrid-code-optional-integrations.mdc +7 -7
  74. package/harness/tests/rules/cross-repo-index-routing.mdc +1 -1
  75. package/harness/tests/rules/flowgrid-test-optional-accelerators.mdc +3 -3
  76. package/harness/tests/rules/plans-docs-first.mdc +5 -5
  77. package/harness/tests/skills/grill-testcase/SKILL.md +4 -4
  78. package/harness/tests/skills/scenario/SKILL.md +3 -3
  79. package/harness/tests/skills/testcase/SKILL.md +2 -2
  80. package/package.json +1 -1
  81. package/templates/shared/bundle-authoring.md +13 -6
  82. package/templates/shared/default-layout.ejs +47 -2
  83. package/templates/shared/feature.bundle.yaml +29 -1
@@ -0,0 +1,136 @@
1
+ # Agent design context (L1 FLOW · L2 interactionCases · NFR · ACP)
2
+
3
+ **Status:** Implemented — `interactionCases`, split/render, audit, ACP skills, `screenToFlows`, MCP `linkedFlows` / `flowgrid_docs_user_flows?id=`.
4
+
5
+ **See also:** `product-id-convention.md`. BE runtime-sequence diagram layer is a future phase (not L1/L2).
6
+
7
+ ---
8
+
9
+ ## Problem
10
+
11
+ Agents often read only `*.bundle.yaml` + `ir/design.yaml` and miss three independent axes:
12
+
13
+ | Axis | SSOT | Agent gap |
14
+ | --- | --- | --- |
15
+ | **L1 Journey (cross-screen)** | `FLOW-*.md` (Markdown only) | No enforced read before codegen on `W-*` |
16
+ | **L2 Interaction (one screen)** | `interactionCases` on bundle + `stateMatrix` / `actions` | No timeline diagram per branch (409, double-submit, …) |
17
+ | **NFR overlay** | `bundle.nfr` + `architecture/08-*` links | NFR treated as appendix, not constraint |
18
+
19
+ **Sequence diagrams at the right layer materially improve codegen quality.**
20
+
21
+ ---
22
+
23
+ ## Layer model
24
+
25
+ | Layer | SSOT | Format | Question answered |
26
+ | --- | --- | --- | --- |
27
+ | **L1** | `FLOW-*` · `common/user-flows/` | MD + **§6 `sequenceDiagram`** | Where the user goes across screens |
28
+ | **L2** | `interactionCases` on bundle (optional) | YAML → split | One `W-*`: cases + per-case sequence |
29
+ | **L3** | `bundle.design.stateMatrix` | YAML on bundle → split | Machine state/button matrix |
30
+ | **L4** | `bundle.design` + `01` | YAML on bundle → `ir/design.yaml` | Fields, actions, apiRef, outcomes |
31
+ | **NFR** | `bundle.nfr` | MD bullets | Constraints on all cases |
32
+
33
+ **Do not** put L2 single-screen branches into FLOW MD. **Do not** require L2 on trivial list-only GET screens.
34
+
35
+ ---
36
+
37
+ ## L1 ↔ leaf link: `userFlows` on bundle
38
+
39
+ ```yaml
40
+ userFlows: |
41
+ - FLOW-checkout — role: step-3-ops — screens: W-ADM-ORD-01 (this leaf)
42
+ ```
43
+
44
+ | Token | Agent use |
45
+ | --- | --- |
46
+ | `FLOW-*` | Open FLOW MD SSOT |
47
+ | `role` | Focus §4 stage |
48
+ | `screens` + `(this leaf)` | Filter journey to current screen |
49
+
50
+ Resolve FLOW paths: `architecture/03-user-flows/<FLOW>.md`, `surfaces/**/common/user-flows/<FLOW>.md`.
51
+
52
+ **Discovery:** `flowgrid_docs_route("W-…")` → `linkedFlows[]`; index `registries/docs-index.json` → `screenToFlows`.
53
+
54
+ ---
55
+
56
+ ## L2: `interactionCases` on bundle
57
+
58
+ Authoring SSOT: `feature.bundle.yaml` (not separate FLOW files).
59
+
60
+ ```yaml
61
+ interactionCases:
62
+ policy: required | skip
63
+ skipReason: "" # required when policy: skip
64
+ items:
65
+ - id: IC-SUBMIT-409
66
+ title: ...
67
+ description: ...
68
+ sequenceDiagram: |
69
+ sequenceDiagram
70
+ ...
71
+ ```
72
+
73
+ **Author here only** — on `feature.bundle.yaml`. **`flowgrid split`** partitions:
74
+
75
+ - prose (`description`, `policy`, …) → `ir/spec.yaml` → render `spec.md`
76
+ - `sequenceDiagram` per item → `ir/design.yaml` → render `design.md`
77
+
78
+ **Codegen read order for L2:** read split/render output (`design.md` + `stateMatrix` / `actions` on `ir/design.yaml`) — do not author L2 on IR.
79
+
80
+ **Not FLOW** for L2 timelines.
81
+
82
+ ---
83
+
84
+ ## Agent context package (ACP) — read before codegen
85
+
86
+ For target leaf `W-*`:
87
+
88
+ 1. **`userFlows`** → each **`FLOW-*.md`** (§3–§4 for this screen, **§6 sequence**).
89
+ 2. **`bundle.nfr`** (+ linked `architecture/08-cross-cutting/*` when cited).
90
+ 3. **`ir/generated/design.md`** when `interactionCases.policy: required` (after split + render).
91
+ 4. **`ir/design.yaml`** + **`01-backend-spec.yaml`**.
92
+ 5. Then patch `bundle.gen` / run gen.
93
+
94
+ **Chat checklist:** FLOW ids read · NFR read · L2 design.md yes/no.
95
+
96
+ **Skills:** `/spec` (declare `userFlows` when cross-screen); `/grill-dev`, `/prototype`, `/api-spec` (ACP); `/user-flow` (author FLOW + §6, trace `W-*` in §5).
97
+
98
+ ---
99
+
100
+ ## Audit (`flowgrid audit spec`)
101
+
102
+ **Target file:** always **`*.bundle.yaml`** on the function leaf — **not** `ir/spec.yaml`, `ir/design.yaml`, or `ir/generated/*`.
103
+
104
+ `engines/spec/lib/audit-bundle-gaps.mjs` parses the **bundle** and runs `auditInteractionCases(bundle)` (plus UX/DB/userFlows warnings). Patch findings on the **bundle**, then `split` → `render`.
105
+
106
+ **Step 1 — policy confirm** when screen is complex and `interactionCases` missing on the **bundle**:
107
+
108
+ - Emit `CONFIRM_INTERACTION_CASES_POLICY` in `confirms[]`.
109
+ - Options: **(Recommended) required** — set `policy: required` + `items[]`; **skip** — `policy: skip` + `skipReason`; **Other** (free text).
110
+
111
+ **Step 2 — item validation** when `policy: required` or `items.length > 0`:
112
+
113
+ - Each item needs `id`, `title`, `description`, `sequenceDiagram`.
114
+ - Optional `links.actionId`, `links.recordStatus`, `links.scenario`.
115
+
116
+ Skip step 1 when `interactionCases.policy: skip` is already declared.
117
+
118
+ ---
119
+
120
+ ## VitePress (member review)
121
+
122
+ | Page | Source |
123
+ | --- | --- |
124
+ | Spec | `ir/generated/spec.md` |
125
+ | Linked flows | Rendered from `userFlows` |
126
+ | Design sequences | `ir/generated/design.md` |
127
+ | API | `ir/generated/api.md` |
128
+
129
+ **SSOT loop:** Review **`ir/generated/spec.md`** (read-only) → gaps → **`/update-spec`** patches **`*.bundle.yaml`** → `split` → `render`. Never edit `ir/spec.yaml`, `ir/design.yaml`, or generated MD. See **`ir-read-only.md`**. No routine `spec:merge`.
130
+
131
+ ---
132
+
133
+
134
+ ## One-line summary
135
+
136
+ **L1:** `/user-flow` → `FLOW-*.md` + §6; leaf links via **`userFlows`**. **NFR:** mandatory read before design/API. **L2:** **`interactionCases`** on bundle → `spec.md` + `design.md`; never in FLOW.
@@ -28,12 +28,16 @@
28
28
  ".cursor/extracts/db-audit-wizard.md",
29
29
  ".cursor/extracts/agent-execution-protocol.md",
30
30
  ".cursor/extracts/common-scope.md",
31
- ".cursor/extracts/product-id-convention.md"
31
+ ".cursor/extracts/product-id-convention.md",
32
+ ".cursor/extracts/agent-design-context.md",
33
+ ".cursor/extracts/ir-read-only.md"
32
34
  ],
33
35
  "spec-core": [
34
36
  ".cursor/extracts/spec-core.md",
35
37
  ".cursor/extracts/common-scope.md",
36
- ".cursor/extracts/product-id-convention.md"
38
+ ".cursor/extracts/product-id-convention.md",
39
+ ".cursor/extracts/agent-design-context.md",
40
+ ".cursor/extracts/ir-read-only.md"
37
41
  ],
38
42
  "bqa-grill": [
39
43
  ".cursor/extracts/grill/validation.md",
@@ -43,7 +47,8 @@
43
47
  "dev-grill": [
44
48
  ".cursor/extracts/codegen/readiness.md",
45
49
  ".cursor/extracts/docs-mark-detect.md",
46
- ".cursor/extracts/db-audit-wizard.md"
50
+ ".cursor/extracts/db-audit-wizard.md",
51
+ ".cursor/extracts/agent-design-context.md"
47
52
  ],
48
53
  "grill-docs": [
49
54
  ".cursor/extracts/grill-docs-reconcile.md",
@@ -51,6 +56,7 @@
51
56
  ],
52
57
  "update-spec": [
53
58
  ".cursor/extracts/update-spec-delta.md",
59
+ ".cursor/extracts/ir-read-only.md",
54
60
  ".cursor/extracts/wire-spec-feedback.md",
55
61
  ".cursor/extracts/qa-inbox.md"
56
62
  ]
@@ -0,0 +1,42 @@
1
+ # IR & generated markdown — read-only (SSOT = bundle)
2
+
3
+ ## Authoring SSOT (incl. L1/L2 added for agents)
4
+
5
+ **Write on `*.bundle.yaml` only** — then `split` materializes IR:
6
+
7
+ | Field | On bundle | After `split` (read-only) |
8
+ | --- | --- | --- |
9
+ | `userFlows`, `nfr`, `interactionCases` (full block) | top-level on bundle | partitioned → `ir/spec.yaml` + `ir/design.yaml` |
10
+ | `design.stateMatrix`, `design.actions`, sections | `design:` on bundle | `ir/design.yaml` |
11
+
12
+ **Never** create or edit `interactionCases` / `userFlows` first on `ir/spec.yaml` or `ir/design.yaml`. There is no separate IR authoring path for those fields.
13
+
14
+ ## Write path (single loop)
15
+
16
+ 1. **Author / patch** `*.bundle.yaml` on the function leaf (`/spec`, `/grill-*`, `/update-spec`, `/api-spec` for `01` only).
17
+ 2. **`flowgrid audit spec <bundle.yaml>`** — UX, DB, `userFlows`, **`interactionCases`** (`CONFIRM_INTERACTION_CASES_POLICY`), state/action checks all run on the **bundle file**, never on `ir/*`.
18
+ 3. **`flowgrid split`** → regenerates `ir/spec.yaml` + `ir/design.yaml` from bundle.
19
+ 4. **`flowgrid render`** → regenerates `ir/generated/*.md` for VitePress.
20
+
21
+ **Do not** use `spec:merge` / `flowgrid merge` to “fix” review findings — patch the **bundle**, then split (+ render).
22
+
23
+ ## Read-only (agents and members)
24
+
25
+ | Path | Role |
26
+ | --- | --- |
27
+ | `ir/spec.yaml` | Split output — business prose mirror. **Read only.** |
28
+ | `ir/design.yaml` | Split output — tech IR. **Read only.** |
29
+ | `ir/generated/spec.md` | **Primary human review** (VitePress). **Read only.** |
30
+ | `ir/generated/design.md` | L2 sequence diagrams (render). **Read only.** |
31
+ | `ir/generated/data-model.md`, `api.md` | Review helpers. **Read only.** |
32
+
33
+ **[STRICTLY FORBIDDEN]** `Write` / patch on any `ir/*` or `ir/generated/*` file.
34
+
35
+ ## Review → fix loop
36
+
37
+ 1. Member runs docs site build (VitePress) and reads **`ir/generated/spec.md`** (and linked `design.md` / `api.md` when relevant).
38
+ 2. Gaps, typos, scope, stories, `interactionCases`, NFR → **`/update-spec`** (or `/spec` if greenfield rewrite).
39
+ 3. Agent patches **`*.bundle.yaml` only** → audit → split → render.
40
+ 4. Re-open VitePress page to confirm.
41
+
42
+ Downstream codegen (`/prototype`, `/grill-dev`) **reads** `ir/design.yaml` (and ACP reads `ir/generated/design.md` for L2) — still **never writes** IR.
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: Enforce physical interlocks for all bộ docs skills
2
+ description: Enforce physical interlocks for all docs hub skills
3
3
  alwaysApply: true
4
4
  ---
5
5
 
@@ -24,3 +24,7 @@ When executing any skill (`/spec`, `/grill`, `/grill-bqa`, etc.):
24
24
  7. **ISOLATION:** Execute strictly within the invoked skill scope. **[STRICTLY FORBIDDEN]** to merge sibling features or output fake Markdown reports when YAML contracts are required.
25
25
 
26
26
  **Path SSOT:** `surfaces/<surface>/CMP-*/<slug>/` (NO `modules/` segment). **IDs:** `product-id-convention.md` (`surfaceCode` + `CMP|W|API-{SURF}-{DOMAIN}-{NN}`).
27
+
28
+ **Harness language:** Agent instructions in `harness/**/skills` and `harness/**/rules` are **English**. Member-facing product prose (bundle summaries, UI copy) follows `docs-hub.locale.yaml` / `/spec` — not the skill language.
29
+
30
+ **Docs hub IR:** SSOT write = **`*.bundle.yaml`** → `flowgrid split` → `flowgrid render`. **`ir/spec.yaml`**, **`ir/design.yaml`**, and **`ir/generated/*`** are **read-only** for agents and members; review fixes → **`/update-spec`** on the bundle (`ir-read-only.md`).
@@ -1,12 +1,12 @@
1
1
  ---
2
- description: bộ docs MCP — arc42/C4 docs index; opt-in skill use
2
+ description: docs hub MCP — arc42/C4 docs index; opt-in skill use
3
3
  alwaysApply: false
4
4
  ---
5
- # docs-hub (bộ docs)
5
+ # docs-hub (docs hub)
6
6
 
7
7
  Use `/docs-hub` for targeted ID, dependency, link, journey, and chapter queries.
8
8
 
9
- The docs repo owns architecture/product Markdown. bộ docs indexes and validates
9
+ The docs repo owns architecture/product Markdown. docs hub indexes and validates
10
10
  only.
11
11
 
12
12
  - In docs: `FLOWGRID_DOCS_ROOT` points to the current docs repo.
@@ -21,14 +21,14 @@ only.
21
21
  4. Run `flowgrid_docs_orphans` and `flowgrid_docs_validate_links` before claiming completeness.
22
22
  5. Use `flowgrid_docs_user_flows` before reading all journey files.
23
23
 
24
- Do not require bộ docs for architecture work: if the MCP is unavailable, inspect
24
+ Do not require docs hub for architecture work: if the MCP is unavailable, inspect
25
25
  the repository Markdown directly or explain how to run project-local setup.
26
26
 
27
27
  ## Index routing
28
28
 
29
29
  Cross-repo index is per-repo, never one giant parent-workspace graph:
30
30
 
31
- - Architecture ID / C4 path → bộ docs (`FLOWGRID_DOCS_ROOT`). Never CodeGraph for
31
+ - Architecture ID / C4 path → docs hub (`FLOWGRID_DOCS_ROOT`). Never CodeGraph for
32
32
  architecture Markdown.
33
33
  - IR / registry / generation → pointer kits when present
34
34
  (`FLOWGRID_DOCS_ROOT`, `FLOWGRID_DOCS_ROOT`, `FLOWGRID_TESTS_DOC`).
@@ -40,7 +40,7 @@ Cross-repo index is per-repo, never one giant parent-workspace graph:
40
40
  - ArtifactGraph stays local-only; it is never a shared index for other repos.
41
41
 
42
42
  ArtifactGraph is optional. If `@platform/artifactgraph` is not configured,
43
- unavailable, or fails, bộ docs must continue with targeted local search and
43
+ unavailable, or fails, docs hub must continue with targeted local search and
44
44
  scoped Markdown reads; the missing optional must never abort the run. Assign one
45
45
  stable `runId` per run. Count each successful fallback file read and its exact
46
46
  raw byte length. After the fallback completes, emit exactly one
@@ -1,9 +1,9 @@
1
1
  ---
2
- description: FlowGrid bộ process — business-process-trace (brownfield) and impact review (opt-in)
2
+ description: FlowGrid process hub — business-process-trace (brownfield) and impact review (opt-in)
3
3
  alwaysApply: false
4
4
  ---
5
5
 
6
- # FlowGrid bộ process
6
+ # FlowGrid process hub
7
7
 
8
8
  - `/business-process-trace`: observed brownfield process through code/evidence.
9
9
  - `/business-impact-review`: read-only vertical × horizontal blast-radius review.
@@ -14,11 +14,11 @@ alwaysApply: false
14
14
  Checkout routing (`cross-repo-index.mdc`): `legacy-*` →
15
15
  `legacy-repos.local.json`; other system ids → `platform-repos.local.json`.
16
16
  Ambiguous or missing keys → ask / Gaps + `/configure-repo-maps` — never invent
17
- paths. FlowGrid bộ process does not write cross-repo CodeGraph MCP entries.
17
+ paths. FlowGrid process hub does not write cross-repo CodeGraph MCP entries.
18
18
 
19
- CodeGraph, bộ docs and ArtifactGraph are optional accelerators; route them per
19
+ CodeGraph, docs hub and ArtifactGraph are optional accelerators; route them per
20
20
  repo/intent as defined in `cross-repo-index.mdc` (architecture →
21
- bộ docs, IR/registry → pointer kits, symbols of repo X → `codegraph-<key>` for
21
+ docs hub, IR/registry → pointer kits, symbols of repo X → `codegraph-<key>` for
22
22
  X). Missing tools must fall back to targeted local search/model analysis and
23
23
  explicit residual gaps. Per run/optional pair, count actual successful file reads and raw context
24
24
  bytes, then emit exactly one `flowgrid.missing-optional` event conforming to
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: bộ docs grill metadata — list/form/detail profiles
2
+ description: docs hub grill metadata — list/form/detail profiles
3
3
  globs: surfaces/**
4
4
  alwaysApply: false
5
5
  ---
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: bộ docs docs spec/grill/update workflow
2
+ description: docs hub docs spec/grill/update workflow
3
3
  globs: surfaces/**, legacy-dynamics/**
4
4
  alwaysApply: false
5
5
  ---
@@ -24,12 +24,12 @@ Shared: resolve skill `extractBundle` → `.cursor/extracts/extract-registry.doc
24
24
 
25
25
  ## Pipeline
26
26
 
27
- 1. **`/spec`** — `*.bundle.yaml` only (`feature.bundle.yaml` template; not `design-spec.yaml`). Include `successMetrics` / `nonGoals` when known. Per-zone: DSL/registry → bundle; `audit spec` `gaps[]` + non-blocking `warnings[]`. BA deliverable: `ir/generated/spec.md` after split+render. No `gen` / `codegen` in first pass.
27
+ 1. **`/spec`** — **write** `*.bundle.yaml` only → `split` → `render`. **Read-only:** `ir/spec.yaml`, `ir/design.yaml`, `ir/generated/*` (see `ir-read-only.md`). BA reviews **`ir/generated/spec.md`** on VitePress; gaps → **`/update-spec`** (not direct IR edits, not `spec:merge`). No `gen` / `codegen` in first pass.
28
28
  2. **`/grill-bqa`** — UI, acceptance, breadcrumb, delete rules.
29
- 3. **`/grill-dev`** — codegen-ready bundle + `tags`; emit bộ code FE dry-run handoff.
29
+ 3. **`/grill-dev`** — codegen-ready bundle + `tags`; emit FE code repo dry-run handoff.
30
30
  4. **`/grill-docs`** — optional reconcile when BQA↔Dev contradict.
31
- 5. **`/update-spec`** — controlled delta + `#update:*` (legacy trace → `/legacy /spec` hoặc delta legacy trong cùng skill; not full rewrite).
32
- 6. **`/prototype`** — FE-lane handoff only after bộ code dry-run passes.
31
+ 5. **`/update-spec`** — controlled delta + `#update:*` (legacy trace → `/legacy /spec` or legacy delta in the same skill; not full rewrite).
32
+ 6. **`/prototype`** — FE-lane handoff only after code repo dry-run passes.
33
33
 
34
34
  - Render: `docs_render` / `flowgrid render` (pnpm fallback during transition)
35
35
  - **[STRICTLY FORBIDDEN]** Do NOT build UI prototypes, backend implementations, live APIs, or full E2E/unit tests during the spec/grill phase.
@@ -12,7 +12,7 @@ extractBundle: architecture-core
12
12
 
13
13
  **Audit Interlock:** Run `flowgrid audit legacy <target-id>`. Consume JSON gap report to verify mapping or prompt member if index is missing.
14
14
 
15
- **Handoff SSOT spec:** Sau adopt, member drill [spec-ssot-prep.md](../../../docs/workflows/spec-ssot-prep.md) — Phase 0 → `/legacy /spec` per `W-*` (không nhảy thẳng bundle không có ID trong inventory).
15
+ **Handoff SSOT spec:** After adopt, member drills [spec-ssot-prep.md](../../../docs/workflows/spec-ssot-prep.md) — Phase 0 → `/legacy /spec` per `W-*` (do not jump straight to a bundle whose ID is not in the inventory).
16
16
 
17
17
  **Inventory template:** `.cursor/extracts/tpl-adoption-inventory.md` — section layout + **user-flow placement tiers** (cross-surface → `architecture/03-user-flows/`).
18
18
 
@@ -22,7 +22,7 @@ disable-model-invocation: true
22
22
  | Portal specs changed / merge deferred child functions | `/api-update` |
23
23
  | BE-only requirement (no FE contract change) | `/api-update --be-only` |
24
24
  | Spec exists but not codegen-ready / `approval.status` not `approved` | `/grill-api-spec` |
25
- | `approval.status: approved` + explicit implement request | bộ code BE `/api` (switch to BE repo skill — NOT this skill) |
25
+ | `approval.status: approved` + explicit implement request | BE code repo `/api` (switch to BE repo skill — NOT this skill) |
26
26
 
27
27
  - **[MANDATORY]** Locate `01-backend-spec.yaml` under: `…/api/<seq>/` (screen leaf), `…/common/yaml/<slug>/`, or any surface leaf dedicated to external-channel APIs.
28
28
  - **[STRICTLY FORBIDDEN]** Do NOT skip `/grill-api-spec` for new features, cross-portal, or legacy-derived contracts.
@@ -35,5 +35,5 @@ Doc: `docs/operational/TEAM-AI-BACKEND-WORKFLOW.md`
35
35
  ## Verification Checklist
36
36
 
37
37
  - [ ] Checked `01-backend-spec.yaml` presence, `approval.status`, and `feature.source.kind`.
38
- - [ ] Correctly routed to contract skills vs bộ code BE `/api`.
38
+ - [ ] Correctly routed to contract skills vs BE code repo `/api`.
39
39
  - [ ] Did NOT generate any content from this routing skill.
@@ -18,6 +18,10 @@ Shared extracts: `spec-evolution.md`, `api-spec-sync.md`, `entity-relationship.m
18
18
 
19
19
  Hashtag extracts: `#call-external` → `call-external.md`; `#cross-entity-service` → `cross-entity-service.md`.
20
20
 
21
+ ## Agent context (ACP) before `01`
22
+
23
+ Per **`agent-design-context.md`**: (1) `userFlows` → `FLOW-*.md` §6 (`flowgrid_docs_user_flows` / `flowgrid_docs_route`); (2) `bundle.nfr`; (3) `ir/generated/design.md` if `interactionCases.policy: required`; (4) `ir/design.yaml` + `01`. Print checklist: FLOW · NFR · L2.
24
+
21
25
  ---
22
26
 
23
27
  ## Rule: Audit Interlock
@@ -9,7 +9,7 @@ disable-model-invocation: true
9
9
 
10
10
  # /build-templates — Codebase Scanning & Template Scaffolding
11
11
 
12
- **Purpose:** Synchronize Docs Hub (bộ docs) with actual FE/BE codebase reality by scanning code and scaffolding customized `.ejs` templates.
12
+ **Purpose:** Synchronize Docs Hub (docs hub) with actual FE/BE codebase reality by scanning code and scaffolding customized `.ejs` templates.
13
13
 
14
14
  ---
15
15
 
@@ -10,7 +10,7 @@ disable-model-invocation: true
10
10
 
11
11
  # #call-external — Third-Party Integration Tag
12
12
 
13
- Used from: `/api-spec`, `/grill-api-spec`, and bộ code BE `/api` when this hashtag is present.
13
+ Used from: `/api-spec`, `/grill-api-spec`, and BE code repo `/api` when this hashtag is present.
14
14
 
15
15
  ---
16
16
 
@@ -10,7 +10,7 @@ disable-model-invocation: true
10
10
 
11
11
  # #cross-entity-service — Cross-Aggregate Orchestration Tag
12
12
 
13
- Used from: `/api-spec`, `/grill-api-spec`, and bộ code BE `/api` when this hashtag is present.
13
+ Used from: `/api-spec`, `/grill-api-spec`, and BE code repo `/api` when this hashtag is present.
14
14
 
15
15
  ---
16
16
 
@@ -10,14 +10,14 @@ extractBundle: architecture-core
10
10
 
11
11
  # /db-erd — Business Data Model (ERD)
12
12
 
13
- **Phase:** **0 Architecture** — sau `/overview`, `/module`, `/user-flow` khi có entity/bảng mới. **Trước** `/spec` leaf.
13
+ **Phase:** **0 Architecture** — after `/overview`, `/module`, `/user-flow` when new entities/tables appear. **Before** any `/spec` leaf.
14
14
 
15
15
  **Hub SSOT:** [architecture-data.md](../../../docs/workflows/architecture-data.md)
16
16
 
17
17
  **Target Path:** `<LCA>/common/db-erd.md` — LCA resolved from `.cursor/extracts/common-scope.md`.
18
18
  VitePress/publish menu label: **`db-erd`** (not the H1 heading).
19
19
 
20
- **Handoff:** Design `/spec` đọc file này; chi tiết cột → `design.sections[].db` + `spec.entities` — **không** duplicate full ER trên bundle.
20
+ **Handoff:** Design `/spec` reads this file; column detail → `design.sections[].db` + `spec.entities` — do **not** duplicate the full ER on the bundle.
21
21
 
22
22
  ---
23
23
 
@@ -22,7 +22,7 @@ SSOT flow: `docs/workflows/grill-and-human-review.md` · close checklist: `docs/
22
22
  | Gap context | Route to |
23
23
  | --- | --- |
24
24
  | Overview / surface / CMP `index.md` PRD sections | `/grill-hub-prd` |
25
- | Sổ rủi ro quota / hạn mức / peak | `/risk-register` |
25
+ | Consolidated risk register (quota / limits / peak) | `/risk-register` |
26
26
  | UI acceptance, copy, validation, UX affordance | `/grill-bqa` |
27
27
  | `bundle.gen`, codegen profile, `#gen:*`, endpoint `action` on `01` | `/grill-dev` |
28
28
  | BQA ↔ Dev contradiction on same bundle | `/grill-docs` |
@@ -12,7 +12,7 @@ disable-model-invocation: true
12
12
 
13
13
  # /grill-api-spec — API Contract Audit
14
14
 
15
- After `/api-spec`. Before bộ code BE `/api`. No code implementation on docs hub.
15
+ After `/api-spec`. Before BE code repo `/api`. No code implementation on docs hub.
16
16
 
17
17
  Shared extracts: `spec-evolution.md`, `api-spec-sync.md`, `entity-relationship.md`, `api-codegen-readiness.md`, `api-codegen-tags.md`, `call-external.md`, `agent-discipline.md`, `verify-gate.md`
18
18
 
@@ -46,7 +46,7 @@ Shared extracts: `spec-evolution.md`, `api-spec-sync.md`, `entity-relationship.m
46
46
 
47
47
  Run from docs hub cwd (or pass `--docs-root`); paths relative to docs hub:
48
48
 
49
- **Deterministic audit (lượng):**
49
+ **Deterministic audit (quantitative):**
50
50
 
51
51
  1. `flowgrid audit api <path-to-01-backend-spec.yaml>` — consume `gaps[]` / `confirms[]` on the contract.
52
52
  2. When portal-backed and sibling `*.bundle.yaml` exists: `flowgrid audit fe-be <bundle.yaml>` — `apiRef` ↔ `01` parity.
@@ -74,4 +74,4 @@ Re-run steps 1–5 after patching `01` until audit gaps are resolved or logged a
74
74
 
75
75
  ## Handoff
76
76
 
77
- - `approval.status: approved` → bộ code BE `/api` with `--spec …/01-backend-spec.yaml`
77
+ - `approval.status: approved` → BE code repo `/api` with `--spec …/01-backend-spec.yaml`
@@ -22,13 +22,13 @@ disable-model-invocation: true
22
22
  | Read (whole file) | Write | NEVER Read |
23
23
  |---|---|---|
24
24
  | **`ir/design.yaml`** (UI inventory, copy, visual, actions) | After Confirm: patch `*.bundle.yaml` → `pnpm spec:split` | Generated `*.md` |
25
- | **`ir/spec.yaml`** (requirements/acceptance prose — only when auditing) | | `bundle.gen` |
25
+ | **`ir/spec.yaml`** (prose mirror after split — read for BQA review; **audit CLI stays on bundle**) | | `bundle.gen` |
26
26
 
27
27
  ---
28
28
 
29
29
  ## Rule: Audit Interlock (`flowgrid audit spec`)
30
30
 
31
- - **[MANDATORY]** Before Step A: run `flowgrid audit spec <*.bundle.yaml> --type <pageType>`.
31
+ - **[MANDATORY]** Before Step A: run `flowgrid audit spec <*.bundle.yaml> --type <pageType>` (never `ir/spec.yaml` / `ir/design.yaml`).
32
32
  - `<pageType>` from `gen.codegen.profile` when set; else infer from prompt (list | create | detail | auth | admin-crud | …) — same table as `docs/workflows/grill-and-human-review.md`.
33
33
  - If profile unknown → AskQuestion to lock profile **before** audit (do not use `--type unknown`).
34
34
  - **[MANDATORY]** Consume `gaps[]` (patch bundle) and `confirms[]` (AskQuestion with `(Recommended)` from audit): `CONFIRM_UX_*` + **`CONFIRM_DB_*`** (`db-audit-wizard.md`).
@@ -21,10 +21,28 @@ disable-model-invocation: true
21
21
 
22
22
  ## Rule: Load Policy
23
23
 
24
- | Read (whole file) | Write | NEVER Read |
24
+ **IR is read-only** (`ir-read-only.md`). Writes go to **`*.bundle.yaml`** (+ `01` for endpoints), then **split**.
25
+
26
+ | Read (whole file) | Write | NEVER write |
25
27
  |---|---|---|
26
- | **`ir/design.yaml`** (layout, ui, projected api, entities, codegen, tags) | `bundle.gen` on `*.bundle.yaml` → `pnpm spec:split` | `ir/spec.yaml` prose, generated `*.md` |
27
- | **`api/<seq>/01-backend-spec.yaml`** (endpoint action/path) | endpoint `action` / path on **01** only — NOT `bundle.spec.api` | |
28
+ | **`ir/design.yaml`** (tech SSOT after split) | `bundle.gen` on `*.bundle.yaml` → `flowgrid split` | `ir/spec.yaml`, `ir/design.yaml`, `ir/generated/*` |
29
+ | **`ir/generated/design.md`** — L2 mermaid when `interactionCases.policy: required` (ACP only) | | |
30
+ | **`api/<seq>/01-backend-spec.yaml`** | `action` / path on **01** only — NOT `bundle.spec.api` | |
31
+
32
+ ACP fields (`userFlows`, `nfr`, `interactionCases`) are **authored on the bundle**; after split, read mirrors on `ir/*` — still **never write** IR.
33
+
34
+ ---
35
+
36
+ ## Rule: Agent context (ACP) before codegen
37
+
38
+ Per **`agent-design-context.md`** — read **before** patching `bundle.gen` / codegen:
39
+
40
+ 1. **`userFlows`** → each linked **`FLOW-*.md`** (§3–§4 for this `W-*`, **§6 sequence**).
41
+ 2. **`bundle.nfr`** (+ linked `architecture/08` if cited).
42
+ 3. **`ir/generated/design.md`** when `interactionCases.policy: required` (after `split` + `render`).
43
+ 4. Then **`ir/design.yaml`** + **`01`**.
44
+
45
+ Print checklist in chat: FLOW ids read · NFR read · L2 design.md yes/no.
28
46
 
29
47
  ---
30
48
 
@@ -32,21 +50,21 @@ disable-model-invocation: true
32
50
 
33
51
  - **[MANDATORY]** Before grilling, run: `flowgrid audit spec <bundle> --type <profile>`. Treat `warnings[]` as non-blocking; nudge BQA via handoff if summary still has `[placeholder]` brackets.
34
52
  - **[MANDATORY]** After `bundle.gen` patch: `flowgrid split` + `flowgrid render` (FE uses `ir/design.yaml`; BA PDF path uses `ir/generated/spec.md`).
35
- - `<profile>` lấy từ `gen.codegen.profile` đã xác nhận (list | create | detail | admin-crud | auth | ...).
36
- - Nếu profile chưa set → hỏi member xác định profile trước, KHÔNG chạy audit với `--type unknown`.
53
+ - `<profile>` comes from confirmed `gen.codegen.profile` (list | create | detail | admin-crud | auth | ...).
54
+ - If profile is unset → ask the member to confirm profile first; do **not** run audit with `--type unknown`.
37
55
  - Script output `gaps[]` + `confirms[]` (`CONFIRM_UX_*`, **`CONFIRM_DB_*`** — `db-audit-wizard.md`).
38
56
  - Agent patches structural `gaps[]`; UX/DB confirms → wizard; BE drift → `/api-update` then re-audit.
39
57
 
40
58
  ---
41
59
 
42
- ## Rule: Zone-Based Grill (chống Lost-in-Middle)
60
+ ## Rule: Zone-Based Grill (avoid lost-in-the-middle)
43
61
 
44
- - **[MANDATORY]** Grill theo zone, KHÔNG grill toàn bộ bundle 1 lần.
45
- - **[MANDATORY]** Chia bundle thành zones linh động theo nội dung thực:
46
- - Mỗi turn grill 1 zone: đọc zone data → phân tích chất (logic, consistency, cross-field gaps) → bổ sung/sửa.
47
- - Nếu zone quá lớn → chia nhỏ tiếp.
48
- - **[MANDATORY]** Script check **lượng** (field có/không). Agent check **chất** (nội dung chuẩn, hợp logic, gaps giữa fields).
49
- - **[STRICTLY FORBIDDEN]** Gửi all-in-one rồi bỏ sót giữa.
62
+ - **[MANDATORY]** Grill by zone; do **not** grill the entire bundle in one pass.
63
+ - **[MANDATORY]** Split the bundle into zones based on actual content:
64
+ - One zone per turn: read zone data → analyze quality (logic, consistency, cross-field gaps) → patch.
65
+ - If a zone is too large → subdivide further.
66
+ - **[MANDATORY]** Script checks **quantity** (field present or not). Agent checks **quality** (correct content, logic, cross-field gaps).
67
+ - **[STRICTLY FORBIDDEN]** Single all-in-one pass that drops items in the middle.
50
68
 
51
69
  ## Rule: Missing Information / Hard Gate & Workload Threshold (Law 2)
52
70
 
@@ -154,7 +172,7 @@ disable-model-invocation: true
154
172
 
155
173
  ## Handoff
156
174
 
157
- - bộ code FE dry pass → `/prototype`
175
+ - FE code repo dry pass → `/prototype`
158
176
  - BQA↔Dev conflict → `/grill-docs`
159
177
  - Legacy fact gap → `/legacy /spec` or `/update-spec` (legacy evidence delta)
160
178
  - Confirmed common promote → `/docs-mark` (same session or before `/prototype`)
@@ -63,7 +63,7 @@ disable-model-invocation: true
63
63
  3. Reconcile `#reuse-api` on page actions/items (no duplicate `api/<seq>/` for reused APIs).
64
64
  4. Verify codegen gate: `bundle.gen.codegen.profile` set correctly.
65
65
  5. Write/fix `bundle.gen` → `flowgrid audit spec` → `flowgrid_docs_bundle_split` → `docs_render`.
66
- 6. Handoff ID/path + recommendation to bộ code FE (`gen:dry` on FE repo).
66
+ 6. Handoff ID/path + recommendation to FE code repo (`gen:dry` on FE repo).
67
67
 
68
68
  ---
69
69
 
@@ -75,7 +75,7 @@ disable-model-invocation: true
75
75
 
76
76
  ## Handoff
77
77
 
78
- → `/prototype` after bộ code FE dry-run passes.
78
+ → `/prototype` after FE code repo dry-run passes.
79
79
 
80
80
  ---
81
81
 
@@ -20,7 +20,7 @@ disable-model-invocation: true
20
20
  - **[MANDATORY]** Run `flowgrid audit hub-prd <path-to.md>` before editing.
21
21
  - **[MANDATORY]** Fix all `gaps[]`; resolve `warnings[]` via patch or `AskQuestion` (Recommended / Other / Log as Tech Debt → `qa/` per `qa-authoring.md`).
22
22
  - **[MANDATORY]** Re-run audit until `totalGaps === 0` or gaps deferred to `qa/*.yaml`.
23
- - **[STRICTLY FORBIDDEN]** Author Personas tables or Success metrics on hub — KPI/persona ngoài hub.
23
+ - **[STRICTLY FORBIDDEN]** Author Personas tables or Success metrics on hub — KPI/persona belong off-hub.
24
24
 
25
25
  ---
26
26
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: openapi
3
- description: /openapi — generate 02-openapi.yaml from 01-backend-spec.yaml on the docs hub (bộ docs).
3
+ description: /openapi — generate 02-openapi.yaml from 01-backend-spec.yaml on the docs hub (docs hub).
4
4
  disable-model-invocation: true
5
5
  ---
6
6
 
@@ -9,7 +9,7 @@ disable-model-invocation: true
9
9
 
10
10
  # /openapi — OpenAPI YAML (docs hub)
11
11
 
12
- **Owner:** bộ docs (`--type=docs`). OpenAPI is a **docs artifact**, not bộ code.
12
+ **Owner:** docs hub (`--type=docs`). OpenAPI is a **docs artifact**, not code repo.
13
13
 
14
14
  One generator: **OpenAPI 3.0.3** from `01-backend-spec.yaml`. Merge/UI stays `openapi:render` + Redocly bundle.
15
15
 
@@ -34,5 +34,5 @@ One generator: **OpenAPI 3.0.3** from `01-backend-spec.yaml`. Merge/UI stays `op
34
34
 
35
35
  - **[MANDATORY]** If fragment is too thin (error $refs, missing examples): patch **`01-backend-spec.yaml`** and regenerate.
36
36
  - **[STRICTLY FORBIDDEN]** Do NOT hand-edit `02-openapi.yaml` as SSOT.
37
- - **[STRICTLY FORBIDDEN]** Do NOT run bộ code `--type=docs` or `nestjs --openapi`. Do NOT invent a second generator per stack.
37
+ - **[STRICTLY FORBIDDEN]** Do NOT run code repo `--type=docs` or `nestjs --openapi`. Do NOT invent a second generator per stack.
38
38
  - **[STRICTLY FORBIDDEN]** BE `/api` generates implementation code from the contract — it does NOT own OpenAPI YAML.