@educa-corp/sdd-framework 0.3.0 → 0.4.2

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 (126) hide show
  1. package/bin/build.js +9 -0
  2. package/bin/index.js +115 -4
  3. package/bin/self-check.js +236 -0
  4. package/bin/trace-schema.json +692 -0
  5. package/commands/debug.md +82 -17
  6. package/commands/define-product.md +82 -17
  7. package/commands/dev-gen-test.md +82 -17
  8. package/commands/dev-run-test.md +84 -18
  9. package/commands/dev-run-test.tmpl +2 -1
  10. package/commands/dev-smoke-test.md +82 -17
  11. package/commands/fix-bug.md +137 -20
  12. package/commands/fix-bug.tmpl +29 -3
  13. package/commands/generate-architecture.md +82 -17
  14. package/commands/generate-bdd.md +187 -44
  15. package/commands/generate-bdd.tmpl +92 -17
  16. package/commands/generate-code.md +115 -20
  17. package/commands/generate-code.tmpl +33 -3
  18. package/commands/generate-design-spec.md +82 -17
  19. package/commands/generate-prd.md +82 -17
  20. package/commands/generate-spec-manifest.md +82 -17
  21. package/commands/generate-tech-docs.md +85 -20
  22. package/commands/generate-tech-docs.tmpl +2 -2
  23. package/commands/learn.md +82 -17
  24. package/commands/map-testids.md +82 -17
  25. package/commands/propose-scenario.md +102 -19
  26. package/commands/propose-scenario.tmpl +20 -2
  27. package/commands/qc-analyze.md +82 -17
  28. package/commands/qc-design-test.md +82 -17
  29. package/commands/qc-plan.md +82 -17
  30. package/commands/qc-report.md +82 -17
  31. package/commands/qc-review.md +82 -17
  32. package/commands/qc-run-test.md +104 -19
  33. package/commands/qc-run-test.tmpl +22 -2
  34. package/commands/refine-prd.md +82 -17
  35. package/commands/report-bug.md +82 -17
  36. package/commands/review-code.md +122 -19
  37. package/commands/review-code.tmpl +40 -2
  38. package/commands/review-context.md +124 -21
  39. package/commands/review-context.tmpl +42 -4
  40. package/commands/review-tech-docs.md +113 -19
  41. package/commands/review-tech-docs.tmpl +31 -2
  42. package/commands/setup-ai-first.md +35 -16
  43. package/commands/setup-ai-first.tmpl +19 -6
  44. package/commands/sync.md +15 -4
  45. package/commands/sync.tmpl +12 -2
  46. package/commands/update-framework.md +40 -2
  47. package/commands/update-framework.tmpl +37 -0
  48. package/commands/validate-traces.md +231 -25
  49. package/commands/validate-traces.tmpl +149 -8
  50. package/core/FRAMEWORK_VERSION +1 -1
  51. package/core/README.md +56 -0
  52. package/core/commands/debug.md +82 -17
  53. package/core/commands/define-product.md +82 -17
  54. package/core/commands/dev-gen-test.md +82 -17
  55. package/core/commands/dev-run-test.md +84 -18
  56. package/core/commands/dev-smoke-test.md +82 -17
  57. package/core/commands/fix-bug.md +137 -20
  58. package/core/commands/generate-architecture.md +82 -17
  59. package/core/commands/generate-bdd.md +187 -44
  60. package/core/commands/generate-code.md +115 -20
  61. package/core/commands/generate-design-spec.md +82 -17
  62. package/core/commands/generate-prd.md +82 -17
  63. package/core/commands/generate-spec-manifest.md +82 -17
  64. package/core/commands/generate-tech-docs.md +85 -20
  65. package/core/commands/learn.md +82 -17
  66. package/core/commands/map-testids.md +82 -17
  67. package/core/commands/propose-scenario.md +102 -19
  68. package/core/commands/qc-analyze.md +82 -17
  69. package/core/commands/qc-design-test.md +82 -17
  70. package/core/commands/qc-plan.md +82 -17
  71. package/core/commands/qc-report.md +82 -17
  72. package/core/commands/qc-review.md +82 -17
  73. package/core/commands/qc-run-test.md +104 -19
  74. package/core/commands/refine-prd.md +82 -17
  75. package/core/commands/report-bug.md +82 -17
  76. package/core/commands/review-code.md +122 -19
  77. package/core/commands/review-context.md +124 -21
  78. package/core/commands/review-tech-docs.md +113 -19
  79. package/core/commands/setup-ai-first.md +35 -16
  80. package/core/commands/sync.md +15 -4
  81. package/core/commands/update-framework.md +40 -2
  82. package/core/commands/validate-traces.md +231 -25
  83. package/core/modules/android-compose/stack-profile.yaml +1 -1
  84. package/core/modules/flutter/stack-profile.yaml +1 -1
  85. package/core/modules/ios-swiftui/stack-profile.yaml +1 -1
  86. package/core/modules/java-spring/stack-profile.yaml +1 -1
  87. package/core/modules/nextjs/stack-profile.yaml +1 -1
  88. package/core/modules/nuxt/stack-profile.yaml +1 -1
  89. package/core/modules/phaser-game/stack-profile.yaml +1 -1
  90. package/core/modules/php-laravel/stack-profile.yaml +1 -1
  91. package/core/modules/qc-playwright/stack-profile.yaml +1 -1
  92. package/core/modules/react/stack-profile.yaml +1 -1
  93. package/core/modules/react-native/stack-profile.yaml +1 -1
  94. package/core/modules/vue/stack-profile.yaml +1 -1
  95. package/core/rules/workflow.md +11 -0
  96. package/core/steps/context-loader.md +66 -7
  97. package/core/steps/gate.md +13 -8
  98. package/core/steps/report-footer.md +3 -2
  99. package/core/templates/README.md +47 -0
  100. package/core/templates/feature.template +13 -10
  101. package/core/templates/project-context.yaml +49 -17
  102. package/core/templates/tech-design.template.md +1 -1
  103. package/docs/02-concepts/traceability.md +29 -6
  104. package/docs/04-reference/trace-schema.md +128 -37
  105. package/modules/android-compose/stack-profile.yaml +1 -1
  106. package/modules/flutter/stack-profile.yaml +1 -1
  107. package/modules/ios-swiftui/stack-profile.yaml +1 -1
  108. package/modules/java-spring/stack-profile.yaml +1 -1
  109. package/modules/nextjs/stack-profile.yaml +1 -1
  110. package/modules/nuxt/stack-profile.yaml +1 -1
  111. package/modules/phaser-game/stack-profile.yaml +1 -1
  112. package/modules/php-laravel/stack-profile.yaml +1 -1
  113. package/modules/qc-playwright/stack-profile.yaml +1 -1
  114. package/modules/react/stack-profile.yaml +1 -1
  115. package/modules/react-native/stack-profile.yaml +1 -1
  116. package/modules/vue/stack-profile.yaml +1 -1
  117. package/package.json +50 -49
  118. package/rules/workflow.md +11 -0
  119. package/scripts/migrate-bdd-platform.js +286 -0
  120. package/steps/context-loader.md +66 -7
  121. package/steps/gate.md +13 -8
  122. package/steps/report-footer.md +3 -2
  123. package/templates/README.md +47 -0
  124. package/templates/feature.template +13 -10
  125. package/templates/project-context.yaml +49 -17
  126. package/templates/tech-design.template.md +1 -1
