Skip to content

Commit 901552c

Browse files
authored
✨ Generalize release-tool for semver & release-flow (#55)
Parent issue: sequentech/meta#9230
2 parents 24939cc + 7678fb4 commit 901552c

File tree

95 files changed

+40901
-2653
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+40901
-2653
lines changed

.claude/README.md

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
# Release Tool - Claude Code Project Context
2+
3+
## Project Overview
4+
5+
This is **release-tool**, a comprehensive Python CLI tool for managing releases using semantic versioning. It automates release note generation by consolidating commits, fetching ticket details from GitHub, and creating beautifully formatted release notes.
6+
7+
## Key Capabilities
8+
9+
- **Semantic Versioning**: Full support for versions, release candidates, betas, alphas
10+
- **Ticket Consolidation**: Groups commits by parent tickets for cleaner release notes
11+
- **GitHub Integration**: Syncs PRs, issues, releases via parallelized API calls
12+
- **Local Git Analysis**: Analyzes commit history from local repositories
13+
- **Template-based Output**: Jinja2 templates for customizable release notes
14+
- **Performance Optimized**: 20 parallel workers, GitHub Search API, efficient caching
15+
16+
## Technology Stack
17+
18+
- **Python 3.10+** with type hints and Pydantic models
19+
- **PyGithub** - GitHub API integration
20+
- **GitPython** - Local Git operations
21+
- **Click** - CLI framework
22+
- **Rich** - Beautiful terminal output with progress bars
23+
- **Jinja2** - Template rendering
24+
- **SQLite** - Local caching database
25+
- **pytest** - Testing framework
26+
27+
## Architecture
28+
29+
```
30+
src/release_tool/
31+
├── main.py # CLI entry point (sync, generate, list-releases commands)
32+
├── models.py # Pydantic models (SemanticVersion, Commit, PR, Ticket, Release)
33+
├── config.py # Configuration with validation
34+
├── db.py # SQLite database operations
35+
├── git_ops.py # Git operations (find commits, tags, version comparison)
36+
├── github_utils.py # GitHub API client (search, fetch, create releases/PRs)
37+
├── sync.py # Parallelized sync manager
38+
├── policies.py # Ticket extraction, consolidation, categorization
39+
└── media_utils.py # Media download utilities
40+
```
41+
42+
## Common Workflows
43+
44+
### 1. Initial Setup
45+
```bash
46+
release-tool init-config # Create release_tool.toml
47+
export GITHUB_TOKEN="ghp_..." # Set GitHub token
48+
# Edit release_tool.toml with your repo settings
49+
```
50+
51+
### 2. Sync GitHub Data
52+
```bash
53+
release-tool sync # Sync tickets, PRs, releases
54+
```
55+
56+
### 3. Generate Release Notes
57+
```bash
58+
release-tool generate 2.0.0 \
59+
--repo-path ~/projects/myrepo \
60+
--output docs/releases/2.0.0.md
61+
```
62+
63+
### 4. Create GitHub Release or PR
64+
```bash
65+
release-tool generate 2.0.0 \
66+
--repo-path ~/projects/myrepo \
67+
--upload # Creates GitHub release
68+
69+
release-tool generate 2.0.0 \
70+
--repo-path ~/projects/myrepo \
71+
--create-pr # Creates PR with release notes
72+
```
73+
74+
## Performance Requirements (CRITICAL)
75+
76+
When working on this codebase, ALWAYS adhere to these performance principles:
77+
78+
### 1. Parallelize All Network Operations
79+
- Use `ThreadPoolExecutor` with 20 workers for GitHub API calls
80+
- Batch size: 100-200 items for optimal throughput
81+
- GitHub rate limit: 5000/hour = safe to parallelize aggressively
82+
83+
### 2. Use GitHub Search API
84+
- NEVER use PyGithub's lazy iteration (`for issue in repo.get_issues()`)
85+
- ALWAYS use Search API (`gh.search_issues(query)`)
86+
- Search API is 10-20x faster than iteration
87+
88+
### 3. Progress Feedback ALWAYS
89+
- NEVER leave user waiting >2 seconds without feedback
90+
- Show "Searching...", "Found X items", "Filtering...", "Fetching X/Y..."
91+
- Use Rich progress bars for parallel operations
92+
93+
### 4. Example Pattern
94+
```python
95+
# BAD - Sequential iteration
96+
for issue in repo.get_issues(): # Each iteration = network call
97+
process(issue)
98+
99+
# GOOD - Search API + parallel fetch
100+
query = f"repo:{repo_name} is:issue"
101+
issues = gh.search_issues(query) # Fast
102+
console.print(f"Searching for issues...")
103+
console.print(f"Found {len(issues)} issues")
104+
105+
with ThreadPoolExecutor(max_workers=20) as executor:
106+
futures = [executor.submit(fetch_details, num) for num in issues]
107+
for future in as_completed(futures):
108+
# Process with progress bar
109+
```
110+
111+
## Testing
112+
113+
Run tests with:
114+
```bash
115+
pytest # All tests
116+
pytest tests/test_sync.py -v # Specific module
117+
pytest --cov=release_tool # With coverage
118+
```
119+
120+
Current coverage: 74 tests across all modules.
121+
122+
## Slash Commands Available
123+
124+
See `.claude/commands/` for custom slash commands:
125+
- `/sync-fast` - Quick sync with monitoring
126+
- `/generate-release` - Generate release notes workflow
127+
- `/test-affected` - Run tests for modified modules
128+
- `/lint-fix` - Auto-fix code quality issues
129+
- `/perf-profile` - Profile sync performance
130+
- `/debug-sync` - Debug sync with verbose output
131+
132+
## Important Files
133+
134+
- `release_tool.toml` - Configuration file (created by `init-config`)
135+
- `release_tool.db` - SQLite cache (auto-created by `sync`)
136+
- `.release_tool_cache/` - Cloned git repositories for offline access
137+
- `docs/` - User documentation
138+
- `tests/` - Comprehensive unit tests
139+
140+
## Documentation
141+
142+
- Main docs: `docs/`
143+
- README: `README.md`
144+
- Example configs: `examples/example_*.toml`
145+
- Template docs: `examples/MASTER_TEMPLATE_FEATURE.md`, `examples/OUTPUT_TEMPLATE_EXAMPLES.md`
146+
147+
## Key Design Patterns
148+
149+
1. **Ticket Consolidation**: Commits grouped by parent ticket for cleaner notes
150+
2. **Version Comparison**: RCs compare to previous RC, finals to previous final
151+
3. **Incremental Sync**: Only fetch new items since last sync
152+
4. **Parallel Everything**: All GitHub operations parallelized
153+
5. **Template System**: Jinja2 with category-based grouping and custom sections

0 commit comments

Comments
 (0)