@shanyucoder/flowgrid 0.1.4 → 0.1.8

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 (157) hide show
  1. package/README.md +4 -1
  2. package/adapters/laravel/registries/codegen.registry.json +9 -9
  3. package/bin/flowgrid.mjs +353 -116
  4. package/bin/lib/agent-mcp.mjs +4 -0
  5. package/bin/lib/agent-profiles.mjs +30 -6
  6. package/bin/lib/audit-run.mjs +1 -1
  7. package/bin/lib/cli-update.mjs +48 -8
  8. package/bin/lib/doctor.mjs +90 -3
  9. package/bin/lib/harness-overlay.mjs +12 -5
  10. package/bin/lib/harness-sync.mjs +17 -3
  11. package/bin/lib/init-adapters.mjs +75 -0
  12. package/bin/lib/init-scaffold.mjs +9 -0
  13. package/bin/lib/inject-consumer-scripts.mjs +115 -0
  14. package/bin/lib/merge-stack-config.mjs +89 -0
  15. package/bin/lib/project-gitignore.mjs +1 -0
  16. package/bin/lib/repo-maps-align.mjs +203 -0
  17. package/dist/graph/config/load-config.js +7 -2
  18. package/dist/graph/config/load-config.js.map +1 -1
  19. package/dist/graph/mcp/tools.js +1 -1
  20. package/dist/graph/mcp/tools.js.map +1 -1
  21. package/dist/graph/registry/load-registries.d.ts +1 -0
  22. package/dist/graph/registry/load-registries.js +14 -1
  23. package/dist/graph/registry/load-registries.js.map +1 -1
  24. package/engines/cases/render-cases.mjs +67 -5
  25. package/engines/docs/lib/render-api-summary-markdown.mjs +28 -0
  26. package/engines/docs/lib/render-bundle-markdown.mjs +77 -2
  27. package/engines/docs/lib/render-data-model-markdown.mjs +171 -0
  28. package/engines/docs/lib/render-design-tables.mjs +89 -7
  29. package/engines/docs/lib/render-template.mjs +6 -0
  30. package/engines/docs/render-docs.mjs +6 -2
  31. package/engines/docs/vitepress/config.ts +7 -7
  32. package/engines/docs/vitepress/surfaces-nav.mjs +45 -14
  33. package/engines/openapi/check-backend-spec.mjs +2 -2
  34. package/engines/openapi/lib/markdown-table.mjs +8 -0
  35. package/engines/openapi/lib/render-backend-spec-markdown.mjs +78 -0
  36. package/engines/registry-sync/be-capabilities-sync.mjs +118 -0
  37. package/engines/registry-sync/fe-design-sync.mjs +258 -0
  38. package/engines/registry-sync/run-registry-sync.mjs +107 -0
  39. package/engines/shared/e2e-output-layout.mjs +68 -0
  40. package/engines/shared/flowgrid-e2e-root.mjs +19 -0
  41. package/engines/shared/resolve-flowgrid-context.mjs +176 -0
  42. package/engines/spec/lib/audit-api-gaps.mjs +1 -1
  43. package/engines/spec/lib/audit-bundle-gaps.mjs +92 -3
  44. package/engines/spec/lib/audit-db-tables.mjs +529 -0
  45. package/engines/spec/lib/audit-e2e-coverage.mjs +88 -30
  46. package/engines/spec/lib/bundle-schema.mjs +4 -1
  47. package/engines/spec/split-bundle.mjs +11 -1
  48. package/engines/testcase/runners/generate-api.mjs +23 -23
  49. package/engines/testcase/runners/generate.mjs +19 -17
  50. package/engines/testcase/runners/lib/bootstrap-context.mjs +44 -0
  51. package/engines/testcase/runners/lib/write-files.mjs +37 -9
  52. package/harness/agents/antigravity/rules/antigravity-mcp.mdc +12 -0
  53. package/harness/agents/gemini/rules/gemini-mcp.mdc +11 -0
  54. package/harness/agents/gemini_antigravity/rules/antigravity-mcp.mdc +8 -6
  55. package/harness/be/skills/{grill-api → audit-api}/SKILL.md +8 -7
  56. package/harness/common/extracts/artifact-graph.md +2 -2
  57. package/harness/common/extracts/artifactgraph-phase-hooks.md +2 -2
  58. package/harness/common/extracts/docs-mark-detect.md +2 -2
  59. package/harness/common/extracts/entity-relationship.md +23 -0
  60. package/harness/common/rules/flowgrid-ux-common.mdc +3 -3
  61. package/harness/common/skills/configure-repo-maps/SKILL.md +4 -2
  62. package/harness/docs/extracts/agent-execution-protocol.md +1 -1
  63. package/harness/docs/extracts/api-codegen-readiness.md +34 -0
  64. package/harness/docs/extracts/api-codegen-tags.md +30 -0
  65. package/harness/docs/extracts/api-contract.md +43 -0
  66. package/harness/docs/extracts/api-spec-sync.md +35 -0
  67. package/harness/docs/extracts/artifactgraph-hooks-docs.md +1 -1
  68. package/harness/docs/extracts/call-external.md +16 -0
  69. package/harness/docs/extracts/common-scope.md +9 -10
  70. package/harness/docs/extracts/db-audit-wizard.md +45 -0
  71. package/harness/docs/extracts/derived-data.md +18 -0
  72. package/harness/docs/extracts/design-leaf-signoff.md +16 -0
  73. package/harness/docs/extracts/extract-registry.docs.json +9 -1
  74. package/harness/docs/extracts/spec-core.md +7 -3
  75. package/harness/docs/extracts/spec-evolution.md +21 -0
  76. package/harness/docs/extracts/spec-prd-lite.md +19 -0
  77. package/harness/docs/extracts/spec-requirement.md +6 -2
  78. package/harness/docs/extracts/spec-ssot-prep.md +25 -0
  79. package/harness/docs/extracts/tpl-module.md +12 -0
  80. package/harness/docs/extracts/verify-gate.md +33 -0
  81. package/harness/docs/extracts/wire-spec-feedback.md +31 -0
  82. package/harness/docs/rules/agent-compliance.mdc +1 -1
  83. package/harness/docs/rules/team-flow-spec.mdc +3 -4
  84. package/harness/docs/skills/adopt/SKILL.md +2 -0
  85. package/harness/docs/skills/api/SKILL.md +4 -5
  86. package/harness/docs/skills/api-spec/SKILL.md +19 -6
  87. package/harness/docs/skills/api-update/SKILL.md +3 -3
  88. package/harness/docs/skills/architecture/SKILL.md +1 -1
  89. package/harness/docs/skills/business-process/SKILL.md +2 -0
  90. package/harness/docs/skills/common/SKILL.md +2 -2
  91. package/harness/docs/skills/common-spec/SKILL.md +10 -47
  92. package/harness/docs/skills/db-erd/SKILL.md +26 -0
  93. package/harness/docs/skills/grill/SKILL.md +28 -22
  94. package/harness/docs/skills/grill-api/SKILL.md +4 -6
  95. package/harness/docs/skills/grill-api-spec/SKILL.md +44 -24
  96. package/harness/docs/skills/grill-bqa/SKILL.md +28 -13
  97. package/harness/docs/skills/grill-common-spec/SKILL.md +10 -35
  98. package/harness/docs/skills/grill-dev/SKILL.md +7 -6
  99. package/harness/docs/skills/grill-docs/SKILL.md +10 -3
  100. package/harness/docs/skills/module/SKILL.md +3 -1
  101. package/harness/docs/skills/openapi/SKILL.md +2 -1
  102. package/harness/docs/skills/overview/SKILL.md +7 -1
  103. package/harness/docs/skills/spec/SKILL.md +42 -9
  104. package/harness/docs/skills/update-spec/SKILL.md +4 -1
  105. package/harness/fe/extracts/wire-audit-loop.md +72 -0
  106. package/harness/fe/extracts/wire-phase.md +45 -0
  107. package/harness/fe/rules/platform-design-vocabulary.mdc +1 -1
  108. package/harness/fe/rules/team-flow-prototype.mdc +8 -4
  109. package/harness/fe/skills/gen-common/SKILL.md +11 -84
  110. package/harness/fe/skills/grill-prototype/SKILL.md +51 -25
  111. package/harness/fe/skills/grill-test/SKILL.md +78 -20
  112. package/harness/fe/skills/grill-wire/SKILL.md +81 -0
  113. package/harness/fe/skills/prototype/SKILL.md +3 -2
  114. package/harness/fe/skills/wire/SKILL.md +7 -2
  115. package/harness/shared/AGENTS.md +3 -3
  116. package/harness/shared/SSOT_AGENT_PROTOCOL.md +3 -3
  117. package/harness/tests/extracts/grill-api-hook.md +69 -0
  118. package/harness/tests/extracts/grill-scenario-flow.md +39 -0
  119. package/harness/tests/extracts/grill-screen-tc.md +40 -0
  120. package/harness/tests/extracts/testcase-gen-cli.md +57 -0
  121. package/harness/tests/extracts/testcase-plan.md +29 -0
  122. package/harness/tests/extracts/tests-verify-gate.md +29 -0
  123. package/harness/tests/extracts/wire-test-handoff.md +37 -0
  124. package/harness/tests/skills/grill-testcase/SKILL.md +1 -0
  125. package/harness/tests/skills/test-api/SKILL.md +14 -6
  126. package/harness/tests/skills/testcase/SKILL.md +3 -1
  127. package/harness/tests/templates/TC.example-api.yaml +7 -1
  128. package/harness/tests/templates/TC.example.yaml +4 -1
  129. package/harness/tests/templates/tpl-testcase-plan.md +75 -0
  130. package/package.json +1 -1
  131. package/stacks/fastapi.json +1 -0
  132. package/stacks/laravel.json +1 -0
  133. package/stacks/nestjs.json +72 -0
  134. package/stacks/nextjs-nest.json +1 -0
  135. package/stacks/nuxt4-nest.json +1 -0
  136. package/templates/project-skeleton/architecture/03-business-process/FLOW-template.md +2 -0
  137. package/templates/project-skeleton/overview/index.md +68 -2
  138. package/templates/project-skeleton/overview/operational-areas/_template.md +37 -0
  139. package/templates/project-skeleton/surfaces/common/data-model/index.md +10 -2
  140. package/templates/shared/api-03-mock.stub.yaml +14 -0
  141. package/templates/shared/backend-api.bundle.yaml +3 -0
  142. package/templates/shared/backend-api.yaml +4 -0
  143. package/templates/shared/be-capabilities.registry.base.json +8 -0
  144. package/templates/shared/bundle-authoring.md +39 -3
  145. package/templates/shared/default-layout.ejs +131 -18
  146. package/templates/shared/design-spec.yaml +2 -3
  147. package/templates/shared/design.registry.base.json +38 -0
  148. package/templates/shared/feature.bundle.yaml +16 -9
  149. package/templates/shared/ir/generated/spec.md +281 -0
  150. package/templates/shared/qa-item.yaml +1 -1
  151. package/templates/shared/tpl-api-contract.md +133 -0
  152. package/templates/shared/tpl-screen-data-model.md +76 -0
  153. package/templates/tests-skeleton/cases/README.md +4 -0
  154. package/templates/tests-skeleton/catalog/locale.yaml +9 -0
  155. package/templates/tests-skeleton/tpl-testcase-plan.md +9 -0
  156. package/harness/docs/skills/api-integration/SKILL.md +0 -110
  157. package/harness/docs/skills/grill-integration-spec/SKILL.md +0 -51
