@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
@@ -0,0 +1,37 @@
1
+ # Wire phase — tests-hub handoff
2
+
3
+ When **FE `/wire` or `/grill-wire`** finds plan gaps (real API behaviour, status codes, matrix facets), fix on **tests-docs** — not on FE repo.
4
+
5
+ Hub: `docs/workflows/wire.md#gap-loop` · FE extract: `harness/fe/extracts/wire-audit-loop.md`.
6
+
7
+ ## Triggers from wire audits
8
+
9
+ | Signal | Tests action |
10
+ |--------|----------------|
11
+ | `audit e2e` `matrixRowsUncovered` for post-wire facet | Extend `TC-*.yaml` `testMatrix` + `steps[]` (real API, no mock) |
12
+ | New error path seen on wire (409, 422 field) | Add negative TC row; mirror bundle `#err:*` |
13
+ | `SC_SCREEN_NO_TC` after wire | `/testcase` under `cases/...` or update `SC-*.yaml` |
14
+ | Plan still describes mock-only setup | Set lifecycle / steps for **wire** runtime; remove mock-only `setup` notes |
15
+
16
+ ## Grill sequence
17
+
18
+ 1. Read full `*.bundle.yaml` on docs (post `/update-spec` if spec changed).
19
+ 2. Patch `cases/**/TC-*.yaml` — `traceability`, `testMatrix`, `refs`.
20
+ 3. `flowgrid cases:check`
21
+ 4. `flowgrid audit testcase <TC.yaml> --bundle <bundle>`
22
+ 5. `flowgrid cases:gate --strict --docs-root $FLOWGRID_DOCS_ROOT`
23
+ 6. `flowgrid cases:render` (hub 5174)
24
+ 7. `/grill-testcase` sign-off for scope
25
+
26
+ ## Back to FE
27
+
28
+ ```text
29
+ testcase:gen --id TC-* # e2e-root
30
+ /test → scoped test:e2e (post-wire)
31
+ /grill-test → audit e2e
32
+ /grill-wire → full convergence chain
33
+ ```
34
+
35
+ ## Spec hole (not test-only)
36
+
37
+ If AC/UX wrong → paste `/docs-hub /update-spec …` — do not invent business rules on tests hub.
@@ -6,6 +6,7 @@ disable-model-invocation: true
6
6
 
7
7
  > [!CRITICAL] MANDATORY PRE-FLIGHT
8
8
  > **[MANDATORY]** Re-read this entire `SKILL.md` via file-read tool. STRICTLY FORBIDDEN to rely on memory.
9
+ > **[MANDATORY]** Read `.cursor/extracts/tests-verify-gate.md`, `testcase-plan.md`, and the mode extract matching scope: `grill-screen-tc.md` (one `W-*`), `grill-scenario-flow.md` (`SC-*`), `grill-api-hook.md` (`genType: api-e2e`). After FE wire gaps: also `wire-test-handoff.md`.
9
10
 
10
11
  # /grill-testcase
11
12
 
@@ -6,7 +6,7 @@ disable-model-invocation: true
6
6
 
7
7
  > [!CRITICAL] MANDATORY PRE-FLIGHT
8
8
  > **[MANDATORY]** Re-read this `SKILL.md` via file-read tool.
9
- > **[MANDATORY]** Integration contract SSOT on docs-hub: `surfaces/integrations/`, `01-backend-spec` — skills `/api-integration`, `/grill-integration-spec`.
9
+ > **[MANDATORY]** Contract SSOT on docs-hub: `…/api/<seq>/01-backend-spec.yaml` — `/api-spec` then `/grill-api-spec`.
10
10
 
11
11
  # /test-api — API hook E2E (tests-docs + codegen)
12
12
 
@@ -27,11 +27,11 @@ disable-model-invocation: true
27
27
  - **[MANDATORY]** `api.baseUrlEnv` (CI env) + `api.baseURL` fallback; optional `api.defaultHeaders`.
28
28
  - **[MANDATORY]** `apiSteps[]`: `method`, `path`, `expectStatus`, optional `body`, `headers`, `expectJson`, `expectBodyContains`.
29
29
  - **[MANDATORY]** Human `steps[]` + `testMatrix` (same gate as UI TC).
30
- - Mirror path: `cases/.../integrations/.../TC-*.yaml` aligned with docs integration leaf.
30
+ - Mirror path: `cases/.../<module>/.../TC-*.yaml` aligned with docs API leaf on the same surface.
31
31
 
32
- Template: `harness/tests/templates/TC.example-api.yaml`.
32
+ Template: hub `_templates/TC.example-api.yaml` or `harness/tests/templates/TC.example-api.yaml`.
33
33
 
