@anhth2/spec-driven-dev-plugin 0.6.0 → 0.8.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 (86) hide show
  1. package/bin/index.js +285 -11
  2. package/commands/debug.md +233 -11
  3. package/commands/debug.tmpl +170 -6
  4. package/commands/define-product.md +68 -6
  5. package/commands/define-product.tmpl +5 -1
  6. package/commands/fix-bug.md +111 -11
  7. package/commands/fix-bug.tmpl +48 -6
  8. package/commands/generate-bdd.md +86 -9
  9. package/commands/generate-bdd.tmpl +23 -4
  10. package/commands/generate-code.md +146 -19
  11. package/commands/generate-code.tmpl +83 -14
  12. package/commands/generate-design-spec.md +754 -0
  13. package/commands/generate-design-spec.tmpl +399 -0
  14. package/commands/generate-prd.md +91 -7
  15. package/commands/generate-prd.tmpl +28 -2
  16. package/commands/generate-spec-manifest.md +519 -0
  17. package/commands/generate-spec-manifest.tmpl +164 -0
  18. package/commands/generate-tech-docs.md +122 -9
  19. package/commands/generate-tech-docs.tmpl +59 -4
  20. package/commands/generate-tests.md +491 -37
  21. package/commands/generate-tests.tmpl +428 -32
  22. package/commands/refine-prd.md +76 -8
  23. package/commands/refine-prd.tmpl +13 -3
  24. package/commands/review-code.md +94 -6
  25. package/commands/review-code.tmpl +31 -1
  26. package/commands/review-context.md +118 -12
  27. package/commands/review-context.tmpl +55 -7
  28. package/commands/review-tech-docs.md +76 -9
  29. package/commands/review-tech-docs.tmpl +13 -4
  30. package/commands/run-tests.md +196 -18
  31. package/commands/run-tests.tmpl +133 -13
  32. package/commands/setup-ai-first.md +192 -6
  33. package/commands/setup-ai-first.tmpl +136 -5
  34. package/commands/smoke-test.md +228 -22
  35. package/commands/smoke-test.tmpl +165 -17
  36. package/commands/validate-traces.md +77 -8
  37. package/commands/validate-traces.tmpl +14 -3
  38. package/core/FRAMEWORK_VERSION +1 -1
  39. package/core/commands/debug.md +233 -11
  40. package/core/commands/define-product.md +68 -6
  41. package/core/commands/fix-bug.md +111 -11
  42. package/core/commands/generate-bdd.md +86 -9
  43. package/core/commands/generate-code.md +146 -19
  44. package/core/commands/generate-design-spec.md +754 -0
  45. package/core/commands/generate-prd.md +91 -7
  46. package/core/commands/generate-spec-manifest.md +519 -0
  47. package/core/commands/generate-tech-docs.md +122 -9
  48. package/core/commands/generate-tests.md +491 -37
  49. package/core/commands/refine-prd.md +76 -8
  50. package/core/commands/review-code.md +94 -6
  51. package/core/commands/review-context.md +118 -12
  52. package/core/commands/review-tech-docs.md +76 -9
  53. package/core/commands/run-tests.md +196 -18
  54. package/core/commands/setup-ai-first.md +192 -6
  55. package/core/commands/smoke-test.md +228 -22
  56. package/core/commands/validate-traces.md +77 -8
  57. package/core/skills/code/SKILL.md +68 -8
  58. package/core/skills/debug/SKILL.md +72 -10
  59. package/core/skills/design-spec/SKILL.md +450 -0
  60. package/core/skills/discovery/SKILL.md +62 -4
  61. package/core/skills/prd/SKILL.md +12 -8
  62. package/core/skills/setup-ai-first/SKILL.md +5 -3
  63. package/core/skills/spec/SKILL.md +11 -7
  64. package/core/skills/test/SKILL.md +130 -12
  65. package/core/steps/context-loader.md +57 -1
  66. package/core/steps/gate.md +1 -1
  67. package/core/steps/report-footer.md +5 -3
  68. package/core/steps/spawn-agent.md +3 -1
  69. package/core/templates/design-spec.template.md +209 -0
  70. package/core/templates/project-context.yaml +29 -0
  71. package/package.json +1 -1
  72. package/skills/code/SKILL.md +68 -8
  73. package/skills/debug/SKILL.md +72 -10
  74. package/skills/design-spec/SKILL.md +450 -0
  75. package/skills/design-spec/SKILL.tmpl +95 -0
  76. package/skills/discovery/SKILL.md +62 -4
  77. package/skills/prd/SKILL.md +12 -8
  78. package/skills/setup-ai-first/SKILL.md +5 -3
  79. package/skills/spec/SKILL.md +11 -7
  80. package/skills/test/SKILL.md +130 -12
  81. package/steps/context-loader.md +57 -1
  82. package/steps/gate.md +1 -1
  83. package/steps/report-footer.md +5 -3
  84. package/steps/spawn-agent.md +3 -1
  85. package/templates/design-spec.template.md +209 -0
  86. package/templates/project-context.yaml +29 -0
