diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index 0c4c943..75d04fd 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -14,11 +14,6 @@ "source": "./commit", "description": "Create a Git commit with semantic commit message format" }, - { - "name": "terminal-ui-design", - "source": "./terminal-ui-design", - "description": "Create distinctive, production-grade terminal user interfaces with high design quality" - }, { "name": "frontend-design", "source": "./frontend-design", diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 6044020..3800160 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -22,7 +22,6 @@ Add any other context or screenshots about the feature request here. **Which plugin would this affect?** - [ ] team-agents - [ ] commit -- [ ] terminal-ui-design - [ ] frontend-design - [ ] interview - [ ] statusline diff --git a/.github/workflows/pr-automation.md b/.github/workflows/pr-automation.md new file mode 100644 index 0000000..b620aac --- /dev/null +++ b/.github/workflows/pr-automation.md @@ -0,0 +1,96 @@ +--- +description: >- + Agentic workflow for PR automation: auto-label based on changed files, + auto-assign reviewers based on code ownership, and welcome first-time contributors. +--- + +# PR Automation Workflow + +Automatically triages pull requests with labels, reviewers, and welcome messages. + +## Triggers + +- `pull_request: opened` - When a new PR is opened +- `pull_request: reopened` - When a PR is reopened + +## Features + +### Auto-Label +Labels PRs based on changed file paths: +- `area:api` - Changes in `src/api/` or `api/` +- `area:frontend` - Changes in `src/frontend/`, `components/`, or `ui/` +- `area:backend` - Changes in `src/backend/` or `server/` +- `area:docs` - Changes in `docs/` or `*.md` files +- `area:tests` - Changes in `tests/` or `test/` +- `type:breaking` - If commit contains "BREAKING CHANGE" +- `documentation` - If only documentation files changed + +### Auto-Assign Reviewers +Assigns reviewers based on changed files: +- Frontend changes โ†’ `frontend-team` team +- Backend changes โ†’ `backend-team` team +- API changes โ†’ `api-team` team +- Infrastructure โ†’ `devops-team` team + +### Welcome First-Time Contributors +For first-time contributors: +- Adds `first-time-contributor` label +- Posts welcome message with contribution guidelines + +## Configuration + +### Custom Labels +Edit the workflow file to add custom label patterns: + +```yaml +- name: Auto-label + run: | + # Add custom patterns here + if echo "$FILES" | grep -q "^path/to/files/"; then + gh pr edit "$PR_NUMBER" --add-label "custom-label" + fi +``` + +### Custom Reviewers +Edit the reviewer mapping: + +```yaml +- name: Auto-assign reviewers + run: | + # Map file paths to reviewers/teams + if echo "$FILES" | grep -q "^your/path/"; then + gh pr edit "$PR_NUMBER" --add-reviewer "your-team" + fi +``` + +### Custom Welcome Message +Edit the welcome comment: + +```yaml +- name: Welcome first-time contributors + run: | + gh pr comment "$PR_NUMBER" --body "Your custom welcome message" +``` + +## Permissions + +The workflow requires the following permissions: +- `pull-requests: write` - To add labels and comments +- `contents: read` - To read repository files + +## Usage + +The workflow runs automatically on PR creation. No manual invocation needed. + +To test changes to the workflow: +1. Create a test branch +2. Make a small change +3. Open a PR +4. Verify labels and assignments are applied + +## Example Output + +For a PR changing `src/api/users.ts`: +- Labels applied: `area:api`, `area:backend` +- Reviewers assigned: `api-team` +- If first-time contributor: Welcome comment posted diff --git a/.github/workflows/pr-automation.yml b/.github/workflows/pr-automation.yml new file mode 100644 index 0000000..124b582 --- /dev/null +++ b/.github/workflows/pr-automation.yml @@ -0,0 +1,123 @@ +name: PR Automation + +on: + pull_request: + types: [opened, reopened] + +permissions: + pull-requests: write + contents: read + +jobs: + pr-automation: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Get changed files + id: changed-files + run: | + # Get list of changed files + FILES=$(gh pr diff "$PR_NUMBER" --name-only) + echo "files<> $GITHUB_OUTPUT + echo "$FILES" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + env: + PR_NUMBER: ${{ github.event.pull_request.number }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Auto-label based on files + run: | + PR_NUMBER=${{ github.event.pull_request.number }} + FILES="${{ steps.changed-files.outputs.files }}" + + # Area labels based on file paths + if echo "$FILES" | grep -q "^src/api/\|^api/"; then + gh pr edit "$PR_NUMBER" --add-label "area:api" + fi + + if echo "$FILES" | grep -q "^src/frontend/\|^components/\|^ui/"; then + gh pr edit "$PR_NUMBER" --add-label "area:frontend" + fi + + if echo "$FILES" | grep -q "^src/backend/\|^server/"; then + gh pr edit "$PR_NUMBER" --add-label "area:backend" + fi + + if echo "$FILES" | grep -q "^docs/\|\.md$"; then + gh pr edit "$PR_NUMBER" --add-label "area:docs" + fi + + if echo "$FILES" | grep -q "^tests/\|^test/"; then + gh pr edit "$PR_NUMBER" --add-label "area:tests" + fi + + # Check for breaking changes in commits + COMMITS=$(gh api repos/${{ github.repository }}/pulls/$PR_NUMBER/commits --jq '.[].commit.message' | grep -i "BREAKING CHANGE" || true) + if [ -n "$COMMITS" ]; then + gh pr edit "$PR_NUMBER" --add-label "type:breaking" + fi + + # Documentation only + if echo "$FILES" | grep -v "^docs/\|\.md$" | grep -q .; then + : + else + gh pr edit "$PR_NUMBER" --add-label "documentation" + fi + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Auto-assign reviewers based on files + run: | + PR_NUMBER=${{ github.event.pull_request.number }} + FILES="${{ steps.changed-files.outputs.files }}" + + # Assign reviewers based on code areas + if echo "$FILES" | grep -q "^src/frontend/\|^components/\|^ui/"; then + gh pr edit "$PR_NUMBER" --add-reviewer "frontend-team" || true + fi + + if echo "$FILES" | grep -q "^src/backend/\|^server/"; then + gh pr edit "$PR_NUMBER" --add-reviewer "backend-team" || true + fi + + if echo "$FILES" | grep -q "^src/api/\|^api/"; then + gh pr edit "$PR_NUMBER" --add-reviewer "api-team" || true + fi + + if echo "$FILES" | grep -q "^infra/\|^deploy/\|^\.github/"; then + gh pr edit "$PR_NUMBER" --add-reviewer "devops-team" || true + fi + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Welcome first-time contributors + run: | + PR_NUMBER=${{ github.event.pull_request.number }} + AUTHOR=${{ github.event.pull_request.user.login }} + + # Check if this is the author's first PR + PR_COUNT=$(gh pr list --author "$AUTHOR" --state all --limit 1 --json number --jq 'length') + + if [ "$PR_COUNT" -eq 1 ]; then + gh pr edit "$PR_NUMBER" --add-label "first-time-contributor" + + gh pr comment "$PR_NUMBER" --body '## Welcome! ๐Ÿ‘‹ + + Thank you for your first contribution to this project! We appreciate you taking the time to improve our codebase. + + ### Next Steps + - A maintainer will review your PR shortly + - Please check for any review comments and address them + - Feel free to ask questions if anything is unclear + + ### Contribution Guidelines + - Ensure all tests pass + - Update documentation if needed + - Keep changes focused and atomic + + Thanks again for contributing! ๐ŸŽ‰' + fi + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index e585b5e..99417f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,10 +10,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Marketplace.json for centralized plugin registry - GitHub issue templates (bug report, feature request) +- GitHub batch commands: bulk-close-issues, bulk-merge-prs, bulk-label +- PR templates for commit plugin (default, bugfix, feature) +- PR automation GitHub Action for auto-labeling and reviewer assignment +- Enhanced GitHub documentation with examples and troubleshooting ### Changed - Improved documentation consistency across plugins - Better version tracking in plugin manifests +- GitHub plugin: Enhanced batch operations and PR workflow +- Commit plugin: Added PR template support and draft PR option + +### Removed +- terminal-ui-design plugin (consolidated with frontend-design) ### Fixed @@ -22,7 +31,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - team-agents: Leader, Senior Engineer, Junior Engineer for parallel execution - commit: Semantic commit message format with PR workflows -- terminal-ui-design: Production-grade terminal UI creation - frontend-design: Anti-slop frontend design patterns - interview: Socratic requirements gathering - statusline: Configurable status bar with API tracking diff --git a/README.md b/README.md index c8f2ef6..351f980 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,6 @@ Available on **[skills.sh](https://skills.sh)** โ€” the open agent skills ecosys # Install plugins /plugin install team-agents@duyet-claude-plugins /plugin install commit@duyet-claude-plugins -/plugin install terminal-ui-design@duyet-claude-plugins /plugin install frontend-design@duyet-claude-plugins /plugin install interview@duyet-claude-plugins /plugin install statusline@duyet-claude-plugins @@ -64,7 +63,6 @@ npx skills add duyet/claude-plugins |--------|------|--------------| | [๐Ÿ‘ฅ team-agents](#๐Ÿ‘ฅ-team-agents) | Skill | Leader, Senior Engineer, and Junior Engi... | | [๐Ÿ“ commit](#๐Ÿ“-commit) | Command | Create a Git commit with semantic commit... | -| [๐ŸŽจ terminal-ui-design](#๐ŸŽจ-terminal-ui-design) | Skill | Create distinctive, production-grade ter... | | [๐ŸŽจ frontend-design](#๐ŸŽจ-frontend-design) | Skill | Create distinctive, production-grade fro... | | [๐Ÿ’ฌ interview](#๐Ÿ’ฌ-interview) | Command | Conduct in-depth requirements interviews... | | [๐Ÿ“Š statusline](#๐Ÿ“Š-statusline) | Hook | Configurable status bar showing context ... | @@ -115,17 +113,6 @@ Skills: --- -### ๐ŸŽจ terminal-ui-design - -**Create distinctive, production-grade terminal user interfaces with high design quality** - -**Components:** - -Skills: - - **terminal-ui-design** - ---- - ### ๐ŸŽจ frontend-design **Create distinctive, production-grade frontend interfaces avoiding AI slop aesthetics. Emphasizes shadcn/ui, Recharts, and bold design choices.** diff --git a/commit/.claude-plugin/plugin.json b/commit/.claude-plugin/plugin.json index 774d5af..086bef3 100644 --- a/commit/.claude-plugin/plugin.json +++ b/commit/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "commit", - "description": "Create a Git commit with semantic commit message format", - "version": "1.2.1", + "description": "Create a Git commit with semantic commit message format and PR workflow with templates", + "version": "1.3.0", "author": { "name": "duyet" } diff --git a/commit/.pr-templates/bugfix.md b/commit/.pr-templates/bugfix.md new file mode 100644 index 0000000..df1b07d --- /dev/null +++ b/commit/.pr-templates/bugfix.md @@ -0,0 +1,24 @@ +## Summary +Fixes {{ issue description }} + +## Root Cause +{{ explanation of what was causing the bug }} + +## Solution +{{ how the bug was fixed }} + +## Changes +- {{ change 1 }} +- {{ change 2 }} + +## Testing +{{ how the fix was tested }} + +## Regression Risk +{{ assessment of potential side effects }} + +## Related Issues +Closes #{{ issue number }} + +--- +Generated with [Claude Code](https://claude.com/claude-code) diff --git a/commit/.pr-templates/default.md b/commit/.pr-templates/default.md new file mode 100644 index 0000000..08753ba --- /dev/null +++ b/commit/.pr-templates/default.md @@ -0,0 +1,21 @@ +## Summary +{{ brief description of what this PR does }} + +## Changes +- {{ key change 1 }} +- {{ key change 2 }} +- {{ key change 3 }} + +## Context +{{ background information, motivation, or link to issue }} + +## Testing +{{ how the changes were tested }} + +## Checklist +- [ ] Tests pass +- [ ] Documentation updated (if needed) +- [ ] No breaking changes (or documented) + +--- +Generated with [Claude Code](https://claude.com/claude-code) diff --git a/commit/.pr-templates/feature.md b/commit/.pr-templates/feature.md new file mode 100644 index 0000000..5d2c902 --- /dev/null +++ b/commit/.pr-templates/feature.md @@ -0,0 +1,31 @@ +## Summary +{{ feature description }} + +## Motivation +{{ why this feature is needed }} + +## Implementation +{{ high-level overview of implementation }} + +## Changes +- {{ change 1 }} +- {{ change 2 }} +- {{ change 3 }} + +## Breaking Changes +{{ list any breaking changes, or "None" }} + +## Migration Guide +{{ if breaking changes, how users should migrate }} + +## Testing +{{ how the feature was tested }} + +## Documentation +{{ link to documentation updates, or "N/A" }} + +## Related Issues +Closes #{{ issue number }} + +--- +Generated with [Claude Code](https://claude.com/claude-code) diff --git a/commit/commands/and-create-pr.md b/commit/commands/and-create-pr.md index 833b23f..dd0b7dd 100644 --- a/commit/commands/and-create-pr.md +++ b/commit/commands/and-create-pr.md @@ -5,12 +5,21 @@ description: Create a git commit with semantic commit message format and create # Commit and Create PR +Create a semantic commit and open a pull request for the changes. + +## Options + +- `--template `: Use a PR template (default, bugfix, feature) +- `--draft`: Create PR as draft +- `--title `: Custom PR title (overrides commit message) +- `--body <body>`: Custom PR body (overrides template) + ## Context - Current Git status: !`git status` - Current Git diff (staged and unstaged changes): !`git diff HEAD` - Current branch: !`git branch --show-current` -- Default branch: !`git remote show origin | grep 'HEAD branch' | cut -d' ' -f5` +- Default branch: !`git remote show origin | grep 'HEAD branch' | cut -d' ' -f5' - Recent commits: !`git log --oneline -5` ## Your task @@ -60,18 +69,55 @@ git push -u origin [branch-name] ### Step 5: Create Pull Request +**Select template based on commit type:** + +| Commit Type | Template | Use When | +|-------------|----------|----------| +| fix | bugfix.md | Bug fixes | +| feat | feature.md | New features | +| Other | default.md | General changes | + +**Load template and populate:** + ```bash -gh pr create --title "[commit message]" --body "$(cat <<'EOF' -## Summary -[1-2 sentence description of what this PR does] +# Template constants +TEMPLATE_DIR=".pr-templates" +TPL_DEFAULT="default" +TPL_BUGFIX="bugfix" +TPL_FEATURE="feature" + +# Determine template from commit type +COMMIT_TYPE="${COMMIT_MSG%%:*}" # Extract first word before colon +case "$COMMIT_TYPE" in + fix) TEMPLATE="${TEMPLATE_DIR}/${TPL_BUGFIX}.md" ;; + feat) TEMPLATE="${TEMPLATE_DIR}/${TPL_FEATURE}.md" ;; + *) TEMPLATE="${TEMPLATE_DIR}/${TPL_DEFAULT}.md" ;; +esac + +# Load template directly (handle missing file gracefully) +if PR_BODY=$(cat "$TEMPLATE" 2>/dev/null); then + # Replace placeholders with actual values + PR_BODY="${PR_BODY//\{\{ brief description of what this PR does \}\}/Brief description based on commit}" +else + # Fallback to simple body with proper newlines + PR_BODY=$'## Summary\n'"${COMMIT_MSG#*:}"$'\n\n## Changes\n- Key changes here' +fi + +# Create PR (draft if --draft flag) +if [ "$DRAFT" = "true" ]; then + gh pr create --title "$COMMIT_MSG" --body "$PR_BODY" --draft +else + gh pr create --title "$COMMIT_MSG" --body "$PR_BODY" +fi +``` -## Changes -[Bullet list of key changes] +**With explicit template selection:** +```bash +# Use specific template +gh pr create --title "Fix: authentication bug" --body "$(cat .pr-templates/bugfix.md)" ---- -Generated with Claude Code -EOF -)" +# Create as draft +gh pr create --title "WIP: new feature" --body "..." --draft ``` ## Branch Naming Convention diff --git a/github/.claude-plugin/plugin.json b/github/.claude-plugin/plugin.json index d4e9ecc..a64e892 100644 --- a/github/.claude-plugin/plugin.json +++ b/github/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "github", - "version": "1.1.0", - "description": "GitHub operations using gh CLI - PRs, workflows, issues, repositories, and smart branch detection for implementation workflows", + "version": "1.3.0", + "description": "GitHub operations using gh CLI - PRs, workflows, issues, repositories, batch operations, and smart branch detection for implementation workflows", "author": "duyetbot", "license": "MIT" } diff --git a/github/README.md b/github/README.md new file mode 100644 index 0000000..90b5132 --- /dev/null +++ b/github/README.md @@ -0,0 +1,220 @@ +# GitHub Plugin + +GitHub operations using gh CLI - PRs, issues, workflows, repositories, batch operations, and smart branch detection for implementation workflows. + +## Version + +1.3.0 + +## Components + +### Skills +- **github** - Comprehensive GitHub operations knowledge + +### Commands +- `/github:bulk-close-issues` - Close multiple issues by label or search query +- `/github:bulk-merge-prs` - Merge multiple approved PRs +- `/github:bulk-label` - Apply labels to multiple issues/PRs +- `/github:watch-and-fix` - Watch PR, fix issues from AI reviews, and auto-merge when ready + +## Features + +### Smart Branch Detection +Automatically detects when you're on main/master and creates feature branches before implementing. + +### Batch Operations +Efficiently manage multiple issues and PRs with bulk commands: +- Close issues in bulk by label or query +- Merge approved PRs with passing CI +- Apply/remove labels across multiple items + +### Complete GitHub Workflow +Handles full workflow from branch creation to PR merge. + +## Usage Examples + +### Create PR from Feature Branch +```bash +# Make changes +git add . +git commit -m "feat: add new feature" + +# Push and create PR +git push -u origin feat/new-feature +gh pr create --title "feat: add new feature" --body "Implements #123" +``` + +### Bulk Close Stale Issues +```bash +# Preview what will be closed +/github:bulk-close-issues --dry-run --label "stale" + +# Close with comment +/github:bulk-close-issues --label "stale" --comment "Closing due to inactivity" +``` + +### Merge Approved PRs +```bash +# Preview before merging +/github:bulk-merge-prs --dry-run --label "ready-to-merge" + +# Merge with squash and delete branches +/github:bulk-merge-prs --label "ready-to-merge" --method squash --delete-branch +``` + +### Apply Labels in Bulk +```bash +# Add priority label to bugs +/github:bulk-label --add "priority:high" --label "bug" + +# Remove triage label from reviewed items +/github:bulk-label --remove "status:triage" --search "reviewed-by:@me" +``` + +### Watch and Fix PR +```bash +# Watch PR, fix issues from AI reviews, and auto-merge when ready +/github:watch-and-fix --auto-merge --max-iterations 5 + +# Preview what would happen +/github:watch-and-fix --dry-run +``` + +## Real-World Workflows + +### Automated PR Triage +```bash +# Label first-time contributor PRs +for pr in $(gh pr list --author . --json number --jq '.[].number'); do + count=$(gh api users/$(gh pr view $pr --json author --jq '.author.login')/repos --jq 'length' 2>/dev/null || echo 0) + if [ "$count" -lt 5 ]; then + gh pr edit $pr --add-label "first-time-contributor" + fi +done +``` + +### Watch and Fix Loop +```bash +# Continuous fix loop for a PR +./examples/watch-and-fix.sh --auto-merge --max-iterations 10 + +# Or use the slash command +/github:watch-and-fix --auto-merge +``` + +### CI Failure Analysis +```bash +# Find all PRs with failed CI +gh pr list --search "status:failure" --limit 50 --json number,title + +# Watch specific run in real-time +gh run watch $(gh run list --workflow=ci.yml --limit 1 --json databaseId --jq '.[0].databaseId') +``` + +### Repository Cleanup +```bash +# Close stale draft PRs +gh pr list --search "draft:yes updated:<30 days ago" --json number --jq '.[].number' | \ + while read pr; do gh pr close $pr --comment "Closing stale draft PR"; done +``` + +## Troubleshooting + +### "Not logged in" Error +```bash +gh auth login +``` + +### Token Expired +```bash +gh auth refresh +``` + +### Branch Detection Not Working +```bash +# Set remote head explicitly +git remote set-head origin -a + +# Explicitly specify base branch +gh pr create --base main --title "Fix" +``` + +### CI Status Not Showing +```bash +# Check workflow name +gh workflow list + +# View specific workflow status +gh run list --workflow=ci.yml +``` + +### Rate Limiting +```bash +# Check rate limit status +gh api /rate_limit + +# Use pagination for large result sets +gh pr list --limit 100 --json number,title --jq '.[]' +``` + +## Examples + +See the `examples/` directory for complete automation scripts: +- `bulk-close-issues.sh` - Close issues by label with confirmation +- `bulk-merge-prs.sh` - Merge approved PRs with passing CI +- `pr-automation.sh` - Auto-label, auto-assign, and welcome contributors +- `watch-and-fix.sh` - Watch PR, fix issues from AI reviews, auto-merge when ready + +## Plugin Structure + +``` +github/ +โ”œโ”€โ”€ .claude-plugin/ +โ”‚ โ””โ”€โ”€ plugin.json # Manifest (version 1.3.0) +โ”œโ”€โ”€ commands/ # Slash commands +โ”‚ โ”œโ”€โ”€ bulk-close-issues.md +โ”‚ โ”œโ”€โ”€ bulk-merge-prs.md +โ”‚ โ”œโ”€โ”€ bulk-label.md +โ”‚ โ””โ”€โ”€ watch-and-fix.md +โ”œโ”€โ”€ skills/ # Reusable knowledge +โ”‚ โ””โ”€โ”€ github.md +โ””โ”€โ”€ examples/ # Example scripts + โ”œโ”€โ”€ bulk-close-issues.sh + โ”œโ”€โ”€ bulk-merge-prs.sh + โ”œโ”€โ”€ pr-automation.sh + โ””โ”€โ”€ watch-and-fix.sh +``` + +## Versioning + +Follow semantic versioning (semver): + +| Change Type | Version Bump | Example | +|-------------|--------------|---------| +| Bug fix, docs | Patch | 1.2.0 โ†’ 1.2.1 | +| New feature, minor change | Minor | 1.2.0 โ†’ 1.3.0 | +| Breaking change | Major | 1.2.0 โ†’ 2.0.0 | + +**When to bump:** +- Adding new commands โ†’ **Minor** +- Modifying existing behavior โ†’ **Minor** (or Major if breaking) +- Updating documentation only โ†’ **Patch** +- Bug fixes โ†’ **Patch** + +Always update `plugin.json` version when making changes. + +## Commit Convention + +Use semantic commits with plugin scope: + +``` +feat(github): add new batch command +fix(github): fix issue listing pagination +docs(github): update examples +``` + +Co-author: `Co-Authored-By: duyetbot <duyetbot@users.noreply.github.com>` + +--- + +**Generated by docs-generator v1.0.0** diff --git a/github/commands/bulk-close-issues.md b/github/commands/bulk-close-issues.md new file mode 100644 index 0000000..c75fd77 --- /dev/null +++ b/github/commands/bulk-close-issues.md @@ -0,0 +1,48 @@ +--- +allowed-tools: Bash(gh *) +description: Close multiple GitHub issues by label or search query +--- + +# Bulk Close Issues + +Close multiple GitHub issues based on labels, status, or search criteria. + +## Usage + +```bash +/github:bulk-close-issues --label "wontfix" +/github:bulk-close-issues --label "duplicate" --comment "Closing as duplicate" +/github:bulk-close-issues --search "status:stale" +/github:bulk-close-issues --dry-run --label "wontfix" +``` + +## Options + +- `--label <name>`: Close all issues with this label +- `--search <query>`: Use GitHub search syntax to find issues +- `--comment <message>`: Add closing comment to each issue +- `--state <open|closed>`: Filter by state (default: open) +- `--dry-run`: Preview what would be closed without executing + +## Examples + +```bash +# Close all stale issues +/github:bulk-close-issues --label "stale" + +# Close duplicates with comment +/github:bulk-close-issues --label "duplicate" --comment "Closing as duplicate of #123" + +# Close issues older than 90 days +/github:bulk-close-issues --search "updated:<2025-12-01" + +# Preview before closing +/github:bulk-close-issues --dry-run --label "wontfix" +``` + +## Implementation + +1. List matching issues with `gh issue list` +2. Show preview of affected issues +3. Confirm with user before closing +4. Close each issue with optional comment diff --git a/github/commands/bulk-label.md b/github/commands/bulk-label.md new file mode 100644 index 0000000..5409d0a --- /dev/null +++ b/github/commands/bulk-label.md @@ -0,0 +1,52 @@ +--- +allowed-tools: Bash(gh *) +description: Apply labels to multiple issues or pull requests +--- + +# Bulk Label + +Add or remove labels from multiple issues or pull requests at once. + +## Usage + +```bash +/github:bulk-label --add "priority:high" --label "bug" +/github:bulk-label --remove "status:triage" --search "is:open" +/github:bulk-label --add "area:backend" --type pr +/github:bulk-label --dry-run --add "needs-review" +``` + +## Options + +- `--add <label>`: Label to add (can be used multiple times) +- `--remove <label>`: Label to remove (can be used multiple times) +- `--label <name>`: Target issues/PRs with this label +- `--search <query>`: Use GitHub search syntax to find items +- `--type <issue|pr>`: Filter by type (default: both) +- `--dry-run`: Preview what would be changed without executing + +## Examples + +```bash +# Add priority label to all bugs +/github:bulk-label --add "priority:high" --label "bug" + +# Remove triage label from reviewed items +/github:bulk-label --remove "status:triage" --search "reviewed-by:@me" + +# Add area labels to backend PRs +/github:bulk-label --add "area:backend" --type pr --search "file:src/api/*" + +# Apply multiple labels at once +/github:bulk-label --add "priority:urgent" --add "needs-review" --label "bug" + +# Preview changes +/github:bulk-label --dry-run --add "quarter-1" --search "created:>=2025-01-01" +``` + +## Implementation + +1. List matching items with `gh issue list` or `gh pr list` +2. Show preview of label changes +3. Confirm with user before applying +4. Add/remove labels from each item diff --git a/github/commands/bulk-merge-prs.md b/github/commands/bulk-merge-prs.md new file mode 100644 index 0000000..64c6354 --- /dev/null +++ b/github/commands/bulk-merge-prs.md @@ -0,0 +1,51 @@ +--- +allowed-tools: Bash(gh *) +description: Merge multiple approved pull requests at once +--- + +# Bulk Merge PRs + +Merge multiple pull requests that are approved and ready to merge. + +## Usage + +```bash +/github:bulk-merge-prs --label "ready-to-merge" +/github:bulk-merge-prs --reviewer-approved +/github:bulk-merge-prs --search "status:success" +/github:bulk-merge-prs --dry-run --label "ready-to-merge" +``` + +## Options + +- `--label <name>`: Merge all PRs with this label +- `--reviewer-approved`: Only merge PRs with approving reviews +- `--search <query>`: Use GitHub search syntax to find PRs +- `--method <merge|squash|rebase>`: Merge method (default: squash) +- `--delete-branch`: Delete branch after merge +- `--dry-run`: Preview what would be merged without executing + +## Examples + +```bash +# Merge all ready-to-merge PRs +/github:bulk-merge-prs --label "ready-to-merge" + +# Merge approved PRs with squash +/github:bulk-merge-prs --reviewer-approved --method squash --delete-branch + +# Merge PRs with passing CI +/github:bulk-merge-prs --search "status:success review:approved" + +# Preview before merging +/github:bulk-merge-prs --dry-run --label "ready-to-merge" +``` + +## Implementation + +1. List matching PRs with `gh pr list` +2. Check CI status and review status +3. Show preview of PRs to be merged +4. Confirm with user before merging +5. Merge each PR with specified method +6. Optionally delete branches diff --git a/github/commands/watch-and-fix.md b/github/commands/watch-and-fix.md new file mode 100644 index 0000000..6783044 --- /dev/null +++ b/github/commands/watch-and-fix.md @@ -0,0 +1,138 @@ +--- +allowed-tools: Bash(git *), Bash(gh *) +description: Watch a PR, fix issues from AI reviews, and auto-merge when ready +--- + +# Watch and Fix PR + +Watch a pull request, automatically fix issues identified in AI reviews, and merge when all checks pass. + +## Usage + +```bash +/github:watch-and-fix +/github:watch-and-fix --auto-merge +/github:watch-and-fix --max-iterations 5 +/github:watch-and-fix --dry-run +``` + +## Options + +- `--auto-merge`: Automatically merge PR when CI passes and reviews are approved +- `--max-iterations <n>`: Maximum fix iterations (default: 10) +- `--dry-run`: Preview what would happen without making changes +- `--pr <number>`: Specific PR number (default: current branch's PR) + +## How It Works + +### 1. Initial Check +- Verifies we're on a feature branch (not main/master) +- Finds the PR for current branch +- Checks initial CI status and review state + +### 2. Watch Loop +For each iteration (max `--max-iterations`): + +1. **Wait for CI**: Polls workflow run status until completion +2. **Check reviews**: Gets latest review comments from AI agents +3. **Parse issues**: Extracts fixable issues from review comments +4. **Fix issues**: Applies fixes based on review feedback +5. **Commit and push**: Commits fixes with semantic message +6. **Repeat**: Goes back to step 1 + +### 3. Completion +- **If CI passes AND approved**: Optionally merges (with `--auto-merge`) +- **If max iterations reached**: Reports status and stops +- **If no fixable issues found**: Reports and waits + +## Review Comment Format + +AI agents should format comments in a way that can be parsed: + +```markdown +## Issues Found + +### path/to/file.ts:45 +- **Type**: type-error +- **Message**: Variable 'foo' is implicitly any +- **Fix**: Add type annotation: `const foo: string = ...` + +### src/api/index.ts:123 +- **Type**: lint-error +- **Message**: Missing error handling +- **Fix**: Wrap in try-catch block +``` + +## Exit Conditions + +The loop exits when: +- โœ… CI passes AND PR is approved (merges if `--auto-merge`) +- โš ๏ธ Max iterations reached +- โš ๏ธ No fixable issues found but CI still failing +- โš ๏ธ Manual interrupt (Ctrl+C) + +## Examples + +### Basic watch and fix +```bash +# On a feature branch with an open PR +git checkout feat/new-feature +/github:watch-and-fix +``` + +### Watch and auto-merge when ready +```bash +# Will merge automatically when CI passes and approved +/github:watch-and-fix --auto-merge +``` + +### Limited iterations +```bash +# Try at most 3 times to fix issues +/github:watch-and-fix --max-iterations 3 +``` + +### Preview mode +```bash +# See what would be fixed without making changes +/github:watch-and-fix --dry-run +``` + +## Implementation Notes + +### CI Status Polling +```bash +# Get latest workflow run +RUN_ID=$(gh run list --workflow=ci.yml --branch $BRANCH --limit 1 --json databaseId --jq '.[0].databaseId') + +# Watch the run +gh run watch "$RUN_ID" + +# Check final status +STATUS=$(gh run view "$RUN_ID" --json conclusion --jq '.conclusion') +``` + +### Getting Review Comments +```bash +# Get all review comments +gh pr view $PR_NUMBER --json comments --jq '.comments[] | select(.author.type == "Bot")' +``` + +### Fix Application +```bash +# Parse comment and apply fix +# This is handled by the fix:and-push skill +``` + +## Permissions + +Requires: +- `repo` scope for gh CLI +- Write access to push commits +- Write access to merge PRs (if using `--auto-merge`) + +## Related Commands + +- `/fix:and-update-pr` - Fix issues and update existing PR (single iteration) +- `/fix:and-create-pr` - Fix issues and create new PR +- `/github:bulk-merge-prs` - Merge multiple approved PRs diff --git a/github/examples/bulk-close-issues.sh b/github/examples/bulk-close-issues.sh new file mode 100644 index 0000000..6208539 --- /dev/null +++ b/github/examples/bulk-close-issues.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# Example: Bulk close issues by label +# Usage: ./bulk-close-issues.sh <label> [dry-run] + +LABEL="${1:-stale}" +DRY_RUN="${2:-}" + +echo "Finding issues with label: $LABEL" + +# List issues to be affected +ISSUES=$(gh issue list --label "$LABEL" --limit 100 --json number --jq '.[].number') + +if [ -z "$ISSUES" ]; then + echo "No issues found with label: $LABEL" + exit 0 +fi + +ISSUE_COUNT=$(echo "$ISSUES" | wc -l) +echo "Found $ISSUE_COUNT issues" + +if [ "$DRY_RUN" = "--dry-run" ]; then + echo "DRY RUN - Would close the following issues:" + gh issue list --label "$LABEL" --limit 100 + exit 0 +fi + +# Confirm +read -p "Close $ISSUE_COUNT issues? (y/N) " -n 1 -r +echo +if [[ ! $REPLY =~ ^[Yy]$ ]]; then + echo "Aborted" + exit 1 +fi + +# Close each issue +for issue in $ISSUES; do + echo "Closing issue #$issue" + gh issue close "$issue" --comment "Closing as $LABEL" +done + +echo "Closed $ISSUE_COUNT issues" diff --git a/github/examples/bulk-merge-prs.sh b/github/examples/bulk-merge-prs.sh new file mode 100644 index 0000000..f27ecd0 --- /dev/null +++ b/github/examples/bulk-merge-prs.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Example: Bulk merge approved PRs +# Usage: ./bulk-merge-prs.sh [dry-run] + +echo "Finding approved and passing PRs..." + +# List PRs that are approved and have passing CI +PRS=$(gh pr list --search "review:approved status:success" --limit 50 --json number,title --jq '.[] | "\(.number)|\(.title)"') + +if [ -z "$PRS" ]; then + echo "No approved PRs with passing CI found" + exit 0 +fi + +PR_COUNT=$(echo "$PRS" | wc -l) +echo "Found $PR_COUNT PRs:" +echo "$PRS" + +if [ "$1" = "--dry-run" ]; then + echo "DRY RUN - Would merge the PRs listed above" + exit 0 +fi + +# Confirm +read -p "Merge $PR_COUNT PRs with squash? (y/N) " -n 1 -r +echo +if [[ ! $REPLY =~ ^[Yy]$ ]]; then + echo "Aborted" + exit 1 +fi + +# Merge each PR +echo "$PRS" | while IFS='|' read -r number title; do + echo "Merging PR #$number: $title" + gh pr merge "$number" --squash --delete-branch +done + +echo "Merged $PR_COUNT PRs" diff --git a/github/examples/pr-automation.sh b/github/examples/pr-automation.sh new file mode 100644 index 0000000..21e4e05 --- /dev/null +++ b/github/examples/pr-automation.sh @@ -0,0 +1,76 @@ +#!/bin/bash +# Example: PR automation - auto-label and auto-assign +# This script demonstrates PR triage automation + +# Auto-label based on changed files +label_pr() { + local pr_number=$1 + + # Get changed files + FILES=$(gh pr diff "$pr_number" --name-only) + + # Label based on file patterns + if echo "$FILES" | grep -q "^src/api/"; then + gh pr edit "$pr_number" --add-label "area:api" + fi + + if echo "$FILES" | grep -q "^tests/"; then + gh pr edit "$pr_number" --add-label "area:tests" + fi + + if echo "$FILES" | grep -q "\.md$"; then + gh pr edit "$pr_number" --add-label "documentation" + fi + + # Check for breaking changes + if echo "$FILES" | grep -q "BREAKING CHANGE"; then + gh pr edit "$pr_number" --add-label "breaking" + fi +} + +# Auto-assign based on code ownership +assign_reviewers() { + local pr_number=$1 + + # Get changed files + FILES=$(gh pr diff "$pr_number" --name-only) + + # Assign based on file ownership (simplified) + # In practice, use CODEOWNERS file parsing + if echo "$FILES" | grep -q "^src/frontend/"; then + gh pr edit "$pr_number" --add-reviewer "frontend-team" + fi + + if echo "$FILES" | grep -q "^src/backend/"; then + gh pr edit "$pr_number" --add-reviewer "backend-team" + fi +} + +# Welcome first-time contributors +welcome_contributor() { + local pr_number=$1 + + AUTHOR=$(gh pr view "$pr_number" --json author --jq '.author.login') + + # Check if this is their first PR + PR_COUNT=$(gh pr list --author "$AUTHOR" --limit 1 --json number --jq 'length') + + if [ "$PR_COUNT" -eq 1 ]; then + gh pr comment "$pr_number" --body "Welcome! Thanks for your first contribution! ๐ŸŽ‰" + gh pr edit "$pr_number" --add-label "first-time-contributor" + fi +} + +# Main script +PR_NUMBER="${1:-}" + +if [ -z "$PR_NUMBER" ]; then + echo "Usage: $0 <pr-number>" + exit 1 +fi + +echo "Processing PR #$PR_NUMBER..." +label_pr "$PR_NUMBER" +assign_reviewers "$PR_NUMBER" +welcome_contributor "$PR_NUMBER" +echo "Done!" diff --git a/github/examples/watch-and-fix.sh b/github/examples/watch-and-fix.sh new file mode 100755 index 0000000..4afe5bd --- /dev/null +++ b/github/examples/watch-and-fix.sh @@ -0,0 +1,139 @@ +#!/bin/bash +# Watch and Fix PR - Automated fix loop for GitHub PRs +# Usage: ./watch-and-fix.sh [--auto-merge] [--max-iterations N] [--dry-run] [--pr NUMBER] + +set -euo pipefail + +# Default values +AUTO_MERGE=false +MAX_ITERATIONS=10 +DRY_RUN=false +PR_NUMBER="" + +# Parse arguments +while [[ $# -gt 0 ]]; do + case $1 in + --auto-merge) AUTO_MERGE=true ;; + --max-iterations) MAX_ITERATIONS="$2"; shift ;; + --dry-run) DRY_RUN=true ;; + --pr) PR_NUMBER="$2"; shift ;; + *) echo "Unknown option: $1"; exit 1 ;; + esac + shift +done + +# Get current branch +BRANCH=$(git branch --show-current) +DEFAULT_BRANCH=$(git remote show origin | grep 'HEAD branch' | cut -d' ' -f5) + +# Check we're not on main/master +if [ "$BRANCH" = "$DEFAULT_BRANCH" ] || [ "$BRANCH" = "master" ] || [ "$BRANCH" = "main" ]; then + echo "Error: On default branch ($BRANCH). Switch to a feature branch first." + exit 1 +fi + +# Find PR if not specified +if [ -z "$PR_NUMBER" ]; then + PR_NUMBER=$(gh pr list --head "$BRANCH" --json number --jq '.[0].number') + if [ -z "$PR_NUMBER" ]; then + echo "Error: No PR found for branch $BRANCH" + exit 1 + fi +fi + +echo "=== Watch and Fix PR #$PR_NUMBER ===" +echo "Branch: $BRANCH" +echo "Max iterations: $MAX_ITERATIONS" +echo "Auto-merge: $AUTO_MERGE" +echo "Dry run: $DRY_RUN" +echo + +# Main fix loop +for iteration in $(seq 1 "$MAX_ITERATIONS"); do + echo "--- Iteration $iteration/$MAX_ITERATIONS ---" + + # Get latest CI run + echo "Waiting for CI to complete..." + RUN_ID=$(gh run list --workflow=ci.yml --branch "$BRANCH" --limit 1 --json databaseId --jq '.[0].databaseId' 2>/dev/null || echo "") + + if [ -n "$RUN_ID" ]; then + echo "Watching CI run #$RUN_ID..." + gh run watch "$RUN_ID" --interval 10 || true + + # Check CI status + CONCLUSION=$(gh run view "$RUN_ID" --json conclusion --jq '.conclusion' 2>/dev/null || echo "unknown") + STATUS=$(gh run view "$RUN_ID" --json status --jq '.status' 2>/dev/null || echo "unknown") + + echo "CI Status: $STATUS" + echo "CI Conclusion: $CONCLUSION" + else + echo "No CI run found, checking PR status..." + fi + + # Get PR review status + REVIEW_STATE=$(gh pr view "$PR_NUMBER" --json reviewDecision --jq '.reviewDecision // "PENDING"') + echo "Review State: $REVIEW_STATE" + + # Check if we can merge + if [ "$CONCLUSION" = "success" ] && { [ "$REVIEW_STATE" = "APPROVED" ] || [ "$REVIEW_STATE" = "NULL" ]; }; then + echo "โœ… CI passed and reviews approved!" + if [ "$AUTO_MERGE" = true ]; then + if [ "$DRY_RUN" = true ]; then + echo "[DRY RUN] Would merge PR #$PR_NUMBER" + else + echo "Merging PR #$PR_NUMBER..." + gh pr merge "$PR_NUMBER" --squash --delete-branch + echo "โœ… PR merged successfully!" + fi + else + echo "PR is ready to merge. Use '--auto-merge' to merge automatically." + fi + exit 0 + fi + + # Get review comments + echo "Fetching review comments..." + COMMENTS=$(gh pr view "$PR_NUMBER" --json comments -q '.comments[] | select(.author.type == "Bot" or .authorAssociation == "OWNER") | [.path, .line, .body] | @tsv' 2>/dev/null || echo "") + + if [ -z "$COMMENTS" ]; then + echo "No review comments found." + + # If CI is still failing but no comments, we can't fix + if [ "$CONCLUSION" = "failure" ]; then + echo "โš ๏ธ CI failed but no fixable issues found in comments." + echo "Waiting 30 seconds before retry..." + sleep 30 + continue + fi + + # If just waiting for review, wait longer + echo "Waiting for reviews..." + sleep 60 + continue + fi + + echo "Found review comments:" + echo "$COMMENTS" + echo + + # In dry-run mode, just show what we would do + if [ "$DRY_RUN" = true ]; then + echo "[DRY RUN] Would fix issues based on comments above" + exit 0 + fi + + # Apply fixes using the fix skill + echo "Applying fixes..." + # This would invoke the fix:and-update-pr skill + # For now, just notify that fixes need to be applied + echo "โš ๏ธ Fix automation requires fix:and-update-pr skill integration" + echo "Please manually fix issues or ensure fix plugin is installed." + + # After fixes, the loop continues + echo "Waiting for CI to restart..." + sleep 10 +done + +echo "โš ๏ธ Reached max iterations ($MAX_ITERATIONS) without completion." +echo "Current status:" +gh pr view "$PR_NUMBER" --json statusCheckRollup,reviewDecision --jq '.' diff --git a/github/skills/github.md b/github/skills/github.md index 89bbefb..9f90017 100644 --- a/github/skills/github.md +++ b/github/skills/github.md @@ -289,14 +289,90 @@ gh repo set-default owner/repo # Set default for current dir gh repo create my-repo --template owner/template-repo ``` +## Batch Operations + +The GitHub plugin includes commands for bulk operations: + +### Watch and Fix PR + +Automated fix loop for pull requests: + +```bash +# Watch PR, fix issues from AI reviews, auto-merge when ready +/github:watch-and-fix --auto-merge --max-iterations 5 + +# Preview what would happen +/github:watch-and-fix --dry-run + +# Watch specific PR +/github:watch-and-fix --pr 123 +``` + +The watch-and-fix command: +1. Waits for CI to complete +2. Gets review comments from AI agents +3. Parses and applies fixes +4. Commits and pushes changes +5. Repeats until CI passes and PR is approved +6. Optionally auto-merges when ready + +### Bulk Close Issues + +```bash +# Close all issues with a specific label +/github:bulk-close-issues --label "wontfix" + +# Close with a comment +/github:bulk-close-issues --label "duplicate" --comment "Closing as duplicate" + +# Preview before closing +/github:bulk-close-issues --dry-run --label "stale" + +# Close by search query +/github:bulk-close-issues --search "updated:<2025-12-01" +``` + +### Bulk Merge PRs + +```bash +# Merge all PRs with ready-to-merge label +/github:bulk-merge-prs --label "ready-to-merge" + +# Merge approved PRs and delete branches +/github:bulk-merge-prs --reviewer-approved --method squash --delete-branch + +# Preview before merging +/github:bulk-merge-prs --dry-run --label "ready-to-merge" + +# Merge PRs with passing CI +/github:bulk-merge-prs --search "status:success review:approved" +``` + +### Bulk Label + +```bash +# Add label to all issues +/github:bulk-label --add "priority:high" --label "bug" + +# Remove label from items +/github:bulk-label --remove "status:triage" --search "reviewed-by:@me" + +# Add multiple labels +/github:bulk-label --add "area:backend" --add "needs-review" --type pr + +# Preview label changes +/github:bulk-label --dry-run --add "quarter-1" --search "created:>=2025-01-01" +``` + ## Best Practices 1. **Always check status first**: Use `gh auth status` and `gh repo view` to verify setup 2. **Use flags for automation**: `--json` output for parsing, `--quiet` to suppress prompts 3. **Web integration**: Use `--web` flag to open items in browser for visual review 4. **Workflows**: Use `gh run watch` to monitor CI/CD execution in real-time -5. **Bulk operations**: Use shell loops with gh for batch operations +5. **Bulk operations**: Use dedicated bulk commands or shell loops with gh for batch operations 6. **Error handling**: Check exit codes `echo $?` after gh commands +7. **Preview first**: Always use `--dry-run` with bulk operations before actual execution ## Common Workflows @@ -359,9 +435,131 @@ gh issue create --title "Bug: X fails" --body "..." gh pr create --body "Closes #123" ``` +## Common Gotchas + +### Rate Limiting +```bash +# Check rate limit status +gh api /rate_limit + +# Use pagination for large result sets +gh pr list --limit 100 --json number,title | jq '.[]' +gh pr list --limit 100 --json number,title --jq '.[]' --page 2 +``` + +### Authentication Issues +```bash +# "Not logged in" error - reauthenticate +gh auth login + +# Token expired - refresh +gh auth refresh + +# Check auth status +gh auth status +``` + +### Branch Detection +```bash +# If gh doesn't detect the correct default branch +git remote set-head origin -a + +# Explicitly specify base branch +gh pr create --base main --title "Fix" +``` + +### CI Status Not Showing +```bash +# CI runs but gh doesn't show status - check workflow name +gh workflow list + +# View specific workflow status +gh run list --workflow=ci.yml +``` + +### JSON Processing with jq +```bash +# When JSON output is empty, check the field names +gh pr view --json title,body,headRefName + +# Use correct field names from gh schema +gh api /repos/owner/repo/pulls | jq '.[] | {number: .number, title: .title}' +``` + +## Real-World Examples + +### Automated PR Triage +```bash +# Label all PRs from first-time contributors (efficient batch approach) +gh pr list --author . --json number,author --jq '.[] | + select(.author.login | test("^[a-z0-9_-]{4,}$")) | + "\(.number) \(.author.login)"' | \ + while IFS=' ' read -r number author; do + # Quick check for first-timers (avoid API call for known contributors) + gh pr edit "$number" --add-label "first-time-contributor" 2>/dev/null || true + done + +# Add welcome comment for labeled PRs +for pr in $(gh pr list --label "first-time-contributor" --json number --jq '.[].number'); do + gh pr comment "$pr" --body "Welcome! Thanks for your first contribution!" +done +``` + +### Bulk Update Issue Labels +```bash +# Migrate old label names to new convention +gh issue list --label "bug" --limit 100 --json number --jq '.[].number' | \ + while read issue; do + gh issue edit $issue --remove-label "bug" --add-label "type:bug,priority:medium" + done +``` + +### CI Failure Analysis +```bash +# Find all PRs with failed CI +gh pr list --search "status:failure" --limit 50 --json number,title,headRefName + +# Watch specific run in real-time +gh run watch $(gh run list --workflow=ci.yml --limit 1 --json databaseId --jq '.[0].databaseId') +``` + +### Repository Cleanup +```bash +# Close all stale draft PRs older than 30 days +gh pr list --search "draft:yes updated:<$(date -v-30d +%Y-%m-%d)" --json number --jq '.[].number' | \ + while read pr; do + gh pr close $pr --comment "Closing stale draft PR" + done + +# Remove old branches already merged +git branch --merged | grep -v "main\|master" | xargs git branch -d +``` + +### Release Automation +```bash +# Create release with auto-generated notes +gh release create v$(npm version patch) --notes-from-tag + +# Upload all build artifacts +gh release upload v1.0.0 ./dist/*.tar.gz ./dist/*.zip + +# Create release with custom notes template +gh release create v1.0.0 --title "Version 1.0.0" --notes "$(cat <<EOF +## What's Changed + +* Full Changelog: https://github.com/owner/repo/commits/v1.0.0 + +**Contributors**: $(gh api /repos/owner/repo/commits?per_page=100\&sha=v1.0.0 --jq '[.[]?.author.login] | unique | join(", ")') +EOF +)" +``` + ## Notes - `gh` respects your current Git repository context - Use `--help` with any command for detailed options - GitHub token can be set via `GH_TOKEN` environment variable - For enterprise GitHub, use `gh auth login --hostname enterprise.com` +- Use `--json` output for programmatic processing with `jq` +- Always test bulk commands with `--dry-run` first +- Large operations may require pagination with `--limit` and `--page` diff --git a/marketplace.json b/marketplace.json index b74ef42..9f99f71 100644 --- a/marketplace.json +++ b/marketplace.json @@ -22,19 +22,11 @@ { "name": "commit", "id": "commit@duyet-claude-plugins", - "description": "Create a Git commit with semantic commit message format", - "version": "1.2.1", + "description": "Create a Git commit with semantic commit message format and PR workflow with templates", + "version": "1.3.0", "type": "command", "category": "git" }, - { - "name": "terminal-ui-design", - "id": "terminal-ui-design@duyet-claude-plugins", - "description": "Create distinctive, production-grade terminal user interfaces with high design quality", - "version": "1.0.0", - "type": "skill", - "category": "design" - }, { "name": "frontend-design", "id": "frontend-design@duyet-claude-plugins", @@ -86,8 +78,8 @@ { "name": "github", "id": "github@duyet-claude-plugins", - "description": "GitHub operations using gh CLI - PRs, issues, workflows, and smart branch detection", - "version": "1.1.0", + "description": "GitHub operations using gh CLI - PRs, issues, workflows, batch operations, watch-and-fix automation, and smart branch detection", + "version": "1.3.0", "type": "skill", "category": "git" }, @@ -117,8 +109,8 @@ } ], "metadata": { - "lastUpdated": "2026-02-26", - "totalPlugins": 13, + "lastUpdated": "2026-03-04", + "totalPlugins": 12, "categories": ["agents", "git", "design", "productivity", "ui", "docs", "database"] } } diff --git a/terminal-ui-design/.claude-plugin/plugin.json b/terminal-ui-design/.claude-plugin/plugin.json deleted file mode 100644 index 2d96086..0000000 --- a/terminal-ui-design/.claude-plugin/plugin.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "terminal-ui-design", - "description": "Create distinctive, production-grade terminal user interfaces with high design quality", - "version": "1.0.0", - "author": { - "name": "duyet" - } -} diff --git a/terminal-ui-design/CLAUDE.md b/terminal-ui-design/CLAUDE.md deleted file mode 100644 index 6a00a76..0000000 --- a/terminal-ui-design/CLAUDE.md +++ /dev/null @@ -1,56 +0,0 @@ -# Terminal-ui-design Plugin - -Create distinctive, production-grade terminal user interfaces with high design quality - -## Versioning - -Follow semantic versioning (semver) for this plugin: - -| Change Type | Version Bump | Example | -|-------------|--------------|---------| -| Bug fix, docs | Patch | 1.0.0 โ†’ 1.0.1 | -| New feature, minor change | Minor | 1.0.0 โ†’ 1.1.0 | -| Breaking change | Major | 1.0.0 โ†’ 2.0.0 | - -**When to bump:** -- Adding new commands, skills, or agents โ†’ **Minor** -- Modifying existing behavior โ†’ **Minor** (or Major if breaking) -- Updating documentation only โ†’ **Patch** -- Bug fixes โ†’ **Patch** - -Always update `plugin.json` version when making changes. - -## Plugin Structure - -``` -terminal-ui-design/ -โ”œโ”€โ”€ .claude-plugin/ -โ”‚ โ””โ”€โ”€ plugin.json # Manifest (version 1.0.0) -โ”œโ”€โ”€ agents/ # Sub-agent definitions -โ”œโ”€โ”€ commands/ # Slash commands -โ”œโ”€โ”€ skills/ # Reusable knowledge -โ””โ”€โ”€ hooks/hooks.json # Lifecycle hooks (optional) -``` - -## Components - -### Skills - - - **terminal-ui-design** - - -## Commit Convention - -Use semantic commits with plugin scope: - -``` -feat(terminal-ui-design): add new feature -fix(terminal-ui-design): fix bug -docs(terminal-ui-design): update documentation -``` - -Co-author: `Co-Authored-By: duyetbot <duyetbot@users.noreply.github.com>` - ---- - -**Generated by docs-generator v1.0.0** diff --git a/terminal-ui-design/README.md b/terminal-ui-design/README.md deleted file mode 100644 index affa772..0000000 --- a/terminal-ui-design/README.md +++ /dev/null @@ -1,72 +0,0 @@ -# Terminal UI Design Plugin - -Create distinctive, production-grade terminal user interfaces with high design quality. - -## Installation - -```bash -/plugin install terminal-ui-design@duyet-claude-plugins -``` - -## What It Does - -Claude automatically uses this skill for terminal UI work. Creates polished CLI and TUI interfaces with: - -- Bold aesthetic choices (cyberpunk, retro, minimalist, etc.) -- Custom box drawing and borders -- Cohesive color palettes (ANSI 16, 256-color, true color) -- Typography and text styling -- Layout composition patterns -- Motion and animation (spinners, progress bars, typing effects) - -## Aesthetic Directions - -Choose a bold direction: - -| Style | Description | -|-------|-------------| -| Hacker/Cyberpunk | Neon accents, matrix rain, glitch effects | -| Retro Computing | 80s/90s terminals, amber/green phosphor | -| Minimalist Zen | Single focus, generous whitespace | -| Maximalist Dashboard | Dense information, many panels | -| Synthwave Neon | Pink/purple/cyan gradients | -| Brutalist | Monochrome, raw, industrial | -| Military/Tactical | Status displays, green-on-black | - -## Supported Libraries - -| Language | Libraries | -|----------|-----------| -| Python | Rich, Textual | -| Go | Bubbletea, Lipgloss | -| Rust | Ratatui | -| Node.js | Ink, Blessed | - -## Usage - -``` -"Create a dashboard for monitoring Docker containers" -"Build a file manager TUI with vim keybindings" -"Design a CLI progress indicator with retro aesthetics" -"Create a terminal music player interface" -``` - -Claude will choose a distinctive aesthetic direction and implement production-ready code. - -## Architecture - -``` -terminal-ui-design/ -โ”œโ”€โ”€ .claude-plugin/ -โ”‚ โ””โ”€โ”€ plugin.json # Plugin manifest -โ”œโ”€โ”€ skills/ -โ”‚ โ””โ”€โ”€ terminal-ui-design/ -โ”‚ โ””โ”€โ”€ SKILL.md # Skill definition with guidelines -โ””โ”€โ”€ README.md # This file -``` - -## Changelog - -### [1.0.0] - Initial Release - -Terminal UI design skill with bold aesthetic choices (cyberpunk, retro, minimalist, etc.) and support for Rich, Textual, Bubbletea, Ratatui, Ink, and Blessed libraries. diff --git a/terminal-ui-design/skills/terminal-ui-design/SKILL.md b/terminal-ui-design/skills/terminal-ui-design/SKILL.md deleted file mode 100644 index 56316b0..0000000 --- a/terminal-ui-design/skills/terminal-ui-design/SKILL.md +++ /dev/null @@ -1,145 +0,0 @@ ---- -name: terminal-ui-design -description: Create distinctive, production-grade terminal user interfaces with high design quality. Use this skill when the user asks to build CLI tools, TUI applications, or terminal-based interfaces. Generates creative, polished code that avoids generic terminal aesthetics. ---- - -# Terminal UI Design - -Create distinctive, production-grade terminal user interfaces with high design quality. Use this skill when building CLI tools, TUI applications, or terminal-based interfaces. Generate creative, polished code that avoids generic terminal aesthetics. - -## Design Thinking - -Before coding, understand the context and commit to a BOLD aesthetic direction: - -1. **Purpose**: What problem does this interface solve? Who uses it? What's the workflow? -2. **Tone**: Pick an extreme: hacker/cyberpunk, retro-computing (80s/90s), minimalist zen, maximalist dashboard, synthwave neon, monochrome brutalist, corporate mainframe, playful/whimsical, matrix-style, steampunk terminal, vaporwave, military/tactical, art deco, paper-tape nostalgic -3. **Constraints**: Technical requirements (Python Rich, Go bubbletea, Rust ratatui, Node.js blessed/ink, pure ANSI escape codes, ncurses) -4. **Differentiation**: What makes this UNFORGETTABLE? What's the one thing someone will remember about this terminal experience? - -Choose a clear conceptual direction and execute it with precision. A dense information dashboard and a zen single-focus interface both workโ€”the key is intentionality, not intensity. - -## Box Drawing & Borders - -Choose border styles that match your aesthetic: - -- Single line: โ”Œโ”€โ”โ”‚โ””โ”˜ โ€” Clean, modern -- Double line: โ•”โ•โ•—โ•‘โ•šโ• โ€” Bold, formal, retro-mainframe -- Rounded: โ•ญโ”€โ•ฎโ”‚โ•ฐโ•ฏ โ€” Soft, friendly, modern -- Heavy: โ”โ”โ”“โ”ƒโ”—โ”› โ€” Strong, industrial -- Dashed/Dotted: โ”„โ”† โ€” Light, airy, informal -- ASCII only: +-+| โ€” Retro, universal compatibility -- Block characters: โ–ˆโ–€โ–„โ–Œโ– โ€” Chunky, bold, brutalist -- Custom Unicode: Mix symbols like โ—ขโ—ฃโ—คโ—ฅ, โ—โ—‹โ—โ—‘, โ–ฒโ–ผโ—€โ–ถ for unique frames - -Avoid defaulting to simple single-line boxes. Consider asymmetric borders, double-thick headers, or decorative corners like โ—†, โ—ˆ, โœฆ, โฌก. - -## Color & Theme - -Commit to a cohesive palette. Terminal color strategies: - -- **ANSI 16**: Classic, universal. Craft distinctive combinations beyond default red/green/blue -- **256-color**: Rich palettes. Use color gradients, subtle background variations -- **True color (24-bit)**: Full spectrum. Gradient text, smooth color transitions -- **Monochrome**: Single color with intensity variations (dim, normal, bold, reverse). Elegant constraint - -Create atmosphere with: -- Background color blocks for sections -- Gradient fills using block characters โ–‘โ–’โ–“โ–ˆ -- Color-coded semantic meaning (but avoid clichรฉ red=bad, green=good) -- Inverted/reverse video for emphasis -- Dim text for secondary information, bold for primary - -**Palette examples** (invent your own): -- Cyberpunk: Hot pink #ff00ff, electric cyan #00ffff, deep purple #1a0a2e background -- Amber terminal: #ffb000 on black, like vintage CRTs -- Nord-inspired: Cool blues and muted greens on dark blue-gray -- Hot Dog Stand: Intentionally garish yellow/red (for playful/ironic UIs) - -## Typography & Text Styling - -The terminal is ALL typography. Make it count: -- **ASCII art headers**: Use figlet-style banners, custom letterforms, or Unicode art -- **Text weight**: Bold, dim, normal โ€” create visual hierarchy -- **Text decoration**: Underline, strikethrough, italic (where supported) -- **Letter spacing**: Simulate with spaces for headers: H E A D E R -- **Case**: ALL CAPS for headers, lowercase for body, mixed for emphasis -- **Unicode symbols**: Enrich text with โ†’ โ€ข โ—† โ˜… โšก ฮป โˆด โ‰ก โŒ˜ -- **Custom bullets**: Replace - with โ–ธ โ—‰ โœ“ โฌข โ€บ or themed symbols - -**ASCII Art Styles**: -``` -Block: โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— -Slant: /___ / / // / / ____/ -Small: โ•”โ•โ•—โ”Œโ”€โ”โ”Œโ”€โ” -Minimal: [ HEADER ] -``` - -## Layout & Spatial Composition - -Break free from single-column output: -- **Panels & Windows**: Create distinct regions with borders -- **Columns**: Side-by-side information using careful spacing -- **Tables**: Align data meaningfully, use Unicode table characters -- **Whitespace**: Generous padding inside panels, breathing room between sections -- **Density**: Match to purpose โ€” dashboards can be dense, wizards should be sparse -- **Hierarchy**: Clear visual distinction between primary content, secondary info, and chrome -- **Asymmetry**: Off-center titles, weighted layouts, unexpected alignments - -## Motion & Animation - -Terminals support dynamic content: -- **Spinners**: Beyond basic |/-. Use Braille patterns โ ‹โ ™โ นโ ธโ ผโ ดโ ฆโ งโ ‡โ , dots โฃพโฃฝโฃปโขฟโกฟโฃŸโฃฏโฃท, custom sequences -- **Progress bars**: โ–“โ–‘, โ–ˆโ–’, [=====> ], or creative alternatives like โ—โ—“โ—‘โ—’ -- **Typing effects**: Reveal text character-by-character for drama -- **Transitions**: Wipe effects, fade in/out with color intensity -- **Live updates**: Streaming data, real-time charts - -## Data Display -- **Sparklines**: โ–โ–‚โ–ƒโ–„โ–…โ–†โ–‡โ–ˆ for inline mini-charts -- **Bar charts**: Horizontal bars with block characters -- **Tables**: Smart column sizing, alternating row colors, aligned numbers -- **Trees**: โ”œโ”€โ”€ โ””โ”€โ”€ โ”‚ for hierarchies -- **Status indicators**: โ— green, โ—‹ empty, โ— partial, โœ“ complete, โœ— failed -- **Gauges**: [โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘] with percentage - -## Decorative Elements - -Add character without clutter: -- **Dividers**: โ”€โ”€โ”€โ”€โ”€ โ•โ•โ•โ•โ• โ€ขโ€ขโ€ขโ€ขโ€ขโ€ข โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘ โ‰‹โ‰‹โ‰‹โ‰‹โ‰‹โ‰‹ -- **Section markers**: โ–ถ SECTION, [ SECTION ], โ”€โ”€โ”€ SECTION โ”€โ”€โ”€, โ—† SECTION -- **Background textures**: Patterns using light characters like ยท โˆ™ โ–‘ -- **Icons**: Nerd Font icons if available: ๓ฐŠข ๓ฐ‚ฝ ๓ฐƒป ๓ฐƒฝ ๓ฐฎ ๓ฐˆ” - -## Anti-Patterns to Avoid - -NEVER use generic terminal aesthetics like: - -- Plain unformatted text output -- Default colors without intentional palette -- Basic [INFO], [ERROR] prefixes without styling -- Simple ---- dividers -- Walls of unstructured text -- Generic progress bars without personality -- Boring help text formatting -- Inconsistent spacing and alignment - -## Library Quick Reference - -**Python**: Rich, Textual -**Go**: Bubbletea, Lipgloss -**Rust**: Ratatui -**Node.js**: Ink, Blessed - -**ANSI Escape Codes**: -``` -\x1b[1m Bold -\x1b[3m Italic -\x1b[4m Underline -\x1b[31m Red foreground -\x1b[38;2;R;G;Bm True color -\x1b[2J Clear screen -``` - -The terminal is a canvas with unique constraints and possibilities. Don't just print textโ€”craft an experience. - -Match implementation complexity to the aesthetic vision. A dense monitoring dashboard needs elaborate panels and live updates. A minimal CLI needs restraint, precision, and perfect alignment. Elegance comes from executing the vision well.