jj log post-processor. Nicer graph, elastic tabs for revision details. - Go 99%
- Shell <1%
bijjou #
bijjou is a jujutsu (jj) log post-processor. It makes the graph prettier, and allows rearranging fields with optional elastic tabs for columnar alignment.
Typical jj log oneline output
That same output piped through bijjou
bijjou takes input from jj log -T bijjou_log_oneline, where bijjou_log_oneline is a custom jj template that emits NUL-separated key/value fields. bijjou reads its own template to determine the arrangement of fields.
In general, jj templates are used to style the non-graph pieces (commit id, change id, title, bookmark, etc). bijjou arranges them and re-styles the graph.
Features #
Elastic tabs #
Notice the change ids all line up? That's the elastic_tab() function. It left-pads the current row so the content that follows lines up in a column across rows. It also adds a horizontal guide line in the gap. %{elastic_tab(field)} is shorthand for a tab that a %{field} follows. It pads, then emits the field. bijjou keys columns by tab position, so each elastic_tab in a template is its own column.
Color #
bijjou keeps color when jj and bijjou both enable it. By default, jj emits no color when a pipe sends its output to a non-TTY process. To keep color, add a config option or use the --color=always CLI flag.
Graph #
Although jj is typically responsible for styled output of each field, bijjou makes one output replacement: it rewrites the graph edges into something more aesthetic. These are Large Type Pieces from the Symbols for Legacy Computing Supplement block, introduced in Unicode 16.0 (unicode pdf). If you do not like those, you can set the graph edge characters to anything you want. I am not the dad of you.
Graph collapse #
jj draws the graph in fixed two-cell columns. The glyph sits in the first cell. An inter-column gap sits in the second cell (a space, or a horizontal where a connector passes through). Set graph.collapse = true to drop those gap cells. Then the graph becomes half as wide, and the dash run to the content shrinks with it:
❯ jj log -T bijjou_log_oneline | bijjou --graph__collapse=true
○╶─ rppzwpzx c90ec200 jason 260530·0600 HYH hydra head
○ vxqsrzyn 02d310e8 jason 260530·0600 HYS-foo hydra stack foo
○ mzpomyto 30e8e07f jason 260530·0600 HYS-baz hydra stack baz
○─ wrvuovwm 9d7ea2ce jason 260530·0600 HYS-bar hydra stack bar
Only gap cells go. A glyph that is a horizontal because a connector spans several columns (├───╯) keeps its cell. An inactive column keeps one of its two spaces. As a result, nothing slides off the column it belongs to.
Streaming #
bijjou takes streaming input. By default, it streams output in batches, either a fixed size (default 128) or half-pager mode. This mode works with pagers like less, more, or [moor](https://github. It sets the batch size from the screen height (height/2 - 1) to reduce or remove tears between page-down and page-up events. The -1 accommodates the status bar of pagers.
You can also turn off output streaming in the config.
Hydra topologies #
hydra is a tool to manage jj megamerges. It comprises a series of linear stacks as siblings between a base fork point and a head merge point. As a
result, jj log gives each stack its own graph column.
With hydra.enable = true (the default), bijjou marks those columns up. bijjou recognizes them by
bookmark name, from the naming in [hydra.prefixes]. A row that carries
HYS-<name> opens that stack. An anchor (HYB / HYH / HYCR) or a
HYWC-* working copy closes it. The rows between keep the stack they sit in,
for as long as they stay in its graph column. A commit drawn in another
column is nobody's stack and keeps jj's own colors. An extra head off the
base below the bottom stack is one example.
hydra.top-stack-paddingdraws the separator row that jj skips under the log's top stack. jj closes a graph column only when the branch to its left ends. As a result, every stack gets a├─╯row under it, except the topmost. The topmost stack runs straight into its neighbor.hydra.colorsassigns a color to each stack's graph nodes.truehashes the stack name into a hue. Hashing based on the stack name results in a stable coloring regardless of toplogy or number of stacks.falseleaves jj's nodes alone. A list is a palette, indexed by the order the log first names each stack (the index wraps). The hash skips two reserved bands corresponding to 10° either side of#a6e3a1(115°) and#f5c2e7(316°), the default colors of jj bookmarks and workspaces in Catpuccin Mocha (TODO: make this configurable). As a result, a hashed stack never reads as one of those.bijjouuses a palette you wrote as given. A stack'sHYWC-<name>working copy takes its stack's color too, so the two read as one thing.hydra.color-bookmarksputs that color on the bookmark names themselves. As a result,HYS-<name>andHYWC-<name>read in their column's color instead of jj's. Other bookmarks on the row, and the anchors, keep jj's colors.[hydra.prefixes-replace]renames those bookmarks in the output, keyed like[hydra.prefixes]. A set key stands in for the whole leader built out of it and keeps the stack name. For example,base = "◆"rendersHYBas◆, andstack-head = "Ψ"rendersHYS-fooasΨfoo(the dash goes with the leader).prefixreplaces the sharedHYleader alone, soHYS-fooreadsΨS-foo. A per-bookmark key wins overprefix. A key left unset leaves the bookmarks it names as jj printed them. Classification still runs on the real names.bijjoumeasures the elastic-tab columns on the rendered width, so a stand-in of any width stays aligned.
❯ jj log -T log_oneline | bijjou --graph__collapse=true
● knktkz 478c07 ME 260915·1336 [LOY-734] docs(home): …
← top-stack-padding
● zolnlk 1a5407 ME 260915·1336 HYS-list-prs hydra stack …
● kknmqn ef4d55 ME 260915·1336 agent/jjt/loy-832-lis…
A repo with no hydra carries no such bookmark, so it gets no markup. The
output is byte-for-byte what hydra.enable = false gives. Classification
runs per row off the bookmarks field, so there is no subprocess and nothing
to wait on. If the repo renamed its hydra bookmarks, spell the new naming in
[hydra.prefixes]. Markup needs jj's default top-down log order. jj log --reversed puts a stack's commits above its marker, which the walk cannot
follow.
Output from jj log in a repo with hydra topology and bijjou configured to add colouring, collapse horizonal graph space, and re-write the hydra bookmark names
Install #
From source:
go install tangled.org/jjt.io/bijjou@latest
Or with mise, which pins the Go toolchain:
mise run install # installs to ~/.local/bin/bijjou
BIJJOU_INSTALL_PATH=... mise run install
Configuration #
Precedence (low → high): config file < env vars < CLI flags.
Config file paths (first match wins):
$BIJJOU_CONFIG$XDG_CONFIG_HOME/bijjou/config.toml$HOME/.config/bijjou/config.toml
If no file is present, bijjou writes a default file to the XDG path on first run.
Env vars: prefix BIJJOU__, replace . with __ and - with _. Uppercase is canonical. bijjou also accepts lowercase.
BIJJOU__GRAPH__EDGES__CHARS__HORIZONTAL=X jj log | bijjou
CLI flags: --<key>=<value>, replace . with __.
jj log | bijjou --graph__edges__chars__horizontal=X
See bijjou-config.toml for every key, default,
and explanatory comment. Quick reference:
| Section | Keys |
|---|---|
| (top level) | activate, pager |
[ui] |
color (auto|always|never) |
[layout] |
dash, dash-start, dash-end |
[templates] |
<name> (DSL body — a row's bijjou_template_name selects one) |
[stream] |
enabled, batch-size (int or "half-pager") |
[graph] |
collapse (bool — drop the graph's inter-column pad cells) |
[graph.edges.chars] |
horizontal, vertical, top-left, top-right, bottom-left, bottom-right, tee-right, tee-left, tee-down, tee-up, cross, elision |
[colors] |
dash-filler, graph-edge (int 0–255 or "#rrggbb") |
[hydra] |
enable, top-stack-padding, color-bookmarks (bool), colors (true|false|list of colors) |
[hydra.prefixes] |
prefix, base, head, conflict-resolution, stack-head, stack-working-copy |
Run bijjou --help for the same reference inline.
Development #
mise run build # build bin/bijjou
mise run test # all tests
mise run test-unit # package unit tests only
mise run test-golden # golden output tests
mise run show-golden [name] # render a golden file with ANSI codes live
Golden files live under testdata/golden/. After intentional output changes,
run mise run test-golden -- -update to rewrite them, then read the diff.
About this repo #
The vast majority of the code was generated using a commercial LLM.
I'm not likely to action any PRs or feature requests given the other demands on my attention in life, but feel free to file them anyway!