Skip to content

Commit e4b32d7

Browse files
phernandezclaude
andcommitted
feat: add automated release management system
- Add version management in __init__.py - Add justfile targets for release and beta automation - Create Claude command documentation for /release and /beta - Implement comprehensive quality checks and validation - Support automated version updates and git tagging 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 9590b93 commit e4b32d7

File tree

4 files changed

+227
-77
lines changed

4 files changed

+227
-77
lines changed

.claude/commands/release/beta.md

Lines changed: 68 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,95 @@
11
# /beta - Create Beta Release
22

3-
Create a new beta release for the current version with automated quality checks and tagging.
3+
Create a new beta release using the automated justfile target with quality checks and tagging.
44

55
## Usage
66
```
7-
/beta [version]
7+
/beta <version>
88
```
99

1010
**Parameters:**
11-
- `version` (optional): Beta version like `v0.13.0b4`. If not provided, auto-increments from latest beta tag.
11+
- `version` (required): Beta version like `v0.13.2b1` or `v0.13.2rc1`
1212

1313
## Implementation
1414

1515
You are an expert release manager for the Basic Memory project. When the user runs `/beta`, execute the following steps:
1616

17-
### Step 1: Pre-flight Checks
18-
1. Check current git status for uncommitted changes
19-
2. Verify we're on the `main` branch
20-
3. Get the latest beta tag to determine next version if not provided
21-
22-
### Step 2: Quality Assurance
23-
1. Run `just check` to ensure code quality
24-
2. If any checks fail, report issues and stop
25-
3. Run `just update-deps` to ensure latest dependencies
26-
4. Commit any dependency updates with proper message
27-
28-
### Step 3: Version Determination
29-
If version not provided:
30-
1. Get latest git tags with `git tag -l "v*b*" --sort=-version:refname | head -1`
31-
2. Auto-increment beta number (e.g., `v0.13.0b2``v0.13.0b3`)
32-
3. Confirm version with user before proceeding
33-
34-
### Step 4: Release Creation
35-
1. Commit any remaining changes
36-
2. Push to main: `git push origin main`
37-
3. Create tag: `git tag {version}`
38-
4. Push tag: `git push origin {version}`
39-
40-
### Step 5: Monitor Release
17+
### Step 1: Pre-flight Validation
18+
1. Verify version format matches `v\d+\.\d+\.\d+(b\d+|rc\d+)` pattern
19+
2. Check current git status for uncommitted changes
20+
3. Verify we're on the `main` branch
21+
4. Confirm no existing tag with this version
22+
23+
### Step 2: Use Justfile Automation
24+
Execute the automated beta release process:
25+
```bash
26+
just beta <version>
27+
```
28+
29+
The justfile target handles:
30+
- ✅ Beta version format validation (supports b1, b2, rc1, etc.)
31+
- ✅ Git status and branch checks
32+
- ✅ Quality checks (`just check` - lint, format, type-check, tests)
33+
- ✅ Version update in `src/basic_memory/__init__.py`
34+
- ✅ Automatic commit with proper message
35+
- ✅ Tag creation and pushing to GitHub
36+
- ✅ Beta release workflow trigger
37+
38+
### Step 3: Monitor Beta Release
4139
1. Check GitHub Actions workflow starts successfully
42-
2. Provide installation instructions for beta
43-
3. Report status and next steps
40+
2. Monitor workflow at: https://github.com/basicmachines-co/basic-memory/actions
41+
3. Verify PyPI pre-release publication
42+
4. Test beta installation: `uv tool install basic-memory --pre`
43+
44+
### Step 4: Beta Testing Instructions
45+
Provide users with beta testing instructions:
46+
47+
```bash
48+
# Install/upgrade to beta
49+
uv tool install basic-memory --pre
50+
51+
# Or upgrade existing installation
52+
uv tool upgrade basic-memory --prerelease=allow
53+
```
54+
55+
## Version Guidelines
56+
- **First beta**: `v0.13.2b1`
57+
- **Subsequent betas**: `v0.13.2b2`, `v0.13.2b3`, etc.
58+
- **Release candidates**: `v0.13.2rc1`, `v0.13.2rc2`, etc.
59+
- **Final release**: `v0.13.2` (use `/release` command)
4460

