feat: antigravity hooks platform fix - #123
Open
priyamkarn wants to merge 4 commits into
Open
Conversation
Contributor
Author
|
@kushalpatil07 can you please review and merge this |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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