Skip to content
Docs / Automatic build logs

Build logs

Automatic build logs

Install a git hook once, and every commit you make in that repository ends with Kairo offering you a build log.

Turn it on with kairo install#

Run it once, inside the repository:

kairo install
✓ Installed. Kairo will offer a build log after each commit here.

  Hook    .git/hooks/post-commit

  After each commit, `kairo review` drafts a build log in this terminal.
  Nothing is published until you press P and confirm.

  Skip once   KAIRO_SKIP_HOOK=1 git commit …
  Remove      kairo uninstall

It installs a post-commit hook for this repository only. Run it again in each repository you want it in.

What happens after every commit#

After git commit
  1. git commit

    The commit is made first, as usual

  2. post-commit hook runs

    Kairo's section of it

  3. kairo review

    In the same terminal

  4. Draft, preview, edit

    Exactly as with a manual review

  5. Publish or discard

    Your choice

In order, the hook:

  1. Stops quietly if KAIRO_SKIP_HOOK=1 is set.
  2. Stops if kairo isn’t on your PATH, printing kairo: not found on PATH, so no build log review for this commit.
  3. Stops quietly if a rebase or cherry-pick is writing commits one after another.
  4. Stops quietly if there’s no terminal to review in — an editor’s commit button, CI.
  5. Otherwise, runs kairo review in your terminal. From there it’s the same flow as running it by hand.

In a hurry?

You don’t have to deal with the draft right away. Press Ctrl+C: nothing is published, and the draft is saved. Run kairo review whenever you’re ready and it opens again. See Draft recovery.

Skip it for one commit#

Set KAIRO_SKIP_HOOK=1 for that commit:

macOS, Linux, Git Bash
KAIRO_SKIP_HOOK=1 git commit -m "wip"
Windows PowerShell
$env:KAIRO_SKIP_HOOK = "1"; git commit -m "wip"; Remove-Item Env:KAIRO_SKIP_HOOK

Rebases and cherry-picks are skipped automatically, so you won’t be asked about every replayed commit. Run kairo review afterwards to review the result.

Turn it off with kairo uninstall#

kairo uninstall
✓ Uninstalled. Removed .git/hooks/post-commit, which only held Kairo's hook.

It removes Kairo’s section of the hook and nothing else. If that section was the whole file, the file is deleted too — installing and then uninstalling leaves the repository exactly as it was.

If you already have a post-commit hook#

The hook file isn’t only Kairo’s, so it’s treated carefully:

  • Your hooks stay. Kairo adds a fenced section just under the first line and touches nothing else. It runs in a subshell, so it can’t change anything your part of the hook relies on.
  • Running it twice changes nothing. A newer CLI updates its own section in place.
  • Hooks in another language are left alone. Kairo won’t paste shell into a Python or Node hook; it tells you to have your hook run kairo review itself instead.
  • It finds the right file. It follows core.hooksPath, linked worktrees and husky (.husky/post-commit).

Kairo’s section is marked so you can recognise it:

.git/hooks/post-commit
#!/bin/sh
# >>> kairo post-commit >>>
# Added by `kairo install`. `kairo uninstall` removes this section and
# nothing else. …
# <<< kairo post-commit <<<