@@ -1,43 +1,18 @@
1
1
  ---
2
2
  name: grill-common-spec
3
- description: EXCLUSIVE /grill-common-spec — Use this to audit and verify technical common bundles before code generation.
3
+ description: DEPRECATED — no common YAML bundles to grill. Route to /grill-bqa on function bundles or /common for pattern MD.
4
4
  disable-model-invocation: true
5
5
  ---
6
6
 
7
- > [!CRITICAL] MANDATORY PRE-FLIGHT
8
- > **[MANDATORY]** Re-read this entire `SKILL.md` via file-read tool. STRICTLY FORBIDDEN to rely on memory.
7
+ # /grill-common-spec — DEPRECATED
9
8
 
10
- # /grill-common-spec — Common Bundle Audit
9
+ There is no `common/yaml` + IR grill path on the docs hub anymore.
11
10
 
12
- **Target Path:** `<LCA>/common/yaml/<slug>/<slug>.bundle.yaml` (see `.cursor/extracts/common-scope.md`).
11
+ | Gap | Route |
12
+ |-----|--------|
13
+ | Function screen/API spec | `/grill-bqa` · `/grill-dev` on `*.bundle.yaml` |
14
+ | Shared rule prose | `/common` (patterns Markdown) |
15
+ | UI affordance / pattern | `flowgrid-ux-common.mdc` + `/grill-bqa` |
16
+ | Registry / template drift | [custom-base](../../../docs/workflows/custom-base.md) |
13
17
 
