Skip to content

Commit 4dad14f

Browse files
authored
Avoid Gemini loading Claude hook events (#139)
1 parent 0ac987f commit 4dad14f

7 files changed

Lines changed: 31 additions & 5 deletions

File tree

‎.claude-plugin/plugin.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
"author": {
66
"name": "Dietrich Gebert",
77
"url": "https://github.com/DietrichGebert"
8-
}
8+
},
9+
"hooks": "./hooks/claude-codex-hooks.json"
910
}

‎.codex-plugin/plugin.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"license": "MIT",
1212
"keywords": ["yagni", "minimalism", "code-review", "productivity"],
1313
"skills": "./skills/",
14+
"hooks": "./hooks/claude-codex-hooks.json",
1415
"interface": {
1516
"displayName": "Ponytail",
1617
"shortDescription": "Lazy senior developer mode",

‎README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ gemini extensions install https://github.com/DietrichGebert/ponytail
163163
```
164164

165165
Loads the ruleset as always-on context every session and registers the `/ponytail` commands; the `skills/` ship too, activated when a task needs them.
166+
The Gemini adapter intentionally does not ship a root `hooks/hooks.json`: Gemini auto-loads that path, while Ponytail's lifecycle hooks use Claude/Codex event names.
166167

167168
### Antigravity CLI
168169

‎docs/agent-portability.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ to load in a given agent.
88

99
| Host | Files | Notes |
1010
|------|-------|-------|
11-
| Claude Code | `.claude-plugin/`, `commands/`, `hooks/` | Full plugin install with session activation, mode tracking, commands, and statusline support. |
12-
| Codex | `.codex-plugin/plugin.json`, `hooks/hooks.json`, `hooks/`, `skills/` | Plugin install with the same skills plus lifecycle hooks for activation and mode tracking. |
11+
| Claude Code | `.claude-plugin/plugin.json`, `commands/`, `hooks/claude-codex-hooks.json`, `hooks/` | Full plugin install with session activation, mode tracking, commands, and statusline support. |
12+
| Codex | `.codex-plugin/plugin.json`, `hooks/claude-codex-hooks.json`, `hooks/`, `skills/` | Plugin install with the same skills plus lifecycle hooks for activation and mode tracking. |
1313
| OpenCode | `.opencode/plugins/ponytail.mjs`, `.opencode/command/`, `hooks/`, `skills/` | Server plugin injects the ruleset each turn via `experimental.chat.system.transform` and persists `/ponytail` switches; reuses the shared instruction builder. |
1414
| pi | `pi-extension/`, `skills/`, `hooks/` | Package extension: injects the ruleset each turn through the shared instruction builder and registers the `/ponytail` commands. |
15-
| Gemini CLI | `gemini-extension.json`, `AGENTS.md`, `commands/`, `skills/` | Extension manifest points `contextFileName` at `AGENTS.md` for always-on rules, and reuses the existing `commands/*.toml` and `skills/`, which Gemini CLI auto-discovers. |
15+
| Gemini CLI | `gemini-extension.json`, `AGENTS.md`, `commands/`, `skills/` | Extension manifest points `contextFileName` at `AGENTS.md` for always-on rules, and reuses the existing `commands/*.toml` and `skills/`, which Gemini CLI auto-discovers. The Claude/Codex hook map is not placed at Gemini's auto-discovered `hooks/hooks.json` path. |
1616
| Cursor | `.cursor/rules/ponytail.mdc` | Always-on project rule. |
1717
| Windsurf | `.windsurf/rules/ponytail.md` | Project rule. |
1818
| Cline | `.clinerules/ponytail.md` | Project rule. |

‎tests/gemini-extension.test.js‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ const VERSIONED_MANIFESTS = [
2525
// Gemini auto-discovers these by directory; the manifest is only useful if they exist.
2626
const REUSED_COMMANDS = ['commands/ponytail.toml', 'commands/ponytail-review.toml'];
2727
const REUSED_SKILLS = ['skills/ponytail/SKILL.md'];
28+
// Gemini CLI auto-loads this exact path for extension hooks. Ponytail's
29+
// Claude/Codex hook map uses events Gemini does not support, so it must stay
30+
// behind the host-specific plugin manifests instead.
31+
const GEMINI_AUTO_HOOKS = 'hooks/hooks.json';
2832
// Same load-bearing phrases asserted by scripts/check-rule-copies.js: the file
2933
// contextFileName points at must actually carry the rules, not just exist.
3034
const RULE_INVARIANTS = [
@@ -77,3 +81,11 @@ test('the commands and skills the adapter reuses are present', () => {
7781
assert.ok(fs.existsSync(path.join(root, rel)), `reused file missing: ${rel}`);
7882
}
7983
});
84+
85+
test('Gemini cannot auto-discover Claude/Codex hook events', () => {
86+
assert.equal(
87+
fs.existsSync(path.join(root, GEMINI_AUTO_HOOKS)),
88+
false,
89+
`${GEMINI_AUTO_HOOKS} is auto-loaded by Gemini CLI; keep Claude/Codex hooks on manifest paths`,
90+
);
91+
});

‎tests/hooks-windows.test.js‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ const fs = require('fs');
1111
const path = require('path');
1212

1313
const root = path.join(__dirname, '..');
14-
const HOOKS_JSON = 'hooks/hooks.json';
14+
const HOOKS_JSON = 'hooks/claude-codex-hooks.json';
15+
const HOST_PLUGIN_MANIFESTS = [
16+
'.claude-plugin/plugin.json',
17+
'.codex-plugin/plugin.json',
18+
];
1519
// cmd.exe variable syntax (%FOO%); PowerShell leaves it literal, breaking the path.
1620
const CMD_VAR_SYNTAX = /%[A-Za-z_][A-Za-z0-9_]*%/;
1721
// Pull the hooks/<script> a command launches, so we can check it exists.
@@ -46,3 +50,10 @@ test('every hook command points at a script that ships in hooks/', () => {
4650
}
4751
}
4852
});
53+
54+
test('Claude and Codex manifests point at the shared host-specific hook config', () => {
55+
for (const rel of HOST_PLUGIN_MANIFESTS) {
56+
const manifest = JSON.parse(fs.readFileSync(path.join(root, rel), 'utf8'));
57+
assert.equal(manifest.hooks, `./${HOOKS_JSON}`, `${rel} must not rely on root hooks auto-discovery`);
58+
}
59+
});

0 commit comments

Comments
 (0)