4561
## Error Handling
46-
- If quality checks fail, provide specific fix instructions
47-
- If git operations fail, provide manual recovery steps
48-
- If GitHub Actions fail, provide debugging guidance
62+
- If `just beta` fails, examine the error output for specific issues
63+
- If quality checks fail, fix issues and retry
64+
- If version format is invalid, correct and retry
65+
- If tag already exists, increment version number
4966

5067
## Success Output
5168
```
52-
✅ Beta Release v0.13.0b4 Created Successfully!
69+
✅ Beta Release v0.13.2b1 Created Successfully!
5370
54-
🏷️ Tag: v0.13.0b4
71+
🏷️ Tag: v0.13.2b1
5572
🚀 GitHub Actions: Running
56-
📦 PyPI: Will be available in ~5 minutes
73+
📦 PyPI: Will be available in ~5 minutes as pre-release
5774
58-
Install with:
59-
uv tool upgrade basic-memory --prerelease=allow
75+
Install/test with:
76+
uv tool install basic-memory --pre
6077
6178
Monitor release: https://github.com/basicmachines-co/basic-memory/actions
6279
```
6380

81+
## Beta Testing Workflow
82+
1. **Create beta**: Use `/beta v0.13.2b1`
83+
2. **Test features**: Install and validate new functionality
84+
3. **Fix issues**: Address bugs found during testing
85+
4. **Iterate**: Create `v0.13.2b2` if needed
86+
5. **Release candidate**: Create `v0.13.2rc1` when stable
87+
6. **Final release**: Use `/release v0.13.2` when ready
88+
6489
## Context
65-
- Use the existing justfile targets (`just check`, `just update-deps`)
66-
- Follow semantic versioning for beta releases
67-
- Maintain release notes in CHANGELOG.md
68-
- Use conventional commit messages
69-
- Leverage uv-dynamic-versioning for version management
90+
- Beta releases are pre-releases for testing new features
91+
- Automatically published to PyPI with pre-release flag
92+
- Uses the automated justfile target for consistency
93+
- Version is automatically updated in `__init__.py`
94+
- Ideal for validating changes before stable release
95+
- Supports both beta (b1, b2) and release candidate (rc1, rc2) versions
Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# /release - Create Stable Release
22

3-
Create a stable release from the current main branch with comprehensive validation.
3+
Create a stable release using the automated justfile target with comprehensive validation.
44

55
## Usage
66
```
77
/release <version>
88
```
99

1010
**Parameters:**
11-
- `version` (required): Release version like `v0.13.0`
11+
- `version` (required): Release version like `v0.13.2`
1212

1313
## Implementation
1414

@@ -20,53 +20,54 @@ You are an expert release manager for the Basic Memory project. When the user ru
2020
3. Verify we're on the `main` branch
2121
4. Confirm no existing tag with this version
2222

23-
### Step 2: Comprehensive Quality Checks
24-
1. Run `just check` (lint, format, type-check, full test suite)
25-
2. Verify test coverage meets minimum requirements (95%+)
26-
3. Check that CHANGELOG.md contains entry for this version
27-
4. Validate all high-priority issues are closed
28-
29-
### Step 3: Release Preparation
30-
1. Update any version references if needed
31-
2. Commit any final changes with message: `chore: prepare for ${version} release`
32-
3. Push to main: `git push origin main`
23+
### Step 2: Use Justfile Automation
24+
Execute the automated release process:
25+
```bash
26+
just release <version>
27+
```
3328

34-
### Step 4: Release Creation
35-
1. Create annotated tag: `git tag -a ${version} -m "Release ${version}"`
36-
2. Push tag: `git push origin ${version}`
37-
3. Monitor GitHub Actions for release automation
29+
The justfile target handles:
30+
- ✅ Version format validation
31+
- ✅ Git status and branch checks
32+
- ✅ Quality checks (`just check` - lint, format, type-check, tests)
33+
- ✅ Version update in `src/basic_memory/__init__.py`
34+
- ✅ Automatic commit with proper message
35+
- ✅ Tag creation and pushing to GitHub
36+
- ✅ Release workflow trigger
37+
38+
### Step 3: Monitor Release Process
39+
1. Check that GitHub Actions workflow starts successfully
40+
2. Monitor workflow completion at: https://github.com/basicmachines-co/basic-memory/actions
41+
3. Verify PyPI publication
42+
4. Test installation: `uv tool install basic-memory`
3843