14
- ---
15
-
16
- ## Rule: Audit Checks
17
-
18
- - **[MANDATORY]** Verify `schema` is set (e.g. `portal-feature-bundle/v1` or appropriate surface schema).
19
- - **[MANDATORY]** Verify `design.shell.tag` reflects the target platform:
20
- - Web Portal → `#shell: DataListPage`
21
- - WinForms → `#shell: KioskCheckIn`
22
- - Gateway → `#shell: OtAdapter`
23
- - **[MANDATORY]** Verify `spec.principles` and `spec.acceptance` are detailed enough to drive test cases and codegen.
24
- - **[MANDATORY]** Verify `design.patterns` and referenced middlewares point to valid, existing items.
25
- - **[STRICTLY FORBIDDEN]** Do NOT "fix" a module-common bundle by copying it to surface `common/`.
26
-
27
- ---
28
-
29
- ## Rule: Output
30
-
31
- - **[STRICTLY FORBIDDEN]** Do NOT output new files from this skill.
32
- - **[MANDATORY]** If issues are found → inform user + suggest fixes, or fix directly in `.bundle.yaml` if instructed.
33
- - **[MANDATORY]** If bundle passes → instruct user: run `flowgrid split -- <path>` (must emit `ir/design.yaml`), then bộ code FE `/gen-common`.
34
- - **[STRICTLY FORBIDDEN]** Do NOT send BE `/api` a common FE bundle.
35
-
36
- ---
37
-
38
- ## Verification Checklist
39
-
40
- - [ ] `schema` field set correctly.
41
- - [ ] `design.shell.tag` aligned with target surface type.
42
- - [ ] `spec.principles` and `spec.acceptance` are substantive.
43
- - [ ] All `design.patterns` / middleware references are valid and exist.
18
+ **If invoked:** STOP — do not load `surfaces/common/yaml`.
@@ -8,7 +8,7 @@ disable-model-invocation: true
8
8
  > [!CRITICAL] MANDATORY PRE-FLIGHT
9
9
  > **[MANDATORY]** Re-read this entire `SKILL.md` via file-read tool. STRICTLY FORBIDDEN to rely on memory.
10
10
  > **[MANDATORY]** Read entire `ir/design.yaml`. If `ir/` is missing, read entire `*.bundle.yaml`. NEVER filter partial keys.
11
- > **[MANDATORY]** Expect `grillStatus.bqaOpen: done` (or `bqaFacts`) before starting.
11
+ > **[MANDATORY]** Expect `grillStatus.bqaOpen: done` before starting. Do **not** start if only `bqaFacts` is set — finish `/grill-bqa` Step B first.
12
12
 
13
13
  # /grill-dev — Dev / Codegen Grill
14
14
 
@@ -30,11 +30,12 @@ disable-model-invocation: true
30
30
 
31
31
  ## Rule: Audit Interlock with Page Type
32
32
 
33
- - **[MANDATORY]** Before grilling, run: `flowgrid audit spec <bundle> --type <profile>`.
33
+ - **[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
+ - **[MANDATORY]** After `bundle.gen` patch: `flowgrid split` + `flowgrid render` (FE uses `ir/design.yaml`; BA PDF path uses `ir/generated/spec.md`).
34
35
  - `<profile>` lấy từ `gen.codegen.profile` đã xác nhận (list | create | detail | admin-crud | auth | ...).
35
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`.
36
- - Script output `gaps[]` + `confirms[]` (includes `UX_*` / `CONFIRM_UX_*` affordance — see `flowgrid-ux-common.mdc`).
37
- - Agent patches structural `gaps[]`; UX confirms → wizard with `(Recommended)` from audit output.
37
+ - Script output `gaps[]` + `confirms[]` (`CONFIRM_UX_*`, **`CONFIRM_DB_*`** — `db-audit-wizard.md`).
38
+ - Agent patches structural `gaps[]`; UX/DB confirms → wizard; BE drift → `/api-update` then re-audit.
38
39
 
39
40
  ---
40
41
 
@@ -120,7 +121,7 @@ disable-model-invocation: true
120
121
 
121
122
  ## Rule: API Reuse & Explicit Suffix
122
123
 
123
- - **[MANDATORY]** Scan `common/yaml/` (LCA) + sibling `…/api/<seq>/` for existing `01` files. If found → tag `#reuse-api` + `reuseFrom` on page action/item; skip new trio.
124
+ - **[MANDATORY]** Scan sibling `…/api/<seq>/` (+ shared `01` on function leaf when present) for existing endpoints. If found → tag `#reuse-api` + `reuseFrom` on page action/item; skip new trio. Do not scan deprecated `common/yaml`.
124
125
  - **[MANDATORY]** All endpoint paths MUST use explicit suffixes: `/create`, `/{id}/update`, `/{id}/duplicate`, `/{id}/delete`, `/{id}/detail`.
125
126
 
126
127
  ---
@@ -155,7 +156,7 @@ disable-model-invocation: true
155
156
 
156
157
  - bộ code FE dry pass → `/prototype`
157
158
  - BQA↔Dev conflict → `/grill-docs`
158
- - Legacy fact gap → `/update-spec-legacy`
159
+ - Legacy fact gap → `/legacy /spec` or `/update-spec` (legacy evidence delta)
159
160
  - Confirmed common promote → `/docs-mark` (same session or before `/prototype`)
160
161
 
161
162
  ---
@@ -39,6 +39,13 @@ disable-model-invocation: true
39
39
 
40
40
  ---
41
41
 
42
+ ## Rule: Audit interlock (sau reconcile)
43
+
44
+ - **[MANDATORY]** After any bundle patch that touches `design.*`, `userStories`, `bundle.gen`, or `api` refs: run `flowgrid audit spec <bundle> --type <pageType>` (same profile rules as `/grill-dev`). Resolve `CONFIRM_DB_*` via `db-audit-wizard.md` before handoff.
45
+ - Patch structural `gaps[]`; defer remainder via `qa/open/` per Law 2.
46
+ - Address `warnings[]` when reconcile changes business prose (`summary`, `successMetrics`, `nonGoals`, `userStories`).
47
+ - ❌ Do not hand off FE until audit has been re-run post-reconcile.
48
+
42
49
  ## Rule: Codegen Gate
43
50
 
44
51
  - **[MANDATORY]** `bundle.gen.codegen.profile` (+ entity/module when required) MUST be set.
@@ -55,8 +62,8 @@ disable-model-invocation: true
55
62
  2. Reconcile common patterns (BQA flows ↔ Dev `#pattern`, `#split-hook:` tags).
56
63
  3. Reconcile `#reuse-api` on page actions/items (no duplicate `api/<seq>/` for reused APIs).
57
64
  4. Verify codegen gate: `bundle.gen.codegen.profile` set correctly.
58
- 5. Write/fix `bundle.gen` → `flowgrid_docs_bundle_split` → `docs_render`.
59
- 6. Handoff ID/path + recommendation to bộ code FE.
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).
60
67
 
61
68
  ---
62
69
 
@@ -76,4 +83,4 @@ disable-model-invocation: true
76
83
 
77
84
  - [ ] Conflicts reconciled in `*.bundle.yaml`, or deferred with `qa/open/QA-…`. No `openQuestions`.
78
85
  - [ ] `bundle.gen.codegen.profile` present and correct.
79
- - [ ] `flowgrid split` succeeded with zero errors.
86
+ - [ ] `flowgrid audit spec` re-run after reconcile; `flowgrid split` succeeded with zero errors.
@@ -11,9 +11,11 @@ extractBundle: architecture-core
11
11
 
12
12
  # /module — Business Module (CMP-*)
13
13
 
14
+ **Template:** `.cursor/extracts/tpl-module.md` (includes **Out of scope** + **Depends on**).
15
+
14
16
  **Target Paths:**
