|
| 1 | +# /release-codelet-napi - Create Tagged Release for codelet-napi |
| 2 | + |
| 3 | +You are implementing the `/release-codelet-napi` slash command for creating tagged releases of the `@sengac/codelet-napi` native module. |
| 4 | + |
| 5 | +**Note:** This is separate from the main fspec release. codelet-napi has its own version and release cycle. |
| 6 | + |
| 7 | +## Critical Requirements |
| 8 | + |
| 9 | +### Git Commit Author |
| 10 | +**MANDATORY**: ALL commits created by this command MUST use: |
| 11 | +- Author: `Roland Quast <rquast@rolandquast.com>` |
| 12 | +- Use `--author="Roland Quast <rquast@rolandquast.com>"` flag with git commit |
| 13 | + |
| 14 | +### Pre-Release Validation (MUST RUN FIRST) |
| 15 | + |
| 16 | +1. **Check for uncommitted changes:** |
| 17 | + - Run `git status --porcelain` to check for unstaged/staged files |
| 18 | + - If changes exist in `codelet/` directory, stage them: `git add codelet/` |
| 19 | + - Create commit with analyzed message and author `Roland Quast <rquast@rolandquast.com>` |
| 20 | + |
| 21 | +2. **Run E2E publish test:** |
| 22 | + - Execute `npm run test:napi-publish` |
| 23 | + - This tests the full publish → install → load flow locally |
| 24 | + - If test fails, ABORT release with error message |
| 25 | + |
| 26 | +### Version Determination |
| 27 | + |
| 28 | +1. **Get last codelet-napi git tag:** |
| 29 | + - Run `git describe --tags --match "codelet-napi-v*" --abbrev=0 2>/dev/null || echo ""` |
| 30 | + - If no tag exists, use `codelet/napi/package.json` version as base |
| 31 | + |
| 32 | +2. **Get commits since last tag:** |
| 33 | + - Run `git log <last-tag>..HEAD --oneline -- codelet/` (only codelet changes) |
| 34 | + - Parse conventional commit messages |
| 35 | + |
| 36 | +3. **Determine semver bump:** |
| 37 | + - If any commit has `BREAKING CHANGE:` in body/footer → **major** bump |
| 38 | + - Else if any commit starts with `feat:` → **minor** bump |
| 39 | + - Else if any commit starts with `fix:` → **patch** bump |
| 40 | + - Else → **patch** bump (default) |
| 41 | + |
| 42 | +4. **Calculate new version:** |
| 43 | + - Parse base version (from tag or package.json) |
| 44 | + - Apply semver bump to calculate new version |
| 45 | + |
| 46 | +### Version Update |
| 47 | + |
| 48 | +1. **Update codelet/napi/package.json:** |
| 49 | + - Update `"version"` field to new version |
| 50 | + - Update ALL versions in `optionalDependencies` to match: |
| 51 | + ```json |
| 52 | + "optionalDependencies": { |
| 53 | + "@sengac/codelet-napi-darwin-arm64": "{new-version}", |
| 54 | + "@sengac/codelet-napi-darwin-x64": "{new-version}", |
| 55 | + "@sengac/codelet-napi-linux-arm64-gnu": "{new-version}", |
| 56 | + "@sengac/codelet-napi-linux-x64-gnu": "{new-version}", |
| 57 | + "@sengac/codelet-napi-win32-arm64-msvc": "{new-version}", |
| 58 | + "@sengac/codelet-napi-win32-x64-msvc": "{new-version}" |
| 59 | + } |
| 60 | + ``` |
| 61 | + |
| 62 | +2. **Stage and commit:** |
| 63 | + - Run `git add codelet/napi/package.json` |
| 64 | + - Commit message: `chore(codelet-napi): release v{version}` |
| 65 | + - Use `--author="Roland Quast <rquast@rolandquast.com>"` |
| 66 | + |
| 67 | +3. **Create git tag:** |
| 68 | + - Tag name: `codelet-napi-v{version}` (with `codelet-napi-v` prefix) |
| 69 | + - Run: `git tag -a codelet-napi-v{version} -m "Release @sengac/codelet-napi v{version}"` |
| 70 | + |
| 71 | +### Post-Release |
| 72 | + |
| 73 | +- **DO NOT push** to remote (manual step for user) |
| 74 | +- Display success message with: |
| 75 | + - New version number |
| 76 | + - Tag name created |
| 77 | + - Reminder to push: `git push && git push origin codelet-napi-v{version}` |
| 78 | + - Explanation that CI will build all 6 platforms and publish to npm |
| 79 | + |
| 80 | +## Workflow Summary |
| 81 | + |
| 82 | +```bash |
| 83 | +# 1. Pre-release validation |
| 84 | +git status --porcelain |
| 85 | +git add codelet/ # Stage codelet changes if any |
| 86 | +npm run test:napi-publish # E2E test (ABORT if fails) |
| 87 | + |
| 88 | +# 2. Version determination |
| 89 | +git describe --tags --match "codelet-napi-v*" --abbrev=0 # Get last tag |
| 90 | +git log <last-tag>..HEAD --oneline -- codelet/ # Get codelet commits |
| 91 | +# Parse conventional commits, determine semver bump |
| 92 | + |
| 93 | +# 3. Version update |
| 94 | +# Update codelet/napi/package.json version AND optionalDependencies |
| 95 | +git add codelet/napi/package.json |
| 96 | +git commit -m "chore(codelet-napi): release v{version}" --author="Roland Quast <rquast@rolandquast.com>" |
| 97 | + |
| 98 | +# 4. Create tag |
| 99 | +git tag -a codelet-napi-v{version} -m "Release @sengac/codelet-napi v{version}" |
| 100 | + |
| 101 | +# 5. Display success message (do NOT push) |
| 102 | +``` |
| 103 | + |
| 104 | +## Example Output |
| 105 | + |
| 106 | +``` |
| 107 | +$ /release-codelet-napi |
| 108 | +
|
| 109 | +Running E2E publish test... |
| 110 | +✓ E2E TEST PASSED |
| 111 | +
|
| 112 | +Analyzing commits since codelet-napi-v0.1.0... |
| 113 | + - feat: add new persistence API |
| 114 | + - fix: memory leak in session handling |
| 115 | +
|
| 116 | +Determined version bump: minor (0.1.0 → 0.2.0) |
| 117 | +
|
| 118 | +Updating codelet/napi/package.json... |
| 119 | + - version: 0.2.0 |
| 120 | + - optionalDependencies: all updated to 0.2.0 |
| 121 | +
|
| 122 | +Creating release commit... |
| 123 | +✓ Committed: chore(codelet-napi): release v0.2.0 |
| 124 | +
|
| 125 | +Creating tag... |
| 126 | +✓ Created tag: codelet-napi-v0.2.0 |
| 127 | +
|
| 128 | +═══════════════════════════════════════════════════════════ |
| 129 | + Release Ready: @sengac/codelet-napi v0.2.0 |
| 130 | +═══════════════════════════════════════════════════════════ |
| 131 | +
|
| 132 | +To publish, run: |
| 133 | + git push && git push origin codelet-napi-v0.2.0 |
| 134 | +
|
| 135 | +This will trigger GitHub Actions to: |
| 136 | + 1. Build native binaries for all 6 platforms |
| 137 | + 2. Run smoke tests on each platform |
| 138 | + 3. Publish to npm: |
| 139 | + - @sengac/codelet-napi@0.2.0 |
| 140 | + - @sengac/codelet-napi-darwin-arm64@0.2.0 |
| 141 | + - @sengac/codelet-napi-darwin-x64@0.2.0 |
| 142 | + - @sengac/codelet-napi-linux-arm64-gnu@0.2.0 |
| 143 | + - @sengac/codelet-napi-linux-x64-gnu@0.2.0 |
| 144 | + - @sengac/codelet-napi-win32-arm64-msvc@0.2.0 |
| 145 | + - @sengac/codelet-napi-win32-x64-msvc@0.2.0 |
| 146 | +``` |
| 147 | + |
| 148 | +## Error Handling |
| 149 | + |
| 150 | +- If E2E test fails: Display error, ABORT release |
| 151 | +- If no codelet commits since last tag: Warn user, ask for confirmation |
| 152 | +- If cannot determine version: Display error with guidance |
0 commit comments