Skip to content

fix: declare antigravity-cli Stop hook in the flat form agy accepts - #1240

Open
rubenmarcus wants to merge 1 commit into
mksglu:nextfrom
rubenmarcus:fix/antigravity-stop-hook-flat
Open

rubenmarcus wants to merge 1 commit into
mksglu:nextfrom
rubenmarcus:fix/antigravity-stop-hook-flat

Conversation

@rubenmarcus

Copy link
Copy Markdown

Fixes #1206

What / Why / How

agy rejects the whole plugin hooks.json when Stop carries the grouped matcher/hooks wrapper, so no context-mode hook ever runs under agy. The filer's log line: failed to parse hooks for plugin ...: invalid hook "hooks": command hook must specify 'command', reproduced on agy 1.2.11. agy's bundled docs table groups only PreToolUse/PostToolUse; Stop must be a flat list of handler objects.

Three changes, exactly the files #1206 enumerates:

  • configs/antigravity-cli/hooks.json and configs/antigravity-cli/hooks/hooks.json: Stop is now [{ "type": "command", "command": "context-mode hook antigravity-cli stop" }], no wrapper. PreToolUse/PostToolUse stay grouped.
  • src/adapters/antigravity-cli/index.ts: desiredStop is written flat, so context-mode upgrade repairs existing installs (a legacy grouped Stop is filtered out and replaced, same command). hookEntryHasCommand now also accepts a handler object whose command matches directly, so ctx_doctor recognizes the flat form in both profiles.
  • tests/adapters/antigravity.test.ts: the grouped-form assertions moved to the flat contract, plus a rewrite test that feeds a legacy grouped Stop through configureAllHooks, and a plugin-profile validateHooks case that must report best-effort Stop hook also configured.

Affected platforms

  • Claude Code
  • Cursor
  • VS Code Copilot (GitHub Copilot)
  • JetBrains Copilot
  • Gemini CLI
  • Qwen Code
  • OpenCode
  • KiloCode
  • Codex CLI
  • OpenClaw (Pi Agent)
  • Pi
  • Kiro
  • Antigravity
  • Zed
  • All platforms

Test plan

# next (4621364), new assertions first
Tests  5 failed | 32 passed   # tests/adapters/antigravity.test.ts

# this branch (a8b8261)
Tests  37 passed (37)         # tests/adapters/antigravity.test.ts

tests/hooks/antigravity-cli-hooks.test.ts (runtime dispatch) is 5 failed / 6 passed on this machine, identical on pristine next: no session DB created in the spawned hook process, the failures predate this change. No path handling touched, so no Windows-path risk.

Checklist

  • Tests added/updated (TDD: red → green)
  • npm test passes (touched suite green; environmental failures identical on base, see test plan)
  • npm run typecheck passes
  • Docs updated if needed (README, platform-support.md)
  • No Windows path regressions (forward slashes only)
  • Targets next branch (unless hotfix)

Prepared with AI assistance (GLM 5.3 via Oh My Pi) and reviewed before submission.

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