34
- Audit: `flowgrid audit testcase <TC.yaml> --bundle <integration.bundle.yaml>` when bundle exists on docs hub.
34
+ Audit: `flowgrid audit testcase <TC.yaml> --bundle <*.bundle.yaml>` when bundle exists on docs hub.
35
35
 
36
36
  ---
37
37
 
@@ -53,7 +53,15 @@ Output (e2e-root): `tests/api-e2e/<module>/<TC-id>.api.spec.ts` — run with Pla
53
53
 
54
54
  - Fix auth (HMAC, rotating tokens) in generated spec or TC `headers` — do not commit secrets; use env in CI.
55
55
  - Hybrid UI → API: run UI spec first (or fixture API) then API spec; share `orderId` via `process.env` / `test.info().attach` / storageState as team convention.
56
- - Postman/Newman collections remain optional; link via TC tag `contract-postman` (no FlowGrid gen yet).
56
+ ## Newman / Postman (optional)
57
+
58
+ - **[MANDATORY]** FlowGrid SSOT remains `TC-*.yaml` (`api-e2e`) — Newman does **not** replace plan or `cases:gate`.
59
+ - Store partner collections under e.g. `integrations/postman/`; CI: `newman run … -e …`.
60
+ - Tag TC: `contract-postman`; document collection path in `description`.
61
+ - Use Newman when: partner-owned collection, heavy pre-request scripts, or contractual replay — **in addition to** Playwright gen for traceability.
62
+ - Grill cross-flow: same `SC-*` may list UI `TC` (e2e) + API `TC` (api-e2e) — `audit scenario` must cover both screens/API refs.
63
+
64
+ Extract: `.cursor/extracts/grill-api-hook.md`.
57
65
 
58
66
  ---
59
67
 
@@ -61,5 +69,5 @@ Output (e2e-root): `tests/api-e2e/<module>/<TC-id>.api.spec.ts` — run with Pla
61
69
 
62
70
  - Author plan: `/testcase` (UI), `/scenario` (SC-*)
63
71
  - Grill hub: `/grill-testcase`
64
- - Docs SSOT: `/api-integration`, `/grill-integration-spec`
72
+ - Docs SSOT: `/api-spec`, `/grill-api-spec`
65
73
  - UI E2E after skeleton: `/test` + `testcase:gen`
@@ -7,6 +7,7 @@ disable-model-invocation: true
7
7
  > [!CRITICAL] MANDATORY PRE-FLIGHT
8
8
  > **[MANDATORY]** Re-read this entire `SKILL.md` via file-read tool. STRICTLY FORBIDDEN to rely on memory.
9
9
  > **[MANDATORY]** Read the entire function **`*.bundle.yaml`** (sibling of `ir/` on docs hub) BEFORE authoring any test case. Do not split-read `ir/spec.yaml` + `ir/design.yaml` for coverage traceability.
10
+ > **[MANDATORY]** Read `.cursor/extracts/testcase-plan.md` and golden `TC.example.yaml` from hub `_templates/` (after init) or package `harness/tests/templates/`.
10
11
 
11
12
  # /testcase — E2E Test Case Authoring (Tests Hub)
12
13
 
@@ -91,8 +92,9 @@ disable-model-invocation: true
91
92
  - [ ] Function `*.bundle.yaml` read in full (not partial slices).
92
93
  - [ ] All `userStories.scenarios` covered by corresponding test cases.
93
94
  - [ ] Equivalence Partitioning & Boundary Value Analysis `testMatrix` declared (min/max boundary, regex failure, duplicate 409, double-submit lock, offline preservation).
94
- - [ ] Scenario markdown (`SC-*.md`) formatted with IEEE 29119 Boundary Analysis Table & Gherkin BDD.
95
+ - [ ] Cross-flow: `refs.scenario` points to existing `SC-*`; per-screen TC still authored via `/testcase` (optional review prose: `SC.example.md` pattern).
95
96
  - [ ] `meaning` + `purpose` used for step descriptions.
96
97
  - [ ] `id` short; `title` ≤20 chars; `description` is rich and business-meaningful.
97
98
  - [ ] YAML syntax valid — no JS expressions in test data values.
98
99
  - [ ] Directory structure mirrors docs SSOT path exactly.
100
+ - [ ] `flowgrid cases:render` run so `TC-*.md` exposes steps, testMatrix table, and traceability for QA.
@@ -1,6 +1,6 @@
1
1
  schemaVersion: 2
2
2
  id: TC-EXAMPLE-PARTNER-EXPORT
3
- title: Partner export hook
3
+ title: Partner export
4
4
  summary: Ví dụ — đối tác đọc export API sau khi đơn đã sẵn sàng.
