jev-cli 0.6.2__tar.gz → 0.6.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jev-cli
3
- Version: 0.6.2
3
+ Version: 0.6.3
4
4
  Summary: Small CLI and stdio MCP server for TypeSafe Jev
5
5
  Keywords: typesafe,jev,cli,mcp,ai
6
6
  License-Expression: MIT
@@ -71,7 +71,7 @@ jev --version
71
71
  Expected output:
72
72
 
73
73
  ```text
74
- jev 0.6.2
74
+ jev 0.6.3
75
75
  ```
76
76
 
77
77
  ## Authentication
@@ -52,7 +52,7 @@ jev --version
52
52
  Expected output:
53
53
 
54
54
  ```text
55
- jev 0.6.2
55
+ jev 0.6.3
56
56
  ```
57
57
 
58
58
  ## Authentication
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "jev-cli"
3
- version = "0.6.2"
3
+ version = "0.6.3"
4
4
  description = "Small CLI and stdio MCP server for TypeSafe Jev"
5
5
  readme = "README.md"
6
6
  license = "MIT"
@@ -279,7 +279,7 @@ def call(payload: dict[str, Any], endpoint: str, provider: str = "official") ->
279
279
  headers={
280
280
  "Authorization": f"Bearer {api_key(provider)}",
281
281
  "Content-Type": "application/json",
282
- "User-Agent": "jev-cli/0.6.2",
282
+ "User-Agent": "jev-cli/0.6.3",
283
283
  **provider_headers,
284
284
  },
285
285
  method="POST",
@@ -295,6 +295,8 @@ def call(payload: dict[str, Any], endpoint: str, provider: str = "official") ->
295
295
  detail = body
296
296
  code = 3 if exc.code in (401, 403) else 4 if exc.code in (429, 500, 502, 503, 504) else 1
297
297
  raise CliError(f"API HTTP {exc.code}: {json.dumps(detail, ensure_ascii=False)}", code) from exc
298
+ except json.JSONDecodeError as exc:
299
+ raise CliError(f"API returned invalid JSON: {exc}", 4) from exc
298
300
  except (urllib.error.URLError, TimeoutError) as exc:
299
301
  raise CliError(f"API connection failed: {exc}", 4) from exc
300
302
  if not isinstance(result, dict):
@@ -324,7 +326,7 @@ def parser() -> argparse.ArgumentParser:
324
326
  prog="jev",
325
327
  description="Evaluate text or JSON with TypeSafe Jev. Uses its own local credential store.",
326
328
  )
327
- root.add_argument("--version", action="version", version="jev 0.6.2")
329
+ root.add_argument("--version", action="version", version="jev 0.6.3")
328
330
  sub = root.add_subparsers(dest="command", required=True)
329
331
  common = common_parser()
330
332
 
@@ -134,7 +134,7 @@ logger = logging.getLogger(__name__)
134
134
  mcp = MCPServer(
135
135
  name="jev",
136
136
  title="TypeSafe Jev",
137
- version="0.6.2",
137
+ version="0.6.3",
138
138
  instructions=(
139
139
  "Ask TypeSafe Jev typed questions about text or JSON state. Use noul for a yes/no "
140
140
  "probability, choice for one key from explicit options, score for an ordered level, "
@@ -369,6 +369,14 @@ class JevTest(unittest.TestCase):
369
369
  jev.call({"state": "test", "questions": {}}, "https://example.test")
370
370
  self.assertEqual(raised.exception.exit_code, 4)
371
371
 
372
+ def test_call_maps_non_json_success_response_to_exit_code_4(self):
373
+ with patch.object(jev, "api_key", return_value="test-key"), patch(
374
+ "urllib.request.urlopen", return_value=io.BytesIO(b"<html>gateway timeout</html>")
375
+ ):
376
+ with self.assertRaisesRegex(jev.CliError, "API returned invalid JSON") as raised:
377
+ jev.call({"state": "test", "questions": {}}, "https://example.test")
378
+ self.assertEqual(raised.exception.exit_code, 4)
379
+
372
380
  def test_main_prints_only_primary_value(self):
373
381
  argv = ["jev", "noul", "--question", "Urgent?", "--state", "today", "--value"]
374
382
  with patch("sys.argv", argv), patch.object(
File without changes
File without changes
File without changes
File without changes
File without changes