ALL INTELLIGENCE
Hacker News AIT2·Tools

jjack Launches CLI and TypeScript Library for jj PR Stacks

Original title: jjack: A CLI and TypeScript library to help jj users manage PR stacks on GitHub
38AI Score

jjack is a CLI and TypeScript library that helps jj version-control users manage PR stacks on GitHub, diverging in implementation from its jj-spr and spr lineage. The author says it was entirely vibe-coded with frontier models and never read, yet the tool and its GitHub test fake are well-validated against real GitHub behavior. It is public mainly to support the stack-management GUI in the author's other repo, ah.

Related Entities

Full Report

Contents5 sections

jjack

jjack is a CLI and TypeScript library to help jj users manage PR stacks on GitHub.

It started as a very stripped-down TS port of @papertigers"s [native-stacks branch](https://github.com/papertigers/jj-spr/tree/native-stacks of jj-spr (which in turn comes from spr), but at this point it")s fairly different in implementation. See THIRD_PARTY_NOTICES.md for attribution and licenses.

Because jjack is built narrowly around how I want to work, I don't expect anyone else to want to use it, but you might take it as inspiration when building your own stack tool. This repo is public mostly because my other public repo ah depends on it for its stack management GUI, and I want anyone interested in that to be able to see all the pieces.

This was entirely vibe-coded with a variety of frontier models. I have not read any of the code and do not plan to. Despite that (or because of it), the tool and the GitHub test fake are pretty well-validated against actual GitHub behavior.

If you're looking for a stack tool to actually use yourself, you'll probably want one of these instead:

See docs/comparison.md for details on how jjack differs from them.

The problem with stacks on GitHub

A big problem for jj users trying to use stacks on GitHub is that if you do things naively, every time you change a PR lower in the stack, whether by editing a commit or adding a new one, later PRs get rebased and force pushed. This results in a very poor reviewing experience in GitHub because the reviewer cannot easily tell what changed between pushes. The jj-spr approach is to treat what gets pushed to GitHub as a sort of generated projection of the "real" change you have in jj locally, taking what is intuitive for you and turning it into something entirely different that displays well on GitHub. In practice what that means is merge commits.

How jjack does it (which is also how jj-spr does it)

Say you have a stack of three PRs, A, B, and C, and the bottom one has three changes:

Diagram

You make a change to A2 locally:

Diagram

From git's point of view, everything from A2' on is brand new, so if you were to push the branches for A, B, and C directly, those are force pushes. What jj spr diff and jjack submit do here instead is maintain a second representation of the change that preserves all the existing commits, turning your change to A2 above into this:

Diagram

U is an ordinary commit on top of A's branch that contains your edit. MB is a merge commit on B's branch with parents B1 and U. MC is a merge commit on C's branch with parents C1 and MB. Every commit that was already on GitHub is untouched, so each PR shows the update as new commits on top of what reviewers have already seen.

This is Git and GitHub's fault

The only reason all this is necessary is that Git doesn't have a good canonical spot to put the information necessary to make this work well, and GitHub does not know how to display stacks and the changes between them properly. They're stuck in a very tough spot because the vast majority of their users are not using jj, but their most savvy users want functionality like this.

We want interdiff!

Install

Requires Node 24 or later, jj, and git. It also needs gh unless you pass --token or set jjack.token. From a checkout of this repository:

BASH
npm install && npm run build && npm install --global .

Configuration

jjack reads jj config and falls back to the jj-spr keys, so a repository already set up for jj-spr works without changes.

KeyFalls back toDefault
jjack.branchPrefixspr.branchPrefixnone (required; e.g., yourname/)
jjack.repositoryspr.githubRepositoryfrom the remote's URL (owner/repo)
jjack.remotespr.githubRemoteNameorigin
jjack.mainBranchspr.githubMasterBranchthe remote's bookmark at jj's trunk(), or main
jjack.requireApprovalspr.requireApprovalfalse
jjack.tokenspr.githubAuthTokenthe output of gh auth token
jjack.apiUrlspr.githubApiUrlhttps://api.github.com
BASH
jj config set --repo jjack.branchPrefix yourname/

--branch-prefix, --repository, and --token override these for a single run.

(注:更多技术实现细节与完整 API 文档请查阅原项目 README)