@speclife/cli 0.7.0 → 0.8.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@speclife/cli",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "CLI for SpecLife - for CI/scripts",
5
5
  "repository": {
6
6
  "type": "git",
@@ -21,8 +21,10 @@ Create a new branch for a change, optionally in a worktree for parallel work.
21
21
  ## Usage
22
22
 
23
23
  ```
24
- /speclife start <description> # Worktree (default)
25
- /speclife start <description> in a branch # Branch-only
24
+ /speclife start <description> # New proposal, worktree (default)
25
+ /speclife start <description> in a branch # New proposal, branch-only
26
+ /speclife start "resume <change-id>" # Resume existing proposal, worktree
27
+ /speclife start "implement <change-id>" # Resume if exists, create if not
26
28
  /speclife start # Interactive
27
29
  ```
28
30
 
@@ -32,7 +34,21 @@ Set up a workspace for a new change with proper git branch.
32
34
 
33
35
  ## Mode Detection
34
36
 
35
- Parse the input for workflow hints:
37
+ Parse the input for workflow hints in this order:
38
+
39
+ ### 1. Resume Intent Detection
40
+
41
+ | Phrase in input | Meaning |
42
+ |-----------------|---------|
43
+ | "resume <change-id>", "continue <change-id>", "pick up <change-id>" | **Resume existing proposal** (error if not found) |
44
+ | "implement <change-id>" | **Resume if exists**, create new if not |
45
+
46
+ Examples:
47
+ - `"resume fix-release-and-init"` → resume mode, change-id = `fix-release-and-init`
48
+ - `"continue working on add-oauth-login"` → resume mode, change-id = `add-oauth-login`
49
+ - `"implement fix-email-validation"` → try resume, fallback to new
50
+
51
+ ### 2. Worktree Mode Detection
36
52
 
37
53
  | Phrase in input | Mode |
38
54
  |-----------------|------|
@@ -40,18 +56,53 @@ Parse the input for workflow hints:
40
56
  | "in a worktree", "with worktree", "parallel" | **Worktree** |
41
57
  | Neither | **Worktree** (default) |
42
58
 
43
- Strip workflow hints from the description before deriving change-id.
59
+ ### 3. Parsing Order
60
+
61
+ 1. Check for resume keywords → extract change-id
62
+ 2. Check for mode keywords → determine worktree/branch
63
+ 3. Strip workflow hints → derive description (new proposals only)
64
+
65
+ Examples:
66
+ - `"resume fix-bug in a branch"` → resume mode, branch-only
67
+ - `"implement oauth with worktree"` → resume/new mode, worktree
44
68
 
45
69
  ## Steps
46
70
 
47
- ### 1. Derive change-id
71
+ ### 1. Check for Resume Intent
72
+
73
+ Parse input for resume keywords (`resume`, `continue`, `pick up`, `implement`):
74
+
75
+ **If resume intent detected:**
76
+ ```bash
77
+ CHANGE_ID=<extracted-from-input> # e.g., "fix-release-and-init"
78
+ PROPOSAL_DIR="openspec/changes/${CHANGE_ID}"
79
+
80
+ if [[ ! -d "$PROPOSAL_DIR" ]]; then
81
+ echo "❌ Proposal '${CHANGE_ID}' not found"
82
+ echo ""
83
+ echo "Available proposals:"
84
+ ls -1 openspec/changes/ | grep -v archive
85
+ exit 1
86
+ fi
87
+
88
+ echo "✓ Found existing proposal at ${PROPOSAL_DIR}/"
89
+ # Skip to step 3 (create branch/worktree)
90
+ ```
91
+
92
+ **If "implement" keyword and proposal doesn't exist:**
93
+ - Continue as new proposal (steps 2-5)
94
+
95
+ **If no resume intent:**
96
+ - Continue to step 2
97
+
98
+ ### 2. Derive change-id (New Proposals Only)
48
99
 
49
100
  Convert description to kebab-case:
50
101
  - "Add user authentication" → `add-user-auth`
51
102
  - Prefix with verb: add-, fix-, update-, remove-, refactor-
52
103
  - Keep it short (3-5 words max)
53
104
 
54
- ### 2. Create branch/worktree
105
+ ### 3. Create branch/worktree
55
106
 
56
107
  **Branch-only mode:**
57
108
  ```bash
@@ -68,15 +119,17 @@ speclife worktree create <change-id>
68
119
  - Creates branch `spec/<change-id>`
69
120
  - Parallel changes possible
70
121
 
71
- ### 3. Scaffold proposal
122
+ ### 4. Scaffold proposal (New Proposals Only)
123
+
124
+ **Skip this step if resuming an existing proposal.**
72
125
 
73
126
  Invoke `/openspec-proposal` with the description (minus workflow hints)
74
127
  - Creates `openspec/changes/<change-id>/proposal.md`
75
128
  - Creates `openspec/changes/<change-id>/tasks.md`
76
129
 
77
- ### 4. Report and STOP
130
+ ### 5. Report and STOP
78
131
 
79
- **Branch-only:**
132
+ **New Proposal - Branch-only:**
80
133
  ```
81
134
  ✓ Derived change-id: add-oauth-login
82
135
  ✓ Created branch spec/add-oauth-login
@@ -85,7 +138,7 @@ Invoke `/openspec-proposal` with the description (minus workflow hints)
85
138
  Next: Review the proposal, then run `/openspec-apply` to implement.
86
139
  ```
87
140
 
88
- **Worktree:**
141
+ **New Proposal - Worktree:**
89
142
  ```
90
143
  ✓ Derived change-id: add-oauth-login
91
144
  ✓ Created worktree at worktrees/add-oauth-login/
@@ -105,23 +158,75 @@ Next steps:
105
158
  NOT in the main repo paths!
106
159
  ```
107
160
 
161
+ **Resume Proposal - Branch-only:**
162
+ ```
163
+ ✓ Found existing proposal at openspec/changes/fix-release-and-init/
164
+ ✓ Created branch spec/fix-release-and-init
165
+ ℹ️ Proposal already defined - ready to implement
166
+
167
+ Next: Run `/openspec-apply` to implement tasks.
168
+ ```
169
+
170
+ **Resume Proposal - Worktree:**
171
+ ```
172
+ ✓ Found existing proposal at openspec/changes/fix-release-and-init/
173
+ ✓ Created worktree at worktrees/fix-release-and-init/
174
+ ✓ Created branch spec/fix-release-and-init
175
+ ℹ️ Proposal already defined - ready to implement
176
+
177
+ Next: cd worktrees/fix-release-and-init/ then run `/openspec-apply`.
178
+ ```
179
+
108
180
  **⛔ STOP HERE.** Do NOT proceed to implementation. Wait for user to:
109
- 1. Review the proposal
110
- 2. Switch to worktree directory
111
- 3. Invoke `/openspec-apply` or `/speclife implement` from there
181
+ 1. Review the proposal (if new)
182
+ 2. Switch to worktree directory (if worktree mode)
183
+ 3. Invoke `/openspec-apply` or `/speclife implement`
112
184
 
113
185
  ## Examples
114
186
 
187
+ **New proposals:**
115
188
  ```
116
189
  User: /speclife start "Add OAuth login support"
117
- → Creates worktree (default)
190
+ → Creates worktree (default), scaffolds new proposal
118
191
 
119
192
  User: /speclife start "Add OAuth login" in a branch
120
- → Creates branch only, no worktree
193
+ → Creates branch only, scaffolds new proposal
121
194
 
122
195
  User: /speclife start "fix login bug" branch only
123
- → Creates branch only
196
+ → Creates branch only, scaffolds new proposal
197
+ ```
198
+
199
+ **Resume existing proposals:**
200
+ ```
201
+ User: /speclife start "resume fix-release-and-init"
202
+ → Creates worktree, uses existing proposal
203
+
204
+ User: /speclife start "continue working on add-oauth-login"
205
+ → Creates worktree, uses existing proposal
206
+
207
+ User: /speclife start "pick up fix-email-validation in a branch"
208
+ → Creates branch only, uses existing proposal
124
209
 
210
+ User: /speclife start "implement add-user-auth"
211
+ → If proposal exists: resumes it
212
+ → If not: creates new proposal
213
+ ```
214
+
215
+ **Error case:**
216
+ ```
217
+ User: /speclife start "resume nonexistent-change"
218
+
219
+ Agent:
220
+ ❌ Proposal 'nonexistent-change' not found
221
+
222
+ Available proposals:
223
+ fix-release-and-init
224
+ add-oauth-login
225
+ fix-email-validation
226
+ ```
227
+
228
+ **Interactive:**
229
+ ```
125
230
  User: /speclife start
126
231
  → Prompts: "Describe your change" then "Worktree (default) or branch-only?"
127
232
  ```
@@ -149,8 +254,22 @@ User: /speclife start
149
254
 
150
255
  ## Notes
151
256
 
257
+ ### General
152
258
  - Branch name is always `spec/<change-id>` regardless of mode
153
259
  - If branch exists, error and suggest using existing
154
260
  - Branch-only: uncommitted changes carry over (stash if needed)
155
261
  - Worktree: clean checkout from main
156
262
  - To switch modes later, use `/speclife convert`
263
+
264
+ ### Resume Behavior
265
+ - Resume keywords: `resume`, `continue`, `pick up`, `implement`
266
+ - Proposals must exist in `openspec/changes/<change-id>/`
267
+ - Archived proposals are not searched (move from archive first if needed)
268
+ - Resume skips `/openspec-proposal` scaffolding
269
+ - "implement" keyword tries resume first, creates new if not found
270
+ - Combine with mode: "resume X in a branch" or "resume X with worktree"
271
+
272
+ ### Next Steps
273
+ - After creating new proposal: Review, refine, then `/openspec-apply`
274
+ - After resuming proposal: Directly run `/openspec-apply` to implement tasks
275
+ - Both workflows converge at implementation phase