Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions .cursor/commands/create-pr.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ For complete documentation on pull request guidelines, templates, and review pro

- **[Pull Request Guidelines](./../pr-template.md)**
- **[Git Workflow](./../git-workflow.md)**
- **[Version Management](./../../docs/VERSION_MANAGEMENT.md)**

## Workflow

Expand All @@ -18,6 +19,90 @@ For complete documentation on pull request guidelines, templates, and review pro

When creating a pull request, follow these steps:

### 0. AI-Powered Version Bump & CHANGELOG (Automatic)

**AI analyzes your changes, suggests version bump, and generates CHANGELOG:**

```bash
# Gather data
CURRENT_VERSION=$(make version | grep -oP '\d+\.\d+\.\d+')
COMMITS=$(git log --oneline origin/main..HEAD)
FILES=$(git diff --name-only origin/main...HEAD)

# AI Analysis: Check commits AND examine actual code changes
# Mechanical: BREAKING CHANGE, feat:, fix: in commits
# Intelligent: New APIs, signature changes, file impact, user-facing changes

# AI presents recommendation
echo "🤖 AI Analysis: Current $CURRENT_VERSION"
echo ""
echo "Changes detected:"
echo " - [AI summary of actual changes]"
echo ""
echo "📈 Recommended: MINOR bump → 0.4.0"
echo " Rationale: [AI explanation]"
echo ""
echo "Apply version bump?"
echo " 1) patch - Bug fixes only"
echo " 2) minor - New features ← AI suggests"
echo " 3) major - Breaking changes"
echo " 4) skip"
read -p "Choice [default=2]: " CHOICE

# Apply bump
case "${CHOICE:-2}" in
1) make bump-patch; BUMP_TYPE="patch" ;;
2) make bump-minor; BUMP_TYPE="minor" ;;
3) make bump-major; BUMP_TYPE="major" ;;
4) BUMP_TYPE="" ;;
esac

# AI generates CHANGELOG entry automatically
if [ -n "$BUMP_TYPE" ]; then
# AI analyzes diff and generates Keep a Changelog formatted entry
# Categorizes: Added/Changed/Fixed based on actual changes
# Uses clear, user-focused language

NEW_VERSION=$(make version | grep -oP '\d+\.\d+\.\d+')
echo "✨ AI generated CHANGELOG for $NEW_VERSION"
echo "📝 Refinable in PR review"

# Commit with version bump type in message
git add pyproject.toml CHANGELOG.md
git commit -m "chore(release): bump version to $NEW_VERSION [$BUMP_TYPE]

AI-generated CHANGELOG. Version: $CURRENT_VERSION → $NEW_VERSION"
fi
```

**AI Analysis Factors:**

- **Commits:** `BREAKING CHANGE`, `feat:`, `fix:` patterns
- **Code:** New APIs, signature changes, refactoring detection
- **Files:** New vs. modified, public vs. internal
- **Impact:** User-facing vs. internal changes

**Semantic Versioning:**

- **MAJOR (X.0.0):** Breaking changes, API removals
- **MINOR (0.X.0):** New features (backward compatible)
- **PATCH (0.0.X):** Bug fixes, docs, internal refactoring

**Bump Type in PR Title:**

The version bump type is included in the commit message with `[patch]`,
`[minor]`, or `[major]` tag. This allows `/tag-and-release` to automatically
determine the correct version bump when creating releases.

**Example:**

```bash
# Commit message includes bump type
chore(release): bump version to 0.4.0 [minor]
```

Tag-and-release reads this to know it's a MINOR bump.

1. **Ensure your branch follows naming conventions:**
- `feature/`, `fix/`, `docs/`, `refactor/`, `test/`, `chore/`, or `release/`
- Example: `feature/add-user-authentication`
Expand Down
Loading
Loading