Skip to content

Commit 3a5a5f9

Browse files
1broseidonclaude
andcommitted
chore: release v0.7.4 - real-world promptext automation tools
Add three practical tools demonstrating promptext library usage: - Release notes generator with AI enhancement mode - AI PR assistant for GitHub Actions - Local dev assistant for pre-commit validation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 137d980 commit 3a5a5f9

File tree

3 files changed

+230
-9
lines changed

3 files changed

+230
-9
lines changed

CHANGELOG.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,73 @@ All notable changes to promptext will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.7.4] - 2025-11-10
9+
10+
### Added
11+
12+
- **Release Notes Generator** (`cmd/release-notes/`): Automated changelog generation powered by promptext
13+
- Analyzes git history since last tag to identify all changes
14+
- Extracts code context with token-aware analysis (~8K token budget)
15+
- Categorizes commits by conventional commit type (feat, fix, docs, chore, breaking)
16+
- Generates Keep a Changelog format automatically
17+
- **AI Enhancement Mode**: New `--ai-prompt` flag generates comprehensive prompts for Claude Code
18+
- Includes full commit history and code context in prompt
19+
- Provides structured instructions for polished release notes
20+
- Example: `go run cmd/release-notes/main.go --version v0.7.4 --ai-prompt`
21+
- Usage: `go run cmd/release-notes/main.go --version v0.7.4` for basic notes
22+
- Demonstrates: Dogfooding promptext for repository automation
23+
24+
- **AI PR Assistant** (`cmd/pr-assistant/`): Automated pull request analysis tool
25+
- GitHub Actions integration for automatic PR review comments
26+
- Uses promptext to extract context from changed files (~10K token budget)
27+
- **Smart Detection**:
28+
- Missing CHANGELOG.md updates when library code changes
29+
- Documentation updates needed for new features
30+
- Example additions needed for new library functionality
31+
- Potential breaking changes based on code keywords
32+
- Generates formatted markdown comment with actionable suggestions
33+
- Workflow file: `.github/workflows/pr-assistant.yml`
34+
- Environment variables: `PR_NUMBER`, `BASE_SHA`, `HEAD_SHA`
35+
- Demonstrates: CI/CD integration with promptext library
36+
37+
- **Local Dev Assistant** (`cmd/dev-assistant/`): Pre-commit validation for developers
38+
- Analyzes git staged changes before committing
39+
- Interactive prompts for fixing detected issues
40+
- Smart pattern detection across codebase structure
41+
- **Validation Checks**:
42+
- Library changes in `pkg/promptext/` require CHANGELOG.md entry
43+
- Public API changes should update documentation
44+
- New features should include examples
45+
- Code changes should have test coverage
46+
- **Modes**:
47+
- Default: Interactive mode with prompts
48+
- `--dry-run`: Show analysis without prompting
49+
- `--auto-fix`: Attempt automatic fixes (manual for most cases)
50+
- Shell wrapper: `./scripts/dev-assistant.sh`
51+
- Can be integrated as git pre-commit hook
52+
- Demonstrates: Local development workflow enhancement
53+
54+
### Documentation
55+
56+
- Added comprehensive READMEs for all three tools explaining usage and integration
57+
- Each tool includes practical examples and git workflow integration patterns
58+
- Documented environment variables and command-line options
59+
60+
### Changed
61+
62+
- Project now dogfoods promptext library in three real-world automation scenarios
63+
- Enhanced code samples with functional assistant tools instead of basic examples
64+
65+
### Development
66+
67+
- All three tools use promptext library via `promptext.Extract()` function
68+
- Token budgets optimized for different use cases (8K-10K ranges)
69+
- File filtering focused on relevant extensions (.go, .md, .yml, .yaml)
70+
- Git integration using standard git commands (diff, log, describe)
71+
- Zero external dependencies beyond promptext library and Go stdlib
72+
73+
---
74+
875
## [0.7.3] - 2025-11-09
976

1077
### Added

cmd/release-notes/main.go

