the-frame-ai 0.1.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 (77) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +335 -0
  3. package/README.ru.md +333 -0
  4. package/bin/the-frame +5 -0
  5. package/bin/the-frame-ai +5 -0
  6. package/package.json +29 -0
  7. package/src/cli.js +84 -0
  8. package/src/doctor.js +164 -0
  9. package/src/init.js +178 -0
  10. package/src/languages.js +141 -0
  11. package/src/manifest.js +55 -0
  12. package/src/update.js +87 -0
  13. package/src/utils.js +55 -0
  14. package/templates/agents/builder.md +240 -0
  15. package/templates/agents/devils-advocate.md +136 -0
  16. package/templates/agents/planner.md +277 -0
  17. package/templates/agents/researcher.md +195 -0
  18. package/templates/agents/reviewer.md +300 -0
  19. package/templates/commands/frame:add-task.md +57 -0
  20. package/templates/commands/frame:build.md +170 -0
  21. package/templates/commands/frame:check-deps.md +118 -0
  22. package/templates/commands/frame:checkpoint.md +158 -0
  23. package/templates/commands/frame:cleanup-memory.md +80 -0
  24. package/templates/commands/frame:context.md +64 -0
  25. package/templates/commands/frame:daily.md +77 -0
  26. package/templates/commands/frame:debug.md +146 -0
  27. package/templates/commands/frame:doctor.md +170 -0
  28. package/templates/commands/frame:estimate.md +105 -0
  29. package/templates/commands/frame:explain.md +84 -0
  30. package/templates/commands/frame:fast.md +89 -0
  31. package/templates/commands/frame:forensics.md +139 -0
  32. package/templates/commands/frame:headless.md +118 -0
  33. package/templates/commands/frame:health.md +86 -0
  34. package/templates/commands/frame:init.md +231 -0
  35. package/templates/commands/frame:migrate.md +107 -0
  36. package/templates/commands/frame:note.md +32 -0
  37. package/templates/commands/frame:pause.md +145 -0
  38. package/templates/commands/frame:performance.md +228 -0
  39. package/templates/commands/frame:plan.md +198 -0
  40. package/templates/commands/frame:refactor.md +161 -0
  41. package/templates/commands/frame:research.md +131 -0
  42. package/templates/commands/frame:resume.md +137 -0
  43. package/templates/commands/frame:retrospective.md +196 -0
  44. package/templates/commands/frame:review.md +174 -0
  45. package/templates/commands/frame:rollback.md +207 -0
  46. package/templates/commands/frame:ship.md +148 -0
  47. package/templates/commands/frame:sprint-check.md +111 -0
  48. package/templates/commands/frame:status.md +103 -0
  49. package/templates/commands/frame:unstuck.md +102 -0
  50. package/templates/commands/frame:wave.md +312 -0
  51. package/templates/commands/frame:where.md +5 -0
  52. package/templates/commands/frame:why.md +57 -0
  53. package/templates/commands/frame:worktree.md +219 -0
  54. package/templates/hooks/git-safety.sh +33 -0
  55. package/templates/hooks/quality-gate.sh +52 -0
  56. package/templates/hooks/safety-net.sh +13 -0
  57. package/templates/hooks/session-init.sh +81 -0
  58. package/templates/planning/pause-state.json +1 -0
  59. package/templates/project/CLAUDE.md +63 -0
  60. package/templates/project/CONTEXT.md +16 -0
  61. package/templates/project/MAP.md +35 -0
  62. package/templates/project/ROADMAP.md +12 -0
  63. package/templates/project/STATE.md +13 -0
  64. package/templates/project/config.json +74 -0
  65. package/templates/project/memory/anti-patterns.md +14 -0
  66. package/templates/project/memory/context.md +23 -0
  67. package/templates/project/memory/conventions.md +19 -0
  68. package/templates/project/memory/decisions.md +20 -0
  69. package/templates/project/memory/dependencies.md +23 -0
  70. package/templates/project/memory/metrics.md +22 -0
  71. package/templates/project/memory/patterns.md +30 -0
  72. package/templates/project/memory/wins.md +11 -0
  73. package/templates/project/settings.local.json +50 -0
  74. package/templates/project/specs/_template/PRD.md +24 -0
  75. package/templates/project/specs/_template/plan.md +25 -0
  76. package/templates/project/specs/_template/spec.md +27 -0
  77. package/templates/project/specs/_template/subagent-prompt.md +43 -0
