Repository navigation
feat(antigravity): add PreToolUse command-wrapping hook and installer support - #56
Conversation
|
@boxxxie is attempting to deploy a commit to the jaypokale35gmailcom's projects Team on Vercel. A member of the Team first needs to authorize it. |
3629b5c to
195646d
Compare
JayPokale
left a comment
There was a problem hiding this comment.
Thanks for this. Bringing the command filters to Antigravity is a welcome addition, and the PR is careful: the hooks.json merge validates before writing and leaves a broken file untouched, --state-dir keeps stats out of ~/.claude, and the copied hook set is complete. It merges cleanly with current main and the full suite passes (271/271).
A few things before it can go in:
-
Hook protocol reference. Nothing in this repo documents Antigravity's hook API, so I can't verify the payload shape (
toolCall.name === 'run_command',args.CommandLine), the{ "decision": "ask", "overwrite": { ... } }response, thehooks.jsonlayout with a namedchislegroup, or that hooks run with.agents/as the working directory. If any of these is off, the hook silently does nothing. Could you link Antigravity's hook documentation (and theagyversion you tested with), or paste a short session log showing a wrappednpm test? -
Deny/ask rules. On the Claude Code path,
guardedPrograms()skips any command the user has listed underpermissions.denyorpermissions.ask, because rewriting the command string can stop those rules from matching. The Antigravity path rewrites unconditionally. A user who deniesnpm installin Antigravity could have it rewritten tonode …/chisle-run.js --state-dir … -- npm install, which may no longer match the deny rule; withdecision: "ask"that becomes a prompt instead of a block. Please apply the same guard against Antigravity's permission configuration, or skip the rewrite when a rule could match. -
Prompt on every wrapped command. Returning
askkeeps the permission gate, which is right, but if Antigravity matches its always-allow list against the overwrittenCommandLine, users who auto-allowednpm testwould be prompted on every run. Can you confirm which string Antigravity checks? -
Uninstall vs. install. The installer preserves sibling hooks inside
hooks.chisle.PreToolUse(theecho siblingtest), but uninstall deletes the wholehooks.chislegroup, so those siblings would be lost. Either treat the group as Chisle-owned on both sides, or have uninstall remove only Chisle's entry. -
Smaller points:
- The hook files copied into
.agents/chisle-hooks/go stale after a Chisle upgrade until the installer is rerun, and users may commit them. A note in the install output or docs would help. docs/usage.mdstill says Antigravity receives the ruleset only; please update it, and add a CHANGELOG entry.
- The hook files copied into
Happy to take another look once these are addressed.
|
ok, i'll review all of these tomorrow and see how much closure i can bring to the issues you bring up. |
…ons, uninstall, and docs Addresses review comments on JayPokale#56: - Gate Antigravity PreToolUse command wrapping on toolPermission === 'always-proceed' (or CHISLE_COMPRESS_WRAP=1) so Always-Allow rules are not broken by rewritten CommandLine strings. - Skip rewriting programs guarded by permissions.deny or permissions.ask (command/unsandboxed rules, including * and regex:) in ~/.gemini/antigravity-cli/settings.json. - Link Antigravity hooks and permissions documentation in hooks/chisle-run.js. - Preserve sibling hooks inside hooks.chisle.PreToolUse on --uninstall instead of deleting the entire hooks.chisle group. - Print a note during install that .agents/chisle-hooks/ is a local copy to refresh on Chisle upgrades, and update docs/usage.md, docs/agent-portability.md, and CHANGELOG.md.
|
Thanks for the thorough review — addressed all five points in
|
JayPokale
left a comment
There was a problem hiding this comment.
Thanks, all five points are addressed: the docs link and agy 1.5.17 test, the deny/ask guard, the always-proceed gate, symmetric uninstall, and docs plus CHANGELOG. Merged with current main, the full suite passes (272/272).
Summary
hooks/chisle-run.js: Support Antigravity (agy)PreToolUsepayloads (toolCall.name === 'run_command',toolCall.args.CommandLine) and emit{"decision":"ask","overwrite":{"CommandLine":...}}for wrappable test/build/install commands, passing--state-dir <getAntigravityDir()>before--so stats/spill files land in~/.gemini/configeven when~/.claudeexists.hooks/chisle-config.js: AddgetAntigravityDir()($AGY_CONFIG_DIRor~/.gemini/config).bin/install.js: AddinstallAntigravity()so--only antigravityinstalls.agents/rules/chisle.md, copies the runner/compressor into.agents/chisle-hooks/, and safely merges achislePreToolUsehook into.agents/hooks.json(validating existing JSON objects before any writes); wire--stats --only antigravitytogetAntigravityDir().tests/test_run.js&tests/test_installer.js: Add unit/integration tests for AntigravityPreToolUserewrites (including compound commands and--state-dirrouting) and.agents/hooks.jsonmerge/validation.Verification
node --test tests/test_run.js tests/test_installer.js: 45/45 passing.