@@ -0,0 +1,209 @@
1
+ # {TICKET-ID} {Feature Name} — Design Spec [{Platform}]
2
+
3
+ <!--
4
+ Template này được sử dụng bởi /generate-design-spec.
5
+ Platform = web | app | app-ios | app-android
6
+
7
+ PLATFORM SECTIONS:
8
+ - Section 3A + 4A: chỉ dành cho web (react/nextjs/vue/angular). Xóa C khi dùng cho web.
9
+ - Section 3C + 4B: chỉ dành cho app (flutter/react-native/ios/android). Xóa A+B khi dùng cho app.
10
+
11
+ COMPONENT MAPPING (bắt buộc):
12
+ - Mọi component trong Component Inventory PHẢI được map với figma-components/{module}.md
13
+ - ✅ Matched → dùng Code Component và Import Path từ catalog
14
+ - ⚠️ TODO → đánh dấu [TODO — chưa implement]
15
+ - ❌ Chưa có → đánh dấu [NEW — cần confirm với designer]
16
+
17
+ SCREEN STATES (bắt buộc mỗi màn):
18
+ - Tối thiểu: default, loading, error
19
+ - Thêm "empty" nếu màn có thể hiển thị trạng thái không có dữ liệu
20
+ - Thêm "success" nếu action tạo ra trạng thái xác nhận riêng biệt
21
+ -->
22
+
23
+ ---
24
+
25
+ ## Metadata
26
+
27
+ | Field | Value |
28
+ |--------------------|---------------------------------------------------------------|
29
+ | **Spec ID** | {TICKET-ID}-DS-{platform} |
30
+ | **Version** | 1.0 |
31
+ | **Status** | draft / approved |
32
+ | **Platform** | {web \| app \| app-ios \| app-android} |
33
+ | **Module** | {active_module} |
34
+ | **Service** | {active_service} |
35
+ | **Domain** | {domain} |
36
+ | **Business PRD** | [{TICKET-ID}](./{TICKET-ID}-slug.md) |
37
+ | **Figma** | {figma_url or TBD} |
38
+ | **Author** | {PO name or "AI-assisted"} |
39
+ | **Created** | {YYYY-MM-DD} |
40
+ | **Updated** | {YYYY-MM-DD} |
41
+
42
+ ---
43
+
44
+ # 1. Screen Inventory
45
+
46
+ | # | Screen Name | Entry Point | Figma Frame | Notes |
47
+ |---|-------------|-------------|-------------|-------|
48
+ | 1 | {Screen 1} | {how user arrives} | [Frame]({figma_url}) | |
49
+ | 2 | {Screen 2} | {entry point} | [Frame]({figma_url}) | |
50
+
51
+ ---
52
+
53
+ # 2. Screen Specs
54
+
55
+ ## Screen 1: {Screen Name}
56
+
57
+ **Figma**: [{Frame name}]({figma_frame_url})
58
+
59
+ ### Layout
60
+
61
+ {Grid / max-width / padding / spacing — reference design tokens where applicable}
62
+
63
+ ### Component Inventory
64
+
65
+ | Component (Figma) | Code Component | Import Path | States | Notes |
66
+ |------------------------|----------------|------------------------|---------------------------------|---------|
67
+ | {Figma/Button/Primary} | Button | @/components/ui/Button | default, loading, disabled | |
68
+ | {Figma/Input/Text} | TextInput | @/components/ui/Input | default, focus, error, disabled | |
69
+
70
+ ### Screen States
71
+
72
+ | State | Trigger | UI Behavior |
73
+ |-----------|----------------------------------|----------------------------------------------------------|
74
+ | default | Screen loaded, data available | {Describe full rendered appearance} |
75
+ | loading | API call in flight | {Skeleton / spinner position and style} |
76
+ | error | API failure / validation error | {Toast / inline error / error screen + recovery CTA} |
77
+ | empty | No data returned | {Illustration + CTA — e.g., "No items yet. Add one →"} |
78
+ | success | Action completed (if applicable) | {Confirmation toast / navigation / visual change} |
79
+
80
+ ### Actions & Navigation
81
+
82
+ | Action | Trigger | Result |
83
+ |-----------------|---------------------------|---------------------------------------------------|
84
+ | {Action name} | Tap/click {element} | Navigate to {Screen N} / Open {Modal name} |
85
+ | {Back/Cancel} | Back gesture / button | Return to {previous screen} without saving |
86
+
87
+ ---
88
+
89
+ <!-- Repeat ## Screen N for each additional screen -->
90
+
91
+ ---
92
+
93
+ # 3. Interaction Patterns
94
+
95
+ <!-- === WEB ONLY — delete this section for app === -->
96
+
97
+ ## A. Responsive Behavior *(web)*
98
+
99
+ | Breakpoint | Width | Layout Changes |
100
+ |------------|------------|---------------------------------------------|
101
+ | Mobile | < 768px | {Single column, bottom nav, full-width CTA} |
102
+ | Tablet | 768–1279px | {2-col grid, sidebar collapsed} |
103
+ | Desktop | ≥ 1280px | {Full layout, max-width 1440px} |
104
+
105
+ ## B. Hover / Focus / Keyboard *(web)*
106
+
107
+ | Element | Hover | Focus | Keyboard |
108
+ |----------------|-------------------------------|---------------------------------|---------------|
109
+ | Primary button | Background → {color.hover} | Outline 2px {color.focus} | Enter / Space |
110
+ | Text input | Border → {color.border.hover} | Border → {color.primary} | Tab to focus |
111
+
112
+ <!-- === APP ONLY — delete sections A+B for app === -->
113
+
114
+ ## C. Gestures & Navigation *(app)*
115
+
116
+ | Gesture | Screen / Element | Behavior |
117
+ |----------------------|---------------------|---------------------------------------------|
118
+ | Back gesture | All screens | {Return / show "Discard changes?" dialog} |
119
+ | Pull-to-refresh | {Screen names} | Refresh data, spinner at top |
120
+ | Swipe left on row | {List item} | Reveal {Delete / Archive} action |
121
+
122
+ ### Navigation Stack *(app)*
123
+
124
+ ```
125
+ {e.g., BottomTab(Home) → ListPage → DetailPage → EditPage}
126
+ ```
127
+
128
+ ### Platform Conventions *(app)*
129
+
130
+ | Aspect | iOS | Android |
131
+ |------------------|-------------------------------------------|-------------------------------------|
132
+ | Navigation bar | Back button top-left, title centered | Up arrow, title left-aligned |
133
+ | Bottom sheet | UISheetPresentation, grabber visible | BottomSheet, drag handle |
134
+ | Dialog | Actions right-aligned | Actions left-aligned |
135
+
136
+ ---
137
+
138
+ # 4. Platform Considerations
139
+
140
+ <!-- === WEB ONLY === -->
141
+
142
+ ## A. Accessibility *(web)*
143
+
144
+ - [ ] All interactive elements reachable by Tab key — no keyboard traps
145
+ - [ ] Focus trap inside modals
146
+ - [ ] Icon-only buttons have `aria-label`
147
+ - [ ] Dynamic content announces via `aria-live`
148
+ - [ ] WCAG AA contrast: text ≥ 4.5:1, large text ≥ 3:1
149
+ - [ ] Form inputs have visible labels (not placeholder-only)
150
+
151
+ <!-- === APP ONLY === -->
152
+
153
+ ## B. Device & OS *(app)*
154
+
155
+ - [ ] Safe area insets applied (top + bottom) on all screens
156
+ - [ ] Minimum touch target: 44×44pt (iOS) / 48×48dp (Android)
157
+ - [ ] Tested on 375pt (iPhone SE) and 360dp (small Android)
158
+ - [ ] Deep link: `{scheme}://{host}/{path}` → {screen name}
159
+ - [ ] Permissions: {Camera / Location / Notification} — rationale copy TBD
160
+ - [ ] Offline: {screen name} shows cached data + banner; {action} disabled with tooltip
161
+ - [ ] Dark mode tested — no hardcoded colors
162
+
163
+ ---
164
+
165
+ # 5. AC-UI — Design Acceptance Criteria
166
+
167
+ > Reviewed and signed off by **PO + Designer** before BDD generation.
168
+ > Complements business-level AC in [Business PRD](./{TICKET-ID}-slug.md).
169
+
170
+ | ID | Acceptance Criterion | Verified by |
171
+ |--------|--------------------------------------------------------------------------|-----------------|
172
+ | AC-UI1 | All screens match approved Figma frames within design-system tolerances | Designer |
173
+ | AC-UI2 | Loading state appears within 200ms of any API call initiation | QA |
174
+ | AC-UI3 | All error messages are visible, descriptive, and include a recovery CTA | PO |
175
+ | AC-UI4 | Empty states include illustration and call-to-action | PO + Designer |
176
+ | AC-UI5 | {Platform-specific criterion} | QA |
177
+
178
+ ---
179
+
180
+ # Appendix
181
+
182
+ ## Figma Summary
183
+
184
+ | Screen | Figma Frame | Status |
185
+ |------------|----------------------|--------------------------------|
186
+ | {Screen 1} | [Link]({url}) | ✅ Ready / ⏳ WIP / ❌ Missing |
187
+
188
+ ## Design Tokens Referenced
189
+
190
+ | Token | Value | Used in |
191
+ |-------------------|----------|----------------------------|
192
+ | `color.primary` | {#hex} | Buttons, links |
193
+ | `spacing.md` | {16px} | Standard vertical gap |
194
+
195
+ ## References
196
+
197
+ - [{TICKET-ID}](./{TICKET-ID}-slug.md) — Business PRD
198
+
199
+ ## AI Assumptions
200
+
201
+ - {Assumption — [AI DRAFT]}
202
+
203
+ ---
204
+
205
+ ## Changelog
206
+
207
+ | Version | Date | Changes |
208
+ |---------|--------------|-----------------|
209
+ | 1.0 | {YYYY-MM-DD} | Initial version |
@@ -48,6 +48,9 @@ paths:
48
48
  # Tech Docs
49
49
  tech_docs_dir: "tech-docs"
50
50
 
51
+ # Design Specs (FE/App platforms only — web, app)
52
+ design_spec_dir: "specs/design-spec"
53
+
51
54
  # Trace
52
55
  trace_dir: ".trace"
53
56
 
@@ -69,6 +72,32 @@ domains:
69
72
  - "{{DOMAIN_1}}"
70
73
  # - "{{DOMAIN_2}}"
71
74
 
75
+ # ----- Multi-Service / Umbrella Setup -----
76
+ # Fill this section ONLY if this is an UMBRELLA repo that contains multiple
77
+ # service submodules. Leave commented out for single-service projects.
78
+ #
79
+ # setup:
80
+ # mode: umbrella # "umbrella" | "single" (default: single)
81
+ # spec_source: "{{SPEC_SUBMODULE_PATH}}" # path to PO spec submodule, e.g. "free-trial-specs"
82
+ #
83
+ # When spec_source is set, context-loader auto-derives:
84
+ # prd_dir → {spec_source}/specs/prd
85
+ # design_spec_dir → {spec_source}/specs/design-spec
86
+ # domain_knowledge_dir → {spec_source}/specs/domain-knowledge
87
+ # (You can still override these manually in paths: section below.)
88
+ #
89
+ # services: # domain → service submodule routing
90
+ # {{DOMAIN_1}}: # must match @trace.domain in PRD files
91
+ # path: "{{SERVICE_SUBMODULE_DIR}}" # relative path to service submodule
92
+ # module: "{{STACK_MODULE}}" # e.g., java-spring, nextjs, flutter
93
+ # specs_dir: "{{SERVICE_SUBMODULE_DIR}}/specs/bdd"
94
+ # tech_docs_dir: "{{SERVICE_SUBMODULE_DIR}}/specs/tech-docs"
95
+ # {{DOMAIN_2}}:
96
+ # path: "{{SERVICE_2_DIR}}"
97
+ # module: "{{STACK_MODULE}}"
98
+ # specs_dir: "{{SERVICE_2_DIR}}/specs/bdd"
99
+ # tech_docs_dir: "{{SERVICE_2_DIR}}/specs/tech-docs"
100
+
72
101
  # ----- Architecture -----
73
102
  architecture:
74
103
  style: "{{ARCH_STYLE}}" # e.g., Layered / Clean / Hexagonal