5
5
  story: |
6
6
  Given đơn ORD-EXAMPLE-001 đã được portal xử lý
@@ -38,7 +38,13 @@ steps:
38
38
  - Partner gọi GET export với token hợp lệ
39
39
  - Hệ thống trả JSON orderId và status
40
40
  tags: [integration, partner-api, webhook]
41
+ # contract-postman: integrations/postman/partner-export.json # optional Newman — see grill-api-hook extract
41
42
  automation: automated
43
+ traceability:
44
+ bundleScreen: API-EXAMPLE-EXPORT-001
45
+ bundleScenarios: []
46
+ acceptanceRefs: []
47
+ actionRefs: []
42
48
  dimensions:
43
49
  business: [workflow]
44
50
  technical: [api]
@@ -1,7 +1,10 @@
1
1
  schemaVersion: 2
2
2
  id: TC-EXAMPLE-VALID
3
- title: Example flow with valid input should succeed
3
+ title: Valid create flow
4
4
  summary: Ví dụ — luồng hợp lệ đi đến trạng thái thành công.
5
+ description: |
6
+ Member tạo hồ sơ mới với dữ liệu hợp lệ theo ma trận positive_boundary.
7
+ Kỳ vọng: lưu thành công, thông báo rõ, không mất dữ liệu khi lỗi mạng tạm thời.
5
8
  story: |
6
9
  Given điều kiện đầu vào hợp lệ và người dùng có quyền
7
10
  When thực hiện thao tác nhập liệu và nhấn lưu
@@ -0,0 +1,75 @@
1
+ # Template — Testcase plan (`TC-*.yaml`)
2
+
3
+ **Mục đích:** SSOT **kế hoạch** kiểm thử (hub tests-docs) → `cases:render` → **user case** trên VitePress (port **5174**) → `testcase:gen` → Playwright (e2e-root).
4
+
5
+ **Workflow:** [docs/workflows/test.md](../../../docs/workflows/test.md) · Artifact: [docs/artifacts/tests-docs.md](../../../docs/artifacts/tests-docs.md).
6
+
7
+ ---
8
+
9
+ ## Ai đọc gì
10
+
11
+ | Ai | Đọc | Ghi |
12
+ |----|-----|-----|
13
+ | BA / PO | Docs hub `ir/generated/spec.md` (AC, scenarios) | Không sửa `TC-*.yaml` |
14
+ | QA | Tests hub `TC-*.md` (sau render) + YAML SSOT | `/testcase`, `/scenario` |
15
+ | Dev FE | `TC-*.md` + `ir/design.yaml` (`testIds`) | `/test`, `/grill-test` |
16
+ | Dev BE | `TC` `genType: api-e2e` + docs `01` | `/test-api` |
17
+
18
+ **Không** sửa tay `TC-*.md` — chỉnh YAML → `flowgrid cases:render`.
19
+
20
+ ---
21
+
22
+ ## Path mirror
23
+
24
+ ```text
25
+ docs: surfaces/<surface>/CMP-*/<NN…>/<slug>/*.bundle.yaml
26
+ tests: cases/<surface>/CMP-*/<NN…>/<slug>/TC-*.yaml
27
+ ```
28
+
29
+ Cross-flow: `scenarios/.../FLOW-<name>/SC-*.yaml` mirror `FLOW-*.md` trên docs.
30
+
31
+ ---
32
+
33
+ ## Golden file
34
+
35
+ Copy shape từ `harness/tests/templates/TC.example.yaml` (sau init tests hub: `.flowgrid/` hoặc package harness path).
36
+
37
+ Bắt buộc:
38
+
39
+ - `schemaVersion: 2`
40
+ - `story` / `description` (ngữ cảnh nghiệp vụ)
41
+ - `testMatrix[]` — facet: `positive_boundary`, `negative_length`, `negative_format`, `negative_duplicate`, `concurrency_double_submit`, `network_interruption`
42
+ - `steps[]` — chuỗi bước QA (string hoặc machine step)
43
+ - `traceability` — `bundleScreen`, `bundleScenarios[]`, `acceptanceRefs[]`, `actionRefs[]` (cho `cases:gate --strict`)
44
+ - `testIds.required` — khớp bundle/design sau split
45
+ - `genType: e2e` | `api-e2e`
46
+
47
+ ---
48
+
49
+ ## Trước khi author
50
+
51
+ 1. Đọc **cả** `*.bundle.yaml` trên docs leaf — không chỉ IR.
52
+ 2. Bundle thiếu story/AC → STOP → `/update-spec` trên docs hub.
53
+ 3. `flowgrid audit testcase <TC> --bundle <bundle>` sau draft.
54
+
55
+ ## Gate release
56
+
57
+ ```text
58
+ flowgrid cases:check
59
+ flowgrid cases:render
60
+ flowgrid cases:gate --strict --docs-root $FLOWGRID_DOCS_ROOT
61
+ ```
62
+
63
+ ---
64
+
65
+ ## Grill — chọn mode
66
+
67
+ | Mode | Extract / workflow |
68
+ |------|-------------------|
69
+ | Một màn `W-*` | `extracts/grill-screen-tc.md` · [test.md#grill-single-screen](../../../docs/workflows/test.md#grill-single-screen) |
70
+ | Flow dài `SC-*` | `extracts/grill-scenario-flow.md` · [test.md#grill-scenario-flow](../../../docs/workflows/test.md#grill-scenario-flow) |
71
+ | API hook | `/test-api` · `extracts/grill-api-hook.md` · Playwright `testcase:gen:api` (+ Newman tùy chọn) |
72
+
73
+ ## Excel UAT
74
+
75
+ Excel deliverable **xuất sau** YAML/MD chốt — không SSOT ngược. Xem tests-docs § Excel.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shanyucoder/flowgrid",
3
- "version": "0.1.4",
3
+ "version": "0.1.8",
4
4
  "description": "Unified Local MCP Toolkit (Graph, DNA, Docs, Test, Codegen)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -45,6 +45,7 @@
45
45
  ]
46
46
  },
