Thanks for helping improve Hunk.
Hunk is a review-first terminal diff viewer. Keep changes focused, verify behavior locally, and prefer small PRs over broad rewrites.
Requirements:
- Bun 1.3+
- Node.js 18+
- Git
Install dependencies:
bun installRun Hunk from source:
bun run src/main.tsx -- diffValidate a typical change:
bun run typecheck
bun test
bun run test:tty-smokeFormat the JS/TS/JSON codebase:
bun run format
bun run format:checkLint the JS/TS codebase:
bun run lint
bun run lint:fixbun install also installs a local pre-commit hook that runs lint-staged, so staged JS/TS files are auto-formatted and linted before commit.
Build and verify the npm package:
bun run build:npm
bun run check:packBenchmark scripts live in benchmarks/.
Common runs:
bun run bench:bootstrap-load
bun run bench:highlight-prefetch
bun run bench:large-stream
bun run bench:large-stream-profileBuild and smoke-test the prebuilt npm packages for the current host:
bun run build:prebuilt:npm
bun run check:prebuilt-pack
bun run smoke:prebuilt-installPrepare the multi-platform release directories from downloaded artifacts and dry-run publish order:
bun run build:prebuilt:artifact
bun run stage:prebuilt:release
bun run check:prebuilt-pack
bun run publish:prebuilt:npm -- --dry-run- Rendering changes: run
bun run typecheck,bun test,bun run test:tty-smoke, and do one real TTY smoke run on an actual diff. - CLI, config, or pager changes: verify the relevant source invocation still works, such as
diff,show,patch, orpager. - Packaging or release changes: run the pack and prebuilt checks locally before opening a PR.
- Most unit tests are colocated in
src/beside the code they cover. test/helpers/contains shared test-only fixtures used by those unit tests.test/cli/covers black-box CLI behavior.test/session/covers daemon, broker, and session-CLI integration flows.test/pty/covers PTY-backed live UI integration.test/smoke/contains opt-in transcript-based TTY smoke tests.
See test/README.md for the intent behind each top-level test category.
CLI input
-> parse runtime + config-backed view options
-> normalize into one Changeset / DiffFile model
-> App shell coordinates state, layout, and review navigation
-> pane components render review UI
-> Pierre-backed terminal renderer draws diff rows
Key rules:
- Keep the app review-first: the main pane is one top-to-bottom review stream.
- The sidebar is for navigation. Selecting a file should jump within the main stream, not collapse the review to one file.
- Keep split, stack, and auto layouts driven from the same normalized diff model.
- Preserve mouse and keyboard parity for primary actions.
- Keep agent context beside the code it explains.
- Prefer dedicated helper modules and pane components over growing
Appinto a monolith.
- Keep scope tight and explain user-visible behavior changes clearly.
- Update docs and examples when behavior or workflows change.
- If you want temporary local review notes, you can use
.hunk/latest.json, but do not commit it. hunk diffincludes untracked working-tree files by default. Use--exclude-untrackedif you want to review tracked changes only.
- The npm package name is
hunkdiff. - The installed CLI command remains
hunk. - The automated prebuilt publish workflow lives in
.github/workflows/release-prebuilt-npm.yml.