15
17
  - Module folder: `surfaces/[Surface]/[CMP-ID]/`
16
- - Main doc: `surfaces/[Surface]/[CMP-ID]/[CMP-ID].md`
18
+ - Main doc: `surfaces/[Surface]/[CMP-ID]/README.md` or `[CMP-ID].md` (team convention — MD only)
17
19
 
18
20
  ---
19
21
 
@@ -23,9 +23,10 @@ One generator: **OpenAPI 3.0.3** from `01-backend-spec.yaml`. Merge/UI stays `op
23
23
  # Or from docs hub root (all 01-backend-spec.yaml under surfaces):
24
24
  flowgrid openapi_gen
25
25
  # Validate only:
26
- flowgrid check --spec …/01-backend-spec.yaml
26
+ flowgrid api:check --spec …/01-backend-spec.yaml
27
27
  ```
28
28
  - **[MANDATORY]** After generation: run `flowgrid openapi_render` to merge fragments into `docs/openapi/api.yaml`.
29
+ - **[MANDATORY]** After contract change: run `flowgrid render` on docs hub so leaf `ir/generated/api.md` matches `01` for BA/Dev review (see `tpl-api-contract.md`).
29
30
 
30
31
  ---
31
32
 
@@ -10,10 +10,16 @@ extractBundle: architecture-core
10
10
 
11
11
  # /overview — Operational Areas Overview
12
12
 
13
- **Target Paths:** `overview/operational-areas/[Admin operations | Workforce operations | …]`
13
+ **Target Paths:** `overview/index.md`, `overview/operational-areas/<slug>.md` (copy from hub template `operational-areas/_template.md` on greenfield init).
14
14
 
15
15
  ---
16
16
 
17
+ ## Rule: arc42 §1 content
18
+
19
+ - **[MANDATORY]** `overview/index.md`: goals, stakeholders table, top 5 quality goals, persona summaries, product-level in/out scope, success metrics, link to operational areas.
20
+ - **[MANDATORY]** Each operational area file: personas, in/out scope, area metrics, `CMP-*` links, non-goals — per `_template.md`.
21
+ - **[RECOMMENDED]** Trước spec leaf lớn: overview + area đã có persona id mà `userStories.primary.asA` tham chiếu.
22
+
17
23
  ## Rule: Content Boundary
18
24
 
19
25
  - **[MANDATORY]** Overview MUST be a pure business document written in user domain language: personas, operational areas, high-level system purpose.
@@ -7,8 +7,9 @@ disable-model-invocation: true
7
7
 
8
8
  > [!CRITICAL] MANDATORY PRE-FLIGHT
9
9
  > **[MANDATORY]** Re-read this entire `SKILL.md` via file-read tool. **STRICTLY FORBIDDEN** to rely on memory.
10
- > **[MANDATORY]** Read `.flowgrid/templates/feature.bundle.yaml` + `.flowgrid/templates/bundle-authoring.md` BEFORE generating any YAML.
10
+ > **[MANDATORY]** Read `.flowgrid/templates/feature.bundle.yaml` + `.flowgrid/templates/bundle-authoring.md` BEFORE generating any YAML. **Do NOT** use `design-spec.yaml` (deprecated).
11
11
  > If templates are missing → STOP: *"Template missing. Run `flowgrid init` to generate templates."*
12
+ > **Extract:** `spec-ssot-prep.md`, `spec-prd-lite.md`, `db-audit-wizard.md`, `design-leaf-signoff.md`.
12
13
  > Physical interlocks: `AGENTS.md` + `SSOT_AGENT_PROTOCOL.md` (Laws 1–7). Chat-only done = **FAILED**.
13
14
 
14
15
  # /spec — Function detail (design)
@@ -44,14 +45,29 @@ disable-model-invocation: true
44
45
 
45
46
  ---
46
47
 
48
+ ## Rule: SSOT prep drill (custom-base · adopt · legacy)
49
+
50
+ Hub: [spec-ssot-prep.md](../../../docs/workflows/spec-ssot-prep.md) · extract `spec-ssot-prep.md`.
51
+
52
+ - **[MANDATORY]** Before first leaf on a **custom/maintain** project: confirm **custom-base** (`build-template-code`) or **standard** `registry:sync` — agent must map `#ui:` / `#shell:` from real `design.registry.json`, not invent `#needs-component`.
53
+ - **[MANDATORY]** **Brownfield workspace:** `/adopt` + `audit legacy` on inventory **before** `/legacy /spec` on any `W-*` (see `/legacy` modifier below).
54
+ - **[MANDATORY]** When `adoption-inventory.md` exists at workspace root: read **Section 5 (Common Catalog Candidates)** on every `/spec` and `/legacy /spec` — inherit `CMN-*`; **STRICTLY FORBIDDEN** copy-paste legacy files into new bundles.
55
+ - **Greenfield hub mới (no legacy):** skip `/adopt`; prep = nhánh A/B only.
56
+
57
+ ---
58
+
47
59
  ## Rule: Audit Interlock
48
60
 
49
61
  - **[MANDATORY]** If bundle file already exists: run `flowgrid audit spec <path-to-bundle.yaml> --type <pageType>` first.
50
62
  - `<pageType>` = page type đã xác định ở bước trên (list | create | detail | admin-crud | auth | ...).
51
63
  - Script output:
52
64
  - `gaps[]` → required fields missing → Agent patches bundle directly.
53
- - `confirms[]` → optional / UX (`category: ux`, codes `UX_*`, `CONFIRM_UX_*`) → AskQuestion; `(Recommended)` must match audit option text or `flowgrid-ux-common` checklist proposals.
54
- - Summary fields: `uxAffordanceGaps`, `uxAffordanceConfirms`.
65
+ - `warnings[]` → **quality hints only** (missing `successMetrics`/`nonGoals`, summary placeholders) — fix when info exists; **does not** block split.
66
+ - `confirms[]` → AskQuestion wizard (one question at a time, ≥3 options):
67
+ - UX: `category: ux`, `UX_*`, `CONFIRM_UX_*` — `flowgrid-ux-common.mdc`
68
+ - **DB:** `category: db`, `CONFIRM_DB_*` — `.cursor/extracts/db-audit-wizard.md` (entities, multi-table, `db` vs `01`, `#derived-data`)
69
+ - `warnings[]` → agent-only hints (metrics, placeholders); DB issues should appear as `CONFIRM_DB_*`, not silent fixes.
70
+ - Summary fields: `uxAffordanceGaps`, `uxAffordanceConfirms`, `totalWarnings`, `dbTables.dbConfirms`.
55
71
  - **Threshold Interlock (Law 2):** If audit script outputs ≥10 gaps + confirms, HALT chat wizard immediately → create an implementation plan / Plan Mode document partitioned into sequential phases.
56
72
  - ❌ Do not skip audit and proceed to authoring directly.
57
73
  - ❌ Do not run audit without `--type` parameter.
@@ -90,10 +106,10 @@ disable-model-invocation: true
90
106
  1. Confirm `CMP-*` exists and `CTR-*` is identified — otherwise stop for lead/owner.
91
107
  2. Detect page type from prompt or existing bundle's `codegen.profile`.
92
108
  3. Run audit: `flowgrid audit spec <bundle> --type <pageType>` (if bundle exists).
93
- 4. Process audit output: fill `gaps[]` directly; ask member about `confirms[]` via wizard.
109
+ 4. Process audit output: fill `gaps[]` directly; **`confirms[]` (UX + DB)** → `AskQuestion` wizard per `db-audit-wizard.md` / `flowgrid-ux-common.mdc`.
94
110
  5. **Zone-based multi-turn authoring** (see rule below): chia page thành zones, phân tích từng zone trong turn riêng.
95
111
  6. Write/update `*.bundle.yaml` with `specOrigin: requirement`.
96
- 7. Apply **existing** common/DSL extracts (consume only — promote via `/common-spec`).
112
+ 7. Apply **DSL/registry** + `flowgrid-ux-common.mdc` (FE base patterns — no `common/yaml` / gen-common).
97
113
  8. Run `pnpm docs:split -- <bundle>` → `pnpm docs:render` (design MD only).
98
114
  9. Update `.harness/progress.md`.
99
115
  10. Handoff → `/testcase` from acceptance criteria.
@@ -111,7 +127,7 @@ disable-model-invocation: true
111
127
  Each zone turn — **in order**:
112
128
 
113
129
  1. Announce zone name (e.g. `Zone CONTENT: toolbar + table`).
114
- 2. **DSL / registry pass:** Match controls to `design.registry.json` (when present), common catalog, `#shell:`, `#pattern:`, `#ui:`, `#widget:`. Write matched structure into `*.bundle.yaml` for this zone.
130
+ 2. **DSL / registry pass:** Match controls to **`registries/design.registry.json` on the FE checkout** (`flowgrid registry:sync`: `#ui`, Mo*, `#composable: use*`, helpers). Use `#shell:`, `#pattern:`, `#ui:`, `#widget:` — not authored on docs hub. Write matched structure into `*.bundle.yaml` for this zone.
115
131
  3. **Unmapped structure:** Shadcn primitive → `#ui: <Primitive>`. ≥2 domain structural blocks → `#needs-component: MoBlockName`. Unknown widget → `#needs-ui:` (never invent primitive names). See **Common Pattern Resolution** below.
116
132
  4. **Affordance gaps** (still unmapped or thin spec): apply **`flowgrid-ux-common.mdc`** + `.cursor/extracts/ux-common-patterns.md` — only **Recognize / Propose** checklist items that apply; use the rule’s proposal output format. No open-ended UX brainstorming.
117
133
  5. **Member decisions:** `confirms[]` from audit + any checklist-derived proposals → `AskQuestion` wizard — one question at a time, ≥3 options: `(Recommended)` = top structured proposal from steps 3–4, Alternative, `Log as Tech Debt (Pending)` (Law 2).
@@ -124,8 +140,24 @@ Each zone turn — **in order**:
124
140
 
125
141
  ## Rule: Content Requirements per Section
126
142
 
