|
| 1 | +You are responsible for publishing a new version of this PHP library to GitHub. |
| 2 | + |
| 3 | +## Your Task |
| 4 | + |
| 5 | +Automate the versioning and publishing process by: |
| 6 | +1. Analyzing recent commits since the last tag |
| 7 | +2. Suggesting the appropriate version bump (patch, minor, or major) |
| 8 | +3. Creating an annotated git tag |
| 9 | +4. Pushing the tag to GitHub |
| 10 | + |
| 11 | +## Process |
| 12 | + |
| 13 | +### 1. Get Current Version and Commits |
| 14 | + |
| 15 | +Run these commands in parallel: |
| 16 | +- `git describe --tags --abbrev=0` - Get the latest tag |
| 17 | +- `git log $(git describe --tags --abbrev=0)..HEAD --oneline` - Get commits since last tag |
| 18 | + |
| 19 | +### 2. Analyze Version Bump |
| 20 | + |
| 21 | +Based on conventional commits since the last tag, determine the version bump: |
| 22 | + |
| 23 | +**MAJOR (X.0.0)** - Breaking changes: |
| 24 | +- Commits with `BREAKING CHANGE:` in body |
| 25 | +- Commits with `!` after type (e.g., `feat!:`, `fix!:`) |
| 26 | +- Major refactoring that changes public API |
| 27 | + |
| 28 | +**MINOR (X.Y.0)** - New features: |
| 29 | +- `feat:` commits |
| 30 | +- New functionality added |
| 31 | +- Backwards-compatible changes |
| 32 | + |
| 33 | +**PATCH (X.Y.Z)** - Bug fixes and small improvements: |
| 34 | +- `fix:` commits |
| 35 | +- `refactor:` commits |
| 36 | +- `perf:` commits |
| 37 | +- `chore:` commits |
| 38 | +- `docs:` commits |
| 39 | +- `style:` commits |
| 40 | +- `test:` commits |
| 41 | + |
| 42 | +### 3. Present Suggestion to User |
| 43 | + |
| 44 | +Show: |
| 45 | +- Current version |
| 46 | +- Commits since last tag (grouped by type) |
| 47 | +- Suggested new version with reasoning |
| 48 | +- Ask user to confirm or specify a different version |
| 49 | + |
| 50 | +Example: |
| 51 | +``` |
| 52 | +Current version: 1.6.0 |
| 53 | +
|
| 54 | +Commits since last tag: |
| 55 | +- fix(cast): correct boolify function to handle string conversions properly |
| 56 | +- chore(config): add Claude Code lint command configuration |
| 57 | +
|
| 58 | +Suggested version: 1.6.1 (patch) |
| 59 | +Reason: Bug fixes and configuration changes |
| 60 | +
|
| 61 | +Options: |
| 62 | +1. Accept suggested version (1.6.1) |
| 63 | +2. Specify custom version (e.g., 1.7.0 for minor, 2.0.0 for major) |
| 64 | +``` |
| 65 | + |
| 66 | +### 4. Create Tag Summary |
| 67 | + |
| 68 | +Ask the user for a concise summary description, or suggest one based on the commits. |
| 69 | + |
| 70 | +The tag message format follows this pattern: |
| 71 | +``` |
| 72 | +[X.Y.Z] Brief description |
| 73 | +``` |
| 74 | + |
| 75 | +Examples from history: |
| 76 | +- `[1.6.0] Upgrade type instruments` |
| 77 | +- `[1.5.11] Improve interigify` |
| 78 | +- `[1.5.10] Add new types` |
| 79 | +- `[1.4.4] Supports array on builder` |
| 80 | + |
| 81 | +### 5. Final Confirmation |
| 82 | + |
| 83 | +Before creating the tag, show a clear summary and ask for explicit confirmation: |
| 84 | + |
| 85 | +``` |
| 86 | +📦 Ready to publish version X.Y.Z |
| 87 | +
|
| 88 | +Tag: X.Y.Z |
| 89 | +Message: [X.Y.Z] Description |
| 90 | +Remote: origin |
| 91 | +
|
| 92 | +This will: |
| 93 | +✓ Create annotated tag X.Y.Z locally |
| 94 | +✓ Push tag to GitHub |
| 95 | +
|
| 96 | +Proceed? (yes/no) |
| 97 | +``` |
| 98 | + |
| 99 | +**IMPORTANT**: Wait for explicit "yes" confirmation before proceeding. |
| 100 | + |
| 101 | +### 6. Create and Push Tag |
| 102 | + |
| 103 | +Only after receiving confirmation: |
| 104 | +```bash |
| 105 | +git tag -a "X.Y.Z" -m "[X.Y.Z] Description" |
| 106 | +git push origin X.Y.Z |
| 107 | +``` |
| 108 | + |
| 109 | +Then show: |
| 110 | +- Confirmation that tag was created |
| 111 | +- Tag name and message |
| 112 | +- Confirmation that tag was pushed |
| 113 | +- Link to GitHub releases: `https://github.com/devitools/constructo/releases/tag/X.Y.Z` |
| 114 | + |
| 115 | +## Important Rules |
| 116 | + |
| 117 | +- Always get user confirmation before creating and pushing tags |
| 118 | +- NEVER push tags without explicit confirmation |
| 119 | +- If no commits since last tag, inform user and stop |
| 120 | +- Validate version format (must be semantic versioning: X.Y.Z) |
| 121 | +- Check if tag already exists before creating |
| 122 | +- If push fails, show error and suggest solutions |
| 123 | + |
| 124 | +## Error Handling |
| 125 | + |
| 126 | +If tag already exists: |
| 127 | +- Show error message |
| 128 | +- Ask if user wants to delete and recreate (not recommended) |
| 129 | +- Suggest incrementing version instead |
| 130 | + |
| 131 | +If push fails: |
| 132 | +- Check internet connection |
| 133 | +- Verify git remote is configured |
| 134 | +- Show full error message |
| 135 | +- Suggest running `git remote -v` to check remote configuration |
0 commit comments