Dev Assistant
Interactive local development tool that analyzes staged changes before committing to ensure changelog, documentation, and examples are up to date.
Features
- Changelog Detection: Checks if staged changes need changelog entry
- Documentation Checks: Identifies when docs should be updated
- Example Validation: Suggests when examples need updates
- Test Coverage: Reminds about test requirements
- Interactive Mode: Prompts for actions
- Token-Aware: Uses promptext for intelligent analysis
Usage
Basic Check
# Stage your changes first
git add .
# Run the assistant
./scripts/dev-assistant.sh
Dry Run Mode
# See what would be checked without prompting
./scripts/dev-assistant.sh --dry-run
Auto-Fix Mode
# Attempt to automatically apply fixes
./scripts/dev-assistant.sh --auto-fix
Example Session
π€ Promptext Dev Assistant
π Analyzing staged changes...
Found 3 staged files
Extracted ~2,456 tokens from 3 files
π Analysis Results:
β οΈ Changelog entry recommended
Reason: Public API changes detected in pkg/promptext/
β οΈ Documentation updates needed
- docs-astro/src/content/docs/library-usage.md - Library changes detected
β
Examples are up to date
β
Tests look good
Add changelog entry? [y/N]: y
π‘ Add your changelog entry to CHANGELOG.md
Then stage the file: git add CHANGELOG.md
β¨ Done! Remember to review your changes before committing.
Integration with Git
Pre-Commit Hook
Add to .git/hooks/pre-commit:
#!/bin/bash
./scripts/dev-assistant.sh --dry-run
Alias
Add to your .bashrc or .zshrc:
alias check='./scripts/dev-assistant.sh'
Then use:
git add .
check
git commit -m "..."
How It Works
- Detect Staged Files: Uses
git diff --cached to get staged changes
- Extract Context: Uses promptext library with 8K token budget
- Pattern Analysis: Checks for library changes, doc updates, etc.
- Interactive Prompts: Asks for confirmation before actions
- Helpful Suggestions: Provides specific file paths and reasons
Demonstrates
- β
Local development productivity
- β
Interactive CLI tools with promptext
- β
Git workflow integration
- β
Pre-commit validation
- β
Token-aware context extraction
- Changelog: Detects if CHANGELOG.md needs an entry
- Documentation: Identifies doc files needing updates
- Examples: Checks if examples/ should be updated
- Tests: Reminds about test coverage
- Breaking Changes: Warns about API changes
Future Enhancements
- Auto-generate changelog entries
- Suggest specific doc sections to update
- Check test coverage percentage
- Integrate with editor (VS Code extension)
- AI-powered commit message suggestions