143
+ ### Rule: Data model (read Phase 0 ERD, write screen detail)
144
+
145
+ - **[MANDATORY]** Before authoring `db:` on any control: walk LCA per `common-scope.md` and **read** `common/db-erd.md` if present. If entity/table is new and ERD missing → **handoff** `/db-erd` (Phase 0), do not invent schema names silently.
146
+ - **[MANDATORY]** Fill `spec.entities` / `spec.relationships` with the **subset** of ER entities this screen reads/writes (prose + names aligned with ERD).
147
+ - **[MANDATORY]** Persisted fields: on `design.sections[]` items (and list columns when stored): `bind.field` + `db.schema` + `db.field`; `enumMapping` when UI enum maps DB codes.
148
+ - **[MANDATORY]** List columns: `key` consistent with `bind.field`; computed-only columns → document `#derived-data` (see `common/data-model/derived-data.md`), no fake `db`.
149
+ - **[STRICTLY FORBIDDEN]** Empty `entities: []` while form/list has multiple persisted `db.field` without QA defer.
150
+ - **Authoring detail:** [bundle-authoring.md § Data model](../../../templates/shared/bundle-authoring.md#data-model--phase-0-erd-vs-screen-detail) · [tpl-screen-data-model.md](../../../templates/shared/tpl-screen-data-model.md) (multi-table).
151
+ - **Sau split:** `ir/generated/data-model.md` cho review. **Audit:** `CONFIRM_DB_*` → member wizard; sau chốt → re-audit. BE SSOT: `01` khớp `db` (drift → `/api-update`).
152
+
153
+ ### Rule: Summary extensions (PRD lite)
154
+ - **[MANDATORY]** `summary` bullets: business_goals, stakeholders, user_journey, context (input/output), optional solution.
155
+ - **[RECOMMENDED]** When PO/BA có thông tin: fill `successMetrics` and `nonGoals` (multiline `|` bullets) — product-level metrics còn ở `overview/`.
156
+ - **[MANDATORY]** Replace template `[placeholder]` brackets in `summary` / metrics / non-goals before handoff grill.
157
+
127
158
  ### Rule: User Stories (`userStories`)
128
159
  - **[MANDATORY]** Generate complete `primary` (asA, iWant, soThat), `contextAndHandoff`, `scenarios` (5 core + **6th “Affordances UX”** when delete/filter/breadcrumb/disabled/import apply), `acceptanceCriteria` (include UX AC lines from template when applicable).
160
+ - **[MANDATORY]** **Profile trim:** do not keep all 6 template scenarios on every page — drop form/background scenarios when profile has no `ui.form` / no async; keep Affordances UX only when audit UX or delete/filter/breadcrumb applies.
129
161
  - **[MANDATORY]** After resolving audit `UX_*` gaps or `CONFIRM_UX_*` answers: mirror behavior in `userStories` (use `suggestedStoryPatch` from audit JSON when present).
130
162
  - **[MANDATORY]** `contextAndHandoff.screenAccess` MUST be one of: `directRoute` | `sidebarMenu` | `contextualAction`.
131
163
  - **[MANDATORY]** 5 scenarios: (1) Initial data load, (2) Input entry & Form validation errors, (3) Successful submission, (4) Exception handling / UI error states, (5) Background operations (if applicable). All descriptive texts generated for user consumption MUST be in clear Vietnamese.
@@ -183,13 +215,13 @@ Each zone turn — **in order**:
183
215
 
184
216
  ## Rule: Common Pattern Resolution (DSL consume)
185
217
 
186
- - **[MANDATORY]** Before authoring each zone: scan upward `common/yaml/` (function → module → cluster → surface → global); read `templates/shared/patterns/*.pattern.yaml`; match `design.registry.json` when the FE checkout pointer exists.
218
+ - **[MANDATORY]** Before authoring each zone: read LCA `common/patterns/*.md` when present (skill `/common`); read `templates/shared/patterns/*.pattern.yaml`; match `design.registry.json` on the FE checkout when the pointer exists.
187
219
  - **[MANDATORY]** Tag from structural cues only (never invented business fields):
188
220
  - `>8 columns` → `#split-hook:columns`; `>3 filters` → `#split-hook:filters`; export → `#split-hook:export`; form >6 fields → `#split-hook:form-sections`
189
221
  - `≥2 domain structural blocks` → `#needs-component: MoBlockName` (NOT shadcn primitives)
190
222
  - Delete → `#pattern: delete-flow`; list/table → `#pattern: CRUD`; confirm/overwrite → `common-confirm-dialog`
191
223
  - **[MANDATORY]** Inject resolved patterns into `design.patterns[]` and zone `items[]` with `#ui:` / `#widget:` as applicable.
192
- - **[STRICTLY FORBIDDEN]** Tag shadcn primitives as `#needs-component`. Duplicate full common IR into the screen bundle when DSL already covers the widget.
224
+ - **[STRICTLY FORBIDDEN]** Tag shadcn primitives as `#needs-component`. Duplicate CMN YAML/IR into the screen bundle (common YAML path is deprecated).
193
225
 
194
226
  ---
195
227
 
@@ -236,5 +268,6 @@ Each zone turn — **in order**:
236
268
  - [ ] UX gap questions used checklist-backed `(Recommended)` options (`flowgrid-ux-common.mdc`), not open brainstorming.
237
269
  - [ ] `userStories` scenarios/AC reflect UX affordances patched in `design` (incl. audit `suggestedStoryPatch`).
238
270
  - [ ] YAML strings with `:` or `[]` are double-quoted. No `.md` written by hand.
239
- - [ ] `pnpm docs:split` + `pnpm docs:render` run with zero errors; rendered `spec.md` verified clean of raw YAML dumps.
271
+ - [ ] `successMetrics` / `nonGoals` filled or consciously omitted (not left as template brackets).
272
+ - [ ] `pnpm docs:split` + `pnpm docs:render` run with zero errors; `ir/generated/spec.md` has TOC + overview sections.
240
273
  - [ ] Handoff → `/testcase` created.
@@ -27,7 +27,8 @@ Doc hub: `platform/toolchain/UPDATE-SPEC-FLOW.md` · `platform/toolchain/FEATURE
27
27
  ## Rule: Scope Boundaries
28
28
 
29
29
  - **[MANDATORY]** Scope: patch bundle (delta only); emit `#update:*` tags; bump `specRevision`; run `flowgrid split/check`.
30
- - **[STRICTLY FORBIDDEN]** Full rewrite → `/spec`. Close `qa/open` item → `/qa-resolve`. Legacy re-mine → `/update-spec-legacy`. Production code → NOT this skill.
30
+ - **[STRICTLY FORBIDDEN]** Full rewrite → `/spec`. Close `qa/open` item → `/qa-resolve`. Production code → NOT this skill.
31
+ - **[MANDATORY]** Legacy re-mine / trace lại từ code cũ: dùng **`/legacy /spec`** (adopt lại) hoặc **`/update-spec`** với delta `legacy` / `legacyEvidence` + `#update:*` — **không** skill riêng.
31
32
 
32
33
  ---
33
34
 
@@ -45,6 +46,7 @@ Doc hub: `platform/toolchain/UPDATE-SPEC-FLOW.md` · `platform/toolchain/FEATURE
45
46
  ## Rule: Patch Guardrails
46
47
 
47
48
  - **[MANDATORY]** Patch minimal YAML sections in **bundle** only (not `ir/*`).
49
+ - **[MANDATORY]** When the delta touches scope or acceptance: update `summary`, `successMetrics`, or `nonGoals` if PO changed goals/out-of-scope; sync `userStories` / AC.
48
50
  - **[MANDATORY]** When the delta touches `design.actions`, `design.sections`, or `spec.ui` (list/form/detail, filters, row actions): run the **UX ↔ userStories** checklist in `templates/shared/bundle-authoring.md` — sync `userStories.scenarios` / `acceptanceCriteria` prose when behavior or affordances change (do not leave business story stale).
49
51
  - **[MANDATORY]** Before split/merge: run `flowgrid audit spec <bundle.yaml> --type <pageType>` and resolve or explicitly defer `UX_*` / gap codes; do not hand off FE/tests with a fresh structural delta and no re-audit.
50
52
  - **[MANDATORY]** Preserve error matrices: when patching actions/API endpoints, ensure `onSuccess`, `onCommonError`, `onSpecificError` + `#err:*` tags are preserved and updated accordingly.
@@ -69,6 +71,7 @@ Doc hub: `platform/toolchain/UPDATE-SPEC-FLOW.md` · `platform/toolchain/FEATURE
69
71
  8. `flowgrid_docs_bundle_check` / `flowgrid split --check -- <bundle>` (fallback: `pnpm docs:check`).
70
72
  9. User runs `docs_render` / `flowgrid render` (fallback: `pnpm docs:render`).
71
73
  10. Follow-up per patch type: handoff FE `/prototype` or `/grill-dev` / `/grill-bqa`; if API contract changed → `/api-update` before `openapi:gen`.
74
+ 11. When delta originated from wire/`audit fe-be` on FE: read `.cursor/extracts/wire-spec-feedback.md`; after merge handoff tests-hub `/grill-testcase` then FE `/wire` or `/grill-wire`.
72
75
 
73
76
  ---
74
77
 
@@ -0,0 +1,72 @@
1
+ # Wire — audit loop & handoff (FE repo)
2
+
3
+ Hub: `docs/workflows/wire.md#wire-gates` · Implement: `/wire` · Verify-only: `/grill-wire`.
4
+
5
+ ## Preconditions (do not skip)
6
+
7
+ ```bash
8
+ flowgrid doctor
9
+ flowgrid cases:gate --strict --docs-root "$FLOWGRID_DOCS_ROOT" # when team policy
10
+ # Pre-wire: scoped test:e2e green (mocks) — see tests-hub plan lifecycle
11
+ ```
12
+
13
+ Env: `FLOWGRID_DOCS_ROOT`, `FLOWGRID_TESTS_DOC`, e2e-root (`tests/e2e` or config `frontend.e2eRoot`).
14
+
15
+ ## Post-wire audit chain (order)
16
+
17
+ Run from **FE repo** cwd after `/wire` code changes:
18
+
19
+ ```bash
20
+ # 1) Plan ↔ Playwright (mandatory)
21
+ flowgrid audit e2e --e2e-root <dir> --tests-docs "$FLOWGRID_TESTS_DOC" --screen <W-*>
22
+
23
+ # 2) Contract parity (portal leaf with apiRef)
24
+ flowgrid audit fe-be "$FLOWGRID_DOCS_ROOT/surfaces/.../<slug>.bundle.yaml" \
25
+ [--backend-spec .../api/.../01-backend-spec.yaml]
26
+
27
+ # 3) Cross-flow (when SC lists this screen)
28
+ flowgrid audit scenario "$FLOWGRID_DOCS_ROOT/scenarios/.../SC-*.yaml" --tests-docs "$FLOWGRID_TESTS_DOC"
29
+ ```
30
+
31
+ Consume JSON fields:
32
+
33
+ | Audit | Keys / codes | Meaning |
34
+ |-------|----------------|---------|
35
+ | `e2e` | `missingInPlaywright`, `matrixRowsUncovered`, `orphanSpecs`, `orphanTestCases`, `gaps[]` | TC ↔ PO ↔ spec |
36
+ | `fe-be` | `FEBE_*` | `apiRef` / DTO ↔ `01` |
37
+ | `scenario` | `SC_SCREEN_NO_TC` | SC `screens[]` without plan |
38
+
39
+ Re-run **entire chain** after fixes in any lane (code, plan, or spec).
40
+
41
+ ## Gap → skill (no silent patches)
42
+
43
+ | Finding | Owner repo | Skill / command |
44
+ |---------|------------|-----------------|
45
+ | Missing/wrong `*.spec.ts`, PO, `testId`, post-wire assertion | FE | `/test` → `/grill-test` |
46
+ | TC plan thin, wrong AC, missing `testMatrix` facet for **real API** behaviour | tests-docs | `/grill-testcase` · patch `TC-*.yaml` · `cases:gate` |
47
+ | Business/spec/UX wrong vs what API actually returns | docs hub | `/update-spec` (paste-ready `/docs-hub` prompt) |
48
+ | `01` / OpenAPI wrong; BE field/status codes | docs hub | `/api-update` → BE `/audit-api` → re-wire |
49
+ | SC screen uncovered | tests-docs | `/testcase` or `/scenario` + `audit scenario` |
50
+ | Intentional defer | docs | `qa/open` + `QA-*` / `coverage_deferred` on SC |
51
+
52
+ **Forbidden:** patch `ir/*` or `01` from FE repo; invent AC on tests hub; skip `audit e2e` because manual QA passed.
53
+
54
+ ## Loop: wire → spec → test → wire
55
+
56
+ ```text
57
+ /wire (FE)
58
+ → audit e2e + fe-be (+ scenario)
59
+ → gap?
60
+ spec/UX → docs /update-spec → split/render → FE re-prototype or continue wire
61
+ contract → docs /api-update → BE deploy → /wire
62
+ plan → tests /grill-testcase → cases:gate → testcase:gen → /test → /grill-test
63
+ → re-run audit chain until sign-off (wire.md#wire-signoff)
64
+ ```
65
+
66
+ Lifecycle: promote route registry `test` → `wire` when team uses page lifecycle (`artifacts/code.md`).
67
+
68
+ ## Sign-off snippet
69
+
70
+ ```text
71
+ Wire audit OK: <W-*> | audit e2e: no critical | fe-be: clear | scenario: clear/deferred
72
+ ```
@@ -0,0 +1,45 @@
1
+ # Wire phase — agent digest (FE repo)
2
+
3
+ Hub SSOT: `docs/workflows/wire.md` · Skill: `harness/fe/skills/wire/SKILL.md`.
4
+
5
+ ## When
6
+
7
+ After `/grill-prototype` pass, BE `/audit-api` (or tracked issues), tests `cases:gate --strict` for scope, pre-wire E2E green.
8
+
9
+ ## Resolve docs
10
+
11
+ 1. `FLOWGRID_DOCS_ROOT` (mandatory preferred)
12
+ 2. Else platform-dna pointer — slower
13
+
14
+ Never invent IR; read `ir/design.yaml` + bundle via docs route.
15
+
16
+ ## `/wire` order (Portal)
17
+
18
+ 1. models ↔ real API
19
+ 2. services/* ($apiFetch, parseApiData)
20
+ 3. composables
21
+ 4. pages/components + 422 validation map
22
+ 5. Remove **production** mocks — keep test-only mocks
23
+ 6. Restore auth/RBAC (from grill-prototype handoff)
24
+ 7. Clear `#wire-only` / resolved `#update:*` when done
25
+
26
+ ## Post-wire audits (mandatory)
27
+
28
+ ```bash
29
+ flowgrid audit e2e --e2e-root <dir> --tests-docs "$FLOWGRID_TESTS_DOC" --screen <W-*>
30
+ flowgrid audit fe-be <bundle.yaml> # portal screens
31
+ ```
32
+
33
+ Optional: `audit scenario` when SC covers screen.
34
+
35
+ Fix gaps → see **`wire-audit-loop.md`** (`/test`, `/grill-test`, `/grill-testcase`, `/update-spec`, `/api-update`). Sign-off audit → `/grill-wire`.
36
+
37
+ ## Forbidden
38
+
39
+ - Wire without `FLOWGRID_TESTS_DOC` when team uses gate
40
+ - Skip `audit e2e` because manual QA passed
41
+ - Patch `01` from FE repo — use `/api-update` on docs hub
42
+
43
+ ## BE-only / API hook
44
+
45
+ No FE `/wire` — use `testcase:gen:api`, Newman optional, BE integration tests.
@@ -6,7 +6,7 @@ alwaysApply: false
6
6
 
7
7
  # Design vocabulary
8
8
 
9
- SSOT: `registries/design.registry.json` · validate with `flowgrid registry`.
9
+ SSOT: `registries/design.registry.json` (refresh: `flowgrid registry:sync`) · validate: `flowgrid registry`.
10
10
 
11
11
  ## Hashtags (grill → `tags:`)
12
12
 
@@ -6,7 +6,7 @@ alwaysApply: false
6
6
 
7
7
  # Team Flow — Prototype
8
8
 
9
- Active: `/prototype` · `/grill-prototype` — **một** command / session.
9
+ Active: `/prototype` và `/grill-prototype` — **hai** session (prototype trước, grill-prototype sau).
10
10
 
11
11
  | Command | Skill |
12
12
  |---------|-------|
@@ -20,11 +20,15 @@ bộ docs (`FLOWGRID_DOCS_ROOT`); never CodeGraph for C4/architecture.
20
20
 
21
21
  ## Thứ tự
22
22
 
23
- 0. `/gen-common --surface=…` rồi `/gen-common --module=CMP-…` nếu hub có `common/` — gen molecule/shell dùng chung trước.
24
- 1. Quét `#needs-component` / custom-render tags — chỉ tạo component còn thiếu.
25
- 2. `npm run codegen -- --id W-…` (hoặc MCP `gen`) — đọc `…/code/{W-…}/generated/HANDOFF.md`.
23
+ 0. Docs hub `common/` = `processes/` + `patterns/` (Markdown) — tham chiếu nghiệp vụ; **không** gen-common.
24
+ 1. `npm run codegen:dry` rồi `npm run codegen -- --id W-…` (hoặc MCP `gen`) — đọc `…/code/{W-…}/generated/HANDOFF.md`.
25
+ 2. Quét `#needs-component` — implement từ FE base + shadcn; template/registry mới → `docs/workflows/custom-base.md` (toolkit SSOT).
26
26
  3. Vá slot · auth bypass · gap; **không** sửa YAML business trên hub khi prototype.
27
27
 
28
+ ## Sau prototype
29
+
30
+ 4. Session mới: `/grill-prototype` — checklist UI (design.md bước 6); không chạy `gen:dry` lại trừ khi đổi IR.
31
+
28
32
  - Source: grill-approved hub `ir/design.yaml`
29
33
  - Real UI; mock chỉ API boundary
30
34
  - **Không** backend thật — `/wire` thay mock
@@ -1,93 +1,20 @@
1
1
  ---
2
2
  name: gen-common
3
- description: >-
4
- /gen-common — generate shared UI from bộ docs common specs before
5
- /prototype. Covers surface common (surfaces/<surface>/common) and
6
- module common (surfaces/<surface>/CMP-*/common). Use when
7
- bootstrapping DataListPage, MoStatusChip, or CMP-level shared widgets.
3
+ description: DEPRECATED — common UI is shipped in the FE base; use custom-base for new templates. Do not invoke.
8
4
  disable-model-invocation: true
