nprt: draft initial version from design
Done! Here's what I've created:
Updated DESIGN.md with:
- Algorithm details (GitHub compare API approach)
- CLI flags (
--channels,--no-color,--json,--version) - Error handling with exit codes
- Testing strategy
Project structure:
cmd/nprt/main.go # CLI entry point
internal/
config/config.go # Input parsing, config
github/client.go # GitHub REST API client
core/core.go # Domain logic (channel checking)
render/render.go # Table/JSON output
tests/
config_test.go # 6 tests
github_test.go # 5 tests
core_test.go # 5 tests
render_test.go # 4 tests
Makefile # build, test, format-check
All 20 tests pass, and the binary builds successfully. You can test it with a real PR:
./bin/nprt 476497
Done! All changes implemented:
--channelsnow filters - Always checks all 5 default channels unless you specify a subset (e.g.,--channels=master,nixos-unstablechecks only those two)Version bumping - Use
make version-bump TYPE=<patch|minor|major>:make version-bump TYPE=patch # 0.1.0 -> 0.1.1 make version-bump TYPE=minor # 0.1.0 -> 0.2.0 make version-bump TYPE=major # 0.1.0 -> 1.0.0-devsuffix for local builds - Local builds show0.1.0-dev. SetCI=truein CI environments to get clean version numbers.
Done. The VERSION file is now at the repo root and the Makefile references it correctly.
Fixed! The issue was inverted logic in interpreting the GitHub compare API. The correct check is BehindBy == 0 (meaning the branch contains the commit), not checking for status == "behind".
PR 475593 now correctly shows:
- ✓ master, staging-next, nixpkgs-unstable, nixos-unstable-small
- ✗ nixos-unstable
Done! The output now includes a PR status line:
- Merged PR (475593):
● PR #475593(purple ● with bold text) - Open PR (395498):
● PR #395498(green ● with bold text, all channels show ✗)
Status symbols by PR state:
- Draft → gray ●
- Open → green ●
- Merged → purple ●
- Closed → red ●
Unmerged PRs no longer error—they display all channels as not present.
Could you share the Nerd Font codepoints you'd like for each PR state (draft, open, merged, closed)?
Done! Updated the icons to use the Nerd Font codepoints:
- Draft:
\uf4dd(gray) - Open:
\uf407(green) - Merged:
\uf407(purple) - Closed:
\uf4dc(red)
The merged PR 475593 now shows the `` icon (which should render correctly with a Nerd Font installed).
Fixed! The issue was that the TTY detection wasn't working in your environment. I replaced --no-color with a --color flag that accepts three modes:
--color=auto(default) - detect TTY automatically--color=always- force colors on--color=never- disable colors
With --color=always, the ANSI codes are now being emitted (purple for merged PR icon, green for ✓, red for ✗, bold for PR number).
Done! The "PR #<number>" text is now an OSC 8 hyperlink pointing to https://github.com/NixOS/nixpkgs/pull/<number>.
The format used is:
\033]8;;URL\033\\TEXT\033]8;;\033\\
When you run ./bin/nprt --color=always 475593 in a terminal that supports OSC 8 (like iTerm2, Kitty, WezTerm, etc.), the "PR #475593" text will be clickable and open the GitHub PR page.
Done! Hyperlinks are now independent of the --color flag. The OSC 8 hyperlink is automatically enabled whenever stdout is a TTY, regardless of color settings. This means:
- Running in a terminal → hyperlinks enabled (clickable "PR #<number>")
- Piping output → hyperlinks disabled (clean text)
--color=neverwith TTY → no colors but hyperlinks still work--color=alwayswithout TTY → colors but no hyperlinks
Done! Added --verbose flag that shows:
- Initial fetch message
- Each HTTP request with method and URL (
→ GET https://...) - Each response status (
← 200 200 OK) - Channel check progress
Example output with --verbose:
Fetching PR #475593 from NixOS/nixpkgs...
→ GET https://api.github.com/repos/NixOS/nixpkgs/pulls/475593
← 200 200 OK
Checking 5 channels for commit abc123def456...
Checking channel master...
→ GET https://api.github.com/repos/NixOS/nixpkgs/compare/abc123...master
← 200 200 OK
...
Done! Here's a summary of the optimizations and additions:
Performance:
- Parallelized channel checks using goroutines (~5x faster for default 5 channels)
- Removed unnecessary slice copy in
SortChannelResults(sorts in place)
Reliability:
- Added signal handling (Ctrl+C) for clean cancellation
- Improved error handling with
errors.Asfor proper error unwrapping - Added verbose error logging for channel check failures
Code Quality:
- Removed unused
Config,OutputFormattypes - DRY'd terminal detection (reuse
IsTerminal()inShouldUseColor) - Added Go doc comments to all packages and exported functions
Documentation:
- Created comprehensive README.md with:
- Installation and usage instructions
- All CLI options and environment variables
- Channel and icon reference tables
- Development guide with project structure
- Exit codes documentation
All 22 tests pass and the build is clean.
Done! Changes made:
Extended coloring to entire status line - The PR state color (gray/green/purple/red) now applies to both the icon and the "PR #123" text together
Fallback to dots - By default, uses
●(dot) for all PR states. SetNERD_FONTS=1environment variable to enable Nerd Font icons (\uf4dd,\uf407,\uf4dc)
Example output now shows the colored dot with the entire line in the state color:
● PR #475593 (purple for merged)
Done! Nerd Font icons are now enabled by default. Set NO_NERD_FONTS=1 to disable them and fall back to simple dots (●).