conduct-cli 0.4.19__tar.gz → 0.4.21__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: conduct-cli
3
- Version: 0.4.19
3
+ Version: 0.4.21
4
4
  Summary: CLI for Conduct AI — install agents, manage projects, run tests
5
5
  Author-email: Conduct AI <hello@conductai.ai>
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "conduct-cli"
7
- version = "0.4.19"
7
+ version = "0.4.21"
8
8
  description = "CLI for Conduct AI — install agents, manage projects, run tests"
9
9
  readme = "README.md"
10
10
  license = { text = "MIT" }
@@ -371,7 +371,9 @@ def main():
371
371
  if hard_blocked is None:
372
372
  hard_blocked, reason = _fetch_budget_status()
373
373
  if hard_blocked:
374
- print(f"[ConductGuard] {reason or 'Budget hard cap reached. Contact your manager.'}")
374
+ msg = f"[ConductGuard] {reason or 'Budget hard cap reached. Contact your manager.'}"
375
+ print(msg)
376
+ print(msg, file=sys.stderr)
375
377
  sys.exit(2)
376
378
 
377
379
  session_id = data.get("session_id")
@@ -385,7 +387,9 @@ def main():
385
387
  _post_event(tool_name, tool_input, decision, rule_id, message, session_id=session_id)
386
388
 
387
389
  if action == "block":
388
- print(f"[ConductGuard] {message}")
390
+ msg = f"[ConductGuard] {message}"
391
+ print(msg)
392
+ print(msg, file=sys.stderr)
389
393
  sys.exit(2)
390
394
  if action in ("warn", "approval"):
391
395
  print(f"[ConductGuard] {message}")
@@ -402,6 +406,20 @@ if __name__ == "__main__":
402
406
  main()
403
407
  '''
404
408
 
409
+ # ── Python interpreter selection ─────────────────────────────────────────────
410
+
411
+ def _best_python() -> str:
412
+ """Return the best available Python 3 interpreter path.
413
+ Prefers 3.11+ (Homebrew) over Apple's system Python 3.9 which has
414
+ restrictions that cause the hook to fail silently."""
415
+ import shutil
416
+ for candidate in ("python3.13", "python3.12", "python3.11", "python3.10"):
417
+ found = shutil.which(candidate)
418
+ if found:
419
+ return found
420
+ return sys.executable
421
+
422
+
405
423
  # ── Hook write helper ─────────────────────────────────────────────────────────
406
424
 
407
425
  def _write_hook(path: Path) -> None:
@@ -502,7 +520,7 @@ def _install_codex_hook(hook_path: Path) -> None:
502
520
  hook_section = hooks.setdefault("hooks", {})
503
521
 
504
522
  # PreToolUse
505
- pre_cmd = f"{sys.executable} {hook_path}"
523
+ pre_cmd = f"{_best_python()} {hook_path}"
506
524
  hook_path_str = str(hook_path)
507
525
  pre = hook_section.setdefault("PreToolUse", [])
508
526
  # Match by hook path so old python3/python3.11 entries are treated as already registered
@@ -524,7 +542,7 @@ def _install_codex_hook(hook_path: Path) -> None:
524
542
  changed = True
525
543
 
526
544
  # PostToolUse
527
- post_cmd = f"{sys.executable} {hook_path} post"
545
+ post_cmd = f"{_best_python()} {hook_path} post"
528
546
  post = hook_section.setdefault("PostToolUse", [])
529
547
  # Remove stale conductguard-post entries registered by older CLI versions
530
548
  stale = "conductguard-post"
@@ -619,7 +637,7 @@ def _install_claude_hook(hook_path: Path) -> None:
619
637
 
620
638
  # PreToolUse — existing hook script
621
639
  pre = hooks.setdefault("PreToolUse", [])
622
- pre_cmd = f"{sys.executable} {hook_path}"
640
+ pre_cmd = f"{_best_python()} {hook_path}"
623
641
  hook_path_str = str(hook_path)
624
642
  pre_already = any(
625
643
  hook_path_str in e.get("command", "")
@@ -640,7 +658,7 @@ def _install_claude_hook(hook_path: Path) -> None:
640
658
 
641
659
  # PostToolUse
642
660
  post = hooks.setdefault("PostToolUse", [])
643
- post_cmd = f"{sys.executable} {hook_path} post"
661
+ post_cmd = f"{_best_python()} {hook_path} post"
644
662
  # Remove stale conductguard-post entries registered by older CLI versions
645
663
  stale = "conductguard-post"
646
664
  cleaned = False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: conduct-cli
3
- Version: 0.4.19
3
+ Version: 0.4.21
4
4
  Summary: CLI for Conduct AI — install agents, manage projects, run tests
5
5
  Author-email: Conduct AI <hello@conductai.ai>
6
6
  License: MIT
File without changes
File without changes
File without changes