47
47
  "registries": [
48
+ "registries/be-capabilities.registry.json",
48
49
  "registries/codegen.registry.json",
49
50
  "registries/unit-test.registry.json",
50
51
  "registries/common.registry.json"
@@ -42,6 +42,7 @@
42
42
  },
43
43
  "registries": [
44
44
  "registries/codegen.registry.json",
45
+ "registries/be-capabilities.registry.json",
45
46
  "registries/unit-test.registry.json"
46
47
  ],
47
48
  "gapSources": [
@@ -0,0 +1,72 @@
1
+ {
2
+ "stack": "nestjs",
3
+ "mode": "brownfield",
4
+ "commands": {
5
+ "genDry": [
6
+ "flowgrid",
7
+ "api-gen:dry",
8
+ "--",
9
+ "--spec",
10
+ "{spec}"
11
+ ],
12
+ "gen": [
13
+ "flowgrid",
14
+ "api-gen",
15
+ "--",
16
+ "--spec",
17
+ "{spec}"
18
+ ],
19
+ "unitGenDry": [
20
+ "flowgrid",
21
+ "api-unit-gen:dry",
22
+ "--",
23
+ "--spec",
24
+ "{spec}"
25
+ ],
26
+ "unitGen": [
27
+ "flowgrid",
28
+ "api-unit-gen",
29
+ "--",
30
+ "--spec",
31
+ "{spec}"
32
+ ],
33
+ "registryValidate": [
34
+ "flowgrid",
35
+ "api-registry"
36
+ ]
37
+ },
38
+ "registries": [
39
+ "registries/be-capabilities.registry.json",
40
+ "registries/nest-codegen.registry.json",
41
+ "registries/nest-unit-test.registry.json"
42
+ ],
43
+ "gapSources": [
44
+ "**/generated/HANDOFF.md",
45
+ "**/generated/UNIT-HANDOFF.md",
46
+ "**/generated/codegen.manifest.json"
47
+ ],
48
+ "specRoots": [],
49
+ "templates": {
50
+ "root": "adapters/nestjs/nestgen/templates",
51
+ "engine": "handlebars",
52
+ "note": "SSOT in FlowGrid package; product registries at repo root"
53
+ },
54
+ "dsl": {
55
+ "ssot": "product-repo",
56
+ "lanes": {
57
+ "be": {
58
+ "registries": ["registries/nest-codegen.registry.json"],
59
+ "genKeys": ["genDry", "gen"],
60
+ "needsTags": ["#needs-endpoint", "#needs-dto"]
61
+ },
62
+ "unit": {
63
+ "registries": ["registries/nest-unit-test.registry.json"],
64
+ "genKeys": ["unitGenDry", "unitGen"],
65
+ "needsTags": ["#needs-unit-test"]
66
+ }
67
+ }
68
+ },
69
+ "vocabularies": {
70
+ "registryTags": "artifactgraph/lexicon/registry-tags.en.txt"
71
+ }
72
+ }
@@ -38,6 +38,7 @@
38
38
  },
39
39
  "registries": [
40
40
  "registries/design.registry.json",
41
+ "registries/be-capabilities.registry.json",
41
42
  "registries/nest-codegen.registry.json",
42
43
  "registries/contract-field.registry.json"
43
44
  ],
