Skip to content

feat(gemini): Gemini CLI plan review integration#384

Open
backnotprop wants to merge 3 commits intomainfrom
feat/gem-cli
Open

feat(gemini): Gemini CLI plan review integration#384
backnotprop wants to merge 3 commits intomainfrom
feat/gem-cli

Conversation

@backnotprop
Copy link
Owner

Summary

  • Adds apps/gemini-hook/ — a thin adapter that enables Plannotator plan review for Gemini CLI via the BeforeTool hook system
  • Reads plan file from disk (Gemini provides plan_path, not inline content), delegates to shared @plannotator/server, translates decision to Gemini's hook output format
  • Install script updated to download Gemini binary, install policy TOML to ~/.gemini/policies/, and configure ~/.gemini/settings.json

How it works

  1. User policy (plannotator.toml) grants allow for exit_plan_mode → skips TUI dialog
  2. BeforeTool hook fires → plannotator-gemini binary starts
  3. Adapter reads plan from disk, opens Plannotator review UI in browser
  4. User approves/denies with annotations → decision returned to Gemini as hook output
  5. On deny: model receives structured feedback via planDenyFeedback(), revises plan

Depends on upstream fix: google-gemini/gemini-cli#21802 (merged)

Test plan

  • echo '<BeforeTool JSON>' | bun run apps/gemini-hook/server/index.ts opens browser with plan
  • Approve → stdout is {}
  • Deny with feedback → stdout is {"decision":"deny","reason":"YOUR PLAN WAS NOT APPROVED..."}
  • End-to-end with patched Gemini CLI: /plan → task → plan appears in browser → approve/deny works

Adds a new `apps/gemini-hook/` adapter that enables Plannotator plan
review for Gemini CLI users via the BeforeTool hook system.

The adapter reads the plan file from disk (Gemini provides a path, not
inline content), delegates to the shared @plannotator/server for the
browser-based review UI, and translates the decision back into Gemini's
hook output format.

Requires an upstream fix (google-gemini/gemini-cli#21802) that makes
`decision = "allow"` user policies work for exit_plan_mode, allowing
hooks to replace the built-in TUI approval dialog.

Includes:
- apps/gemini-hook/server/index.ts — stdin/stdout adapter
- apps/gemini-hook/hooks/ — policy TOML + settings snippet
- scripts/install.sh — Gemini binary download, policy install, settings config

For provenance purposes, this commit was AI assisted.
…parate app

Removes apps/gemini-hook/ — the plannotator binary now auto-detects
Gemini CLI from stdin (plan_path = file on disk) vs Claude Code
(plan = inline content) and branches input parsing + output formatting.

Config fixtures live in apps/gemini/ (policy TOML + settings snippet).
Install script gates on ~/.gemini existing so Claude-only users are
unaffected.

For provenance purposes, this commit was AI assisted.
Three modes:
- --simulate: pipes BeforeTool JSON to hook, tests approve/deny output
- (default): runs local patched Gemini build
- --nightly: installs Gemini nightly and runs it

Backs up and restores ~/.gemini config on exit.

For provenance purposes, this commit was AI assisted.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant