@educa-corp/sdd-framework 0.4.0 → 0.5.0

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 (158) hide show
  1. package/bin/build.js +9 -0
  2. package/bin/index.js +115 -4
  3. package/bin/self-check.js +354 -0
  4. package/bin/trace-schema.json +1199 -0
  5. package/commands/debug.md +19 -12
  6. package/commands/define-product.md +19 -12
  7. package/commands/dev-gen-test.md +53 -19
  8. package/commands/dev-run-test.md +55 -20
  9. package/commands/dev-run-test.tmpl +2 -1
  10. package/commands/dev-smoke-test.md +19 -12
  11. package/commands/extend-prd.md +907 -0
  12. package/commands/extend-prd.tmpl +270 -0
  13. package/commands/fix-bug.md +101 -15
  14. package/commands/fix-bug.tmpl +29 -3
  15. package/commands/generate-architecture.md +19 -12
  16. package/commands/generate-bdd.md +174 -48
  17. package/commands/generate-bdd.tmpl +107 -18
  18. package/commands/generate-code.md +122 -29
  19. package/commands/generate-code.tmpl +69 -10
  20. package/commands/generate-design-spec.md +19 -12
  21. package/commands/generate-prd.md +44 -12
  22. package/commands/generate-prd.tmpl +25 -0
  23. package/commands/generate-spec-manifest.md +19 -12
  24. package/commands/generate-tech-docs.md +22 -15
  25. package/commands/generate-tech-docs.tmpl +2 -2
  26. package/commands/learn.md +19 -12
  27. package/commands/map-testids.md +19 -12
  28. package/commands/propose-scenario.md +91 -15
  29. package/commands/propose-scenario.tmpl +72 -3
  30. package/commands/qc-analyze.md +19 -12
  31. package/commands/qc-design-test.md +20 -12
  32. package/commands/qc-design-test.tmpl +1 -0
  33. package/commands/qc-plan.md +19 -12
  34. package/commands/qc-report.md +19 -12
  35. package/commands/qc-review.md +19 -12
  36. package/commands/qc-run-test.md +88 -22
  37. package/commands/qc-run-test.tmpl +35 -3
  38. package/commands/refine-prd.md +19 -12
  39. package/commands/report-bug.md +19 -12
  40. package/commands/review-code.md +60 -14
  41. package/commands/review-code.tmpl +41 -2
  42. package/commands/review-context.md +62 -16
  43. package/commands/review-context.tmpl +43 -4
  44. package/commands/review-tech-docs.md +50 -14
  45. package/commands/review-tech-docs.tmpl +31 -2
  46. package/commands/setup-ai-first.md +26 -16
  47. package/commands/setup-ai-first.tmpl +7 -4
  48. package/commands/sync.md +43 -18
  49. package/commands/sync.tmpl +37 -14
  50. package/commands/update-framework.md +43 -4
  51. package/commands/update-framework.tmpl +37 -0
  52. package/commands/validate-traces.md +481 -49
  53. package/commands/validate-traces.tmpl +462 -37
  54. package/core/FRAMEWORK_VERSION +1 -1
  55. package/core/README.md +56 -0
  56. package/core/commands/debug.md +19 -12
  57. package/core/commands/define-product.md +19 -12
  58. package/core/commands/dev-gen-test.md +53 -19
  59. package/core/commands/dev-run-test.md +55 -20
  60. package/core/commands/dev-smoke-test.md +19 -12
  61. package/core/commands/extend-prd.md +907 -0
  62. package/core/commands/fix-bug.md +101 -15
  63. package/core/commands/generate-architecture.md +19 -12
  64. package/core/commands/generate-bdd.md +174 -48
  65. package/core/commands/generate-code.md +122 -29
  66. package/core/commands/generate-design-spec.md +19 -12
  67. package/core/commands/generate-prd.md +44 -12
  68. package/core/commands/generate-spec-manifest.md +19 -12
  69. package/core/commands/generate-tech-docs.md +22 -15
  70. package/core/commands/learn.md +19 -12
  71. package/core/commands/map-testids.md +19 -12
  72. package/core/commands/propose-scenario.md +91 -15
  73. package/core/commands/qc-analyze.md +19 -12
  74. package/core/commands/qc-design-test.md +20 -12
  75. package/core/commands/qc-plan.md +19 -12
  76. package/core/commands/qc-report.md +19 -12
  77. package/core/commands/qc-review.md +19 -12
  78. package/core/commands/qc-run-test.md +88 -22
  79. package/core/commands/refine-prd.md +19 -12
  80. package/core/commands/report-bug.md +19 -12
  81. package/core/commands/review-code.md +60 -14
  82. package/core/commands/review-context.md +62 -16
  83. package/core/commands/review-tech-docs.md +50 -14
  84. package/core/commands/setup-ai-first.md +26 -16
  85. package/core/commands/sync.md +43 -18
  86. package/core/commands/update-framework.md +43 -4
  87. package/core/commands/validate-traces.md +481 -49
  88. package/core/modules/android-compose/stack-profile.yaml +1 -1
  89. package/core/modules/flutter/stack-profile.yaml +1 -1
  90. package/core/modules/ios-swiftui/stack-profile.yaml +1 -1
  91. package/core/modules/java-spring/stack-profile.yaml +1 -1
  92. package/core/modules/nextjs/stack-profile.yaml +1 -1
  93. package/core/modules/nuxt/stack-profile.yaml +1 -1
  94. package/core/modules/phaser-game/stack-profile.yaml +1 -1
  95. package/core/modules/php-laravel/stack-profile.yaml +1 -1
  96. package/core/modules/qc-playwright/stack-profile.yaml +1 -1
  97. package/core/modules/react/stack-profile.yaml +1 -1
  98. package/core/modules/react-native/stack-profile.yaml +1 -1
  99. package/core/modules/vue/stack-profile.yaml +1 -1
  100. package/core/rules/workflow.md +29 -0
  101. package/core/steps/gate.md +13 -8
  102. package/core/steps/report-footer.md +6 -4
  103. package/core/steps/trace-mirror.md +34 -7
  104. package/core/templates/README.md +47 -0
  105. package/core/templates/feature.template +14 -11
  106. package/core/templates/project-context.yaml +26 -14
  107. package/core/templates/tech-design.template.md +1 -1
  108. package/docs/01-getting-started/installation.md +18 -1
  109. package/docs/01-getting-started/what-is-sdd.md +4 -2
  110. package/docs/02-concepts/architecture.md +27 -3
  111. package/docs/02-concepts/pipeline-steps/02-specification.md +39 -3
  112. package/docs/02-concepts/pipeline-steps/04-bdd.md +24 -2
  113. package/docs/02-concepts/pipeline-steps/05-tech-docs.md +18 -1
  114. package/docs/02-concepts/pipeline-steps/06-code.md +35 -4
  115. package/docs/02-concepts/pipeline-steps/09-validate-traces.md +137 -12
  116. package/docs/02-concepts/pipeline-steps/10-feedback-loop.md +59 -3
  117. package/docs/02-concepts/roles-and-hitl.md +1 -1
  118. package/docs/02-concepts/traceability.md +126 -94
  119. package/docs/03-guides/developer.md +20 -4
  120. package/docs/03-guides/product-owner.md +72 -68
  121. package/docs/03-guides/tester-qa.md +81 -70
  122. package/docs/04-reference/commands.md +134 -105
  123. package/docs/04-reference/configuration.md +146 -94
  124. package/docs/04-reference/trace-schema.md +145 -37
  125. package/docs/explain/02-generate-prd.md +80 -78
  126. package/docs/explain/02b-extend-prd.md +125 -0
  127. package/docs/explain/03-refine-prd.md +86 -86
  128. package/docs/explain/04-review-context.md +18 -1
  129. package/docs/explain/06-generate-bdd.md +23 -0
  130. package/docs/explain/08-review-tech-docs.md +20 -5
  131. package/docs/explain/10-review-code.md +36 -2
  132. package/docs/explain/19-qc-run-test.md +87 -67
  133. package/docs/explain/21-validate-traces.md +74 -68
  134. package/docs/explain/23-fix-bug.md +19 -3
  135. package/docs/explain/26-propose-scenario.md +70 -63
  136. package/docs/explain/README.md +135 -134
  137. package/modules/android-compose/stack-profile.yaml +1 -1
  138. package/modules/flutter/stack-profile.yaml +1 -1
  139. package/modules/ios-swiftui/stack-profile.yaml +1 -1
  140. package/modules/java-spring/stack-profile.yaml +1 -1
  141. package/modules/nextjs/stack-profile.yaml +1 -1
  142. package/modules/nuxt/stack-profile.yaml +1 -1
  143. package/modules/phaser-game/stack-profile.yaml +1 -1
  144. package/modules/php-laravel/stack-profile.yaml +1 -1
  145. package/modules/qc-playwright/stack-profile.yaml +1 -1
  146. package/modules/react/stack-profile.yaml +1 -1
  147. package/modules/react-native/stack-profile.yaml +1 -1
  148. package/modules/vue/stack-profile.yaml +1 -1
  149. package/package.json +5 -4
  150. package/rules/workflow.md +29 -0
  151. package/scripts/migrate-bdd-platform.js +286 -0
  152. package/steps/gate.md +13 -8
  153. package/steps/report-footer.md +6 -4
  154. package/steps/trace-mirror.md +34 -7
  155. package/templates/README.md +47 -0
  156. package/templates/feature.template +14 -11
  157. package/templates/project-context.yaml +26 -14
  158. package/templates/tech-design.template.md +1 -1