@@ -48,6 +48,7 @@
48
48
  "registries/design.registry.json",
49
49
  "registries/unit-test.registry.json",
50
50
  "registries/e2e-test.registry.json",
51
+ "registries/be-capabilities.registry.json",
51
52
  "registries/nest-codegen.registry.json",
52
53
  "registries/contract-field.registry.json"
53
54
  ],
@@ -15,6 +15,8 @@ status: "draft"
15
15
 
16
16
  * **Bối cảnh kích hoạt (Trigger Context):** [Mô tả hoàn cảnh hoặc sự kiện nào khiến quy trình này diễn ra. Ví dụ: Khách hàng yêu cầu đặt hàng, hoặc quản trị viên khởi tạo chiến dịch khuyến mãi...]
17
17
  * **Mục tiêu kinh doanh (Business Goal):** [Giá trị kinh doanh hoặc bài toán mà quy trình này giải quyết...]
18
+ * **Chỉ số thành công (Success metrics):** [Đo được nếu có — VD: thời gian xử lý, tỷ lệ lỗi, SLA phản hồi]
19
+ * **Phạm vi không làm (Non-goals):** [Quy trình/phase này cố ý không bao gồm — tránh trùng FLOW khác]
18
20
  * **Ma trận Vai trò & Quyền hạn (Role & Permission Matrix):**
19
21
  | Tác nhân (Actor) | Vai trò trong Quy trình | Quyền hạn trên Màn hình |
20
22
  | :--- | :--- | :--- |
@@ -1,2 +1,68 @@
1
- # Product Overview
2
- Welcome to the product overview.
1
+ ---
2
+ status: draft
3
+ owner: product-team
4
+ ---
5
+
6
+ # Product overview (arc42 §1 — Introduction & Goals)
7
+
8
+ Tài liệu **sản phẩm** cho toàn docs hub: *vì sao* hệ thống tồn tại, *ai* dùng, *phạm vi* operational area. Chi tiết màn/API → `surfaces/`; kiến trúc kỹ thuật → `architecture/`.
9
+
10
+ ## Mục tiêu (Goals)
11
+
12
+ 1. **Giá trị nghiệp vụ** — [Một đoạn: bài toán chính product giải quyết.]
13
+ 2. **Đối tượng phục vụ** — [Vai trò / operational area chính.]
14
+ 3. **Nguyên tắc sản phẩm** — [VD: một SSOT docs, trace `W-*` / `API-*`, grill trước codegen.]
15
+
16
+ ## Stakeholders
17
+
18
+ | Vai trò | Mục đích đọc overview |
19
+ | --- | --- |
20
+ | PO / BA | Phạm vi, persona, operational area |
21
+ | Dev / QA | Boundary module, link `CMP-*` |
22
+ | Leadership | Goals + success metrics cấp product |
23
+
24
+ ## Top quality goals (arc42)
25
+
26
+ | # | Thuộc tính | Mục tiêu (đo được nếu có) |
27
+ | --- | --- | --- |
28
+ | 1 | Khả dụng | [VD: uptime SLA nội bộ] |
29
+ | 2 | Bảo mật | [VD: RBAC trên admin portal] |
30
+ | 3 | Khả năng mở rộng | [VD: multi-tenant / module mới không phá SSOT] |
31
+ | 4 | Khả năng bảo trì | [VD: spec bundle + split + audit] |
32
+ | 5 | Trải nghiệm | [VD: affordance UX portal chuẩn] |
33
+
34
+ ## Personas (tóm tắt)
35
+
36
+ - **[Persona A]** — [Một câu: nhu cầu chính trên surface nào.]
37
+ - **[Persona B]** — […]
38
+
39
+ Leaf `userStories.primary.asA` **tham chiếu** persona ở đây (không copy persona dài trên từng màn).
40
+
41
+ ## Phạm vi & không làm (product-level)
42
+
43
+ **In scope (overview):**
44
+
45
+ - [Operational area / surface được document trong hub này]
46
+
47
+ **Non-goals (product-level):**
48
+
49
+ - [VD: không mô tả hạ tầng chi tiết — xem `architecture/`]
50
+ - [VD: không thay quy trình UAT Excel deliverable — xem tests-docs]
51
+
52
+ ## Success metrics (product-level)
53
+
54
+ - [Chỉ số đo được cấp product — VD: thời gian onboard member đọc SSOT, % leaf có audit sạch trước test lane]
55
+
56
+ ## Operational areas
57
+
58
+ Mỗi area một file dưới `overview/operational-areas/` — dùng [`_template.md`](./operational-areas/_template.md).
59
+
60
+ | Area | File |
61
+ | --- | --- |
62
+ | [Tên area] | `operational-areas/<slug>.md` |
63
+
64
+ ## See also
65
+
66
+ - Surfaces SSOT: `surfaces/`
67
+ - Architecture: `architecture/01-introduction/`
68
+ - Workflow Design: `platform` hoặc `docs/workflows/design.md` (khi publish site)
@@ -0,0 +1,37 @@
1
+ ---
2
+ id: OA-TEMPLATE
3
+ title: "Tên operational area"
4
+ status: draft
5
+ surfaces: ["admin-web"]
6
+ ---
7
+
8
+ # Operational area: [Tên]
9
+
10
+ **Mục đích:** [Một đoạn — bối cảnh vận hành: ai làm việc gì, trên kênh nào.]
11
+
12
+ ## Personas trong area
13
+
14
+ | Persona | Mô tả ngắn | Surface chính |
15
+ | --- | --- | --- |
16
+ | [VD: Nhân viên vận hành] | [Nhu cầu] | `admin-web` |
17
+
18
+ ## Phạm vi nghiệp vụ
19
+
20
+ - **In scope:** [Quy trình / module thuộc area]
21
+ - **Out of scope:** [Chuyển sang area khác hoặc phase sau]
22
+
23
+ ## Success metrics (area)
24
+
25
+ - [Metric 1 — đo được]
26
+ - [Metric 2]
27
+
28
+ ## Liên kết module
29
+
30
+ | CMP | Mô tả |
31
+ | --- | --- |
32
+ | `CMP-XX-…` | [Boundary một dòng] |
33
+
34
+ ## Non-goals
35
+
36
+ - [Không document chi tiết deployment — `architecture/07-deployment/`]
37
+ - [Không duplicate FLOW kỹ thuật — `architecture/03-business-process/`]
@@ -1,6 +1,14 @@
1
1
  # Data model
