Skip to content

Repository files navigation

Hunk Git Lite

Git staging for Hunk's TUI — a Status pane and stage/unstage commands, so you can act on a review without leaving it.

Status: fully working. The Status pane shows both the Unstaged and Staged sections live, is fully navigable by keyboard and mouse, and x / Extensions → Stage all / Unstage all all really stage/unstage (renames excepted for x — see below). See CONTEXT.md for the vocabulary this extension uses (Status pane, Unstaged/Staged sections), and docs/adr/ for the reasoning behind its hard-to-reverse design decisions.

Install

Hunk 0.19 or newer installs extensions directly from Git:

hunk extension install joshedler/hunk-git-lite

New Hunk sessions load it automatically.

Develop

Hunk serves React, OpenTUI, and hunkdiff/extension at runtime — this repo keeps them as dev-only dependencies and ships TypeScript source directly, no build step.

bun install
bun run check
hunk diff --extension /path/to/hunk-git-lite

--extension loads immediately with no trust prompt — it's the iteration path. See Hunk's extension guide for the public API and trust model.

bun run check's test suite has two tiers: fast pure-function unit tests, and integration tests (git.integration.test.ts) that run this extension's actual git-facing functions against a real repo created fresh in a temp directory per test — proving git itself still behaves the way the unit tests assume, not just that our parsers agree with themselves. The integration tier needs git on PATH; nothing else beyond what bun install already sets up.

Use

  • ctrl+t — toggle the Status pane
  • ctrl+u / ctrl+d — move the Status pane's own cursor through its full list (Unstaged then Staged, one combined list, no wrap-around at either end). While the cursor's in Unstaged, this is exactly Hunk's own ,/. file navigation; crossing into Staged moves independently, since staged files aren't part of Hunk's own selection model
  • Bare ,/. and mouse clicks work as normal, and the Status pane's highlighted row follows along automatically
  • x — toggle stage/unstage on the selected file (git add/git reset). A rename can't be toggled this way — staging or unstaging only the one path a rename row represents doesn't register as a rename at the index level, it just splits into an unrelated-looking add/delete — so x on one notifies "Rename toggling is unsupported." instead of acting. Deletes work normally.
  • Extensions → Stage all / Extensions → Unstage all — no default key; asks for confirmation first, showing how many files it's about to touch (git add -A, or a bare git reset). Staging everything at once needs no rename guard — both a rename's paths land in the same command, so git still detects it as a rename rather than splitting it.

The built-in files pane may open the first time you open this one

On a terminal narrower than 220 columns, Hunk's own files pane starts internally "open" but invisible. The first pane you open of any kind — the files pane itself via s, or this extension's Status pane — reveals the whole sidebar area at once, so whichever pane was already sitting open-but-hidden appears alongside it. This is Hunk's own behavior, not specific to this extension (Hunk's official pane-layout and review-triage example extensions do the same thing).

If this bothers you, set sidebar = false under [view] in your Hunk config — it makes the files pane start genuinely closed instead of open-but-hidden, so it can't pop open unannounced.

Manage

hunk extension update hunk-git-lite
hunk extension remove hunk-git-lite

Pin a release when you want updates to stay on a specific version:

hunk extension install joshedler/hunk-git-lite@v0.1.0

How did you write this?

I wrote this using a Claude Code agent using the Sonnet 5 model. The agent did most of the work, from researching feasibility to walking through an agreed-upon approach to development and testing. I got to use the tools and this extension along the way.

The initial design went through a structured interview process before any code was written. The /grilling and /domain-modeling skills from Matt Pocock's mattpocock-skills Claude Code plugin were used to turn a vague idea into a settled design along with a domain glossary (CONTEXT.md). The hard-to-reverse decisions that came out of it are recorded in docs/adr/.

Implementation leaned on real Hunk extensions as reference, not just the public docs: hunk-hg and hunk-lens (both modem-dev's own), plus the official review-triage example bundled with Hunk itself.

Before each commit, the AI agent was tasked with a privacy audit to ensure nothing gets published that doesn't need to be exposed to the public.

Why did you write this?

I like to accumulate changes when directing my AI because it tends to go off and do things I don't like at times, and I don't want to give it a whole bunch of tasks that I then have to spend a long time reviewing and correcting. Quick changes > review > stage as a form of approval > Repeat.

I recently learned about hunk, it simplifies my workflow with my AI agents in the terminal, and it was missing this ability. Since it supports extensions, this seemed like a great learning opportunity.

"But I need it to do X."

This repo is named hunk-git-lite for a reason. Feel free to create, borrow, extend as you need. I encourage anyone to publish what might help others, even if it's something as simple as a repo like this.

License

MIT

About

Adds a status pane with git stage/unstage commands to Hunk's TUI.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages