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,150 @@
1
+ ---
2
+ name: vp-pause
3
+ description: "Pause work với context preservation để resume sau"
4
+ version: 0.1.0
5
+ ---
6
+
7
+ <cursor_skill_adapter>
8
+ ## A. Skill Invocation
9
+ - Skill được gọi khi user mention `vp-pause`, `/vp-pause`, "pause", "dừng", "tạm nghỉ"
10
+ - Treat all user text after the skill mention as `{{VP_ARGS}}`
11
+
12
+ ## B. User Prompting
13
+ Prompt user conversationally để gather state info.
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
+ Save complete work state để có thể resume từ bất kỳ context nào.
21
+
22
+ **Creates/Updates:**
23
+ - `.viepilot/HANDOFF.json` - Machine-readable state
24
+ - `.viepilot/phases/{current}/.continue-here.md` - Human-readable context
25
+ - Git WIP commit
26
+
27
+ **After:** Safe to close session. Resume với `/vp-resume`
28
+ </objective>
29
+
30
+ <execution_context>
31
+ @$HOME/.cursor/viepilot/workflows/pause-work.md
32
+ </execution_context>
33
+
34
+ <process>
35
+ Execute workflow from `@$HOME/.cursor/viepilot/workflows/pause-work.md`
36
+
37
+ ### Step 1: Detect Current Position
38
+ ```bash
39
+ # Find current phase from TRACKER.md or recent files
40
+ Read TRACKER.md → current_phase, current_task
41
+ Check PHASE-STATE.md → task status
42
+ ```
43
+
44
+ ### Step 2: Gather State
45
+ Collect:
46
+ 1. **Current position**: Phase, task, line
47
+ 2. **Work completed**: What got done this session
48
+ 3. **Work remaining**: What's left
49
+ 4. **Decisions made**: Key decisions and rationale
50
+ 5. **Blockers/issues**: Anything stuck
51
+ 6. **Human actions pending**: Manual interventions needed
52
+ 7. **Background processes**: Running servers/watchers
53
+ 8. **Uncommitted files**: Changes not yet committed
54
+
55
+ Ask user for clarifications if needed.
56
+
57
+ ### Step 3: Write HANDOFF.json
58
+ ```json
59
+ {
60
+ "version": "1.0",
61
+ "timestamp": "{ISO8601}",
62
+ "phase": "{phase_number}",
63
+ "phase_name": "{phase_name}",
64
+ "task": "{current_task}",
65
+ "total_tasks": "{total}",
66
+ "status": "paused",
67
+ "completed_tasks": [...],
68
+ "remaining_tasks": [...],
69
+ "blockers": [...],
70
+ "human_actions_pending": [...],
71
+ "decisions": [...],
72
+ "uncommitted_files": [...],
73
+ "next_action": "{specific first action when resuming}",
74
+ "context_notes": "{mental state, approach}"
75
+ }
76
+ ```
77
+
78
+ ### Step 4: Write .continue-here.md
79
+ ```markdown
80
+ ---
81
+ phase: {phase}
82
+ task: {task}
83
+ total_tasks: {total}
84
+ status: in_progress
85
+ last_updated: {timestamp}
86
+ ---
87
+
88
+ <current_state>
89
+ [Where exactly are we? Immediate context]
90
+ </current_state>
91
+
92
+ <completed_work>
93
+ - Task 1: [name] - Done
94
+ - Task 2: [name] - In progress, [what's done]
95
+ </completed_work>
96
+
97
+ <remaining_work>
98
+ - Task 2: [what's left]
99
+ - Task 3: Not started
100
+ </remaining_work>
101
+
102
+ <decisions_made>
103
+ - Decided [X] because [reason]
104
+ </decisions_made>
105
+
106
+ <blockers>
107
+ - [Blocker]: [status/workaround]
108
+ </blockers>
109
+
110
+ <context>
111
+ [Mental state, what were you thinking]
112
+ </context>
113
+
114
+ <next_action>
115
+ Start with: [specific first action when resuming]
116
+ </next_action>
117
+ ```
118
+
119
+ ### Step 5: Git Commit
120
+ ```bash
121
+ git add -A
122
+ git commit -m "wip({phase}): paused at task {task}/{total}"
123
+ ```
124
+
125
+ ### Step 6: Confirm
126
+ ```
127
+ ✓ Work paused successfully
128
+
129
+ Current state:
130
+ - Phase: {phase_name}
131
+ - Task: {task} of {total}
132
+ - Status: {status}
133
+ - Blockers: {count}
134
+
135
+ Files saved:
136
+ - .viepilot/HANDOFF.json
137
+ - .viepilot/phases/{phase}/.continue-here.md
138
+
139
+ To resume: /vp-resume
140
+ ```
141
+ </process>
142
+
143
+ <success_criteria>
144
+ - [ ] HANDOFF.json created with complete state
145
+ - [ ] .continue-here.md created in phase directory
146
+ - [ ] All sections filled with specific content
147
+ - [ ] Uncommitted changes identified
148
+ - [ ] Git WIP commit created
149
+ - [ ] User knows how to resume
150
+ </success_criteria>
@@ -0,0 +1,250 @@
1
+ ---
2
+ name: vp-request
3
+ description: "Tạo request mới: feature, bug fix, enhancement, hoặc brainstorm tiếp"
4
+ version: 0.1.0
5
+ ---
6
+
7
+ <cursor_skill_adapter>
8
+ ## A. Skill Invocation
9
+ - Skill được gọi khi user mention `vp-request`, `/vp-request`, "request", "yêu cầu", "bug", "lỗi", "feature mới", "nâng cấp"
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
+ Tạo và quản lý requests cho dự án đang phát triển:
21
+ - Bug report và fix
22
+ - Feature request
23
+ - Enhancement/Improvement
24
+ - Technical debt
25
+ - Brainstorm tiếp cho ý tưởng mới
26
+
27
+ **Creates/Updates:**
28
+ - `.viepilot/requests/{TYPE}-{NUMBER}.md`
29
+ - `.viepilot/TRACKER.md` (thêm vào backlog)
30
+ - `.viepilot/ROADMAP.md` (nếu approved)
31
+
32
+ **Routes to:** `/vp-auto` hoặc `/vp-evolve` tùy loại request
33
+ </objective>
34
+
35
+ <execution_context>
36
+ @$HOME/.cursor/viepilot/workflows/request.md
37
+ </execution_context>
38
+
39
+ <context>
40
+ Optional flags:
41
+ - `--bug` : Bug report mode
42
+ - `--feature` : Feature request mode
43
+ - `--enhance` : Enhancement mode
44
+ - `--debt` : Technical debt mode
45
+ - `--brainstorm` : Brainstorm continuation mode
46
+ - `--list` : List pending requests
47
+ - `--quick` : Quick mode (minimal questions)
48
+ </context>
49
+
50
+ <process>
51
+ Execute workflow from `@$HOME/.cursor/viepilot/workflows/request.md`
52
+
53
+ ### Step 1: Detect Request Type
54
+
55
+ ```
56
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
57
+ VIEPILOT ► REQUEST
58
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
59
+
60
+ What type of request?
61
+
62
+ 1. 🐛 Bug Report - Something is broken
63
+ 2. ✨ Feature Request - New functionality
64
+ 3. 🔧 Enhancement - Improve existing feature
65
+ 4. 🧹 Technical Debt - Code cleanup/refactor
66
+ 5. 💡 Brainstorm - Explore new ideas
67
+ 6. 📋 List Requests - View pending requests
68
+ ```
69
+
70
+ ### Step 2: Gather Request Details
71
+
72
+ #### For Bug Report (🐛)
73
+ ```
74
+ Bug Details:
75
+
76
+ 1. Title/Summary?
77
+ 2. What happened? (actual behavior)
78
+ 3. What should happen? (expected behavior)
79
+ 4. Steps to reproduce?
80
+ 5. Which part of system? (service/module)
81
+ 6. Severity? (critical/high/medium/low)
82
+ 7. Any error messages/logs?
83
+ ```
84
+
85
+ #### For Feature Request (✨)
86
+ ```
87
+ Feature Details:
88
+
89
+ 1. Title/Summary?
90
+ 2. What problem does it solve?
91
+ 3. Describe the feature
92
+ 4. Who benefits from this?
93
+ 5. Priority? (must-have/should-have/nice-to-have)
94
+ 6. Any specific requirements?
95
+
96
+ Do you want to brainstorm this feature in detail? (y/n)
97
+ → If yes: route to mini brainstorm session
98
+ ```
99
+
100
+ #### For Enhancement (🔧)
101
+ ```
102
+ Enhancement Details:
103
+
104
+ 1. Title/Summary?
105
+ 2. Which existing feature to enhance?
106
+ 3. Current behavior
107
+ 4. Desired improvement
108
+ 5. Why is this valuable?
109
+ 6. Breaking changes? (yes/no)
110
+ ```
111
+
112
+ #### For Technical Debt (🧹)
113
+ ```
114
+ Tech Debt Details:
115
+
116
+ 1. Title/Summary?
117
+ 2. What needs cleanup?
118
+ 3. Current issues (performance/maintainability/etc)
119
+ 4. Proposed solution
120
+ 5. Effort estimate? (S/M/L/XL)
121
+ 6. Risk if not addressed?
122
+ ```
123
+
124
+ #### For Brainstorm (💡)
125
+ ```
126
+ Brainstorm Topic:
127
+
128
+ 1. What do you want to explore?
129
+ 2. Related to existing feature or completely new?
130
+ 3. Any initial ideas?
131
+
132
+ → Route to full brainstorm session with context
133
+ ```
134
+
135
+ ### Step 3: Create Request File
136
+
137
+ Create `.viepilot/requests/{TYPE}-{NUMBER}.md`:
138
+
139
+ ```markdown
140
+ # {TYPE}: {TITLE}
141
+
142
+ ## Meta
143
+ - **ID**: {TYPE}-{NUMBER}
144
+ - **Type**: Bug | Feature | Enhancement | Tech Debt
145
+ - **Status**: new | triaged | in_progress | done | wont_fix
146
+ - **Priority**: critical | high | medium | low
147
+ - **Created**: {timestamp}
148
+ - **Reporter**: User
149
+ - **Assignee**: AI
150
+
151
+ ## Summary
152
+ {SUMMARY}
153
+
154
+ ## Details
155
+ {DETAILS_BASED_ON_TYPE}
156
+
157
+ ## Acceptance Criteria
158
+ - [ ] {criteria_1}
159
+ - [ ] {criteria_2}
160
+
161
+ ## Related
162
+ - Phase: {if linked to phase}
163
+ - Files: {affected files}
164
+ - Dependencies: {related requests}
165
+
166
+ ## Discussion
167
+ {Any additional context from brainstorm}
168
+
169
+ ## Resolution
170
+ {Filled when resolved}
171
+ ```
172
+
173
+ ### Step 4: Triage & Route
174
+
175
+ Based on request type and priority:
176
+
177
+ **Critical Bug:**
178
+ ```
179
+ ⚠️ Critical bug detected!
180
+
181
+ Options:
182
+ 1. Fix immediately (pause current work)
183
+ 2. Add to top of current phase
184
+ 3. Schedule for next available slot
185
+ ```
186
+
187
+ **Feature/Enhancement:**
188
+ ```
189
+ Request logged: {TYPE}-{NUMBER}
190
+
191
+ Options:
192
+ 1. Add to current milestone backlog
193
+ 2. Brainstorm in detail first
194
+ 3. Schedule for next milestone
195
+ 4. Start working now
196
+ ```
197
+
198
+ **Tech Debt:**
199
+ ```
200
+ Tech debt logged: {TYPE}-{NUMBER}
201
+
202
+ Options:
203
+ 1. Add to refactor backlog
204
+ 2. Include in next phase
205
+ 3. Create dedicated cleanup phase
206
+ ```
207
+
208
+ ### Step 5: Update Tracking
209
+
210
+ Update `.viepilot/TRACKER.md`:
211
+ ```markdown
212
+ ## Backlog
213
+
214
+ ### Pending Requests
215
+ | ID | Type | Title | Priority | Status |
216
+ |----|------|-------|----------|--------|
217
+ | BUG-001 | 🐛 | Login timeout | high | new |
218
+ | FEAT-002 | ✨ | Export feature | medium | triaged |
219
+ ```
220
+
221
+ ### Step 6: Confirm & Next Steps
222
+
223
+ ```
224
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
225
+ VIEPILOT ► REQUEST CREATED ✓
226
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
227
+
228
+ ID: {TYPE}-{NUMBER}
229
+ Type: {TYPE}
230
+ Title: {TITLE}
231
+ Priority: {PRIORITY}
232
+ Status: {STATUS}
233
+
234
+ File: .viepilot/requests/{TYPE}-{NUMBER}.md
235
+
236
+ Next:
237
+ - /vp-request --list View all requests
238
+ - /vp-auto Start working on it
239
+ - /vp-request Create another request
240
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
241
+ ```
242
+ </process>
243
+
244
+ <success_criteria>
245
+ - [ ] Request type identified
246
+ - [ ] Details gathered appropriately
247
+ - [ ] Request file created
248
+ - [ ] TRACKER.md updated
249
+ - [ ] Appropriate routing suggested
250
+ </success_criteria>
@@ -0,0 +1,141 @@
1
+ ---
2
+ name: vp-resume
3
+ description: "Resume work từ previous session với full context restoration"
4
+ version: 0.1.0
5
+ ---
6
+
7
+ <cursor_skill_adapter>
8
+ ## A. Skill Invocation
9
+ - Skill được gọi khi user mention `vp-resume`, `/vp-resume`, "resume", "tiếp tục", "where was i"
10
+ - Treat all user text after the skill mention as `{{VP_ARGS}}`
11
+
12
+ ## B. User Prompting
13
+ Prompt user conversationally với 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
+ Restore complete project context và resume work seamlessly.
21
+
22
+ **Reads:**
23
+ - `.viepilot/HANDOFF.json`
24
+ - `.viepilot/TRACKER.md`
25
+ - `.viepilot/phases/{phase}/.continue-here.md`
26
+
27
+ **After:** Context restored, ready to continue or route to appropriate action.
28
+ </objective>
29
+
30
+ <execution_context>
31
+ @$HOME/.cursor/viepilot/workflows/resume-work.md
32
+ </execution_context>
33
+
34
+ <process>
35
+ Execute workflow from `@$HOME/.cursor/viepilot/workflows/resume-work.md`
36
+
37
+ ### Step 1: Check Project Exists
38
+ ```bash
39
+ ls .viepilot/TRACKER.md
40
+ ```
41
+ If not exists → Error: "No ViePilot project found. Run `/vp-crystallize` first."
42
+
43
+ ### Step 2: Load State
44
+
45
+ **Try HANDOFF.json first (preferred):**
46
+ ```bash
47
+ cat .viepilot/HANDOFF.json
48
+ ```
49
+ Parse: phase, task, status, next_action, context_notes
50
+
51
+ **Fallback to TRACKER.md:**
52
+ ```bash
53
+ cat .viepilot/TRACKER.md
54
+ ```
55
+ Extract current state from Progress Overview section.
56
+
57
+ **Load .continue-here.md if exists:**
58
+ ```bash
59
+ cat .viepilot/phases/{phase}/.continue-here.md
60
+ ```
61
+
62
+ ### Step 3: Check Uncommitted Changes
63
+ ```bash
64
+ git status --porcelain
65
+ ```
66
+ If changes exist, warn user and ask how to proceed.
67
+
68
+ ### Step 4: Rebuild Context
69
+ Following AI-GUIDE.md strategy:
70
+ ```yaml
71
+ minimal_load:
72
+ - AI-GUIDE.md
73
+ - TRACKER.md
74
+ - PHASE-STATE.md (current phase)
75
+
76
+ task_load:
77
+ - tasks/{current_task}.md
78
+ - context_required files from task
79
+ ```
80
+
81
+ ### Step 5: Display State Summary
82
+ ```
83
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
84
+ VIEPILOT ► RESUME
85
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
86
+
87
+ Project: {project_name}
88
+ Last Activity: {timestamp}
89
+
90
+ Current State:
91
+ ├── Phase: {phase_number} - {phase_name}
92
+ ├── Task: {task_number}/{total} - {task_name}
93
+ ├── Status: {status}
94
+ └── Progress: [████████░░] {percent}%
95
+
96
+ Context Notes:
97
+ {context_notes from HANDOFF.json}
98
+
99
+ Next Action:
100
+ {next_action from HANDOFF.json}
101
+
102
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
103
+ ```
104
+
105
+ ### Step 6: Offer Options
106
+ Prompt user:
107
+ ```
108
+ How would you like to proceed?
109
+
110
+ 1. Continue from task {task} (recommended)
111
+ 2. Restart current task
112
+ 3. Skip to next task
113
+ 4. View task details
114
+ 5. Run /vp-status for full overview
115
+ 6. Start /vp-auto for autonomous mode
116
+ ```
117
+
118
+ ### Step 7: Route to Action
119
+ Based on user choice:
120
+ - **Continue** → Load task context, start working
121
+ - **Restart** → Reset task state, start fresh
122
+ - **Skip** → Mark task skipped, move to next
123
+ - **View** → Display task file content
124
+ - **Status** → `Skill(skill="vp-status")`
125
+ - **Auto** → `Skill(skill="vp-auto", args="--from {phase}")`
126
+
127
+ ### Step 8: Update Session
128
+ ```bash
129
+ # Update TRACKER.md with session info
130
+ # Clear HANDOFF.json (now active)
131
+ ```
132
+ </process>
133
+
134
+ <success_criteria>
135
+ - [ ] HANDOFF.json or TRACKER.md loaded
136
+ - [ ] Context rebuilt efficiently
137
+ - [ ] State summary displayed clearly
138
+ - [ ] User offered appropriate options
139
+ - [ ] Routed to correct next action
140
+ - [ ] Session continuity maintained
141
+ </success_criteria>
@@ -0,0 +1,116 @@
1
+ ---
2
+ name: vp-rollback
3
+ description: "Rollback to any checkpoint safely with state preservation"
4
+ version: 0.1.0
5
+ ---
6
+
7
+ <cursor_skill_adapter>
8
+ ## A. Skill Invocation
9
+ - Skill được gọi khi user mention `vp-rollback`, `/vp-rollback`, "rollback", "quay lại"
10
+ - Treat all user text after the skill mention as `{{VP_ARGS}}`
11
+
12
+ ## B. User Prompting
13
+ Show available checkpoints and confirm before rollback.
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
+ Rollback đến bất kỳ checkpoint nào một cách an toàn, với backup và state preservation.
21
+
22
+ **Checkpoints:** Git tags với prefix `vp-`
23
+ - `vp-p{N}-t{M}` - Start of task M in phase N
24
+ - `vp-p{N}-t{M}-done` - Task M complete
25
+ - `vp-p{N}-complete` - Phase N complete
26
+
27
+ **Safety:**
28
+ - Backup current state before rollback
29
+ - Validate target checkpoint exists
30
+ - Update HANDOFF.json after rollback
31
+ </objective>
32
+
33
+ <execution_context>
34
+ @$HOME/.cursor/viepilot/workflows/rollback.md
35
+ </execution_context>
36
+
37
+ <context>
38
+ Optional flags:
39
+ - `--list` : List available checkpoints
40
+ - `--to <tag>` : Rollback to specific tag
41
+ - `--latest` : Rollback to latest checkpoint
42
+ - `--force` : Skip confirmation
43
+ - `--dry-run` : Show what would happen
44
+ </context>
45
+
46
+ <process>
47
+
48
+ ### 1. List Checkpoints
49
+ ```bash
50
+ git tag -l "vp-*" --sort=-creatordate
51
+ ```
52
+
53
+ Display with dates and descriptions:
54
+ ```
55
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
56
+ AVAILABLE CHECKPOINTS
57
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
58
+
59
+ TAG DATE COMMIT
60
+ vp-p1-complete 2026-03-30 Phase 1 done
61
+ vp-p1-t1-done 2026-03-30 Task 1.1 done
62
+ vp-p1-t1 2026-03-30 Start task 1.1
63
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
64
+ ```
65
+
66
+ ### 2. Validate Target
67
+ - Check tag exists
68
+ - Show files that will change
69
+ - Show commits that will be undone
70
+
71
+ ### 3. Backup Current State
72
+ ```bash
73
+ # Backup HANDOFF.json
74
+ cp .viepilot/HANDOFF.json .viepilot/HANDOFF.backup.json
75
+
76
+ # Create safety tag
77
+ git tag vp-backup-{timestamp}
78
+ ```
79
+
80
+ ### 4. Execute Rollback
81
+ ```bash
82
+ # Reset to checkpoint
83
+ git reset --hard {tag}
84
+
85
+ # Or soft reset (keep changes staged)
86
+ git reset --soft {tag}
87
+ ```
88
+
89
+ ### 5. Update State
90
+ Update HANDOFF.json to reflect rollback position.
91
+ Update TRACKER.md if needed.
92
+
93
+ ### 6. Confirm Success
94
+ ```
95
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
96
+ ROLLBACK COMPLETE ✓
97
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
98
+
99
+ From: {previous_commit}
100
+ To: {tag} ({commit})
101
+
102
+ Backup tag: vp-backup-{timestamp}
103
+
104
+ To undo this rollback:
105
+ git reset --hard vp-backup-{timestamp}
106
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
107
+ ```
108
+ </process>
109
+
110
+ <success_criteria>
111
+ - [ ] Checkpoints listed with dates
112
+ - [ ] Target validated before rollback
113
+ - [ ] Backup created before changes
114
+ - [ ] State files updated after rollback
115
+ - [ ] Undo instructions provided
116
+ </success_criteria>