9
5
  ---
10
6
 
11
- # /gen-common — Shared UI before /prototype
7
+ # /gen-common — DEPRECATED
12
8
 
13
- **Owner:** bộ code (`--type=fe`) · Adapters: `nuxt4` | `nextjs`
14
- Not synced for `dotnet-line`.
9
+ **Removed from product workflow.** Shared molecules (list page, status chip, delete flow, …) live in the **FE base**; affordances are enforced via `flowgrid-ux-common.mdc` during `/spec` and grill.
15
10
 
16
- Skill is **`/gen-common`**, not `/common` — `common` is the docs folder name (and there are three of them).
11
+ | Old step | Use instead |
12
+ |----------|-------------|
13
+ | `common/yaml` + `flowgrid gen-common` | FE base components + `design.registry.json` |
14
+ | New Mo* / adapter templates | [custom-base workflow](../../../docs/workflows/custom-base.md) → `build-template-code` |
15
+ | Cross-scope business rules | `/common` → `common/patterns/*.md` |
16
+ | Cross-flow | `common/processes/FLOW-*.md` |
17
17
 
18
- | Scope | Docs path | Flag |
19
- |-------|-----------|------|
20
- | Platform | `surfaces/common` | `--surface=common` |
21
- | Surface | `surfaces/<surface>/common` | `--surface=admin-web` |
22
- | Module | `surfaces/<surface>/<CMP-*>/common` | `--module=CMP-ADM-009` |
18
+ **If a member invokes `/gen-common`:** STOP — explain deprecation; continue with `/prototype` (`gen:dry` → `gen`) when `grillStatus.dev: done`.
23
19
 