39-
### Step 5: Post-Release Validation
44+
### Step 4: Post-Release Validation
4045
1. Verify GitHub release is created automatically
4146
2. Check PyPI publication
4247
3. Validate release assets
43-
4. Test installation: `uv tool install basic-memory`
44-
45-
### Step 6: Documentation Update
46-
1. Update any post-release documentation
47-
2. Create follow-up tasks if needed
48+
4. Update any post-release documentation
4849

4950
## Pre-conditions Check
5051
Before starting, verify:
5152
- [ ] All beta testing is complete
5253
- [ ] Critical bugs are fixed
5354
- [ ] Breaking changes are documented
54-
- [ ] CHANGELOG.md is updated
55+
- [ ] CHANGELOG.md is updated (if needed)
5556
- [ ] Version number follows semantic versioning
5657

5758
## Error Handling
58-
- If any quality check fails, stop and provide fix instructions
59-
- If changelog entry missing, prompt to create one
60-
- If tests fail, provide debugging guidance
61-
- If GitHub Actions fail, provide manual release steps
59+
- If `just release` fails, examine the error output for specific issues
60+
- If quality checks fail, fix issues and retry
61+
- If changelog entry missing, update CHANGELOG.md and commit before retrying
62+
- If GitHub Actions fail, check workflow logs for debugging
6263

