-
Unified View: Show all labels from both repos in one list
- Target-only labels appear first with "(dest only)" marker
- Visual separator between target-only and source labels
- Source labels are pre-selected by default
-
Label Matching: Labels are matched by name (case-insensitive)
- If a label exists in both repos, use the source version
- Never create duplicates
-
User Actions:
- Toggle any label on/off
- Unchecking a target-only label = delete it
- Checking a source label = copy it
- Final confirmation shows exact end state
- Use stderr for all logs to keep stdout clean
- Log levels: DEBUG (hidden by default), INFO, ERROR
- Enable debug with
-dor--debugflag - Log format:
[LEVEL] message - Key events to log:
- GitHub CLI detection
- API calls made
- Label operations (create/update/delete)
- Errors with full context
-
GitHub CLI not found:
Error: GitHub CLI (gh) is required but not found. Install it from: https://cli.github.com -
Not authenticated:
Error: Not authenticated with GitHub. Run: gh auth login -
No permissions:
Error: You don't have permission to manage labels in owner/repo. Ensure you have write access to the repository. -
Network/API errors: Show GitHub's error message directly
- Show colored blocks before hex codes:
█ #d73a4a bug - Detect color support:
- 24-bit color: Full color blocks
- 256 colors: Approximate to nearest color
- 16 colors: Show colored text instead of blocks
- No color: Show hex codes only
- Use
github.com/mattn/go-isattyto detect TTY - Gracefully degrade in non-interactive environments
main.go - cobra setup, command handling
labels.go - fetch/create/update/delete via gh api
picker.go - promptui interactive selection
display.go - color rendering, terminal output
types.go - Label struct and related types
logger.go - Logging utilities
# Fetch labels
gh api repos/{owner}/{repo}/labels --paginate
# Create label
gh api repos/{owner}/{repo}/labels -f name=X -f color=X -f description=X
# Update label
gh api repos/{owner}/{repo}/labels/{name} --method PATCH -f color=X -f description=X
# Delete label
gh api repos/{owner}/{repo}/labels/{name} --method DELETE- No labels in source: Show error "No labels found in {owner}/{repo}"
- Empty selection: Show warning "No labels selected. Nothing to do."
- Ctrl+C handling: Clean exit, no partial operations
- Large label sets: Handle pagination properly
- Mock
ghcommands for unit tests - Test picker state management
- Test confirmation logic
- Test error handling for all edge cases
- Test color detection and fallback
Picker display with full color support:
[✓] █ bug #d73a4a
[✓] █ documentation #0075ca
[ ] █ duplicate #cfd3d7
Limited color support:
[✓] bug #d73a4a [red]
[✓] documentation #0075ca [blue]
[ ] duplicate #cfd3d7 [gray]
Final confirmation:
Final state for myorg/myproject:
✓ █ bug #d73a4a
✓ █ documentation #0075ca
✓ █ enhancement #a2eeef
Actions:
• Create 2 labels
• Delete 1 label (duplicate)
• Keep 1 existing label
Proceed? [y/N]: