@shanyucoder/flowgrid 0.1.5 → 0.1.9

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 (169) hide show
  1. package/README.md +1 -1
  2. package/adapters/laravel/registries/codegen.registry.json +9 -9
  3. package/bin/flowgrid.mjs +326 -115
  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/qa-item.mjs +91 -0
  26. package/engines/docs/lib/render-api-summary-markdown.mjs +28 -0
  27. package/engines/docs/lib/render-bundle-markdown.mjs +77 -2
  28. package/engines/docs/lib/render-data-model-markdown.mjs +171 -0
  29. package/engines/docs/lib/render-design-tables.mjs +89 -7
  30. package/engines/docs/lib/render-qa-list.mjs +123 -25
  31. package/engines/docs/lib/render-template.mjs +6 -0
  32. package/engines/docs/render-docs.mjs +6 -2
  33. package/engines/docs/vitepress/config.ts +7 -7
  34. package/engines/docs/vitepress/surfaces-nav.mjs +45 -14
  35. package/engines/openapi/check-backend-spec.mjs +2 -2
  36. package/engines/openapi/lib/markdown-table.mjs +8 -0
  37. package/engines/openapi/lib/render-backend-spec-markdown.mjs +78 -0
  38. package/engines/registry-sync/be-capabilities-sync.mjs +118 -0
  39. package/engines/registry-sync/fe-design-sync.mjs +258 -0
  40. package/engines/registry-sync/run-registry-sync.mjs +107 -0
  41. package/engines/shared/e2e-output-layout.mjs +68 -0
  42. package/engines/shared/flowgrid-e2e-root.mjs +19 -0
  43. package/engines/shared/resolve-flowgrid-context.mjs +176 -0
  44. package/engines/spec/lib/audit-api-gaps.mjs +1 -1
  45. package/engines/spec/lib/audit-bundle-gaps.mjs +92 -3
  46. package/engines/spec/lib/audit-db-tables.mjs +529 -0
  47. package/engines/spec/lib/audit-e2e-coverage.mjs +88 -30
  48. package/engines/spec/lib/bundle-schema.mjs +4 -1
  49. package/engines/spec/lib/open-qa.mjs +71 -21
  50. package/engines/spec/split-bundle.mjs +11 -1
  51. package/engines/testcase/runners/generate-api.mjs +23 -23
  52. package/engines/testcase/runners/generate.mjs +19 -17
  53. package/engines/testcase/runners/lib/bootstrap-context.mjs +44 -0
  54. package/engines/testcase/runners/lib/write-files.mjs +37 -9
  55. package/harness/agents/antigravity/rules/antigravity-mcp.mdc +12 -0
  56. package/harness/agents/gemini/rules/gemini-mcp.mdc +11 -0
  57. package/harness/agents/gemini_antigravity/rules/antigravity-mcp.mdc +8 -6
  58. package/harness/be/skills/{grill-api → audit-api}/SKILL.md +8 -7
  59. package/harness/common/extracts/artifact-graph.md +2 -2
  60. package/harness/common/extracts/artifactgraph-phase-hooks.md +2 -2
  61. package/harness/common/extracts/docs-mark-detect.md +2 -2
  62. package/harness/common/extracts/entity-relationship.md +23 -0
  63. package/harness/common/rules/flowgrid-ux-common.mdc +3 -3
  64. package/harness/common/skills/configure-repo-maps/SKILL.md +4 -2
  65. package/harness/docs/extracts/agent-execution-protocol.md +3 -3
  66. package/harness/docs/extracts/api-codegen-readiness.md +34 -0
  67. package/harness/docs/extracts/api-codegen-tags.md +30 -0
  68. package/harness/docs/extracts/api-contract.md +43 -0
  69. package/harness/docs/extracts/api-spec-sync.md +35 -0
  70. package/harness/docs/extracts/artifactgraph-hooks-docs.md +1 -1
  71. package/harness/docs/extracts/call-external.md +16 -0
  72. package/harness/docs/extracts/common-scope.md +9 -10
  73. package/harness/docs/extracts/db-audit-wizard.md +45 -0
  74. package/harness/docs/extracts/derived-data.md +18 -0
  75. package/harness/docs/extracts/design-leaf-signoff.md +16 -0
  76. package/harness/docs/extracts/extract-registry.docs.json +11 -2
  77. package/harness/docs/extracts/qa-inbox.md +19 -10
  78. package/harness/docs/extracts/qa-team.md +32 -0
  79. package/harness/docs/extracts/spec-core.md +7 -3
  80. package/harness/docs/extracts/spec-evolution.md +21 -0
  81. package/harness/docs/extracts/spec-prd-lite.md +19 -0
  82. package/harness/docs/extracts/spec-requirement.md +6 -2
  83. package/harness/docs/extracts/spec-ssot-prep.md +25 -0
  84. package/harness/docs/extracts/tpl-module.md +12 -0
  85. package/harness/docs/extracts/verify-gate.md +33 -0
  86. package/harness/docs/extracts/wire-spec-feedback.md +31 -0
  87. package/harness/docs/rules/agent-compliance.mdc +1 -1
  88. package/harness/docs/rules/team-flow-spec.mdc +3 -4
  89. package/harness/docs/schemas/flowgrid-docs/qa-item.schema.json +65 -0
  90. package/harness/docs/skills/adopt/SKILL.md +2 -0
  91. package/harness/docs/skills/api/SKILL.md +4 -5
  92. package/harness/docs/skills/api-spec/SKILL.md +19 -6
  93. package/harness/docs/skills/api-update/SKILL.md +4 -4
  94. package/harness/docs/skills/architecture/SKILL.md +1 -1
  95. package/harness/docs/skills/business-process/SKILL.md +2 -0
  96. package/harness/docs/skills/common/SKILL.md +2 -2
  97. package/harness/docs/skills/common-spec/SKILL.md +10 -47
  98. package/harness/docs/skills/db-erd/SKILL.md +26 -0
  99. package/harness/docs/skills/grill/SKILL.md +28 -22
  100. package/harness/docs/skills/grill-api/SKILL.md +4 -6
  101. package/harness/docs/skills/grill-api-spec/SKILL.md +44 -24
  102. package/harness/docs/skills/grill-bqa/SKILL.md +28 -13
  103. package/harness/docs/skills/grill-common-spec/SKILL.md +10 -35
  104. package/harness/docs/skills/grill-dev/SKILL.md +8 -7
  105. package/harness/docs/skills/grill-docs/SKILL.md +11 -4
  106. package/harness/docs/skills/module/SKILL.md +3 -1
  107. package/harness/docs/skills/openapi/SKILL.md +2 -1
  108. package/harness/docs/skills/overview/SKILL.md +7 -1
  109. package/harness/docs/skills/qa-resolve/SKILL.md +13 -12
  110. package/harness/docs/skills/qa-review/SKILL.md +45 -0
  111. package/harness/docs/skills/spec/SKILL.md +43 -10
  112. package/harness/docs/skills/update-spec/SKILL.md +5 -2
  113. package/harness/fe/extracts/wire-audit-loop.md +72 -0
  114. package/harness/fe/extracts/wire-phase.md +45 -0
  115. package/harness/fe/rules/platform-design-vocabulary.mdc +1 -1
  116. package/harness/fe/rules/team-flow-prototype.mdc +8 -4
  117. package/harness/fe/skills/gen-common/SKILL.md +11 -84
  118. package/harness/fe/skills/grill-prototype/SKILL.md +51 -25
  119. package/harness/fe/skills/grill-test/SKILL.md +78 -20
  120. package/harness/fe/skills/grill-wire/SKILL.md +81 -0
  121. package/harness/fe/skills/prototype/SKILL.md +3 -2
  122. package/harness/fe/skills/wire/SKILL.md +8 -3
  123. package/harness/shared/AGENTS.md +3 -3
  124. package/harness/shared/SSOT_AGENT_PROTOCOL.md +3 -3
  125. package/harness/tests/extracts/grill-api-hook.md +69 -0
  126. package/harness/tests/extracts/grill-scenario-flow.md +39 -0
  127. package/harness/tests/extracts/grill-screen-tc.md +40 -0
  128. package/harness/tests/extracts/testcase-gen-cli.md +57 -0
  129. package/harness/tests/extracts/testcase-plan.md +29 -0
  130. package/harness/tests/extracts/tests-verify-gate.md +29 -0
  131. package/harness/tests/extracts/wire-test-handoff.md +37 -0
  132. package/harness/tests/skills/grill-testcase/SKILL.md +1 -0
  133. package/harness/tests/skills/test-api/SKILL.md +14 -6
  134. package/harness/tests/skills/testcase/SKILL.md +3 -1
  135. package/harness/tests/templates/TC.example-api.yaml +7 -1
  136. package/harness/tests/templates/TC.example.yaml +4 -1
  137. package/harness/tests/templates/tpl-testcase-plan.md +75 -0
  138. package/package.json +1 -1
  139. package/stacks/fastapi.json +1 -0
  140. package/stacks/laravel.json +1 -0
  141. package/stacks/nestjs.json +72 -0
  142. package/stacks/nextjs-nest.json +1 -0
  143. package/stacks/nuxt4-nest.json +1 -0
  144. package/templates/project-skeleton/architecture/03-business-process/FLOW-template.md +2 -0
  145. package/templates/project-skeleton/overview/index.md +68 -2
  146. package/templates/project-skeleton/overview/operational-areas/_template.md +37 -0
  147. package/templates/project-skeleton/qa/README.md +4 -8
  148. package/templates/project-skeleton/surfaces/common/data-model/index.md +10 -2
  149. package/templates/schemas/qa-item.schema.json +98 -0
  150. package/templates/shared/api-03-mock.stub.yaml +14 -0
  151. package/templates/shared/backend-api.bundle.yaml +3 -0
  152. package/templates/shared/backend-api.yaml +4 -0
  153. package/templates/shared/be-capabilities.registry.base.json +8 -0
  154. package/templates/shared/bundle-authoring.md +44 -7
  155. package/templates/shared/default-layout.ejs +131 -18
  156. package/templates/shared/design-spec.yaml +2 -3
  157. package/templates/shared/design.registry.base.json +38 -0
  158. package/templates/shared/feature.bundle.yaml +16 -9
  159. package/templates/shared/ir/generated/spec.md +281 -0
  160. package/templates/shared/ir-spec.yaml +1 -1
  161. package/templates/shared/qa-authoring.md +78 -0
  162. package/templates/shared/qa-item.yaml +35 -14
  163. package/templates/shared/tpl-api-contract.md +133 -0
  164. package/templates/shared/tpl-screen-data-model.md +76 -0
  165. package/templates/tests-skeleton/cases/README.md +4 -0
  166. package/templates/tests-skeleton/catalog/locale.yaml +9 -0
  167. package/templates/tests-skeleton/tpl-testcase-plan.md +9 -0
  168. package/harness/docs/skills/api-integration/SKILL.md +0 -110
  169. package/harness/docs/skills/grill-integration-spec/SKILL.md +0 -51
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: qa-resolve
3
3
  extractBundle: docs-hub
