From f7222a90c227aa06465a6f57ba88419d369d78fb Mon Sep 17 00:00:00 2001 From: Julian Lechner Date: Mon, 16 Nov 2026 10:57:56 +0100 Subject: [PATCH] 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 --- README.md | 4 +- adapters/codex/config/config.toml | 16 ++++++ adapters/placeholders.tsv | 1 + adapters/plugins.tsv | 3 +- docs/plugins.md | 8 +-- scripts/lib/install-options.py | 2 +- scripts/lib/managed-extensions.py | 34 ++--------- scripts/lib/plugins.ps1 | 3 + scripts/lib/plugins.sh | 3 + scripts/tests/test-install-options.py | 33 +++++++++++ scripts/tests/test-managed-extensions.py | 57 +++---------------- scripts/tests/test-plugin-selection.ps1 | 5 +- scripts/tests/test-plugin-selection.sh | 1 + scripts/tests/test-quick-update.py | 6 +- scripts/tests/test-shell-packages.ps1 | 2 +- scripts/tests/test-shell-packages.sh | 2 +- shared/hooks/README.md | 2 + .../hooks/scripts/Invoke-ImpeccableHook.ps1 | 13 +++++ .../hooks/scripts/invoke-impeccable-hook.sh | 7 +++ shared/skills/plugin-workflow/SKILL.md | 2 +- 20 files changed, 109 insertions(+), 95 deletions(-) create mode 100644 shared/hooks/scripts/Invoke-ImpeccableHook.ps1 create mode 100644 shared/hooks/scripts/invoke-impeccable-hook.sh diff --git a/README.md b/README.md index d60df43..4392009 100644 --- a/README.md +++ b/README.md @@ -96,8 +96,8 @@ Install and update also rebuild internally; the explicit build above lets you ch - Separate install, update, and uninstall scripts: install refuses to run against an already-installed destination, update refuses to run against one that is not installed yet, and uninstall refuses to run against one that was never installed. -- User-level extension installation for Ponytail, i-have-adhd, Superpowers, Context7, Caveman, MCPorter, - Humanizer, Impeccable, Anthropic Frontend Design, and REA, with an interactive extension toggle during both install and update. Only extensions +- User-level extension installation for Ponytail, i-have-adhd, Superpowers, Context7, Caveman (Claude only), MCPorter, + Humanizer, Impeccable, and REA, with an interactive extension toggle during both install and update. Only extensions installed and recorded by this setup can be removed through deselection. - Optional local search for both clients through QMD with Qwen3-Embedding-4B, Qwen3-Reranker-4B, and QMD Query Expansion 1.7B (Yes/No/Auto; Auto benchmarks GPU, then CPU). diff --git a/adapters/codex/config/config.toml b/adapters/codex/config/config.toml index a846928..0c39512 100644 --- a/adapters/codex/config/config.toml +++ b/adapters/codex/config/config.toml @@ -48,3 +48,19 @@ type = "command" command = '__HOOK_COMMAND__ "__AI_CONFIG_ROOT__/hooks/scripts/__COMMAND_SAFETY_SCRIPT__"' command_windows = '__POWERSHELL_HOOK_COMMAND__ "__AI_CONFIG_ROOT__/hooks/scripts/__COMMAND_SAFETY_SCRIPT__"' timeout = 6 + +# Impeccable's design detector; the wrapper is a no-op unless the Impeccable Codex skill is installed. +[[hooks.PostToolUse]] +matcher = "Edit|Write|apply_patch" +[[hooks.PostToolUse.hooks]] +type = "command" +command = '__HOOK_COMMAND__ "__AI_CONFIG_ROOT__/hooks/scripts/__IMPECCABLE_HOOK_SCRIPT__"' +command_windows = '__POWERSHELL_HOOK_COMMAND__ "__AI_CONFIG_ROOT__/hooks/scripts/__IMPECCABLE_HOOK_SCRIPT__"' +timeout = 10 + +[[hooks.Stop]] +[[hooks.Stop.hooks]] +type = "command" +command = '__HOOK_COMMAND__ "__AI_CONFIG_ROOT__/hooks/scripts/__IMPECCABLE_HOOK_SCRIPT__"' +command_windows = '__POWERSHELL_HOOK_COMMAND__ "__AI_CONFIG_ROOT__/hooks/scripts/__IMPECCABLE_HOOK_SCRIPT__"' +timeout = 30 diff --git a/adapters/placeholders.tsv b/adapters/placeholders.tsv index 15e9e3b..7bd270f 100644 --- a/adapters/placeholders.tsv +++ b/adapters/placeholders.tsv @@ -11,5 +11,6 @@ __QMD_WARM_SCRIPT__ Start-QmdWarm.ps1 start-qmd-warm.sh __CORRECTION_PROMPT_SCRIPT__ Show-CorrectionPrompt.ps1 show-correction-prompt.sh __COMPLETION_EVIDENCE_SCRIPT__ Check-CompletionEvidence.ps1 check-completion-evidence.sh __COMMAND_SAFETY_SCRIPT__ Validate-CommandSafety.ps1 validate-command-safety.sh +__IMPECCABLE_HOOK_SCRIPT__ Invoke-ImpeccableHook.ps1 invoke-impeccable-hook.sh __SHELL_TOOL__ PowerShell Bash __SCRIPT_EXTENSION__ ps1 sh diff --git a/adapters/plugins.tsv b/adapters/plugins.tsv index bec71f8..8baa5c3 100644 --- a/adapters/plugins.tsv +++ b/adapters/plugins.tsv @@ -3,9 +3,8 @@ Ponytail DietrichGebert/ponytail ponytail@ponytail DietrichGebert/ponytail ponyt i-have-adhd ayghri/i-have-adhd i-have-adhd@i-have-adhd ayghri/i-have-adhd i-have-adhd@i-have-adhd plugin - - Superpowers anthropics/claude-plugins-official superpowers@claude-plugins-official openai-curated-remote superpowers@openai-curated-remote plugin - - Context7 upstash/context7 context7@context7-marketplace upstash/context7 context7@context7-marketplace plugin - - context7 https://mcp.context7.com/mcp -Caveman JuliusBrussee/caveman caveman@caveman thinkhome-org/caveman-codex caveman@thinkhome-caveman plugin - - +Caveman JuliusBrussee/caveman caveman@caveman - - - - - MCPorter - mcporter - mcporter cli mcporter - Humanizer blader/humanizer humanizer@humanizer - - skill blader/humanizer humanizer Impeccable pbakaus/impeccable impeccable@impeccable pbakaus/impeccable impeccable skill pbakaus/impeccable impeccable -Anthropic Frontend Design anthropics/claude-plugins-official frontend-design@claude-plugins-official - - skill anthropics/skills frontend-design REA morluto/rea rea@rea morluto/rea rea@rea plugin - - diff --git a/docs/plugins.md b/docs/plugins.md index a1ffb1a..f605c16 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -2,11 +2,11 @@ The user-level plugin manifest is `adapters/plugins.tsv`. It maps each logical extension to the client-specific plugin, skill, or MCP installation method. -The current baseline includes Ponytail, i-have-adhd, Superpowers, Context7, Caveman, MCPorter, Humanizer, Impeccable, Anthropic Frontend Design, and REA. Install and update operate at user scope and show an extension selector unless running a dry run or Quickupdate. Selections are collected before configuration changes. Both rebuild generated packages before synchronizing client files and extensions. Choosing Auto for local search can prepare and benchmark QMD earlier, during option selection. +The current baseline includes Ponytail, i-have-adhd, Superpowers, Context7, Caveman (Claude only), MCPorter, Humanizer, Impeccable, and REA. Install and update operate at user scope and show an extension selector unless running a dry run or Quickupdate. Selections are collected before configuration changes. Both rebuild generated packages before synchronizing client files and extensions. Choosing Auto for local search can prepare and benchmark QMD earlier, during option selection. ### Automatic workflow integration -The always-loaded general rules route both clients to the shared `plugin-workflow` skill for development tasks, on resume, and at phase changes; questions and prose-only changes skip it, and the general rules carry the core response style. The policy requires Superpowers at development phase boundaries, Ponytail for implementation and review, Impeccable for UI planning through verification, and i-have-adhd response structure with Caveman's concise style when available. Superpowers owns process; Ponytail constrains implementation to the smallest complete, verified change; Impeccable owns UI decisions; Frontend Design supplements uncovered needs without starting another workflow. User authorization, research gates, and proportionate checks retain precedence. +The always-loaded general rules route both clients to the shared `plugin-workflow` skill for development tasks, on resume, and at phase changes; questions and prose-only changes skip it, and the general rules carry the core response style. The policy requires Superpowers at development phase boundaries, Ponytail for implementation and review, Impeccable for UI planning through verification, and i-have-adhd response structure with Caveman's concise style when available. Superpowers owns process; Ponytail constrains implementation to the smallest complete, verified change; Impeccable owns UI decisions. User authorization, research gates, and proportionate checks retain precedence. The installed i-have-adhd 0.4.1 skill declares `disable-model-invocation: true`. The shared policy therefore supplies automatic response guidance without forcing a manual-only skill invocation or relying on its optional hook. It does not diagnose the user. Style stop commands persist through task changes and resume; `normal mode` disables i-have-adhd, Caveman, and Ponytail for the session. Explicit mode levels override defaults. Missing plugins are reported once and do not trigger installation. These are instruction-level requirements, not runtime interception or a guarantee of model compliance. Existing installations receive them through the normal configuration update; builds do not modify local plugin caches or hook trust. @@ -47,9 +47,7 @@ The check passes only if documentation retrieval returns relevant content with a Codex's local `plugins` and `marketplaces` tables survive configuration synchronization, along with other root keys, extra fields in managed tables, other unmanaged tables, and unowned array tables; changed files are backed up. Cached plugin files alone are not treated as proof of installation: selection uses the client CLI's installed list. If an older update removed the registrations, inspect the backed-up `config.toml` under `~/.codex/backups/` and reselect the affected plugins on the next update. -Codex receives Caveman through its native plugin adapter. Humanizer, Impeccable, and Anthropic Frontend Design are downloaded as skill payloads from the GitHub sources in the manifest, without running upstream installers. All three appear in the extension selector for Codex. Ownership is recorded in `~/.my-ai-configuration/extensions.json`. Skill files are tracked by hash; modified or foreign files are retained with a warning. Existing installations from before ownership tracking are not automatically adopted. - -On Windows, installation and update repair the known Caveman 1.0.0 hook launcher in setup-owned Codex installations so it resolves the plugin path under PowerShell as well as Command Prompt. Custom commands and foreign installations are preserved. Review the changed hook definitions in Codex `/hooks`; setup does not grant hook trust automatically. +Caveman is installed for Claude only: a `-` in the `codex_method` column marks a Claude-only extension, which the Codex selector omits and which install and update remove from Codex when this setup installed it there. Humanizer and Impeccable are downloaded to Codex as skill payloads from the GitHub sources in the manifest, without running upstream installers. Both appear in the extension selector for Codex. Impeccable's design-detector hooks run in every project for both clients: Claude through the plugin's own hooks, Codex through the registered `Invoke-ImpeccableHook`/`invoke-impeccable-hook.sh` wrapper (see `shared/hooks/README.md`). No per-project `impeccable hooks on` is needed; `impeccable hooks off` still disables a project. Ownership is recorded in `~/.my-ai-configuration/extensions.json`. Skill files are tracked by hash; modified or foreign files are retained with a warning. Existing installations from before ownership tracking are not automatically adopted. ### Setup options outside the extension selector diff --git a/scripts/lib/install-options.py b/scripts/lib/install-options.py index addf1ce..8d78abc 100644 --- a/scripts/lib/install-options.py +++ b/scripts/lib/install-options.py @@ -9,7 +9,7 @@ from personal_instructions import CLIENT_FILES, render # Hook scripts this configuration installs; merges replace these and keep any foreign hooks. -OWNED_HOOK_PATTERN = r'(?:flashbang|statusline|record-compact|session-state-pointer|qmd-warm|Start-QmdWarm|completion-?evidence|correction-?prompt|command-?safety)\.(?:ps1|sh)' +OWNED_HOOK_PATTERN = r'(?:flashbang|statusline|record-compact|session-state-pointer|qmd-warm|Start-QmdWarm|completion-?evidence|correction-?prompt|command-?safety|impeccable-?hook)\.(?:ps1|sh)' def is_flashbang(hook): diff --git a/scripts/lib/managed-extensions.py b/scripts/lib/managed-extensions.py index 6b05bf0..b642b5c 100644 --- a/scripts/lib/managed-extensions.py +++ b/scripts/lib/managed-extensions.py @@ -424,30 +424,6 @@ class Manager: self.state['resources'].append(dict(client='shared', name=entry['name'], kind='cli', package=package, clients=[client])) self.save() - def repair_caveman_windows_hooks(self): - if self.dry_run or os.name != 'nt': - return - if not any(r['client'] == 'codex' and r['kind'] == 'plugin' - and r['selector'] == 'caveman@thinkhome-caveman' for r in self.state['resources']): - return - # ponytail: only the known 1.0.0 command; remove when upstream ships a portable launcher. - path = safe_path(self.home, '.codex/plugins/cache/thinkhome-caveman/caveman/1.0.0/hooks/hooks.json') - if not path.is_file(): - return - content = json.loads(path.read_text(encoding='utf-8')) - changed = False - for groups in content.get('hooks', {}).values(): - for group in groups: - for hook in group.get('hooks', []): - if hook.get('commandWindows') == 'node "%PLUGIN_ROOT%\\hooks\\caveman-hook.mjs"': - hook['commandWindows'] = ('node -e "import(require(\'node:url\').pathToFileURL(' - 'require(\'node:path\').join(process.env.PLUGIN_ROOT,' - '\'hooks\',\'caveman-hook.mjs\')).href)"') - changed = True - if changed: - atomic_write(path, (json.dumps(content, indent=2) + '\n').encode('utf-8')) - print('Repaired Caveman Windows hook commands; review the changed hooks in Codex /hooks.') - def ensure_mcporter(self, entry, clients): server, url = entry['mcporter_name'], entry['mcporter_url'] if not re.fullmatch(r'[a-z0-9-]+', server) or not re.fullmatch(r'https://[^\s]+', url): @@ -540,11 +516,14 @@ class Manager: use_mcporter = 'MCPorter' in desired mcporter_entries = {name: entry for name, entry in desired.items() if use_mcporter and entry.get('mcporter_name') and entry.get('mcporter_url') not in ('', '-')} direct_entries = {name: entry for name, entry in desired.items() if name not in mcporter_entries} + # codex_method '-' marks a Claude-only extension; owned Codex installs of it are removed. + claude_only = {name for name, entry in direct_entries.items() if entry['codex_method'] == '-'} for record in sorted(self.state['resources'], key=lambda record: record['kind'] != 'mcp'): if record['client'] != 'shared' and record['client'] not in clients: continue selected_entries = mcporter_entries if record['kind'] == 'mcp' else direct_entries - if (action == 'sync' and record['name'] not in selected_entries) or (action == 'remove' and record['name'] in selected): + if ((action == 'sync' and record['name'] not in selected_entries) or (action == 'remove' and record['name'] in selected) + or (action != 'remove' and record['client'] == 'codex' and record['name'] in claude_only)): if record['client'] == 'shared': remaining = [client for client in record.get('clients', ['claude', 'codex']) if client not in clients] if remaining: @@ -555,9 +534,8 @@ class Manager: if action != 'remove': for client in clients: for entry in direct_entries.values(): - self.ensure(client, entry) - if client == 'codex' and entry.get('codex_plugin') == 'caveman@thinkhome-caveman': - self.repair_caveman_windows_hooks() + if client != 'codex' or entry['name'] not in claude_only: + self.ensure(client, entry) for entry in mcporter_entries.values(): self.ensure_mcporter(entry, clients) print('EXTENSIONS: reconciliation complete' + (' (dry run)' if self.dry_run else '')) diff --git a/scripts/lib/plugins.ps1 b/scripts/lib/plugins.ps1 index cbf1edf..f67024f 100644 --- a/scripts/lib/plugins.ps1 +++ b/scripts/lib/plugins.ps1 @@ -121,6 +121,8 @@ function Select-ConfiguredPlugins { [switch]$DryRun ) $entries = @(Get-ConfiguredPluginEntries -RepositoryRoot $RepositoryRoot) + # codex_method '-' marks a Claude-only extension. + if ($Client -eq 'Codex') { $entries = @($entries | Where-Object { $_.codex_method -ne '-' }) } $toggleable = @($entries) $fixed = @($entries | Where-Object { $toggleable -notcontains $_ }) if ($toggleable.Count -eq 0 -or ($DryRun -and $Mode -eq 'Install')) { return @{ Selected = $entries; Deselected = @() } } @@ -136,6 +138,7 @@ function Select-ConfiguredPlugins { Test-InstalledMCPServer -HomePath $HomePath -Name $entry.mcporter_name -Url $entry.mcporter_url } else { $false } foreach ($referenceClient in $referenceClients) { + if ($referenceClient -eq 'Codex' -and $entry.codex_method -eq '-') { continue } $selector = if ($referenceClient -eq 'Claude') { $entry.claude_plugin } else { $entry.codex_plugin } if ($referenceClient -eq 'Codex' -and $entry.codex_method -ne 'plugin') { $found = $found -or (Test-Path -LiteralPath (Join-Path $HomePath ('.agents/skills/' + $entry.codex_skill))) -or (Test-Path -LiteralPath (Join-Path $HomePath ('.codex/skills/' + $entry.codex_skill))) diff --git a/scripts/lib/plugins.sh b/scripts/lib/plugins.sh index 21df05f..a56d325 100755 --- a/scripts/lib/plugins.sh +++ b/scripts/lib/plugins.sh @@ -146,6 +146,8 @@ select_configured_plugins() { local name all_names=() toggle_names=() fixed_names=() while IFS= read -r name; do + # codex_method '-' marks a Claude-only extension. + if [ "$client" = codex ] && [ "$(plugin_field "$root" "$name" codex_method)" = - ]; then continue; fi all_names+=("$name") if plugin_toggleable "$root" "$name" "$client"; then toggle_names+=("$name"); else fixed_names+=("$name"); fi done < <(get_plugin_names "$root") @@ -178,6 +180,7 @@ select_configured_plugins() { else status=$?; [ "$status" -eq 1 ] || return "$status"; fi fi for reference_client in "${reference_clients[@]}"; do + if [ "$reference_client" = codex ] && [ "$(plugin_field "$root" "$name" codex_method)" = - ]; then continue; fi if [ "$reference_client" = claude ]; then selector=$(plugin_field "$root" "$name" claude_plugin); else selector=$(plugin_field "$root" "$name" codex_plugin); fi if [ "$reference_client" = codex ] && [ "$(plugin_field "$root" "$name" codex_method)" != plugin ]; then local skill_name diff --git a/scripts/tests/test-install-options.py b/scripts/tests/test-install-options.py index c5531a9..71b3e98 100644 --- a/scripts/tests/test-install-options.py +++ b/scripts/tests/test-install-options.py @@ -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 "$test_home/.mcporter/mcporter.json" select_configured_plugins "$root" codex Update true selected deselected [[ " ${deselected[*]} " == *' Context7 '* ]] || { printf 'A different MCPorter server must not select Context7.\n' >&2; exit 1; } +[[ " ${selected[*]} ${deselected[*]} " != *' Caveman '* ]] || { printf 'Claude-only extensions must not be offered for Codex.\n' >&2; exit 1; } npm_prefix=$(mktemp -d "$root/.npm-test.XXXXXX") cli_name="ai-config-test-cli-${npm_prefix##*.}" npm() { printf '%s\n' "$npm_prefix"; } diff --git a/scripts/tests/test-quick-update.py b/scripts/tests/test-quick-update.py index fc5f7a2..3c19fa2 100644 --- a/scripts/tests/test-quick-update.py +++ b/scripts/tests/test-quick-update.py @@ -35,15 +35,15 @@ class SelectionTests(unittest.TestCase): self.assertFalse(self.path.exists()) def test_selection_round_trip_and_last_successful_write(self): - self.save('--selected', 'Superpowers', 'Anthropic Frontend Design', '--deselected', 'Context7') + self.save('--selected', 'Superpowers', 'Humanizer', '--deselected', 'Context7') original = self.path.read_bytes() state = json.loads(self.run_state('read').stdout) self.assertEqual(state['shell'], 'powershell') self.assertEqual(state['client'], 'both') - self.assertEqual(state['selected'], ['Superpowers', 'Anthropic Frontend Design']) + self.assertEqual(state['selected'], ['Superpowers', 'Humanizer']) self.assertEqual(state['deselected'], ['Context7']) self.assertEqual(self.path.read_bytes(), original) - self.assertIn('selected\tAnthropic Frontend Design', self.run_state('read', '--format', 'tsv').stdout) + self.assertIn('selected\tHumanizer', self.run_state('read', '--format', 'tsv').stdout) self.save('--selected', 'Context7') self.assertEqual(json.loads(self.run_state('read').stdout)['selected'], ['Context7']) diff --git a/scripts/tests/test-shell-packages.ps1 b/scripts/tests/test-shell-packages.ps1 index f01864f..38dabd3 100644 --- a/scripts/tests/test-shell-packages.ps1 +++ b/scripts/tests/test-shell-packages.ps1 @@ -61,7 +61,7 @@ foreach ($shell in @('powershell','bash')) { if ($shell -eq 'powershell' -and $content -match 'WindowStyle\s+Hidden') { throw "PowerShell hook hides the terminal in $package" } if ($client -eq 'codex') { $events = @([regex]::Matches($content, '(?m)^\[\[hooks\.([^.\]]+)\]\]\s*$') | ForEach-Object { $_.Groups[1].Value }) - if ((($events | Sort-Object) -join ',') -ne 'PreToolUse,SessionStart,Stop,Stop,UserPromptSubmit' -or $content -match 'flashbang-if-input' -or $content -match '(?m)^async\s*=\s*true\s*$') { throw "Codex finish hook is incorrect in $package" } + if ((($events | Sort-Object) -join ',') -ne 'PostToolUse,PreToolUse,SessionStart,Stop,Stop,Stop,UserPromptSubmit' -or $content -match 'flashbang-if-input' -or $content -match '(?m)^async\s*=\s*true\s*$') { throw "Codex finish hook is incorrect in $package" } if ($content -notmatch 'approvals_reviewer\s*=\s*"auto_review"') { throw "Codex auto review is missing in $package" } if ($content -notmatch '(?m)^sandbox_mode\s*=\s*"danger-full-access"\s*$') { throw "Codex full access is missing in $package" } if ($content -notmatch '(?m)^max_depth\s*=\s*1\s*$') { throw "Codex agent depth limit is missing in $package" } diff --git a/scripts/tests/test-shell-packages.sh b/scripts/tests/test-shell-packages.sh index b0848fb..7bceed9 100644 --- a/scripts/tests/test-shell-packages.sh +++ b/scripts/tests/test-shell-packages.sh @@ -80,7 +80,7 @@ for shell in powershell bash; do grep -q 'bash .*flashbang.sh' "$package/$file" fi if [ "$client" = codex ]; then - [ "$(sed -n 's/^\[\[hooks\.\([^].]*\)\]\][[:space:]]*$/\1/p' "$package/$file" | sort)" = $'PreToolUse\nSessionStart\nStop\nStop\nUserPromptSubmit' ] + [ "$(sed -n 's/^\[\[hooks\.\([^].]*\)\]\][[:space:]]*$/\1/p' "$package/$file" | sort)" = $'PostToolUse\nPreToolUse\nSessionStart\nStop\nStop\nStop\nUserPromptSubmit' ] ! grep -q 'flashbang-if-input' "$package/$file" ! grep -Eq '^async[[:space:]]*=[[:space:]]*true[[:space:]]*$' "$package/$file" grep -q 'approvals_reviewer[[:space:]]*=[[:space:]]*"auto_review"' "$package/$file" diff --git a/shared/hooks/README.md b/shared/hooks/README.md index 60e4428..8829799 100644 --- a/shared/hooks/README.md +++ b/shared/hooks/README.md @@ -9,3 +9,5 @@ Both clients register `PreToolUse` (`Validate-CommandSafety`/`validate-command-s `Invoke-PostChangeVerification`/`invoke-post-change-verification.sh` is not registered or invoked automatically; it runs the repository build only when explicitly invoked. Python-based hooks resolve their interpreter through `Resolve-Python.ps1`/`resolve-python.sh` and are silently skipped without Python 3.11+. `Test-SessionConfig`/`test-session-config.sh` checks repository inputs during a build. When local QMD search is enabled, both clients also register a `SessionStart` warm-up hook (`Start-QmdWarm.ps1`/`start-qmd-warm.sh`). It starts the installed Node wrapper in the background from the process working directory, only inside a Git repository. Warm-up errors are recorded in `~/.my-ai-configuration/qmd/warm.log`; they do not fail the session. Disabling local search removes the hook registration. + +Codex also registers `PostToolUse` (matcher `Edit|Write|apply_patch`) and `Stop` hooks for Impeccable's design detector (`Invoke-ImpeccableHook.ps1`/`invoke-impeccable-hook.sh`). The wrapper runs the installed Impeccable Codex skill's `impeccable hook` and is a no-op when that skill is missing. Claude receives the same hooks from the Impeccable plugin. The detector is on by default in every project; a project opts out with `impeccable hooks off`. diff --git a/shared/hooks/scripts/Invoke-ImpeccableHook.ps1 b/shared/hooks/scripts/Invoke-ImpeccableHook.ps1 new file mode 100644 index 0000000..9adfc9c --- /dev/null +++ b/shared/hooks/scripts/Invoke-ImpeccableHook.ps1 @@ -0,0 +1,13 @@ +# Codex PostToolUse/Stop: run the Impeccable design detector when its Codex skill is installed; otherwise a no-op. +# Claude receives the same hooks from the Impeccable plugin. Projects can still opt out with `impeccable hooks off`. +$codexHome = if ($env:CODEX_HOME) { $env:CODEX_HOME } else { Join-Path $HOME '.codex' } +$windows = $env:OS -eq 'Windows_NT' +foreach ($skill in @((Join-Path $HOME '.agents/skills/impeccable'), (Join-Path $codexHome 'skills/impeccable'))) { + $launcher = Join-Path $skill $(if ($windows) { 'scripts/impeccable.cmd' } else { 'scripts/impeccable' }) + if (-not (Test-Path -LiteralPath $launcher -PathType Leaf)) { continue } + # The hook reply carries non-ASCII text; Windows PowerShell would otherwise decode it with the OEM code page. + [Console]::OutputEncoding = [System.Text.UTF8Encoding]::new($false) + if ($windows) { & $launcher hook } else { & sh $launcher hook } + exit $LASTEXITCODE +} +exit 0 diff --git a/shared/hooks/scripts/invoke-impeccable-hook.sh b/shared/hooks/scripts/invoke-impeccable-hook.sh new file mode 100644 index 0000000..f34cbfd --- /dev/null +++ b/shared/hooks/scripts/invoke-impeccable-hook.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +# Codex PostToolUse/Stop: run the Impeccable design detector when its Codex skill is installed; otherwise a no-op. +# Claude receives the same hooks from the Impeccable plugin. Projects can still opt out with `impeccable hooks off`. +for skill in "$HOME/.agents/skills/impeccable" "${CODEX_HOME:-$HOME/.codex}/skills/impeccable"; do + if [ -f "$skill/scripts/impeccable" ]; then exec sh "$skill/scripts/impeccable" hook; fi +done +exit 0 diff --git a/shared/skills/plugin-workflow/SKILL.md b/shared/skills/plugin-workflow/SKILL.md index 3a0329f..82c8d13 100644 --- a/shared/skills/plugin-workflow/SKILL.md +++ b/shared/skills/plugin-workflow/SKILL.md @@ -26,7 +26,7 @@ MUST load `ponytail` in `full` mode before coding, fixing, refactoring, configur ## Impeccable: UI -MUST load `impeccable` before UI planning, edits, debugging, or review, including accessibility, responsive behavior, UI copy, and frontend performance. Follow installed context setup, relevant references, and launcher fallback within permissions. Preserve the brief and existing design system. Verify affected states and layouts; batch findings and bound confirmation passes. Report unavailable previews honestly. Impeccable owns UI decisions; Superpowers owns process; Frontend Design supplements gaps without starting a competing workflow. Backend-only tasks skip this layer. +MUST load `impeccable` before UI planning, edits, debugging, or review, including accessibility, responsive behavior, UI copy, and frontend performance. Follow installed context setup, relevant references, and launcher fallback within permissions. Preserve the brief and existing design system. Verify affected states and layouts; batch findings and bound confirmation passes. Report unavailable previews honestly. Impeccable owns UI decisions; Superpowers owns process. Backend-only tasks skip this layer. ## REA: reverse engineering