Skip to content

Add hunk package#202

Merged
jtnkminimal merged 3 commits into
mainfrom
hunk-pkg
May 29, 2026
Merged

Add hunk package#202
jtnkminimal merged 3 commits into
mainfrom
hunk-pkg

Conversation

@jtnkminimal
Copy link
Copy Markdown
Contributor

@jtnkminimal jtnkminimal commented May 28, 2026

Summary

Packages hunk, a terminal diff viewer, so it's
available in the registry. Built from source with the bun toolchain rather than
shipping the prebuilt release binary, giving us a real supply-chain guarantee and the
ability to tweak build flags. The package exposes both the hunk and hunkdiff
binaries (the latter is a symlink to hunk, matching upstream's launcher behavior).

Related issues

Changes

  • New package hunk at upstream version 0.14.0.
  • Source: https://github.com/modem-dev/hunk/archive/refs/tags/v0.14.0.tar.gz
    (sha256 = 8cb99e7366eddc82d1ccc754c9cdf4b55c64244929094e49571fad1b80ce759c).
  • Build: bun install --frozen-lockfile --ignore-scripts then
    bun build --compile ./src/main.tsx to produce a single binary; needs dns/internet
    to fetch JS dependencies during the build.
  • Build deps: base, bun. Runtime deps: glibc, git.
  • Outputs: usr/bin/hunk and a usr/bin/hunkdiff symlink to it.
  • source_provenance → GitHub modem-dev/hunk; license_spdx = MIT.
  • Smoke test runs hunk --version.

Checklist

  • I've read CONTRIBUTING.md.
  • I've accepted the ICLA (and CCLA if contributing on my
    employer's time). CLA Assistant will prompt me on this PR if I haven't already.
  • min check passes for the affected packages/harnesses.
  • min patched-build <name> succeeds for any package I added or modified.
  • For new packages: source_provenance points to the canonical upstream and the source builds from source (not a prebuilt
    release binary) where the required toolchain is available.
  • For version bumps: I've verified the new sha256 against the upstream archive.

Notes for reviewers

  • The build needs network access (needs.dns / needs.internet) for bun install.
  • hunkdiff is shipped as a relative symlink to hunk; both names are declared as
    separate OutputBin globs.

Summary by CodeRabbit

  • Chores
    • Added build configuration and scripts to support the hunk package v0.14.0.
    • Package now includes two executable tools and configured runtime dependencies, along with verification testing.

Review Change Stack

Package the hunk diff viewer from modem-dev/hunk, built from source
with bun and exposing both the hunk and hunkdiff binaries.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

📝 Walkthrough

Walkthrough

This PR adds the hunk package to the build system. A Nickel build specification (build.ncl) configures the package to fetch version 0.14.0 from GitHub, declare runtime dependencies (glibc, git), and define build and network requirements. A corresponding Bash script (build.sh) implements the build steps: setting up Bun caching, installing frozen dependencies, building a TSX source entrypoint, and installing both hunk and hunkdiff outputs with a symlink.

Changes

Hunk Package Build

Layer / File(s) Summary
Hunk package build specification and script
packages/hunk/build.ncl, packages/hunk/build.sh
Build specification pins version 0.14.0 from GitHub with hash and configures build/run dependencies (glibc, git), declares network needs, and runs ./build.sh. Build script configures Bun directories, installs dependencies with frozen lockfile, builds ./src/main.tsx to hunk binary, and installs into $OUTPUT_DIR/usr/bin with hunkdiff symlink.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • norrietaylor

Poem

🐰 A hunk of a package arrives today,
Built from TypeScript in every way,
With Bun's swift hands and Nickel's care,
Two binaries born, a symlinked pair! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add hunk package' directly and clearly summarizes the main change: adding a new package for the hunk terminal diff viewer.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch hunk-pkg

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/hunk/build.sh`:
- Around line 4-10: The build script (build.sh) fails to navigate into the
extracted source directory before running bun commands; update build.sh to cd
into the extracted directory using the provided version variable (e.g., cd
"hunk-$MINIMAL_ARG_VERSION") before running bun install and bun build so that
./src/main.tsx exists; ensure the cd occurs before the BUN_TMPDIR/BUN_INSTALL
exports or at least before bun install/build and preserve existing
temporary-directory setup and build commands in the same script.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 2d8682d5-a567-4afa-8023-60a6cb79f907

📥 Commits

Reviewing files that changed from the base of the PR and between 3ae4553 and a305db8.

📒 Files selected for processing (2)
  • packages/hunk/build.ncl
  • packages/hunk/build.sh

Comment thread packages/hunk/build.sh
Comment on lines +4 to +10
mkdir -p .bun-tmp .bun-install
export BUN_TMPDIR="$PWD/.bun-tmp"
export BUN_INSTALL="$PWD/.bun-install"

bun install --frozen-lockfile --ignore-scripts

bun build --compile ./src/main.tsx --outfile hunk
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Missing navigation to extracted source directory.

The build script does not navigate into the extracted source directory before running build commands. The Source dependency in build.ncl extracts the tarball with strip_prefix = "hunk-%{version}", creating a hunk-0.14.0 directory. However, line 10 references ./src/main.tsx which will not exist in the build root—it exists inside the extracted directory.

🐛 Proposed fix to navigate to extracted source
+cd hunk-$MINIMAL_ARG_VERSION
+
 mkdir -p .bun-tmp .bun-install
 export BUN_TMPDIR="$PWD/.bun-tmp"
 export BUN_INSTALL="$PWD/.bun-install"

As per coding guidelines: "Use 'cd' to navigate to the extracted source directory and reference the version variable via '$MINIMAL_ARG_VERSION' environment variable in build.sh".

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
mkdir -p .bun-tmp .bun-install
export BUN_TMPDIR="$PWD/.bun-tmp"
export BUN_INSTALL="$PWD/.bun-install"
bun install --frozen-lockfile --ignore-scripts
bun build --compile ./src/main.tsx --outfile hunk
cd hunk-$MINIMAL_ARG_VERSION
mkdir -p .bun-tmp .bun-install
export BUN_TMPDIR="$PWD/.bun-tmp"
export BUN_INSTALL="$PWD/.bun-install"
bun install --frozen-lockfile --ignore-scripts
bun build --compile ./src/main.tsx --outfile hunk
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/hunk/build.sh` around lines 4 - 10, The build script (build.sh)
fails to navigate into the extracted source directory before running bun
commands; update build.sh to cd into the extracted directory using the provided
version variable (e.g., cd "hunk-$MINIMAL_ARG_VERSION") before running bun
install and bun build so that ./src/main.tsx exists; ensure the cd occurs before
the BUN_TMPDIR/BUN_INSTALL exports or at least before bun install/build and
preserve existing temporary-directory setup and build commands in the same
script.

@jtnkminimal jtnkminimal enabled auto-merge May 28, 2026 16:00
@bryan-minimal
Copy link
Copy Markdown
Member

/build

jtnkminimal and others added 2 commits May 29, 2026 13:25
No-op commit to re-trigger builtbot after build-servers GitHub app update.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Jake King seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@jtnkminimal jtnkminimal added this pull request to the merge queue May 29, 2026
Merged via the queue into main with commit aedaf90 May 29, 2026
3 of 4 checks passed
@jtnkminimal jtnkminimal deleted the hunk-pkg branch May 29, 2026 20:59
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.

4 participants