Skip to content

merge: dev into main — dedup refactor, type cleanup, Dockerfile#34

Merged
rbansal42 merged 8 commits intomainfrom
dev
Feb 6, 2026
Merged

merge: dev into main — dedup refactor, type cleanup, Dockerfile#34
rbansal42 merged 8 commits intomainfrom
dev

Conversation

@rbansal42
Copy link
Owner

Summary

Merges the complete deduplication refactoring work from dev to main.

Phase 1: Extract shared utilities into cmdutil

  • cmdutil.TimeAgo() / TimeAgoFromString() — replaces 5 duplicate implementations
  • cmdutil.TruncateString() — replaces 6 duplicate implementations
  • cmdutil.GetUserDisplayName() — replaces 2 duplicate implementations
  • cmdutil.PrintJSON() — replaces 8 duplicate JSON marshal blocks
  • cmdutil.PrintTableHeader() — replaces 7 duplicate table header blocks
  • cmdutil.ConfirmPrompt() — shared confirmation prompt helper

Phase 2: Remove duplicate PR types

  • Eliminated PRUser, PRParticipant, PullRequest, PRComment from pr/shared.go
  • All PR commands now use canonical api.* types directly
  • Added Nickname field to api.User for complete API compatibility

Phase 3: Dockerfile

  • Multi-stage build: golang:1.25-alpine builder + alpine:3.21 runtime
  • Non-root user, OCI labels, comprehensive .dockerignore

Bug fixes

  • Fixed Makefile ldflags using wrong module path (pre-existing)
  • Removed dead formatTimestamp function from pipeline/view.go

Stats

  • ~500 lines of duplication removed
  • 20+ files cleaned up
  • 3 new shared utility files
  • All tests passing, build clean

rahul-hudle and others added 8 commits February 6, 2026 12:14
…cation

- Add cmdutil.TimeAgo() and TimeAgoFromString() replacing 5 duplicate timeAgo implementations
- Add cmdutil.GetUserDisplayName() replacing 2 duplicate getUserDisplayName functions
- Add cmdutil.PrintJSON() replacing 8 duplicate JSON marshal/print blocks
- Add cmdutil.PrintTableHeader() replacing 7 duplicate table header blocks
- Add cmdutil.ConfirmPrompt() for shared confirmation logic
- Replace all local truncateString/truncateMessage with existing cmdutil.TruncateString
- Clean up unused imports across all modified files
- Add future timestamp guard in TimeAgo (returns 'in the future')
- Migrate project/list.go: replace truncateString, JSON, table header boilerplate
- Migrate issue/view.go: replace JSON output with cmdutil.PrintJSON
- Use 'any' instead of 'interface{}' in output.go
- Remove PRUser, PRParticipant, PullRequest, PRComment from pr/shared.go
- Remove getPullRequest helper, use api.Client.GetPullRequest directly
- Update pr/view.go to use api.PullRequest, api.User, cmdutil.GetUserDisplayName
- Update pr/reopen.go, pr/diff.go, pr/merge.go, pr/checkout.go, pr/comment.go
- Update pr/pr_test.go to use api types
- Fix type conversions: int64 PR IDs, PRState to string casts
- Multi-stage build: golang:1.25-alpine builder + alpine:3.21 runtime
- Supports VERSION and BUILD_DATE build args for ldflags
- Minimal runtime image with git + ca-certificates
- .dockerignore excludes .git, .worktrees, bin/, docs/, .github/
- Add Nickname field to api.User, add Nickname fallback in GetUserDisplayName
- Use api.PRStateOpen/PRStateDeclined constants instead of raw strings
- Dockerfile: add non-root user, OCI labels, BUILD_DATE default
- .dockerignore: add Dockerfile, Makefile, .goreleaser.yml, dist/, *.test
refactor: eliminate code duplication, remove duplicate types, add Dockerfile
- Fix Makefile ldflags: github.com/rbansal42/bb -> github.com/rbansal42/bitbucket-cli
- Remove unused formatTimestamp function from pipeline/view.go
- Clean up unused time import
fix: Makefile module path + remove dead code from final review
@rbansal42 rbansal42 merged commit 2c6dee5 into main Feb 6, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants