@speclife/cli 0.8.0 → 0.9.1
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 +17 -5
- 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 +26 -0
- package/templates/commands/setup.md +20 -292
- package/templates/commands/ship.md +17 -146
- 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`
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: /speclife-retrofit
|
|
3
|
+
id: speclife-retrofit
|
|
4
|
+
category: SpecLife
|
|
5
|
+
description: Formalize ad-hoc changes on main into a spec-tracked change for review.
|
|
6
|
+
---
|
|
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
|
+
|
|
12
|
+
**Steps**
|
|
13
|
+
1. Detect changes: `git status --short` and `git log origin/main..HEAD --oneline`; error if no changes.
|
|
14
|
+
2. Analyze diffs to understand what was done; infer change type (feat, fix, refactor, docs).
|
|
15
|
+
3. Derive change-id: kebab-case with verb prefix (add-, fix-, update-, remove-, refactor-).
|
|
16
|
+
4. Review context: `openspec list --specs`, `cat openspec/project.md`.
|
|
17
|
+
5. Create retrospective spec: `proposal.md` (past tense), `tasks.md` (all `[x]` completed), spec deltas if applicable.
|
|
18
|
+
6. Validate and branch: `openspec validate <id>`, `git checkout -b spec/<id>`.
|
|
19
|
+
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>"`.
|
|
20
|
+
8. Report: change-id, spec created, PR URL. Next: `/speclife land` after approval.
|
|
21
|
+
|
|
22
|
+
**Reference**
|
|
23
|
+
- Proposal documents what was done (reality), not aspirations
|
|
24
|
+
- Uncommitted changes move to the new branch automatically
|
|
25
|
+
- PR title: use conventional commit format (`<type>: <meaningful description>`)
|
|
26
|
+
- PR body: if `.github/pull_request_template.md` exists, read it and fill in each section based on the change context
|
|
@@ -4,295 +4,23 @@ id: speclife-setup
|
|
|
4
4
|
category: SpecLife
|
|
5
5
|
description: Discover project configuration and populate openspec/speclife.md.
|
|
6
6
|
---
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
7
|
+
**Guardrails**
|
|
8
|
+
- Execute immediately—scan project to auto-detect configuration
|
|
9
|
+
- Don't overwrite existing user customizations in speclife.md
|
|
10
|
+
- Ask before creating publish workflow (don't auto-create)
|
|
11
|
+
|
|
12
|
+
**Steps**
|
|
13
|
+
1. Read existing `openspec/speclife.md` if present.
|
|
14
|
+
2. Detect build system: package.json (Node), Cargo.toml (Rust), go.mod (Go), pyproject.toml (Python), etc.
|
|
15
|
+
3. Extract commands: test, build, lint from detected system (e.g., `npm test`, `cargo test`).
|
|
16
|
+
4. Detect publish config: registry (npm/crates.io/PyPI), required secret, private flag.
|
|
17
|
+
5. Check `.github/workflows/` for existing release/publish workflows.
|
|
18
|
+
6. Identify context files: `openspec/project.md`, `openspec/AGENTS.md`, `README.md`.
|
|
19
|
+
7. Update `openspec/speclife.md` with discovered values.
|
|
20
|
+
8. If publishable and no publish workflow exists: ask user, create if agreed, remind about secrets.
|
|
21
|
+
9. Report: project type, detected commands, workflow status, what was configured.
|
|
22
|
+
|
|
23
|
+
**Reference**
|
|
24
|
+
- Publish workflow templates: Node.js, Rust, Python (standard patterns)
|
|
25
|
+
- Private packages (`"private": true`) skip publish workflow
|
|
26
|
+
- Go has no central registry—skip publish step
|
|
@@ -4,149 +4,20 @@ id: speclife-ship
|
|
|
4
4
|
category: SpecLife
|
|
5
5
|
description: Commit changes, push to remote, and create a PR for review.
|
|
6
6
|
---
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
- Run `openspec archive <change-id>`
|
|
54
|
-
- Read proposal.md for commit message
|
|
55
|
-
|
|
56
|
-
### 2. Ad-hoc Branch Only
|
|
57
|
-
- Infer commit type from branch name (`fix/*` → `fix:`, `feat/*` → `feat:`)
|
|
58
|
-
- Ask user for commit message if needed
|
|
59
|
-
|
|
60
|
-
### 3. All Branches
|
|
61
|
-
```bash
|
|
62
|
-
git add -A
|
|
63
|
-
git commit -m "<type>: <description>" # if uncommitted changes
|
|
64
|
-
git push -u origin <branch>
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
### 4. Create PR
|
|
68
|
-
```bash
|
|
69
|
-
# Check if PR exists
|
|
70
|
-
gh pr view --json url 2>/dev/null
|
|
71
|
-
|
|
72
|
-
# If not, create
|
|
73
|
-
gh pr create --fill --base main
|
|
74
|
-
# Or: gh pr create --fill --base main --draft
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
### 5. Report and STOP
|
|
78
|
-
```
|
|
79
|
-
✓ Committed: "feat: description"
|
|
80
|
-
✓ Pushed to origin/<branch>
|
|
81
|
-
✓ Created PR #42: <url>
|
|
82
|
-
|
|
83
|
-
Next: After approval, run /speclife land
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
**⛔ STOP HERE.** Do NOT proceed to merge. Wait for:
|
|
87
|
-
1. PR review and approval
|
|
88
|
-
2. User to invoke `/speclife land`
|
|
89
|
-
|
|
90
|
-
---
|
|
91
|
-
|
|
92
|
-
<!-- REFERENCE SECTIONS - Read only when needed -->
|
|
93
|
-
|
|
94
|
-
## Appendix: Commit Type Inference
|
|
95
|
-
|
|
96
|
-
| Branch Pattern | Commit Type |
|
|
97
|
-
|----------------|-------------|
|
|
98
|
-
| `fix/*`, `bugfix/*`, `hotfix/*` | `fix:` |
|
|
99
|
-
| `feat/*`, `feature/*` | `feat:` |
|
|
100
|
-
| `docs/*` | `docs:` |
|
|
101
|
-
| `refactor/*` | `refactor:` |
|
|
102
|
-
| `chore/*` | `chore:` |
|
|
103
|
-
| Other | Ask user |
|
|
104
|
-
|
|
105
|
-
## Appendix: Error Handling
|
|
106
|
-
|
|
107
|
-
**Cannot ship from main:**
|
|
108
|
-
```
|
|
109
|
-
❌ Cannot ship from main. Create a branch first.
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
**No changes:**
|
|
113
|
-
```
|
|
114
|
-
❌ No changes to ship. Working directory clean.
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
**Spec validation failed:**
|
|
118
|
-
```
|
|
119
|
-
❌ Spec validation failed:
|
|
120
|
-
- proposal.md: Missing "What" section
|
|
121
|
-
Fix issues and retry, or use --skip-validation
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
**PR already exists:**
|
|
125
|
-
```
|
|
126
|
-
ℹ️ PR #43 already exists. Pushing updates...
|
|
127
|
-
✓ Updated PR #43
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
## Appendix: Examples
|
|
131
|
-
|
|
132
|
-
**Spec branch:**
|
|
133
|
-
```
|
|
134
|
-
User: /speclife ship
|
|
135
|
-
|
|
136
|
-
Agent:
|
|
137
|
-
ℹ️ Spec branch: spec/add-oauth-login
|
|
138
|
-
✓ Validated spec
|
|
139
|
-
✓ Archived to openspec/changes/archive/
|
|
140
|
-
✓ Committed: "feat: add OAuth login"
|
|
141
|
-
✓ Created PR #42
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
**Ad-hoc branch:**
|
|
145
|
-
```
|
|
146
|
-
User: /speclife ship
|
|
147
|
-
|
|
148
|
-
Agent:
|
|
149
|
-
ℹ️ Ad-hoc branch: fix/login-bug
|
|
150
|
-
✓ Committed: "fix: resolve login redirect"
|
|
151
|
-
✓ Created PR #43
|
|
152
|
-
```
|
|
7
|
+
**Guardrails**
|
|
8
|
+
- Execute immediately—do not ask for confirmation
|
|
9
|
+
- Detect branch type: `spec/*` = full OpenSpec workflow, other non-main = ad-hoc, `main` = error
|
|
10
|
+
- STOP after PR created—do NOT auto-invoke `/speclife land`
|
|
11
|
+
|
|
12
|
+
**Steps**
|
|
13
|
+
1. For spec branches: run `openspec validate <id>`, commit changes, run `openspec archive <id> --yes`, commit archive.
|
|
14
|
+
2. For ad-hoc branches: infer commit type from branch name (`fix/*` → `fix:`, `feat/*` → `feat:`), ask if ambiguous.
|
|
15
|
+
3. Push branch: `git push -u origin <branch>`.
|
|
16
|
+
4. Create/update PR: `gh pr create --title "<type>: <description>" --body "<body>" --base main` (add `--draft` if requested).
|
|
17
|
+
5. Report: commits made, branch pushed, PR URL. Next: `/speclife land` after approval.
|
|
18
|
+
|
|
19
|
+
**Reference**
|
|
20
|
+
- Commit type inference: fix/bugfix/hotfix → `fix:`, feat/feature → `feat:`, docs → `docs:`, refactor → `refactor:`, chore → `chore:`
|
|
21
|
+
- If PR exists, push updates it automatically
|
|
22
|
+
- PR title: use conventional commit format (`<type>: <meaningful description>`)
|
|
23
|
+
- PR body: if `.github/pull_request_template.md` exists, read it and fill in each section based on the change context
|