@shanyucoder/flowgrid 0.1.9 → 0.1.10

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 (69) hide show
  1. package/bin/flowgrid.mjs +43 -9
  2. package/bin/lib/audit-run.mjs +5 -1
  3. package/bin/lib/docs-hub-locale.mjs +9 -0
  4. package/bin/lib/init-scaffold.mjs +30 -2
  5. package/dist/docs/mcp/tools.js +4 -4
  6. package/dist/docs/mcp/tools.js.map +1 -1
  7. package/dist/docs/scan/ids.d.ts +1 -1
  8. package/dist/docs/scan/ids.js +6 -6
  9. package/dist/docs/scan/ids.js.map +1 -1
  10. package/dist/docs/scan/route.js +2 -2
  11. package/dist/docs/scan/route.js.map +1 -1
  12. package/engines/cases/render-cases.mjs +33 -25
  13. package/engines/docs/lib/audit-hub-prd.mjs +136 -0
  14. package/engines/docs/lib/audit-risks-catalog.mjs +142 -0
  15. package/engines/docs/lib/docs-hub-locale.mjs +100 -0
  16. package/engines/docs/lib/render-bundle-markdown.mjs +8 -1
  17. package/engines/docs/vitepress/config.ts +4 -4
  18. package/engines/spec/lib/audit-bundle-gaps.mjs +38 -7
  19. package/engines/spec/lib/audit-flow-gaps.mjs +2 -2
  20. package/engines/spec/lib/bundle-schema.mjs +3 -1
  21. package/engines/testcase/runners/lib/resolve-hub-id.mjs +3 -3
  22. package/harness/common/skills/legacy/SKILL.md +2 -2
  23. package/harness/docs/extracts/common-scope.md +8 -8
  24. package/harness/docs/extracts/spec-core.md +1 -1
  25. package/harness/docs/extracts/spec-prd-lite.md +11 -13
  26. package/harness/docs/extracts/tpl-module.md +9 -40
  27. package/harness/docs/extracts/tpl-overview-prd.md +11 -0
  28. package/harness/docs/extracts/tpl-risk-register.md +28 -0
  29. package/harness/docs/extracts/tpl-surface-prd.md +7 -0
  30. package/harness/docs/rules/docs-hub.mdc +1 -1
  31. package/harness/docs/rules/flowgrid-process.mdc +1 -1
  32. package/harness/docs/skills/adopt/SKILL.md +1 -1
  33. package/harness/docs/skills/background-logic/SKILL.md +1 -1
  34. package/harness/docs/skills/common-spec/SKILL.md +1 -1
  35. package/harness/docs/skills/cross-service/SKILL.md +1 -1
  36. package/harness/docs/skills/db-erd/SKILL.md +1 -1
  37. package/harness/docs/skills/grill/SKILL.md +2 -0
  38. package/harness/docs/skills/grill-hub-prd/SKILL.md +38 -0
  39. package/harness/docs/skills/module/SKILL.md +8 -5
  40. package/harness/docs/skills/overview/SKILL.md +7 -6
  41. package/harness/docs/skills/risk-register/SKILL.md +29 -0
  42. package/harness/docs/skills/spec/SKILL.md +3 -3
  43. package/harness/docs/skills/surfaces/SKILL.md +3 -1
  44. package/harness/docs/skills/{business-process → user-flow}/SKILL.md +8 -8
  45. package/harness/fe/skills/gen-common/SKILL.md +1 -1
  46. package/harness/tests/extracts/grill-scenario-flow.md +2 -2
  47. package/harness/tests/skills/grill-testcase/SKILL.md +1 -1
  48. package/harness/tests/skills/scenario/SKILL.md +11 -11
  49. package/harness/tests/skills/testcase/SKILL.md +1 -1
  50. package/harness/tests/templates/SC.example.md +16 -16
  51. package/lexicon/registry-tags.en.txt +2 -2
  52. package/package.json +1 -1
  53. package/templates/project-skeleton/architecture/03-business-process/index.md +3 -0
  54. package/templates/project-skeleton/architecture/{03-business-process → 03-user-flows}/FLOW-login.md +6 -6
  55. package/templates/project-skeleton/architecture/{03-business-process → 03-user-flows}/FLOW-template.md +6 -7
  56. package/templates/project-skeleton/architecture/11-risks/index.md +7 -17
  57. package/templates/project-skeleton/architecture/11-risks/risk-register.md +34 -0
  58. package/templates/project-skeleton/architecture/12-glossary/index.md +2 -1
  59. package/templates/project-skeleton/overview/index.md +21 -43
  60. package/templates/project-skeleton/overview/operational-areas/_template.md +15 -22
  61. package/templates/project-skeleton/surfaces/_module-index.template.md +40 -0
  62. package/templates/project-skeleton/surfaces/_surface-index.template.md +43 -0
  63. package/templates/shared/bundle-authoring.md +5 -2
  64. package/templates/shared/default-layout.ejs +108 -62
  65. package/templates/shared/feature.bundle.yaml +15 -6
  66. package/templates/shared/ir/generated/spec.md +24 -24
  67. package/templates/shared/tpl-api-contract.md +5 -5
  68. package/templates/tests-skeleton/catalog/locale.yaml +16 -15
  69. package/templates/tests-skeleton/tpl-testcase-plan.md +6 -6
@@ -1,45 +1,14 @@
1
- # Module README template
1
+ # Module index template
2
2
 
3
- Path: `surfaces/<surface>/CMP-{NN}-{slug}/index.md` — **MD only** (yaml under `<function-slug>/code/`).
3
+ Path: `surfaces/<surface>/CMP-{NN}-{slug}/index.md` — **MD only**.
4
4
 