@@ -1,18 +1,18 @@
1
1
  # ============================================================
2
2
  # @trace.id: {TICKET-ID}-UC{N}
3
3
  # @trace.title: <Feature name>
4
- # @trace.revision: 1 ← field tĩnh; dùng @trace.bdd_version để theo dõi version (tăng bởi /review-context --fix hoặc --resume)
4
+ # @trace.revision: 1 ← field tĩnh; version theo dõi bằng @trace.bdd_version
5
5
  # @trace.domain: <domain>
6
- # @trace.platform: {active_platform — web | app | system | (bỏ trong umbrella mode)}
7
- # @trace.service: {active_service — bỏ trong spec repo mode}
6
+ # @trace.platform: {active_platform — web | app | system} ← BẮT BUỘC mọi mode; phải khớp segment bdd/{platform}/ của path
7
+ # @trace.service: {active_service — BẮT BUỘC mọi mode. "—" ở single-service/spec repo mode; "multi" nếu chưa chốt; "unresolved" nếu routing sai. Nguồn của cột TSV `service` — trace gộp không tách theo service nên đây là chỗ DUY NHẤT mang thông tin sở hữu}
8
8
  # @trace.module: {active_module trong umbrella mode; "unknown" trong spec repo mode}
9
9
  # @trace.status: draft
