#!/usr/bin/env bash # D1 — 🔥 Cost-spike: step tốn 3× token bị bắt (SHOWPIECE H6) # cwd = thư mục gốc dự án. Offline OK (dùng telemetry seed). # provider-usage.jsonl: 3 step ~200 token, 1 step "plan" = 710 (spike) printf '%s\n' \ '{"step":"srs","total_tokens":210}' \ '{"step":"bd","total_tokens":195}' \ '{"step":"spec","total_tokens":230}' \ '{"step":"plan","total_tokens":710}' > /tmp/usage.jsonl bash .specify/scripts/bash/cost-spike-detect.sh /tmp/usage.jsonl 3.0; echo "exit=$?" # Kỳ vọng: median_tokens=220.0 threshold=660 · SPIKE step=plan tokens=710 (>660) # COST_SPIKE_DETECTED count=1 · exit=2