5
- ```markdown
6
- # CMP-{NN} — Name
5
+ Copy from: `templates/project-skeleton/surfaces/_module-index.template.md`
7
6
 
8
- Lead-assigned module. **This README is MD-only** (no YAML).
7
+ Required sections (English keys — `flowgrid audit hub-prd`):
9
8
 
10
- Owns …
9
+ - `## Goals` {#goals}
10
+ - `## Scope` {#scope} — In scope / Out of scope
11
+ - `## Features overview` {#features-overview}
12
+ - `## Depends on` {#depends-on}
11
13
 
12
- ## Out of scope (module)
13
-
14
- - [Chức năng / CMP khác giữ SSOT — không copy bundle vào module này]
15
- - [Hạ tầng / deployment — `architecture/`]
16
-
17
- ## Depends on
18
-
19
- | ID / artifact | Lý do |
20
- | --- | --- |
21
- | `CMP-…` / `FLOW-…` | [Upstream data hoặc quy trình] |
22
- | `API-…` | [Contract reuse — link `01-backend-spec`] |
23
-
24
- | | |
25
- |--|--|
26
- | **ID** | `CMP-{NN}` |
27
- | **Business Process** | Module/cluster: `…/common/processes/FLOW-…`. Catalog: [`architecture/03-business-process/`](/architecture/03-business-process/) |
28
- | **Functions** | `<function-slug>`, … |
29
- | **Screens** | `W-…` |
30
- | **APIs** | `API-…` |
31
-
32
- \`\`\`mermaid
33
- flowchart LR
34
- CMP[CMP-{NN}]
35
- W[W-…]
36
- API[API-…]
37
- CMP --> W
38
- CMP --> API
39
- \`\`\`
40
-
41
- ## Code paths
42
-
43
- - [`<function-slug>/code/W-…/`](./<function-slug>/code/W-…/)
44
- - [`<function-slug>/code/API-…/`](./<function-slug>/code/API-…/)
45
- ```
14
+ Prose: `docs-hub.locale.yaml` → `contentLocale`. No Personas / Success metrics tables on hub.
@@ -0,0 +1,11 @@
1
+ # Overview PRD headings (English keys — audit hub-prd)
2
+
3
+ Required on `overview/index.md`:
4
+
5
+ - `## Goals` {#goals}
6
+ - `## Background` {#background}
7
+ - `## Scope` {#scope} with in-scope / out-of-scope bullets
8
+
9
+ Prose language: `docs-hub.locale.yaml` → `contentLocale` (BCP-47 tag, e.g. `vi`, `en`, `ja`).
10
+
11
+ Forbidden hub sections: Personas tables, Success metrics (manage outside hub).
@@ -0,0 +1,28 @@
1
+ # Risk register — format (SSOT duy nhất)
2
+
3
+ **File:** `architecture/11-risks/risk-register.md`
4
+ **Không** có `risks:` trên `*.bundle.yaml` — audit spec báo `WARN_BUNDLE_RISKS_FORBIDDEN` nếu còn key đó.
5
+
6
+ ## Table: one row = one risk
7
+
8
+ | ID | Type | Description | Limit | Need | Gap | Impact | Mitigation | Status |
9
+
10
+ - **ID:** `RISK-<TOPIC>-<NNN>`
11
+ - **Limit / Need:** counts + units (e.g. `500 emails/day` vs `~700 emails/day` peak)
12
+ - **Gap:** `+200 (~40%)` or equivalent
13
+ - **Status:** `Open` | `Watching` | `Closed` | `Accepted` (prose may use hub `contentLocale`)
14
+
15
+ Ví dụ đầy đủ: xem dòng `RISK-QUOTA-EMAIL-001` trong skeleton `risk-register.md`.
16
+
17
+ ## Quick stats (top of file)
18
+
19
+ Member cập nhật tay (tổng mở, có chênh quota, đã có phương án).
20
+
21
+ ## VitePress
22
+
23
+ Trang MD trong Architecture → 11 Risks → **risk-register** (không render từ feature).
24
+
25
+ ## Audit & skill
26
+
27
+ - `flowgrid audit risks architecture/11-risks/risk-register.md`
28
+ - `/risk-register`
@@ -0,0 +1,7 @@
1
+ # Surface index — English section keys
2
+
3
+ Template: `templates/project-skeleton/surfaces/_surface-index.template.md`
4
+
5
+ Required: `## Goals`, `## Background`, `## Scope`, CMP table, user flow links.
6
+
7
+ Content: language from `docs-hub.locale.yaml` (`contentLocale`).
@@ -19,7 +19,7 @@ only.
19
19
  2. Use `flowgrid_docs_get_element` for one ID.
20
20
  3. Use `flowgrid_docs_deps_of` and `flowgrid_docs_dependents_of` for reference impact.
21
21
  4. Run `flowgrid_docs_orphans` and `flowgrid_docs_validate_links` before claiming completeness.
22
- 5. Use `flowgrid_docs_business_processes` before reading all journey files.
22
+ 5. Use `flowgrid_docs_user_flows` before reading all journey files.
23
23
 
24
24
  Do not require bộ docs for architecture work: if the MCP is unavailable, inspect
25
25
  the repository Markdown directly or explain how to run project-local setup.
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: FlowGrid bộ process — business process trace and impact review (opt-in)
2
+ description: FlowGrid bộ process — business-process-trace (brownfield) and impact review (opt-in)
3
3
  alwaysApply: false
4
4
  ---
5
5
 
@@ -127,7 +127,7 @@ extractBundle: architecture-core
127
127
  ---
128
128
  ## 6. Handoff Usage Guide
129
129
  - `/legacy /spec W-AD-AUTH-001` — spec a legacy screen (MUST reuse CMN-* if applicable)
130
- - `/legacy /business-process FLOW-checkout` — map a legacy flow
130
+ - `/legacy /user-flow FLOW-checkout` — map a legacy flow
131
131
  ```
132
132
 
133
133
  ---
@@ -19,7 +19,7 @@ extractBundle: architecture-core
19
19
  ## Rule: When to Use /background-logic
20
20
 
21
21
  - **[MANDATORY]** Use this skill when:
22
- 1. A `FLOW-*` business process has established UI steps but requires background automation (e.g. dispatching Zalo/SMS notifications upon booking creation, auto-cancelling orders after 15 minutes of non-payment).
22
+ 1. A `FLOW-*` user flow has established UI steps but requires background automation (e.g. dispatching Zalo/SMS notifications upon booking creation, auto-cancelling orders after 15 minutes of non-payment).
23
23
  2. Existing background logic needs updating (changing dispatch channels, modifying filtering conditions, adjusting retry policies, updating storage buckets).
24
24
  3. Auditing background tasks for comprehensive error scenarios, retry strategies, and idempotency guarantees.
25
25
  - **[STRICTLY FORBIDDEN]** Do NOT use this skill to edit UI screen specifications (use `/update-spec`) or author new APIs (use `/api-spec`).
@@ -10,7 +10,7 @@ Common technical bundles (`common/yaml`, `*.bundle.yaml` under `surfaces/.../com
10
10
 
11
11
  | Need | Use |
12
12
  |------|-----|
13
- | Cross-flow product doc | `common/processes/FLOW-*.md` |
13
+ | Cross-flow product doc | `common/user-flows/FLOW-*.md` |
14
14
  | Shared UX/business rules | `/common` → `common/patterns/*.md` |
15
15
  | UI patterns (delete flow, badges, flat design, …) | FE **base** + `flowgrid-ux-common.mdc` during `/spec` / grill |
16
16
  | New shared component / codegen template | [custom-base](../../../docs/workflows/custom-base.md) → `build-template-code` |
@@ -18,7 +18,7 @@ extractBundle: architecture-core
18
18
 
19
19
  - **[MANDATORY]** Use when a flow crosses a service, system, or boundary: sync RPC, async messaging, event-driven handoffs, retries, idempotency, integration contracts.
20
20
  - **[STRICTLY FORBIDDEN]** Do NOT use for internal code execution paths inside a single service — that belongs in architecture internals.
21
- - **[STRICTLY FORBIDDEN]** Do NOT use for business action flows on a surface → use `/business-process`.
21
+ - **[STRICTLY FORBIDDEN]** Do NOT use for business action flows on a surface → use `/user-flow`.
22
22
  - **[STRICTLY FORBIDDEN]** Do NOT use for runtime journey narratives focusing on user/system step order across the whole product → use `/journey`.
23
23
 
24
24
  ---
@@ -10,7 +10,7 @@ extractBundle: architecture-core
10
10
 
11
11
  # /db-erd — Business Data Model (ERD)
12
12
 
13
- **Phase:** **0 Architecture** — sau `/overview`, `/module`, `/business-process` khi có entity/bảng mới. **Trước** `/spec` leaf.
13
+ **Phase:** **0 Architecture** — sau `/overview`, `/module`, `/user-flow` khi có entity/bảng mới. **Trước** `/spec` leaf.
14
14
 
15
15
  **Hub SSOT:** [architecture-data.md](../../../docs/workflows/architecture-data.md)
16
16
 
@@ -21,6 +21,8 @@ SSOT flow: `docs/workflows/grill-and-human-review.md` · close checklist: `docs/
21
21
 
22
22
  | Gap context | Route to |
23
23
  | --- | --- |
24
+ | Overview / surface / CMP `index.md` PRD sections | `/grill-hub-prd` |
25
+ | Sổ rủi ro quota / hạn mức / peak | `/risk-register` |
24
26
  | UI acceptance, copy, validation, UX affordance | `/grill-bqa` |
25
27
  | `bundle.gen`, codegen profile, `#gen:*`, endpoint `action` on `01` | `/grill-dev` |
26
28
  | BQA ↔ Dev contradiction on same bundle | `/grill-docs` |
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: grill-hub-prd
3
+ description: EXCLUSIVE /grill-hub-prd — PRD sections on overview, surface, CMP index.md. Audit-first like grill-bqa.
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ > [!CRITICAL] MANDATORY PRE-FLIGHT
8
+ > **[MANDATORY]** Re-read this entire `SKILL.md` via file-read tool.
9
+
10
+ # /grill-hub-prd — Hub PRD validation
11
+
12
+ **Targets:** `overview/index.md`, `overview/operational-areas/*.md`, `surfaces/<surface>/index.md`, `surfaces/.../CMP-*/index.md`.
13
+
14
+ **Extracts:** `tpl-overview-prd.md`, `tpl-surface-prd.md`, `tpl-module.md`.
15
+
16
+ ---
17
+
18
+ ## Rule: Audit interlock
19
+
20
+ - **[MANDATORY]** Run `flowgrid audit hub-prd <path-to.md>` before editing.
21
+ - **[MANDATORY]** Fix all `gaps[]`; resolve `warnings[]` via patch or `AskQuestion` (Recommended / Other / Log as Tech Debt → `qa/` per `qa-authoring.md`).
22
+ - **[MANDATORY]** Re-run audit until `totalGaps === 0` or gaps deferred to `qa/*.yaml`.
23
+ - **[STRICTLY FORBIDDEN]** Author Personas tables or Success metrics on hub — KPI/persona ngoài hub.
24
+
25
+ ---
26
+
27
+ ## Rule: Missing information (Law 2)
28
+
29
+ - **≤5 gaps:** `AskQuestion` one at a time, ≥3 options.
30
+ - **≥10 gaps:** STOP — Plan Mode / phased doc offloading.
31
+
32
+ ---
33
+
34
+ ## Verification
35
+
36
+ - [ ] English headings: Goals, Background, Scope (prose = `contentLocale` from `docs-hub.locale.yaml`).
37
+ - [ ] No bracket placeholders `[...]` for sign-off.
38
+ - [ ] `flowgrid audit hub-prd` clean or qa defer documented.
@@ -11,11 +11,14 @@ 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**).
14
+ **Template:** `templates/project-skeleton/surfaces/_module-index.template.md` → `surfaces/<surface>/CMP-*/index.md` (extract: `tpl-module.md`).
15
15
 
16
- **Target Paths:**
17
- - Module folder: `surfaces/[Surface]/[CMP-ID]/`
18
- - Main doc: `surfaces/[Surface]/[CMP-ID]/README.md` or `[CMP-ID].md` (team convention — MD only)
16
+ - **[MANDATORY]** Sections: **Goals**, **Scope**, **Features overview**, **Depends on** — English headings; prose in `contentLocale`.
17
+ - **[MANDATORY]** After edit: `flowgrid audit hub-prd surfaces/.../CMP-*/index.md` or `/grill-hub-prd`.
18
+
19
+ **Target paths:**
20
+ - Module folder: `surfaces/<surface>/CMP-<NN>-<slug>/`
21
+ - Hub doc: `index.md` only (not README) — MD hub for grill/audit
19
22
 
20
23
  ---
21
24
 
@@ -30,7 +33,7 @@ extractBundle: architecture-core
30
33
  ## Rule: Common Scope for `/module … common`
31
34
 
32
35
  - **[MANDATORY]** When called with `common` modifier:
33
- - Default: `surfaces/[Surface]/[CMP-ID]/common/` (`patterns/`, `yaml/`, `processes/`).
36
+ - Default: `surfaces/[Surface]/[CMP-ID]/common/` (`patterns/`, `user-flows/`).
34
37
  - If user names a cluster (e.g. `02`, draft `2-*`) → `…/[CMP-ID]/02/common/` (or deeper if sub-prefix specified).
35
38
  - **[STRICTLY FORBIDDEN]** Do NOT create `surfaces/[Surface]/common` from `/module` — that scope requires `/surfaces`.
36
39
 
@@ -14,15 +14,16 @@ extractBundle: architecture-core
14
14
 
15
15
  ---
16
16
 
17
- ## Rule: arc42 §1 content
17
+ ## Rule: PRD sections (English keys)
18
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.
19
+ - **[MANDATORY]** `overview/index.md` from `templates/project-skeleton/overview/index.md`: **Goals**, **Background**, **Scope** (in/out bullets), operational-areas table, see-also links. Extract: `tpl-overview-prd.md`.
20
+ - **[MANDATORY]** Each `overview/operational-areas/<slug>.md` from `operational-areas/_template.md`: **Scope**, module links, related user flows.
21
+ - **[STRICTLY FORBIDDEN]** Personas tables or Success metrics on hub — defer outside hub or bundle `userStories`.
22
+ - **[MANDATORY]** After edit: `flowgrid audit hub-prd overview/index.md` (or operational/surface path) — zero gaps or `/grill-hub-prd`.
22
23
 
23
- ## Rule: Content Boundary
24
+ ## Rule: Content boundary
24
25
 
25
- - **[MANDATORY]** Overview MUST be a pure business document written in user domain language: personas, operational areas, high-level system purpose.
26
+ - **[MANDATORY]** Overview is business prose in hub `contentLocale`; section titles stay English.
26
27
  - **[STRICTLY FORBIDDEN]** Do NOT include technical details (database schemas, cloud infrastructure configurations, internal routing mechanisms).
27
28
  - **[MANDATORY]** When mentioning 3rd-party systems, use business names only (e.g. "Payment Gateway"), not technical specifications or protocols.
28
29
 
@@ -0,0 +1,29 @@
1
+ ---
2
+ name: risk-register
3
+ description: /risk-register — Maintain architecture/11-risks/risk-register.md (quota, limits vs peak need).
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ # /risk-register — Sổ rủi ro tổng hợp
8
+
9
+ **SSOT:** `architecture/11-risks/risk-register.md`
10
+ **Template:** `harness/docs/extracts/tpl-risk-register.md`
11
+
12
+ **Khi dùng:** Rủi ro **không gắn một màn** — hạn mức email/SMS/API, license, SLA vendor, capacity cao điểm.
13
+
14
+ ---
15
+
16
+ ## Rule: Audit interlock
17
+
18
+ - **[MANDATORY]** `flowgrid audit risks architecture/11-risks/risk-register.md` trước/sau sửa.
19
+ - **[MANDATORY]** Mỗi dòng: so sánh **Hạn mức** vs **Nhu cầu** → **Chênh lệch** → **Ảnh hưởng** → **Phương án**.
20
+ - **[STRICTLY FORBIDDEN]** Ghi `risks:` trên `*.bundle.yaml` — SSOT chỉ file này.
21
+
22
+ ## Rule: AskQuestion (Law 2)
23
+
24
+ Thiếu số (quota, peak): wizard ≥3 options (Recommended / Other / Tech debt → `qa/`).
25
+
26
+ ## Verification
27
+
28
+ - [ ] Ít nhất một rủi ro thật (không chỉ RISK-EXAMPLE).
29
+ - [ ] Audit `risks` trên register: gaps = 0 hoặc defer qa.
@@ -62,7 +62,7 @@ Hub: [spec-ssot-prep.md](../../../docs/workflows/spec-ssot-prep.md) · extract `
62
62
  - `<pageType>` = page type đã xác định ở bước trên (list | create | detail | admin-crud | auth | ...).
63
63
  - Script output:
64
64
  - `gaps[]` → required fields missing → Agent patches bundle directly.
65
- - `warnings[]` → **quality hints only** (missing `successMetrics`/`nonGoals`, summary placeholders) — fix when info exists; **does not** block split.
65
+ - `warnings[]` → **quality hints** (`scopeIn`, `nonGoals`, `nfr`, `userFlows`, placeholders) — fix when info exists; **does not** block split. Rủi ro → `/risk-register` only (`WARN_BUNDLE_RISKS_FORBIDDEN` if `risks:` on bundle).
66
66
  - `confirms[]` → AskQuestion wizard (one question at a time, ≥3 options):
67
67
  - UX: `category: ux`, `UX_*`, `CONFIRM_UX_*` — `flowgrid-ux-common.mdc`
68
68
  - **DB:** `category: db`, `CONFIRM_DB_*` — `.cursor/extracts/db-audit-wizard.md` (entities, multi-table, `db` vs `01`, `#derived-data`)
@@ -152,7 +152,7 @@ Each zone turn — **in order**:
152
152
 
153
153
  ### Rule: Summary extensions (PRD lite)
154
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/`.
155
+ - **[RECOMMENDED]** Fill `scopeIn`, `nonGoals`, `userFlows`, `nfr` when PO/BA có thông tin. Rủi ro dự án → **`/risk-register`** (`architecture/11-risks/risk-register.md`), never `risks:` on bundle.
156
156
  - **[MANDATORY]** Replace template `[placeholder]` brackets in `summary` / metrics / non-goals before handoff grill.
157
157
 
158
158
  ### Rule: User Stories (`userStories`)
@@ -268,6 +268,6 @@ Each zone turn — **in order**:
268
268
  - [ ] UX gap questions used checklist-backed `(Recommended)` options (`flowgrid-ux-common.mdc`), not open brainstorming.
269
269
  - [ ] `userStories` scenarios/AC reflect UX affordances patched in `design` (incl. audit `suggestedStoryPatch`).
270
270
  - [ ] YAML strings with `:` or `[]` are double-quoted. No `.md` written by hand.
271
- - [ ] `successMetrics` / `nonGoals` filled or consciously omitted (not left as template brackets).
271
+ - [ ] PRD fields (`scopeIn`, `nonGoals`, `userFlows`, `nfr`) filled or deferred via `qa/` (no template brackets). Rủi ro không trên bundle.
272
272
  - [ ] `pnpm docs:split` + `pnpm docs:render` run with zero errors; `ir/generated/spec.md` has TOC + overview sections.
273
273
  - [ ] Handoff → `/testcase` created.
@@ -31,7 +31,9 @@ extractBundle: architecture-core
31
31
 
32
32
  ## Rule: Overview Alignment
33
33
 
34
- - **[MANDATORY]** When authoring a surface overview, describe: target actors, their actions, interaction channels, and assigned business responsibilities. Keep descriptions in business terms rather than technical architecture.
34
+ - **[MANDATORY]** When creating or updating a surface hub, copy `templates/project-skeleton/surfaces/_surface-index.template.md` → `surfaces/<surface>/index.md` (**Goals**, **Background**, **Scope**, CMP table, user-flow links, features overview). Extract: `tpl-surface-prd.md`.
35
+ - **[MANDATORY]** Before handoff: `flowgrid audit hub-prd surfaces/<surface>/index.md` — zero gaps or `/grill-hub-prd`.
36
+ - **[MANDATORY]** Describe actors, channels, and business responsibilities in plain language (no infra detail).
35
37
  - **[MANDATORY]** Surface technical boundary: UI layout, component states, props, single-API data schemas specific to that screen.
36
38
  - **[STRICTLY FORBIDDEN]** Do NOT include system-level architecture details (backend server configuration, load balancers, database schemas) in surface documentation.
37
39
 
@@ -1,6 +1,6 @@
1
1
  ---
2
- name: business-process
3
- description: /business-process (or /flow) — Models business action flows (actor + surface + action + outcome) as FLOW-*.
2
+ name: user-flow
3
+ description: /user-flow — Luồng người dùng (FLOW-*) trên surfaces.
4
4
  disable-model-invocation: true
5
5
  extractBundle: architecture-core
6
6
  ---
@@ -8,11 +8,11 @@ extractBundle: architecture-core
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
 
11
- # /business-process (Alias: /flow)
11
+ # /user-flow
12
12
 
13
13
  **Mindset:** Model the process by **business actions on surfaces**, not by repository or service topology.
14
14
 
15
- **Template:** `architecture/03-business-process/FLOW-template.md` (or surfaces `common/processes/FLOW-*.md`) — include **Success metrics** and **Non-goals** in §1 when information exists.
15
+ **Template:** `architecture/03-user-flows/FLOW-template.md` (or `**/common/user-flows/FLOW-*.md`) — **Non-goals** in §1 when information exists (KPI ngoài hub).
16
16
 
17
17
  ---
18
18
 
@@ -36,8 +36,8 @@ extractBundle: architecture-core
36
36
  ## Rule: Target Path Resolution
37
37
 
38
38
  - **[MANDATORY]** Resolve placement path via `.cursor/extracts/common-scope.md` §4.
39
- - Surface-level: `surfaces/**/common/processes/FLOW-*.md`
40
- - Architecture-level: `architecture/03-business-process/`
39
+ - Surface-level: `surfaces/**/common/user-flows/FLOW-*.md`
40
+ - Architecture-level: `architecture/03-user-flows/`
41
41
  - **[STRICTLY FORBIDDEN]** Do NOT use an unstandardized path like `[Target Path]/Common/Business processes`.
42
42
 
43
43
  ---
@@ -59,7 +59,7 @@ extractBundle: architecture-core
59
59
 
60
60
  ### When co-activated with `/architecture`:
61
61
  - **[MANDATORY]** Focus on technical `sequenceDiagram` for entire long-running flow: backend services, DB interactions, cronjobs, external APIs, 3rd-party handshakes.
62
- - Placement: `architecture/03-business-process/`.
62
+ - Placement: `architecture/03-user-flows/`.
63
63
 
64
64
  ---
65
65
 
@@ -93,7 +93,7 @@ extractBundle: architecture-core
93
93
 
94
94
  - **[MANDATORY]** If `adoption-inventory.md` does NOT exist at workspace root → STOP: *"Run `/docs-hub /adopt` first."*
95
95
  - **[MANDATORY]** If file exists: look up `FLOW-*` candidates and map legacy module/screens. Write with `legacy-` prefix (e.g. `legacy-FLOW-checkout.md`).
96
- - **[MANDATORY - CROSS-FLOW LEGACY AUDIT]**: When analyzing legacy business processes (`/legacy /business-process`), Agent **MUST PROACTIVELY AUDIT END-TO-END FLOW GAPS**:
96
+ - **[MANDATORY - CROSS-FLOW LEGACY AUDIT]**: When analyzing legacy user flows (`/legacy /user-flow`), Agent **MUST PROACTIVELY AUDIT END-TO-END FLOW GAPS**:
97
97
  - Compare Data Output at Step $N$ (e.g., Screen 1 / API 1) with Input expectations at Step $N+1$ (e.g., Screen 2 / API 2) to identify schema or status misalignments.
98
98
  - Flag orphan steps/APIs (not attached to any valid flow step) or processes lacking Confirmation / Rollback / Idempotency handling on failure.
99
99
  - Tag issues with `[LEGACY_FLOW_GAP]` and generate Open Questions for member resolution.
@@ -13,7 +13,7 @@ disable-model-invocation: true
13
13
  | `common/yaml` + `flowgrid gen-common` | FE base components + `design.registry.json` |
14
14
  | New Mo* / adapter templates | [custom-base workflow](../../../docs/workflows/custom-base.md) → `build-template-code` |
15
15
  | Cross-scope business rules | `/common` → `common/patterns/*.md` |
16
- | Cross-flow | `common/processes/FLOW-*.md` |
16
+ | Cross-flow | `common/user-flows/FLOW-*.md` |
17
17
 
18
18
  **If a member invokes `/gen-common`:** STOP — explain deprecation; continue with `/prototype` (`gen:dry` → `gen`) when `grillStatus.dev: done`.
19
19
 
@@ -4,7 +4,7 @@ Hub SSOT: `docs/workflows/test.md#grill-scenario-flow`.
4
4
 
5
5
  ## Scope
6
6
 
7
- - Docs **`FLOW-*.md`** exists (Phase 0 / business-process) — **no SC without FLOW**
7
+ - Docs **`FLOW-*.md`** exists (Phase 0 / user-flow) — **no SC without FLOW**
8
8
  - Tests: `scenarios/<mirror>/FLOW-<name>/SC-*.yaml` with `screens: [W-*, W-*, …]`
9
9
  - **Per screen touched:** at least one `cases/…/TC-*.yaml` OR documented defer (`coverage_deferred` + `QA-*` on docs)
10
10
 
@@ -36,4 +36,4 @@ Hub SSOT: `docs/workflows/test.md#grill-scenario-flow`.
36
36
  - [ ] Each screen's TC passed `cases:gate --strict` traceability
37
37
  - [ ] SC `screens[]` matches docs FLOW touchpoints (spot vs `FLOW-*.md`)
38
38
 
39
- Handoff thin FLOW → `/docs-hub /business-process` or `/update-spec` — not tests hub.
39
+ Handoff thin FLOW → `/docs-hub /user-flow` or `/update-spec` — not tests hub.
@@ -26,7 +26,7 @@ query a workspace-parent graph.
26
26
  - **[MANDATORY]** Read the entire function **`*.bundle.yaml`** (sibling of `ir/`). Cross-reference plans against bundle `userStories`, `acceptanceCriteria`, `spec.ui`, and `design.*` — not split IR files.
27
27
  - If scenarios/acceptance are thin or missing → hand off docs-hub `/update-spec` or `/spec` (paste-ready prompt). Do not patch bundle from tests hub.
28
28
  - **[STRICTLY FORBIDDEN]** Do NOT read generated `*.md`.
29
- - If auditing **SC-***, the YAML/MD path MUST mirror the docs `FLOW-*.md` (cluster/module/surface `common/processes/` or `architecture/03-business-process/`). Flag `scenarios/auth/…` or `common/` leftovers.
29
+ - If auditing **SC-***, the YAML/MD path MUST mirror the docs `FLOW-*.md` (cluster/module/surface `common/user-flows/` or `architecture/03-user-flows/`). Flag `scenarios/auth/…` or `common/` leftovers.
30
30
 
31
31
  ## Audit Rules
32
32
 
@@ -13,7 +13,7 @@ disable-model-invocation: true
13
13
 
14
14
  Author cross-flow scenarios (SC) on the current tests hub. Design rules stay on the docs hub.
15
15
 
16
- Scenarios test a **business process** (`FLOW-*`) that spans multiple screens (`W-*`) or modules. They mirror the docs FLOW file **after** bộ docs LCA `common/` placement (not a flat `common/` tree).
16
+ Scenarios test a **user flow** (`FLOW-*`) that spans multiple screens (`W-*`) or modules. They mirror the docs FLOW file **after** bộ docs LCA `common/` placement (not a flat `common/` tree).
17
17
 
18
18
  ## Output Rules
19
19
 
@@ -30,12 +30,12 @@ Scenarios test a **business process** (`FLOW-*`) that spans multiple screens (`W
30
30
 
31
31
  - **[MANDATORY]** Agent MUST locate the **`FLOW-*.md`** file on the docs hub (`FLOWGRID_DOCS_ROOT`) via `flowgrid_docs_route` / `flowgrid_docs_get_element` / glob. Filenames are `FLOW-…md`, not `flow-*`.
32
32
  - Search in this order (same LCA as bộ docs `common-scope.md`):
33
- 1. `surfaces/<surface>/<CMP-id>/<NN>/common/processes/FLOW-*.md` (cluster)
34
- 2. `surfaces/<surface>/<CMP-id>/common/processes/FLOW-*.md` (module)
35
- 3. `surfaces/<surface>/common/processes/FLOW-*.md` (surface)
36
- 4. `surfaces/common/processes/FLOW-*.md` (cross-surface product common)
37
- 5. `architecture/03-business-process/FLOW-*.md` (org catalog only)
38
- - **Strict:** Only author a scenario if that `FLOW-*.md` exists. Missing FLOW or thin business rules → hand off to docs-hub `/business-process` or `/update-spec`, do not invent SC. **[MANDATORY]** When handing off, you MUST output a comprehensive gap report (formatted as a complete, ready-to-use prompt starting with `/docs-hub`) detailing exactly what flows or business rules are missing, so the user can copy-paste it directly to run the docs-hub skill.
33
+ 1. `surfaces/<surface>/<CMP-id>/<NN>/common/user-flows/FLOW-*.md` (cluster)
34
+ 2. `surfaces/<surface>/<CMP-id>/common/user-flows/FLOW-*.md` (module)
35
+ 3. `surfaces/<surface>/common/user-flows/FLOW-*.md` (surface)
36
+ 4. `surfaces/common/user-flows/FLOW-*.md` (cross-surface product common)
37
+ 5. `architecture/03-user-flows/FLOW-*.md` (org catalog only)
38
+ - **Strict:** Only author a scenario if that `FLOW-*.md` exists. Missing FLOW or thin business rules → hand off to docs-hub `/user-flow` or `/update-spec`, do not invent SC. **[MANDATORY]** When handing off, you MUST output a comprehensive gap report (formatted as a complete, ready-to-use prompt starting with `/docs-hub`) detailing exactly what flows or business rules are missing, so the user can copy-paste it directly to run the docs-hub skill.
39
39
  - **[STRICTLY FORBIDDEN]** Do not treat `common/yaml/` or `common/patterns/` as scenario sources.
40
40
 
41
41
  ## Directory Mirroring Rule (Docs SSOT)
@@ -44,13 +44,13 @@ Mirror the FLOW file path onto the tests hub. Strip **only** these prefixes:
44
44
 
45
45
  | Docs FLOW path | Tests hub |
46
46
  |----------------|-----------|
47
- | `surfaces/<rest>/common/processes/FLOW-checkout.md` | `scenarios/<rest>/common/processes/FLOW-checkout/SC-*.yaml` |
48
- | `architecture/03-business-process/FLOW-checkout.md` | `scenarios/architecture/03-business-process/FLOW-checkout/SC-*.yaml` |
47
+ | `surfaces/<rest>/common/user-flows/FLOW-checkout.md` | `scenarios/<rest>/common/user-flows/FLOW-checkout/SC-*.yaml` |
48
+ | `architecture/03-user-flows/FLOW-checkout.md` | `scenarios/architecture/03-user-flows/FLOW-checkout/SC-*.yaml` |
49
49
 
50
50
  Examples:
51
51
 
52
- - Docs `surfaces/admin/CMP-ADM-002/02/common/processes/FLOW-checkout.md` → `scenarios/admin/CMP-ADM-002/02/common/processes/FLOW-checkout/SC-*.yaml`
53
- - Docs `surfaces/admin/CMP-ADM-002/common/processes/FLOW-onboard.md` → `scenarios/admin/CMP-ADM-002/common/processes/FLOW-onboard/SC-*.yaml`
52
+ - Docs `surfaces/admin/CMP-ADM-002/02/common/user-flows/FLOW-checkout.md` → `scenarios/admin/CMP-ADM-002/02/common/user-flows/FLOW-checkout/SC-*.yaml`
53
+ - Docs `surfaces/admin/CMP-ADM-002/common/user-flows/FLOW-onboard.md` → `scenarios/admin/CMP-ADM-002/common/user-flows/FLOW-onboard/SC-*.yaml`
54
54
 
55
55
  Do **not** flatten to `scenarios/auth/…`. Do **not** use `common/` (legacy). Keep numeric cluster folders (`02/`) in the tests path.
56
56
 
@@ -51,7 +51,7 @@ disable-model-invocation: true
51
51
  - **[MANDATORY]** Mirror function folder: `cases/<relative-path>/TC-*.yaml`.
52
52
  - ✅ `surfaces/admin/CMP-ADM-002/02/01/login/` → `cases/admin/CMP-ADM-002/02/01/login/TC-*.yaml`
53
53
  - ❌ `cases/admin/auth/W-…` — invented path not matching docs structure.
54
- - Cross-flow plans → `/scenario` (mirror `common/processes/FLOW-*` or `architecture/03-business-process/FLOW-*`).
54
+ - Cross-flow plans → `/scenario` (mirror `common/user-flows/FLOW-*` or `architecture/03-user-flows/FLOW-*`).
55
55
 
56
56
  ---
57
57
 
@@ -20,28 +20,28 @@ coverage_plan:
20
20
  Scenario thuộc **CMP-01-auth** · Tính năng năng lực **CAP-AUTH-001**.
21
21
  Quy tắc chi tiết và schema cơ sở dữ liệu tham chiếu tại **Docs Hub** (cite ID: `spec.yaml`).
22
22
 
23
- | Thuộc tính | Giá trị |
24
- |---|---|
23
+ | Attribute | Value |
24
+ | --- | --- |
25
25
  | **Scenario ID** | `SC-EXAMPLE` |
26
26
  | **Module** | `CMP-01-auth` |
27
- | **Bề mặt (Surface)** | `admin` |
28
- | **Màn hình (Screen)** | `W-AD-AUTH-001` (`/admin/records/create`) |
29
- | **Mức độ ưu tiên** | `High` |
27
+ | **Surface** | `admin` |
28
+ | **Screen** | `W-AD-AUTH-001` (`/admin/records/create`) |
29
+ | **Priority** | `High` |
30
30
 
31
- ## 1. Bối Cảnh Nghiệp Vụ & Phân Tích Rủi Ro (Business Context & Risk Analysis)
31
+ ## 1. Business context & risk analysis
32
32
 
33
33
  Màn hình khởi tạo hồ sơ là cửa ngõ dữ liệu tài chính của khách hàng. Nếu bỏ sót kiểm tra trùng mã hoặc không xử lý chặn click đúp (double-submit), hệ thống sẽ tạo các bản ghi rác gây xung đột số liệu doanh thu và vi phạm tính toàn vẹn dữ liệu kế toán.
34
34
 
35
- ## 2. Hành Vi Chuẩn BDD (Behavior: Given / When / Then)
35
+ ## 2. BDD behavior (Given / When / Then)
36
36
 
37
37
  - **Given (Tiền điều kiện):** Người dùng đăng nhập thành công với vai trò Quản trị viên (`ADMIN`), tài khoản có quyền `records.create`, và chưa tồn tại bản ghi nào có mã `REC-2026-001` trong cơ sở dữ liệu.
38
38
  - **When (Thao tác):** Người dùng nhập đầy đủ các trường thông tin hợp lệ (mã hồ sơ, tên hồ sơ, chọn gói dịch vụ) và nhấn nút "Lưu & Xác Nhận".
39
39
  - **Then (Hậu điều kiện):** Hệ thống khóa nút để tránh gửi trùng lặp, gửi request kèm header `X-Idempotency-Key`, tạo mới bản ghi thành công trong bảng `records`, hiển thị Toast thông báo màu xanh và điều hướng sang màn hình chi tiết `W-ADM-DETAIL-01`.
40
40
 
41
- ## 3. Ma Trận Test Phân Hoạch Tương Đương & Phân Tích Giá Trị Biên (Equivalence Partitioning & Boundary Test Matrix - IEEE 29119)
41
+ ## 3. Equivalence & boundary test matrix
42
42
 
43
- | Mã Case (Case ID) | Khía Cạnh Kiểm Thử (Facet) | Dữ Liệu Đầu Vào (Input Data) | Kết Quả Mong Đợi (Expected Outcome) | HTTP Status & UI State | Tự Động Hóa (Automation Case) |
44
- |---|---|---|---|---|---|
43
+ | Case ID | Facet | Input | Expected outcome | HTTP & UI | Automation case |
44
+ | --- | --- | --- | --- | --- | --- |
45
45
  | **TC-VAL-01** | `positive_boundary` (Biên tối thiểu) | `code: "REC01"` (5 chars), `name: "Hồ sơ A"` | Form hợp lệ, gửi dữ liệu thành công | `HTTP 200` · Toast Success xanh | `TC-EXAMPLE-VALID` |
46
46
  | **TC-VAL-02** | `positive_boundary` (Biên tối đa) | `code: "REC-2026-MAXIMUM-001"` (20 chars) | Form hợp lệ, gửi dữ liệu thành công | `HTTP 200` · Toast Success xanh | `TC-EXAMPLE-VALID` |
47
47
  | **TC-VAL-03** | `negative_length` (Dưới độ dài min) | `code: "REC"` (3 chars) | Chặn submit, báo lỗi inline dưới ô nhập | `Client Error` · "Độ dài từ 5 đến 20 ký tự" | `TC-EXAMPLE-INVALID` |
@@ -50,10 +50,10 @@ Màn hình khởi tạo hồ sơ là cửa ngõ dữ liệu tài chính của kh
50
50
  | **TC-ACT-06** | `concurrency_double_submit` | Click nút "Lưu" liên tục 2 lần trong 100ms | Nút khóa disabled tức thì, chỉ 1 request gửi đi | `UI Locked` · Không tạo 2 bản ghi trùng | `TC-EXAMPLE-CONCURRENCY` |
51
51
  | **TC-SYS-07** | `network_interruption` (Mất mạng) | Ngắt kết nối mạng ngay khi gửi request | Hiện banner cảnh báo mất kết nối, giữ nguyên dữ liệu form | `Network Banner` · Form state preserved | `TC-EXAMPLE-OFFLINE` |
52
52
 
53
- ## 4. Bao Phủ Rủi Ro & Khía Cạnh Chất Lượng (Quality Dimensions Coverage)
53
+ ## 4. Quality dimensions coverage
54
54
 
55
- | Khía Cạnh (Dimension) | Mức Độ Bao Phủ | Ghi Chú Đảm Bảo Chất Lượng |
56
- |---|---|---|
55
+ | Dimension | Coverage | Notes |
56
+ | --- | --- | --- |
57
57
  | **Happy Path & Workflow** | 100% | Toàn bộ luồng khởi tạo đến xem chi tiết hoàn tất |
58
58
  | **Boundary Value Analysis** | 100% | Kiểm thử đầy đủ tại ngưỡng min-1, min, max, max+1 |
59
59
  | **Data Integrity & Concurrency** | 100% | Kiểm tra unique mã hồ sơ qua async DB & chặn double-click |
@@ -75,10 +75,10 @@ stateDiagram-v2
75
75
  ChuyenTrangChiTiet --> [*]
76
76
  ```
77
77
 
78
- ## 5. Danh Sách Test Cases Chi Tiết (Test Cases Mapping)
78
+ ## 5. Test case mapping
79
79
 
80
- | Mã Case (ID) | Khía Cạnh | Mức Độ Ưu Tiên | Thư Mục Test Hub |
81
- |---|---|---|---|
80
+ | Case ID | Facets | Priority | Tests hub path |
81
+ | --- | --- | --- | --- |
82
82
  | `TC-EXAMPLE-VALID` | happy, boundary | Critical | `cases/admin/CMP-01-auth/01/create/` |
83
83
  | `TC-EXAMPLE-INVALID` | validation, boundary | High | `cases/admin/CMP-01-auth/01/create/` |
84
84
  | `TC-EXAMPLE-DUPLICATE` | concurrency, remote_unique | High | `cases/admin/CMP-01-auth/01/create/` |
@@ -127,7 +127,7 @@ PII / Sensitive / Masked
127
127
  K. Business architecture — process hierarchy & synonyms
128
128
  ================================================================================
129
129
  Business Capability
130
- Business Process
130
+ User flow
131
131
  End-to-End Flow / E2E Flow
132
132
  Use Case
133
133
  Scenario
@@ -138,7 +138,7 @@ Cross-Service Flow / Service Orchestration / Service Choreography
138
138
  Saga Flow / Distributed Transaction
139
139
  Domain Workflow / Event Flow / Command Flow
140
140
  #process: business-capability
141
- #process: business-process
141
+ #process: user-flow
142
142
  #process: e2e-flow
143
143
  #process: use-case
144
144
  #process: scenario
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shanyucoder/flowgrid",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "Unified Local MCP Toolkit (Graph, DNA, Docs, Test, Codegen)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -0,0 +1,3 @@
1
+ # Deprecated path
2
+
3
+ Use [`../03-user-flows/`](../03-user-flows/) for new hubs. Files here are legacy copies only.