@@ -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,14 +145,16 @@ 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
  #
140
152
  # services: # domain → service submodule routing
141
153
  # # Each domain key MUST match the PRD's `Domain` (Metadata row) / folder path segment.
142
- # # A domain value has TWO forms — context-loader (Step 1.5) auto-detects by whether
143
- # # `path` is present directly:
154
+ # # A domain value has THREE forms — context-loader (Step 1.5) auto-detects in this order:
155
+ # # has `path` FORM A (resolved)
156
+ # # has `by_prd_slug` → FORM C (look up one more level)
157
+ # # otherwise → FORM B (per-platform map)
144
158
  # #
145
159
  # # FORM A — FLAT (one domain ↔ one submodule, all platforms):
146
160
  # {{DOMAIN_1}}:
@@ -157,6 +171,22 @@ domains:
157
171
  # web: { path: "{{WEB_SUBMODULE_DIR}}", module: "nextjs" }
158
172
  # app: { path: "{{APP_SUBMODULE_DIR}}", module: "flutter" }
159
173
  # #
174
+ # # FORM C — PER-PRD_SLUG MAP (one routing cell ↔ MANY submodules, one per feature-package).
175
+ # # Use when a platform — or a whole domain — is split into one repo per feature,
176
+ # # e.g. each webview mini-game lives in its own repo. No `path`; instead a
177
+ # # `by_prd_slug` table keyed by the feature-package folder name. context-loader
178
+ # # already extracted prd_slug in Step 1, so no extra detection is needed.
179
+ # # Valid at BOTH levels: directly under the domain, or nested under a platform.
180
+ # {{DOMAIN_3}}:
181
+ # system: { path: "{{BE_SUBMODULE_DIR}}", module: "java-spring" } # normal entry
182
+ # webview: # this cell → many repos
183
+ # by_prd_slug:
184
+ # {{PRD_SLUG_1}}: { path: "games/{{GAME_1}}", module: "phaser-game" }
185
+ # {{PRD_SLUG_2}}: { path: "games/{{GAME_2}}", module: "phaser-game" }
186
+ # # A prd_slug with no entry → active_service = unresolved (the command STOPS rather than
187
+ # # guessing a lookalike repo). An entry with BOTH `path` and `by_prd_slug` is a config
188
+ # # error, as is nesting `by_prd_slug` inside `by_prd_slug`.
189
+ # #
160
190
  # # NOTE: with spec_source set, BDD + tech-docs are cross-team and live in the spec repo —
161
191
  # # do NOT pin per-service specs_dir / tech_docs_dir here (they would be ignored).
162
192
  # # Per-service specs_dir / tech_docs_dir apply ONLY when there is no spec_source.
@@ -169,7 +199,9 @@ domains:
169
199
  # root, so without a service CLAUDE.md, code generation falls back to umbrella defaults
170
200
  # + the module stack-profile (a ⚠️ is flagged in the context recap). Generate one per
171
201
  # service via /setup-ai-first inside each. For FORM B, add one CLAUDE.md per platform
172
- # submodule ({system|web|app}.path/CLAUDE.md).
202
+ # submodule ({system|web|app}.path/CLAUDE.md). For FORM C, one per feature repo
203
+ # (by_prd_slug.{slug}.path/CLAUDE.md) — these repos usually share a stack, so the fastest
204
+ # route is to write one and copy it, adjusting the parts that actually differ.
173
205
 
174
206
  # ----- Architecture -----
175
207
  architecture:
@@ -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