Skip to content

feat: antigravity hooks platform fix - #123

Open
priyamkarn wants to merge 4 commits into
Autoloops:mainfrom
priyamkarn:feat/antigravity-hooks-platform-fix
Open

feat: antigravity hooks platform fix#123
priyamkarn wants to merge 4 commits into
Autoloops:mainfrom
priyamkarn:feat/antigravity-hooks-platform-fix

Conversation

@priyamkarn

Copy link
Copy Markdown
Contributor

Extends the Antigravity platform installer beyond skills-only to also wire up the Stop hook, so Greplica's background working-memory update fires when an Antigravity session ends.
What changed

libs/install/platforms/antigravity.ts — when context.hooks is true, writes a namespaced Stop entry into project-local .agents/hooks.json (keyed under greplica, alongside any other tool's own top-level key) pointing at a generated wrapper script, since Antigravity's command field must be an absolute path to an executable file rather than a shell string with args.
The wrapper (.agents/hooks/greplica-stop.sh / .cmd) always exits 0 regardless of the inner command's result — Stop isn't a gating/veto-capable event in Antigravity, but the wrapper doesn't rely on that alone, mirroring a real cmux bug where a non-zero exit from a non-gating hook ended up blocking tool calls.
apps/cli/main.ts — added antigravity to the hook ingest usage string (already present on install's usage line, just missed here).
scripts/check-antigravity-hooks.js — new check covering: hooks written on first install, no duplicate entries on reinstall, other tools' namespaces left untouched, and both a structural and behavioral check that the wrapper exits 0 even when the wrapped command fails.
package.json — wired check-antigravity-hooks.js into the npm test chain (it existed but wasn't being run).

Scope / what's deliberately left out

Only Stop is wired up. It's the one event consistent across every source (official docs, real integrations, bug reports) with no contradictions. SessionStart is skipped — some real hooks.json dumps show it but Google's own documented event list doesn't, and that's not worth resolving since Stop alone covers what Greplica needs.
If process.argv[1] is undefined (no resolvable entrypoint), hooks are skipped rather than writing something broken — skills still install.

Testing

npm run build — clean
npm test — passing, including the new Antigravity check
Manually verified: reinstall doesn't duplicate the greplica.Stop entry, and a hand-inserted cmux namespace survives untouched across installs

@priyamkarn priyamkarn changed the title Feat/antigravity hooks platform fix feat: antigravity hooks platform fix Jul 7, 2026
@priyamkarn

Copy link
Copy Markdown
Contributor Author

@kushalpatil07 can you please review and merge this

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