10
10
  # @trace.author: AI-generated
11
11
  # @trace.created_at: {YYYY-MM-DD}
12
12
  # @trace.prd: {TICKET-ID}
13
13
  # @trace.prd_version: {đọc từ metadata PRD "| **Version** |"}
14
- # @trace.bdd_version: {1.0 nếu gen mới; tăng 0.1 khi gen lại vd 1.0 1.1}
15
- # @trace.business_rules: {TICKET-ID}-UC{N}-BR1, {TICKET-ID}-UC{N}-BR2
14
+ # @trace.bdd_version: {cấp FILE — 1.0 nếu gen mới; tăng 0.1 khi gen lại. Khác @trace.sc_version (cấp từng SC) bên dưới}
15
+ # @trace.business_rules: {TICKET-ID}-UC{N}-BR{m}, {TICKET-ID}-UC{N}-BR{m+1} ← {m} lấy NGUYÊN từ PRD §3: BR đánh số LIÊN TỤC toàn PRD, KHÔNG reset theo UC
16
16
  # @trace.dataset: {domain}.testdata.yaml
17
17
  # ============================================================
18
18
 
@@ -59,8 +59,8 @@ Feature: <Feature name>
59
59
 
60
60
  # Side-effects: <liệt kê ngắn các Then side-effect cần verify>
61
61
  # @trace.scenario: {TICKET-ID}-UC{N}-SC1
62
- # @trace.sc_version: 1.0
63
- # @trace.business_rules: {TICKET-ID}-UC{N}-BR1
62
+ # @trace.sc_version: 1.0 ← cấp SCENARIO. Sửa thân SC này (tên/step/table/side-effect) thì +0.1, nếu không code cũ mãi hiện OK
63
+ # @trace.business_rules: {TICKET-ID}-UC{N}-BR{m}
64
64
  @happy
65
65
  Scenario: <mô tả business outcome — dùng động từ chính xác: create/receive/assign/block>
66
66
  Given <input state — alias từ dataset>
@@ -71,7 +71,7 @@ Feature: <Feature name>
71
71
  # Side-effects: <...>
72
72
  # @trace.scenario: {TICKET-ID}-UC{N}-SC2
73
73
  # @trace.sc_version: 1.0
74
- # @trace.business_rules: {TICKET-ID}-UC{N}-BR1
74
+ # @trace.business_rules: {TICKET-ID}-UC{N}-BR{m}
75
75
  @happy @alternative
76
76
  Scenario: <cùng theme NHÓM 1 nhưng path khác — vd: giá trị enum khác>
77
77
  Given <state>
@@ -85,7 +85,7 @@ Feature: <Feature name>
85
85
  # Side-effects: <...>
86
86
  # @trace.scenario: {TICKET-ID}-UC{N}-SC3
87
87
  # @trace.sc_version: 1.0