4
- description: EXCLUSIVE /qa-resolve — close one qa/open file. Prompt is QA id + solution. Do not use for full-screen grill or first-time /spec.
4
+ description: EXCLUSIVE /qa-resolve — append answer + close one qa/<id>.yaml. Prompt is QA id + solution. Do not use for full-screen grill or first-time /spec.
5
5
  disable-model-invocation: true
6
6
  ---
7
7
 
@@ -10,14 +10,14 @@ disable-model-invocation: true
10
10
 
11
11
  # /qa-resolve — Close One Open QA
12
12
 
13
- **When:** Member provides `QA-<page-id>-NNNN` (or `QA-<feature.id>-NNNN`) **along with** an explicit decision/solution.
13
+ **When:** Member provides `HOTEL-LIST_0001` (or legacy `QA-<page-id>-NNNN`) **along with** an explicit decision/solution.
14
14
 
15
15
  **Not this skill:**
16
16
  - Unknown answers needing brainstorming → `/grill-bqa` / `/grill-dev` / `/grill-docs` / `/api-spec`
17
17
  - FE delta without an existing QA file → `/update-spec`
18
18
  - Portal/BE sync without closing QA files → `/api-update`
19
19
 
20
- **Extract:** `.cursor/extracts/qa-inbox.md`
20
+ **Extract:** `.cursor/extracts/qa-inbox.md` · `qa-team.md`
21
21
 