24
- Run **surface** first, then **module**, then `/prototype` for screens.
25
-
26
- ## IR
27
-
28
- ```text
29
- …/common/yaml/<slug>/ir/design.yaml # tech — Read entire file
30
- …/common/yaml/<slug>/ir/spec.yaml # prose only — do not gen from this
31
- ```
32
-
33
- Read the **entire** `ir/design.yaml`. Missing design → STOP, hand off to docs `/common-spec` + `flowgrid split` (do not invent yaml). Prose-only `common/processes` (FLOW) is not `/gen-common` input. Thin design is OK for tokens; do not page-gen common IRs.
34
-
35
- **Docs hub is read-only.** Never Write common bundles/`ir/*` on the docs hub.
36
-
37
- Do **not** run `flowgrid gen --id common-list-page`. Page gen skips all three common trees.
38
-
39
- ## Docs Root Resolution
40
-
41
- 1. If `FLOWGRID_DOCS_ROOT` is set (non-empty), use it as the canonical
42
- pointer for locating common IR (`ir/design.yaml`).
43
- 2. If `FLOWGRID_DOCS_ROOT` is **not** set, fall back to Platform DNA
44
- configuration (`platform-dna`) to resolve the docs hub path.
45
- Platform DNA discovery is slower and more error-prone, so always prefer
46
- an explicit `FLOWGRID_DOCS_ROOT` when available.
47
-
48
- ## Workflow
49
-
50
- ```bash
51
- npm run codegen:common:dry -- --surface=admin-web --json
52
- npm run codegen:common -- --surface=admin-web
53
- npm run codegen:common:dry -- --module=CMP-ADM-009 --json
54
- npm run codegen:common -- --module=CMP-ADM-009
55
-
56
- # Fallback:
57
- flowgrid gen-common:dry --adapter=nextjs --docs-root=/path/to/docs -- --surface=admin-web --json
58
- flowgrid gen-common --adapter=nextjs --docs-root=/path/to/docs -- --module=CMP-ADM-009
59
- flowgrid gen-common:dry -- --id common-status-chip --surface=admin-web
60
- ```
61
-
62
- `common-gen` is an alias of `gen-common`.
63
-
64
- 1. Choose scope (`--surface` xor `--module`, or `--surface=… --all-modules`). Do not guess when several surfaces exist.
65
- 2. Dry `--json`. Kinds: `tokens` / `policy` / `molecule` / `shell` / `flow`.
66
- 3. Write stubs + upsert `registries/common.registry.json`. Keep existing files unless `--force`.
67
- 4. Implement `action: implement` from **`ir/design.yaml`** (tokens/policy as constraints). shadcn compose when `components.json` exists.
68
- 5. Surface emit → molecules/organisms. Module emit → `src/components/modules/<cmp-…>/` (namespaced, no overwrite of surface shells).
69
- 6. Re-run dry until emit entries are `implemented`.
70
- 7. `/prototype` for `CMP-*` screens.
71
-
72
- ## Kind handling
73
-
74
- | Kind | Emit? | Agent |
75
- |------|-------|--------|
76
- | `tokens` / `policy` | no | Apply while implementing others |
77
- | `molecule` | yes | Compose primitive → molecule |
78
- | `shell` | yes | After `dependsOn` molecules |
79
- | `flow` | sometimes | delete-flow wires ConfirmDialog; import-csv emits `MoImportCsv` |
80
- | `skip` | no | Backend folders (`common-api`, `backend-core-services`) |
81
-
82
- ## Do not
83
-
84
- - Page-gen common IRs or invent routes from them.
85
- - Copy platform `surfaces/common` over a surface overlay that already exists.
86
- - Emit module widgets onto surface paths (`DataListPage`, `MoStatusChip`).
87
- - Rewrite unrelated feature screens here.
88
-
89
- ## Translation Rule
90
- Luôn bọc text tĩnh bằng i18n helper native của framework.
91
- - Đọc block `i18n` từ `ir/design.yaml`.
92
- - Tự động sinh/cập nhật file ngôn ngữ tương ứng (`.json` cho FE/NodeJS, hoặc `.resx` cho Dotnet).
93
- - KHÔNG viết gộp ngôn ngữ lên giao diện (ví dụ không dùng `login / đăng nhập`).
20
+ CLI `flowgrid gen-common` may still exist for legacy repos; do not document new hubs against it.