|
| 1 | +> [!IMPORTANT] > `arr` is still in development and not production-ready. Interested? Email jonathan@posthog.com |
| 2 | +
|
| 3 | +# arr |
| 4 | + |
| 5 | +arr is CLI for stacked PR management using Jujutsu (`jj`). |
| 6 | + |
| 7 | +Split your work into small changes, push them as a PR stack, and keep everything in sync. |
| 8 | + |
| 9 | +## Features |
| 10 | + |
| 11 | +- Stacked PRs synced to GitHub |
| 12 | +- Simpler interface compared to `jj` for managing your work. |
| 13 | +- Visual stack log with PR status. |
| 14 | +- Comes with a GitHub Action to enforce merge order |
| 15 | +- Unknown commands pass through to `jj` |
| 16 | + |
| 17 | +## Why |
| 18 | + |
| 19 | +Stacked PRs keep reviews small and manageable. Managing them with `git` is painful, this involves rebasing, force-pushing, updating PR bases and describing the PR stack via comments. |
| 20 | + |
| 21 | +`arr` makes it easy to create, manage and submit (stacked) PRs by using `jj` under the hood. |
| 22 | + |
| 23 | +## Install |
| 24 | + |
| 25 | +Requires [Bun](https://bun.sh). |
| 26 | + |
| 27 | +``` |
| 28 | +git clone https://github.com/posthog/array |
| 29 | +cd array |
| 30 | +pnpm install |
| 31 | +pnpm --filter @array/core build |
| 32 | +``` |
| 33 | + |
| 34 | +Then install the `arr` command (symlinked to `~/bin/arr`): |
| 35 | + |
| 36 | +``` |
| 37 | +./apps/cli/arr.sh install |
| 38 | +``` |
| 39 | + |
| 40 | +## Usage |
| 41 | + |
| 42 | +``` |
| 43 | +arr init # set up arr in a git repo |
| 44 | +arr create "message" # new change on stack |
| 45 | +arr submit # push stack, create PRs |
| 46 | +arr merge # merge PR via GitHub |
| 47 | +arr sync # fetch, rebase, cleanup merged |
| 48 | +arr up / arr down # navigate stack |
| 49 | +arr log # show stack |
| 50 | +arr exit # back to git |
| 51 | +arr help --all # show all commands |
| 52 | +``` |
| 53 | + |
| 54 | +## Example |
| 55 | + |
| 56 | +``` |
| 57 | +$ echo "user model" >> user_model.ts |
| 58 | +$ arr create "Add user model" |
| 59 | +✓ Created add-user-model-qtrsqm |
| 60 | +
|
| 61 | +$ echo "user api" >> user_api.ts |
| 62 | +$ arr create "Add user API" |
| 63 | +✓ Created add-user-api-nnmzrt |
| 64 | +
|
| 65 | +$ arr log |
| 66 | +◉ (working copy) |
| 67 | +│ Empty |
| 68 | +○ 12-23-add-user-api nnmzrtzz (+1, 1 file) |
| 69 | +│ Not submitted |
| 70 | +○ 12-23-add-user-model qtrsqmmy (+1, 1 file) |
| 71 | +│ Not submitted |
| 72 | +○ main |
| 73 | +
|
| 74 | +$ arr submit |
| 75 | +Created PR #8: 12-23-add-user-model |
| 76 | + https://github.com/username/your-repo/pull/8 |
| 77 | +Created PR #9: 12-23-add-user-api |
| 78 | + https://github.com/username/your-repo/pull/9 |
| 79 | +
|
| 80 | +$ arr merge |
| 81 | +... |
| 82 | +
|
| 83 | +$ arr sync |
| 84 | +``` |
| 85 | + |
| 86 | +Each change becomes a PR. PRs are stacked so reviewers see the dependency. |
| 87 | + |
| 88 | +## CI |
| 89 | + |
| 90 | +``` |
| 91 | +arr ci |
| 92 | +``` |
| 93 | + |
| 94 | +Adds a GitHub Action that blocks merging a PR if its parent PR hasn't merged yet, which helps keep your stack in order. |
| 95 | + |
| 96 | +## FAQ |
| 97 | + |
| 98 | +**Can I use this with an existing `git` repo?** |
| 99 | + |
| 100 | +Yes, do so by using `arr init` in any `git` repo. `jj` works alongside `git`. |
| 101 | + |
| 102 | +**Do my teammates need to use `arr` or `jj`?** |
| 103 | + |
| 104 | +No, your PRs are normal GitHub PRs. Teammates review and merge them as usual. `jj` has full support for `git`. |
| 105 | + |
| 106 | +**What if I want to stop using `arr`?** |
| 107 | + |
| 108 | +Run `arr exit` to switch back to `git`. Your repo, branches, and PRs stay exactly as they are. |
| 109 | + |
| 110 | +**How is `arr` related to Array?** |
| 111 | + |
| 112 | +`arr` is the CLI component of Array, an agentic development environment. |
| 113 | + |
| 114 | +## Learn more |
| 115 | + |
| 116 | +- [`jj` documentation](https://jj-vcs.github.io/jj/latest/) - full `jj` reference |
| 117 | +- [`jj` tutorial](https://jj-vcs.github.io/jj/latest/tutorial/) - getting started with `jj` |
0 commit comments