22
22
  ---
23
23
 
@@ -25,8 +25,8 @@ disable-model-invocation: true
25
25
 
26
26
  | Read (whole file) | Write | NEVER do |
27
27
  |---|---|---|
28
- | `qa/open/<id>.yaml` | Patch `target.path` only | Read generated `*.md` as SSOT |
29
- | Target bundle **or** `01-backend-spec.yaml` (entire file) | Delete QA file after patch | Author `openQuestions` |
28
+ | `qa/<id>.yaml` (legacy: `qa/open/<id>.yaml`) | Patch `target.path` only | Read generated `*.md` as SSOT |
29
+ | Target bundle **or** `01-backend-spec.yaml` (entire file) | **Append** `updates[]` — never delete prior lines | Author `openQuestions` |
30
30
  | `ir/design.yaml` — ONLY to locate field if `at` is a design pointer | `flowgrid split` after patch | Full-screen rewrite (use `/spec`) |
31
31
 
32
32
  ---
@@ -41,10 +41,10 @@ disable-model-invocation: true
41
41
 
42
42
  ## Rule: Resolving the QA File
43
43
 
44
- - **[MANDATORY]** Step 1: Locate `qa/open/<id>.yaml`. If missing, glob `qa/open/QA-*-NNNN.yaml` matching `id:`.
45
- - Zero matches → **STOP**, list available `qa/open/` IDs to user.
44
+ - **[MANDATORY]** Step 1: Locate `qa/<id>.yaml`. If missing, glob `qa/*` and legacy `qa/*` matching `id:`.
45
+ - Zero matches → **STOP**, list available QA ids to user.
46
46
  - Multiple matches → **STOP**, prompt user to clarify which file to close.
