@speclife/cli 0.6.0 → 0.6.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.js +21 -5
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
- package/templates/commands/convert.md +165 -0
- package/templates/commands/implement.md +44 -0
- package/templates/commands/land.md +246 -0
- package/templates/commands/release.md +119 -0
- package/templates/commands/setup.md +298 -0
- package/templates/commands/ship.md +154 -0
- package/templates/commands/start.md +145 -0
- package/templates/commands/sync.md +170 -0
- package/templates/speclife-release.yml +96 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: /speclife-release
|
|
3
|
+
id: speclife-release
|
|
4
|
+
category: SpecLife
|
|
5
|
+
description: Create a release with version bump for manual releases (major versions).
|
|
6
|
+
---
|
|
7
|
+
# /speclife release
|
|
8
|
+
|
|
9
|
+
Create a release with version bump. Used for manual releases (typically major versions).
|
|
10
|
+
|
|
11
|
+
## ⚡ Execution
|
|
12
|
+
|
|
13
|
+
**When this command is invoked, IMMEDIATELY execute the workflow below.**
|
|
14
|
+
|
|
15
|
+
- Check that we're on the main branch
|
|
16
|
+
- Analyze commits to determine version bump (or use explicit flag)
|
|
17
|
+
- Update version files and changelog
|
|
18
|
+
- Commit and push to trigger release workflow
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
/speclife release # Auto-detect version bump
|
|
24
|
+
/speclife release --major # Force major version bump
|
|
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
|
+
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: /speclife-setup
|
|
3
|
+
id: speclife-setup
|
|
4
|
+
category: SpecLife
|
|
5
|
+
description: Discover project configuration and populate openspec/speclife.md.
|
|
6
|
+
---
|
|
7
|
+
# /speclife setup
|
|
8
|
+
|
|
9
|
+
Discover project configuration and populate `openspec/speclife.md`.
|
|
10
|
+
|
|
11
|
+
## ⚡ Execution
|
|
12
|
+
|
|
13
|
+
**When this command is invoked, IMMEDIATELY execute the workflow below.**
|
|
14
|
+
|
|
15
|
+
- Scan project files to detect build system and commands
|
|
16
|
+
- Check for existing workflows and context files
|
|
17
|
+
- Update `openspec/speclife.md` with discovered configuration
|
|
18
|
+
- Offer to create publish workflow if missing (ask first)
|
|
19
|
+
|
|
20
|
+
## Goal
|
|
21
|
+
|
|
22
|
+
Auto-detect project commands (test, build, lint), publishing configuration, and context files to configure speclife for this project.
|
|
23
|
+
|
|
24
|
+
## Steps
|
|
25
|
+
|
|
26
|
+
1. **Read current config**: Check if `openspec/speclife.md` exists and what's already configured
|
|
27
|
+
|
|
28
|
+
2. **Detect build system**: Look for project configuration files:
|
|
29
|
+
- `package.json` → Node.js (npm/yarn/pnpm)
|
|
30
|
+
- `Cargo.toml` → Rust (cargo)
|
|
31
|
+
- `go.mod` → Go
|
|
32
|
+
- `Makefile` → Make-based
|
|
33
|
+
- `pyproject.toml` or `setup.py` → Python
|
|
34
|
+
- `build.gradle` or `pom.xml` → Java
|
|
35
|
+
|
|
36
|
+
3. **Extract commands**: From the detected build system, find:
|
|
37
|
+
- **Test command**: e.g., `npm test`, `cargo test`, `make test`
|
|
38
|
+
- **Build command**: e.g., `npm run build`, `cargo build`, `make build`
|
|
39
|
+
- **Lint command**: e.g., `npm run lint`, `cargo clippy`, `make lint`
|
|
40
|
+
|
|
41
|
+
4. **Detect publish configuration**: Based on project type:
|
|
42
|
+
|
|
43
|
+
| Project Type | Detection | Registry | Secret Required |
|
|
44
|
+
|--------------|-----------|----------|-----------------|
|
|
45
|
+
| Node.js | `package.json` with `name` (not private) | npm | `NPM_TOKEN` |
|
|
46
|
+
| Node.js monorepo | `workspaces` in package.json | npm | `NPM_TOKEN` |
|
|
47
|
+
| Rust | `Cargo.toml` with `[package]` | crates.io | `CARGO_REGISTRY_TOKEN` |
|
|
48
|
+
| Python | `pyproject.toml` with `[project]` | PyPI | `PYPI_TOKEN` |
|
|
49
|
+
| Go | `go.mod` | N/A (no central registry) | None |
|
|
50
|
+
| Internal/private | `"private": true` in package.json | N/A | None |
|
|
51
|
+
|
|
52
|
+
5. **Check for existing workflows**: Look in `.github/workflows/` for:
|
|
53
|
+
- `publish.yml` or similar publish workflow
|
|
54
|
+
- `release.yml` - release workflow
|
|
55
|
+
|
|
56
|
+
6. **Identify context files**: Look for common documentation:
|
|
57
|
+
- `openspec/project.md` - project context
|
|
58
|
+
- `openspec/AGENTS.md` - agent guidelines
|
|
59
|
+
- `README.md` - project overview
|
|
60
|
+
- `CONTRIBUTING.md` - contribution guidelines
|
|
61
|
+
|
|
62
|
+
7. **Update speclife.md**: Write discovered values to `openspec/speclife.md`
|
|
63
|
+
|
|
64
|
+
8. **Offer to create publish workflow** (if missing):
|
|
65
|
+
- If no publish workflow exists AND project is publishable (not private, not Go):
|
|
66
|
+
- Ask: "No publish workflow found. Would you like me to create `.github/workflows/publish.yml`?"
|
|
67
|
+
- If user agrees, create the appropriate workflow from the templates below
|
|
68
|
+
- Remind user to add the required secret in repo settings
|
|
69
|
+
- If project is private (`"private": true`) or Go (no central registry):
|
|
70
|
+
- Skip this step (no publish workflow needed)
|
|
71
|
+
|
|
72
|
+
9. **Report**: Tell the user what was configured and any next steps
|
|
73
|
+
|
|
74
|
+
## Publish Workflow Templates
|
|
75
|
+
|
|
76
|
+
Use these templates when creating publish workflows:
|
|
77
|
+
|
|
78
|
+
### Node.js (single package)
|
|
79
|
+
```yaml
|
|
80
|
+
# .github/workflows/publish.yml
|
|
81
|
+
name: Publish to npm
|
|
82
|
+
on:
|
|
83
|
+
release:
|
|
84
|
+
types: [published]
|
|
85
|
+
|
|
86
|
+
jobs:
|
|
87
|
+
publish:
|
|
88
|
+
runs-on: ubuntu-latest
|
|
89
|
+
steps:
|
|
90
|
+
- uses: actions/checkout@v4
|
|
91
|
+
- uses: actions/setup-node@v4
|
|
92
|
+
with:
|
|
93
|
+
node-version: '20'
|
|
94
|
+
registry-url: 'https://registry.npmjs.org'
|
|
95
|
+
- run: npm ci
|
|
96
|
+
- run: npm test
|
|
97
|
+
- run: npm publish --access public
|
|
98
|
+
env:
|
|
99
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Node.js (monorepo with workspaces)
|
|
103
|
+
```yaml
|
|
104
|
+
# .github/workflows/publish.yml
|
|
105
|
+
name: Publish to npm
|
|
106
|
+
on:
|
|
107
|
+
release:
|
|
108
|
+
types: [published]
|
|
109
|
+
|
|
110
|
+
jobs:
|
|
111
|
+
publish:
|
|
112
|
+
runs-on: ubuntu-latest
|
|
113
|
+
steps:
|
|
114
|
+
- uses: actions/checkout@v4
|
|
115
|
+
- uses: actions/setup-node@v4
|
|
116
|
+
with:
|
|
117
|
+
node-version: '20'
|
|
118
|
+
registry-url: 'https://registry.npmjs.org'
|
|
119
|
+
- run: npm ci
|
|
120
|
+
- run: npm run build
|
|
121
|
+
- run: npm test
|
|
122
|
+
# Publish each workspace package
|
|
123
|
+
- run: npm publish -w packages/<package-name> --access public
|
|
124
|
+
env:
|
|
125
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Rust
|
|
129
|
+
```yaml
|
|
130
|
+
# .github/workflows/publish.yml
|
|
131
|
+
name: Publish to crates.io
|
|
132
|
+
on:
|
|
133
|
+
release:
|
|
134
|
+
types: [published]
|
|
135
|
+
|
|
136
|
+
jobs:
|
|
137
|
+
publish:
|
|
138
|
+
runs-on: ubuntu-latest
|
|
139
|
+
steps:
|
|
140
|
+
- uses: actions/checkout@v4
|
|
141
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
142
|
+
- run: cargo test
|
|
143
|
+
- run: cargo publish
|
|
144
|
+
env:
|
|
145
|
+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Python
|
|
149
|
+
```yaml
|
|
150
|
+
# .github/workflows/publish.yml
|
|
151
|
+
name: Publish to PyPI
|
|
152
|
+
on:
|
|
153
|
+
release:
|
|
154
|
+
types: [published]
|
|
155
|
+
|
|
156
|
+
jobs:
|
|
157
|
+
publish:
|
|
158
|
+
runs-on: ubuntu-latest
|
|
159
|
+
steps:
|
|
160
|
+
- uses: actions/checkout@v4
|
|
161
|
+
- uses: actions/setup-python@v5
|
|
162
|
+
with:
|
|
163
|
+
python-version: '3.11'
|
|
164
|
+
- run: pip install build twine
|
|
165
|
+
- run: python -m build
|
|
166
|
+
- run: twine upload dist/*
|
|
167
|
+
env:
|
|
168
|
+
TWINE_USERNAME: __token__
|
|
169
|
+
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## Output
|
|
173
|
+
|
|
174
|
+
Update `openspec/speclife.md` with discovered configuration:
|
|
175
|
+
|
|
176
|
+
```markdown
|
|
177
|
+
# SpecLife Configuration
|
|
178
|
+
|
|
179
|
+
## Commands
|
|
180
|
+
|
|
181
|
+
- **Test:** `<detected-test-command>`
|
|
182
|
+
- **Build:** `<detected-build-command>`
|
|
183
|
+
- **Lint:** `<detected-lint-command>`
|
|
184
|
+
|
|
185
|
+
## Release Policy
|
|
186
|
+
|
|
187
|
+
- **Auto-release:** patch and minor versions
|
|
188
|
+
- **Manual release:** major versions (breaking changes)
|
|
189
|
+
|
|
190
|
+
## Publish
|
|
191
|
+
|
|
192
|
+
- **Registry:** npm / PyPI / crates.io / None
|
|
193
|
+
- **Workflow:** .github/workflows/publish.yml (exists / TODO)
|
|
194
|
+
- **Secret:** NPM_TOKEN / PYPI_TOKEN / CARGO_REGISTRY_TOKEN
|
|
195
|
+
|
|
196
|
+
## Context Files
|
|
197
|
+
|
|
198
|
+
When implementing changes, always read:
|
|
199
|
+
- `openspec/project.md` - project context and conventions
|
|
200
|
+
- `openspec/AGENTS.md` - agent guidelines
|
|
201
|
+
- `README.md` - project overview
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## Example Output
|
|
205
|
+
|
|
206
|
+
### When publish workflow exists:
|
|
207
|
+
```
|
|
208
|
+
User: /speclife setup
|
|
209
|
+
|
|
210
|
+
Agent:
|
|
211
|
+
Detecting project configuration...
|
|
212
|
+
|
|
213
|
+
✓ Project type: Node.js monorepo (npm workspaces)
|
|
214
|
+
✓ Packages: @speclife/core, @speclife/cli, @speclife/mcp-server
|
|
215
|
+
|
|
216
|
+
Commands detected:
|
|
217
|
+
✓ Test: npm test
|
|
218
|
+
✓ Build: npm run build
|
|
219
|
+
✓ Lint: npm run lint
|
|
220
|
+
|
|
221
|
+
Workflows:
|
|
222
|
+
✓ Release: .github/workflows/release.yml
|
|
223
|
+
✓ Publish: .github/workflows/publish.yml
|
|
224
|
+
|
|
225
|
+
Context files:
|
|
226
|
+
✓ openspec/project.md
|
|
227
|
+
✓ openspec/AGENTS.md
|
|
228
|
+
✓ README.md
|
|
229
|
+
|
|
230
|
+
✓ Updated openspec/speclife.md
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### When publish workflow is missing:
|
|
234
|
+
```
|
|
235
|
+
User: /speclife setup
|
|
236
|
+
|
|
237
|
+
Agent:
|
|
238
|
+
Detecting project configuration...
|
|
239
|
+
|
|
240
|
+
✓ Project type: Node.js (single package)
|
|
241
|
+
✓ Package: my-awesome-lib
|
|
242
|
+
|
|
243
|
+
Commands detected:
|
|
244
|
+
✓ Test: npm test
|
|
245
|
+
✓ Build: npm run build
|
|
246
|
+
✓ Lint: npm run lint
|
|
247
|
+
|
|
248
|
+
Workflows:
|
|
249
|
+
✓ Release: .github/workflows/release.yml
|
|
250
|
+
⚠ Publish: Not found
|
|
251
|
+
|
|
252
|
+
This package appears to be publishable to npm. Would you like me to create
|
|
253
|
+
`.github/workflows/publish.yml`?
|
|
254
|
+
|
|
255
|
+
User: yes
|
|
256
|
+
|
|
257
|
+
Agent:
|
|
258
|
+
✓ Created .github/workflows/publish.yml
|
|
259
|
+
|
|
260
|
+
⚠️ Remember to add NPM_TOKEN to your repository secrets:
|
|
261
|
+
GitHub → Settings → Secrets and variables → Actions → New repository secret
|
|
262
|
+
|
|
263
|
+
Get your token from: https://www.npmjs.com/settings/~/tokens
|
|
264
|
+
|
|
265
|
+
✓ Updated openspec/speclife.md
|
|
266
|
+
|
|
267
|
+
Done! Your project is configured for automated releases and publishing.
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### When project is private:
|
|
271
|
+
```
|
|
272
|
+
User: /speclife setup
|
|
273
|
+
|
|
274
|
+
Agent:
|
|
275
|
+
Detecting project configuration...
|
|
276
|
+
|
|
277
|
+
✓ Project type: Node.js (private package)
|
|
278
|
+
|
|
279
|
+
Commands detected:
|
|
280
|
+
✓ Test: npm test
|
|
281
|
+
✓ Build: npm run build
|
|
282
|
+
|
|
283
|
+
Workflows:
|
|
284
|
+
✓ Release: .github/workflows/release.yml
|
|
285
|
+
ℹ Publish: Not needed (private package)
|
|
286
|
+
|
|
287
|
+
✓ Updated openspec/speclife.md
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
## Notes
|
|
291
|
+
|
|
292
|
+
- If a command can't be detected, leave it as a TODO for the user
|
|
293
|
+
- Don't overwrite user customizations if speclife.md already exists
|
|
294
|
+
- This command is idempotent - safe to run multiple times
|
|
295
|
+
- Always ask before creating publish workflow (don't auto-create)
|
|
296
|
+
- Remind about secrets after creating publish workflow
|
|
297
|
+
|
|
298
|
+
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: /speclife-ship
|
|
3
|
+
id: speclife-ship
|
|
4
|
+
category: SpecLife
|
|
5
|
+
description: Commit changes, push to remote, and create a PR for review.
|
|
6
|
+
---
|
|
7
|
+
# /speclife ship
|
|
8
|
+
|
|
9
|
+
Create a PR from your current branch. Works with spec branches and ad-hoc branches.
|
|
10
|
+
|
|
11
|
+
## ⚡ Execution
|
|
12
|
+
|
|
13
|
+
**When this command is invoked, IMMEDIATELY execute the workflow below.**
|
|
14
|
+
|
|
15
|
+
- Do NOT skip steps or ask for confirmation before starting
|
|
16
|
+
- Detect branch type first, then follow the appropriate flow
|
|
17
|
+
- If there are uncommitted changes, proceed to stage and commit them
|
|
18
|
+
- Create or update PR as the final step
|
|
19
|
+
- **STOP after PR created—do NOT auto-invoke `/speclife land`**
|
|
20
|
+
|
|
21
|
+
## TL;DR
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
/speclife ship # Ship current branch
|
|
25
|
+
/speclife ship --draft # Create as draft PR
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
**Quick flow:**
|
|
29
|
+
1. Detect branch type (spec vs ad-hoc)
|
|
30
|
+
2. For spec branches: validate + archive spec
|
|
31
|
+
3. Stage, commit, push
|
|
32
|
+
4. Create/update PR
|
|
33
|
+
|
|
34
|
+
## Mode Detection
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
BRANCH=$(git branch --show-current)
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
| Branch | Type | Behavior |
|
|
41
|
+
|--------|------|----------|
|
|
42
|
+
| `spec/*` | **Spec** | Full workflow with OpenSpec (validate, archive) |
|
|
43
|
+
| Any other non-main | **Ad-hoc** | Simplified (skip spec steps) |
|
|
44
|
+
| `main` | **Error** | Cannot ship from main |
|
|
45
|
+
|
|
46
|
+
Note: Spec mode is determined by branch name prefix (`spec/`), not worktree existence. Works identically whether you're in a worktree or the main repo.
|
|
47
|
+
|
|
48
|
+
## Core Steps
|
|
49
|
+
|
|
50
|
+
### 1. Spec Branch Only
|
|
51
|
+
If spec branch detected:
|
|
52
|
+
- Run `openspec validate <change-id>`
|
|
53
|
+
- **⚡ Required:** Invoke `/openspec-archive <change-id>` command
|
|
54
|
+
- Do NOT manually `mv` files—the command updates project.md and specs
|
|
55
|
+
- Wait for archive confirmation before proceeding
|
|
56
|
+
- Read proposal.md for commit message
|
|
57
|
+
|
|
58
|
+
### 2. Ad-hoc Branch Only
|
|
59
|
+
- Infer commit type from branch name (`fix/*` → `fix:`, `feat/*` → `feat:`)
|
|
60
|
+
- Ask user for commit message if needed
|
|
61
|
+
|
|
62
|
+
### 3. All Branches
|
|
63
|
+
```bash
|
|
64
|
+
git add -A
|
|
65
|
+
git commit -m "<type>: <description>" # if uncommitted changes
|
|
66
|
+
git push -u origin <branch>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### 4. Create PR
|
|
70
|
+
```bash
|
|
71
|
+
# Check if PR exists
|
|
72
|
+
gh pr view --json url 2>/dev/null
|
|
73
|
+
|
|
74
|
+
# If not, create
|
|
75
|
+
gh pr create --fill --base main
|
|
76
|
+
# Or: gh pr create --fill --base main --draft
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### 5. Report and STOP
|
|
80
|
+
```
|
|
81
|
+
✓ Committed: "feat: description"
|
|
82
|
+
✓ Pushed to origin/<branch>
|
|
83
|
+
✓ Created PR #42: <url>
|
|
84
|
+
|
|
85
|
+
Next: After approval, run /speclife land
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**⛔ STOP HERE.** Do NOT proceed to merge. Wait for:
|
|
89
|
+
1. PR review and approval
|
|
90
|
+
2. User to invoke `/speclife land`
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
<!-- REFERENCE SECTIONS - Read only when needed -->
|
|
95
|
+
|
|
96
|
+
## Appendix: Commit Type Inference
|
|
97
|
+
|
|
98
|
+
| Branch Pattern | Commit Type |
|
|
99
|
+
|----------------|-------------|
|
|
100
|
+
| `fix/*`, `bugfix/*`, `hotfix/*` | `fix:` |
|
|
101
|
+
| `feat/*`, `feature/*` | `feat:` |
|
|
102
|
+
| `docs/*` | `docs:` |
|
|
103
|
+
| `refactor/*` | `refactor:` |
|
|
104
|
+
| `chore/*` | `chore:` |
|
|
105
|
+
| Other | Ask user |
|
|
106
|
+
|
|
107
|
+
## Appendix: Error Handling
|
|
108
|
+
|
|
109
|
+
**Cannot ship from main:**
|
|
110
|
+
```
|
|
111
|
+
❌ Cannot ship from main. Create a branch first.
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
**No changes:**
|
|
115
|
+
```
|
|
116
|
+
❌ No changes to ship. Working directory clean.
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**Spec validation failed:**
|
|
120
|
+
```
|
|
121
|
+
❌ Spec validation failed:
|
|
122
|
+
- proposal.md: Missing "What" section
|
|
123
|
+
Fix issues and retry, or use --skip-validation
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
**PR already exists:**
|
|
127
|
+
```
|
|
128
|
+
ℹ️ PR #43 already exists. Pushing updates...
|
|
129
|
+
✓ Updated PR #43
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Appendix: Examples
|
|
133
|
+
|
|
134
|
+
**Spec branch:**
|
|
135
|
+
```
|
|
136
|
+
User: /speclife ship
|
|
137
|
+
|
|
138
|
+
Agent:
|
|
139
|
+
ℹ️ Spec branch: spec/add-oauth-login
|
|
140
|
+
✓ Validated spec
|
|
141
|
+
✓ Archived to openspec/changes/archive/
|
|
142
|
+
✓ Committed: "feat: add OAuth login"
|
|
143
|
+
✓ Created PR #42
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
**Ad-hoc branch:**
|
|
147
|
+
```
|
|
148
|
+
User: /speclife ship
|
|
149
|
+
|
|
150
|
+
Agent:
|
|
151
|
+
ℹ️ Ad-hoc branch: fix/login-bug
|
|
152
|
+
✓ Committed: "fix: resolve login redirect"
|
|
153
|
+
✓ Created PR #43
|
|
154
|
+
```
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: /speclife-start
|
|
3
|
+
id: speclife-start
|
|
4
|
+
category: SpecLife
|
|
5
|
+
description: Create a new branch for a change, optionally in a worktree for parallel work.
|
|
6
|
+
---
|
|
7
|
+
# /speclife start
|
|
8
|
+
|
|
9
|
+
Create a new branch for a change, optionally in a worktree for parallel work.
|
|
10
|
+
|
|
11
|
+
## ⚡ Execution
|
|
12
|
+
|
|
13
|
+
**When this command is invoked, IMMEDIATELY execute the workflow below.**
|
|
14
|
+
|
|
15
|
+
- Do NOT skip steps or jump straight to implementation
|
|
16
|
+
- If mid-conversation, treat the invocation as "start fresh with this workflow"
|
|
17
|
+
- If required inputs are missing (description), prompt the user
|
|
18
|
+
- If user says "based on context", derive the description from recent discussion
|
|
19
|
+
- **STOP after scaffolding proposal—do NOT auto-invoke `/openspec-apply`**
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
/speclife start <description> # Worktree (default)
|
|
25
|
+
/speclife start <description> in a branch # Branch-only
|
|
26
|
+
/speclife start # Interactive
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Goal
|
|
30
|
+
|
|
31
|
+
Set up a workspace for a new change with proper git branch.
|
|
32
|
+
|
|
33
|
+
## Mode Detection
|
|
34
|
+
|
|
35
|
+
Parse the input for workflow hints:
|
|
36
|
+
|
|
37
|
+
| Phrase in input | Mode |
|
|
38
|
+
|-----------------|------|
|
|
39
|
+
| "in a branch", "branch only", "no worktree", "simple" | **Branch-only** |
|
|
40
|
+
| "in a worktree", "with worktree", "parallel" | **Worktree** |
|
|
41
|
+
| Neither | **Worktree** (default) |
|
|
42
|
+
|
|
43
|
+
Strip workflow hints from the description before deriving change-id.
|
|
44
|
+
|
|
45
|
+
## Steps
|
|
46
|
+
|
|
47
|
+
### 1. Derive change-id
|
|
48
|
+
|
|
49
|
+
Convert description to kebab-case:
|
|
50
|
+
- "Add user authentication" → `add-user-auth`
|
|
51
|
+
- Prefix with verb: add-, fix-, update-, remove-, refactor-
|
|
52
|
+
- Keep it short (3-5 words max)
|
|
53
|
+
|
|
54
|
+
### 2. Create branch/worktree
|
|
55
|
+
|
|
56
|
+
**Branch-only mode:**
|
|
57
|
+
```bash
|
|
58
|
+
git checkout -b spec/<change-id>
|
|
59
|
+
```
|
|
60
|
+
- Works in current directory
|
|
61
|
+
- One change at a time (switch branches to context-switch)
|
|
62
|
+
|
|
63
|
+
**Worktree mode (default):**
|
|
64
|
+
```bash
|
|
65
|
+
speclife worktree create <change-id>
|
|
66
|
+
```
|
|
67
|
+
- Creates `worktrees/<change-id>/`
|
|
68
|
+
- Creates branch `spec/<change-id>`
|
|
69
|
+
- Parallel changes possible
|
|
70
|
+
|
|
71
|
+
### 3. Scaffold proposal
|
|
72
|
+
|
|
73
|
+
Invoke `/openspec-proposal` with the description (minus workflow hints)
|
|
74
|
+
- Creates `openspec/changes/<change-id>/proposal.md`
|
|
75
|
+
- Creates `openspec/changes/<change-id>/tasks.md`
|
|
76
|
+
|
|
77
|
+
### 4. Report and STOP
|
|
78
|
+
|
|
79
|
+
**Branch-only:**
|
|
80
|
+
```
|
|
81
|
+
✓ Derived change-id: add-oauth-login
|
|
82
|
+
✓ Created branch spec/add-oauth-login
|
|
83
|
+
✓ Scaffolded proposal at openspec/changes/add-oauth-login/
|
|
84
|
+
|
|
85
|
+
Next: Review the proposal, then run `/openspec-apply` to implement.
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**Worktree:**
|
|
89
|
+
```
|
|
90
|
+
✓ Derived change-id: add-oauth-login
|
|
91
|
+
✓ Created worktree at worktrees/add-oauth-login/
|
|
92
|
+
✓ Created branch spec/add-oauth-login
|
|
93
|
+
✓ Scaffolded proposal at openspec/changes/add-oauth-login/
|
|
94
|
+
|
|
95
|
+
Next: cd worktrees/add-oauth-login/ then run `/openspec-apply`.
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**⛔ STOP HERE.** Do NOT proceed to implementation. Wait for user to:
|
|
99
|
+
1. Review the proposal
|
|
100
|
+
2. Invoke `/openspec-apply` or `/speclife implement`
|
|
101
|
+
|
|
102
|
+
## Examples
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
User: /speclife start "Add OAuth login support"
|
|
106
|
+
→ Creates worktree (default)
|
|
107
|
+
|
|
108
|
+
User: /speclife start "Add OAuth login" in a branch
|
|
109
|
+
→ Creates branch only, no worktree
|
|
110
|
+
|
|
111
|
+
User: /speclife start "fix login bug" branch only
|
|
112
|
+
→ Creates branch only
|
|
113
|
+
|
|
114
|
+
User: /speclife start
|
|
115
|
+
→ Prompts: "Describe your change" then "Worktree (default) or branch-only?"
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Tradeoffs
|
|
119
|
+
|
|
120
|
+
| Aspect | Worktree | Branch-only |
|
|
121
|
+
|--------|----------|-------------|
|
|
122
|
+
| Parallel changes | ✓ Multiple worktrees | One at a time |
|
|
123
|
+
| IDE support | May need reload | Seamless |
|
|
124
|
+
| Setup complexity | More dirs | Simpler |
|
|
125
|
+
| Context switching | cd to worktree | git checkout |
|
|
126
|
+
|
|
127
|
+
## Naming Conventions
|
|
128
|
+
|
|
129
|
+
- Use kebab-case for change-id
|
|
130
|
+
- Prefix with action verb: `add-`, `fix-`, `update-`, `remove-`, `refactor-`
|
|
131
|
+
- Keep it descriptive but concise
|
|
132
|
+
- Examples:
|
|
133
|
+
- `add-user-auth`
|
|
134
|
+
- `fix-login-redirect`
|
|
135
|
+
- `update-api-docs`
|
|
136
|
+
- `remove-deprecated-endpoint`
|
|
137
|
+
- `refactor-database-layer`
|
|
138
|
+
|
|
139
|
+
## Notes
|
|
140
|
+
|
|
141
|
+
- Branch name is always `spec/<change-id>` regardless of mode
|
|
142
|
+
- If branch exists, error and suggest using existing
|
|
143
|
+
- Branch-only: uncommitted changes carry over (stash if needed)
|
|
144
|
+
- Worktree: clean checkout from main
|
|
145
|
+
- To switch modes later, use `/speclife convert`
|