mtrx-cli 0.1.2 → 0.1.4

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mtrx-cli",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "MATRX CLI for routing Codex and Claude through Matrx",
5
5
  "homepage": "https://mtrx.so",
6
6
  "repository": {
@@ -1 +1 @@
1
- __version__ = "0.1.0"
1
+ __version__ = "0.1.4"
@@ -12,6 +12,7 @@ import webbrowser
12
12
 
13
13
  import httpx
14
14
 
15
+ from matrx import __version__
15
16
  from matrx.cli.launcher import (
16
17
  prepare_routed_setup,
17
18
  build_launch_plan,
@@ -43,6 +44,9 @@ def main(argv: list[str] | None = None) -> int:
43
44
  parser = _build_parser()
44
45
  args, remainder = parser.parse_known_args(argv)
45
46
 
47
+ if getattr(args, "version", False) or args.command == "version":
48
+ print(f"mtrx {__version__}")
49
+ return 0
46
50
  if args.command == "help":
47
51
  parser.print_help()
48
52
  return 0
@@ -65,6 +69,7 @@ def main(argv: list[str] | None = None) -> int:
65
69
 
66
70
  def _build_parser() -> argparse.ArgumentParser:
67
71
  parser = argparse.ArgumentParser(prog="mtrx")
72
+ parser.add_argument("-V", "--version", action="store_true")
68
73
  subparsers = parser.add_subparsers(dest="command")
69
74
 
70
75
  login = subparsers.add_parser("login")
@@ -80,6 +85,7 @@ def _build_parser() -> argparse.ArgumentParser:
80
85
  use.add_argument("route", choices=["direct", "matrx"])
81
86
 
82
87
  subparsers.add_parser("help")
88
+ subparsers.add_parser("version")
83
89
  subparsers.add_parser("status")
84
90
  subparsers.add_parser("doctor")
85
91
 
@@ -256,6 +262,26 @@ def _complete_codex_login() -> None:
256
262
  raise ValueError("Codex login did not complete successfully")
257
263
 
258
264
 
265
+ def _complete_claude_login(state: dict) -> tuple[dict, bool]:
266
+ token = (read_claude_oauth_token() or "").strip()
267
+ if token:
268
+ return state, False
269
+ if not _is_interactive_terminal():
270
+ raise ValueError("Claude login required. Run: claude auth login")
271
+
272
+ print("Claude login required.")
273
+ if not _prompt_yes_no("Run `claude auth login` now?", default=True):
274
+ raise ValueError("Claude login cancelled")
275
+
276
+ executable = find_executable("claude") or "claude"
277
+ result = subprocess.run([executable, "auth", "login"], check=False)
278
+ token = (read_claude_oauth_token() or "").strip()
279
+ if result.returncode != 0 or not token:
280
+ raise ValueError("Claude login did not complete successfully")
281
+
282
+ return state, False
283
+
284
+
259
285
  def _maybe_promote_direct_route(state: dict, tool: str, route: str | None) -> tuple[str | None, bool]:
260
286
  if route is not None:
261
287
  return route, False
@@ -563,6 +589,9 @@ def _cmd_launch(tool: str, route: str | None, remainder: list[str]) -> int:
563
589
  auth_changed = auth_changed or login_changed
564
590
  if tool == "codex":
565
591
  _complete_codex_login()
592
+ if tool == "claude":
593
+ state, login_changed = _complete_claude_login(state)
594
+ auth_changed = auth_changed or login_changed
566
595
  initialized = initialize_first_launch_route(state, tool, route)
567
596
  state, changed = prepare_routed_setup(
568
597
  state,