diff --git a/scripts/smoke-test.sh b/scripts/smoke-test.sh index da93c7b..a4155eb 100755 --- a/scripts/smoke-test.sh +++ b/scripts/smoke-test.sh @@ -175,11 +175,14 @@ if docker run --rm \ python3 /usr/local/lib/opencode-devbox/generate-config.py 2>/dev/null cat /tmp/home/.config/opencode/opencode.jsonc ' > "$tmp/out.jsonc" 2>/dev/null; then - # Strip single-line // comments for JSON validation - sed 's|//.*$||' "$tmp/out.jsonc" > "$tmp/out.json" + # Strip single-line // comments for JSON validation (respecting strings) if python3 -c " -import json, sys -c = json.load(open('$tmp/out.json')) +import re, json, sys +text = open('$tmp/out.jsonc').read() +# Match either a string literal or a // comment; keep strings, drop comments +pattern = r'\"(?:\\\\.|[^\"\\\\])*\"|//[^\n]*' +stripped = re.sub(pattern, lambda m: m.group(0) if m.group(0).startswith('\"') else '', text) +c = json.loads(stripped) assert c['model'].startswith('anthropic/'), c assert c['autoupdate'] is False assert c['share'] == 'disabled'