@shanyucoder/flowgrid 0.1.10 → 0.1.12
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.
- package/adapters/nextjs/codegen/runners/lib/resolve-hub-id.mjs +7 -4
- package/adapters/nextjs/unitgen/runners/README.md +4 -4
- package/adapters/nextjs/unitgen/runners/generate.mjs +1 -1
- package/adapters/nuxt4/codegen/runners/lib/resolve-hub-id.mjs +7 -4
- package/adapters/nuxt4/unitgen/runners/README.md +4 -4
- package/adapters/nuxt4/unitgen/runners/generate.mjs +1 -1
- package/adapters/shared/common-gen.mjs +1 -1
- package/adapters/shared/resolve-hub-id.mjs +12 -5
- package/dist/docs/mcp/tools.js +59 -6
- package/dist/docs/mcp/tools.js.map +1 -1
- package/dist/docs/scan/ids.js +3 -2
- package/dist/docs/scan/ids.js.map +1 -1
- package/dist/docs/scan/screen-to-flows.d.ts +3 -0
- package/dist/docs/scan/screen-to-flows.js +18 -0
- package/dist/docs/scan/screen-to-flows.js.map +1 -0
- package/dist/graph/mcp/tools.js +1 -1
- package/dist/graph/mcp/tools.js.map +1 -1
- package/engines/cases/render-cases.mjs +1 -1
- package/engines/docs/lib/render-bundle-markdown.mjs +19 -0
- package/engines/docs/lib/render-design-markdown.mjs +56 -0
- package/engines/docs/lib/screen-to-flows-index.mjs +121 -0
- package/engines/docs/vitepress/surfaces-nav.mjs +7 -0
- package/engines/spec/lib/audit-bundle-gaps.mjs +15 -3
- package/engines/spec/lib/audit-interaction-cases.mjs +185 -0
- package/engines/spec/lib/audit-legacy-gaps.mjs +10 -0
- package/engines/spec/lib/bundle-ir.mjs +7 -0
- package/engines/spec/lib/bundle-schema.mjs +1 -0
- package/engines/spec/lib/interaction-cases.mjs +46 -0
- package/engines/spec/split-bundle.mjs +1 -1
- package/engines/testcase/_staging-from-portal/runners/README.md +3 -3
- package/engines/testcase/_staging-from-portal/runners/generate.mjs +2 -2
- package/engines/testcase/_staging-from-portal/runners/lib/read-testcase.mjs +1 -1
- package/engines/testcase/runners/README.md +3 -3
- package/engines/testcase/runners/generate.mjs +2 -2
- package/engines/testcase/runners/lib/read-testcase.mjs +1 -1
- package/engines/testcase/runners/lib/resolve-hub-id.mjs +3 -3
- package/harness/be/skills/audit-api/SKILL.md +1 -1
- package/harness/be/skills/grill-api-unit/SKILL.md +1 -1
- package/harness/docs/extracts/agent-design-context.md +124 -0
- package/harness/docs/extracts/architecture-core.md +2 -0
- package/harness/docs/extracts/extract-registry.docs.json +11 -4
- package/harness/docs/extracts/product-id-convention.md +58 -0
- package/harness/docs/extracts/spec-requirement.md +1 -1
- package/harness/docs/extracts/tpl-adoption-inventory.md +32 -0
- package/harness/docs/extracts/tpl-module.md +1 -1
- package/harness/docs/rules/agent-compliance.mdc +1 -1
- package/harness/docs/skills/adopt/SKILL.md +42 -10
- package/harness/docs/skills/api-spec/SKILL.md +4 -0
- package/harness/docs/skills/api-update/SKILL.md +1 -1
- package/harness/docs/skills/grill-dev/SKILL.md +22 -9
- package/harness/docs/skills/module/SKILL.md +1 -1
- package/harness/docs/skills/spec/SKILL.md +10 -6
- package/harness/docs/skills/surfaces/SKILL.md +1 -0
- package/harness/docs/skills/user-flow/SKILL.md +4 -2
- package/harness/fe/skills/grill-prototype/SKILL.md +1 -1
- package/harness/fe/skills/prototype/SKILL.md +28 -16
- package/harness/fe/skills/unit/SKILL.md +4 -4
- package/harness/shared/SSOT_AGENT_PROTOCOL.md +1 -1
- package/harness/tests/skills/grill-testcase/SKILL.md +1 -1
- package/harness/tests/skills/scenario/SKILL.md +2 -2
- package/harness/tests/skills/testcase/SKILL.md +1 -1
- package/harness/tests/templates/SC.example.md +11 -11
- package/harness/tests/templates/TC.example.yaml +3 -3
- package/package.json +1 -1
- package/templates/project-skeleton/architecture/03-user-flows/FLOW-login.md +10 -10
- package/templates/project-skeleton/architecture/04-solution-strategy/index.md +1 -1
- package/templates/project-skeleton/architecture/08-cross-cutting/security.md +1 -1
- package/templates/project-skeleton/architecture/12-glossary/index.md +3 -2
- package/templates/project-skeleton/architecture/model/workspace.dsl +7 -7
- package/templates/project-skeleton/surfaces/_module-index.template.md +2 -2
- package/templates/project-skeleton/surfaces/_surface-index.template.md +1 -0
- package/templates/shared/bundle-authoring.md +3 -2
- package/templates/shared/default-layout.ejs +47 -2
- package/templates/shared/feature.bundle.yaml +29 -1
- package/templates/shared/tpl-runtime-sequence.md +56 -0
- package/templates/tests-skeleton/cases/README.md +1 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: prototype
|
|
3
|
-
description: /prototype — UI from FLOWGRID_DOCS_ROOT ir/design.yaml with mock API via
|
|
3
|
+
description: /prototype — UI from FLOWGRID_DOCS_ROOT ir/design.yaml with mock API via the FE code repo.
|
|
4
4
|
disable-model-invocation: true
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# /prototype — UI Prototype (Mock API Boundary)
|
|
8
8
|
|
|
9
|
-
**Owner:**
|
|
9
|
+
**Owner:** FE code repo (`--type=fe`) · Adapters: `nuxt4` | `nextjs` | `dotnet-line`
|
|
10
10
|
|
|
11
11
|
## Artifact & Target ID Resolution Rule
|
|
12
12
|
|
|
13
|
-
- User prompt MAY specify a screen ID, function ID, or slug (e.g. `W-
|
|
13
|
+
- User prompt MAY specify a screen ID, function ID, or slug (e.g. `W-ADM-AUTH-01`, `login`).
|
|
14
14
|
- Agent MUST use `--id` or resolve `surfaces/<surface>/CMP-*/<NN…>/ir/design.yaml` via `FLOWGRID_DOCS_ROOT` or `flowgrid_docs_route` (same leaf as the bundle; API trio is sibling `api/<seq>/`, not this file).
|
|
15
15
|
- Shared UI (list shell, chips, delete flow, …) is **already in the FE base** — do not run `/gen-common` (deprecated).
|
|
16
16
|
- `surfaces/…/common/` on the docs hub is **Markdown only** (`processes/FLOW-*.md`, `patterns/`) — read for context; never codegen from `common/yaml`.
|
|
@@ -18,11 +18,22 @@ disable-model-invocation: true
|
|
|
18
18
|
|
|
19
19
|
```text
|
|
20
20
|
surfaces/<surface>/CMP-*/<NN…>/ir/design.yaml
|
|
21
|
-
# e.g. …/CMP-ADM-
|
|
21
|
+
# e.g. …/CMP-ADM-DEMO-01/01/01/01/ir/design.yaml
|
|
22
22
|
```
|
|
23
23
|
|
|
24
24
|
Read the **entire** `ir/design.yaml` (script + agent inspection). Do not filter keys from `*.bundle.yaml`. **`ir/spec.yaml`** is business prose only.
|
|
25
25
|
|
|
26
|
+
## Agent context (ACP) before gen
|
|
27
|
+
|
|
28
|
+
Per **`agent-design-context.md`** (resolve `W-*` via `flowgrid_docs_route` → `linkedFlows[]`):
|
|
29
|
+
|
|
30
|
+
1. **`userFlows` / linked `FLOW-*.md`** — §6 sequence for journey context.
|
|
31
|
+
2. **`bundle.nfr`** (from bundle or `ir/spec.yaml` mirror).
|
|
32
|
+
3. **`ir/generated/design.md`** when `interactionCases.policy: required`.
|
|
33
|
+
4. Then **`ir/design.yaml`**.
|
|
34
|
+
|
|
35
|
+
Print checklist in chat: FLOW ids read · NFR · L2 design.md yes/no.
|
|
36
|
+
|
|
26
37
|
**Docs hub is read-only for this skill.** Never Write/patch `*.bundle.yaml`, `ir/*`, or any file under `FLOWGRID_DOCS_ROOT`. Missing `ir/design.yaml`, empty `codegen.profile`, or `flowgrid gen` failure → **STOP**, quote the CLI error, hand off to docs-hub `/grill-dev` (or `/spec`). Do not invent SSOT to make gen pass. Login/forgot/reset must be `codegen.profile: auth` (not `create`) or gen writes `(dashboard)`.
|
|
27
38
|
|
|
28
39
|
Do not invent sibling docs-hub paths. Pass `FLOWGRID_DOCS_ROOT` or `--docs-root`.
|
|
@@ -38,7 +49,7 @@ Do not invent sibling docs-hub paths. Pass `FLOWGRID_DOCS_ROOT` or `--docs-root`
|
|
|
38
49
|
|
|
39
50
|
## Route
|
|
40
51
|
|
|
41
|
-
Architecture/C4 →
|
|
52
|
+
Architecture/C4 → docs hub (`FLOWGRID_DOCS_ROOT`); IR/registry/gen →
|
|
42
53
|
`FLOWGRID_DOCS_ROOT`; symbols/call-graph for repo X → Platform DNA-wired
|
|
43
54
|
`codegraph-<repo-key>`. Never workspace-parent graphs, sibling-path inference,
|
|
44
55
|
or member-edited MCP. Local ArtifactGraph is allowlist/tag hints for this repo
|
|
@@ -47,12 +58,12 @@ only.
|
|
|
47
58
|
## Workflow
|
|
48
59
|
|
|
49
60
|
```bash
|
|
50
|
-
npm run codegen:dry -- --id W-
|
|
51
|
-
npm run codegen -- --id W-
|
|
61
|
+
npm run codegen:dry -- --id W-ADM-AUTH-01
|
|
62
|
+
npm run codegen -- --id W-ADM-AUTH-01
|
|
52
63
|
|
|
53
64
|
# Fallback direct CLI if wrappers missing:
|
|
54
|
-
flowgrid gen:dry --adapter=nuxt4 --docs-root=/path/to/docs-hub -- --id W-
|
|
55
|
-
flowgrid gen --adapter=nuxt4 --docs-root=/path/to/docs-hub -- --id W-
|
|
65
|
+
flowgrid gen:dry --adapter=nuxt4 --docs-root=/path/to/docs-hub -- --id W-ADM-AUTH-01
|
|
66
|
+
flowgrid gen --adapter=nuxt4 --docs-root=/path/to/docs-hub -- --id W-ADM-AUTH-01
|
|
56
67
|
|
|
57
68
|
flowgrid gen:dry --adapter=nextjs -- --spec ir/design.yaml
|
|
58
69
|
flowgrid gen --adapter=nextjs -- --spec ir/design.yaml
|
|
@@ -75,7 +86,7 @@ For each HANDOFF / `#needs-component: Mo…` after gen:
|
|
|
75
86
|
4. Re-run `flowgrid gen` so slots bind to the new file.
|
|
76
87
|
5. Dotnet-line / no `components.json`: skip this section; do not invent React/shadcn APIs.
|
|
77
88
|
|
|
78
|
-
Do not copy the shadcn skill into
|
|
89
|
+
Do not copy the shadcn skill into the docs hub. Do not author `#ui:` tags from memory if `shadcn search` can name the registry item.
|
|
79
90
|
|
|
80
91
|
`dotnet-line` requires the .NET 8 SDK (`FLOWGRID_DOTNET`, then `dotnet`) and
|
|
81
92
|
is limited to the pilot-specific `kiosk-check-in` profile. Its main pass also
|
|
@@ -88,14 +99,15 @@ if local ArtifactGraph available: recommend/check the FE repo's allowlisted gen
|
|
|
88
99
|
else: run flowgrid gen:dry / gen directly
|
|
89
100
|
|
|
90
101
|
Missing ArtifactGraph never blocks prototype generation. Complete the direct,
|
|
91
|
-
deterministic
|
|
102
|
+
deterministic FE-repo fallback first, then follow
|
|
92
103
|
`.cursor/rules/flowgrid-code-optional-integrations.mdc` for once-per-run telemetry.
|
|
93
104
|
```
|
|
94
105
|
|
|
95
|
-
Docs render / `spec:split` remain flowgrid /
|
|
106
|
+
Docs render / `spec:split` remain flowgrid / docs-hub handoffs.
|
|
96
107
|
|
|
97
108
|
## Translation Rule
|
|
98
|
-
|
|
99
|
-
-
|
|
100
|
-
-
|
|
101
|
-
-
|
|
109
|
+
|
|
110
|
+
- Wrap all static UI copy with the framework’s native i18n helper.
|
|
111
|
+
- Read the `i18n` block from `ir/design.yaml`.
|
|
112
|
+
- Generate or update locale files (`.json` for FE/Node, `.resx` for dotnet-line).
|
|
113
|
+
- Do **not** hard-code mixed languages in UI (e.g. avoid `login / đăng nhập` in one string).
|
|
@@ -9,12 +9,12 @@ disable-model-invocation: true
|
|
|
9
9
|
**Owner:** bộ code (`--type=fe`)
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
npm run codegen:unit:dry -- --id W-
|
|
13
|
-
npm run codegen:unit -- --id W-
|
|
12
|
+
npm run codegen:unit:dry -- --id W-ADM-AUTH-01
|
|
13
|
+
npm run codegen:unit -- --id W-ADM-AUTH-01
|
|
14
14
|
|
|
15
15
|
# Fallback direct CLI if wrappers missing:
|
|
16
|
-
flowgrid unit-gen:dry --adapter=nuxt4 --docs-root=/path/to/docs-hub -- --id W-
|
|
17
|
-
flowgrid unit-gen --adapter=nuxt4 --docs-root=/path/to/docs-hub -- --id W-
|
|
16
|
+
flowgrid unit-gen:dry --adapter=nuxt4 --docs-root=/path/to/docs-hub -- --id W-ADM-AUTH-01
|
|
17
|
+
flowgrid unit-gen --adapter=nuxt4 --docs-root=/path/to/docs-hub -- --id W-ADM-AUTH-01
|
|
18
18
|
flowgrid unit-registry --adapter=nuxt4
|
|
19
19
|
```
|
|
20
20
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
> These are **PHYSICAL INTERLOCKS**, not casual reminders.
|
|
5
5
|
> Any violation of these laws → run **FAILED**. Chat-only "done" = **STRICTLY REJECTED**.
|
|
6
6
|
>
|
|
7
|
-
> Path SSOT: `surfaces/<surface>/CMP-*/<slug>/` (NO `modules/` segment).
|
|
7
|
+
> Path SSOT: `surfaces/<surface>/CMP-*/<slug>/` (NO `modules/` segment). Product IDs: `product-id-convention.md` (`surfaceCode`, `CMP-{SURF}-{DOMAIN}-{NN}`, `W-{SURF}-{DOMAIN}-{NN}`).
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
|
@@ -21,7 +21,7 @@ query a workspace-parent graph.
|
|
|
21
21
|
|
|
22
22
|
## Target / ID Resolution Rule
|
|
23
23
|
|
|
24
|
-
- User prompt MAY specify a screen ID, module ID, or short slug (e.g. `W-
|
|
24
|
+
- User prompt MAY specify a screen ID, module ID, or short slug (e.g. `W-ADM-AUTH-01`, `CMP-ADM-AUTH-01`, `login`).
|
|
25
25
|
- **[MANDATORY]** Agent MUST use `flowgrid_docs_route` or `flowgrid_docs_get_element` (or glob search under `FLOWGRID_DOCS_ROOT` / `surfaces/...`) to resolve target paths.
|
|
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.
|
|
@@ -49,8 +49,8 @@ Mirror the FLOW file path onto the tests hub. Strip **only** these prefixes:
|
|
|
49
49
|
|
|
50
50
|
Examples:
|
|
51
51
|
|
|
52
|
-
- Docs `surfaces/admin/CMP-ADM-
|
|
53
|
-
- Docs `surfaces/admin/CMP-ADM-
|
|
52
|
+
- Docs `surfaces/admin/CMP-ADM-ORD-01/02/common/user-flows/FLOW-checkout.md` → `scenarios/admin/CMP-ADM-ORD-01/02/common/user-flows/FLOW-checkout/SC-*.yaml`
|
|
53
|
+
- Docs `surfaces/admin/CMP-ADM-ORD-01/common/user-flows/FLOW-onboard.md` → `scenarios/admin/CMP-ADM-ORD-01/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
|
|
|
@@ -49,7 +49,7 @@ disable-model-invocation: true
|
|
|
49
49
|
## Rule: Directory Mirroring (Docs SSOT)
|
|
50
50
|
|
|
51
51
|
- **[MANDATORY]** Mirror function folder: `cases/<relative-path>/TC-*.yaml`.
|
|
52
|
-
- ✅ `surfaces/admin/CMP-ADM-
|
|
52
|
+
- ✅ `surfaces/admin/CMP-ADM-ORD-01/02/01/login/` → `cases/admin/CMP-ADM-ORD-01/02/01/login/TC-*.yaml`
|
|
53
53
|
- ❌ `cases/admin/auth/W-…` — invented path not matching docs structure.
|
|
54
54
|
- Cross-flow plans → `/scenario` (mirror `common/user-flows/FLOW-*` or `architecture/03-user-flows/FLOW-*`).
|
|
55
55
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: SC-EXAMPLE
|
|
3
|
-
module: CMP-01
|
|
3
|
+
module: CMP-ADM-AUTH-01
|
|
4
4
|
surface: admin
|
|
5
|
-
screen: W-
|
|
5
|
+
screen: W-ADM-AUTH-01
|
|
6
6
|
screens:
|
|
7
|
-
- W-
|
|
7
|
+
- W-ADM-AUTH-01
|
|
8
8
|
rules:
|
|
9
9
|
- RUL-00-example
|
|
10
10
|
coverage_plan:
|
|
@@ -17,15 +17,15 @@ coverage_plan:
|
|
|
17
17
|
|
|
18
18
|
# SC-EXAMPLE — Xác Thực & Khởi Tạo Hồ Sơ Khách Hàng
|
|
19
19
|
|
|
20
|
-
Scenario thuộc **CMP-01
|
|
20
|
+
Scenario thuộc **CMP-ADM-AUTH-01** · 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
23
|
| Attribute | Value |
|
|
24
24
|
| --- | --- |
|
|
25
25
|
| **Scenario ID** | `SC-EXAMPLE` |
|
|
26
|
-
| **Module** | `CMP-01
|
|
26
|
+
| **Module** | `CMP-ADM-AUTH-01` |
|
|
27
27
|
| **Surface** | `admin` |
|
|
28
|
-
| **Screen** | `W-
|
|
28
|
+
| **Screen** | `W-ADM-AUTH-01` (`/admin/records/create`) |
|
|
29
29
|
| **Priority** | `High` |
|
|
30
30
|
|
|
31
31
|
## 1. Business context & risk analysis
|
|
@@ -79,8 +79,8 @@ stateDiagram-v2
|
|
|
79
79
|
|
|
80
80
|
| Case ID | Facets | Priority | Tests hub path |
|
|
81
81
|
| --- | --- | --- | --- |
|
|
82
|
-
| `TC-EXAMPLE-VALID` | happy, boundary | Critical | `cases/admin/CMP-01
|
|
83
|
-
| `TC-EXAMPLE-INVALID` | validation, boundary | High | `cases/admin/CMP-01
|
|
84
|
-
| `TC-EXAMPLE-DUPLICATE` | concurrency, remote_unique | High | `cases/admin/CMP-01
|
|
85
|
-
| `TC-EXAMPLE-CONCURRENCY` | interaction, double_submit | High | `cases/admin/CMP-01
|
|
86
|
-
| `TC-EXAMPLE-OFFLINE` | reliability, offline_resilience | Medium | `cases/admin/CMP-01
|
|
82
|
+
| `TC-EXAMPLE-VALID` | happy, boundary | Critical | `cases/admin/CMP-ADM-AUTH-01/01/create/` |
|
|
83
|
+
| `TC-EXAMPLE-INVALID` | validation, boundary | High | `cases/admin/CMP-ADM-AUTH-01/01/create/` |
|
|
84
|
+
| `TC-EXAMPLE-DUPLICATE` | concurrency, remote_unique | High | `cases/admin/CMP-ADM-AUTH-01/01/create/` |
|
|
85
|
+
| `TC-EXAMPLE-CONCURRENCY` | interaction, double_submit | High | `cases/admin/CMP-ADM-AUTH-01/01/create/` |
|
|
86
|
+
| `TC-EXAMPLE-OFFLINE` | reliability, offline_resilience | Medium | `cases/admin/CMP-ADM-AUTH-01/01/create/` |
|
|
@@ -10,11 +10,11 @@ story: |
|
|
|
10
10
|
When thực hiện thao tác nhập liệu và nhấn lưu
|
|
11
11
|
Then hệ thống tạo mới thành công và chuyển trạng thái
|
|
12
12
|
refs:
|
|
13
|
-
module: CMP-01
|
|
13
|
+
module: CMP-ADM-AUTH-01
|
|
14
14
|
surface: admin
|
|
15
15
|
scenario: SC-EXAMPLE
|
|
16
16
|
example: EX-EXAMPLE-01
|
|
17
|
-
screen: W-
|
|
17
|
+
screen: W-ADM-AUTH-01
|
|
18
18
|
coverage: [happy, boundary, validation, concurrency, exception]
|
|
19
19
|
priority: high
|
|
20
20
|
automation: automated
|
|
@@ -123,7 +123,7 @@ testIds:
|
|
|
123
123
|
|
|
124
124
|
# Fill when bundle is available (required for `flowgrid cases:gate --strict`).
|
|
125
125
|
traceability:
|
|
126
|
-
bundleScreen: W-
|
|
126
|
+
bundleScreen: W-ADM-AUTH-01
|
|
127
127
|
bundleScenarios: []
|
|
128
128
|
acceptanceRefs: []
|
|
129
129
|
actionRefs:
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@ status: "approved"
|
|
|
18
18
|
* **Ma trận Vai trò & Quyền hạn:**
|
|
19
19
|
| Tác nhân (Actor) | Vai trò trong Quy trình | Quyền hạn trên Màn hình |
|
|
20
20
|
| :--- | :--- | :--- |
|
|
21
|
-
| **Quản trị viên (Admin)** | Đăng nhập tài khoản | Nhập thông tin trên `[W-
|
|
21
|
+
| **Quản trị viên (Admin)** | Đăng nhập tài khoản | Nhập thông tin trên `[W-ADM-AUTH-01]`, truy cập `[W-ADM-DASH-01]` |
|
|
22
22
|
|
|
23
23
|
---
|
|
24
24
|
|
|
@@ -26,8 +26,8 @@ status: "approved"
|
|
|
26
26
|
|
|
27
27
|
### Story 1: Xác thực & Truy cập Hệ thống (Primary Action Story)
|
|
28
28
|
> **Là một** Quản trị viên hệ thống,
|
|
29
|
-
> **Tôi muốn** nhập tên đăng nhập và mật khẩu hợp lệ trên màn hình đăng nhập `[W-
|
|
30
|
-
> **Để** hệ thống xác thực danh tính và cấp quyền truy cập vào trang tổng quan `[W-
|
|
29
|
+
> **Tôi muốn** nhập tên đăng nhập và mật khẩu hợp lệ trên màn hình đăng nhập `[W-ADM-AUTH-01]`,
|
|
30
|
+
> **Để** hệ thống xác thực danh tính và cấp quyền truy cập vào trang tổng quan `[W-ADM-DASH-01]`.
|
|
31
31
|
|
|
32
32
|
### Story 2: Xử lý Sai Thông tin & Khóa Tài khoản (Security Fallback Story)
|
|
33
33
|
> **Là một** Quản trị viên hệ thống,
|
|
@@ -55,11 +55,11 @@ status: "approved"
|
|
|
55
55
|
|
|
56
56
|
## 4. Step-by-step journey
|
|
57
57
|
|
|
58
|
-
### Chặng 1: Nhập thông tin trên `[W-
|
|
58
|
+
### Chặng 1: Nhập thông tin trên `[W-ADM-AUTH-01]`
|
|
59
59
|
1. **Thao tác:** Quản trị viên mở trang đăng nhập, điền `username` và `password`.
|
|
60
60
|
2. **Bấm "Đăng nhập":**
|
|
61
61
|
* Hệ thống kiểm tra xác thực thông tin đối soát với cơ sở dữ liệu tài khoản.
|
|
62
|
-
* **Nếu hợp lệ:** Khởi tạo phiên làm việc an toàn, điều hướng sang `[W-
|
|
62
|
+
* **Nếu hợp lệ:** Khởi tạo phiên làm việc an toàn, điều hướng sang `[W-ADM-DASH-01] Dashboard`.
|
|
63
63
|
* **Nếu sai thông tin:** Giữ nguyên màn hình đăng nhập, xóa trắng trường mật khẩu và hiển thị cảnh báo đỏ theo BR-03.
|
|
64
64
|
|
|
65
65
|
---
|
|
@@ -68,9 +68,9 @@ status: "approved"
|
|
|
68
68
|
|
|
69
69
|
| Bước trong User Story | Màn hình liên quan | Hành động trên Sequence Diagram | Thành phần kỹ thuật đảm nhiệm |
|
|
70
70
|
| :--- | :--- | :--- | :--- |
|
|
71
|
-
| **Story 1 (Đăng nhập)** | `[W-
|
|
72
|
-
| **Story 1 (Điều hướng)** | `[W-
|
|
73
|
-
| **Story 2 (Sai mật khẩu)** | `[W-
|
|
71
|
+
| **Story 1 (Đăng nhập)** | `[W-ADM-AUTH-01]` | `Admin ->> W_Auth ->> Core: Xác thực` | Auth Service, User Table |
|
|
72
|
+
| **Story 1 (Điều hướng)** | `[W-ADM-DASH-01]` | `W_Auth -->> W_Dash: Mở Dashboard` | Router & Session Storage |
|
|
73
|
+
| **Story 2 (Sai mật khẩu)** | `[W-ADM-AUTH-01]` | `W_Auth -->> Admin: Báo lỗi` | Form State & Error Alert |
|
|
74
74
|
|
|
75
75
|
---
|
|
76
76
|
|
|
@@ -80,10 +80,10 @@ status: "approved"
|
|
|
80
80
|
sequenceDiagram
|
|
81
81
|
autonumber
|
|
82
82
|
actor Admin as Quản trị viên
|
|
83
|
-
participant W_Auth as [W-
|
|
83
|
+
participant W_Auth as [W-ADM-AUTH-01] Màn hình Đăng nhập
|
|
84
84
|
participant Core as Dịch vụ Xác thực (Auth Service)
|
|
85
85
|
participant Storage as Cơ sở dữ liệu Người dùng
|
|
86
|
-
participant W_Dash as [W-
|
|
86
|
+
participant W_Dash as [W-ADM-DASH-01] Bàn làm việc (Dashboard)
|
|
87
87
|
|
|
88
88
|
Admin->>W_Auth: 1. Mở trang đăng nhập
|
|
89
89
|
Admin->>W_Auth: 2. Nhập tên tài khoản, mật khẩu & bấm "Đăng nhập"
|
|
@@ -12,7 +12,7 @@ High-level approach: docs hub as arc42 TOC + C4 views; product Code under `CMP-*
|
|
|
12
12
|
|-------|----------|
|
|
13
13
|
| Docs structure | [ADR-001](../09-decisions/ADR-001-arc42-toc) — arc42 TOC over flat C4 folders |
|
|
14
14
|
| Admin runtime | Admin Web + Admin API ([§07](../07-deployment/)) |
|
|
15
|
-
| Auth entry | [CMP-01](/surfaces/CMP-01
|
|
15
|
+
| Auth entry | [CMP-ADM-AUTH-01](/surfaces/admin/CMP-ADM-AUTH-01/) · [FLOW-login](../03-user-flows/FLOW-login) |
|
|
16
16
|
|
|
17
17
|
Further ADRs land in [§09](../09-decisions/).
|
|
18
18
|
|
|
@@ -9,8 +9,9 @@ status: active
|
|
|
9
9
|
| `LND-*` | Landscape |
|
|
10
10
|
| `DEP-*` | Deployment node |
|
|
11
11
|
| `CTR-*` | Container |
|
|
12
|
-
| `
|
|
13
|
-
| `
|
|
12
|
+
| `surfaceCode` | 2–4 letter token on `surfaces/*/index.md` — embedded in all product IDs on that channel |
|
|
13
|
+
| `CMP-*` | Component (product) — folder name = id, pattern `CMP-{SURF}-{DOMAIN}-{NN}` |
|
|
14
|
+
| `W-*` / `API-*` | Screen / API — `W-{SURF}-{DOMAIN}-{NN}` (globally unique) |
|
|
14
15
|
| `FLOW-*` | Product journey (runtime) |
|
|
15
16
|
| `DEP-*` | Deployment (optional) |
|
|
16
17
|
| `ADR-*` | Architecture decision |
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Structurizr DSL — pilot skeleton (Phase B).
|
|
3
3
|
* SSOT for prose/IDs remains MD under architecture/ + surfaces/ (see MODEL.md).
|
|
4
|
-
* IDs mirror docs hub: admin,
|
|
4
|
+
* IDs mirror docs hub: admin, CMP-ADM-AUTH-01, W-ADM-AUTH-01.
|
|
5
5
|
*/
|
|
6
6
|
workspace "base-docs platform" "arc42 × C4 pilot model" {
|
|
7
7
|
|
|
@@ -12,10 +12,10 @@ workspace "base-docs platform" "arc42 × C4 pilot model" {
|
|
|
12
12
|
|
|
13
13
|
admin = softwareSystem "Admin Product" "Admin product boundary" {
|
|
14
14
|
web = container "Admin Web" "Admin SPA / FE" "Nuxt/Next" {
|
|
15
|
-
auth = component "CMP-01
|
|
15
|
+
auth = component "CMP-ADM-AUTH-01" "Authentication module" "Vue/React"
|
|
16
16
|
}
|
|
17
17
|
api = container "Admin API" "Admin HTTP API" "Nest/FastAPI" {
|
|
18
|
-
authApi = component "
|
|
18
|
+
authApi = component "API-ADM-AUTH-01" "Auth endpoints" "Node"
|
|
19
19
|
}
|
|
20
20
|
db = container "Admin DB" "Storage" "PostgreSQL" "Database"
|
|
21
21
|
}
|
|
@@ -46,19 +46,19 @@ workspace "base-docs platform" "arc42 × C4 pilot model" {
|
|
|
46
46
|
autoLayout tb
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
component web "CMP-01-web" {
|
|
49
|
+
component web "CMP-ADM-AUTH-01-web" {
|
|
50
50
|
include *
|
|
51
51
|
autoLayout lr
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
component api "
|
|
54
|
+
component api "API-ADM-AUTH-01-api" {
|
|
55
55
|
include *
|
|
56
56
|
autoLayout lr
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
dynamic admin "FLOW-login" {
|
|
60
|
-
op -> web "Open login W-
|
|
61
|
-
web -> api "POST login API-
|
|
60
|
+
op -> web "Open login W-ADM-AUTH-01"
|
|
61
|
+
web -> api "POST login API-ADM-AUTH-01"
|
|
62
62
|
api -> idp "Validate credentials"
|
|
63
63
|
api -> web "session / token"
|
|
64
64
|
web -> op "Authenticated shell"
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
|
-
id: CMP-
|
|
2
|
+
id: CMP-ADM-DOMAIN-01
|
|
3
3
|
title: "Module name"
|
|
4
4
|
status: draft
|
|
5
5
|
contentLocale: vi
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
# CMP-
|
|
8
|
+
# CMP-ADM-DOMAIN-01 — [Name]
|
|
9
9
|
|
|
10
10
|
> Section titles are **English**. Prose uses `contentLocale` / `docs-hub.locale.yaml`.
|
|
11
11
|
|
|
@@ -10,7 +10,8 @@ Hub: `docs/templates/feature.bundle.yaml` · split: `pnpm spec:split`
|
|
|
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
11
|
| `scopeIn` | **Khuyến nghị** — trong phạm vi màn/phase (PRD). Audit `WARN_NO_SCOPE_IN`. |
|
|
12
12
|
| `nonGoals` | **Khuyến nghị** — ngoài phạm vi màn/phase (PRD). Audit `WARN_NO_NON_GOALS`. |
|
|
13
|
-
| `userFlows` | **
|
|
13
|
+
| `userFlows` | **Recommended** — `FLOW-* — role: … — screens: W-* (this leaf)`; agents read linked `FLOW-*.md` §6 before codegen (`agent-design-context.md`). |
|
|
14
|
+
| `interactionCases` | **Optional L2** — `policy` + `items[]` (`IC-*`, `description`, `sequenceDiagram`); split → `spec.md` + `ir/generated/design.md`. Audit `CONFIRM_INTERACTION_CASES_POLICY`. |
|
|
14
15
|
| `nfr` | **Khuyến nghị** — hiệu năng, bảo mật. Audit `WARN_NO_NFR`. |
|
|
15
16
|
| _(rủi ro)_ | **Không** khai báo trên bundle. SSOT: `architecture/11-risks/risk-register.md` — `/risk-register`. Key `risks:` → audit `WARN_BUNDLE_RISKS_FORBIDDEN`. |
|
|
16
17
|
| `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. |
|
|
@@ -288,7 +289,7 @@ actions:
|
|
|
288
289
|
trigger: button_click
|
|
289
290
|
apiRefs: [ feature.create ]
|
|
290
291
|
# tags: ["#reuse-api"]
|
|
291
|
-
# reuseFrom: surfaces/admin/CMP-01/
|
|
292
|
+
# reuseFrom: surfaces/admin/CMP-ADM-AUTH-01/01/01/01/api/01/01-backend-spec.yaml
|
|
292
293
|
onSuccess:
|
|
293
294
|
- Navigate to list page
|
|
294
295
|
- Show success toast "Created successfully"
|
|
@@ -7,6 +7,13 @@
|
|
|
7
7
|
const hasStories = !!spec.userStories;
|
|
8
8
|
const hasNfr = spec.nfr && String(spec.nfr).trim();
|
|
9
9
|
const hasUserFlows = spec.userFlows && String(spec.userFlows).trim();
|
|
10
|
+
const icBlock = spec.interactionCases;
|
|
11
|
+
const icItems = icBlock && Array.isArray(icBlock.items) ? icBlock.items : [];
|
|
12
|
+
const hasInteractionCases =
|
|
13
|
+
icBlock &&
|
|
14
|
+
(icBlock.policy === 'skip' ||
|
|
15
|
+
icItems.length > 0 ||
|
|
16
|
+
(icBlock.policy === 'required' && icItems.length === 0));
|
|
10
17
|
const qaOpen = spec['Q&A'] && String(spec['Q&A']).trim();
|
|
11
18
|
const hasEntities = spec.entities && (Array.isArray(spec.entities) ? spec.entities.length : true);
|
|
12
19
|
const pageSections = spec.sections || spec.design?.sections || [];
|
|
@@ -34,8 +41,9 @@
|
|
|
34
41
|
if (hasNonGoals) addToc('Out of scope', 'scope-out');
|
|
35
42
|
if (hasStories) addToc('User stories & requirements', 'user-stories--screen-journey');
|
|
36
43
|
addToc('Data & integrations / API', 'data-integrations');
|
|
37
|
-
if (hasUserFlows) addToc('
|
|
44
|
+
if (hasUserFlows) addToc('Linked user flows (FLOW)', 'user-flows');
|
|
38
45
|
if (hasNfr) addToc('Non-functional (NFR)', 'nfr');
|
|
46
|
+
if (hasInteractionCases) addToc('Interaction cases', 'interaction-cases');
|
|
39
47
|
if (hasState) addToc('State & permissions matrix', 'state--permission-matrix');
|
|
40
48
|
if (hasListColumns) addToc('List columns', 'list-columns');
|
|
41
49
|
if (hasListExtras) addToc('Filters & pagination', 'list-filters-pagination');
|
|
@@ -213,7 +221,11 @@ Backend contract: `api/<seq>/01-backend-spec.yaml` on the same function leaf (no
|
|
|
213
221
|
<% } %>
|
|
214
222
|
|
|
215
223
|
<% if (hasUserFlows) { %>
|
|
216
|
-
##
|
|
224
|
+
## Linked user flows (FLOW) {#user-flows}
|
|
225
|
+
|
|
226
|
+
Use product journey docs (`FLOW-*.md`) — include §6 sequence. Convention per line:
|
|
227
|
+
|
|
228
|
+
`FLOW-<id> — role: entry|step-N-*|exit — screens: W-* … (this leaf)`
|
|
217
229
|
|
|
218
230
|
<%= spec.userFlows %>
|
|
219
231
|
|
|
@@ -226,6 +238,39 @@ Backend contract: `api/<seq>/01-backend-spec.yaml` on the same function leaf (no
|
|
|
226
238
|
|
|
227
239
|
<% } %>
|
|
228
240
|
|
|
241
|
+
<% if (hasInteractionCases) { %>
|
|
242
|
+
## Interaction cases {#interaction-cases}
|
|
243
|
+
|
|
244
|
+
<% if (icBlock.policy === 'skip') { %>
|
|
245
|
+
_Screen interaction sequences skipped:_ <%= icBlock.skipReason || '(no reason given)' %>
|
|
246
|
+
|
|
247
|
+
<% } else { %>
|
|
248
|
+
> Sequence diagrams: [design.md](./design.md) (generated). Authoring: `interactionCases` on `*.bundle.yaml`.
|
|
249
|
+
|
|
250
|
+
<% for (const item of icItems) { %>
|
|
251
|
+
### <%= item.id || 'IC-?' %> {#<%= String(item.id || 'ic').toLowerCase() %>}
|
|
252
|
+
|
|
253
|
+
<% if (item.title) { %>**<%= item.title %>**
|
|
254
|
+
|
|
255
|
+
<% } %>
|
|
256
|
+
<% if (item.description) { %>
|
|
257
|
+
<%= item.description %>
|
|
258
|
+
|
|
259
|
+
<% } %>
|
|
260
|
+
<% if (item.links && typeof item.links === 'object') { %>
|
|
261
|
+
| Link | Value |
|
|
262
|
+
| --- | --- |
|
|
263
|
+
<% for (const [k, v] of Object.entries(item.links)) { %>
|
|
264
|
+
| `<%= k %>` | <%= v %> |
|
|
265
|
+
<% } %>
|
|
266
|
+
|
|
267
|
+
<% } %>
|
|
268
|
+
[View sequence diagram](./design.md#<%= String(item.id || 'ic').toLowerCase() %>)
|
|
269
|
+
|
|
270
|
+
<% } %>
|
|
271
|
+
<% } %>
|
|
272
|
+
<% } %>
|
|
273
|
+
|
|
229
274
|
<%
|
|
230
275
|
const page = {
|
|
231
276
|
nav: spec.nav || spec.design?.nav,
|
|
@@ -26,7 +26,35 @@ nonGoals: |
|
|
|
26
26
|
- [VD: không export Excel tại màn list — defer QA/debt]
|
|
27
27
|
|
|
28
28
|
userFlows: |
|
|
29
|
-
-
|
|
29
|
+
- FLOW-checkout — role: step-3-ops — screens: W-ADM-ORD-01 (this leaf)
|
|
30
|
+
# Journey SSOT: FLOW-*.md (§6 sequenceDiagram) — read via userFlows before codegen
|
|
31
|
+
|
|
32
|
+
# Optional — màn nhiều state / case trên một W-* (L2). Không thay FLOW-*.md.
|
|
33
|
+
# interactionCases:
|
|
34
|
+
# policy: required
|
|
35
|
+
# items:
|
|
36
|
+
# - id: IC-SUBMIT-HAPPY
|
|
37
|
+
# title: "Lưu từ DRAFT"
|
|
38
|
+
# description: |
|
|
39
|
+
# User bấm Lưu; form hợp lệ; chuyển trạng thái.
|
|
40
|
+
# links:
|
|
41
|
+
# actionId: btn_save_record
|
|
42
|
+
# recordStatus: DRAFT
|
|
43
|
+
# sequenceDiagram: |
|
|
44
|
+
# sequenceDiagram
|
|
45
|
+
# actor U as User
|
|
46
|
+
# participant W as [W-ADM-ORD-01]
|
|
47
|
+
# U->>W: Submit
|
|
48
|
+
# - id: IC-SUBMIT-409
|
|
49
|
+
# title: "Conflict"
|
|
50
|
+
# description: |
|
|
51
|
+
# Optimistic lock conflict — giữ form, reload.
|
|
52
|
+
# links:
|
|
53
|
+
# actionId: btn_save_record
|
|
54
|
+
# sequenceDiagram: |
|
|
55
|
+
# sequenceDiagram
|
|
56
|
+
# U->>W: Submit
|
|
57
|
+
# W-->>U: 409 message
|
|
30
58
|
|
|
31
59
|
nfr: |
|
|
32
60
|
- **Hiệu năng:** [VD: danh sách < 2s với 10k bản ghi — phân trang server]
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
---
|
|
2
|
+
page-id: W-XXX-DOMAIN-01
|
|
3
|
+
title: "Runtime sequence — <feature title>"
|
|
4
|
+
status: draft
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Runtime sequence — `<page-id>`
|
|
8
|
+
|
|
9
|
+
> SSOT for **tech review** (BE/FE). Journey context: link `FLOW-*` from bundle `userFlows`.
|
|
10
|
+
> Authoring: `ir/runtime-sequence.md` or `api/<seq>/02-runtime-sequence.md` — not this generated copy.
|
|
11
|
+
|
|
12
|
+
## Scope
|
|
13
|
+
|
|
14
|
+
- **In this diagram:** …
|
|
15
|
+
- **Out of scope:** …
|
|
16
|
+
|
|
17
|
+
## Preconditions & state
|
|
18
|
+
|
|
19
|
+
| State / gate | Rule |
|
|
20
|
+
| --- | --- |
|
|
21
|
+
| e.g. `DRAFT` | User may edit until submit |
|
|
22
|
+
|
|
23
|
+
## Sequence
|
|
24
|
+
|
|
25
|
+
```mermaid
|
|
26
|
+
sequenceDiagram
|
|
27
|
+
autonumber
|
|
28
|
+
actor U as User
|
|
29
|
+
participant W as [W-XXX-DOMAIN-01]
|
|
30
|
+
participant API as [API-XXX-DOMAIN-01]
|
|
31
|
+
participant Svc as DomainService
|
|
32
|
+
participant DB as Database
|
|
33
|
+
|
|
34
|
+
U->>W: Open screen
|
|
35
|
+
W->>API: Load (GET …)
|
|
36
|
+
API->>Svc: fetch
|
|
37
|
+
Svc->>DB: query
|
|
38
|
+
DB-->>Svc: rows
|
|
39
|
+
Svc-->>API: DTO
|
|
40
|
+
API-->>W: 200 + body
|
|
41
|
+
W-->>U: Render
|
|
42
|
+
|
|
43
|
+
alt Validation error
|
|
44
|
+
API-->>W: 422 field errors
|
|
45
|
+
W-->>U: Inline messages
|
|
46
|
+
else Conflict
|
|
47
|
+
API-->>W: 409
|
|
48
|
+
W-->>U: Toast + stay
|
|
49
|
+
end
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Traceability
|
|
53
|
+
|
|
54
|
+
| Step | Endpoint / action | Tables / events |
|
|
55
|
+
| --- | --- | --- |
|
|
56
|
+
| 1 | `endpoints[].id` … | … |
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Đặt `TC-*.yaml` mirror path function trên docs-hub (bỏ prefix `surfaces/`).
|
|
4
4
|
|
|
5
|
-
Ví dụ docs: `surfaces/admin/CMP-ADM-
|
|
5
|
+
Ví dụ docs: `surfaces/admin/CMP-ADM-ORD-01/02/01/login/` → `cases/admin/CMP-ADM-ORD-01/02/01/login/TC-*.yaml`
|
|
6
6
|
|
|
7
7
|
- SSOT ghi: `TC-*.yaml` (`schemaVersion: 2`) — copy mẫu từ `../_templates/TC.example.yaml` (init từ harness).
|
|
8
8
|
- SSOT đọc QA/Dev: `pnpm cases:render` → `TC-*.md` cùng thư mục — **không sửa tay** MD.
|