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
@@ -109,6 +109,39 @@ class InstallOptionsTests(unittest.TestCase):
|
||||
self.assertNotIn('qmd-warm', result)
|
||||
self.assertNotIn('hooks.SessionStart', result)
|
||||
|
||||
def test_codex_merge_registers_impeccable_hooks_once(self):
|
||||
managed = (ROOT / 'adapters/codex/config/config.toml').read_text(encoding='utf-8')
|
||||
managed = managed.replace('__IMPECCABLE_HOOK_SCRIPT__', 'invoke-impeccable-hook.sh')
|
||||
merged = OPTIONS.merge_toml(OPTIONS.merge_toml('', managed), managed)
|
||||
hooks = tomllib.loads(merged)['hooks']
|
||||
impeccable = lambda groups: [group for group in groups if 'impeccable-hook' in group['hooks'][0]['command']]
|
||||
self.assertEqual(1, len(impeccable(hooks['PostToolUse'])))
|
||||
self.assertEqual('Edit|Write|apply_patch', impeccable(hooks['PostToolUse'])[0]['matcher'])
|
||||
self.assertEqual(1, len(impeccable(hooks['Stop'])))
|
||||
|
||||
def test_impeccable_hook_wrappers_forward_event_or_are_noops(self):
|
||||
scripts = ROOT / 'shared/hooks/scripts'
|
||||
shells = [(shutil.which('bash'), [], 'invoke-impeccable-hook.sh', 'impeccable', 'printf "%s:" "$1"; cat\n')]
|
||||
if os.name == 'nt':
|
||||
shells.append((shutil.which('powershell'), ['-NoProfile', '-ExecutionPolicy', 'Bypass', '-File'],
|
||||
'Invoke-ImpeccableHook.ps1', 'impeccable.cmd', '@echo off\r\n<nul set /p=%1:\r\nmore\r\n'))
|
||||
for executable, arguments, name, launcher_name, launcher_body in shells:
|
||||
if not executable:
|
||||
continue
|
||||
with self.subTest(shell=name), tempfile.TemporaryDirectory() as directory:
|
||||
home = Path(directory)
|
||||
env = dict(os.environ, HOME=str(home), USERPROFILE=str(home), CODEX_HOME=str(home / '.codex'))
|
||||
run = lambda: subprocess.run([executable, *arguments, str(scripts / name)], input='{"event":1}',
|
||||
env=env, capture_output=True, text=True, timeout=60)
|
||||
result = run()
|
||||
self.assertEqual((0, ''), (result.returncode, result.stdout), result.stderr)
|
||||
launcher = home / '.agents/skills/impeccable/scripts' / launcher_name
|
||||
launcher.parent.mkdir(parents=True)
|
||||
launcher.write_text(launcher_body, newline='')
|
||||
result = run()
|
||||
self.assertEqual(0, result.returncode, result.stderr)
|
||||
self.assertEqual('hook:{"event":1}', result.stdout.strip())
|
||||
|
||||
def test_instruction_line_only_with_semantic_search(self):
|
||||
text = 'Line one.\nWhen `semantic-search` is installed, run it first.\nLine three.\n'
|
||||
self.assertEqual(OPTIONS.filter_instructions(text, False), 'Line one.\nLine three.\n')
|
||||
|
||||
Reference in new issue
Block a user