mirror of
https://github.com/obra/superpowers.git
synced 2026-05-16 22:19:05 +08:00
test: add Codex native hook drill coverage
This commit is contained in:
@@ -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
|
Note: The path must be quoted because plugin roots may contain spaces on
|
||||||
Windows, for example `C:\Program Files\...`.
|
Windows, for example `C:\Program Files\...`.
|
||||||
|
|
||||||
|
|||||||
@@ -7,10 +7,11 @@ set -euo pipefail
|
|||||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||||
PLUGIN_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
|
PLUGIN_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
|
||||||
|
|
||||||
# Codex plugin hooks set Claude-compatible root env vars, so detect Codex
|
# Codex plugin hooks set both unprefixed PLUGIN_* vars and Claude-compatible
|
||||||
# through its plugin data env before building platform-specific context.
|
# CLAUDE_* vars. Only the unprefixed data var is Codex-specific enough to
|
||||||
|
# distinguish Codex from Claude Code.
|
||||||
is_codex_hook=0
|
is_codex_hook=0
|
||||||
if [ -n "${PLUGIN_DATA:-}" ] || [ -n "${CLAUDE_PLUGIN_DATA:-}" ]; then
|
if [ -n "${PLUGIN_DATA:-}" ]; then
|
||||||
is_codex_hook=1
|
is_codex_hook=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -216,6 +216,19 @@ assert_command_output \
|
|||||||
CLAUDE_PLUGIN_ROOT="$REPO_ROOT" \
|
CLAUDE_PLUGIN_ROOT="$REPO_ROOT" \
|
||||||
bash "$HOOK_UNDER_TEST"
|
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_home="$(make_home codex-legacy-warning)"
|
||||||
codex_legacy_data="$TEST_ROOT/codex-legacy-warning/data"
|
codex_legacy_data="$TEST_ROOT/codex-legacy-warning/data"
|
||||||
mkdir -p "$codex_legacy_home/.config/superpowers/skills" "$codex_legacy_data"
|
mkdir -p "$codex_legacy_home/.config/superpowers/skills" "$codex_legacy_data"
|
||||||
|
|||||||
Reference in New Issue
Block a user