feat: initial implementation of jjf

A TUI revision picker for jujutsu (jj). Wraps any jj subcommand with an
inline fuzzy-finder over jj log, then forwards the picked revision(s)
as -r '<id>' to the underlying jj invocation.

Features:
- Inline viewport (no full-screen alt-screen takeover)
- Smart prefix matching: typing the bold portion of a change ID jumps
  to that revision instantly
- Multi-select via Tab; emitted as -r 'A|B|C' revset union
- Preflight detection of subcommands that don't accept -r
- Optional shell integration (jjf init <bash|zsh|fish|nu>) that
  rewrites shell history so up-arrow recalls the resolved jj command

Hand-rolled ANSI rendering to /dev/tty; only crossterm, nucleo-matcher,
anyhow, and libc as runtime dependencies.
This commit is contained in:
swaits committed 2026-04-29 15:58:55 -06:00
commit ed801c80ee
11 files changed
+1325

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
jjf() {
# Meta-commands and bare flags bypass the picker and run the binary directly.
if [ $# -eq 0 ] || [ "$1" = "init" ] || [ "${1#-}" != "$1" ]; then
command jjf "$@"
return $?
fi
local _jjf_cmd
_jjf_cmd="$(command jjf --emit "$@")" || return $?
[ -n "$_jjf_cmd" ] || return 130
print -s -- "$_jjf_cmd"
sh -c "$_jjf_cmd"
}
# Suppress zsh from recording `jjf …` invocations; jjf appends the resolved
# jj command itself via `print -s`.
autoload -Uz add-zsh-hook 2>/dev/null
_jjf_zshaddhistory() {
case "$1" in
jjf\ *|jjf$'\n'*) return 1 ;;
esac
return 0
}
if typeset -f add-zsh-hook >/dev/null; then
add-zsh-hook zshaddhistory _jjf_zshaddhistory
fi