47
- - **[MANDATORY]** Step 2: Read `target.path`, `target.at`, `kind`, `skill`, and `question` from the QA file.
47
+ - **[MANDATORY]** Step 2: Read `target.path`, `target.at`, `kind`, `skill`, and latest `question` from `updates[]` (or legacy `question` field).
48
48
 
49
49
  ---
50
50
 
@@ -60,9 +60,10 @@ disable-model-invocation: true
60
60
 
61
61
  - **[MANDATORY]** Post-patch execution:
62
62
  1. Write solution into field at `target.at` (replacing `#missing_info` / empty / placeholder).
63
- 2. Remove this ID from `#missing_info QA-…`, `#tech-debt:QA-…`, and all tag lists.
64
- 3. **Delete** `qa/open/<id>.yaml`.
63
+ 2. Remove this ID from `#missing_info QA-…`, `#tech-debt:QA-…`, `#missing_info <id>`, and all tag lists.
64
+ 3. **Same file:** Append `updates[]` entry `kind: answer`, `at` now (`YYYYMMDD HH:mm`), `text` = solution; set `status: closed`.
65
65
  4. Run `flowgrid split` / `pnpm docs:split` so `ir/spec.yaml` Q&A removes this ID.
66
+ 5. Remind `flowgrid render` to refresh `qa/index.md`.
66
67
  - **[MANDATORY]** Preserve existing error matrices (`onSuccess` / `onCommonError` / `onSpecificError`, `#err:*`) unless solution specifically alters those fields.
67
68
 
68
69
  ---
@@ -84,8 +85,8 @@ disable-model-invocation: true
84
85
 
85
86
  ## Verification Checklist
86
87
 
87
- - [ ] Read `qa/open/<id>.yaml`; patched only `target.path` field.
88
+ - [ ] Read `qa/<id>.yaml`; patched only `target.path` field.
88
89
  - [ ] Solution sourced strictly from user prompt (or single AskQuestion turn).
89
- - [ ] QA file deleted; `pendingTechDebt` + `#missing_info` references removed for this ID.
90
+ - [ ] Appended `kind: answer`; `status: closed`; tags removed for this ID.
90
91
  - [ ] `flowgrid split` executed; `ir/spec.yaml` Q&A reflects closed status.
91
92
  - [ ] Did not author `openQuestions` or `bundle.spec.api`.
