viepilot 1.0.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 (84) hide show
  1. package/CHANGELOG.md +230 -0
  2. package/LICENSE +23 -0
  3. package/README.md +550 -0
  4. package/bin/viepilot.cjs +222 -0
  5. package/bin/vp-tools.cjs +912 -0
  6. package/dev-install.sh +109 -0
  7. package/docs/README.md +125 -0
  8. package/docs/advanced-usage.md +366 -0
  9. package/docs/api/README.md +12 -0
  10. package/docs/api/graphql-schema.md +5 -0
  11. package/docs/api/kafka-events.md +5 -0
  12. package/docs/api/rest-api.md +19 -0
  13. package/docs/api/websocket-api.md +5 -0
  14. package/docs/dev/architecture.md +226 -0
  15. package/docs/dev/cli-reference.md +324 -0
  16. package/docs/dev/contributing.md +195 -0
  17. package/docs/dev/deployment.md +204 -0
  18. package/docs/dev/getting-started.md +16 -0
  19. package/docs/dev/testing.md +171 -0
  20. package/docs/dev/ui-components-library.md +36 -0
  21. package/docs/getting-started.md +163 -0
  22. package/docs/skills-reference.md +399 -0
  23. package/docs/troubleshooting.md +297 -0
  24. package/docs/user/faq.md +117 -0
  25. package/docs/user/features/autonomous-mode.md +111 -0
  26. package/docs/user/features/checkpoint-recovery.md +76 -0
  27. package/docs/user/features/debug-mode.md +77 -0
  28. package/docs/user/features/ui-direction.md +29 -0
  29. package/docs/user/quick-start.md +157 -0
  30. package/docs/videos/01-installation.md +113 -0
  31. package/docs/videos/02-first-project.md +132 -0
  32. package/docs/videos/03-autonomous-mode.md +147 -0
  33. package/install.sh +144 -0
  34. package/lib/cli-shared.cjs +108 -0
  35. package/package.json +78 -0
  36. package/skills/vp-audit/SKILL.md +140 -0
  37. package/skills/vp-auto/SKILL.md +204 -0
  38. package/skills/vp-brainstorm/SKILL.md +75 -0
  39. package/skills/vp-crystallize/SKILL.md +175 -0
  40. package/skills/vp-debug/SKILL.md +96 -0
  41. package/skills/vp-docs/SKILL.md +258 -0
  42. package/skills/vp-evolve/SKILL.md +165 -0
  43. package/skills/vp-pause/SKILL.md +150 -0
  44. package/skills/vp-request/SKILL.md +250 -0
  45. package/skills/vp-resume/SKILL.md +141 -0
  46. package/skills/vp-rollback/SKILL.md +116 -0
  47. package/skills/vp-status/SKILL.md +137 -0
  48. package/skills/vp-task/SKILL.md +139 -0
  49. package/skills/vp-ui-components/SKILL.md +64 -0
  50. package/templates/phase/PHASE-STATE.md +35 -0
  51. package/templates/phase/SPEC.md +40 -0
  52. package/templates/phase/SUMMARY.md +67 -0
  53. package/templates/phase/TASK.md +101 -0
  54. package/templates/phase/VERIFICATION.md +49 -0
  55. package/templates/project/AI-GUIDE.md +114 -0
  56. package/templates/project/ARCHITECTURE.md +70 -0
  57. package/templates/project/CHANGELOG.md +36 -0
  58. package/templates/project/CONTRIBUTING.md +154 -0
  59. package/templates/project/CONTRIBUTORS.md +41 -0
  60. package/templates/project/PROJECT-CONTEXT.md +74 -0
  61. package/templates/project/PROJECT-META.md +133 -0
  62. package/templates/project/README.md +197 -0
  63. package/templates/project/ROADMAP.md +56 -0
  64. package/templates/project/SYSTEM-RULES.md +368 -0
  65. package/templates/project/TRACKER.md +50 -0
  66. package/ui-components/INDEX.md +9 -0
  67. package/ui-components/base/button/README.md +8 -0
  68. package/ui-components/base/button/metadata.json +8 -0
  69. package/ui-components/base/card/README.md +8 -0
  70. package/ui-components/base/card/metadata.json +8 -0
  71. package/ui-components/base/input/README.md +8 -0
  72. package/ui-components/base/input/metadata.json +8 -0
  73. package/workflows/audit.md +549 -0
  74. package/workflows/autonomous.md +425 -0
  75. package/workflows/brainstorm.md +257 -0
  76. package/workflows/crystallize.md +418 -0
  77. package/workflows/debug.md +241 -0
  78. package/workflows/documentation.md +587 -0
  79. package/workflows/evolve.md +258 -0
  80. package/workflows/pause-work.md +255 -0
  81. package/workflows/request.md +534 -0
  82. package/workflows/resume-work.md +226 -0
  83. package/workflows/rollback.md +202 -0
  84. package/workflows/ui-components.md +109 -0
@@ -0,0 +1,425 @@
1
+ <purpose>
2
+ Autonomous execution của project phases. Cho mỗi phase: analyze → execute tasks → verify → iterate.
3
+ Pauses at control points cho user decisions.
4
+ </purpose>
5
+
6
+ <process>
7
+
8
+ <step name="initialize">
9
+ ## 1. Initialize
10
+
11
+ Parse `{{VP_ARGS}}` for flags:
12
+ - `--from N` : Start từ phase N
13
+ - `--phase N` : Chỉ chạy phase N
14
+ - `--fast` : Skip optional verifications
15
+ - `--dry-run` : Plan only
16
+
17
+ Load context:
18
+ ```bash
19
+ cat .viepilot/AI-GUIDE.md
20
+ cat .viepilot/TRACKER.md
21
+ cat .viepilot/ROADMAP.md
22
+ ```
23
+
24
+ Display startup banner:
25
+ ```
26
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
27
+ VIEPILOT ► AUTONOMOUS
28
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
29
+
30
+ Project: {project_name}
31
+ Milestone: {milestone}
32
+ Phases: {total} total, {completed} complete
33
+ ```
34
+ </step>
35
+
36
+ <step name="discover_phases">
37
+ ## 2. Discover Phases
38
+
39
+ Parse ROADMAP.md for phases.
40
+
41
+ Filter to incomplete phases:
42
+ - Status != "complete"
43
+ - Apply --from filter if provided
44
+ - Sort by phase number
45
+
46
+ If no incomplete phases:
47
+ ```
48
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
49
+ VIEPILOT ► COMPLETE 🎉
50
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
51
+
52
+ All phases complete!
53
+
54
+ Next steps:
55
+ - /vp-docs to generate documentation
56
+ - /vp-evolve to add more features
57
+ ```
58
+ Exit cleanly.
59
+ </step>
60
+
61
+ <step name="execute_phase">
62
+ ## 3. Execute Phase
63
+
64
+ Display progress:
65
+ ```
66
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
67
+ VIEPILOT ► Phase {N}/{T}: {Name} [████░░░░] {P}%
68
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
69
+ ```
70
+
71
+ ### 3a. Load Phase Context
72
+ ```bash
73
+ cat .viepilot/phases/{phase}/SPEC.md
74
+ cat .viepilot/phases/{phase}/PHASE-STATE.md
75
+ ```
76
+
77
+ Check if phase already has completed tasks → resume from next task.
78
+
79
+ ### 3b. Execute Tasks Loop
80
+
81
+ For each task in phase:
82
+
83
+ #### Load Task Context
84
+ ```yaml
85
+ read:
86
+ - .viepilot/AI-GUIDE.md
87
+ - .viepilot/TRACKER.md
88
+ - .viepilot/phases/{phase}/PHASE-STATE.md
89
+ - .viepilot/phases/{phase}/tasks/{task}.md
90
+ - context_required files from task file
91
+ ```
92
+
93
+ #### Validate Task Contract (required before code)
94
+ Task must include execution-grade details:
95
+ - Objective (specific outcome)
96
+ - Exact file paths to create/modify
97
+ - Per-file implementation notes (what + why)
98
+ - Best practices to apply (stack + code quality)
99
+ - Verification commands with expected results
100
+
101
+ If task file is missing required sections:
102
+ - Mark task as `blocked`
103
+ - Record missing sections in PHASE-STATE.md
104
+ - Stop and request task refinement (do not start coding)
105
+
106
+ #### Pre-execution documentation gate (doc-first; BUG-001)
107
+
108
+ **Hard stop** before **any implementation work** (creating/modifying product code, configs, or docs that ship with the product—anything you would commit as “the task deliverable”):
109
+
110
+ Canonical order for every task: **Validate contract → Doc-first gate → Stack preflight → Start checkpoint → Execute → Verify → State updates.**
111
+
112
+ 1. **Written plan in the task file** — The active `.viepilot/phases/{phase}/tasks/{task}.md` MUST already contain real, task-specific content (not template placeholders) in:
113
+ - `## Paths` (or equivalent), listing concrete files/dirs, and
114
+ - `## File-Level Plan` **or** `## Implementation Notes` with an explicit bullet list of paths + what will change and why.
115
+ If only `{{PLACEHOLDER}}` tokens remain → **blocked**; refine the task file first.
116
+ 2. **PHASE-STATE visibility** — Set the current task row to `in_progress` in `PHASE-STATE.md` **before** the first implementation commit for this task (timestamp/note optional but recommended).
117
+
118
+ **Allowed before this gate passes:** Read-only exploration, contract checks, and **editing the task `.md`** to record the plan (that edit is not “implementation” of the deliverable).
119
+
120
+ If any check fails:
121
+ - Mark task `blocked` in `PHASE-STATE.md` and list what is missing under **Notes**
122
+ - **Do not** create `vp-p{phase}-t{task}`
123
+ - **Do not** proceed to **Execute Task**
124
+
125
+ #### Stack Preflight (token-efficient lookup)
126
+ Before implementing, detect relevant stacks for the current task and load guidance in this order:
127
+ 1. `.viepilot/STACKS.md` (project stack map)
128
+ 2. `~/.viepilot/stacks/{stack}/SUMMARY.md` (quick checklist, always first)
129
+ 3. `~/.viepilot/stacks/{stack}/BEST-PRACTICES.md` (only if task is medium/high complexity)
130
+ 4. `~/.viepilot/stacks/{stack}/ANTI-PATTERNS.md` (for review before finalizing)
131
+
132
+ If stack cache is missing:
133
+ - warn and optionally run quick research
134
+ - then continue with explicit assumptions noted in task logs
135
+
136
+ #### Task start checkpoint (after doc-first gate + preflight)
137
+
138
+ Only after **Validate Task Contract**, **Pre-execution documentation gate**, and **Stack Preflight** (or explicit waiver logged in the task file with reason):
139
+
140
+ Create git tag: `vp-p{phase}-t{task}`
141
+ Ensure `PHASE-STATE.md` already shows current task `in_progress` (set during the gate if not already).
142
+
143
+ #### Execute Task
144
+ 1. Read task objective and acceptance criteria
145
+ 2. Read SYSTEM-RULES.md for coding standards
146
+ 3. Apply stack cache guidance from preflight
147
+ 4. Load any required schemas
148
+ 5. Split into sub-tasks (30-90 minutes each) if scope is non-trivial
149
+ 6. Before each sub-task, write/update plan notes in task file:
150
+ - files touched
151
+ - implementation intent
152
+ - best-practice checklist
153
+ 7. Implement according to task specification
154
+ 6. Atomic commits per logical unit:
155
+ ```bash
156
+ git add {relevant files}
157
+ git commit -m "{type}({scope}): {description}"
158
+ git push
159
+ ```
160
+ 8. Log notes in task file after each sub-task
161
+
162
+ #### Verify Task
163
+ ```yaml
164
+ automated:
165
+ - Run commands from task verification section
166
+ - Check expected outputs
167
+
168
+ manual:
169
+ - Present to user if defined
170
+ - Ask for confirmation
171
+
172
+ quality_gate:
173
+ - acceptance_criteria_met: true
174
+ - automated_tests_pass: true
175
+ - no_lint_errors: true
176
+ ```
177
+
178
+ #### Handle Result
179
+
180
+ **PASS:**
181
+ - Create git tag: `vp-p{phase}-t{task}-done`
182
+ - Update PHASE-STATE.md immediately: task → done, append files changed by this task to Files Changed table (individual files, no glob patterns)
183
+ - Update TRACKER.md immediately
184
+ - Update HANDOFF.json immediately
185
+ - Update CHANGELOG.md if feature/fix
186
+ - Move to next task
187
+
188
+ **PARTIAL (some checks fail):**
189
+ - Attempt auto-fix
190
+ - Re-verify
191
+ - If still fail → control point
192
+
193
+ **FAIL:**
194
+ → Go to handle_blocker
195
+ </step>
196
+
197
+ <step name="update_state">
198
+ ## 4. Update State
199
+
200
+ After each PASS task and PASS sub-task (state-first, then continue):
201
+ ```yaml
202
+ update:
203
+ - PHASE-STATE.md: task status, timestamp
204
+ - TRACKER.md: current state, progress
205
+ - HANDOFF.json: latest position
206
+ - ROADMAP.md: sync when phase status/progress changed
207
+ - CHANGELOG.md: if feature/fix completed
208
+ ```
209
+
210
+ Rule:
211
+ - Never defer state updates to end-of-phase only.
212
+ - If interrupted, HANDOFF.json must still point to exact in-progress task/sub-task.
213
+ </step>
214
+
215
+ <step name="phase_complete">
216
+ ## 5. Phase Complete
217
+
218
+ When all tasks in phase are done/skipped:
219
+
220
+ 1. Run phase-level verification
221
+ 2. Check phase quality gate
222
+ 3. Write SUMMARY.md using `templates/phase/SUMMARY.md` as base.
223
+
224
+ Populate `{{CREATED_FILES}}`, `{{MODIFIED_FILES}}`, `{{DELETED_FILES}}` from git:
225
+ ```bash
226
+ # Get ALL individual files changed since phase start tag
227
+ git diff vp-p{phase}-t1..HEAD --name-status | sort
228
+ ```
229
+ List **every file individually** — do NOT use glob patterns or summarize.
230
+ Correct example:
231
+ ```
232
+ ### Created
233
+ | File | Task |
234
+ |------|------|
235
+ | pom.xml | 1.1 |
236
+ | smarttrack-api/pom.xml | 1.1 |
237
+ | smarttrack-common/pom.xml | 1.1 |
238
+ | smarttrack-common/src/main/java/Foo.java | 1.1 |
239
+ | docker-compose.yml | 1.2 |
240
+ ```
241
+ Incorrect (do not do this):
242
+ ```
243
+ | smarttrack-*/pom.xml (8 files) | 1.1 | ← WRONG: glob pattern
244
+ | smarttrack-*/src/** (7 files) | 1.1 | ← WRONG: summarized
245
+ ```
246
+ 4. Create git tag: `vp-p{phase}-complete`
247
+ 5. Check version bump needed:
248
+ - Features added → MINOR
249
+ - Fixes only → PATCH
250
+ 6. Update TRACKER.md
251
+ 7. Push all changes:
252
+ ```bash
253
+ git push
254
+ git push --tags
255
+ ```
256
+
257
+ ### 5a. Sync ROADMAP.md (after every phase complete)
258
+
259
+ Update `.viepilot/ROADMAP.md` to reflect current phase status:
260
+
261
+ ```markdown
262
+ # Find phase section and update:
263
+ - Phase status line: "Not Started" → "✅ Complete" (or "🔄 In Progress")
264
+ - Progress Summary table row: 0% → 100%, Completed count → actual
265
+
266
+ Example:
267
+ Before: | 5. vp-docs Enhancements | ⏳ Not Started | 2 | 0 | 0% |
268
+ After: | 5. vp-docs Enhancements | ✅ Complete | 2 | 2 | 100% |
269
+ ```
270
+
271
+ Commit: `chore: update ROADMAP.md — phase {N} complete`
272
+
273
+ ### 5b. Update skills-reference.md if new skills added (viepilot framework only)
274
+
275
+ > **Guard**: Only run this step if `skills/` directory exists in the project root.
276
+ > Skip entirely for non-framework projects (Java, Node, Python apps, etc.).
277
+
278
+ ```bash
279
+ # Skip if not a viepilot framework repo
280
+ if [ ! -d "skills" ]; then
281
+ echo "→ Skipping skills-reference update (not a viepilot framework repo)"
282
+ else
283
+ NEW_SKILLS=$(git diff vp-p{phase}-t1..HEAD --name-only | grep 'skills/.*/SKILL\.md' | sed 's|skills/||; s|/SKILL\.md||')
284
+ if [ -n "$NEW_SKILLS" ]; then
285
+ # Append new sections to docs/skills-reference.md
286
+ # (same incremental logic as workflows/documentation.md step 3B)
287
+ git add docs/skills-reference.md
288
+ git commit -m "docs: add {skill} to skills-reference.md"
289
+ git push
290
+ fi
291
+ fi
292
+ ```
293
+ </step>
294
+
295
+ <step name="iterate">
296
+ ## 6. Iterate
297
+
298
+ After phase complete:
299
+ 1. Re-read ROADMAP.md (catch inserted phases)
300
+ 2. Check TRACKER.md for blockers
301
+ 3. If more phases → loop to step 3
302
+ 4. If all complete → milestone complete
303
+
304
+ Milestone complete — Sync ROOT documents:
305
+
306
+ ### 6a. Sync README.md (milestone complete only)
307
+
308
+ Detect project version from the appropriate version file:
309
+ ```bash
310
+ # Generic version detection — works for any project type
311
+ if [ -f "package.json" ]; then
312
+ ACTUAL_VERSION=$(node -p "require('./package.json').version" 2>/dev/null)
313
+ elif [ -f "pom.xml" ]; then
314
+ ACTUAL_VERSION=$(grep -m1 "<version>" pom.xml 2>/dev/null | sed 's/.*<version>//;s/<.*//' | tr -d ' ')
315
+ elif [ -f "pyproject.toml" ]; then
316
+ ACTUAL_VERSION=$(grep '^version' pyproject.toml 2>/dev/null | head -1 | cut -d'"' -f2)
317
+ elif [ -f ".viepilot/TRACKER.md" ]; then
318
+ # Fallback: read from TRACKER.md (viepilot-managed version)
319
+ ACTUAL_VERSION=$(grep -A1 "Current Version" .viepilot/TRACKER.md | tail -1 | tr -d '`' | tr -d ' ')
320
+ fi
321
+ ```
322
+
323
+ Update README.md — **generic updates (all projects)**:
324
+ 1. Any version number mentions: update to `$ACTUAL_VERSION`
325
+ 2. Any "last updated" or "as of" date references
326
+
327
+ **viepilot framework only** (skip if `skills/` directory does not exist):
328
+ ```bash
329
+ if [ -d "skills" ]; then
330
+ ACTUAL_SKILLS=$(ls skills/*/SKILL.md 2>/dev/null | wc -l | tr -d ' ')
331
+ ACTUAL_WORKFLOWS=$(ls workflows/*.md 2>/dev/null | wc -l | tr -d ' ')
332
+ # Update: version badge, skills badge, workflows badge
333
+ # Update: Skills Reference table, Workflows table, Project Structure skills/ list
334
+ fi
335
+ ```
336
+
337
+ Commit: `docs: sync README.md to v{ACTUAL_VERSION}`
338
+ ```bash
339
+ git add README.md
340
+ git commit -m "docs: sync README.md to v{ACTUAL_VERSION}"
341
+ git push
342
+ ```
343
+
344
+ ### 6b. Display milestone complete banner
345
+
346
+ ```
347
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
348
+ VIEPILOT ► MILESTONE COMPLETE 🎉
349
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
350
+
351
+ Milestone: {name}
352
+ Phases: {count} complete
353
+ Version: {version}
354
+ README.md: synced ✓
355
+ ROADMAP.md: synced ✓
356
+
357
+ Next steps:
358
+ - /vp-docs to generate documentation
359
+ - /vp-evolve to start next milestone
360
+ ```
361
+ </step>
362
+
363
+ <step name="handle_blocker">
364
+ ## 7. Handle Blocker
365
+
366
+ At any control point:
367
+ ```
368
+ ⚠ Phase {N} ({Name}): Issue Encountered
369
+
370
+ {description of issue}
371
+
372
+ Options:
373
+ 1. Fix and retry - Attempt to fix the issue
374
+ 2. Skip task - Mark as skipped and continue
375
+ 3. Rollback task - Undo changes from this task
376
+ 4. Stop autonomous - Exit with progress summary
377
+ ```
378
+
379
+ **Fix and retry:**
380
+ - Re-attempt the failed step
381
+ - If still fails → re-present options
382
+
383
+ **Skip task:**
384
+ - Ask for skip reason
385
+ - Log in PHASE-STATE.md
386
+ - Continue to next task
387
+
388
+ **Rollback:**
389
+ ```bash
390
+ git revert --no-commit $(git rev-list vp-p{phase}-t{task}..HEAD)
391
+ ```
392
+ - Reset task → not_started
393
+ - Continue or stop
394
+
395
+ **Stop:**
396
+ ```
397
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
398
+ VIEPILOT ► STOPPED
399
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
400
+
401
+ Progress saved.
402
+
403
+ Completed: {list}
404
+ Skipped: {list}
405
+ Remaining: {list}
406
+
407
+ Resume with: /vp-resume
408
+ Or continue: /vp-auto --from {next_phase}
409
+ ```
410
+ </step>
411
+
412
+ </process>
413
+
414
+ <success_criteria>
415
+ - [ ] Phases executed in order
416
+ - [ ] Tasks tracked with git tags
417
+ - [ ] State updated after each task
418
+ - [ ] Quality gates enforced
419
+ - [ ] CHANGELOG updated for features/fixes
420
+ - [ ] Checkpoints created for recovery
421
+ - [ ] ROADMAP.md synced after each phase complete
422
+ - [ ] skills-reference.md updated when new skills added in a phase
423
+ - [ ] README.md badges and counts synced on milestone complete
424
+ - [ ] Clean stop with summary on pause/error
425
+ </success_criteria>
@@ -0,0 +1,257 @@
1
+ <purpose>
2
+ Interactive brainstorm session để thu thập ý tưởng, requirements, và quyết định cho dự án.
3
+ Cho phép research ngay trong cùng phiên brainstorm khi cần.
4
+ </purpose>
5
+
6
+ <process>
7
+
8
+ <step name="detect_sessions">
9
+ ## 1. Detect Previous Sessions
10
+
11
+ ```bash
12
+ ls -la docs/brainstorm/session-*.md 2>/dev/null | tail -5
13
+ ```
14
+
15
+ Parse results to get list of existing sessions.
16
+ </step>
17
+
18
+ <step name="ask_intent">
19
+ ## 2. Ask User Intent
20
+
21
+ **If previous sessions exist:**
22
+ ```
23
+ Tôi tìm thấy các phiên brainstorm trước đó:
24
+ {list sessions with dates}
25
+
26
+ Bạn muốn:
27
+ 1. Tiếp tục phiên gần nhất
28
+ 2. Xem lại một phiên cụ thể
29
+ 3. Tạo mới phiên brainstorm
30
+ ```
31
+
32
+ **If no sessions:**
33
+ Tự động tạo phiên mới.
34
+ </step>
35
+
36
+ <step name="load_context">
37
+ ## 3. Load Context (nếu tiếp tục)
38
+
39
+ Nếu user chọn tiếp tục:
40
+ 1. Đọc file phiên trước đó
41
+ 2. Tóm tắt nội dung đã thảo luận
42
+ 3. Xác định các open questions / action items còn lại
43
+ 4. Tiếp tục từ điểm dừng
44
+ </step>
45
+
46
+ <step name="brainstorm_mode">
47
+ ## 4. Brainstorm Mode
48
+
49
+ ### Topics Template
50
+ Gợi ý các topics để brainstorm:
51
+
52
+ 1. **Domain Analysis**
53
+ - Mục tiêu dự án
54
+ - User personas
55
+ - Core use cases
56
+
57
+ 2. **Architecture**
58
+ - System components
59
+ - Data flow
60
+ - Technology stack
61
+
62
+ 3. **Data Model**
63
+ - Core entities
64
+ - Relationships
65
+ - Storage strategy
66
+
67
+ 4. **API Design**
68
+ - Endpoint structure
69
+ - Authentication
70
+ - Real-time requirements
71
+
72
+ 5. **Infrastructure**
73
+ - Deployment strategy
74
+ - Monitoring
75
+ - Scaling
76
+
77
+ ### Interactive Q&A
78
+ Cho mỗi topic:
79
+ 1. Đặt câu hỏi cụ thể
80
+ 2. Đợi user trả lời
81
+ 3. Tổng hợp và đặt follow-up questions
82
+ 4. Đề xuất alternatives nếu cần
83
+ 5. Ghi nhận decisions
84
+
85
+ ### Landing Page Deep-Dive (kích hoạt theo ngữ cảnh)
86
+ Nếu user brainstorm về landing page / homepage / marketing page:
87
+
88
+ 1. Hỏi thêm để chốt bố cục:
89
+ - Goal chính của landing page? (signup, booking demo, download, contact)
90
+ - Audience chính?
91
+ - Tone visual? (minimal, modern, bold, enterprise, playful)
92
+ - CTA chính và CTA phụ?
93
+ 2. Đưa menu bố cục để user chọn:
94
+ - Layout A: Hero centric + trust logos + features + CTA
95
+ - Layout B: Problem/Solution + social proof + pricing + FAQ
96
+ - Layout C: Product storytelling + screenshots + testimonials + final CTA
97
+ - Layout D: SaaS conversion + integrations + comparison + onboarding steps
98
+ 3. Tham khảo `https://21st.dev` để đề xuất section/components phù hợp với layout đã chọn.
99
+ 4. Ghi rõ trong session:
100
+ - Layout user chọn
101
+ - Component candidates từ 21st.dev
102
+ - Lý do chọn theo objective + audience
103
+
104
+ ### In-session Research Mode
105
+ User có thể yêu cầu research ngay trong brainstorm (không cần đổi skill):
106
+ - Trigger phrases: "research cái này", "bạn research giúp", "cần research", "hãy tìm best practice"
107
+ - Khi trigger:
108
+ 1. Xác định scope research (1-3 câu)
109
+ 2. Thu thập nhanh từ nguồn phù hợp (docs chính thức, reference sites, patterns)
110
+ 3. Trả về tóm tắt ngắn: findings, trade-offs, recommendation
111
+ 4. Quay lại topic brainstorm hiện tại với quyết định đề xuất
112
+
113
+ Nếu assistant nhận thấy topic có độ mơ hồ cao hoặc rủi ro quyết định sai, assistant nên chủ động đề xuất:
114
+ `Mục này nên research nhanh trước khi chốt, bạn muốn mình research luôn trong phiên này không?`
115
+
116
+ ### UI Direction Mode (design-in-the-loop; FEAT-002)
117
+ Nếu user đang brainstorm cho dự án có UI/UX hoặc yêu cầu thiết kế trực quan:
118
+
119
+ 1. Tạo workspace direction cho phiên hiện tại:
120
+ - `.viepilot/ui-direction/{session-id}/index.html`
121
+ - `.viepilot/ui-direction/{session-id}/style.css`
122
+ - `.viepilot/ui-direction/{session-id}/notes.md`
123
+ 2. Mỗi lần user đổi requirement/layout/component:
124
+ - Cập nhật trực tiếp HTML/CSS direction
125
+ - Ghi decision + rationale vào `notes.md` (single source of truth)
126
+ 3. Nếu user gửi references/components (bao gồm 21st.dev prompt/link), ghi rõ:
127
+ - nguồn tham chiếu
128
+ - phần UI áp dụng
129
+ - điều chỉnh theo mục tiêu sản phẩm
130
+ 4. Giữ prototype ở mức mô tả định hướng (directional), không ép build production-ready code ở bước brainstorm.
131
+
132
+ ### Kết thúc mỗi topic
133
+ - Tóm tắt decisions
134
+ - List action items
135
+ - Note open questions
136
+ </step>
137
+
138
+ <step name="save_session">
139
+ ## 5. Save Session
140
+
141
+ Tạo/cập nhật file: `docs/brainstorm/session-{YYYY-MM-DD}.md`
142
+
143
+ ```markdown
144
+ # Brainstorm Session - {YYYY-MM-DD}
145
+
146
+ ## Session Info
147
+ - **Date**: {full date}
148
+ - **Participants**: User, Claude
149
+ - **Status**: In Progress | Completed
150
+
151
+ ## Topics Discussed
152
+
153
+ ### Topic 1: {Name}
154
+ **Context**: {brief context}
155
+
156
+ **Discussion**:
157
+ - Point 1
158
+ - Point 2
159
+
160
+ **Decisions**:
161
+ - [x] Decision 1
162
+ - [x] Decision 2
163
+
164
+ **Open Questions**:
165
+ - Question 1?
166
+
167
+ **Research Notes**:
168
+ - Query: {what was researched}
169
+ - Sources: {links / docs}
170
+ - Findings: {key points}
171
+ - Recommendation: {recommended direction}
172
+
173
+ **Landing Page Decisions** (if applicable):
174
+ - Chosen layout: {A|B|C|D|Custom}
175
+ - Section order: {hero -> proof -> features -> pricing -> faq -> cta}
176
+ - 21st.dev references:
177
+ - {component/pattern 1}
178
+ - {component/pattern 2}
179
+
180
+ **UI Direction Artifacts** (if applicable):
181
+ - Session id: {session-id}
182
+ - Files:
183
+ - `.viepilot/ui-direction/{session-id}/index.html`
184
+ - `.viepilot/ui-direction/{session-id}/style.css`
185
+ - `.viepilot/ui-direction/{session-id}/notes.md`
186
+ - Preview focus:
187
+ - {layout/flow summary}
188
+
189
+ ---
190
+
191
+ ## Summary
192
+
193
+ ### Key Decisions
194
+ 1. Decision summary
195
+
196
+ ### Action Items
197
+ - [ ] Action 1
198
+ - [ ] Action 2
199
+
200
+ ### Next Steps
201
+ - What to do next
202
+
203
+ ### Open Questions
204
+ - Unresolved questions
205
+ ```
206
+
207
+ Commit:
208
+ ```bash
209
+ mkdir -p docs/brainstorm
210
+ git add docs/brainstorm/
211
+ git commit -m "docs: brainstorm session {date}"
212
+ git push
213
+ ```
214
+ </step>
215
+
216
+ <step name="suggest_next">
217
+ ## 6. Suggest Next Action
218
+
219
+ ```
220
+ ✓ Brainstorm session saved
221
+
222
+ Summary:
223
+ - Topics covered: {count}
224
+ - Decisions made: {count}
225
+ - Open questions: {count}
226
+
227
+ Next step: /vp-crystallize
228
+ This will transform your brainstorm into:
229
+ - Project structure
230
+ - Architecture documents
231
+ - Development roadmap
232
+ ```
233
+ </step>
234
+
235
+ </process>
236
+
237
+ <commands>
238
+ User có thể dùng các lệnh trong phiên brainstorm:
239
+
240
+ - `/topic {name}` - Chuyển sang topic mới
241
+ - `/summary` - Xem tóm tắt phiên hiện tại
242
+ - `/save` - Lưu tiến độ ngay
243
+ - `/end` - Kết thúc và lưu phiên
244
+ - `/questions` - Xem danh sách open questions
245
+ - `/research {topic}` - Research nhanh ngay trong phiên và quay lại topic hiện tại
246
+ </commands>
247
+
248
+ <success_criteria>
249
+ - [ ] Session file created với đầy đủ sections
250
+ - [ ] Decisions có rationale
251
+ - [ ] Open questions tracked
252
+ - [ ] Action items captured
253
+ - [ ] Landing page topics trigger layout follow-up questions
254
+ - [ ] 21st.dev references được dùng khi thảo luận landing page
255
+ - [ ] Research có thể chạy ngay trong brainstorm session khi user yêu cầu
256
+ - [ ] Git committed
257
+ </success_criteria>