Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions tests/explicit-skill-requests/run-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ PROMPTS_DIR="$SCRIPT_DIR/prompts"
echo "=== Running All Explicit Skill Request Tests ==="
echo ""

"$SCRIPT_DIR/test-stream-json-verbose.sh"
echo ""

PASSED=0
FAILED=0
RESULTS=""
Expand Down
5 changes: 5 additions & 0 deletions tests/explicit-skill-requests/run-extended-multiturn-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ claude -p "I want to add user authentication to my app. Help me think through th
--plugin-dir "$PLUGIN_DIR" \
--dangerously-skip-permissions \
--max-turns 3 \
--verbose \
--output-format stream-json \
> "$OUTPUT_DIR/turn1.json" 2>&1 || true
echo "Done."
Expand All @@ -38,6 +39,7 @@ claude -p "Let's use JWT tokens with 24-hour expiry. Email/password registration
--plugin-dir "$PLUGIN_DIR" \
--dangerously-skip-permissions \
--max-turns 3 \
--verbose \
--output-format stream-json \
> "$OUTPUT_DIR/turn2.json" 2>&1 || true
echo "Done."
Expand All @@ -49,6 +51,7 @@ claude -p "Great, write this up as an implementation plan." \
--plugin-dir "$PLUGIN_DIR" \
--dangerously-skip-permissions \
--max-turns 3 \
--verbose \
--output-format stream-json \
> "$OUTPUT_DIR/turn3.json" 2>&1 || true
echo "Done."
Expand All @@ -60,6 +63,7 @@ claude -p "The plan looks good. What are my options for executing it?" \
--plugin-dir "$PLUGIN_DIR" \
--dangerously-skip-permissions \
--max-turns 2 \
--verbose \
--output-format stream-json \
> "$OUTPUT_DIR/turn4.json" 2>&1 || true
echo "Done."
Expand All @@ -72,6 +76,7 @@ claude -p "subagent-driven-development, please" \
--plugin-dir "$PLUGIN_DIR" \
--dangerously-skip-permissions \
--max-turns 2 \
--verbose \
--output-format stream-json \
> "$FINAL_LOG" 2>&1 || true
echo "Done."
Expand Down
5 changes: 5 additions & 0 deletions tests/explicit-skill-requests/run-haiku-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ claude -p "I want to add user authentication to my app. Help me think through th
--plugin-dir "$PLUGIN_DIR" \
--dangerously-skip-permissions \
--max-turns 3 \
--verbose \
--output-format stream-json \
> "$OUTPUT_DIR/turn1.json" 2>&1 || true
echo "Done."
Expand All @@ -68,6 +69,7 @@ claude -p "Let's use JWT tokens with 24-hour expiry. Email/password registration
--plugin-dir "$PLUGIN_DIR" \
--dangerously-skip-permissions \
--max-turns 3 \
--verbose \
--output-format stream-json \
> "$OUTPUT_DIR/turn2.json" 2>&1 || true
echo "Done."
Expand All @@ -80,6 +82,7 @@ claude -p "Great, write this up as an implementation plan." \
--plugin-dir "$PLUGIN_DIR" \
--dangerously-skip-permissions \
--max-turns 3 \
--verbose \
--output-format stream-json \
> "$OUTPUT_DIR/turn3.json" 2>&1 || true
echo "Done."
Expand All @@ -92,6 +95,7 @@ claude -p "The plan looks good. What are my options for executing it?" \
--plugin-dir "$PLUGIN_DIR" \
--dangerously-skip-permissions \
--max-turns 2 \
--verbose \
--output-format stream-json \
> "$OUTPUT_DIR/turn4.json" 2>&1 || true
echo "Done."
Expand All @@ -105,6 +109,7 @@ claude -p "subagent-driven-development, please" \
--plugin-dir "$PLUGIN_DIR" \
--dangerously-skip-permissions \
--max-turns 2 \
--verbose \
--output-format stream-json \
> "$FINAL_LOG" 2>&1 || true
echo "Done."
Expand Down
3 changes: 3 additions & 0 deletions tests/explicit-skill-requests/run-multiturn-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ claude -p "I need to implement an authentication system. Let's plan this out. Th
--plugin-dir "$PLUGIN_DIR" \
--dangerously-skip-permissions \
--max-turns 2 \
--verbose \
--output-format stream-json \
> "$TURN1_LOG" 2>&1 || true

Expand All @@ -64,6 +65,7 @@ claude -p "Good analysis. I've already written the plan to docs/superpowers/plan
--plugin-dir "$PLUGIN_DIR" \
--dangerously-skip-permissions \
--max-turns 2 \
--verbose \
--output-format stream-json \
> "$TURN2_LOG" 2>&1 || true

Expand All @@ -78,6 +80,7 @@ claude -p "subagent-driven-development, please" \
--plugin-dir "$PLUGIN_DIR" \
--dangerously-skip-permissions \
--max-turns 2 \
--verbose \
--output-format stream-json \
> "$TURN3_LOG" 2>&1 || true

Expand Down
1 change: 1 addition & 0 deletions tests/explicit-skill-requests/run-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ timeout 300 claude -p "$PROMPT" \
--plugin-dir "$PLUGIN_DIR" \
--dangerously-skip-permissions \
--max-turns "$MAX_TURNS" \
--verbose \
--output-format stream-json \
> "$LOG_FILE" 2>&1 || true

Expand Down
87 changes: 87 additions & 0 deletions tests/explicit-skill-requests/test-stream-json-verbose.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#!/usr/bin/env bash
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
FAILURES=0

pass() {
echo " PASS: $1"
}

fail() {
echo " FAIL: $1"
echo " $2"
FAILURES=$((FAILURES + 1))
}

check_file() {
local file="$1"
local basename
local output

basename="$(basename "$file")"

if ! grep -q -- "--output-format stream-json" "$file"; then
pass "$basename has no stream-json claude calls"
return 0
fi

if output="$(awk '
function finish_command() {
if (in_command && has_stream_json && !has_verbose) {
printf "%s:%d: stream-json claude -p command is missing --verbose\n", FILENAME, start_line
failed = 1
}
in_command = 0
has_stream_json = 0
has_verbose = 0
}

/claude -p / {
finish_command()
in_command = 1
start_line = NR
has_verbose = 0
has_stream_json = 0
}

in_command && /--verbose/ {
has_verbose = 1
}

in_command && /--output-format[[:space:]]+stream-json/ {
has_stream_json = 1
}

in_command && /\|\|[[:space:]]+true/ {
finish_command()
}

END {
finish_command()
exit failed
}
' "$file" 2>&1)"; then
pass "$basename uses --verbose with stream-json"
else
fail "$basename uses --verbose with stream-json" "$output"
fi
}

echo "Claude stream-json verbose guard"

for file in "$SCRIPT_DIR"/*.sh; do
case "$(basename "$file")" in
test-stream-json-verbose.sh)
continue
;;
esac
check_file "$file"
done

if [[ "$FAILURES" -gt 0 ]]; then
echo "STATUS: FAILED ($FAILURES failure(s))"
exit 1
fi

echo "STATUS: PASSED"