@shanyucoder/flowgrid 0.1.9 → 0.1.11

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 (104) hide show
  1. package/adapters/nextjs/codegen/runners/lib/resolve-hub-id.mjs +7 -4
  2. package/adapters/nextjs/unitgen/runners/README.md +4 -4
  3. package/adapters/nextjs/unitgen/runners/generate.mjs +1 -1
  4. package/adapters/nuxt4/codegen/runners/lib/resolve-hub-id.mjs +7 -4
  5. package/adapters/nuxt4/unitgen/runners/README.md +4 -4
  6. package/adapters/nuxt4/unitgen/runners/generate.mjs +1 -1
  7. package/adapters/shared/common-gen.mjs +1 -1
  8. package/adapters/shared/resolve-hub-id.mjs +7 -4
  9. package/bin/flowgrid.mjs +43 -9
  10. package/bin/lib/audit-run.mjs +5 -1
  11. package/bin/lib/docs-hub-locale.mjs +9 -0
  12. package/bin/lib/init-scaffold.mjs +30 -2
  13. package/dist/docs/mcp/tools.js +4 -4
  14. package/dist/docs/mcp/tools.js.map +1 -1
  15. package/dist/docs/scan/ids.d.ts +1 -1
  16. package/dist/docs/scan/ids.js +9 -8
  17. package/dist/docs/scan/ids.js.map +1 -1
  18. package/dist/docs/scan/route.js +2 -2
  19. package/dist/docs/scan/route.js.map +1 -1
  20. package/dist/graph/mcp/tools.js +1 -1
  21. package/dist/graph/mcp/tools.js.map +1 -1
  22. package/engines/cases/render-cases.mjs +34 -26
  23. package/engines/docs/lib/audit-hub-prd.mjs +136 -0
  24. package/engines/docs/lib/audit-risks-catalog.mjs +142 -0
  25. package/engines/docs/lib/docs-hub-locale.mjs +100 -0
  26. package/engines/docs/lib/render-bundle-markdown.mjs +8 -1
  27. package/engines/docs/vitepress/config.ts +4 -4
  28. package/engines/spec/lib/audit-bundle-gaps.mjs +38 -7
  29. package/engines/spec/lib/audit-flow-gaps.mjs +2 -2
  30. package/engines/spec/lib/audit-legacy-gaps.mjs +10 -0
  31. package/engines/spec/lib/bundle-schema.mjs +3 -1
  32. package/engines/testcase/_staging-from-portal/runners/README.md +3 -3
  33. package/engines/testcase/_staging-from-portal/runners/generate.mjs +2 -2
  34. package/engines/testcase/_staging-from-portal/runners/lib/read-testcase.mjs +1 -1
  35. package/engines/testcase/runners/README.md +3 -3
  36. package/engines/testcase/runners/generate.mjs +2 -2
  37. package/engines/testcase/runners/lib/read-testcase.mjs +1 -1
  38. package/engines/testcase/runners/lib/resolve-hub-id.mjs +6 -6
  39. package/harness/be/skills/audit-api/SKILL.md +1 -1
  40. package/harness/be/skills/grill-api-unit/SKILL.md +1 -1
  41. package/harness/common/skills/legacy/SKILL.md +2 -2
  42. package/harness/docs/extracts/architecture-core.md +2 -0
  43. package/harness/docs/extracts/common-scope.md +8 -8
  44. package/harness/docs/extracts/extract-registry.docs.json +7 -3
  45. package/harness/docs/extracts/product-id-convention.md +58 -0
  46. package/harness/docs/extracts/spec-core.md +1 -1
  47. package/harness/docs/extracts/spec-prd-lite.md +11 -13
  48. package/harness/docs/extracts/spec-requirement.md +1 -1
  49. package/harness/docs/extracts/tpl-adoption-inventory.md +32 -0
  50. package/harness/docs/extracts/tpl-module.md +9 -40
  51. package/harness/docs/extracts/tpl-overview-prd.md +11 -0
  52. package/harness/docs/extracts/tpl-risk-register.md +28 -0
  53. package/harness/docs/extracts/tpl-surface-prd.md +7 -0
  54. package/harness/docs/rules/agent-compliance.mdc +1 -1
  55. package/harness/docs/rules/docs-hub.mdc +1 -1
  56. package/harness/docs/rules/flowgrid-process.mdc +1 -1
  57. package/harness/docs/skills/adopt/SKILL.md +43 -11
  58. package/harness/docs/skills/api-update/SKILL.md +1 -1
  59. package/harness/docs/skills/background-logic/SKILL.md +1 -1
  60. package/harness/docs/skills/common-spec/SKILL.md +1 -1
  61. package/harness/docs/skills/cross-service/SKILL.md +1 -1
  62. package/harness/docs/skills/db-erd/SKILL.md +1 -1
  63. package/harness/docs/skills/grill/SKILL.md +2 -0
  64. package/harness/docs/skills/grill-hub-prd/SKILL.md +38 -0
  65. package/harness/docs/skills/module/SKILL.md +9 -6
  66. package/harness/docs/skills/overview/SKILL.md +7 -6
  67. package/harness/docs/skills/risk-register/SKILL.md +29 -0
  68. package/harness/docs/skills/spec/SKILL.md +5 -4
  69. package/harness/docs/skills/surfaces/SKILL.md +4 -1
  70. package/harness/docs/skills/{business-process → user-flow}/SKILL.md +8 -8
  71. package/harness/fe/skills/gen-common/SKILL.md +1 -1
  72. package/harness/fe/skills/grill-prototype/SKILL.md +1 -1
  73. package/harness/fe/skills/prototype/SKILL.md +6 -6
  74. package/harness/fe/skills/unit/SKILL.md +4 -4
  75. package/harness/shared/SSOT_AGENT_PROTOCOL.md +1 -1
  76. package/harness/tests/extracts/grill-scenario-flow.md +2 -2
  77. package/harness/tests/skills/grill-testcase/SKILL.md +2 -2
  78. package/harness/tests/skills/scenario/SKILL.md +11 -11
  79. package/harness/tests/skills/testcase/SKILL.md +2 -2
  80. package/harness/tests/templates/SC.example.md +26 -26
  81. package/harness/tests/templates/TC.example.yaml +3 -3
  82. package/lexicon/registry-tags.en.txt +2 -2
  83. package/package.json +1 -1
  84. package/templates/project-skeleton/architecture/03-business-process/index.md +3 -0
  85. package/templates/project-skeleton/architecture/{03-business-process → 03-user-flows}/FLOW-login.md +16 -16
  86. package/templates/project-skeleton/architecture/{03-business-process → 03-user-flows}/FLOW-template.md +6 -7
  87. package/templates/project-skeleton/architecture/04-solution-strategy/index.md +1 -1
  88. package/templates/project-skeleton/architecture/08-cross-cutting/security.md +1 -1
  89. package/templates/project-skeleton/architecture/11-risks/index.md +7 -17
  90. package/templates/project-skeleton/architecture/11-risks/risk-register.md +34 -0
  91. package/templates/project-skeleton/architecture/12-glossary/index.md +5 -3
  92. package/templates/project-skeleton/architecture/model/workspace.dsl +7 -7
  93. package/templates/project-skeleton/overview/index.md +21 -43
  94. package/templates/project-skeleton/overview/operational-areas/_template.md +15 -22
  95. package/templates/project-skeleton/surfaces/_module-index.template.md +40 -0
  96. package/templates/project-skeleton/surfaces/_surface-index.template.md +44 -0
  97. package/templates/shared/bundle-authoring.md +6 -3
  98. package/templates/shared/default-layout.ejs +108 -62
  99. package/templates/shared/feature.bundle.yaml +15 -6
  100. package/templates/shared/ir/generated/spec.md +24 -24
  101. package/templates/shared/tpl-api-contract.md +5 -5
  102. package/templates/tests-skeleton/cases/README.md +1 -1
  103. package/templates/tests-skeleton/catalog/locale.yaml +16 -15
  104. package/templates/tests-skeleton/tpl-testcase-plan.md +6 -6