88
- # @trace.business_rules: {TICKET-ID}-UC{N}-BR2
88
+ # @trace.business_rules: {TICKET-ID}-UC{N}-BR{m+2}
89
89
  @edge
90
90
  Scenario: <scenario boundary / error>
91
91
  Given <state>
@@ -97,8 +97,8 @@ Feature: <Feature name>
97
97
  # AC1 (...) → SC1, SC2
98
98
  # AC2 (...) → SC3
99
99
  # BR mapping (mỗi bullet PHẢI có ≥1 SC — C.2):
100
- # {TICKET-ID}-UC{N}-BR1 (...) → SC1, SC2
101
- # {TICKET-ID}-UC{N}-BR2 (...) → SC3
100
+ # {TICKET-ID}-UC{N}-BR{m} (...) → SC1, SC2
101
+ # {TICKET-ID}-UC{N}-BR{m+2} (...) → SC3
102
102
  # Wireframe mapping (mỗi component/action ≥1 SC — C.1):
103
103
  # Screen "<screen name>":
104
104
  # [x] <action 1> → SC1
@@ -111,6 +111,9 @@ Feature: <Feature name>
111
111
 
112
112
  # === PRE-MERGE CHECKLIST ===
113
113
  # - [ ] Mỗi SC có Side-effects + @trace.scenario + @trace.sc_version + @trace.business_rules
114
+ # - [ ] SỬA nội dung một SC (tên / step / data table / side-effect) → đã bump @trace.sc_version của
115
+ # CHÍNH SC đó (+0.1). Quên bump = code sinh từ SC cũ vẫn hiện OK, không ai biết phải regen.
116
+ # (Đổi @trace.business_rules / tag / comment → KHÔNG bump: không đổi hành vi cần implement.)
114
117
  # - [ ] Coverage Matrix: 0 dòng MISSING (C.1)
115
118
  # - [ ] FE/App: mỗi Screen State (≠default) + AC-UI behavioral của design-spec có ≥1 SC (C.1 mở rộng)
116
119
  # - [ ] Mỗi AC/BR map tới ≥1 SC (C.2)
@@ -25,28 +25,41 @@ project:
25
25
  # All paths are relative to workspace root.
26
26
  paths:
27
27
  # Feature-Package Layout:
28
- # specs/{domain}/{prd-slug}/{TICKET-ID}-{prd-slug}.md — PRD document
29
- # specs/{domain}/{prd-slug}/bdd/ — BDD .feature files
30
- # specs/{domain}/{prd-slug}/tech-docs/ — Technical design docs
31
- # specs/{domain}/{prd-slug}/design-spec/ — Design specs (FE/App only)
32
- # .trace/{domain}/{prd-slug}/{UC-ID}.tsv Trace state
28
+ # specs/{domain}/{prd-slug}/{TICKET-ID}-{prd-slug}.md — PRD document
29
+ # specs/{domain}/{prd-slug}/bdd/{platform}/ — BDD .feature ({platform} = web | app | system)
30
+ # specs/{domain}/{prd-slug}/tech-docs/ — Technical design (ONE merged doc per PRD: {TICKET-ID}-tech-design.md)
31
+ # specs/{domain}/{prd-slug}/design-spec/ — Design specs (FE/App only)
32
+ # specs/{domain}/{prd-slug}/changelog/ PRD changelog overflow (created once history exceeds 5 versions)
33
+ # .trace/{domain}/{prd-slug}/{UC-ID}-{platform}.tsv — Trace state (ONE book per UC × platform)
34
+ #
35
+ # The {platform} segment is NOT optional — in any mode, including umbrella.
36
+ # A UC's `web` and `system` features are two different files; without the segment they
37
+ # collide on one filename and overwrite each other. Trace is split the same way, so the
38
+ # spec layout has to match it. Every .feature also carries `@trace.platform` matching
39
+ # its own {platform} segment. (Projects still on the old flat bdd/ layout:
40
+ # run `npx @educa-corp/sdd-framework --migrate-bdd-platform` — dry-run by default.)
33
41
  #
34
42
  # specs_dir is the unified root for all spec artifact types (PRD, BDD, tech-docs, design-spec).
35
43
  # prd-slug is derived from the PRD folder path — not a separate config variable.
36
44
  specs_dir: "specs"
37
- templates_dir: "specs/templates"
38
45
 
39
46
  # Source code root — gốc mã nguồn của service/app này (nơi generate-code đặt & quét code).
40
47
  # BE thường suy vị trí từ CLAUDE.md §2 (code_base_package + layer); src_dir là gốc chung,
41
48
  # và là NGUỒN CHÍNH cho FE (component/hook/service/adapter) + phạm vi quét reuse (DS5).