2
2
 
3
- Shared domain notes (MD). Entity detail for a feature still belongs in that feature’s Code bundle `spec.entities`.
3
+ Shared domain notes (MD) — **bổ trợ** ERD; không thay `common/db-erd.md`.
4
+
5
+ | Artifact | Vai trò |
6
+ |----------|---------|
7
+ | [`../db-erd.md`](../db-erd.md) | **ERD tổng** (Phase 0, skill `/db-erd`) — Mermaid, entity, ownership |
8
+ | File này + topics | Policy prose (`#derived-data`, journey links) |
9
+ | Leaf `*.bundle.yaml` | **Chi tiết màn:** `spec.entities` + `design.sections[].db` → `ir/design.yaml` |
10
+
11
+ Workflow: [architecture-data.md](/docs/workflows/architecture-data.md) (path hub khi publish).
4
12
 
5
13
  ## Topics
6
14
 
@@ -9,7 +17,7 @@ Shared domain notes (MD). Entity detail for a feature still belongs in that feat
9
17
  ## Journeys vs ER
10
18
 
11
19
  Runtime sequences live under [`architecture/06-runtime/journeys/`](/architecture/06-runtime/) (`FLOW-*`).
12
- When a journey persists data, **link** the relevant entity here or in the owning `CMP-*/code` bundle — **do not** paste ER diagrams into every sequence.
20
+ When a journey persists data, **link** the entity in **`db-erd.md`** — **do not** paste ER diagrams into every sequence or every bundle.
13
21
 
14
22
  | Journey | Data notes |
15
23
  |---------|------------|
@@ -0,0 +1,14 @@
1
+ # Copy to api/<seq>/03-mock.yaml when prototype/wire needs samples (optional).
2
+ version: 1
3
+ feature: feature-slug
4
+ endpoints:
5
+ feature.search:
6
+ samples:
7
+ - status: 200
8
+ description: "List success — replace with realistic payload"
9
+ body:
10
+ data: []
11
+ meta:
12
+ page: 1
13
+ perPage: 20
14
+ total: 0
@@ -1,3 +1,6 @@
1
+ # LEGACY: portal-feature-bundle with nested spec.api — do NOT use for new 01 files.
2
+ # New API contract SSOT: api/<seq>/01-backend-spec.yaml from backend-api.yaml + tpl-api-contract.md
3
+
1
4
  schema: portal-feature-bundle/v1
2
5
  id: role-domain-function
3
6
  title: Feature API
@@ -1,3 +1,7 @@
1
+ # SSOT shape for api/<seq>/01-backend-spec.yaml (NOT the screen bundle).
2
+ # Authoring guide: tpl-api-contract.md · Sample only — copy/adapt per leaf.
3
+ # Portal screen bundle: feature.bundle.yaml — do NOT embed spec.api here.
4
+
1
5
  feature:
2
6
  id: feature-slug
3
7
  title: Feature Title
@@ -0,0 +1,8 @@
1
+ {
2
+ "version": 1,
3
+ "description": "BE base capabilities (auth, exceptions, shared helpers) indexed for DSL / ArtifactGraph. flowgrid registry:sync",
4
+ "capabilities": {},
5
+ "middleware": [],
6
+ "exceptionHandlers": [],
7
+ "helpers": []
8
+ }
@@ -8,8 +8,10 @@ Hub: `docs/templates/feature.bundle.yaml` · split: `pnpm spec:split`
8
8
  |-----|---------|
9
9
  | `page-id` | Screen identity (`cmp-adm-000-01`). Split copies this onto `ir/spec.yaml` as `page-id` (not `id`, so it does not collide with requirement/section ids). Legacy bundles may still use `id`. |
10
10
  | `summary` | Phải trình bày dạng bullet. Bắt buộc có các tiêu đề (chuẩn Arc42 business): **mục tiêu nghiệp vụ** (business_goals), **các bên liên quan** (stakeholders), **kịch bản người dùng** (user_journey), **bối cảnh** (description, input liên kết cross-page/module, output) và **cách giải quyết** (tùy chọn). Mục đích để 100% Non-tech Stakeholder hiểu và duyệt. |
11
+ | `successMetrics` | **Tùy chọn** khi có thông tin — bullet (string multiline hoặc list). Chỉ số đo được / qualitative metric cấp **màn/feature**. Product-level → `overview/`. Split → `ir/spec.yaml`; render → section riêng trong `ir/generated/spec.md`. |
12
+ | `nonGoals` | **Tùy chọn** — phạm vi **không làm** trên màn/phase (PRD non-goals). Tránh nhét vào `requirements` prose. |
11
13
  | `userStories` | **Khối User Stories chuyên sâu cho màn hình:** `primary`, `contextAndHandoff` (+ `screenAccess`), `scenarios` (5 kịch bản chuẩn + **scenario thứ 6 “Affordances UX”** khi màn có delete/filter/breadcrumb/disabled/import — xem `feature.bundle.yaml`), `acceptanceCriteria` (kèm checkbox UX khi áp dụng). **Split:** `pnpm spec:split` copy nguyên khối sang `ir/spec.yaml` (business prose); **không** tự sinh từ `design` — Agent phải cập nhật `userStories` khi bổ sung DSL/`#needs-component`/audit `UX_*`. Render → `## User Stories & Screen Journey` trong Markdown. |
12
- | `spec` | Design v1 — actors, requirements, `ui.routes`, **`ui.list` / `ui.form` / `ui.detail`**, `acceptance`. **Không** author `spec.api` — API SSOT là `api/<seq>/01-backend-spec.yaml`. |
14
+ | `spec` | Design v1 — **`entities`**, **`relationships`**, actors, requirements, `ui.routes`, **`ui.list` / `ui.form` / `ui.detail`**, `acceptance`. **Không** author `spec.api` — API SSOT là `api/<seq>/01-backend-spec.yaml`. |
13
15
  | `gen` | **Bắt buộc trước flowgrid gen:** `codegen.profile` (`auth` login/forgot/reset; `change-password`; `public`; `not-found`/`error`; `list`/`create`/`admin-crud`) + entity/module, `tags`, derived `ui.*`. `/grill-dev` ghi. Endpoint `action` ghi trên **01**, không trên bundle. |
14
16
  | `legacy` | Legacy facts + evidence pointers |
15
17
  | `design` | Nested **`sections[]`** (card/container/form + `meaning` + `purpose` + `visual` + `interaction` + `validation` + `messages` + `states` + `bind`/`db`) · **`nav`** (`screenAccess` & `sidebar.hierarchy`) · `zones[]` fallback · `behavior` · **`actions[]`** (onSuccess, onSpecificError, backgroundTrigger) |
@@ -36,6 +38,39 @@ Hub: `docs/templates/feature.bundle.yaml` · split: `pnpm spec:split`
36
38
  - Missing hard facts → `#missing_info` on that field. Do not wait for grill to invent inventory.
37
39
  - `/grill-bqa`, `/grill-dev`, `/grill-docs` only re-check, fill gaps, or fix conflicts.
38
40
 