@@ -0,0 +1,45 @@
1
+ ---
2
+ name: qa-review
3
+ description: /qa-review — append review line on qa/<id>.yaml (team).
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ > [!CRITICAL] MANDATORY PRE-FLIGHT
8
+ > **[MANDATORY]** Read `.cursor/extracts/qa-team.md` and hub `docs/workflows/qa-team.md`.
9
+
10
+ # /qa-review — Review QA timeline (team)
11
+
12
+ **Owner:** docs hub (`--type=Document` or consumer `FLOWGRID_DOCS_ROOT`)
13
+
14
+ **When:** After `/qa-resolve` appended `kind: answer`; senior checks decision quality and spec patch.
15
+
16
+ **Not this skill:** First answer + patch (`/qa-resolve`); silent spec edits (`/update-spec` without review note).
17
+
18
+ ---
19
+
20
+ ## Input
21
+
22
+ - `HOTEL-LIST_0001` (or legacy `QA-<page-id>-NNNN`)
23
+ - Optional: reviewer id + verdict in user prompt
24
+
25
+ ---
26
+
27
+ ## Steps
28
+
29
+ 1. Read **whole** `qa/<id>.yaml` (legacy: `qa/` or same basename under `qa/`).
30
+ 2. Read **whole** target `*.bundle.yaml` or `01-backend-spec.yaml` at `target.path`; verify field at `target.at` matches latest `kind: answer` text.
31
+ 3. **Append only** to `updates[]` (never edit or delete prior lines):
32
+ - `at`: now (`YYYYMMDD HH:mm`)
33
+ - `by`: reviewer
34
+ - `kind`: `review`
35
+ - `text`: `approved: …` or `needs-change: …` (substantive notes)
36
+ 4. If `needs-change` in text → set `status: open` on **same file** (middle fixes spec + `/qa-resolve` or append another `answer` later).
37
+ 5. Remind: `flowgrid render` to refresh `qa/index.md`.
38
+
39
+ ---
40
+
41
+ ## Verification
42
+
43
+ - [ ] File exists; timeline append-only.
44
+ - [ ] Review notes substantive for `needs-change`.
45
+ - [ ] No invented business beyond comparing answer vs spec.
@@ -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)
@@ -25,7 +26,7 @@ disable-model-invocation: true
25
26
  - **Small Scope (≤5 gaps):** Run `AskQuestion` wizard — **one question at a time**, **≥3 options**: (1) `(Recommended)`, (2) Alternative, (3) `Log as Tech Debt (Pending)`. Show next question only after member answers current one.
26
27
  - **Large Scope (≥10 gaps OR multi-screen scope):** **[MANDATORY HARD STOP IN CHAT]**. Do not spam single questions in chat. Generate an implementation plan / Plan Mode document partitioned into Phases (3–5 questions/fields per phase) to prevent session token overflow.
27
28
  - ❌ Never invent, assume, or silently skip missing fields.
28
- - **[MANDATORY]** If member chooses "Log as Tech Debt" → create `qa/open/QA-<page-id>-NNNN.yaml` + tag `#missing_info QA-…`. Do not block on it.
29
+ - **[MANDATORY]** If member chooses "Log as Tech Debt" → read `.flowgrid/templates/qa-item.yaml` + `qa-authoring.md`; create `qa/<SHORT>_NNNN.yaml` (`schema: flowgrid-qa-item/v1`) + tag `#missing_info <id>`. Do not block on it.
29
30
  - **[RECOMMENDED]** Brainstorm business text (context, input, output, screen descriptions) proactively in Vietnamese for Non-tech audience — do not wait to be told.
30
31
 
31
32
  ---
@@ -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` 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
 
@@ -36,7 +37,7 @@ Doc hub: `platform/toolchain/UPDATE-SPEC-FLOW.md` · `platform/toolchain/FEATURE
36
37
  - **[MANDATORY]** Gaps or ambiguity regarding delta scope, evaluate total gap volume:
37
38
  - **Small Scope (≤5 questions):** Trigger `AskQuestion` wizard — one question at a time, **≥3 options**: (1) `(Recommended)`, (2) `Other`, (3) `Log as Tech Debt (Pending)`.
38
39
  - **Large Scope (≥10 gaps):** **[MANDATORY HARD STOP IN CHAT]**. Do not spam single questions in chat. Generate an implementation plan / Plan Mode document partitioned into sequential Phases (3–5 gaps per phase) with disk offloading at boundaries.
39
- - ✅ If "Log as Tech Debt" is selected → create `qa/open/` entry; do not invent business data.
40
+ - ✅ If "Log as Tech Debt" is selected → create `qa/` entry; do not invent business data.
40
41
  - ❌ Never invent delta scope or novel business fields without explicit user confirmation.
41
42
  - Path SSOT: `surfaces/<surface>/CMP-*/<slug>/` — NO `modules/` segment.
42
43
 
@@ -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` + `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.