@@ -115,7 +115,7 @@ function getOverviewSidebar(root: string, docsDir: string, prefix: string) {
115
115
  }
116
116
 
117
117
  function getBusinessProcessSidebarItems(root: string, prefix: string) {
118
- const processDir = path.join(root, prefix.replace(/^\//, ''), '03-business-process')
118
+ const processDir = path.join(root, prefix.replace(/^\//, ''), '03-user-flows')
119
119
  if (!fs.existsSync(processDir)) return []
120
120
  try {
121
121
  const entries = fs.readdirSync(processDir, { withFileTypes: true })
@@ -129,7 +129,7 @@ function getBusinessProcessSidebarItems(root: string, prefix: string) {
129
129
  title = markdownNavText(entry.name, content) || nameWithoutExt
130
130
  items.push({
131
131
  text: title,
132
- link: `${prefix}/03-business-process/${nameWithoutExt}`
132
+ link: `${prefix}/03-user-flows/${nameWithoutExt}`
133
133
  })
134
134
  }
135
135
  }
@@ -399,10 +399,10 @@ export default () => {
399
399
  { text: '01 Introduction', link: `${archPrefix}/01-introduction/` },
400
400
  { text: '02 Constraints', link: `${archPrefix}/02-constraints/` },
401
401
  {
402
- text: '03 Business Processes',
402
+ text: '03 Luồng người dùng',
403
403
  collapsed: true,
404
404
  items: [
405
- { text: 'Catalog', link: `${archPrefix}/03-business-process/` },
405
+ { text: 'Catalog', link: `${archPrefix}/03-user-flows/` },
406
406
  ...getBusinessProcessSidebarItems(projectRoot, archPrefix),
407
407
  ],
408
408
  },
@@ -546,12 +546,12 @@ function auditBundleContent(rawText, filePath, pageType) {
546
546
  // Quality warnings (non-blocking — does not affect totalGaps for structure)
547
547
  // =========================================================================
548
548
 
549
- if (!has(rawText, 'successMetrics:')) {
549
+ if (!has(rawText, 'scopeIn:')) {
550
550
  addWarning(
551
- 'WARN_NO_SUCCESS_METRICS',
552
- 'successMetrics',
553
- 'successMetrics not declared — add when PO has measurable or qualitative targets.',
554
- 'Declare successMetrics: | with 1–3 bullets (see bundle-authoring.md).'
551
+ 'WARN_NO_SCOPE_IN',
552
+ 'scopeIn',
553
+ 'scopeIn not declared — generated spec.md missing “Trong phạm vi” (PRD in-scope).',
554
+ 'Declare scopeIn: | with bullets for what this screen/feature includes.'
555
555
  );
556
556
  }
557
557
 
@@ -559,8 +559,39 @@ function auditBundleContent(rawText, filePath, pageType) {
559
559
  addWarning(
560
560
  'WARN_NO_NON_GOALS',
561
561
  'nonGoals',
562
- 'nonGoals not declared — clarify out-of-scope for this screen/phase.',
563
- 'Declare nonGoals: | with explicit non-scope bullets.'
562
+ 'nonGoals not declared — generated spec.md missing “Ngoài phạm vi” (PRD out-of-scope).',
563
+ 'Declare nonGoals: | with explicit out-of-scope bullets.'
564
+ );
565
+ }
566
+
567
+ if (!has(rawText, 'nfr:')) {
568
+ addWarning(
569
+ 'WARN_NO_NFR',
570
+ 'nfr',
571
+ 'nfr not declared — generated spec.md missing non-functional section (perf/security).',
572
+ 'Declare nfr: | or link architecture/08-cross-cutting in prose.'
573
+ );
574
+ }
575
+
576
+ const multiScreen =
577
+ has(rawText, 'nextScreenOnSuccess') ||
578
+ has(rawText, 'contextualAction') ||
579
+ has(rawText, 'sourceScreen:');
580
+ if (multiScreen && !has(rawText, 'userFlows:')) {
581
+ addWarning(
582
+ 'WARN_NO_USER_FLOWS',
583
+ 'userFlows',
584
+ 'Màn có handoff / multi-screen nhưng chưa khai báo luồng người dùng (userFlows).',
585
+ 'Declare userFlows: | — link FLOW-* hoặc mô tả journey ngắn.'
586
+ );
587
+ }
588
+
589
+ if (has(rawText, 'risks:')) {
590
+ addWarning(
591
+ 'WARN_BUNDLE_RISKS_FORBIDDEN',
592
+ 'risks',
593
+ 'Rủi ro không ghi trên feature bundle — SSOT chỉ `architecture/11-risks/risk-register.md`.',
594
+ 'Xóa key `risks:` khỏi bundle; thêm dòng vào risk-register.md (`RISK-*`). Dùng `/risk-register`.'
564
595
  );
565
596
  }
566
597
 
@@ -2,8 +2,8 @@
2
2
 
3
3
  /**
4
4
  * audit-flow-gaps.mjs
5
- * Zero-dependency static audit script for FlowGrid Business Process markdown files (FLOW-*.md).
6
- * Ensures 100% adherence to the 6-section business process standard and background logic rules.
5
+ * Zero-dependency static audit script for FlowGrid User flow markdown files (FLOW-*.md).
6
+ * Ensures 100% adherence to the 6-section user flow standard and background logic rules.
7
7
  */
8
8
 
9
9
  import fs from 'fs';
@@ -42,6 +42,16 @@ function auditLegacyInventory(inventoryPath, targetId) {
42
42
 
43
43
  const rawText = fs.readFileSync(inventoryPath, 'utf8');
44
44
 
45
+ if (targetId?.startsWith('FLOW-') && !/##\s+4\.\s+User flows/i.test(rawText)) {
46
+ addGap(
47
+ 'ADOPT_MISSING_USER_FLOW_SECTION',
48
+ 'warning',
49
+ 'adoption-inventory.md#user-flows',
50
+ 'Inventory has no "## 4. User flows" section — cross-surface FLOW-* may be missing.',
51
+ 'Re-run /adopt with user-flow discovery; see tpl-adoption-inventory.md (tiers A/B/C).'
52
+ );
53
+ }
54
+
45
55
  if (targetId) {
46
56
  if (!rawText.includes(targetId)) {
47
57
  addGap(
@@ -12,8 +12,10 @@ export const BUNDLE_META_KEYS = [
12
12
  'status',
13
13
  'owner',
14
14
  'summary',
15
- 'successMetrics',
15
+ 'scopeIn',
16
16
  'nonGoals',
17
+ 'userFlows',
18
+ 'nfr',
17
19
  'userStories',
18
20
  'specOrigin',
19
21
  'grillStatus'
@@ -4,10 +4,10 @@ Reads **plans** from sibling `base-tests/` → writes `tests/e2e/` on this FE re
4
4
 
5
5
  ```bash
6
6
  pnpm testcase:gen:dry --id TC-LOGIN-VALID
7
- pnpm testcase:gen --id W-AD-AUTH-001
7
+ pnpm testcase:gen --id W-ADM-AUTH-01
8
8
  pnpm testcase:gen --id smoke
9
- pnpm testcase:gen --testcase ../base-tests/cases/W-AD-AUTH-001/TC-LOGIN-VALID.yaml
10
- pnpm testcase:gen --feature W-AD-AUTH-001 # all TC-* under cases/{id}/
9
+ pnpm testcase:gen --testcase ../base-tests/cases/W-ADM-AUTH-01/TC-LOGIN-VALID.yaml
10
+ pnpm testcase:gen --feature W-ADM-AUTH-01 # all TC-* under cases/{id}/
11
11
  ```
12
12
 
13
13
  Author/edit plans on **base-tests** (`/testcase`), not on this code repo.
@@ -37,8 +37,8 @@ function parseArgs(argv) {
37
37
 
38
38
  if (!options.testcase && !options.feature && !options.id) {
39
39
  throw new Error(
40
- 'Usage: pnpm testcase:gen --id W-AD-AUTH-001|TC-LOGIN-VALID|smoke|CMP-01|SC-LOGIN\n' +
41
- ' pnpm testcase:gen --testcase <path> | --feature W-AD-AUTH-001 (screen under base-tests/cases)',
40
+ 'Usage: pnpm testcase:gen --id W-ADM-AUTH-01|TC-LOGIN-VALID|smoke|CMP-ADM-AUTH-01|SC-LOGIN\n' +
41
+ ' pnpm testcase:gen --testcase <path> | --feature W-ADM-AUTH-01 (screen under base-tests/cases)',
42
42
  )
43
43
  }
44
44
 
@@ -145,7 +145,7 @@ export async function readTestcaseFile(testcasePath, opts = {}) {
145
145
  /**
146
146
  * List TC-*.yaml under base-tests/cases/{screenId}/ (prefer --id).
147
147
  * @param {string} root FE repo root
148
- * @param {string} screenId e.g. W-AD-AUTH-001
148
+ * @param {string} screenId e.g. W-ADM-AUTH-01
149
149
  */
150
150
  export async function listFeatureTestcases(root, screenId) {
151
151
  const testsRoot = resolveProjectRoot(root, 'base-tests')
@@ -4,10 +4,10 @@ Reads **plans** from the tests hub → writes `tests/e2e/` in the FE project.
4
4
 
5
5
  ```bash
6
6
  pnpm testcase:gen:dry --id TC-LOGIN-VALID
7
- pnpm testcase:gen --id W-AD-AUTH-001
7
+ pnpm testcase:gen --id W-ADM-AUTH-01
8
8
  pnpm testcase:gen --id smoke
9
- pnpm testcase:gen --testcase "$FLOWGRID_TESTS_DOC/cases/W-AD-AUTH-001/TC-LOGIN-VALID.yaml"
10
- pnpm testcase:gen --feature W-AD-AUTH-001 # all TC-* under cases/{id}/
9
+ pnpm testcase:gen --testcase "$FLOWGRID_TESTS_DOC/cases/W-ADM-AUTH-01/TC-LOGIN-VALID.yaml"
10
+ pnpm testcase:gen --feature W-ADM-AUTH-01 # all TC-* under cases/{id}/
11
11
  ```
12
12
 
13
13
  Author/edit plans in the **tests hub** (`/testcase`), not in the code project.
@@ -51,8 +51,8 @@ function parseArgs(argv) {
51
51
 
52
52
  if (!options.testcase && !options.feature && !options.id && !options.all) {
53
53
  throw new Error(
54
- 'Usage: pnpm testcase:gen --id W-AD-AUTH-001|TC-LOGIN-VALID|smoke|CMP-01|SC-LOGIN\n' +
55
- ' pnpm testcase:gen --testcase <path> | --feature W-AD-AUTH-001 (screen under tests hub cases/)\n' +
54
+ 'Usage: pnpm testcase:gen --id W-ADM-AUTH-01|TC-LOGIN-VALID|smoke|CMP-ADM-AUTH-01|SC-LOGIN\n' +
55
+ ' pnpm testcase:gen --testcase <path> | --feature W-ADM-AUTH-01 (screen under tests hub cases/)\n' +
56
56
  ' pnpm testcase:gen --all\n' +
57
57
  ' Optional: --tests-docs <hub> or FLOWGRID_TESTS_DOC',
58
58
  )
@@ -158,7 +158,7 @@ export async function readTestcaseFile(testcasePath, opts = {}) {
158
158
  /**
159
159
  * List TC-*.yaml under the tests hub cases/{screenId}/ (prefer --id).
160
160
  * @param {string} root FE repo root
161
- * @param {string} screenId e.g. W-AD-AUTH-001
161
+ * @param {string} screenId e.g. W-ADM-AUTH-01
162
162
  */
163
163
  export async function listFeatureTestcases(root, screenId) {
164
164
  const testsRoot = process.env.FLOWGRID_TESTS_DOC ? path.resolve(process.env.FLOWGRID_TESTS_DOC) : resolveProjectRoot(root, 'tests')
@@ -138,7 +138,7 @@ function absUnder(root, rel) {
138
138
  }
139
139
 
140
140
  function findFlowMarkdown(docsRoot, id) {
141
- const catalog = path.join(docsRoot, 'architecture', '03-business-process', `${id}.md`)
141
+ const catalog = path.join(docsRoot, 'architecture', '03-user-flows', `${id}.md`)
142
142
  if (existsSync(catalog)) return catalog
143
143
  const hits = []
144
144
  const walk = (dir) => {
@@ -150,7 +150,7 @@ function findFlowMarkdown(docsRoot, id) {
150
150
  walk(p)
151
151
  continue
152
152
  }
153
- if (ent.name === `${id}.md` && p.split(path.sep).join('/').includes('/common/processes/')) {
153
+ if (ent.name === `${id}.md` && p.split(path.sep).join('/').includes('/common/user-flows/')) {
154
154
  hits.push(p)
155
155
  }
156
156
  }
@@ -206,7 +206,7 @@ export function resolveHubId(repoRoot, id, mode = 'testcase') {
206
206
  const docsRoot = getDocsRoot()
207
207
  const md = findFlowMarkdown(docsRoot, id)
208
208
  if (!md) {
209
- throw new Error(`Unknown FLOW ${id} — expected architecture/03-business-process/${id}.md or …/common/processes/${id}.md`)
209
+ throw new Error(`Unknown FLOW ${id} — expected architecture/03-user-flows/${id}.md or …/common/user-flows/${id}.md`)
210
210
  }
211
211
  notes.push(`flow markdown: ${path.relative(repoRoot, md)}`)
212
212
  return { kind: 'flow', id, paths: [md], notes }
@@ -263,8 +263,8 @@ export function resolveHubId(repoRoot, id, mode = 'testcase') {
263
263
  return { kind: 'code', id, paths: [spec], notes, codeDir }
264
264
  }
265
265
 
266
- // Module (e.g. CMP-ADM-001) → all code children
267
- if (/^[A-Z]+-[A-Z]+-\d{3}$/i.test(id)) {
266
+ // Module (e.g. CMP-ADM-AUTH-01) → all code children
267
+ if (/^CMP-[A-Z0-9]+(?:-[A-Z0-9]+)+$/i.test(id)) {
268
268
  const { index: docsIdx } = getDocs()
269
269
  const cmp = (docsIdx.modules || []).find(
270
270
  (c) => c.id === id || c.id.startsWith(id) || (c.slug && id.toLowerCase().includes(c.slug)),
@@ -319,6 +319,6 @@ export function resolveHubId(repoRoot, id, mode = 'testcase') {
319
319
  }
320
320
 
321
321
  throw new Error(
322
- `Unrecognized id "${id}". Use W-|API-|UI-|FLOW-|DEP-|TC-|SC-* or hierarchical ID (e.g. cmp-adm-001-01-01), or module ID (CMP-ADM-001), or suite id (smoke, regression-auth).`,
322
+ `Unrecognized id "${id}". Use W-|API-|UI-|FLOW-|DEP-|TC-|SC-* or hierarchical ID (e.g. cmp-adm-auth-01-01-01), or module ID (CMP-ADM-AUTH-01), or suite id (smoke, regression-auth).`,
323
323
  )
324
324
  }
@@ -12,7 +12,7 @@ Run after `npm run codegen:api:dry` / `flowgrid api-gen:dry` and after implement
12
12
 
13
13
  ## Target / ID Resolution Rule
14
14
 
15
- - User prompt MAY specify a function ID, API slug, or short name (e.g. `API-AUTH-001`, `login`, `CMP-ADM-009`).
15
+ - User prompt MAY specify a function ID, API slug, or short name (e.g. `API-AUTH-001`, `login`, `CMP-ADM-DEMO-01`).
16
16
  - Agent MUST resolve **`…/api/<seq>/01-backend-spec.yaml`** via `FLOWGRID_DOCS_ROOT` or `flowgrid_docs_route` (screen leaf `CMP-*/<NN…>/api/<seq>/`, or `common/yaml/<slug>/`, or external-channel surface `…/api/<seq>/`).
17
17
  - **Read the entire `01-backend-spec.yaml`**. Do **not** use `ir/design.yaml` or `ir/spec.yaml` as BE contract.
18
18
  - Compare generated routes/code against that 01 file. Missing 01 → STOP, hand off to docs `/grill-api-spec`.
@@ -13,7 +13,7 @@ before committing generated test code.
13
13
 
14
14
  ## Target / ID Resolution Rule
15
15
 
16
- - User prompt MAY specify a function ID, API slug, or short name (e.g. `API-AUTH-001`, `login`, `CMP-ADM-009`).
16
+ - User prompt MAY specify a function ID, API slug, or short name (e.g. `API-AUTH-001`, `login`, `CMP-ADM-DEMO-01`).
17
17
  - Agent MUST resolve **`…/api/<seq>/01-backend-spec.yaml`** via `FLOWGRID_DOCS_ROOT` or `flowgrid_docs_route`.
18
18
  - **Read the entire `01-backend-spec.yaml`**. Do **not** use `ir/design.yaml` or `ir/spec.yaml` as BE contract.
19
19
  - Compare generated unit tests against that 01 file. Missing 01 → STOP, hand off to docs `/grill-api-spec`.
@@ -6,7 +6,7 @@ disable-model-invocation: true
6
6
 
7
7
  # /legacy — Legacy Context Modifier
8
8
 
9
- **Skill Modifier:** When a member uses `/legacy` alongside another specialized skill (e.g., `/legacy /spec`, `/legacy /overview`, `/legacy /business-process`), the Agent MUST enforce the following behavioral shifts.
9
+ **Skill Modifier:** When a member uses `/legacy` alongside another specialized skill (e.g., `/legacy /spec`, `/legacy /overview`, `/legacy /user-flow`), the Agent MUST enforce the following behavioral shifts.
10
10
 
11
11
  ## Behavioral Shifts (Context Shift)
12
12
 
@@ -18,7 +18,7 @@ disable-model-invocation: true
18
18
  - **Tier 1 (Page / API Detail — `/legacy /spec`)**:
19
19
  - ONLY audit internal page/API scope: Check **missing Validation** (field validation rules, max length, format regex...) and **Local Security** (e.g. Laravel `@csrf`, Auth guard/middleware on route, input sanitization).
20
20
  - Do NOT perform cross-system end-to-end vulnerability audits at this level.
21
- - **Tier 2 (Cross-Flow / Business Process — `/legacy /business-process`, Module, Surface)**:
21
+ - **Tier 2 (Cross-Flow / User flow — `/legacy /user-flow`, Module, Surface)**:
22
22
  - Audit **End-to-End Business Flow Gaps**: Check data/status misalignment between Step 1 (Screen 1) and Step 2 (Screen 2), orphan APIs/steps, broken flow steps, and missing rollback/confirmation handling on failure.
23
23
 
24
24
  3. **Metadata Updates (When Applicable):**
@@ -36,6 +36,8 @@ No **dynamics** wording on new trees — use **flow** / `FLOW-*` / `/journey`.
36
36
 
37
37
  ## ID rules
38
38
 
39
+ **Product IDs (global):** `product-id-convention.md` — `surfaceCode` on each surface; `CMP-{SURF}-{DOMAIN}-{NN}`, `W-{SURF}-{DOMAIN}-{NN}`, `API-{SURF}-{DOMAIN}-{NN}`.
40
+
39
41
  | Prefix | Path | Notes |
40
42
  |--------|------|-------|
41
43
  | `LND-*` `CTX-*` | `architecture/03-context/` | Overview / landscape + context |
@@ -25,7 +25,7 @@ Inside every `common/`:
25
25
  ```text
26
26
  common/
27
27
  patterns/ ← /common Markdown (BA/QA rules)
28
- processes/ ← module/cluster FLOW-*.md (not architecture catalog)
28
+ user-flows/ ← module/cluster FLOW-*.md (Luồng người dùng; not architecture catalog)
29
29
  ```
30
30
 
31
31
  Optional: `data-model/`, `integrations/`, `db-erd.md`, `cross-service.md` at the same LCA (see skills `/db-erd`, `/cross-service`).
@@ -38,20 +38,20 @@ If the same pattern already exists at a **narrower** `common/`, **reuse it** (re
38
38
 
39
39
  ## 3. Consume order (`/spec`, `/grill-*`, `/api-spec`)
40
40
 
41
- From the function folder, walk **up** and read the **nearest** `common/patterns/*.md` (and FLOW under `processes/` when relevant). Do not author duplicate YAML CMN bundles.
41
+ From the function folder, walk **up** and read the **nearest** `common/patterns/*.md` (and FLOW under `user-flows/` when relevant). Do not author duplicate YAML CMN bundles.
42
42
 
43
43
  Same walk for `patterns/` Markdown.
44
44
 
45
- ## 4. Business process (`FLOW-*`)
45
+ ## 4. Luồng người dùng (`FLOW-*`)
46
46
 
47
47
  | Scope of the flow | File |
48
48
  |-------------------|------|
49
- | Org / cross-surface / “hero” catalog | `architecture/03-business-process/FLOW-*.md` (MCP `flowgrid_docs_business_processes`) |
50
- | Many modules, one surface | `surfaces/<surface>/common/processes/FLOW-*.md` |
51
- | Whole module, several clusters | `surfaces/<surface>/<CMP-id>/common/processes/FLOW-*.md` |
52
- | One cluster / submodule only | `surfaces/<surface>/<CMP-id>/<NN>/common/processes/FLOW-*.md` |
49
+ | Org / cross-surface / “hero” catalog | `architecture/03-user-flows/FLOW-*.md` (MCP `flowgrid_docs_user_flows`) |
50
+ | Many modules, one surface | `surfaces/<surface>/common/user-flows/FLOW-*.md` |
51
+ | Whole module, several clusters | `surfaces/<surface>/<CMP-id>/common/user-flows/FLOW-*.md` |
52
+ | One cluster / submodule only | `surfaces/<surface>/<CMP-id>/<NN>/common/user-flows/FLOW-*.md` |
53
53
 
54
- Do **not** drop `FLOW-*.md` beside a single `W-*` bundle. Do **not** write module-internal flows only under `architecture/03-business-process/` (optional **link** from the catalog to the product path).
54
+ Do **not** drop `FLOW-*.md` beside a single `W-*` bundle. Do **not** write module-internal flows only under `architecture/03-user-flows/` (optional **link** from the catalog to the product path).
55
55
 
56
56
  `/db-erd` and `/cross-service` use the **same** `common/` LCA (`common/db-erd.md`, `common/cross-service.md`), not a second invented folder name.
57
57
 
@@ -10,7 +10,9 @@
10
10
  ".cursor/extracts/tpl-deployment.md",
11
11
  ".cursor/extracts/tpl-adr.md",
12
12
  ".cursor/extracts/tpl-cross-cutting.md",
13
- ".cursor/extracts/common-scope.md"
13
+ ".cursor/extracts/common-scope.md",
14
+ ".cursor/extracts/tpl-adoption-inventory.md",
15
+ ".cursor/extracts/product-id-convention.md"
14
16
  ],
15
17
  "docs-hub": [
16
18
  ".cursor/extracts/docs-phase-hooks.md",
@@ -25,11 +27,13 @@
25
27
  ".cursor/extracts/design-leaf-signoff.md",
26
28
  ".cursor/extracts/db-audit-wizard.md",
27
29
  ".cursor/extracts/agent-execution-protocol.md",
28
- ".cursor/extracts/common-scope.md"
30
+ ".cursor/extracts/common-scope.md",
31
+ ".cursor/extracts/product-id-convention.md"
29
32
  ],
30
33
  "spec-core": [
31
34
  ".cursor/extracts/spec-core.md",
32
- ".cursor/extracts/common-scope.md"
35
+ ".cursor/extracts/common-scope.md",
36
+ ".cursor/extracts/product-id-convention.md"
33
37
  ],
34
38
  "bqa-grill": [
35
39
  ".cursor/extracts/grill/validation.md",
@@ -0,0 +1,58 @@
1
+ # Product ID convention (global SSOT)
2
+
3
+ English **structure**; prose locale is separate (`contentLocale`).
4
+
5
+ ## Why surface code is mandatory
6
+
7
+ IDs are **globally unique** across the docs hub (CLI `--id`, registries, tests mirror). The same capability on two channels (e.g. Login on admin vs customer) MUST be two IDs. Path `surfaces/<slug>/` alone is not enough when referencing without a path.
8
+
9
+ ## Surface code (`surfaceCode`)
10
+
11
+ - Declare on every `surfaces/<slug>/index.md` frontmatter: `surfaceCode: ADM` (2–4 uppercase letters).
12
+ - Register once per channel; reuse the **same token** in every `CMP-*` / `W-*` / `API-*` / `UI-*` on that surface.
13
+ - Folder slug stays human (`admin`, `customer-web`); **IDs embed `surfaceCode`**, not the slug.
14
+
15
+ | Surface folder | Example `surfaceCode` |
16
+ | --- | --- |
17
+ | `surfaces/admin` | `ADM` |
18
+ | `surfaces/customer-web` | `CUS` |
19
+ | `surfaces/workforce-app` | `WRK` |
20
+
21
+ ## Patterns
22
+
23
+ | Kind | Pattern | Example |
24
+ | --- | --- | --- |
25
+ | Module (folder name) | `CMP-{SURF}-{DOMAIN}-{NN}` | `CMP-ADM-AUTH-01` |
26
+ | Screen | `W-{SURF}-{DOMAIN}-{NN}` | `W-ADM-AUTH-01` |
27
+ | API | `API-{SURF}-{DOMAIN}-{NN}` | `API-ADM-AUTH-01` |
28
+ | UI code leaf | `UI-{SURF}-{DOMAIN}-{NN}` | `UI-ADM-EMPTY-01` |
29
+ | User flow | `FLOW-{slug}` | `FLOW-checkout` (no surface — scope in doc body) |
30
+ | Common | `CMN-UI-*` / `CMN-API-*` / `CMN-DTO-*` | No surface prefix |
31
+
32
+ - `{SURF}` = `surfaceCode` (2–4 chars).
33
+ - `{DOMAIN}` = short capability token (`AUTH`, `ORD`, `CART`, `USR`, …).
34
+ - `{NN}` = two digits `01`–`99` per domain on that surface (pad with zero).
35
+
36
+ ## Module folder = global module ID
37
+
38
+ `surfaces/<slug>/CMP-ADM-AUTH-01/` — folder name **equals** global `CMP-*` id (tooling SSOT).
39
+
40
+ ## Bundle / path slug (lowercase)
41
+
42
+ `CMP-ADM-ORD-01` + draft `02-01-02` → `page-id: cmp-adm-ord-01-02-01-02` (lowercase, same tokens).
43
+
44
+ ## Hierarchical CLI alias
45
+
46
+ Lowercase path encoding: `cmp-adm-auth-01-01-01-01` (= module + numeric segments under `CMP-*`).
47
+
48
+ ## Same business name, two surfaces
49
+
50
+ - Admin login: `W-ADM-AUTH-01`
51
+ - Customer login: `W-CUS-AUTH-01`
52
+ Shared spec → `CMN-*` or explicit cross-reference; **never** one `W-*` for both.
53
+
54
+ ## Forbidden
55
+
56
+ - `W-AUTH-01` without `{SURF}` (collision risk).
57
+ - Mixed tokens on one surface (`W-AD-*` vs `W-ADM-*`) — pick one `surfaceCode` and stick to it.
58
+ - Renaming IDs for arc42-only refactors (see `architecture/02-constraints`).
@@ -2,7 +2,7 @@
2
2
 
3
3
  `/common` writes `common/patterns/*.md` at the LCA from `common-scope.md`.
4
4
 
5
- Cross-flow: `common/processes/FLOW-*.md`.
5
+ Cross-flow: `common/user-flows/FLOW-*.md`.
6
6
 
7
7
  **Deprecated:** `/common-spec`, `common/yaml`, `/gen-common`, `/grill-common-spec`.
8
8
 
@@ -1,19 +1,17 @@
1
1
  # Leaf bundle ↔ PRD lite (map for /spec)
2
2
 
3
- | PRD section | Bundle / IR |
3
+ | PRD section | Bundle key → `ir/generated/spec.md` |
4
4
  | --- | --- |
5
- | Problem / goals | `summary` bullets (business_goals, stakeholders, user_journey, context) |
6
- | Success metrics | `successMetrics` (optional) |
7
- | Non-goals | `nonGoals` (optional) |
8
- | Users / persona | `userStories.primary.asA` + link `overview/` persona |
9
- | User stories + AC | `userStories.scenarios`, `acceptanceCriteria` |
10
- | Functional scope | `spec.requirements`, `design.sections`, `design.actions` |
11
- | API | `api/<seq>/01-backend-spec.yaml` — **not** `spec.api` |
12
- | Tech / codegen | `gen`, `grill-dev` — not in first `/spec` pass |
13
- | Open questions | `qa/*.yaml` |
5
+ | Goals / background | `summary` |
6
+ | In scope | `scopeIn` |
7
+ | Out of scope | `nonGoals` |
8
+ | Features & requirements | `userStories` + `design.*` (render sections) |
9
+ | User flows | `userFlows` (+ FLOW-* docs) |
10
+ | Data & API | `entities` + links `data-model.md` / `api.md` / `01` |
11
+ | NFR | `nfr` |
12
+ | Risks | **Chỉ** `architecture/11-risks/risk-register.md` — không key trên bundle |
13
+ | Open questions | `qa/*.yaml` → `Q&A` + Phụ lục |
14
14
 
15
- **Author path:** `.flowgrid/templates/feature.bundle.yaml` + `bundle-authoring.md` only. **`design-spec.yaml` deprecated.**
16
-
17
- **BA deliverable:** `ir/generated/spec.md` (TOC, overview, metrics, non-goals) after `flowgrid split` + `flowgrid render`.
15
+ **BA deliverable:** `flowgrid split` + `flowgrid render` → `ir/generated/spec.md` (TOC PRD). Audit: `WARN_NO_SCOPE_IN`, `WARN_NO_NON_GOALS`, `WARN_NO_NFR`, `WARN_NO_USER_FLOWS` (when handoff). Rủi ro: `/risk-register` + `audit risks` (không `risks:` trên bundle).
18
16
 
19
17
  **Profile trim:** list → giữ Initial Load, Affordances (nếu có), Exceptions; bỏ scenario form nếu không có `ui.form`. create/detail tương tự — không copy 6 scenario khi không áp dụng.
@@ -6,4 +6,4 @@ Required business keys when info exists: `summary`, `userStories` (+ `screenAcce
6
6
 
7
7
  After patch: `flowgrid split` → `flowgrid render` → BA reads `ir/generated/spec.md` (not hand-written `.md`).
8
8
 
9
- Path SSOT: `surfaces/<surface>/CMP-*/<NN…>/` — resolve IDs with `flowgrid_docs_route` on consumer repo.
9
+ Path SSOT: `surfaces/<surface>/CMP-*/<NN…>/` — resolve IDs with `flowgrid_docs_route` on consumer repo. ID shape: `product-id-convention.md`.
@@ -0,0 +1,32 @@
1
+ # Adoption inventory — section template (`adoption-inventory.md`)
2
+
3
+ Workspace root SSOT after `/adopt`. English **IDs**; prose may follow hub `contentLocale` later. ID shape: `product-id-convention.md` (`surfaceCode`, `CMP|W|API-{SURF}-{DOMAIN}-{NN}`).
4
+
5
+ ## Required sections
6
+
7
+ 1. **Surfaces** — channel / app → legacy repo path
8
+ 2. **Modules (`CMP-*`)** — feature groups → legacy module folder
9
+ 3. **Screens & APIs (`W-*`, `API-*`)** — leaf functions → legacy file paths
10
+ 4. **User flows (`FLOW-*`)** — see placement tiers below (mandatory when scan finds multi-step / cross-app journeys)
11
+ 5. **Common catalog (`CMN-*`)** — only if Common Analysis mode
12
+ 6. **Handoff** — `/legacy /spec`, `/legacy /user-flow`
13
+
14
+ ## User flow placement (maps to new docs hub)
15
+
16
+ | Tier | When to list | Target path after `/legacy /user-flow` |
17
+ | --- | --- | --- |
18
+ | **A — Cross-surface / org** | Same journey touches **≥2 surfaces** or **≥2 CMP owners** (checkout admin→customer, ops→partner API, SSO handoff) | `architecture/03-user-flows/FLOW-*.md` |
19
+ | **B — Surface shared** | Journey shared by **≥2 modules** on **one** surface | `surfaces/<surface>/common/user-flows/FLOW-*.md` |
20
+ | **C — Module / cluster** | Journey stays inside **one CMP** (or one cluster `CMP-*/NN/`) | `surfaces/<surface>/<CMP>/common/user-flows/FLOW-*.md` or `…/<CMP>/<NN>/common/user-flows/` |
21
+ | **D — Not a FLOW** | Single screen CRUD, one API call | Document only `W-*` / `API-*` — **do not** invent `FLOW-*` |
22
+
23
+ Each `FLOW-*` line MUST include:
24
+
25
+ - **Surfaces / CMPs involved** (e.g. `admin`, `CMP-ADM-ORD-01`, `customer-web`, `CMP-CUS-CART-01`)
26
+ - **Screen/API steps** (ordered `W-*` / `API-*` refs or legacy route names)
27
+ - **Legacy evidence** (router guards, saga classes, shared session keys, event names — file paths)
28
+ - **Suggested tier** (A / B / C)
29
+
30
+ ## Legacy scan hints (cross-surface)
31
+
32
+ Look for: redirect chains across subdomains/apps, shared `orderId`/`session` in multiple repos, BPM/orchestrator, “checkout” spanning cart (FE) + payment (API) + notification (worker), duplicate route names in 2+ legacy apps for one business journey.
@@ -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-{SURF}-{DOMAIN}-{NN}/index.md` — **MD only** (`product-id-convention.md`).
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`).
@@ -23,4 +23,4 @@ When executing any skill (`/spec`, `/grill`, `/grill-bqa`, etc.):
23
23
  6. **DSL / COMMON:** Human lead decides common promotions. The agent only executes `/common` (Markdown patterns), `/docs-mark`, custom-base handoff, or confirmation post-grill. `/spec` consumes patterns + FE base via `flowgrid-ux-common.mdc`. **[STRICTLY FORBIDDEN]** `common/yaml`, `/common-spec`, `/gen-common`.
24
24
  7. **ISOLATION:** Execute strictly within the invoked skill scope. **[STRICTLY FORBIDDEN]** to merge sibling features or output fake Markdown reports when YAML contracts are required.
25
25
 
26
- **Path SSOT:** `surfaces/<surface>/CMP-*/<slug>/` (NO `modules/` segment).
26
+ **Path SSOT:** `surfaces/<surface>/CMP-*/<slug>/` (NO `modules/` segment). **IDs:** `product-id-convention.md` (`surfaceCode` + `CMP|W|API-{SURF}-{DOMAIN}-{NN}`).