From f5c43d6055de499a69f3c506f690b4448c275e0e Mon Sep 17 00:00:00 2001 From: Drew Ritter Date: Tue, 12 May 2026 19:01:32 -0700 Subject: [PATCH] test: add Codex native hook drill coverage --- docs/windows/polyglot-hooks.md | 6 ++++++ hooks/session-start | 7 ++++--- tests/hooks/test-session-start.sh | 13 +++++++++++++ 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/docs/windows/polyglot-hooks.md b/docs/windows/polyglot-hooks.md index fdd8abb2..6522cad4 100644 --- a/docs/windows/polyglot-hooks.md +++ b/docs/windows/polyglot-hooks.md @@ -134,6 +134,12 @@ verified `${PLUGIN_ROOT}` placeholder and the `startup|resume|clear` matcher: } ``` +The matcher differs from Claude Code intentionally: the Codex spike verified +`startup`, `resume`, and `clear` as Codex `SessionStart` sources. Keep +Claude Code on `startup|clear|compact` until `resume` is explicitly verified +there, and keep Codex off `compact` until Codex support for that source is +verified. + Note: The path must be quoted because plugin roots may contain spaces on Windows, for example `C:\Program Files\...`. diff --git a/hooks/session-start b/hooks/session-start index 0cea691d..c0205382 100755 --- a/hooks/session-start +++ b/hooks/session-start @@ -7,10 +7,11 @@ set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" PLUGIN_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)" -# Codex plugin hooks set Claude-compatible root env vars, so detect Codex -# through its plugin data env before building platform-specific context. +# Codex plugin hooks set both unprefixed PLUGIN_* vars and Claude-compatible +# CLAUDE_* vars. Only the unprefixed data var is Codex-specific enough to +# distinguish Codex from Claude Code. is_codex_hook=0 -if [ -n "${PLUGIN_DATA:-}" ] || [ -n "${CLAUDE_PLUGIN_DATA:-}" ]; then +if [ -n "${PLUGIN_DATA:-}" ]; then is_codex_hook=1 fi diff --git a/tests/hooks/test-session-start.sh b/tests/hooks/test-session-start.sh index 05a4b230..58644aee 100755 --- a/tests/hooks/test-session-start.sh +++ b/tests/hooks/test-session-start.sh @@ -216,6 +216,19 @@ assert_command_output \ CLAUDE_PLUGIN_ROOT="$REPO_ROOT" \ bash "$HOOK_UNDER_TEST" +claude_data_home="$(make_home claude-data-warning)" +claude_data="$TEST_ROOT/claude-data-warning/data" +mkdir -p "$claude_data_home/.config/superpowers/skills" "$claude_data" +assert_command_output \ + "Claude with CLAUDE_PLUGIN_DATA still uses Claude legacy warning" \ + "nested" \ + "Superpowers now uses Claude Code's skills system. Custom skills in ~/.config/superpowers/skills will not be read. Move custom skills to ~/.claude/skills instead." \ + "" \ + "$claude_data_home" \ + CLAUDE_PLUGIN_DATA="$claude_data" \ + CLAUDE_PLUGIN_ROOT="$REPO_ROOT" \ + bash "$HOOK_UNDER_TEST" + codex_legacy_home="$(make_home codex-legacy-warning)" codex_legacy_data="$TEST_ROOT/codex-legacy-warning/data" mkdir -p "$codex_legacy_home/.config/superpowers/skills" "$codex_legacy_data"