@speclife/cli 0.9.0 → 0.9.2
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/dist/index.d.ts +0 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/templates/commands/convert.md +22 -159
- package/templates/commands/land.md +20 -241
- package/templates/commands/release.md +19 -114
- package/templates/commands/retrofit.md +22 -303
- package/templates/commands/setup.md +20 -292
- package/templates/commands/ship.md +18 -162
- package/templates/commands/start.md +17 -269
- package/templates/commands/sync.md +16 -164
|
@@ -2,118 +2,23 @@
|
|
|
2
2
|
name: /speclife-release
|
|
3
3
|
id: speclife-release
|
|
4
4
|
category: SpecLife
|
|
5
|
-
description: Create a release with version bump for
|
|
5
|
+
description: Create a release with version bump (typically for major versions).
|
|
6
6
|
---
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
/speclife release --minor # Force minor version bump
|
|
26
|
-
/speclife release --patch # Force patch version bump
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
## When to Use
|
|
30
|
-
|
|
31
|
-
- **Major releases**: Breaking changes that require manual review
|
|
32
|
-
- **Forced releases**: When auto-release is disabled or skipped
|
|
33
|
-
- **Independent releases**: Creating a release without going through `/speclife land`
|
|
34
|
-
|
|
35
|
-
## Preconditions
|
|
36
|
-
|
|
37
|
-
- On `main` branch
|
|
38
|
-
- Working directory clean
|
|
39
|
-
- Changes merged since last release (for auto-detect)
|
|
40
|
-
|
|
41
|
-
## Steps
|
|
42
|
-
|
|
43
|
-
1. **Check branch**: Ensure on `main` branch
|
|
44
|
-
- If not, suggest switching or report error
|
|
45
|
-
|
|
46
|
-
2. **Analyze commits**: Determine suggested version bump
|
|
47
|
-
- Get commits since last tag
|
|
48
|
-
- `feat:` commits → minor
|
|
49
|
-
- `fix:` commits → patch
|
|
50
|
-
- `BREAKING CHANGE` or `!` → major
|
|
51
|
-
- Use explicit flag if provided (--major, --minor, --patch)
|
|
52
|
-
|
|
53
|
-
3. **Get current version**: Read from package.json (or equivalent)
|
|
54
|
-
|
|
55
|
-
4. **Calculate new version**: Apply bump to current version
|
|
56
|
-
- Major: 1.2.3 → 2.0.0
|
|
57
|
-
- Minor: 1.2.3 → 1.3.0
|
|
58
|
-
- Patch: 1.2.3 → 1.2.4
|
|
59
|
-
|
|
60
|
-
5. **Update version file**: Write new version to package.json
|
|
61
|
-
|
|
62
|
-
6. **Update CHANGELOG**: Add release notes
|
|
63
|
-
- Group commits by type (Features, Fixes, etc.)
|
|
64
|
-
- Include commit messages and PR references
|
|
65
|
-
|
|
66
|
-
7. **Commit**: `git commit -am "chore(release): vX.X.X"`
|
|
67
|
-
- This commit message triggers the release workflow
|
|
68
|
-
|
|
69
|
-
8. **Push**: `git push origin main`
|
|
70
|
-
|
|
71
|
-
9. **Create release PR** (optional, for review):
|
|
72
|
-
- If major release, create PR for review
|
|
73
|
-
- If patch/minor with auto-merge, push directly
|
|
74
|
-
|
|
75
|
-
10. **Report**: Show next steps
|
|
76
|
-
|
|
77
|
-
## Example
|
|
78
|
-
|
|
79
|
-
```
|
|
80
|
-
User: /speclife release --major
|
|
81
|
-
|
|
82
|
-
Agent:
|
|
83
|
-
Analyzing commits since v1.2.3...
|
|
84
|
-
- feat: add OAuth login (breaking: changes auth API)
|
|
85
|
-
- fix: correct redirect URL
|
|
86
|
-
- docs: update API documentation
|
|
87
|
-
|
|
88
|
-
Current version: 1.2.3
|
|
89
|
-
New version: 2.0.0 (major bump)
|
|
90
|
-
|
|
91
|
-
✓ Updated package.json to 2.0.0
|
|
92
|
-
✓ Updated CHANGELOG.md
|
|
93
|
-
✓ Committed: "chore(release): v2.0.0"
|
|
94
|
-
✓ Pushed to origin/main
|
|
95
|
-
|
|
96
|
-
Release workflow triggered. GitHub Actions will:
|
|
97
|
-
1. Create tag v2.0.0
|
|
98
|
-
2. Create GitHub Release with notes
|
|
99
|
-
3. Publish to npm (if configured)
|
|
100
|
-
|
|
101
|
-
Done! Release v2.0.0 is being created.
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
## Release Workflow
|
|
105
|
-
|
|
106
|
-
When the `chore(release): vX.X.X` commit is pushed, the GitHub Actions workflow (`.github/workflows/speclife-release.yml`) automatically:
|
|
107
|
-
|
|
108
|
-
1. Extracts version from commit message
|
|
109
|
-
2. Creates git tag
|
|
110
|
-
3. Creates GitHub Release with auto-generated notes
|
|
111
|
-
4. Optionally publishes to package registry
|
|
112
|
-
|
|
113
|
-
## Notes
|
|
114
|
-
|
|
115
|
-
- For patch/minor releases, prefer using `/speclife land` which handles auto-release
|
|
116
|
-
- Major releases should go through this command for explicit control
|
|
117
|
-
- The release commit message format `chore(release): vX.X.X` is required for the workflow
|
|
118
|
-
|
|
119
|
-
|
|
7
|
+
**Guardrails**
|
|
8
|
+
- Execute immediately—must be on main with clean working directory
|
|
9
|
+
- Use for major releases or when auto-release was skipped
|
|
10
|
+
- For patch/minor, prefer `/speclife land` which handles auto-release
|
|
11
|
+
|
|
12
|
+
**Steps**
|
|
13
|
+
1. Check branch: must be on `main`; error otherwise.
|
|
14
|
+
2. Analyze commits since last tag: `feat:` → minor, `fix:` → patch, `BREAKING CHANGE` or `!` → major; use explicit flag (--major/--minor/--patch) if provided.
|
|
15
|
+
3. Calculate new version from current `package.json`.
|
|
16
|
+
4. Update version: `npm version <bump> --no-git-tag-version` (and workspaces if monorepo).
|
|
17
|
+
5. Update CHANGELOG.md with grouped commits.
|
|
18
|
+
6. Commit: `git commit -am "chore(release): v<version>"`.
|
|
19
|
+
7. Push: `git push origin main`.
|
|
20
|
+
8. Report: version bumped, pushed, GitHub Actions will create tag and release.
|
|
21
|
+
|
|
22
|
+
**Reference**
|
|
23
|
+
- Commit message format `chore(release): vX.X.X` triggers release workflow
|
|
24
|
+
- Major releases should use this command; patch/minor typically via `/speclife land`
|
|
@@ -2,307 +2,26 @@
|
|
|
2
2
|
name: /speclife-retrofit
|
|
3
3
|
id: speclife-retrofit
|
|
4
4
|
category: SpecLife
|
|
5
|
-
description: Formalize ad-hoc changes on main into a
|
|
5
|
+
description: Formalize ad-hoc changes on main into a spec-tracked change for review.
|
|
6
6
|
---
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
**
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
## Goal
|
|
29
|
-
|
|
30
|
-
Convert ad-hoc changes on main into a proper spec-tracked workflow:
|
|
31
|
-
1. Document the change with a spec (proposal + tasks)
|
|
32
|
-
2. Move changes to a spec branch for review
|
|
33
|
-
3. Archive the spec
|
|
34
|
-
4. Create PR for approval before merging back
|
|
35
|
-
|
|
36
|
-
This bridges quick ad-hoc work with the spec-driven process.
|
|
37
|
-
|
|
38
|
-
## When to Use
|
|
39
|
-
|
|
40
|
-
- Made changes on main without going through `/speclife start`
|
|
41
|
-
- Want to properly document and review ad-hoc changes
|
|
42
|
-
- Need to create a release-worthy PR from untracked work
|
|
43
|
-
|
|
44
|
-
## Prerequisites
|
|
45
|
-
|
|
46
|
-
Must be on `main` branch with one of:
|
|
47
|
-
- Uncommitted changes (modified/staged files)
|
|
48
|
-
- Recent commits not yet pushed
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
# Validation
|
|
52
|
-
BRANCH=$(git branch --show-current)
|
|
53
|
-
[[ "$BRANCH" != "main" ]] && error "Must be on main branch"
|
|
54
|
-
|
|
55
|
-
# Check for changes
|
|
56
|
-
UNCOMMITTED=$(git status --porcelain)
|
|
57
|
-
UNPUSHED=$(git log origin/main..HEAD --oneline 2>/dev/null)
|
|
58
|
-
|
|
59
|
-
[[ -z "$UNCOMMITTED" && -z "$UNPUSHED" ]] && error "No changes to retrofit"
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
## Core Steps
|
|
63
|
-
|
|
64
|
-
### 1. Detect Changes
|
|
65
|
-
|
|
66
|
-
```bash
|
|
67
|
-
# Show what will be retrofitted
|
|
68
|
-
echo "Changes to retrofit:"
|
|
69
|
-
git status --short # Uncommitted changes
|
|
70
|
-
git log origin/main..HEAD --oneline # Unpushed commits (if any)
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
### 2. Derive change-id
|
|
74
|
-
|
|
75
|
-
Convert description to kebab-case:
|
|
76
|
-
- "Update ship command to use two commits" → `update-ship-two-commits`
|
|
77
|
-
- Prefix with verb: add-, fix-, update-, remove-, refactor-
|
|
78
|
-
- Keep it short (3-5 words max)
|
|
79
|
-
|
|
80
|
-
```bash
|
|
81
|
-
CHANGE_ID=<derived-from-description>
|
|
82
|
-
SPEC_DIR="openspec/changes/${CHANGE_ID}"
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
### 3. Create Spec
|
|
86
|
-
|
|
87
|
-
Invoke `/openspec-proposal` with the description:
|
|
88
|
-
- Creates `openspec/changes/<change-id>/proposal.md`
|
|
89
|
-
- Creates `openspec/changes/<change-id>/tasks.md`
|
|
90
|
-
- Tasks should reflect what was ALREADY DONE (mark completed)
|
|
91
|
-
|
|
92
|
-
**Important:** The proposal documents what was implemented, not what needs to be done.
|
|
93
|
-
|
|
94
|
-
### 4. Validate Spec
|
|
95
|
-
|
|
96
|
-
```bash
|
|
97
|
-
openspec validate <change-id>
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
Fix any validation errors before proceeding.
|
|
101
|
-
|
|
102
|
-
### 5. Create Spec Branch
|
|
103
|
-
|
|
104
|
-
```bash
|
|
105
|
-
# Create and switch to spec branch (carries uncommitted changes)
|
|
106
|
-
git checkout -b spec/<change-id>
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
Note: Uncommitted changes automatically move to the new branch.
|
|
110
|
-
|
|
111
|
-
### 6. Commit Implementation + Spec
|
|
112
|
-
|
|
113
|
-
Read proposal.md for commit message, then:
|
|
114
|
-
|
|
115
|
-
```bash
|
|
116
|
-
git add -A
|
|
117
|
-
git commit -m "<type>: <description>"
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
This commit includes:
|
|
121
|
-
- The ad-hoc implementation changes
|
|
122
|
-
- The spec files (proposal.md, tasks.md)
|
|
123
|
-
|
|
124
|
-
### 7. Archive Spec
|
|
125
|
-
|
|
126
|
-
Run `/openspec-archive`:
|
|
127
|
-
- Moves spec to `openspec/changes/archive/<date>-<change-id>/`
|
|
128
|
-
- May require updating `project.md` (follow archive prompts)
|
|
129
|
-
|
|
130
|
-
### 8. Commit Archive
|
|
131
|
-
|
|
132
|
-
```bash
|
|
133
|
-
git add -A
|
|
134
|
-
git commit -m "chore: archive <change-id> spec"
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
### 9. Push and Create PR
|
|
138
|
-
|
|
139
|
-
```bash
|
|
140
|
-
git push -u origin spec/<change-id>
|
|
141
|
-
gh pr create --fill --base main
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
### 10. Reset Main (Safety)
|
|
145
|
-
|
|
146
|
-
After successful PR creation, main should be clean:
|
|
147
|
-
|
|
148
|
-
```bash
|
|
149
|
-
# Main is already clean because:
|
|
150
|
-
# - Uncommitted changes moved to spec branch
|
|
151
|
-
# - We're now on spec branch, not main
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
### 11. Report and STOP
|
|
155
|
-
|
|
156
|
-
```
|
|
157
|
-
✓ Detected changes in: <list of changed files>
|
|
158
|
-
✓ Created spec at openspec/changes/<change-id>/
|
|
159
|
-
✓ Validated spec
|
|
160
|
-
✓ Created branch spec/<change-id>
|
|
161
|
-
✓ Committed: "<type>: <description>"
|
|
162
|
-
✓ Archived spec
|
|
163
|
-
✓ Committed: "chore: archive <change-id> spec"
|
|
164
|
-
✓ Pushed to origin/spec/<change-id>
|
|
165
|
-
✓ Created PR #XX: <url>
|
|
166
|
-
|
|
167
|
-
Your changes are now on spec/<change-id> (main is unchanged).
|
|
168
|
-
|
|
169
|
-
Next: After approval, run /speclife land
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
**⛔ STOP HERE.** Do NOT proceed to merge. Wait for:
|
|
173
|
-
1. PR review and approval
|
|
174
|
-
2. User to invoke `/speclife land`
|
|
175
|
-
|
|
176
|
-
---
|
|
177
|
-
|
|
178
|
-
<!-- REFERENCE SECTIONS - Read only when needed -->
|
|
179
|
-
|
|
180
|
-
## Appendix: Examples
|
|
181
|
-
|
|
182
|
-
**Basic retrofit:**
|
|
183
|
-
```
|
|
184
|
-
User: /speclife retrofit "update ship command workflow"
|
|
185
|
-
|
|
186
|
-
Agent:
|
|
187
|
-
ℹ️ On main branch
|
|
188
|
-
✓ Detected changes:
|
|
189
|
-
- openspec/commands/speclife/ship.md (modified)
|
|
190
|
-
✓ Derived change-id: update-ship-workflow
|
|
191
|
-
✓ Created spec at openspec/changes/update-ship-workflow/
|
|
192
|
-
✓ Validated spec
|
|
193
|
-
✓ Created branch spec/update-ship-workflow
|
|
194
|
-
✓ Committed: "docs: update ship command workflow"
|
|
195
|
-
✓ Archived spec
|
|
196
|
-
✓ Committed: "chore: archive update-ship-workflow spec"
|
|
197
|
-
✓ Pushed to origin/spec/update-ship-workflow
|
|
198
|
-
✓ Created PR #47
|
|
199
|
-
|
|
200
|
-
Next: After approval, run /speclife land
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
**With unpushed commits:**
|
|
204
|
-
```
|
|
205
|
-
User: /speclife retrofit "add retrofit command"
|
|
206
|
-
|
|
207
|
-
Agent:
|
|
208
|
-
ℹ️ On main branch
|
|
209
|
-
✓ Detected changes:
|
|
210
|
-
- 2 unpushed commits
|
|
211
|
-
- openspec/commands/speclife/retrofit.md (new file)
|
|
212
|
-
✓ Derived change-id: add-retrofit-command
|
|
213
|
-
✓ Created spec at openspec/changes/add-retrofit-command/
|
|
214
|
-
...
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
**Interactive:**
|
|
218
|
-
```
|
|
219
|
-
User: /speclife retrofit
|
|
220
|
-
|
|
221
|
-
Agent:
|
|
222
|
-
ℹ️ Detected uncommitted changes:
|
|
223
|
-
- src/api.ts (modified)
|
|
224
|
-
- src/utils.ts (modified)
|
|
225
|
-
|
|
226
|
-
What do these changes do? (describe for the spec)
|
|
227
|
-
|
|
228
|
-
User: Add rate limiting to API endpoints
|
|
229
|
-
|
|
230
|
-
Agent:
|
|
231
|
-
✓ Derived change-id: add-rate-limiting
|
|
232
|
-
...
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
## Appendix: Error Handling
|
|
236
|
-
|
|
237
|
-
**Not on main:**
|
|
238
|
-
```
|
|
239
|
-
❌ Must be on main branch to retrofit.
|
|
240
|
-
Current branch: feature/something
|
|
241
|
-
|
|
242
|
-
Either:
|
|
243
|
-
1. Switch to main: git checkout main
|
|
244
|
-
2. Use /speclife ship for non-main branches
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
**No changes to retrofit:**
|
|
248
|
-
```
|
|
249
|
-
❌ No changes to retrofit.
|
|
250
|
-
|
|
251
|
-
Working directory is clean and no unpushed commits.
|
|
252
|
-
|
|
253
|
-
Make some changes first, then run /speclife retrofit
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
**Spec already exists:**
|
|
257
|
-
```
|
|
258
|
-
❌ Spec 'update-ship-workflow' already exists.
|
|
259
|
-
|
|
260
|
-
Either:
|
|
261
|
-
1. Choose a different description
|
|
262
|
-
2. Remove existing: rm -rf openspec/changes/update-ship-workflow/
|
|
263
|
-
3. Use /speclife start "resume update-ship-workflow" to continue existing
|
|
264
|
-
```
|
|
265
|
-
|
|
266
|
-
**Validation failed:**
|
|
267
|
-
```
|
|
268
|
-
❌ Spec validation failed:
|
|
269
|
-
- proposal.md: Missing "What" section
|
|
270
|
-
|
|
271
|
-
Fix issues and retry.
|
|
272
|
-
```
|
|
273
|
-
|
|
274
|
-
## Appendix: Comparison with Other Commands
|
|
275
|
-
|
|
276
|
-
| Command | Starting Point | Creates Spec? | Flow |
|
|
277
|
-
|---------|---------------|---------------|------|
|
|
278
|
-
| `/speclife start` | Clean main | Yes (before implementation) | Spec → Implement → Ship |
|
|
279
|
-
| `/speclife retrofit` | Main with changes | Yes (after implementation) | Implement → Spec → Ship |
|
|
280
|
-
| `/speclife ship` | Spec branch | No (uses existing) | Ship existing work |
|
|
281
|
-
|
|
282
|
-
## Appendix: What Gets Committed
|
|
283
|
-
|
|
284
|
-
**First commit** (implementation + spec):
|
|
285
|
-
```
|
|
286
|
-
<type>: <description>
|
|
287
|
-
|
|
288
|
-
- Implementation changes (the ad-hoc work)
|
|
289
|
-
- openspec/changes/<change-id>/proposal.md
|
|
290
|
-
- openspec/changes/<change-id>/tasks.md
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
**Second commit** (archive):
|
|
294
|
-
```
|
|
295
|
-
chore: archive <change-id> spec
|
|
296
|
-
|
|
297
|
-
- Move spec to archive/
|
|
298
|
-
- Update project.md (if applicable)
|
|
299
|
-
```
|
|
300
|
-
|
|
301
|
-
## Notes
|
|
302
|
-
|
|
303
|
-
- Retrofit is for MAIN branch only (ad-hoc changes)
|
|
304
|
-
- For changes on feature branches, use `/speclife ship` instead
|
|
305
|
-
- The spec documents what WAS done, not what NEEDS to be done
|
|
306
|
-
- Tasks in tasks.md should be marked as completed
|
|
307
|
-
- Main branch stays clean (changes move to spec branch)
|
|
308
|
-
|
|
7
|
+
**Guardrails**
|
|
8
|
+
- Execute immediately—must be on `main` with uncommitted changes or unpushed commits
|
|
9
|
+
- Generate spec from actual changes (retrospective), not speculation
|
|
10
|
+
- STOP after PR created—do NOT auto-invoke `/speclife land`
|
|
11
|
+
- Do NOT manually replicate `openspec archive`—run the command and report errors if it fails
|
|
12
|
+
|
|
13
|
+
**Steps**
|
|
14
|
+
1. Detect changes: `git status --short` and `git log origin/main..HEAD --oneline`; error if no changes.
|
|
15
|
+
2. Analyze diffs to understand what was done; infer change type (feat, fix, refactor, docs).
|
|
16
|
+
3. Derive change-id: kebab-case with verb prefix (add-, fix-, update-, remove-, refactor-).
|
|
17
|
+
4. Review context: `openspec list --specs`, `cat openspec/project.md`.
|
|
18
|
+
5. Create retrospective spec: `proposal.md` (past tense), `tasks.md` (all `[x]` completed), spec deltas if applicable.
|
|
19
|
+
6. Validate and branch: `openspec validate <id>`, `git checkout -b spec/<id>`.
|
|
20
|
+
7. Commit, archive, push, PR: commit changes, run `openspec archive <id> --yes`, commit archive, push, create PR with `gh pr create --title "<type>: <description>" --body "<body>"`.
|
|
21
|
+
8. Report: change-id, spec created, PR URL. Next: `/speclife land` after approval.
|
|
22
|
+
|
|
23
|
+
**Reference**
|
|
24
|
+
- Proposal documents what was done (reality), not aspirations
|
|
25
|
+
- Uncommitted changes move to the new branch automatically
|
|
26
|
+
- PR title: use conventional commit format (`<type>: <meaningful description>`)
|
|
27
|
+
- PR body: if `.github/pull_request_template.md` exists, read it and fill in each section based on the change context
|