procedure-cli 0.1.13 → 0.1.15

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 (51) hide show
  1. package/README.md +8 -13
  2. package/dist/app.js +27 -15
  3. package/dist/app.js.map +1 -1
  4. package/dist/lib/template.js +1 -1
  5. package/dist/lib/template.js.map +1 -1
  6. package/dist/lib/types.d.ts +1 -1
  7. package/dist/steps/build-test.js +1 -1
  8. package/dist/steps/build-test.js.map +1 -1
  9. package/dist/steps/product-context.js +1 -1
  10. package/dist/steps/product-context.js.map +1 -1
  11. package/dist/steps/project-info.js +1 -1
  12. package/dist/steps/project-info.js.map +1 -1
  13. package/dist/steps/stack-style.js +44 -2
  14. package/dist/steps/stack-style.js.map +1 -1
  15. package/package.json +5 -1
  16. package/templates/gitignore +4 -0
  17. package/.claude/settings.local.json +0 -27
  18. package/.env.example +0 -2
  19. package/AGENTS.md +0 -134
  20. package/CLAUDE.md +0 -138
  21. package/CODE-FIXED.md +0 -252
  22. package/CODE-REVIEW.md +0 -558
  23. package/config/defaults.json +0 -8
  24. package/config/powerline-config.json +0 -52
  25. package/config/stacks/typescript-node.json +0 -15
  26. package/docs/GIAI-THICH-CLAUDE-MD.md +0 -206
  27. package/docs/PRD.md +0 -141
  28. package/docs/USER-STORIES.md +0 -324
  29. package/src/app.tsx +0 -213
  30. package/src/cli.tsx +0 -19
  31. package/src/components/banner.tsx +0 -23
  32. package/src/components/gutter-line.tsx +0 -16
  33. package/src/components/guttered-select.tsx +0 -231
  34. package/src/components/step-indicator.tsx +0 -32
  35. package/src/components/timeline.tsx +0 -57
  36. package/src/lib/fs.ts +0 -23
  37. package/src/lib/git.ts +0 -41
  38. package/src/lib/powerline.ts +0 -48
  39. package/src/lib/template.ts +0 -161
  40. package/src/lib/types.ts +0 -70
  41. package/src/providers/openai.ts +0 -5
  42. package/src/providers/zai.ts +0 -7
  43. package/src/steps/architecture.tsx +0 -72
  44. package/src/steps/build-test.tsx +0 -114
  45. package/src/steps/generation.tsx +0 -176
  46. package/src/steps/powerline.tsx +0 -254
  47. package/src/steps/product-context.tsx +0 -269
  48. package/src/steps/project-info.tsx +0 -183
  49. package/src/steps/stack-style.tsx +0 -304
  50. package/src/theme.ts +0 -15
  51. package/tsconfig.json +0 -17
