Repository navigation
feat: add user-level Claude commands sync and automation scripts #238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,138 @@ | ||
| # Branch Cleanup Command | ||
|
|
||
| Clean up merged and stale branches both locally and remotely. | ||
|
|
||
| ## Usage | ||
|
|
||
| ```bash | ||
| /branch-cleanup | ||
| /branch-cleanup --remote | ||
| /branch-cleanup --dry-run | ||
| ``` | ||
|
|
||
| ## What It Does | ||
|
|
||
| This command helps maintain a clean repository by identifying and removing: | ||
|
|
||
| ### Local Branches | ||
|
|
||
| - **Merged Branches**: Branches already merged into main/master | ||
| - **Stale Branches**: Branches with no activity for 30+ days | ||
| - **Gone Remote Branches**: Local branches tracking deleted remote branches | ||
|
|
||
| ### Remote Branches (with --remote) | ||
|
|
||
| - **Merged PR Branches**: Branches from merged pull requests | ||
| - **Stale Remote Branches**: No activity for 30+ days | ||
| - **Abandoned Branches**: No commits, PRs, or activity | ||
|
|
||
| ### Protected Branches | ||
|
|
||
| Never deletes: | ||
|
|
||
| - main, master, develop | ||
| - Current branch | ||
| - Branches with unmerged changes | ||
| - Branches specified in protection list | ||
|
|
||
| ## Example Output | ||
|
|
||
| ``` | ||
| 🧹 Branch Cleanup | ||
| ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
|
|
||
| 📍 Current branch: feat/add-commands | ||
| 🔒 Protected: main, master, develop | ||
|
|
||
| 📊 Analysis | ||
| • Total local branches: 15 | ||
| • Merged branches: 8 | ||
| • Stale branches (30+ days): 3 | ||
| • Up-to-date branches: 4 | ||
|
|
||
| 🗑️ Branches to delete (11): | ||
|
|
||
| Merged (8): | ||
| ✓ feat/227-commitlint (merged 2 days ago) | ||
| ✓ feat/226-common-utils (merged 2 days ago) | ||
| ✓ feat/225-docker-in-docker (merged 2 days ago) | ||
| ... and 5 more | ||
|
|
||
| Stale (3): | ||
| ⚠ experiment/new-feature (90 days old) | ||
| ⚠ fix/old-bug (45 days old) | ||
| ⚠ refactor/unused (60 days old) | ||
|
|
||
| Delete these branches? [y/N]: y | ||
|
|
||
| Deleting branches... | ||
| ✓ Deleted feat/227-commitlint | ||
| ✓ Deleted feat/226-common-utils | ||
| ✓ Deleted feat/225-docker-in-docker | ||
| ✓ Deleted 8 more branches | ||
|
|
||
| ✨ Cleanup complete! Removed 11 branches. | ||
| ``` | ||
|
|
||
| ## Options | ||
|
|
||
| ```bash | ||
| # Preview without deleting (recommended first run) | ||
| /branch-cleanup --dry-run | ||
|
|
||
| # Include remote branches | ||
| /branch-cleanup --remote | ||
|
|
||
| # Auto-confirm deletion (for CI) | ||
| /branch-cleanup --yes | ||
|
|
||
| # Custom staleness threshold (default: 30 days) | ||
| /branch-cleanup --stale-days 60 | ||
|
|
||
| # Only merged branches | ||
| /branch-cleanup --merged-only | ||
| ``` | ||
|
|
||
| ## Safety Features | ||
|
|
||
| - **Dry Run**: Preview before deletion | ||
| - **Interactive Confirmation**: Requires user approval | ||
| - **Protection List**: Never deletes protected branches | ||
| - **Unmerged Detection**: Warns about unmerged changes | ||
| - **Current Branch**: Never deletes current branch | ||
|
|
||
| ## CI Integration | ||
|
|
||
| ```yaml | ||
| # .github/workflows/branch-cleanup.yml | ||
| - name: Cleanup Merged Branches | ||
| run: | | ||
| bash script/branch-cleanup.sh --merged-only --yes | ||
| ``` | ||
|
|
||
| ## Staleness Criteria | ||
|
|
||
| | Age | Status | Action | | ||
| | ------ | ---------- | ------ | | ||
| | < 30d | Active | Keep | | ||
| | 30-60d | Stale | Warn | | ||
| | 60-90d | Very Stale | Delete | | ||
| | > 90d | Abandoned | Delete | | ||
|
|
||
| ## Benefits | ||
|
|
||
| - 🧹 **Clean Repository**: Remove clutter | ||
| - ⚡ **Faster Operations**: Fewer branches to manage | ||
| - 👀 **Better Visibility**: Focus on active work | ||
| - 💾 **Disk Space**: Free up local storage | ||
| - 🔄 **Best Practice**: Regular maintenance habit | ||
|
|
||
| ## Implementation | ||
|
|
||
| This command is implemented in `script/branch-cleanup.sh`. | ||
|
|
||
| ## Requirements | ||
|
|
||
| - Git repository | ||
| - GitHub CLI (`gh`) for remote branch operations (optional) | ||
| - Proper permissions for remote deletions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,123 @@ | ||
| # Dependency Health Check Command | ||
|
|
||
| Comprehensive dependency health analysis including updates, security, and licensing. | ||
|
|
||
| ## Usage | ||
|
|
||
| ```bash | ||
| /dependency-health-check | ||
| ``` | ||
|
|
||
| ## What It Does | ||
|
|
||
| This command performs a comprehensive health check of all project dependencies: | ||
|
|
||
| ### npm Dependencies | ||
|
|
||
| - **Outdated Packages**: Detects packages with available updates | ||
| - **Security Vulnerabilities**: Scans for known vulnerabilities (`npm audit`) | ||
| - **Deprecated Packages**: Identifies deprecated dependencies | ||
| - **License Compliance**: Checks for incompatible licenses | ||
| - **Peer Dependencies**: Validates peer dependency requirements | ||
|
|
||
| ### DevContainer Features | ||
|
|
||
| - **Feature Updates**: Checks for newer versions of DevContainer features | ||
| - **Base Image**: Verifies if base image has updates | ||
| - **Deprecated Features**: Identifies deprecated features | ||
|
|
||
| ### Analysis Report | ||
|
|
||
| - **Risk Level**: Critical, High, Medium, Low | ||
| - **Action Required**: Immediate, Soon, Optional | ||
| - **Recommendations**: Specific actions to improve dependency health | ||
|
|
||
| ## Example Output | ||
|
|
||
| ``` | ||
| 🔍 Dependency Health Check | ||
| ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
|
|
||
| 📦 npm Packages (425 total) | ||
| ✓ No critical vulnerabilities | ||
| ⚠ 3 high severity vulnerabilities | ||
| • 12 packages can be updated | ||
| • 2 deprecated packages found | ||
|
|
||
| 🔒 Security Status: Medium Risk | ||
| High: 3 vulnerabilities | ||
| - axios: Prototype pollution (CVE-2023-XXXX) | ||
| - semver: ReDoS vulnerability (CVE-2023-YYYY) | ||
| - json5: Prototype pollution (CVE-2022-ZZZZ) | ||
|
|
||
| 📊 Update Summary | ||
| Major: 2 packages | ||
| Minor: 7 packages | ||
| Patch: 3 packages | ||
|
|
||
| ⚠ Deprecated Packages | ||
| • request (use axios or node-fetch instead) | ||
| • babel-eslint (use @babel/eslint-parser) | ||
|
|
||
| ✅ License Compliance | ||
| • All licenses compatible | ||
| • MIT: 387 packages | ||
| • Apache-2.0: 28 packages | ||
| • BSD-3-Clause: 10 packages | ||
|
|
||
| 🏥 Overall Health: 75/100 | ||
| Recommendations: | ||
| 1. Update axios to v1.6.0 (security fix) | ||
| 2. Replace deprecated packages | ||
| 3. Update 12 minor/patch versions | ||
|
|
||
| Next steps: | ||
| npm update # Update minor/patch versions | ||
| npm audit fix # Auto-fix security issues | ||
| npm outdated # See all outdated packages | ||
| ``` | ||
|
|
||
| ## Options | ||
|
|
||
| ```bash | ||
| # JSON output for CI integration | ||
| /dependency-health-check --json | ||
|
|
||
| # Fail on high severity issues | ||
| /dependency-health-check --strict | ||
| ``` | ||
|
|
||
| ## CI Integration | ||
|
|
||
| ```yaml | ||
| # .github/workflows/dependency-health.yml | ||
| - name: Dependency Health Check | ||
| run: bash script/dependency-health-check.sh --strict | ||
| ``` | ||
|
|
||
| ## Risk Levels | ||
|
|
||
| | Level | Criteria | Action | | ||
| | -------- | ---------------------------------- | --------- | | ||
| | Critical | Critical vulnerabilities | Immediate | | ||
| | High | High severity or many outdated | Soon | | ||
| | Medium | Some vulnerabilities or deprecated | Optional | | ||
| | Low | Minor updates only | Optional | | ||
|
|
||
| ## Benefits | ||
|
|
||
| - 🛡️ **Security**: Early detection of vulnerabilities | ||
| - 📊 **Visibility**: Clear dependency status | ||
| - ⚡ **Proactive**: Catch issues before they're problems | ||
| - 📋 **Compliance**: License and policy enforcement | ||
| - 🔄 **Maintenance**: Easier dependency management | ||
|
|
||
| ## Implementation | ||
|
|
||
| This command is implemented in `script/dependency-health-check.sh`. | ||
|
|
||
| ## Requirements | ||
|
|
||
| - Node.js and npm | ||
| - Access to npm registry | ||
| - DevContainer configuration (optional) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| # Pre-PR Checklist Command | ||
|
|
||
| Automate comprehensive checks before creating a pull request. | ||
|
|
||
| ## Usage | ||
|
|
||
| ```bash | ||
| /pre-pr-checklist | ||
| ``` | ||
|
|
||
| ## What It Does | ||
|
|
||
| This command runs a comprehensive checklist to ensure your changes are ready for pull request: | ||
|
|
||
| ### Quality Checks (Sequential) | ||
|
|
||
| 1. **Lint Check**: Runs ESLint to detect code issues | ||
| 2. **Format Check**: Verifies Prettier formatting | ||
| 3. **Type Check**: Validates TypeScript types (if applicable) | ||
| 4. **Unit Tests**: Runs all tests with coverage | ||
| 5. **Integration Tests**: Runs Bats integration tests | ||
| 6. **Shellcheck**: Validates shell scripts | ||
|
|
||
| ### PR Analysis | ||
|
|
||
| - **Size Estimation**: Calculates diff lines and file count | ||
| - **Size Label**: Suggests appropriate size label (S/M/L/XL) | ||
| - **Linked Issues**: Checks for related GitHub issues | ||
| - **Commit Messages**: Validates conventional commit format | ||
|
|
||
| ### PR Preparation | ||
|
|
||
| - **Branch Status**: Checks if branch is up-to-date with main | ||
| - **Merge Conflicts**: Detects potential merge conflicts | ||
| - **Template Suggestion**: Recommends PR template content | ||
|
|
||
| ## Size Thresholds | ||
|
|
||
| | Label | Line Changes | File Count | | ||
| | ------- | ------------ | ---------- | | ||
| | size/S | < 100 | < 10 | | ||
| | size/M | < 300 | < 20 | | ||
| | size/L | < 1000 | < 30 | | ||
| | size/XL | ≥ 1000 | ≥ 30 | | ||
|
|
||
| ## Example Output | ||
|
|
||
| ``` | ||
| 📋 Pre-PR Checklist | ||
| ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
|
|
||
| ✅ Quality Checks | ||
| ✓ Lint check passed | ||
| ✓ Format check passed | ||
| ✓ Tests passed (101/101) | ||
| ✓ Coverage: 82.5% (threshold: 70%) | ||
|
|
||
| 📊 PR Analysis | ||
| • Size: Medium (247 lines, 8 files) | ||
| • Suggested label: size/M | ||
| • Linked issues: #227 | ||
| • Commits: 3 (all follow conventional commits) | ||
|
|
||
| 🔄 Branch Status | ||
| ✓ Up-to-date with main | ||
| ✓ No merge conflicts | ||
|
|
||
| ✨ Ready to create PR! | ||
| ``` | ||
|
|
||
| ## Options | ||
|
|
||
| ```bash | ||
| # Skip tests (faster, but not recommended) | ||
| /pre-pr-checklist --skip-tests | ||
|
|
||
| # Skip integration tests only | ||
| /pre-pr-checklist --skip-integration | ||
| ``` | ||
|
|
||
| ## Implementation | ||
|
|
||
| This command is implemented in `script/pre-pr-checklist.sh`. | ||
|
|
||
| ## Integration | ||
|
|
||
| Works seamlessly with: | ||
|
|
||
| - GitHub Actions CI workflows | ||
| - Git hooks (pre-push) | ||
| - IDE integrations | ||
| - Manual PR preparation | ||
|
|
||
| ## Benefits | ||
|
|
||
| - 🚀 **Faster Reviews**: Catch issues before PR creation | ||
| - ✅ **Quality Assurance**: All checks pass before submission | ||
| - 📊 **Better PRs**: Proper sizing and documentation | ||
| - ⚡ **Time Saving**: One command instead of multiple | ||
|
|
||
| ## Requirements | ||
|
|
||
| - Git repository | ||
| - Node.js and npm | ||
| - GitHub CLI (`gh`) for issue detection | ||
| - All project dependencies installed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add
jqto the requirements list.The script depends on
jqfor JSON parsing, but it's not listed here.## Requirements - Node.js and npm +- jq (for JSON parsing) - Access to npm registry - DevContainer configuration (optional)🤖 Prompt for AI Agents