|
| 1 | +# cleanup-issues |
| 2 | + |
| 3 | +Clean up GitHub issues by aligning prefixes with commitlint conventions and adding appropriate labels based on content. |
| 4 | + |
| 5 | +## Steps to Execute |
| 6 | + |
| 7 | +1. **List all open issues to review:** |
| 8 | + |
| 9 | + ```bash |
| 10 | + gh issue list --state open --limit 100 --json number,title,labels |
| 11 | + ``` |
| 12 | + |
| 13 | +2. **Check the commitlint configuration for valid prefixes:** |
| 14 | + - Read `commitlint.config.js` to see allowed types |
| 15 | + - Valid prefixes: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, `revert` |
| 16 | + |
| 17 | +3. **Create missing labels if needed:** |
| 18 | + |
| 19 | + ```bash |
| 20 | + gh label create "performance" --description "Performance improvements" --color "1d76db" |
| 21 | + gh label create "refactoring" --description "Code refactoring" --color "d4c5f9" |
| 22 | + gh label create "security" --description "Security improvements" --color "d73a4a" |
| 23 | + gh label create "technical-debt" --description "Technical debt" --color "fef2c0" |
| 24 | + gh label create "reliability" --description "Reliability improvements" --color "0e8a16" |
| 25 | + ``` |
| 26 | + |
| 27 | +4. **For each issue, analyze the content and update if needed:** |
| 28 | + |
| 29 | + **Prefix Mapping Rules:** |
| 30 | + |
| 31 | + | Issue Content | Correct Prefix | Labels to Add | |
| 32 | + | ----------------------------------------------------- | -------------- | ---------------------------------------- | |
| 33 | + | New feature, pagination, retry mechanism | `feat:` | enhancement, reliability (if resilience) | |
| 34 | + | Bug fix, security fix, validation fix | `fix:` | bug, security (if security-related) | |
| 35 | + | Performance optimization, caching, query optimization | `perf:` | performance | |
| 36 | + | Code restructuring, normalization, consolidation | `refactor:` | refactoring, technical-debt | |
| 37 | + | Dependency management, versioning, cleanup | `chore:` | dependencies, technical-debt | |
| 38 | + | Documentation updates | `docs:` | documentation | |
| 39 | + | Test additions or changes | `test:` | testing | |
| 40 | + |
| 41 | +5. **Update issues with correct prefixes and labels:** |
| 42 | + |
| 43 | + ```bash |
| 44 | + # Example: Update issue with wrong prefix |
| 45 | + gh issue edit 158 --title "fix: Tighten logging defaults for security and traceability" |
| 46 | + gh issue edit 158 --add-label "security" |
| 47 | + |
| 48 | + # Example: Change from feat to perf |
| 49 | + gh issue edit 154 --title "perf: Introduce lightweight caching with TTL for hot paths" |
| 50 | + gh issue edit 154 --add-label "performance" |
| 51 | + |
| 52 | + # Example: Change from feat to refactor |
| 53 | + gh issue edit 155 --title "refactor: Consolidate to single canonical entrypoint and registry" |
| 54 | + gh issue edit 155 --add-label "refactoring,technical-debt" |
| 55 | + ``` |
| 56 | + |
| 57 | +6. **Verify all updates:** |
| 58 | + ```bash |
| 59 | + gh issue list --state open --json number,title,labels --jq '.[] | "\(.number): \(.title)\n Labels: \(.labels | map(.name) | join(", "))"' |
| 60 | + ``` |
| 61 | + |
| 62 | +## Automated Process |
| 63 | + |
| 64 | +When running this command, I will: |
| 65 | + |
| 66 | +1. First check `commitlint.config.js` to confirm valid prefixes |
| 67 | +2. List all open issues to analyze |
| 68 | +3. Create any missing labels needed |
| 69 | +4. For each issue: |
| 70 | + - Check if the current prefix is valid |
| 71 | + - Analyze the title/content to determine the correct prefix |
| 72 | + - Update the title if the prefix is wrong |
| 73 | + - Add appropriate labels based on the issue type |
| 74 | +5. Provide a summary of all changes made |
| 75 | + |
| 76 | +## Example Output |
| 77 | + |
| 78 | +``` |
| 79 | +Reviewing 10 open issues... |
| 80 | +
|
| 81 | +✅ Updated #154: "perf: Introduce lightweight caching with TTL" |
| 82 | + - Changed prefix from 'feat:' to 'perf:' |
| 83 | + - Added labels: performance |
| 84 | +
|
| 85 | +✅ Updated #155: "refactor: Consolidate to single canonical entrypoint" |
| 86 | + - Changed prefix from 'feat:' to 'refactor:' |
| 87 | + - Added labels: refactoring, technical-debt |
| 88 | +
|
| 89 | +✅ Updated #158: "fix: Tighten logging defaults for security" |
| 90 | + - Changed prefix from 'security:' to 'fix:' (invalid prefix) |
| 91 | + - Added labels: security |
| 92 | +
|
| 93 | +Summary: |
| 94 | +- 3 issues updated |
| 95 | +- 7 issues already correct |
| 96 | +- 4 new labels created |
| 97 | +``` |
| 98 | + |
| 99 | +## Notes |
| 100 | + |
| 101 | +- Issue titles can use uppercase after the prefix (unlike commit messages) |
| 102 | +- The command preserves existing valid labels |
| 103 | +- Only updates issues that need changes |
| 104 | +- Creates a summary report of all modifications |
0 commit comments