41
+ ## Data model — Phase 0 ERD vs screen detail {#data-model--phase-0-erd-vs-screen-detail}
42
+
43
+ **Phase 0 (không viết trong `/spec` session đầu nếu chưa có):** `/db-erd` → `<LCA>/common/db-erd.md` (Mermaid ER, ownership). Workflow: [architecture-data.md](../../docs/workflows/architecture-data.md).
44
+
45
+ **Phase 1 — trên leaf bundle (bắt buộc khi field persisted):**
46
+
47
+ | Chỗ ghi | Nội dung |
48
+ |---------|----------|
49
+ | `spec.entities[]` | Entity **của màn** (name, mô tả ngắn, link entity ER) — mirror subset ERD, không copy full diagram |
50
+ | `spec.relationships[]` | Quan hệ màn này đọc/ghi (optional) |
51
+ | `design.sections[].items[].db` | `schema` (table hoặc tên khớp ERD), `field` (column), `enumMapping` cho select/chip |
52
+ | `design.sections[].items[].bind` | `field` — tên payload form/API (có thể camelCase khác column DB) |
53
+ | `spec.ui.list.columns[]` | `key` khớp `bind.field` hoặc cột DB; cột chỉ tính toán → `#derived-data`, không `db` |
54
+ | `spec.ui.form` / `detail` fields | Cùng quy tắc `bind` + `db` trên từng control |
55
+
56
+ **Quy tắc:**
57
+
58
+ - Có `validation` trên control persisted → **phải** có `db.field` (hoặc QA defer) trừ khi field pure UI (`#derived-data`).
59
+ - `meaning` = nghiệp vụ; `db` = vật lý — không gộp một dòng chung trong `requirements`.
60
+ - Split: `entities` + `db` → **`ir/design.yaml`**; BA MD generated **không** render `db` (dev đọc IR / `01`).
61
+ - Grill-dev: `01.modules[].entities[].fields` phải **khớp** tập `db.field` màn (review tay; `#update:*` khi đổi).
62
+
63
+ **Không:** dump SQL migration; thay `db-erd.md` bằng `entities: []` rỗng khi form có >3 field persisted.
64
+
65
+ **Review (multi-table):**
66
+
67
+ | Artifact | Ai đọc |
68
+ |----------|--------|
69
+ | `design.dataModel` | BA/lead — vai trò từng bảng (`tables[].roleOnScreen`, `summary`) — mẫu [tpl-screen-data-model.md](./tpl-screen-data-model.md) |
70
+ | `ir/generated/data-model.md` | Sau `flowgrid split` — bảng/cột gom theo `schema`; link từ `spec.md` |
71
+ | `api/.../01-backend-spec.yaml` | BE codegen — `modules[].entities[]` + `fields[]` khớp `db` trên design |
72
+ | `flowgrid audit spec` | `confirms[]` `CONFIRM_DB_*` → AskQuestion (extract `db-audit-wizard.md`); không chặn split |
73
+
39
74
  ## spec (design v1) — có
40
75
 
41
76
  - `actors`, `entities`, `relationships`
@@ -76,8 +111,9 @@ Authoring (`/spec`, grill-*) still **writes** `*.bundle.yaml`, then split.
76
111
  | `*.bundle.yaml` | **Ghi** `/spec`, grill-*; **đọc cả file** `/testcase`, `/grill-testcase` | Đầy đủ spec+gen+design+`userStories`; tests hub read-only |
77
112
  | `ir/design.yaml` | **Đọc cả file** — grill-*, FE `/prototype`, codegen | Tech sau split; `api` chiếu từ 01. |
78
113
  | `ir/spec.yaml` | VitePress + stakeholder | Business page + requirements/acceptance. Không id/tag/bind. `"Q&A"`. Không stub `legacy` rỗng. |
79
- | `…/api/<seq>/01-backend-spec.yaml` | BE `/api`, `openapi:gen`, **author API** | Tech BE — SSOT duy nhất cho endpoint |
80
- | `<slug>.md` | Người (BA/QA) | Render từ **`ir/spec.yaml`** (chưa split thì không có trang) |
114
+ | `…/api/<seq>/01-backend-spec.yaml` | BE `/api`, `openapi_gen`, **author API** | Tech BE — SSOT duy nhất cho endpoint |
115
+ | `ir/generated/data-model.md` | BA/lead/BE review | Bảng/cột theo `schema` (multi-table); sinh từ `ir/design.yaml` |
116
+ | `ir/generated/spec.md` · `ir/generated/api.md` | BA/QA/Dev review (VitePress) | Render từ `ir/spec.yaml` + `01`; hướng dẫn API: [tpl-api-contract.md](./tpl-api-contract.md) |
81
117
 
82
118
  Không còn `ir/legacy.yaml`. `legacy:` trên `ir/spec.yaml` chỉ khi có evidence thật.
83
119