6364
## Success Output
6465
```
65-
🎉 Stable Release v0.13.0 Created Successfully!
66+
🎉 Stable Release v0.13.2 Created Successfully!
6667
67-
🏷️ Tag: v0.13.0
68-
📋 GitHub Release: https://github.com/basicmachines-co/basic-memory/releases/tag/v0.13.0
69-
📦 PyPI: https://pypi.org/project/basic-memory/0.13.0/
68+
🏷️ Tag: v0.13.2
69+
📋 GitHub Release: https://github.com/basicmachines-co/basic-memory/releases/tag/v0.13.2
70+
📦 PyPI: https://pypi.org/project/basic-memory/0.13.2/
7071
🚀 GitHub Actions: Completed
7172
7273
Install with:
@@ -79,6 +80,7 @@ uv tool upgrade basic-memory
7980
## Context
8081
- This creates production releases used by end users
8182
- Must pass all quality gates before proceeding
82-
- Follows the release workflow documented in CLAUDE.md
83-
- Uses uv-dynamic-versioning for automatic version management
84-
- Triggers automated GitHub release with changelog
83+
- Uses the automated justfile target for consistency
84+
- Version is automatically updated in `__init__.py`
85+
- Triggers automated GitHub release with changelog
86+
- Leverages uv-dynamic-versioning for package version management

justfile

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,125 @@ check: lint format type-check test
5858
migration message:
5959
cd src/basic_memory/alembic && alembic revision --autogenerate -m "{{message}}"
6060

61+
# Create a stable release (e.g., just release v0.13.2)
62+
release version:
63+
#!/usr/bin/env bash
64+
set -euo pipefail
65+
66+
# Validate version format
67+
if [[ ! "{{version}}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
68+
echo "❌ Invalid version format. Use: v0.13.2"
69+
exit 1
70+
fi
71+
72+
# Extract version number without 'v' prefix
73+
VERSION_NUM=$(echo "{{version}}" | sed 's/^v//')
74+
75+
echo "🚀 Creating stable release {{version}}"
76+
77+
# Pre-flight checks
78+
echo "📋 Running pre-flight checks..."
79+
if [[ -n $(git status --porcelain) ]]; then
80+
echo "❌ Uncommitted changes found. Please commit or stash them first."
81+
exit 1
82+
fi
83+
84+
if [[ $(git branch --show-current) != "main" ]]; then
85+
echo "❌ Not on main branch. Switch to main first."
86+
exit 1
87+
fi
88+
89+
# Check if tag already exists
90+
if git tag -l "{{version}}" | grep -q "{{version}}"; then
91+
echo "❌ Tag {{version}} already exists"
92+
exit 1
93+
fi
94+
95+
# Run quality checks
96+
echo "🔍 Running quality checks..."
97+
just check
98+
99+
# Update version in __init__.py
100+
echo "📝 Updating version in __init__.py..."
101+
sed -i.bak "s/__version__ = \".*\"/__version__ = \"$VERSION_NUM\"/" src/basic_memory/__init__.py
102+
rm -f src/basic_memory/__init__.py.bak
103+
104+
# Commit version update
105+
git add src/basic_memory/__init__.py
106+
git commit -m "chore: update version to $VERSION_NUM for {{version}} release"
107+
108+
# Create and push tag
109+
echo "🏷️ Creating tag {{version}}..."
110+
git tag "{{version}}"
111+
112+
echo "📤 Pushing to GitHub..."
113+
git push origin main
114+
git push origin "{{version}}"
115+
116+
echo "✅ Release {{version}} created successfully!"
117+
echo "📦 GitHub Actions will build and publish to PyPI"
118+
echo "🔗 Monitor at: https://github.com/basicmachines-co/basic-memory/actions"
119+
120+
# Create a beta release (e.g., just beta v0.13.2b1)
121+
beta version:
122+
#!/usr/bin/env bash
123+
set -euo pipefail
124+
125+
# Validate version format (allow beta/rc suffixes)
126+
if [[ ! "{{version}}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(b[0-9]+|rc[0-9]+)$ ]]; then
127+
echo "❌ Invalid beta version format. Use: v0.13.2b1 or v0.13.2rc1"
128+
exit 1
129+
fi
130+
131+
# Extract version number without 'v' prefix
132+
VERSION_NUM=$(echo "{{version}}" | sed 's/^v//')
133+
134+
echo "🧪 Creating beta release {{version}}"
135+
136+
# Pre-flight checks
137+
echo "📋 Running pre-flight checks..."
138+
if [[ -n $(git status --porcelain) ]]; then
139+
echo "❌ Uncommitted changes found. Please commit or stash them first."
140+
exit 1
141+
fi
142+
143+
if [[ $(git branch --show-current) != "main" ]]; then
144+
echo "❌ Not on main branch. Switch to main first."
145+
exit 1
146+
fi
147+
148+
# Check if tag already exists
149+
if git tag -l "{{version}}" | grep -q "{{version}}"; then
150+
echo "❌ Tag {{version}} already exists"
151+
exit 1
152+
fi
153+
154+
# Run quality checks
155+
echo "🔍 Running quality checks..."
156+
just check
157+
158+
# Update version in __init__.py
159+
echo "📝 Updating version in __init__.py..."
160+
sed -i.bak "s/__version__ = \".*\"/__version__ = \"$VERSION_NUM\"/" src/basic_memory/__init__.py
161+
rm -f src/basic_memory/__init__.py.bak
162+
163+
# Commit version update
164+
git add src/basic_memory/__init__.py
165+
git commit -m "chore: update version to $VERSION_NUM for {{version}} beta release"
166+
167+
# Create and push tag
168+
echo "🏷️ Creating tag {{version}}..."
169+
git tag "{{version}}"
170+
171+
echo "📤 Pushing to GitHub..."
172+
git push origin main
173+
git push origin "{{version}}"
174+
175+
echo "✅ Beta release {{version}} created successfully!"
176+
echo "📦 GitHub Actions will build and publish to PyPI as pre-release"
177+
echo "🔗 Monitor at: https://github.com/basicmachines-co/basic-memory/actions"
178+
echo "📥 Install with: uv tool install basic-memory --pre"
179+
61180
# List all available recipes
62181
default:
63182
@just --list

src/basic_memory/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
"""basic-memory - Local-first knowledge management combining Zettelkasten with knowledge graphs"""
22

3+
# Package version - updated by release automation
4+
__version__ = "0.13.1"
5+
36
# API version for FastAPI - independent of package version
4-
__version__ = "v0"
7+
__api_version__ = "v0"

0 commit comments

Comments
 (0)