@@ -1,206 +0,0 @@
1
- ---
2
- type: explainer
3
- project: claude-code-best-practices
4
- lang: vi
5
- created: 2026-02-20
6
- updated: 2026-02-20
7
- ---
8
-
9
- # CLAUDE.md — File "Luật Chơi" Cho AI
10
-
11
- > Tài liệu giải thích bằng tiếng Việt, dùng ngôn ngữ đơn giản, để đọc lại khi cần.
12
- > Xem template mẫu tại [[SUGGESTED-CLAUDE-MD]].
13
-
14
- ---
15
-
16
- ## CLAUDE.md Là Gì?
17
-
18
- Hãy tưởng tượng bạn thuê một lập trình viên mới vào team. Ngày đầu tiên, bạn sẽ nói gì với họ?
19
-
20
- - "Dự án này dùng TypeScript, build bằng `npm run build`"
21
- - "Luôn chạy test trước khi tạo PR"
22
- - "Đừng dùng `any` type — team mình không chấp nhận"
23
- - "Khi gặp bug, tự tìm root cause, đừng fix tạm"
24
-
25
- **CLAUDE.md chính là tập hợp những lời dặn dò đó**, nhưng dành cho AI (Claude). Nó là một file text đặt trong thư mục gốc của dự án, và Claude đọc nó mỗi khi bắt đầu làm việc.
26
-
27
- Boris Cherny — người tạo ra Claude Code — và team của anh ấy ở Anthropic dùng file này mỗi ngày. File của họ chỉ khoảng **2.500 từ** nhưng cực kỳ hiệu quả.
28
-
29
- ---
30
-
31
- ## Tại Sao Cần CLAUDE.md?
32
-
33
- Không có CLAUDE.md, Claude sẽ:
34
- - **Đoán mò** lệnh build (có thể dùng `npm` thay vì `bun`)
35
- - **Tự nghĩ ra** convention đặt tên (có thể khác với team bạn)
36
- - **Làm xong rồi nói "done"** mà không chạy test
37
- - **Lặp lại sai lầm cũ** vì không nhớ lần trước bị sửa
38
-
39
- Có CLAUDE.md, Claude sẽ:
40
- - Chạy đúng lệnh build/test
41
- - Tuân theo convention của team
42
- - Tự kiểm tra trước khi nói "xong"
43
- - Không lặp lại lỗi đã ghi trong Lessons
44
-
45
- ---
46
-
47
- ## Cấu Trúc 4 Tầng
48
-
49
- Phát hiện quan trọng nhất từ nghiên cứu: **hầu hết mọi người chỉ viết 1-2 trong 4 tầng cần thiết**, nên kết quả không ổn định.
50
-
51
- Ngoài 4 tầng trong CLAUDE.md, phương pháp procedure còn tạo thêm **PRD** (docs/PRD.md) và **User Stories** (docs/USER-STORIES.md) — giúp AI hiểu không chỉ cách code, mà còn sản phẩm là gì và cần xây cái gì.
52
-
53
- ### Tầng 1: Kiến Thức Dự Án — "Codebase này trông như thế nào?"
54
-
55
- Phần **cụ thể, máy móc**: lệnh build/test, convention code, kiến trúc, file quan trọng.
56
-
57
- Trong template: `Build & Test`, `Code Style`, `Architecture`
58
-
59
- **Nếu thiếu:** Claude đoán lệnh, tự nghĩ ra convention, phá vỡ kiến trúc.
60
-
61
- ### Tầng 2: Hợp Đồng Hành Vi — "Claude nên làm việc như thế nào?"
62
-
63
- Phần **quy tắc tư duy**, bao gồm 5 quy tắc:
64
-
65
- | Quy tắc | Ý nghĩa đơn giản | Ví dụ dễ hiểu |
66
- |---------|-------------------|----------------|
67
- | **Planning** | Task phức tạp → lên plan trước, rồi mới code | Không xây nhà mà không có bản vẽ |
68
- | **Verification** | Không nói "xong" mà chưa chứng minh nó chạy | Đầu bếp nếm thử trước khi bưng ra cho khách |
69
- | **Self-Improvement** | Mỗi lần bị sửa → ghi bài học → không lặp lại | Sau mỗi trận thua, ghi lại lý do |
70
- | **Bug Fixing** | Nhận bug report → tự tìm, tự sửa | Thợ ống nước giỏi không cần bạn chỉ ống nào rò |
71
- | **Elegance** | Task lớn → hỏi "có cách nào đẹp hơn?" | Nấu ăn ngon nhưng không cần trang trí cho bữa cơm gia đình |
72
-
73
- Trong template: `Workflow` section
74
-
75
- **Nếu thiếu:** Claude biết codebase nhưng làm việc cẩu thả — bỏ qua verification, không plan, không tự cải thiện.
76
-
77
- **Tip quan trọng nhất** theo Boris: Verification — tăng chất lượng lên 2-3 lần.
78
-
79
- ### Tầng 3: Hợp Đồng Phối Hợp — "Claude phối hợp nhiều agent như thế nào?"
80
-
81
- Phần **quản lý đội** (mới từ tháng 2/2026 với Agent Teams). 3 quy tắc vàng:
82
-
83
- 1. **Mỗi người sở hữu file riêng** — KHÔNG BAO GIỜ để 2 người sửa cùng 1 file
84
- - Ví dụ: thợ điện chỉ đi dây điện, thợ nước chỉ đi ống nước. 2 người cùng đục 1 bức tường → hỏng!
85
-
86
- 2. **Mô tả task phải đầy đủ** — teammate không biết context trước đó
87
- - Ví dụ: đừng nói "sửa cái lỗi hồi nãy" → hãy nói "sửa lỗi null pointer ở file src/auth.ts dòng 42"
88
-
89
- 3. **Nhắn riêng, không broadcast** — chỉ gửi tin nhắn chung khi thật sự cấp bách
90
-
91
- Trong template: `Task Management` section
92
-
93
- **Nếu thiếu:** Nhiều agent đụng nhau (sửa cùng file), thiếu context, task chạy loạn.
94
-
95
- **Giống như:** Nếu Tầng 2 là "luật chơi cho 1 người", thì Tầng 3 là "luật chơi cho cả đội".
96
-
97
- **3 cách chia việc song song:**
98
-
99
- | Cách | Khi nào dùng | Ví dụ |
100
- |------|-------------|-------|
101
- | **Subagent** | Việc nhỏ, một chiều | Sai người đi photocopy |
102
- | **Agent Team** | Nhiều người phối hợp | Dự án xây nhà |
103
- | **Git Worktree** | Việc hoàn toàn độc lập | 3 nhà hàng khác nhau |
104
-
105
- ### Tầng 4: Bộ Nhớ Sống — "Claude không được lặp lại sai lầm gì?"
106
-
107
- Phần **tích lũy theo thời gian**:
108
-
109
- ```
110
- ## Lessons
111
- - Không dùng `any` type — luôn định nghĩa interface rõ ràng
112
- - Container `--rm` flag không đáng tin — luôn thêm explicit `container rm`
113
- ```
114
-
115
- **Cách hoạt động:**
116
- 1. Claude mắc lỗi
117
- 2. Bạn sửa Claude
118
- 3. Bạn nói: *"Cập nhật CLAUDE.md để lần sau không mắc lại lỗi này"*
119
- 4. Claude tự viết rule cho chính nó
120
- 5. Rule được commit vào git → cả team hưởng lợi
121
-
122
- Trong template: `Lessons` section
123
-
124
- Boris gọi đây là **"chi phí của một sai lầm sinh lời mãi mãi"** — mỗi lần sửa lỗi là một khoản đầu tư.
125
-
126
- ---
127
-
128
- ## PRD và User Stories — Tại Sao AI Cần Biết "Sản Phẩm Là Gì"?
129
-
130
- 4 tầng CLAUDE.md giúp Claude biết **cách làm việc** — lệnh build gì, convention gì, phối hợp thế nào. Nhưng vẫn thiếu một thứ quan trọng: **Claude không biết sản phẩm là gì**.
131
-
132
- Hãy tưởng tượng bạn thuê một thợ mộc giỏi. Anh ta biết cách cưa gỗ, đóng đinh, đánh bóng (= CLAUDE.md). Nhưng nếu bạn không nói "tôi cần một cái tủ sách, cho phòng khách, cao 1m8" — anh ta sẽ làm gì? Đoán mò? Hỏi liên tục?
133
-
134
- **PRD (Product Requirements Document)** chính là bản mô tả "cái tủ sách" đó:
135
- - **Vấn đề** — tại sao cần sản phẩm này?
136
- - **Người dùng** — ai sẽ dùng?
137
- - **Tính năng** — cần làm gì?
138
- - **Không làm** — ranh giới ở đâu?
139
-
140
- **User Stories** là danh sách "việc cần làm" cụ thể:
141
- - "Là người dùng, tôi muốn đăng nhập bằng email, để không cần nhớ mật khẩu"
142
- - Kèm theo **tiêu chí chấp nhận** (Gherkin) — giống như checklist để biết việc đã xong chưa
143
-
144
- ### Tại Sao Không Chỉ CLAUDE.md Là Đủ?
145
-
146
- | Chỉ có CLAUDE.md | CLAUDE.md + PRD + User Stories |
147
- |---|---|
148
- | Claude biết cách code | Claude biết cách code **và** biết đang code cái gì |
149
- | Hỏi "feature này để làm gì?" | Tự đọc PRD, hiểu bối cảnh |
150
- | Viết code đúng convention nhưng sai mục đích | Viết code đúng convention **và** đúng mục đích |
151
- | Không biết khi nào nên nói "không, cái này out of scope" | Đọc Non-Goals, tự biết ranh giới |
152
-
153
- ### Cách Procedure Tạo PRD và User Stories
154
-
155
- Trong bước **Product Context** (bước 5 của wizard), bạn trả lời 4 câu hỏi:
156
- 1. Sản phẩm giải quyết vấn đề gì?
157
- 2. Ai là người dùng?
158
- 3. Tính năng chính là gì?
159
- 4. Cái gì KHÔNG làm?
160
-
161
- Procedure dùng câu trả lời để tạo `docs/PRD.md` và `docs/USER-STORIES.md`. Sau đó CLAUDE.md tham chiếu đến 2 file này — tạo thành bộ 3 hoàn chỉnh:
162
-
163
- - **CLAUDE.md** = luật chơi (HOW — làm thế nào)
164
- - **PRD** = bối cảnh sản phẩm (WHAT + WHY — cái gì và tại sao)
165
- - **User Stories** = việc cần làm (WHAT to build — xây cái gì, kiểm tra thế nào)
166
-
167
- Giống như xây nhà: CLAUDE.md là "quy tắc xây dựng", PRD là "bản vẽ kiến trúc", User Stories là "danh sách phòng cần xây".
168
-
169
- ---
170
-
171
- ## 3 Nguyên Tắc Cốt Lõi
172
-
173
- | Nguyên tắc | Giải thích |
174
- |-----------|-----------|
175
- | **Đơn giản là nhất** | Mỗi thay đổi phải đơn giản nhất có thể. Ít code = ít bug. |
176
- | **Không lười biếng** | Tìm nguyên nhân gốc. Không fix tạm. Chuẩn senior developer. |
177
- | **Ảnh hưởng tối thiểu** | Chỉ sửa những gì cần sửa. Đừng "tiện tay" sửa thêm thứ khác. |
178
-
179
- ---
180
-
181
- ## Cách Bắt Đầu (Ngày 1)
182
-
183
- Bắt đầu với 3 thứ:
184
-
185
- 1. **Lệnh build/test** — copy paste đúng lệnh của dự án
186
- 2. **Một convention** — quy tắc quan trọng nhất
187
- 3. **Một bài học** — lỗi gần nhất mà Claude mắc phải
188
-
189
- Sau đó, mỗi lần sửa Claude, nói: *"Cập nhật CLAUDE.md để lần sau không mắc lại."*
190
-
191
- File sẽ tự lớn lên theo thời gian — và đó chính là sức mạnh của nó.
192
-
193
- ---
194
-
195
- ## Cách Team (Con Người) Dùng CLAUDE.md
196
-
197
- - **Commit vào git** — cả team cùng hưởng lợi
198
- - **Review PR → cập nhật CLAUDE.md** — dùng `@.claude` để thêm bài học từ mỗi PR
199
- - **Prune thường xuyên** — xóa rule mà Claude không vi phạm nữa, gộp rule trùng lặp
200
- - **Giữ dưới 3.000 từ** — file ngắn và tập trung hiệu quả hơn file dài
201
-
202
- ---
203
-
204
- ## Tóm Tắt Một Câu
205
-
206
- > CLAUDE.md = luật chơi (HOW) + PRD = bối cảnh sản phẩm (WHAT + WHY) + User Stories = việc cần làm (WHAT to build) — ba thứ này cùng nhau giúp AI không chỉ code đúng, mà còn code đúng thứ.
package/docs/PRD.md DELETED
@@ -1,141 +0,0 @@
1
- # Procedure CLI — Product Requirements Document
2
-
3
- ## Vision
4
-
5
- Empower developers to start projects with production-ready documentation and architecture decisions from day one, reducing onboarding time and ensuring best practices are baked in from the first commit.
6
-
7
- ## Problem
8
-
9
- 1. **Boilerplate burden** — New projects lack consistent structure for CLAUDE.md, PRD, and user stories
10
- 2. **Documentation debt** — Teams postpone critical docs (architecture, requirements, acceptance criteria)
11
- 3. **Inconsistent onboarding** — Each project has different documentation standards and styles
12
- 4. **Time waste** — Developers manually create skeletal docs instead of focusing on code
13
- 5. **Missing context** — New contributors lack centralized product and technical context
14
-
15
- ## Users
16
-
17
- | User | Needs | Value |
18
- |------|-------|-------|
19
- | **Solo Developer** | Quick project setup with minimal config | Skip boilerplate, start coding faster |
20
- | **Team Lead** | Enforce documentation standards across projects | Consistency, faster onboarding, better reviews |
21
- | **New Contributor** | Understand project decisions and tech stack | Self-serve context, reduced onboarding calls |
22
- | **Product Manager** | Validate feature set and non-goals early | Clearer scope, better planning |
23
-
24
- ## Core Features
25
-
26
- **F-001: Interactive Project Wizard**
27
- - 7-step guided setup with Catppuccin Mocha timeline UI
28
- - `┌`/`└` corners wrap the full flow; animated dot on active step
29
- - Empty-directory guard: warns when cwd has files and continues — Step 6 overwrite confirmation handles conflicts
30
- - Validates required fields; ESC exits at any point; Enter exits on completion
31
- - In-step field navigation: `Tab` = next field, `Shift+Tab` = previous field, `Enter` = confirm; `↑`/`↓` retain their option-navigation role inside selects
32
-
33
- **F-002: CLAUDE.md Generation**
34
- - Code style and import conventions (from preset or manual config)
35
- - Build, test, typecheck, lint, and pre-PR commands
36
- - Architecture pattern with auto-generated best-practice notes
37
- - Workflow guidance (planning, verification, bug fixing, elegance)
38
- - Lessons learned section (AI-updatable)
39
-
40
- **F-003: PRD.md Generation**
41
- - Vision, problem statement, target users
42
- - Core features (F-001 format), non-goals, tech stack table
43
- - Success metrics placeholder, open questions section
44
-
45
- **F-004: USER-STORIES.md Generation**
46
- - Gherkin-formatted acceptance criteria
47
- - "As a / I want / So that" narrative format
48
- - Feature scenarios with Given/When/Then
49
- - Scaffolded from wizard-collected core features and user context
50
-
51
- **F-005: Environment & Config Files**
52
- - `.env.example` template with user-specified variables
53
- - `.gitignore` with language/framework-specific defaults
54
-
55
- **F-006: QuickStart Presets**
56
- - 6 one-click presets: TypeScript+Node, Next.js, React SPA, Python+FastAPI, Go, React Native+Expo
57
- - Each preset pre-fills stack, build, test, typecheck, lint, and pre-PR commands
58
- - "Configure manually →" option for custom language/framework/code-style
59
-
60
- **F-007: Setup & Tooling Integration (Optional)**
61
- Each option is explained before the yes/no prompt:
62
- - **Claude Powerline** — live status bar (git branch, context %, session cost, active tools); deployed via `npx` per session, no global install
63
- - **Git repository** — `git init` + initial commit containing all generated files
64
- - **npm release scripts** — creates `~/bin/<project>-release`; adds `release:patch`, `release:minor`, `release:major` to `package.json`; adapts commands to selected package manager
65
-
66
- ### Visual Style
67
-
68
- - **Theme:** Catppuccin Mocha Dark (mauve active, green complete, sapphire headers, overlay1 gutter)
69
- - **Layout:** `┌`/`│`/`└` vertical timeline with `┌` before step 1 and `└` after step 7
70
- - **Active step:** Animated dot cycling `◆ → ◈ → ◇ → ◈` at 350 ms
71
- - **Completed step:** `◇` (green); summary displayed on separate `│ ` line below
72
- - **Select menus:** Sliding window (5 visible at a time), `↑`/`↓` scroll indicators, `↑↓ move, enter select` hint
73
- - **Multi-select:** `●` selected, `○` unselected, space to toggle, enter to confirm; custom "Other" option via text input
74
-
75
- ## Non-Goals
76
-
77
- - IDE/editor integration (intentionally CLI-first)
78
- - Runtime code generation or plugins
79
- - Database schema generation
80
- - Frontend component scaffolding
81
- - Package template marketplace
82
- - `--quick` or `--update` CLI flags (wizard is always interactive)
83
- - Partial regeneration of individual files
84
-
85
- ## Tech Stack
86
-
87
- | Component | Technology | Purpose |
88
- |-----------|-----------|---------|
89
- | **Runtime** | Node.js + TypeScript | Type-safe CLI |
90
- | **UI** | Ink 6 + React 19 | Interactive terminal rendering |
91
- | **Templating** | Handlebars | Dynamic file generation |
92
- | **AI** | Vercel AI SDK 6, Z.ai, OpenAI | Optional AI-assisted generation |
93
- | **Build** | tsc | Fast compilation, strict mode |
94
-
95
- ## 7 Wizard Steps (Detailed)
96
-
97
- ### Step 1: Project Info
98
- - Inputs: Project name (required), description (required), package manager (select), license (select)
99
- - Outputs: Project metadata used across all generated files
100
-
101
- ### Step 2: Stack & Style
102
- - Inputs: QuickStart preset selection, or manual language + framework + code-style multi-selects
103
- - Outputs: Stack and style data; presets also pre-fill Step 3 commands
104
-
105
- ### Step 3: Build & Test
106
- - Inputs: Build, test, typecheck, lint, pre-PR commands (pre-filled if preset chosen)
107
- - Outputs: Development commands section in CLAUDE.md
108
-
109
- ### Step 4: Architecture
110
- - Inputs: Architecture pattern selection (7 options)
111
- - Outputs: Architecture section in CLAUDE.md with auto-generated best-practice notes
112
-
113
- ### Step 5: Product Context
114
- - Inputs: Problem statement, target users, tech stack (multi-select, prefilled from Step 2), core features (multi-select + custom), non-goals
115
- - Outputs: Data for PRD.md and USER-STORIES.md
116
-
117
- ### Step 6: Generation
118
- - Shows full summary of all collected inputs grouped by section
119
- - Warns about any existing files that will be overwritten
120
- - Confirm → writes all files; Skip → exits without writing
121
- - Outputs: CLAUDE.md, README.md, docs/PRD.md, docs/USER-STORIES.md, .env.example, .gitignore
122
-
123
- ### Step 7: Setup (Optional)
124
- - Three sequential yes/no prompts (Powerline, Git, Release scripts)
125
- - Each explained in detail before asking
126
- - All three can be independently enabled or skipped
127
- - Outputs: `.claude/` powerline config, git repo with initial commit, `~/bin/<project>-release`, updated `package.json`
128
-
129
- ## Success Metrics
130
-
131
- - **Adoption:** 100+ monthly runs within 3 months
132
- - **Time saved:** Average 10+ minutes per project setup
133
- - **User satisfaction:** 80%+ would recommend to teammates
134
- - **Documentation quality:** PRDs generated have 90%+ completeness
135
- - **Consistency:** 95%+ projects follow standard section format
136
-
137
- ## Open Questions
138
-
139
- - Should we support multiple AI models (Claude, GPT-4, local LLMs) for assisted generation?
140
- - Integration with GitHub Actions for CI/CD template generation?
141
- - Support for monorepo scaffolding (workspaces)?
@@ -1,324 +0,0 @@
1
- # Procedure CLI — User Stories
2
-
3
- ## US-001: Full Project Scaffolding
4
-
5
- **As a** new project owner
6
- **I want** to run a single command and answer guided questions
7
- **So that** I have a complete project with CLAUDE.md, PRD.md, and USER-STORIES.md
8
-
9
- ### Feature: Complete Wizard Execution
10
-
11
- ```gherkin
12
- Scenario: User completes full 7-step wizard
13
- Given a developer runs `npx @b3awesome/procedure` in an empty directory
14
- When they answer all wizard questions (project info, stack, build, architecture, product context)
15
- And confirm generation in Step 6
16
- Then CLAUDE.md, README.md, PRD.md, USER-STORIES.md, .env.example, and .gitignore are created
17
- And a success message displays with the project name and generated files listed
18
- And pressing Enter exits the CLI
19
- ```
20
-
21
- ```gherkin
22
- Scenario: Wizard validates required inputs
23
- Given the user is on Step 1 (Project Info)
24
- When they leave the project name empty and press Enter
25
- Then a validation error shows inline
26
- And the wizard does not advance until a valid name is entered
27
- ```
28
-
29
- ```gherkin
30
- Scenario: User skips generation
31
- Given the user reaches Step 6 (Generation)
32
- When they press N at the "Proceed?" prompt
33
- Then no files are written to disk
34
- And the final summary states "Generation was skipped — no files were written"
35
- ```
36
-
37
- ## US-002: Empty Directory Guard
38
-
39
- **As a** developer protecting an existing project
40
- **I want** the CLI to refuse to run in a non-empty directory
41
- **So that** I don't accidentally overwrite my existing files
42
-
43
- ### Feature: Pre-flight Directory Check
44
-
45
- ```gherkin
46
- Scenario: CLI warns when directory has existing files and continues
47
- Given a developer runs `npx @b3awesome/procedure` in a directory with files
48
- When the CLI starts
49
- Then a warning is printed listing up to 3 found files/directories
50
- And a recommendation to use an empty directory is shown
51
- And the wizard renders normally so the user can proceed
52
- And Step 6 (Generation) will list any files that would be overwritten before confirmation
53
- ```
54
-
55
- ```gherkin
56
- Scenario: CLI starts normally in an empty directory
57
- Given a developer runs `npx @b3awesome/procedure` in an empty directory
58
- When the CLI starts
59
- Then the wizard renders with the banner and Step 1 active
60
- ```
61
-
62
- ## US-003: QuickStart Presets
63
-
64
- **As a** developer who knows their stack
65
- **I want** to pick a preset and have all commands pre-filled
66
- **So that** I can scaffold a project in under 2 minutes without typing every command
67
-
68
- ### Feature: Stack & Style Presets
69
-
70
- ```gherkin
71
- Scenario: User selects a QuickStart preset
72
- Given the user is on Step 2 (Stack & Style)
73
- When they navigate to "TypeScript + Node.js" and press Enter
74
- Then Step 2 completes immediately with language, framework, and code style set
75
- And Step 3 (Build & Test) opens with build, test, typecheck, lint, and PR commands pre-filled
76
- ```
77
-
78
- ```gherkin
79
- Scenario: User switches to manual configuration
80
- Given the user is on Step 2 (Stack & Style) in QuickStart mode
81
- When they navigate to "Configure manually →" and press Enter
82
- Then they are shown the language multi-select
83
- And then the framework multi-select
84
- And then the code style multi-select
85
- And can choose any combination with custom "Other" input
86
- ```
87
-
88
- ```gherkin
89
- Scenario: Preset list shows scrollable options
90
- Given the user is on Step 2 (Stack & Style)
91
- When the preset list renders
92
- Then 5 presets are visible at a time
93
- And "↓ more" appears when additional options are below the visible window
94
- And pressing ↓ scrolls the window to reveal more presets
95
- ```
96
-
97
- ## US-004: Advanced Manual Configuration
98
-
99
- **As a** team lead defining custom standards
100
- **I want** to configure language, framework, and code style manually
101
- **So that** the output matches our team's exact conventions
102
-
103
- ### Feature: Detailed Customization
104
-
105
- ```gherkin
106
- Scenario: Full control over stack and style
107
- Given the user selects "Configure manually →" in Step 2
108
- When they choose multiple languages (e.g. TypeScript + Python)
109
- And choose multiple frameworks (e.g. Next.js + FastAPI)
110
- And select code style conventions with a custom "Other" rule
111
- Then CLAUDE.md includes the exact languages, frameworks, and conventions chosen
112
- ```
113
-
114
- ## US-005: Generation Review and Confirmation
115
-
116
- **As a** developer reviewing before committing
117
- **I want** to see a full summary of all my inputs before files are written
118
- **So that** I can catch mistakes without having to edit generated files
119
-
120
- ### Feature: Generation Summary Screen
121
-
122
- ```gherkin
123
- Scenario: Generation step shows all collected inputs
124
- Given the user reaches Step 6 (Generation)
125
- When the summary renders
126
- Then it shows Project Info, Stack & Style, Build & Test, Architecture, and Product Context
127
- And it lists all 6 files that will be generated
128
- And it warns "⚠ Will overwrite: <filename>" for any files that already exist
129
- ```
130
-
131
- ```gherkin
132
- Scenario: Overwrite warning shown for existing files
133
- Given the target directory already contains CLAUDE.md
134
- When the user reaches Step 6 (Generation)
135
- Then a peach-colored warning lists CLAUDE.md as a file that will be overwritten
136
- And the user must confirm before any writing occurs
137
- ```
138
-
139
- ## US-006: PRD Generation with Full Context
140
-
141
- **As a** product manager
142
- **I want** the PRD to capture vision, problem, users, and core features
143
- **So that** stakeholders understand scope without separate meetings
144
-
145
- ### Feature: Comprehensive PRD Output
146
-
147
- ```gherkin
148
- Scenario: PRD includes all required sections
149
- Given the user completes Step 5 (Product Context)
150
- When they provide problem statement, user context, core features, and non-goals
151
- Then PRD.md contains Vision, Problem, Users, Core Features, Non-Goals, Tech Stack, and Success Metrics
152
- And core features are formatted as F-001 through F-NNN entries
153
- ```
154
-
155
- ## US-007: User Stories with Gherkin Format
156
-
157
- **As a** QA engineer
158
- **I want** user stories with Gherkin acceptance criteria
159
- **So that** I can write automated tests and track feature completion
160
-
161
- ### Feature: Structured User Stories
162
-
163
- ```gherkin
164
- Scenario: USER-STORIES.md includes Gherkin scenarios
165
- Given the user provides core features in Step 5
166
- When files are generated in Step 6
167
- Then USER-STORIES.md contains US-NNN headers with "As a / I want / So that" format
168
- And each story includes one or more Scenario blocks with Given/When/Then syntax
169
- ```
170
-
171
- ## US-008: Visual Timeline Progress
172
-
173
- **As a** new user
174
- **I want** to see a visual timeline of all steps with clear current-step indication
175
- **So that** I always know where I am and what's left
176
-
177
- ### Feature: Timeline Progress Indicator
178
-
179
- ```gherkin
180
- Scenario: Timeline shows completed, active, and pending steps
181
- Given the user is on Step 3 (Build & Test)
182
- When they view the terminal
183
- Then the timeline shows:
184
- - ◇ Project Info (green, completed, with summary below)
185
- - ◇ Stack & Style (green, completed, with summary below)
186
- - ◆ Build & Test (mauve animated dot, active)
187
- - ○ Architecture (dim, pending)
188
- - ○ Product Context (dim, pending)
189
- - ○ Generation (dim, pending)
190
- - ○ Setup (dim, pending)
191
- And ┌ appears before step 1 and └ appears after step 7
192
- ```
193
-
194
- ```gherkin
195
- Scenario: Completed step summary appears below step name
196
- Given the user completes Step 1 (Project Info)
197
- When the timeline advances to Step 2
198
- Then below "Project Info" on a separate │ line, the summary shows the entered name and description
199
- ```
200
-
201
- ## US-009: Optional Tooling Setup
202
-
203
- **As a** developer setting up a new project
204
- **I want** to optionally initialize git, configure Claude Powerline, and add release scripts
205
- **So that** my project has proper version control and publish tooling from day one
206
-
207
- ### Feature: Setup Step
208
-
209
- ```gherkin
210
- Scenario: User enables all three setup options
211
- Given the wizard is on Step 7 (Setup)
212
- When the user answers Yes to Powerline, Yes to Git, and Yes to release scripts
213
- Then .claude/ powerline configuration is created
214
- And git init runs and an initial commit is made with the generated files
215
- And ~/bin/<project>-release is created with the correct package manager commands
216
- And package.json is created (or updated) with release:patch, release:minor, and release:major scripts
217
- ```
218
-
219
- ```gherkin
220
- Scenario: Each setup option is explained before asking
221
- Given the wizard is on Step 7 (Setup)
222
- When the Powerline question renders
223
- Then an explanation is shown describing what Powerline does before the yes/no prompt
224
- And the same applies to the Git and release script questions
225
- ```
226
-
227
- ```gherkin
228
- Scenario: Git init is skipped gracefully when nothing to commit
229
- Given the user enables Git setup
230
- When git init runs but there are no files to commit (generation was skipped)
231
- Then a warning message is shown explaining why the commit was skipped
232
- And the setup step completes without error
233
- ```
234
-
235
- ```gherkin
236
- Scenario: Release script skipped when it already exists
237
- Given ~/bin/<project>-release already exists
238
- When the user enables release script setup
239
- Then a message confirms the existing script was skipped
240
- And package.json release scripts are still applied if not already present
241
- ```
242
-
243
- ## US-010: In-Step Field Navigation
244
-
245
- **As a** developer who made a typo in a previous field
246
- **I want** to navigate back and forward between inputs within the current step
247
- **So that** I can fix mistakes without restarting the step from scratch
248
-
249
- ### Feature: ↑/↓ Field Navigation
250
-
251
- ```gherkin
252
- Scenario: User navigates back to a previous field within a step
253
- Given the user is on Step 3 (Build & Test) with "Test command" active
254
- When they press Shift+Tab
255
- Then "Build command" becomes active again with its previously saved value restored
256
- And "Test command" becomes invisible (not yet re-confirmed)
257
- ```
258
-
259
- ```gherkin
260
- Scenario: User navigates forward using Tab
261
- Given the user has gone back to "Build command" in Step 3
262
- When they press Tab
263
- Then the current value (typed or previously saved) is kept
264
- And "Test command" becomes active again
265
- ```
266
-
267
- ```gherkin
268
- Scenario: Tab on a required empty field shows error
269
- Given the user is on "Build command" in Step 3
270
- And the field is empty with no saved value
271
- When they press Tab
272
- Then a validation error is shown
273
- And the field index does not advance
274
- ```
275
-
276
- ```gherkin
277
- Scenario: Navigation hint is shown below each input field
278
- Given the user is on any input field within a step
279
- When the field renders
280
- Then a hint line shows the available navigation keys
281
- And "Shift+Tab prev" is omitted when on the first field
282
- And "Tab next" is replaced by "Tab / Enter confirm" on the last field
283
- ```
284
-
285
- ```gherkin
286
- Scenario: Tab and Shift+Tab work on select fields too
287
- Given the user is on "Package manager" select (Step 1)
288
- When they press Shift+Tab
289
- Then the "Description" text input becomes active again
290
- When they press Tab
291
- Then the "License" select becomes active
292
- And ↑↓ continue to navigate options within the select as normal
293
- ```
294
-
295
- ```gherkin
296
- Scenario: Shift+Tab in Setup step navigates between confirm questions
297
- Given the user is on the "Initialize git repo?" question in Step 7
298
- When they press Shift+Tab
299
- Then the "Set up Powerline?" question is shown again
300
- And the user can re-answer it
301
- ```
302
-
303
- ## US-011: Escape and Graceful Exit
304
-
305
- **As a** developer who changed their mind
306
- **I want** to exit the wizard at any point
307
- **So that** I don't have to complete all steps or kill the process manually
308
-
309
- ### Feature: ESC to Exit
310
-
311
- ```gherkin
312
- Scenario: ESC exits the wizard at any step
313
- Given the user is anywhere in the 7-step wizard
314
- When they press Escape
315
- Then the CLI exits cleanly with no files written
316
- ```
317
-
318
- ```gherkin
319
- Scenario: Enter exits after completion
320
- Given the wizard has completed all 7 steps
321
- When the final success screen is shown
322
- Then pressing Enter exits the CLI
323
- And the final timeline shows all steps as completed with their summaries
324
- ```