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,108 @@
1
+ /**
2
+ * Shared CLI helpers: validation + project root resolution (unit-tested, coverage-targeted).
3
+ * Keeps bin/vp-tools.cjs thinner so Jest can enforce meaningful coverage thresholds.
4
+ */
5
+
6
+ const fs = require('fs');
7
+ const path = require('path');
8
+
9
+ const VIEPILOT_DIR = '.viepilot';
10
+
11
+ function findProjectRoot() {
12
+ let dir = process.cwd();
13
+ while (dir !== path.dirname(dir)) {
14
+ if (fs.existsSync(path.join(dir, VIEPILOT_DIR))) {
15
+ return dir;
16
+ }
17
+ dir = path.dirname(dir);
18
+ }
19
+ return null;
20
+ }
21
+
22
+ const validators = {
23
+ isPositiveInteger(value, name = 'value') {
24
+ const num = parseInt(value, 10);
25
+ if (isNaN(num) || num < 1) {
26
+ return { valid: false, error: `${name} must be a positive integer`, hint: `Got: "${value}"` };
27
+ }
28
+ return { valid: true, value: num };
29
+ },
30
+
31
+ isValidStatus(value) {
32
+ const validStatuses = ['not_started', 'in_progress', 'done', 'skipped', 'blocked'];
33
+ if (!validStatuses.includes(value)) {
34
+ return {
35
+ valid: false,
36
+ error: `Invalid status: "${value}"`,
37
+ hint: `Valid statuses: ${validStatuses.join(', ')}`,
38
+ };
39
+ }
40
+ return { valid: true, value };
41
+ },
42
+
43
+ isValidTimestampFormat(value) {
44
+ const validFormats = ['iso', 'date', 'full'];
45
+ if (!validFormats.includes(value)) {
46
+ return {
47
+ valid: false,
48
+ error: `Invalid timestamp format: "${value}"`,
49
+ hint: `Valid formats: ${validFormats.join(', ')}`,
50
+ };
51
+ }
52
+ return { valid: true, value };
53
+ },
54
+
55
+ isValidBumpType(value) {
56
+ const validTypes = ['major', 'minor', 'patch'];
57
+ if (!validTypes.includes(value)) {
58
+ return {
59
+ valid: false,
60
+ error: `Invalid bump type: "${value}"`,
61
+ hint: `Valid types: ${validTypes.join(', ')}`,
62
+ };
63
+ }
64
+ return { valid: true, value };
65
+ },
66
+
67
+ isNonEmptyString(value, name = 'value') {
68
+ if (!value || typeof value !== 'string' || value.trim() === '') {
69
+ return { valid: false, error: `${name} cannot be empty` };
70
+ }
71
+ return { valid: true, value: value.trim() };
72
+ },
73
+
74
+ requireProjectRoot() {
75
+ const root = findProjectRoot();
76
+ if (!root) {
77
+ return {
78
+ valid: false,
79
+ error: 'No ViePilot project found',
80
+ hint: 'Run this command from a directory containing .viepilot/',
81
+ };
82
+ }
83
+ return { valid: true, value: root };
84
+ },
85
+ };
86
+
87
+ function levenshteinDistance(a, b) {
88
+ if (a.length === 0) return b.length;
89
+ if (b.length === 0) return a.length;
90
+ const matrix = [];
91
+ for (let i = 0; i <= b.length; i++) matrix[i] = [i];
92
+ for (let j = 0; j <= a.length; j++) matrix[0][j] = j;
93
+ for (let i = 1; i <= b.length; i++) {
94
+ for (let j = 1; j <= a.length; j++) {
95
+ matrix[i][j] = b.charAt(i - 1) === a.charAt(j - 1)
96
+ ? matrix[i - 1][j - 1]
97
+ : Math.min(matrix[i - 1][j - 1] + 1, matrix[i][j - 1] + 1, matrix[i - 1][j] + 1);
98
+ }
99
+ }
100
+ return matrix[b.length][a.length];
101
+ }
102
+
103
+ module.exports = {
104
+ VIEPILOT_DIR,
105
+ findProjectRoot,
106
+ validators,
107
+ levenshteinDistance,
108
+ };
package/package.json ADDED
@@ -0,0 +1,78 @@
1
+ {
2
+ "name": "viepilot",
3
+ "version": "1.0.0",
4
+ "description": "**Autonomous Vibe Coding Framework / Bộ khung phát triển tự động có kiểm soát**",
5
+ "main": "index.js",
6
+ "bin": {
7
+ "viepilot": "bin/viepilot.cjs"
8
+ },
9
+ "directories": {
10
+ "doc": "docs",
11
+ "example": "examples"
12
+ },
13
+ "scripts": {
14
+ "test": "jest",
15
+ "test:coverage": "jest --coverage",
16
+ "test:watch": "jest --watch",
17
+ "lint:cli": "node --check bin/vp-tools.cjs && node --check bin/viepilot.cjs",
18
+ "verify:release": "npm run lint:cli && npm test && npm pack --dry-run",
19
+ "prepublishOnly": "npm run verify:release",
20
+ "smoke:published": "node scripts/smoke-published.cjs",
21
+ "release:checklist": "node scripts/release-checklist.cjs"
22
+ },
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git+https://github.com/0-CODE/viepilot.git"
26
+ },
27
+ "keywords": [
28
+ "cursor",
29
+ "claude",
30
+ "ai",
31
+ "autonomous",
32
+ "developer-tools",
33
+ "cli"
34
+ ],
35
+ "author": "",
36
+ "license": "MIT",
37
+ "type": "commonjs",
38
+ "files": [
39
+ "bin/",
40
+ "lib/",
41
+ "skills/",
42
+ "workflows/",
43
+ "templates/",
44
+ "ui-components/",
45
+ "install.sh",
46
+ "dev-install.sh",
47
+ "README.md",
48
+ "CHANGELOG.md",
49
+ "LICENSE",
50
+ "docs/"
51
+ ],
52
+ "publishConfig": {
53
+ "access": "public"
54
+ },
55
+ "bugs": {
56
+ "url": "https://github.com/0-CODE/viepilot/issues"
57
+ },
58
+ "homepage": "https://github.com/0-CODE/viepilot#readme",
59
+ "jest": {
60
+ "testEnvironment": "node",
61
+ "testMatch": [
62
+ "<rootDir>/tests/unit/**/*.test.js",
63
+ "<rootDir>/tests/integration/**/*.test.js"
64
+ ],
65
+ "testTimeout": 30000,
66
+ "collectCoverageFrom": [
67
+ "lib/cli-shared.cjs"
68
+ ],
69
+ "coverageThreshold": {
70
+ "global": {
71
+ "lines": 80
72
+ }
73
+ }
74
+ },
75
+ "devDependencies": {
76
+ "jest": "^30.3.0"
77
+ }
78
+ }
@@ -0,0 +1,140 @@
1
+ ---
2
+ name: vp-audit
3
+ description: "Audit state, docs drift, and stack best-practice compliance — works on any project"
4
+ version: 0.3.0
5
+ ---
6
+
7
+ <cursor_skill_adapter>
8
+ ## A. Skill Invocation
9
+ - Skill được gọi khi user mention `vp-audit`, `/vp-audit`, "audit", "kiểm tra", "check docs"
10
+ - Treat all user text after the skill mention as `{{VP_ARGS}}`
11
+
12
+ ## B. User Prompting
13
+ Display audit results clearly with actionable suggestions grouped by tier.
14
+
15
+ ## C. Tool Usage
16
+ Use Cursor tools: `Shell`, `ReadFile`, `Glob`, `rg`, `ApplyPatch`, `WebSearch`, `WebFetch`, `Subagent`
17
+ </cursor_skill_adapter>
18
+
19
+ <objective>
20
+ Audit ViePilot project state và documentation để phát hiện drift.
21
+ Hoạt động trên **bất kỳ project nào** đang dùng ViePilot (Java, Node, Python, v.v.).
22
+ Auto-detect nếu đang chạy trong viepilot framework repo để thêm framework-specific checks.
23
+
24
+ **Tier 1 — ViePilot State Consistency (mọi project):**
25
+ - `.viepilot/TRACKER.md` current state vs `.viepilot/phases/*/PHASE-STATE.md`
26
+ - `.viepilot/ROADMAP.md` phase status vs PHASE-STATE.md
27
+ - `.viepilot/HANDOFF.json` vs TRACKER.md (resume-state consistency)
28
+ - Git tags `vp-p{N}-complete` vs completed phases in PHASE-STATE.md
29
+
30
+ **Tier 2 — Project Documentation Drift (mọi project):**
31
+ - `README.md` version vs `package.json` / `pom.xml` / `pyproject.toml`
32
+ - `CHANGELOG.md` vs recent git commits
33
+ - Placeholder URLs trong `docs/` (`your-org`, `YOUR_USERNAME`, v.v.)
34
+ - Features mới (từ phases gần đây) chưa có documentation
35
+
36
+ **Tier 3 — Stack Best Practices + Code Quality (mọi project, theo stack detect được):**
37
+ - Detect stacks liên quan từ context/project manifests
38
+ - So khớp code patterns với stack-specific Do/Don't + anti-patterns
39
+ - Severity findings: `critical` / `high` / `medium` / `low` kèm file/module mapping
40
+ - Fallback research bằng `WebSearch` + `WebFetch` khi cache stack thiếu/yếu
41
+ - Sinh output guardrails/checklist để `vp-auto` tái sử dụng trong preflight
42
+
43
+ **Tier 4 — Framework Integrity (chỉ khi detect viepilot framework repo):**
44
+ - Auto-detect: `skills/vp-*/SKILL.md` tồn tại → là viepilot framework repo
45
+ - `ARCHITECTURE.md` counts vs `skills/`, `workflows/`, CLI thực tế
46
+ - `README.md` viepilot-specific badges (version, skills-N, workflows-N)
47
+ - `docs/skills-reference.md` sections vs `skills/` directory
48
+
49
+ **Output:**
50
+ - Báo cáo theo 4 tiers, mỗi tier có status riêng
51
+ - Auto-fix option theo tier
52
+ - Suggestions cho complex gaps
53
+ - `vp-auto` compatible guardrails contract theo từng stack
54
+ </objective>
55
+
56
+ <execution_context>
57
+ @$HOME/.cursor/viepilot/workflows/audit.md
58
+ </execution_context>
59
+
60
+ <context>
61
+ Optional flags:
62
+ - `--framework` : Force Tier 3 framework checks (even if not auto-detected)
63
+ - `--project` : Force project-only mode — skip Tier 3 framework checks
64
+ - `--fix` : Auto-fix all detected issues
65
+ - `--report` : Generate report file at `.viepilot/audit-report.md`
66
+ - `--silent` : Only output if issues found
67
+ - `--tier1` : Run Tier 1 (state consistency) only
68
+ - `--tier2` : Run Tier 2 (docs drift) only
69
+ - `--tier3` : Run Tier 3 (framework integrity) only
70
+ </context>
71
+
72
+ <process>
73
+ Execute workflow from `@$HOME/.cursor/viepilot/workflows/audit.md`
74
+
75
+ ### Quick Summary
76
+
77
+ **Step 0**: Detect project type (viepilot framework vs user project)
78
+
79
+ **Step 1 — Tier 1**: ViePilot State Consistency
80
+ ```bash
81
+ # TRACKER.md vs PHASE-STATE.md
82
+ # ROADMAP.md vs PHASE-STATE.md
83
+ # HANDOFF.json vs TRACKER.md
84
+ # Git tags vs completed phases
85
+ ```
86
+
87
+ **Step 2 — Tier 2**: Project Documentation Drift
88
+ ```bash
89
+ # Detect version: package.json / pom.xml / pyproject.toml
90
+ # README.md version mention
91
+ # CHANGELOG.md vs recent commits
92
+ # Placeholder URLs in docs/
93
+ ```
94
+
95
+ **Step 3 — Tier 3**: Stack Best Practices + Code Quality
96
+ ```bash
97
+ # detect stack(s), load cache summary first
98
+ # if missing/weak cache -> run WebSearch/WebFetch fallback
99
+ # emit severity findings + guardrails contract for vp-auto
100
+ ```
101
+
102
+ **Step 4 — Tier 4**: Framework Integrity (conditional)
103
+
104
+ **Step 5**: Generate full report
105
+
106
+ **Step 6**: Auto-fix (if requested)
107
+ </process>
108
+
109
+ <auto_hook>
110
+ ## Integration with /vp-auto
111
+
112
+ After each phase complete, /vp-auto should:
113
+ 1. Run quick audit (--silent mode, Tier 1 + Tier 2 only)
114
+ 2. If issues found → warn user
115
+ 3. Offer to fix before continuing
116
+
117
+ ```
118
+ Phase 2 complete!
119
+
120
+ ⚠️ Audit found 2 issues:
121
+ Tier 1: ROADMAP.md phase 2 not marked ✅
122
+ Tier 2: README.md version not updated
123
+
124
+ Fix now? (y/n)
125
+ ```
126
+ </auto_hook>
127
+
128
+ <success_criteria>
129
+ - [ ] Runs on any project using ViePilot (Java, Node, Python, etc.) without errors
130
+ - [ ] Tier 1 state consistency checks work for all projects
131
+ - [ ] Tier 2 docs drift checks work for all project types (detects version from package.json/pom.xml/pyproject.toml)
132
+ - [ ] Tier 3 stack checks run for detected stacks with severity output
133
+ - [ ] Tier 3 supports research fallback when stack cache is missing/weak
134
+ - [ ] Tier 4 only runs when `skills/vp-*/SKILL.md` detected OR `--framework` flag used
135
+ - [ ] Results clearly labeled by tier
136
+ - [ ] `--framework` flag forces Tier 4 checks
137
+ - [ ] `--project` flag skips Tier 4 checks
138
+ - [ ] Auto-fix applies correct fixes per tier
139
+ - [ ] No mention of `skills/`, `workflows/`, `vp-tools.cjs` in Tier 1 or Tier 2 output for user projects
140
+ </success_criteria>
@@ -0,0 +1,204 @@
1
+ ---
2
+ name: vp-auto
3
+ description: "Autonomous execution loop với control points và recovery"
4
+ version: 0.2.1
5
+ ---
6
+
7
+ <cursor_skill_adapter>
8
+ ## A. Skill Invocation
9
+ - Skill được gọi khi user mention `vp-auto`, `/vp-auto`, "auto", "vibe", "chạy tự động"
10
+ - Treat all user text after the skill mention as `{{VP_ARGS}}`
11
+
12
+ ## B. User Prompting
13
+ Prompt user conversationally với numbered list options tại control points.
14
+
15
+ ## C. Tool Usage
16
+ Use Cursor tools: `Shell`, `ReadFile`, `Glob`, `rg`, `ApplyPatch`, `WebSearch`, `WebFetch`, `Subagent`
17
+
18
+ ## D. Subagent Spawning
19
+ Use `Task(subagent_type="generalPurpose", ...)` for parallel execution.
20
+ </cursor_skill_adapter>
21
+
22
+ <objective>
23
+ Autonomous execution của project phases. Cho mỗi phase: analyze → plan → execute → verify → iterate.
24
+
25
+ Pauses at control points:
26
+ - Conflicts detected
27
+ - Quality gate failures
28
+ - User decision needed
29
+ - Blockers encountered
30
+
31
+ **Updates after each task:**
32
+ - `.viepilot/TRACKER.md`
33
+ - `.viepilot/phases/*/PHASE-STATE.md`
34
+ - `.viepilot/HANDOFF.json`
35
+ - `CHANGELOG.md` (if feature/fix)
36
+ - `.viepilot/ROADMAP.md` when task completion changes phase progress/status
37
+
38
+ **Mandatory task decomposition before implementation:**
39
+ - Objective with concrete expected outcome
40
+ - Exact file paths to create/modify
41
+ - Per-file description (what + why)
42
+ - Best practices to apply (stack + coding conventions)
43
+ - Verification commands and expected output
44
+
45
+ If required task details are missing, do not implement until task contract is refined.
46
+
47
+ **Doc-first gate before implementation (BUG-001):**
48
+ - After contract validation and **before** any deliverable code/doc edits: the task `.md` MUST hold a real written plan (`Paths` + `File-Level Plan` or bullet **Implementation Notes**—no bare `{{PLACEHOLDER}}` rows).
49
+ - `PHASE-STATE.md` MUST show the task `in_progress` **before** the first implementation commit for that task.
50
+ - **Do not** create `vp-p{phase}-t{task}` or edit shipping files until both are satisfied (read-only exploration and editing the task file to record the plan are allowed).
51
+
52
+ **Preflight before each task implementation:**
53
+ - Read `.viepilot/STACKS.md` (if exists)
54
+ - Read `~/.viepilot/stacks/{stack}/SUMMARY.md` for relevant stacks
55
+ - Expand to detailed cache files only when needed (token-efficient)
56
+ - If `.viepilot/audit-report.md` has Tier 3 stack guardrails, apply them before coding
57
+
58
+ **Updates after each phase complete:**
59
+ - `.viepilot/ROADMAP.md` — phase status row and Progress Summary table
60
+
61
+ **Updates after each phase (if new skills added):**
62
+ - `docs/skills-reference.md` — append sections for new skills
63
+
64
+ **Updates on milestone complete:**
65
+ - `README.md` — version badge, skills/workflows counts, Skills Reference table, Workflows table, Project Structure, Completion Status
66
+
67
+ **After:** Project built, or paused for user intervention.
68
+ </objective>
69
+
70
+ <execution_context>
71
+ @$HOME/.cursor/viepilot/workflows/autonomous.md
72
+ </execution_context>
73
+
74
+ <context>
75
+ Optional flags:
76
+ - `--from N` : Start từ phase N
77
+ - `--phase N` : Chỉ chạy phase N
78
+ - `--fast` : Skip optional verifications
79
+ - `--dry-run` : Plan only, no execution
80
+
81
+ No extra args: chỉ nghĩa các cờ trên **tắt** — **không** phải rule “dừng bắt buộc sau mỗi task”. Trong chat, một turn thường ~một task; tiếp tục bằng lượt sau hoặc `/vp-auto` lại. Doc: `docs/user/features/autonomous-mode.md`.
82
+ </context>
83
+
84
+ <process>
85
+ Execute workflow from `@$HOME/.cursor/viepilot/workflows/autonomous.md`
86
+
87
+ ### 1. Initialize
88
+ ```bash
89
+ # Load context
90
+ Read AI-GUIDE.md → minimal context strategy
91
+ Read TRACKER.md → current state
92
+ Read ROADMAP.md → phases list
93
+ ```
94
+
95
+ Display startup banner:
96
+ ```
97
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
98
+ VIEPILOT ► AUTONOMOUS
99
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
100
+
101
+ Project: {project_name}
102
+ Phase: {current_phase}/{total_phases}
103
+ Progress: [████░░░░░░] {percent}%
104
+ ```
105
+
106
+ ### 2. Select Phase
107
+ - Find first incomplete phase
108
+ - Or resume in_progress phase
109
+ - Check dependencies met
110
+
111
+ ### 3. Execute Phase Loop
112
+
113
+ For each task in phase:
114
+
115
+ #### 3a. Load Task Context
116
+ ```yaml
117
+ Read:
118
+ - AI-GUIDE.md (always)
119
+ - TRACKER.md (always)
120
+ - PHASE-STATE.md (current phase)
121
+ - tasks/{task}.md (current task)
122
+ - context_required files (from task)
123
+
124
+ Stack preflight:
125
+ - Identify stacks used by task
126
+ - Load stack cache summary first
127
+ - Apply stack do/don't rules during implementation
128
+ ```
129
+
130
+ #### Doc-first gate + checkpoint order
131
+ 1. Validate task contract (`workflows/autonomous.md`).
132
+ 2. Record plan in task file; set task `in_progress` in `PHASE-STATE.md`.
133
+ 3. Stack preflight.
134
+ 4. Create git tag `vp-p{phase}-t{task}` **only after** steps 1–3 pass.
135
+
136
+ #### 3b. Execute Task
137
+ - Implement according to objective
138
+ - Follow acceptance criteria
139
+ - Split large tasks into sub-tasks (30-90 minutes)
140
+ - Record plan + files + best-practice checklist before each sub-task
141
+ - Write tests if required
142
+ - Atomic commits per sub-task
143
+ - Log notes in task file
144
+
145
+ #### 3c. Verify Task
146
+ ```yaml
147
+ automated:
148
+ - Run defined commands
149
+ - Check expected outputs
150
+ manual:
151
+ - Present if defined
152
+ - Ask user if required
153
+ quality_gate:
154
+ - All acceptance criteria checked
155
+ - Automated tests pass
156
+ - No lint errors
157
+ ```
158
+
159
+ #### 3d. Handle Result
160
+ - **PASS** → Mark task done, create tag `-done`, next task
161
+ - **PARTIAL** → Retry with fix
162
+ - **FAIL** → Control point (retry/skip/rollback/stop)
163
+
164
+ ### 4. Update State
165
+ After each PASS task and PASS sub-task:
166
+ - Update PHASE-STATE.md
167
+ - Update TRACKER.md
168
+ - Update HANDOFF.json
169
+ - Update ROADMAP.md if progress/status changed
170
+ - Update CHANGELOG.md (if feature/fix)
171
+
172
+ Rule: state-first then continue. Do not batch updates only at end of phase.
173
+
174
+ ### 5. Phase Complete
175
+ When all tasks done:
176
+ - Run phase verification
177
+ - Check phase quality gate
178
+ - Write SUMMARY.md
179
+ - Create git tag: `vp-p{phase}-complete`
180
+ - Increment version if needed
181
+
182
+ ### 6. Iterate
183
+ - More phases? → Loop to step 2
184
+ - All complete? → Suggest `/vp-docs`
185
+
186
+ ### 7. Handle Blockers
187
+ At any control point, offer:
188
+ 1. Fix and retry
189
+ 2. Skip (with reason)
190
+ 3. Rollback
191
+ 4. Stop autonomous mode
192
+
193
+ Display progress summary on stop.
194
+ </process>
195
+
196
+ <success_criteria>
197
+ - [ ] Phases executed in dependency order
198
+ - [ ] Tasks tracked with git tags
199
+ - [ ] Quality gates enforced
200
+ - [ ] State updated after each task
201
+ - [ ] Checkpoints created for recovery
202
+ - [ ] CHANGELOG updated for features/fixes
203
+ - [ ] Clean stop with summary on pause/error
204
+ </success_criteria>
@@ -0,0 +1,75 @@
1
+ ---
2
+ name: vp-brainstorm
3
+ description: "Brainstorm session để thu thập ý tưởng, quyết định cho dự án"
4
+ version: 0.3.0
5
+ ---
6
+
7
+ <cursor_skill_adapter>
8
+ ## A. Skill Invocation
9
+ - Skill được gọi khi user mention `vp-brainstorm`, `/vp-brainstorm`, hoặc yêu cầu "brainstorm"
10
+ - Treat all user text after the skill mention as `{{VP_ARGS}}`
11
+
12
+ ## B. User Prompting
13
+ Prompt user conversationally với numbered list options.
14
+
15
+ ## C. Tool Usage
16
+ Use Cursor tools: `Shell`, `ReadFile`, `Glob`, `rg`, `ApplyPatch`, `WebSearch`, `WebFetch`, `Subagent`
17
+ </cursor_skill_adapter>
18
+
19
+ <objective>
20
+ Thu thập ý tưởng, requirements, quyết định kiến trúc cho dự án thông qua interactive Q&A.
21
+
22
+ Hỗ trợ:
23
+ - Tạo session mới
24
+ - Tiếp tục session cũ
25
+ - Xem lại session trước đó
26
+ - Landing page layout discovery (hỏi thêm để chốt bố cục)
27
+ - In-session research (research ngay trong phiên brainstorm theo yêu cầu)
28
+ - UI Direction mode: tạo/cập nhật HTML prototype + notes trong `.viepilot/ui-direction/{session-id}/`
29
+
30
+ **Creates/Updates:**
31
+ - `docs/brainstorm/session-{YYYY-MM-DD}.md`
32
+
33
+ **After:** Ready for `/vp-crystallize`
34
+ </objective>
35
+
36
+ <execution_context>
37
+ @$HOME/.cursor/viepilot/workflows/brainstorm.md
38
+ </execution_context>
39
+
40
+ <context>
41
+ Optional flags:
42
+ - `--new` : Force tạo session mới
43
+ - `--continue` : Tiếp tục session gần nhất
44
+ - `--list` : Liệt kê các sessions
45
+ - `--landing` : Ưu tiên flow Landing Page layout discovery
46
+ - `--research` : Bật proactive research suggestions trong phiên
47
+ - `--ui` : Bật UI Direction mode (live HTML/CSS direction artifacts)
48
+ </context>
49
+
50
+ <process>
51
+ Execute workflow from `@$HOME/.cursor/viepilot/workflows/brainstorm.md`
52
+
53
+ Key steps:
54
+ 1. Detect existing sessions
55
+ 2. Ask user intent (new/continue/review)
56
+ 3. Load context if continuing
57
+ 4. Run interactive Q&A với topic-based structure
58
+ 5. Nếu topic là landing page: hỏi thêm bố cục + tham khảo `21st.dev` để đề xuất section/components
59
+ 6. Nếu topic cần UI/UX: tạo/cập nhật UI Direction artifacts (`index.html`, `style.css`, `notes.md`) trong `.viepilot/ui-direction/{session-id}/`
60
+ 7. Nếu user yêu cầu research hoặc cần làm rõ quyết định: research ngay trong session và quay lại topic
61
+ 8. Save session with structured format (bao gồm research notes + UI direction references khi có)
62
+ 9. Suggest next action: `/vp-crystallize`
63
+ </process>
64
+
65
+ <success_criteria>
66
+ - [ ] Session file created/updated với đầy đủ sections
67
+ - [ ] Decisions documented với rationale
68
+ - [ ] Open questions listed
69
+ - [ ] Action items captured
70
+ - [ ] Landing page topics include explicit layout selection questions
71
+ - [ ] 21st.dev references included when relevant
72
+ - [ ] Research can be executed inside the same brainstorm session
73
+ - [ ] UI Direction artifacts created/updated when UI mode is active
74
+ - [ ] Next steps suggested
75
+ </success_criteria>