Lines changed: 96 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ func main() {
1717
version := flag.String("version", "", "Version to generate notes for (e.g., v0.7.3)")
1818
sinceTag := flag.String("since", "", "Generate notes since this tag (auto-detects if empty)")
1919
output := flag.String("output", "", "Output file (prints to stdout if empty)")
20+
aiPrompt := flag.Bool("ai-prompt", false, "Generate prompt for Claude Code to enhance release notes")
2021
flag.Parse()
2122

2223
// Get the tag to compare from
@@ -58,18 +59,31 @@ func main() {
5859
fmt.Fprintf(os.Stderr, " Extracted context: ~%d tokens from %d files\n",
5960
result.TokenCount, len(result.ProjectOutput.Files))
6061

61-
// Generate release notes
62-
fmt.Fprintln(os.Stderr, "\n📝 Generating release notes...\n")
63-
releaseNotes := generateReleaseNotes(*version, fromTag, commits, result)
62+
// Generate release notes or AI prompt
63+
if *aiPrompt {
64+
fmt.Fprintln(os.Stderr, "\n📝 Generating Claude Code prompt...\n")
65+
prompt := generateClaudeCodePrompt(*version, fromTag, commits, result)
6466

65-
// Output
66-
if *output != "" {
67-
if err := os.WriteFile(*output, []byte(releaseNotes), 0644); err != nil {
68-
log.Fatalf("Failed to write output: %v", err)
67+
if *output != "" {
68+
if err := os.WriteFile(*output, []byte(prompt), 0644); err != nil {
69+
log.Fatalf("Failed to write output: %v", err)
70+
}
71+
fmt.Fprintf(os.Stderr, "✅ Prompt written to %s\n", *output)
72+
} else {
73+
fmt.Println(prompt)
6974
}
70-
fmt.Fprintf(os.Stderr, "✅ Release notes written to %s\n", *output)
7175
} else {
72-
fmt.Println(releaseNotes)
76+
fmt.Fprintln(os.Stderr, "\n📝 Generating release notes...\n")
77+
releaseNotes := generateReleaseNotes(*version, fromTag, commits, result)
78+
79+
if *output != "" {
80+
if err := os.WriteFile(*output, []byte(releaseNotes), 0644); err != nil {
81+
log.Fatalf("Failed to write output: %v", err)
82+
}
83+
fmt.Fprintf(os.Stderr, "✅ Release notes written to %s\n", *output)
84+
} else {
85+
fmt.Println(releaseNotes)
86+
}
7387
}
7488
}
7589

@@ -246,3 +260,76 @@ func generateReleaseNotes(version, fromTag string, commits []string, result *pro
246260

247261
return notes.String()
248262
}
263+
264+
// generateClaudeCodePrompt generates a prompt for Claude Code to enhance release notes
265+
func generateClaudeCodePrompt(version, fromTag string, commits []string, result *promptext.Result) string {
266+
var prompt strings.Builder
267+
268+
// Determine version
269+
if version == "" {
270+
version = "0.7.4"
271+
}
272+
273+
prompt.WriteString("# Release Notes Enhancement Request\n\n")
274+
prompt.WriteString("Please generate comprehensive release notes for promptext version " + version + "\n\n")
275+
276+
prompt.WriteString("## Context\n\n")
277+
prompt.WriteString(fmt.Sprintf("- **Version**: %s\n", version))
278+
prompt.WriteString(fmt.Sprintf("- **Changes since**: %s\n", fromTag))
279+
prompt.WriteString(fmt.Sprintf("- **Commits analyzed**: %d\n", len(commits)))
280+
prompt.WriteString(fmt.Sprintf("- **Files changed**: %d\n", len(result.ProjectOutput.Files)))
281+
prompt.WriteString(fmt.Sprintf("- **Context extracted**: ~%d tokens\n\n", result.TokenCount))
282+
283+
prompt.WriteString("## Commit History\n\n")
284+
prompt.WriteString("```\n")
285+
for _, commit := range commits {
286+
prompt.WriteString(commit + "\n")
287+
}
288+
prompt.WriteString("```\n\n")
289+
290+
prompt.WriteString("## Changed Files Summary\n\n")
291+
for _, file := range result.ProjectOutput.Files {
292+
prompt.WriteString(fmt.Sprintf("- `%s` (~%d tokens)\n", file.Path, file.Tokens))
293+
}
294+
prompt.WriteString("\n")
295+
296+
prompt.WriteString("## Code Context (via promptext)\n\n")
297+
prompt.WriteString("```\n")
298+
prompt.WriteString(result.FormattedOutput)
299+
prompt.WriteString("\n```\n\n")
300+
301+
prompt.WriteString("## Task\n\n")
302+
prompt.WriteString("Generate release notes in Keep a Changelog format with these sections:\n\n")
303+
prompt.WriteString("### Added\n")
304+
prompt.WriteString("- New features (be specific and detailed)\n")
305+
prompt.WriteString("- Focus on user-facing value\n\n")
306+
prompt.WriteString("### Changed\n")
307+
prompt.WriteString("- Improvements and modifications\n\n")
308+
prompt.WriteString("### Fixed\n")
309+
prompt.WriteString("- Bug fixes\n\n")
310+
prompt.WriteString("### Documentation\n")
311+
prompt.WriteString("- Doc updates\n\n")
312+
313+
prompt.WriteString("## Requirements\n\n")
314+
prompt.WriteString("1. Use the commit history and code context to write detailed, clear descriptions\n")
315+
prompt.WriteString("2. Group related changes together logically\n")
316+
prompt.WriteString("3. Focus on user impact, not implementation details\n")
317+
prompt.WriteString("4. Be specific about what changed and why it matters\n")
318+
prompt.WriteString("5. Follow Keep a Changelog format\n")
319+
prompt.WriteString("6. Include markdown formatting for code, paths, etc.\n\n")
320+
321+
prompt.WriteString("## Example Format\n\n")
322+
prompt.WriteString("```markdown\n")
323+
prompt.WriteString("## [" + version + "] - " + time.Now().Format("2006-01-02") + "\n\n")
324+
prompt.WriteString("### Added\n")
325+
prompt.WriteString("- **Release Notes Generator**: Automated tool using promptext library to analyze git changes\n")
326+
prompt.WriteString(" - Extracts code context with token-aware analysis\n")
327+
prompt.WriteString(" - Categorizes commits by type (feat, fix, docs)\n")
328+
prompt.WriteString(" - Generates changelog-compatible markdown\n\n")
329+
prompt.WriteString("...\n")
330+
prompt.WriteString("```\n\n")
331+
332+
prompt.WriteString("Please generate the complete, polished release notes now.\n")
333+
334+
return prompt.String()
335+
}

docs-astro/src/content/docs/changelog.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,73 @@ All notable changes to promptext are documented here.
1010
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1111
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
1212

13+
## [0.7.4] - 2025-11-10
14+
15+
### Added
16+
17+
- **Release Notes Generator** (`cmd/release-notes/`): Automated changelog generation powered by promptext
18+
- Analyzes git history since last tag to identify all changes
19+
- Extracts code context with token-aware analysis (~8K token budget)
20+
- Categorizes commits by conventional commit type (feat, fix, docs, chore, breaking)
21+
- Generates Keep a Changelog format automatically
22+
- **AI Enhancement Mode**: New `--ai-prompt` flag generates comprehensive prompts for Claude Code
23+
- Includes full commit history and code context in prompt
24+
- Provides structured instructions for polished release notes
25+
- Example: `go run cmd/release-notes/main.go --version v0.7.4 --ai-prompt`
26+
- Usage: `go run cmd/release-notes/main.go --version v0.7.4` for basic notes
27+
- Demonstrates: Dogfooding promptext for repository automation
28+
29+
- **AI PR Assistant** (`cmd/pr-assistant/`): Automated pull request analysis tool
30+
- GitHub Actions integration for automatic PR review comments
31+
- Uses promptext to extract context from changed files (~10K token budget)
32+
- **Smart Detection**:
33+
- Missing CHANGELOG.md updates when library code changes
34+
- Documentation updates needed for new features
35+
- Example additions needed for new library functionality
36+
- Potential breaking changes based on code keywords
37+
- Generates formatted markdown comment with actionable suggestions
38+
- Workflow file: `.github/workflows/pr-assistant.yml`
39+
- Environment variables: `PR_NUMBER`, `BASE_SHA`, `HEAD_SHA`
40+
- Demonstrates: CI/CD integration with promptext library
41+
42+
- **Local Dev Assistant** (`cmd/dev-assistant/`): Pre-commit validation for developers
43+
- Analyzes git staged changes before committing
44+
- Interactive prompts for fixing detected issues
45+
- Smart pattern detection across codebase structure
46+
- **Validation Checks**:
47+
- Library changes in `pkg/promptext/` require CHANGELOG.md entry
48+
- Public API changes should update documentation
49+
- New features should include examples
50+
- Code changes should have test coverage
51+
- **Modes**:
52+
- Default: Interactive mode with prompts
53+
- `--dry-run`: Show analysis without prompting
54+
- `--auto-fix`: Attempt automatic fixes (manual for most cases)
55+
- Shell wrapper: `./scripts/dev-assistant.sh`
56+
- Can be integrated as git pre-commit hook
57+
- Demonstrates: Local development workflow enhancement
58+
59+
### Documentation
60+
61+
- Added comprehensive READMEs for all three tools explaining usage and integration
62+
- Each tool includes practical examples and git workflow integration patterns
63+
- Documented environment variables and command-line options
64+
65+
### Changed
66+
67+
- Project now dogfoods promptext library in three real-world automation scenarios
68+
- Enhanced code samples with functional assistant tools instead of basic examples
69+
70+
### Development
71+
72+
- All three tools use promptext library via `promptext.Extract()` function
73+
- Token budgets optimized for different use cases (8K-10K ranges)
74+
- File filtering focused on relevant extensions (.go, .md, .yml, .yaml)
75+
- Git integration using standard git commands (diff, log, describe)
76+
- Zero external dependencies beyond promptext library and Go stdlib
77+
78+
---
79+
1380
## [0.7.3] - 2025-11-09
1481

1582
### Added

0 commit comments

Comments
 (0)