42
49
  # Ví dụ: "src" (mono FE), "app/src", "src/main/java" (BE). Chỉnh theo layout thật của repo.
43
50
  src_dir: "src"
44
- feature_template: ".agent/templates/feature.template" # SoT skeleton .feature (dùng bởi /generate-bdd qua {{include}})
45
- bdd_writing_guide: "specs/templates/bdd-writing-guide.md"
46
- trace_report: "specs/.trace/trace-report.md"
47
51
 
48
- # PRD template (PRDs are at specs/{domain}/{prd-slug}/{TICKET-ID}-{prd-slug}.md)
49
- prd_template: "specs/templates/prd.template.md"
52
+ # ── Template artifact KHÔNG cấu hình được ──
53
+ # Đã bỏ 6 key chết (không lệnh nào đọc): feature_template · prd_template ·
54
+ # templates_dir · bdd_writing_guide · product_definition_template · trace_report.
55
+ # Các skeleton được {{include}} NƯỚNG CỨNG vào file lệnh lúc `npm run build`,
56
+ # nên lệnh không bao giờ đọc một path template lúc chạy.
57
+ # (trace_report còn trỏ sai hẳn: report thật là {trace_dir}/trace-report.json.)
58
+ #
59
+ # Đổi cấu trúc .feature / PRD sinh ra = sửa templates/*.template* TRONG REPO
60
+ # FRAMEWORK rồi build lại. Sửa .agent/templates/* trong project KHÔNG có tác
61
+ # dụng, và sẽ bị GHI ĐÈ IM LẶNG ở lần /update-framework kế tiếp (--init copy
62
+ # core/ → .agent/ vô điều kiện; file duy nhất được giữ là .agent/project-context.yaml).
50
63
  refinement_dir: ".agent/review"
51
64
 
52
65
  # QC's OWN analysis/design working docs (qc-analyze/plan/design-test outputs:
@@ -66,7 +79,6 @@ paths:
66
79
 
67
80
  # Product Definitions
68
81
  product_definitions_dir: "specs/product-definition"
69
- product_definition_template: "specs/templates/product-definition.template.md"
70
82
 
71
83
  # Domain Knowledge
72
84
  domain_knowledge_dir: "specs/domain-knowledge"
@@ -90,7 +102,7 @@ paths:
90
102
  # This variable is no longer needed as a separate path — derived from specs_dir.
91
103
  # design_spec_dir: "specs/design-spec" ← removed; use specs_dir instead
92
104
 
93
- # Trace (internal structure: .trace/{domain}/{prd-slug}/{UC-ID}.tsv)
105
+ # Trace (internal structure: .trace/{domain}/{prd-slug}/{UC-ID}-{platform}.tsv — one book per UC × platform)
94
106
  trace_dir: ".trace"
95
107
 
96
108
  # Tester / QC feedback (written by /report-bug and /propose-scenario).
@@ -133,7 +145,7 @@ domains:
133
145
  # specs_dir → {spec_source}/specs # unified root — PRD/BDD/tech-docs/design-spec
134
146
  # tech_docs_dir → {spec_source}/specs # merged into specs_dir
135
147
  # domain_knowledge_dir → {spec_source}/specs/domain-knowledge
136
- # trace_dir → {spec_source}/.trace # structure: .trace/{domain}/{prd-slug}/{UC-ID}.tsv
148
+ # trace_dir → {spec_source}/.trace # structure: .trace/{domain}/{prd-slug}/{UC-ID}-{platform}.tsv
137
149
  # (You can still override these manually in paths: section below.)
138
150
  # With spec_source set, only ONE override is needed instead of four separate dir vars.
139
151
  #
@@ -40,7 +40,7 @@
40
40
  @trace.service: {service — từ header BDD @trace.service}
41
41
  @trace.module: {module liên quan — vd dotnet, angular}
42
42
  @trace.platforms: {system | web | app — tuỳ thư mục BDD nào tồn tại}
43
- @trace.bdd_version: {map theo từng platform — vd system=1.5, web=1.9, app=1.7; chỉ platform có mặt. Mỗi feature mang bdd_version riêng; đừng gộp về một số.}
43
+ @trace.bdd_versions: {MAP theo từng platform — số nhiều, KHÁC @trace.bdd_version (scalar) của .feature — vd system=1.5, web=1.9, app=1.7; chỉ platform có mặt. Mỗi feature mang bdd_version riêng; đừng gộp về một số.}
44
44
  @trace.api_source: {existing | —}
45
45
  @trace.revision: 1
46
46
  @trace.status: draft