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.
- {conduct_cli-0.4.19 → conduct_cli-0.4.21}/PKG-INFO +1 -1
- {conduct_cli-0.4.19 → conduct_cli-0.4.21}/pyproject.toml +1 -1
- {conduct_cli-0.4.19 → conduct_cli-0.4.21}/src/conduct_cli/guard.py +24 -6
- {conduct_cli-0.4.19 → conduct_cli-0.4.21}/src/conduct_cli.egg-info/PKG-INFO +1 -1
- {conduct_cli-0.4.19 → conduct_cli-0.4.21}/README.md +0 -0
- {conduct_cli-0.4.19 → conduct_cli-0.4.21}/setup.cfg +0 -0
- {conduct_cli-0.4.19 → conduct_cli-0.4.21}/setup.py +0 -0
- {conduct_cli-0.4.19 → conduct_cli-0.4.21}/src/conduct_cli/__init__.py +0 -0
- {conduct_cli-0.4.19 → conduct_cli-0.4.21}/src/conduct_cli/api.py +0 -0
- {conduct_cli-0.4.19 → conduct_cli-0.4.21}/src/conduct_cli/guardmcp.py +0 -0
- {conduct_cli-0.4.19 → conduct_cli-0.4.21}/src/conduct_cli/main.py +0 -0
- {conduct_cli-0.4.19 → conduct_cli-0.4.21}/src/conduct_cli.egg-info/SOURCES.txt +0 -0
- {conduct_cli-0.4.19 → conduct_cli-0.4.21}/src/conduct_cli.egg-info/dependency_links.txt +0 -0
- {conduct_cli-0.4.19 → conduct_cli-0.4.21}/src/conduct_cli.egg-info/entry_points.txt +0 -0
- {conduct_cli-0.4.19 → conduct_cli-0.4.21}/src/conduct_cli.egg-info/requires.txt +0 -0
- {conduct_cli-0.4.19 → conduct_cli-0.4.21}/src/conduct_cli.egg-info/top_level.txt +0 -0
|
@@ -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
|
-
|
|
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
|
-
|
|
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"{
|
|
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"{
|
|
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"{
|
|
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"{
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|