Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

test(opencode): cover JSONC string edge cases

cyhc8f1b6a68508
diff --git a/tests/test_ui_api.py b/tests/test_ui_api.py
index 39d77f6a4..d4b411a2a 100644
--- a/tests/test_ui_api.py
+++ b/tests/test_ui_api.py
@@ -1,6 +1,7 @@
import json
from vibe import api
+from vibe.opencode_config import parse_jsonc_object
def test_detect_cli_prefers_claude_local(monkeypatch, tmp_path):
@@ -232,3 +233,39 @@ def test_setup_opencode_permission_accepts_jsonc_config(monkeypatch, tmp_path):
"agent": {"build": {"model": "anthropic/claude-sonnet-4-5"}},
"permission": "allow",
}
+
+
+def test_parse_jsonc_object_preserves_comment_markers_inside_strings():
+ parsed = parse_jsonc_object(
+ """{
+ "line": "https://example.com // keep",
+ "block": "value /* keep */ text"
+}"""
+ )
+
+ assert parsed == {
+ "line": "https://example.com // keep",
+ "block": "value /* keep */ text",
+ }
+
+
+def test_parse_jsonc_object_accepts_inline_block_comments_before_values():
+ parsed = parse_jsonc_object(
+ """{
+ "model": /* keep this comment */ "openai/gpt-5",
+ "agent": {
+ "build": /* another comment */ {
+ "reasoningEffort": "high",
+ },
+ },
+}"""
+ )
+
+ assert parsed == {
+ "model": "openai/gpt-5",
+ "agent": {
+ "build": {
+ "reasoningEffort": "high",
+ }
+ },
+ }