@@ -0,0 +1,137 @@
1
+ # /frame:resume -- Resume Work
2
+
3
+ Restores state from the last /frame:pause.
4
+
5
+ ## Instructions
6
+
7
+ Restore state from pause.
8
+
9
+ ### Step 0: Fail-fast validation + mark IN_PROGRESS
10
+
11
+ Verify STATE.md exists:
12
+ ```bash
13
+ test -f .planning/STATE.md || { echo "ERROR: .planning/STATE.md not found. Run /frame:init first."; exit 1; }
14
+ ```
15
+
16
+ Verify pause-state exists and is not empty:
17
+ ```bash
18
+ test -f .planning/pause-state.json || { echo "ERROR: No pause state found. Nothing to resume."; exit 1; }
19
+ ```
20
+
21
+ Read `.planning/pause-state.json` and check it has content:
22
+ ```bash
23
+ cat .planning/pause-state.json
24
+ ```
25
+
26
+ If the file contains only `{}` or is missing required fields (`phase`, `feature`, `resumeHint`), stop:
27
+ ```
28
+ ERROR: pause-state.json is empty or invalid — no saved session to resume.
29
+ Use /frame:status to see current state, or /frame:init to start fresh.
30
+ ```
31
+
32
+ Immediately update status in `.planning/STATE.md`:
33
+ ```
34
+ Status: IN_PROGRESS (resuming)
35
+ ```
36
+
37
+ ### Step 1: Read pause state
38
+
39
+ Read `.planning/pause-state.json`:
40
+ ```bash
41
+ cat .planning/pause-state.json
42
+ ```
43
+
44
+ Extract: `timestamp`, `phase`, `feature`, `task`, `lastCommit`, `hasStash`, `hasWip`, `openTasks`, `resumeHint`.
45
+
46
+ ### Step 2: Restore uncommitted changes
47
+
48
+ If `hasWip === true` — the WIP commit is already in git history, no action needed.
49
+
50
+ If `hasStash === true`:
51
+ ```bash
52
+ git stash pop
53
+ ```
54
+
55
+ If `git stash pop` fails (conflicts), stop and report:
56
+ ```
57
+ ERROR: git stash pop failed with conflicts. Resolve manually, then re-run /frame:resume.
58
+ ```
59
+
60
+ Check checkpoint:
61
+ ```bash
62
+ LAST_PAUSE=$(git tag -l "frame/pause-*" --sort=-creatordate | head -n 1)
63
+ echo "Last pause checkpoint: $LAST_PAUSE"
64
+ ```
65
+
66
+ ### Step 3: Restore STATE.md
67
+
68
+ Update `.planning/STATE.md` — restore context from pause:
69
+ ```markdown
70
+ ## Current Position
71
+ - Phase: {phase from pause}
72
+ - Feature: {feature from pause}
73
+ - Task: {task from pause}
74
+ - Status: RESUMED
75
+ - Resumed at: {now}
76
+ - Paused at: {timestamp from pause-state}
77
+ ```
78
+
79
+ ### Step 4: Show Context
80
+
81
+ Display:
82
+ ```
83
+ +======================================================================+
84
+ | FRAME RESUMED |
85
+ +======================================================================+
86
+ | Paused at: {timestamp} |
87
+ | Resumed at: {now} |
88
+ | Duration: {diff} |
89
+ | |
90
+ | Phase: {phase} |
91
+ | Feature: {feature} |
92
+ | Task: {completed}/{total} |
93
+ | |
94
+ | Continue from: {resumeHint} |
95
+ +======================================================================+
96
+ ```
97
+
98
+ If `openTasks` is non-empty, list them:
99
+ ```
100
+ Open tasks:
101
+ - {open task 1}
102
+ - {open task 2}
103
+ ```
104
+
105
+ ### Step 5: Clean up pause state
106
+
107
+ Move to history (do not delete — preserves audit trail):
108
+ ```bash
109
+ mkdir -p .planning/pause-history
110
+ mv .planning/pause-state.json .planning/pause-history/resumed-$(date +%Y%m%d%H%M).json
111
+ ```
112
+
113
+ ### Step 6: Update STATE.md (final)
114
+
115
+ Update `.planning/STATE.md` status to reflect active work:
116
+ ```
117
+ Status: IN_PROGRESS
118
+ ```
119
+
120
+ ### Step 7: Continue Work
121
+
122
+ Resume from `resumeHint`. Do not restart from the beginning of the phase.
123
+
124
+ ## Rules
125
+
126
+ - **Fail fast** -- exit immediately if STATE.md or pause-state.json is missing
127
+ - **Always restore stash before continuing** -- uncommitted changes must be recovered first
128
+ - **Use resumeHint** -- continue from the exact next step, not from phase start
129
+ - **Move pause-state to history** -- never silently delete it
130
+
131
+ ## Result
132
+
133
+ - State restored from pause-state.json
134
+ - Git stash applied (if hasStash)
135
+ - STATE.md updated to IN_PROGRESS
136
+ - pause-state.json moved to pause-history/
137
+ - Work resumed from resumeHint
@@ -0,0 +1,196 @@
1
+ # /frame:retrospective -- Retrospective + Memory Update
2
+
3
+ Analyzes completed task, updates memory files, creates a retrospective report.
4
+
5
+ ## Instructions
6
+
7
+ Run a retrospective for the last completed task.
8
+
9
+ ### Step 0: Validate prerequisites + Update STATE.md (IN_PROGRESS)
10
+
11
+ **Fail-fast checks:**
12
+ ```bash
13
+ git rev-parse --is-inside-work-tree 2>/dev/null || { echo "ERROR: Not a git repository. Run from project root."; exit 1; }
14
+ git log --oneline -1 2>/dev/null || { echo "ERROR: No commits found. Nothing to retrospect."; exit 1; }
15
+ ```
16
+
17
+ Check `.planning/STATE.md` — the previous phase should be SHIP or BUILD with Status: COMPLETE. If the phase is IN_PROGRESS, warn the user and ask for confirmation before continuing.
18
+
19
+ Update `.planning/STATE.md`:
20
+ ```markdown
21
+ ## Current Position
22
+ - Phase: REFLECT
23
+ - Feature: {feature}
24
+ - Status: IN_PROGRESS
25
+ - Started: {timestamp}
26
+ ```
27
+
28
+ ### Step 1: Analyze the last commit
29
+
30
+ ```bash
31
+ git log --oneline -10
32
+ git diff HEAD~1 --stat
33
+ ```
34
+
35
+ ### Step 2: Identify what worked
36
+
37
+ - Did it fit within the estimate?
38
+ - What patterns were used?
39
+ - What problems were solved?
40
+
41
+ ### Step 3: Identify what did not work
42
+
43
+ - What blockers were there?
44
+ - What took longer than expected?
45
+ - What mistakes were made?
46
+
47
+ ### Step 4: Update Memory
48
+
49
+ Update the relevant memory files:
50
+
51
+ #### context.md
52
+
53
+ Update `.planning/memory/context.md` with current state:
54
+ ```markdown
55
+ # Project Context
56
+
57
+ ## Current Focus
58
+ - Working on: {feature}
59
+ - Status: {completed | in progress}
60
+ - Blocked by: {blockers or "none"}
61
+
62
+ ## Recent Decisions (last 2 weeks)
63
+ - {any decision from this task}
64
+
65
+ ## Health
66
+ - Last retrospective: {date}
67
+ - Open anti-patterns: {count}
68
+ - Stale patterns: {count}
69
+ ```
70
+
71
+ #### patterns.md
72
+
73
+ If a new pattern was discovered, add:
74
+ ```markdown
75
+ ## {Pattern Name} [confidence: low, confirmed: 1x, added: {date}, last: {date}]
76
+ - **Pattern**: {description}
77
+ - **Where**: {where it is used}
78
+ - **Convention**: {convention}
79
+ - **From**: {DEC-XXX if derived from a decision, or blank}
80
+ - **Discovered**: {date}
81
+ ```
82
+
83
+ If an existing pattern was used again, **update its metadata**:
84
+ - Increment `confirmed` count
85
+ - Update `last` date
86
+ - Promote confidence: `low` (1x) -> `medium` (2-4x) -> `high` (5+)
87
+
88
+ #### anti-patterns.md
89
+
90
+ If an anti-pattern was discovered, add:
91
+ ```markdown
92
+ ## Anti-pattern: {anti-pattern}
93
+ - **Why it is bad**: {reason}
94
+ - **Correct approach**: {how it should be done}
95
+ - **Related decision**: {DEC-XXX if avoided by a decision, or blank}
96
+ - **Occurrences**: {count}
97
+ ```
98
+
99
+ #### decisions.md
100
+
101
+ If an architectural decision was made, add:
102
+ ```markdown
103
+ ## [DEC-{XXX}] {Decision Title}
104
+ - **Date**: {date}
105
+ - **Status**: accepted
106
+ - **Context**: {why this decision was needed}
107
+ - **Decision**: {what was decided}
108
+ - **Consequences**: {what follows}
109
+
110
+ Related:
111
+ - → derives: patterns.md#{pattern-name}
112
+ - → avoids: anti-patterns.md#{anti-pattern-name}
113
+ ```
114
+
115
+ #### wins.md
116
+
117
+ If the task went well, add:
118
+ ```markdown
119
+ ## {date}: {feature}
120
+ - **What was done**: {description}
121
+ - **Why it worked**: {reasons}
122
+ - **Time**: {actual} min (estimate: {estimate} min)
123
+ - **Preserved**: {pattern/approach}
124
+ ```
125
+
126
+ #### metrics.md
127
+
128
+ Update metrics. Recalculate task type aggregates:
129
+ ```markdown
130
+ ## Overall
131
+ - Total tasks completed: {N}
132
+ - Average time per task: {N} min
133
+ - Success rate: {N}%
134
+
135
+ ## Task Type Analysis
136
+ | Type | Count | Avg Time | Anti-pattern Rate |
137
+ |------|-------|----------|-------------------|
138
+ | feature | {N} | {N}h | {N}% |
139
+ | bug | {N} | {N}h | {N}% |
140
+ | refactor | {N} | {N}h | {N}% |
141
+ | other | {N} | {N}h | {N}% |
142
+ ```
143
+
144
+ ### Step 4b: Cross-link memory files
145
+
146
+ After writing to decisions.md, check if the new decision implies any of the following:
147
+
148
+ - **New pattern**: if the decision establishes a repeatable approach, ensure a corresponding entry exists in `patterns.md` (or update an existing one).
149
+ - **New anti-pattern**: if the decision avoids or replaces a previous approach, ensure the old approach is recorded in `anti-patterns.md` with the correct approach pointing to the new decision.
150
+ - **Orphan check**: scan the new decision's `→ derives` and `→ avoids` links — if any link target does not exist, create it or remove the broken link.
151
+
152
+ ### Step 5: Create retrospective report
153
+
154
+ Create `docs/specs/{feature}/retrospective.md`:
155
+
156
+ ```markdown
157
+ # Retrospective: {Feature}
158
+
159
+ ## Date
160
+ {date}
161
+
162
+ ## Summary
163
+ - Tasks completed: {N}
164
+ - Time estimate: {estimate}
165
+ - Time actual: {actual}
166
+ - Win rate: {N}%
167
+
168
+ ## Wins
169
+ {what worked well}
170
+
171
+ ## Struggles
172
+ {what was difficult}
173
+
174
+ ## Lessons Learned
175
+ {what to remember}
176
+
177
+ ## Action Items
178
+ {what to do differently next time}
179
+ ```
180
+
181
+ ### Step 6: Update STATE.md (COMPLETE)
182
+
183
+ Update `.planning/STATE.md`:
184
+ ```markdown
185
+ ## Current Position
186
+ - Phase: REFLECT
187
+ - Feature: {feature}
188
+ - Status: COMPLETE
189
+ - Finished: {timestamp}
190
+ ```
191
+
192
+ ## Result
193
+
194
+ - Retrospective report created
195
+ - Memory files updated
196
+ - `.planning/STATE.md` updated
@@ -0,0 +1,174 @@
1
+ # /frame:review -- Code Review + Automated Checks
2
+
3
+ Compares code against spec.md, checks security, performance, edge cases, runs automated checks.
4
+
5
+ ## Instructions
6
+
7
+ Execute a code review of the current feature.
8
+
9
+ ### Step 0: Update STATE.md (start)
10
+
11
+ Update `.planning/STATE.md` before any work:
12
+ ```markdown
13
+ ## Current Position
14
+ - Phase: REVIEW
15
+ - Status: IN_PROGRESS
16
+ - Started: {timestamp}
17
+ ```
18
+
19
+ ### Step 1: Find and read context
20
+
21
+ - `find docs/specs -name "spec.md" | head -5`
22
+ - `find docs/specs -name "plan.md" | head -5`
23
+ - `find docs/specs -name "research.md" | head -5`
24
+ - Read spec.md, plan.md and the **Memory Impact** section from research.md
25
+
26
+ | File | Section | Why |
27
+ |------|---------|-----|
28
+ | `spec.md` | full file | requirements to verify against |
29
+ | `plan.md` | full file | architecture and task Risk levels |
30
+ | `research.md → Memory Impact` | Memory Impact section | context for decisions — avoid flagging intentional tradeoffs |
31
+ | `.planning/memory/anti-patterns.md` | full file | verify code does not repeat known anti-patterns |
32
+ | `.planning/memory/dependencies.md` | full file | verify no unauthorized dependencies added |
33
+
34
+ ### Step 2: Automated Checks
35
+
36
+ Run all automated checks:
37
+ ```bash
38
+ {quality.commands.typecheck} # Type checking
39
+ {quality.commands.test} # Test check
40
+ {quality.commands.lint} # Lint check
41
+ {quality.commands.build} # Build check
42
+ ```
43
+
44
+ **D-step**: All checks MUST pass. If any fail — record errors and do NOT continue the review.
45
+
46
+ ### Step 3: Code Review Checklist
47
+
48
+ #### Before the checklist: check Risk tasks
49
+
50
+ Find all tasks with `Risk: high` in plan.md → for each do a deep check:
51
+ - Are all edge cases covered by tests
52
+ - No regressions in related modules
53
+ - Security analysis is mandatory (even if the task is not auth-related)
54
+
55
+ #### Code Matches Spec
56
+ - [ ] All requirements from spec.md are implemented
57
+ - [ ] No extra features (scope creep)
58
+ - [ ] Architecture matches plan.md
59
+
60
+ #### Tests
61
+ - [ ] Tests cover all cases from spec
62
+ - [ ] Edge cases covered
63
+ - [ ] Error cases covered
64
+ - [ ] Tests in `__tests__/` directory (or project test convention)
65
+
66
+ #### Security (OWASP)
67
+ - [ ] Input validation
68
+ - [ ] XSS prevention
69
+ - [ ] CSRF protection
70
+ - [ ] No sensitive data in logs
71
+ - [ ] Secure credential handling (httpOnly, secure, SameSite cookies if applicable)
72
+
73
+ #### Performance
74
+ - [ ] No N+1 queries
75
+ - [ ] Proper caching
76
+ - [ ] No memory leaks
77
+ - [ ] Bundle size acceptable
78
+
79
+ #### Code Quality
80
+ - [ ] No `any` type
81
+ - [ ] No `@ts-ignore`
82
+ - [ ] Proper error handling
83
+ - [ ] Error reporting configured (Sentry or equivalent)
84
+ - [ ] No `console.log` in production code
85
+ - [ ] Follows project conventions
86
+
87
+ #### i18n (if applicable)
88
+ - [ ] All UI text uses translations
89
+ - [ ] Default language set per project config
90
+ - [ ] Keys follow dot.notation
91
+
92
+ **Issue classification** — for each problem found:
93
+ - **Critical**: must fix before Ship (blocks deploy)
94
+ - **Warning**: should fix (recommended, does not block)
95
+ - **Info**: consider fixing (optional)
96
+
97
+ ### Step 4: Create review report
98
+
99
+ Create `docs/specs/{feature}/review.md`:
100
+
101
+ ```markdown
102
+ # Review: {Feature}
103
+
104
+ ## Date
105
+ {date}
106
+
107
+ ## Automated Checks
108
+ - [x] Typecheck: PASS
109
+ - [x] Tests: PASS
110
+ - [x] Lint: PASS
111
+ - [x] Build: PASS
112
+
113
+ ## Code Review
114
+
115
+ ### Spec Compliance
116
+ {results}
117
+
118
+ ### Security
119
+ {results}
120
+
121
+ ### Performance
122
+ {results}
123
+
124
+ ### Code Quality
125
+ {results}
126
+
127
+ ## Issues Found
128
+ {list of issues, if any}
129
+
130
+ ## Recommendation
131
+ {approve / request changes}
132
+
133
+ ## Action Items
134
+ {specific items to fix}
135
+
136
+ ## Memory Updates
137
+ - anti-patterns.md: {what to add if a problem was found}
138
+ - patterns.md: {what was confirmed as a good pattern}
139
+ - decisions.md: {if a decision was made to change approach}
140
+ ```
141
+
142
+ ### Step 5: Update STATE.md (final)
143
+
144
+ **If approve:**
145
+ ```markdown
146
+ ## Current Position
147
+ - Phase: REVIEW
148
+ - Feature: {feature}
149
+ - Status: Review complete, ready to ship
150
+ ```
151
+
152
+ **If request changes:**
153
+ ```markdown
154
+ ## Current Position
155
+ - Phase: BUILD
156
+ - Feature: {feature}
157
+ - Status: REVIEW_FAILED
158
+ - Review: docs/specs/{feature}/review.md
159
+ - Critical Issues: {N}
160
+ ```
161
+
162
+ Notify the user on request changes:
163
+ ```
164
+ ❌ Review failed. {N} critical issues.
165
+ Fixes: docs/specs/{feature}/review.md → Action Items
166
+ Run /frame:build to fix.
167
+ ```
168
+
169
+ ## Result
170
+
171
+ - All automated checks passed
172
+ - Code review completed
173
+ - Review report created with Memory Updates section
174
+ - `.planning/STATE.md` updated
@@ -0,0 +1,207 @@
1
+ # /frame:rollback -- Rollback to Checkpoint
2
+
3
+ Roll back to the last or a specific checkpoint with confirmation.
4
+
5
+ ## Instructions
6
+
7
+ Command: **$ARGUMENTS**
8
+
9
+ ### Routing
10
+
11
+ Determine action from arguments:
12
+ - (empty) -- rollback to the last checkpoint
13
+ - `--to <tag>` -- rollback to a specific checkpoint
14
+ - `--soft` -- soft rollback (files stay in working tree)
15
+
16
+ ---
17
+
18
+ ## Action: Default (last checkpoint)
19
+
20
+ ### Step 0: Update STATE.md (IN_PROGRESS) + Fail-Fast Checks
21
+
22
+ Update `.planning/STATE.md`:
23
+ ```markdown
24
+ - Phase: ROLLBACK
25
+ - Status: IN_PROGRESS
26
+ - Started: {timestamp}
27
+ ```
28
+
29
+ Check for uncommitted changes:
30
+ ```bash
31
+ git status --porcelain
32
+ ```
33
+
34
+ If there are uncommitted changes → **STOP**:
35
+ ```
36
+ ❌ Rollback blocked: uncommitted changes detected.
37
+ Commit or stash your changes first:
38
+ git stash (to save temporarily)
39
+ git checkout -- . (to discard)
40
+ ```
41
+
42
+ ### Step 1: Find Last Checkpoint
43
+
44
+ ```bash
45
+ LAST_CHECKPOINT=$(git tag -l "frame/checkpoint/*" --sort=-creatordate | head -n 1)
46
+ ```
47
+
48
+ If no checkpoints exist, show "No checkpoints found" and exit.
49
+
50
+ ### Step 2: Show Diff
51
+
52
+ ```bash
53
+ echo "=== Changes since checkpoint ==="
54
+ git log --oneline $LAST_CHECKPOINT..HEAD
55
+ echo ""
56
+ echo "=== Files changed ==="
57
+ git diff --stat $LAST_CHECKPOINT..HEAD
58
+ ```
59
+
60
+ ### Step 3: Confirmation
61
+
62
+ ```
63
+ +======================================================================+
64
+ | ROLLBACK CONFIRMATION |
65
+ +======================================================================+
66
+ | Checkpoint: {tag} |
67
+ | Created: {date} |
68
+ | |
69
+ | Changes to be discarded: |
70
+ | {list of commits} |
71
+ | |
72
+ | WARNING: This will discard {count} commits! |
73
+ | |
74
+ | Type "yes" to confirm rollback |
75
+ +======================================================================+
76
+ ```
77
+
78
+ **If the user does not confirm** -> abort, do nothing.
79
+
80
+ ### Step 4: Execute Rollback
81
+
82
+ ```bash
83
+ git reset --hard $LAST_CHECKPOINT
84
+ ```
85
+
86
+ ### Step 5: Show Result + Update STATE.md (DONE)
87
+
88
+ Update `.planning/STATE.md`:
89
+ ```markdown
90
+ - Phase: {previous_phase}
91
+ - Status: ROLLED_BACK
92
+ - Checkpoint: {tag}
93
+ ```
94
+
95
+ ```
96
+ +======================================================================+
97
+ | ROLLBACK COMPLETE |
98
+ +======================================================================+
99
+ | Rolled back to: {tag} |
100
+ | Discarded commits: {count} |
101
+ | |
102
+ | Working directory is now at checkpoint state |
103
+ | Next: /frame:checkpoint list (to see remaining checkpoints) |
104
+ +======================================================================+
105
+ ```
106
+
107
+ ---
108
+
109
+ ## Action: --to <tag>
110
+
111
+ Rollback to a specific checkpoint.
112
+
113
+ ### Step 0: Update STATE.md (IN_PROGRESS) + Fail-Fast Checks
114
+
115
+ Same as Default action Step 0.
116
+
117
+ ### Step 1: Validate Tag
118
+
119
+ ```bash
120
+ git tag -l "$TAG"
121
+ ```
122
+
123
+ If tag is not found, show available checkpoints:
124
+ ```bash
125
+ git tag -l "frame/checkpoint/*" --sort=-creatordate
126
+ ```
127
+
128
+ ### Step 2: Show Diff
129
+
130
+ ```bash
131
+ echo "=== Changes since $TAG ==="
132
+ git log --oneline $TAG..HEAD
133
+ ```
134
+
135
+ ### Step 3: Confirmation + Rollback
136
+
137
+ (Same as Default, but with the specified tag)
138
+
139
+ Update STATE.md (DONE) same as Default Step 5.
140
+
141
+ ---
142
+
143
+ ## Action: --soft
144
+
145
+ Soft rollback: files reset to checkpoint state, but changes remain in the working tree.
146
+
147
+ ### Step 0: Update STATE.md (IN_PROGRESS)
148
+
149
+ Update `.planning/STATE.md`:
150
+ ```markdown
151
+ - Phase: ROLLBACK
152
+ - Status: IN_PROGRESS
153
+ - Started: {timestamp}
154
+ ```
155
+
156
+ ### Step 1: Find Checkpoint
157
+
158
+ (Same as Default)
159
+
160
+ ### Step 2: Show Diff (what will be preserved)
161
+
162
+ ```bash
163
+ echo "=== Changes that will be preserved in working tree ==="
164
+ git diff --stat $LAST_CHECKPOINT..HEAD
165
+ ```
166
+
167
+ ### Step 3: Execute Soft Rollback
168
+
169
+ ```bash
170
+ git reset --soft $LAST_CHECKPOINT
171
+ ```
172
+
173
+ ### Step 4: Show Result + Update STATE.md (DONE)
174
+
175
+ Update `.planning/STATE.md`:
176
+ ```markdown
177
+ - Phase: {previous_phase}
178
+ - Status: SOFT_ROLLED_BACK
179
+ - Checkpoint: {tag}
180
+ ```
181
+
182
+ ```
183
+ +======================================================================+
184
+ | SOFT ROLLBACK COMPLETE |
185
+ +======================================================================+
186
+ | Rolled back to: {tag} |
187
+ | |
188
+ | Files reset to checkpoint state |
189
+ | Changes preserved in working directory |
190
+ | |
191
+ | Review changes: git diff |
192
+ | Discard changes: git checkout -- . |
193
+ | Next: /frame:checkpoint list (to see remaining checkpoints) |
194
+ +======================================================================+
195
+ ```
196
+
197
+ ## Rules
198
+
199
+ - **Always require confirmation** -- never run `git reset --hard` without user approval
200
+ - **Show diff** -- what will be lost
201
+ - **Soft rollback** -- alternative for cautious rollback
202
+ - **Check git status** -- verify no uncommitted changes before rollback
203
+
204
+ ## Result
205
+
206
+ - Rollback executed (hard or soft)
207
+ - User informed about lost changes