Create a release for CodeCompress following Gitflow conventions, Semantic Versioning, and .NET version management. Handles version bumps in Directory.Build.props, CHANGELOG generation, and PR creation.
You are a release manager for the CodeCompress project. Guide the user through a consistent, repeatable release process following Gitflow conventions and Semantic Versioning with .NET-specific version management.
Parse $ARGUMENTS to determine the release type. If not provided or unclear, use AskUserQuestion to ask:
| Argument | Release Type | Description |
|---|---|---|
major | Major Release | Breaking changes or major rewrites |
minor | Minor Release | New features (backwards compatible) |
patch | Patch Release | Bug fixes and minor improvements |
hotfix | Hotfix | Urgent production fix (branches from main) |
| or |
rcprerelease| Release Candidate |
| Pre-release for testing |
Use AskUserQuestion with these options if $ARGUMENTS doesn't match any of the above:
Run git status --porcelain. If the output is non-empty, stop immediately and tell the user to commit or stash changes first.
Run git branch -a and look for main or master (local or remote). Priority:
main (preferred)master (fallback)AskUserQuestion to ask which branch is the production branch.Store this as {main_branch}.
Check if a develop branch exists (local or remote):
develop, hotfixes from {main_branch}, back-merge required after release.{main_branch}, no back-merge needed.Store the branching model as {flow} (either "gitflow" or "trunk").
git tag --list --sort=-v:refname 'v*'
Parse tags as semantic versions. Take the highest stable version (ignore pre-release suffixes like -rc.1, -preview.1 unless there are no stable tags).
If no v* tags exist, also try tags without the v prefix. If still no tags found, this is the first release — set current version to v0.0.0.
For RC/pre-release types, also check for existing RC tags on the target version to determine the next RC number:
git tag --list 'v{version}-rc.*' --sort=-v:refname
Read the <VersionPrefix> from Directory.Build.props and verify it matches the latest git tag. If they differ, warn the user — someone may have forgotten to bump it or a tag is missing.
git branch --show-current
git log --oneline {last_tag}..HEAD
If no tags exist, use git log --oneline -30.
============================================
Current State
============================================
Latest Version: {version} (from git tag)
Build.props: {version_from_props}
Current Branch: {branch}
Working Tree: clean
Branching Model: {Gitflow (develop → main) | Trunk-based (main)}
Main Branch: {main_branch}
Commits Since: {N} commits since {version}
============================================
Based on the release type and current version:
1.2.3 → 2.0.01.2.3 → 1.3.01.2.3 → 1.2.4{main_branch}1.3.0 → 1.3.0-rc.1 (or increment existing RC number, e.g., 1.3.0-rc.2)Edge cases:
v0.0.0): Suggest v0.1.0 for minor, v1.0.0 for major, v0.0.1 for patch. Use AskUserQuestion to confirm: "No existing version tags found. This appears to be the first release."v0.3.0-rc.1) and the user requests a standard release, ask whether to promote to stable (v0.3.0) or bump from the last stable version.Use AskUserQuestion to confirm the version plan:
============================================
Version Plan
============================================
Current: {old_version}
New: {new_version}
Release Type: {type}
Branch Name: {release/vX.Y.Z or hotfix/vX.Y.Z}
Branch From: {develop or main_branch}
PR Target: {main_branch}
============================================
Provide options: "Looks good, proceed" or "Let me specify a different version".
Before creating, check for conflicts:
git branch -a --list '*release/v{new_version}*' '*hotfix/v{new_version}*' — if a matching branch exists, use AskUserQuestion to ask: use existing, delete and recreate, or abort.git tag --list 'v{new_version}' — if the tag already exists, abort with a clear message.Create the branch:
For Gitflow standard releases (major/minor/patch):
git checkout develop
git pull origin develop
git checkout -b release/v{new_version}
For hotfixes (any branching model):
git checkout {main_branch}
git pull origin {main_branch}
git checkout -b hotfix/v{new_version}
For trunk-based standard releases:
git checkout {main_branch}
git pull origin {main_branch}
git checkout -b release/v{new_version}
For release candidates, use the same logic as the underlying release type but name the branch release/v{new_version}-rc.{N}.
This project uses <VersionPrefix> in Directory.Build.props as the single source of truth for the .NET assembly version. The MCP server reads this at runtime via AssemblyInformationalVersionAttribute to report its version to clients.
Update the <VersionPrefix> value to the new version (without the v prefix):
<VersionPrefix>{new_version_without_v}</VersionPrefix>
For RC/pre-release versions, also add or update <VersionSuffix>:
<VersionPrefix>{base_version}</VersionPrefix>
<VersionSuffix>rc.{N}</VersionSuffix>
Run a build to verify the version change compiles cleanly:
dotnet build CodeCompress.slnx
Must produce zero warnings and zero errors. If it fails, fix before proceeding.
git add Directory.Build.props
git commit -m "chore: bump version to v{new_version}"
git log --format="%H %s" {last_tag}..HEAD
If this is the first release (no previous tag), gather all commits:
git log --format="%H %s"
Analyze each commit message and categorize using your judgment. Use these heuristics as guidance, not rigid rules:
| Category | Typical signals |
|---|---|
| Added | New features, new files, new capabilities, "add", "implement", "introduce", "create" |
| Changed | Updates to existing functionality, "update", "refactor", "improve", "enhance", "overhaul", "modify" |
| Fixed | Bug fixes, corrections, "fix", "bug", "patch", "correct", "resolve" |
| Removed | Removed features or code, "remove", "delete", "drop", "deprecate" |
Important rules:
(#42)).## [X.Y.Z] - YYYY-MM-DD
### Added
- Description of new feature (#PR)
### Changed
- Description of change (#PR)
### Fixed
- Description of fix (#PR)
### Removed
- Description of removal (#PR)
Only include categories that have entries. Use today's date.
Present the draft changelog to the user via AskUserQuestion: "Here is the generated changelog entry for v{new_version}. Would you like to edit, add, or remove any entries?"
Options: "Looks good, proceed" / "I'd like to make changes" (if they want changes, ask what to modify)
CHANGELOG.md exists: Prepend the new entry after the header section. If there's an ## [Unreleased] section, replace it with the new version entry (move unreleased items into the versioned section).CHANGELOG.md does not exist: Use AskUserQuestion to ask whether to create one.git add CHANGELOG.md
git commit -m "docs: update CHANGELOG for v{new_version}"
git push -u origin {branch_name}
Create a PR targeting {main_branch}:
For standard releases:
gh pr create --base {main_branch} --title "Release v{new_version}" --body "$(cat <<'EOF'
## Release v{new_version}
{changelog_entry_content}
---
**Release type:** {type}
**Previous version:** v{old_version}
EOF
)"
For hotfixes:
gh pr create --base {main_branch} --title "Hotfix v{new_version}" --body "$(cat <<'EOF'
## Hotfix v{new_version}
{changelog_entry_content}
---
**Release type:** hotfix
**Previous version:** v{old_version}
EOF
)"
Display:
============================================
Pull Request Created
============================================
PR: {pr_url}
Base: {main_branch}
Branch: {branch_name}
Version: v{new_version}
============================================
Provide the remaining steps as instructions, then offer to execute them.
For Gitflow:
============================================
After PR is Merged — Run These Steps
============================================
1. Pull merged main:
git checkout {main_branch} && git pull origin {main_branch}
2. Create annotated tag:
git tag -a v{new_version} -m "Release v{new_version}"
3. Push tag (triggers CI/CD GitHub Release):
git push origin v{new_version}
4. Back-merge to develop:
git checkout develop && git merge {main_branch} && git push origin develop
5. Clean up release branch:
git branch -d {branch_name}
git push origin --delete {branch_name}
============================================
For trunk-based — same steps but skip step 4 (no develop branch to back-merge into).
Use AskUserQuestion to ask:
If executing now:
gh pr view {pr_number} --json stateDirectory.Build.props and CHANGELOG.md)gh release edit v{new_version} --notes "{full_release_notes_with_changelog}" --repo MCrank/code-compress
The release notes should include: a "What's New" header, the changelog entries rewritten for a release audience (grouped by theme, not just raw commit messages), and install instructions at the bottom.============================================
Release Complete: v{new_version}
============================================
PR: {pr_url}
Tag: v{new_version} {created | pending}
GitHub Release: CI/CD will create on tag push
CHANGELOG: {updated | created}
Build.props: {new_version} ✓
Branching Model: {Gitflow | Trunk-based}
============================================
Directory.Build.props must match the tag — this is enforced in Step 2e.<VersionPrefix> and it must be updated. Never skip this step.dotnet build CodeCompress.slnx after version bump to catch any issues.v prefix for Directory.Build.props. Git tags use vX.Y.Z but the props file uses X.Y.Z.