feat(plugins): enable Impeccable hooks for Codex and trim extensions
- Register Impeccable's design-detector PostToolUse and Stop hooks in the Codex config through new no-op-safe wrappers; Claude already gets them from the Impeccable plugin. - Make Caveman Claude-only: a '-' codex_method marks Claude-only entries, which the Codex selector omits and sync removes from owned Codex installs. Drop the thinkhome Caveman Windows hook repair. - Remove Anthropic Frontend Design from the manifest, plugin workflow, and docs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
eb7cecaaa2
commit
f7222a90c2
20 files changed
+109
-95
No files matched your search
@@ -224,55 +224,14 @@ class ManagedExtensionTests(unittest.TestCase):
|
||||
self.manager().sync([plugin()], ['claude'], {'Example'})
|
||||
self.assertEqual(3, command.call_count)
|
||||
|
||||
@unittest.skipUnless(os.name == 'nt', 'Windows hook compatibility')
|
||||
def test_owned_caveman_hook_repair_runs_in_powershell_and_is_idempotent(self):
|
||||
entry = dict(plugin('Caveman'), codex_plugin='caveman@thinkhome-caveman')
|
||||
root = self.home / '.codex/plugins/cache/thinkhome-caveman/caveman/1.0.0'
|
||||
path = root / 'hooks/hooks.json'
|
||||
path.parent.mkdir(parents=True)
|
||||
hook = {'type': 'command', 'command': 'unchanged',
|
||||
'commandWindows': 'node "%PLUGIN_ROOT%\\hooks\\caveman-hook.mjs"'}
|
||||
path.write_text(json.dumps({'hooks': {event: [{'hooks': [dict(hook)]}]
|
||||
for event in ['SessionStart', 'UserPromptSubmit', 'SubagentStart']}}))
|
||||
upstream = path.read_bytes()
|
||||
self.manager().sync([entry], ['codex'], {'Caveman'})
|
||||
repaired = path.read_bytes()
|
||||
for groups in json.loads(repaired)['hooks'].values():
|
||||
self.assertNotIn('%PLUGIN_ROOT%', groups[0]['hooks'][0]['commandWindows'])
|
||||
self.assertEqual('unchanged', groups[0]['hooks'][0]['command'])
|
||||
self.manager().sync([entry], ['codex'], {'Caveman'})
|
||||
self.assertEqual(repaired, path.read_bytes())
|
||||
path.write_bytes(upstream)
|
||||
self.manager(update=True).sync([entry], ['codex'], {'Caveman'})
|
||||
self.assertEqual(repaired, path.read_bytes())
|
||||
if not shutil.which('node'):
|
||||
self.skipTest('Node is unavailable for launcher execution')
|
||||
(root / 'hooks/caveman-hook.mjs').write_text("process.stdout.write('hook-ok');")
|
||||
command = json.loads(repaired)['hooks']['SessionStart'][0]['hooks'][0]['commandWindows']
|
||||
result = subprocess.run(['powershell', '-NoProfile', '-Command', command],
|
||||
env=dict(os.environ, PLUGIN_ROOT=str(root)), capture_output=True, text=True, timeout=10)
|
||||
self.assertEqual(0, result.returncode, result.stderr)
|
||||
self.assertEqual('hook-ok', result.stdout)
|
||||
|
||||
@unittest.skipUnless(os.name == 'nt', 'Windows hook compatibility')
|
||||
def test_caveman_repair_preserves_foreign_and_custom_hooks_and_dry_runs(self):
|
||||
entry = dict(plugin('Caveman'), codex_plugin='caveman@thinkhome-caveman')
|
||||
path = self.home / '.codex/plugins/cache/thinkhome-caveman/caveman/1.0.0/hooks/hooks.json'
|
||||
path.parent.mkdir(parents=True)
|
||||
original = json.dumps({'hooks': {'SessionStart': [{'hooks': [{'commandWindows':
|
||||
'node "%PLUGIN_ROOT%\\hooks\\caveman-hook.mjs"'}]}]}}).encode()
|
||||
path.write_bytes(original)
|
||||
self.installed['codex'][entry['codex_plugin']] = {}
|
||||
self.manager().sync([entry], ['codex'], {'Caveman'})
|
||||
self.assertEqual([], self.manager().state['resources'])
|
||||
self.assertEqual(original, path.read_bytes())
|
||||
self.installed['codex'].clear()
|
||||
self.manager(dry_run=True).sync([entry], ['codex'], {'Caveman'})
|
||||
self.assertEqual(original, path.read_bytes())
|
||||
original = b'{"hooks":{"SessionStart":[{"hooks":[{"commandWindows":"custom"}]}]}}'
|
||||
path.write_bytes(original)
|
||||
self.manager().sync([entry], ['codex'], {'Caveman'})
|
||||
self.assertEqual(original, path.read_bytes())
|
||||
def test_claude_only_entry_removes_owned_codex_install_and_keeps_claude(self):
|
||||
self.manager().sync([plugin('Caveman')], ['claude', 'codex'], {'Caveman'})
|
||||
installed = len(self.commands)
|
||||
claude_only = dict(plugin('Caveman'), codex_method='-', codex_plugin='-')
|
||||
for action in ('install', 'sync'):
|
||||
self.manager().sync([claude_only], ['claude', 'codex'], {'Caveman'}, action)
|
||||
self.assertEqual([['codex', 'plugin', 'remove', 'caveman@test']], [c for c in self.commands[installed:] if c[0] == 'codex'])
|
||||
self.assertEqual(['claude'], [r['client'] for r in self.manager().state['resources']])
|
||||
|
||||
def test_dry_run_summary_has_one_line(self):
|
||||
with contextlib.redirect_stdout(io.StringIO()) as output:
|
||||
|
||||
Reference in new issue
Block a user