conduct-cli 0.4.17__tar.gz → 0.4.19__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.17 → conduct_cli-0.4.19}/PKG-INFO +1 -1
- {conduct_cli-0.4.17 → conduct_cli-0.4.19}/pyproject.toml +1 -1
- {conduct_cli-0.4.17 → conduct_cli-0.4.19}/src/conduct_cli/guard.py +30 -13
- {conduct_cli-0.4.17 → conduct_cli-0.4.19}/src/conduct_cli.egg-info/PKG-INFO +1 -1
- {conduct_cli-0.4.17 → conduct_cli-0.4.19}/README.md +0 -0
- {conduct_cli-0.4.17 → conduct_cli-0.4.19}/setup.cfg +0 -0
- {conduct_cli-0.4.17 → conduct_cli-0.4.19}/setup.py +0 -0
- {conduct_cli-0.4.17 → conduct_cli-0.4.19}/src/conduct_cli/__init__.py +0 -0
- {conduct_cli-0.4.17 → conduct_cli-0.4.19}/src/conduct_cli/api.py +0 -0
- {conduct_cli-0.4.17 → conduct_cli-0.4.19}/src/conduct_cli/guardmcp.py +0 -0
- {conduct_cli-0.4.17 → conduct_cli-0.4.19}/src/conduct_cli/main.py +0 -0
- {conduct_cli-0.4.17 → conduct_cli-0.4.19}/src/conduct_cli.egg-info/SOURCES.txt +0 -0
- {conduct_cli-0.4.17 → conduct_cli-0.4.19}/src/conduct_cli.egg-info/dependency_links.txt +0 -0
- {conduct_cli-0.4.17 → conduct_cli-0.4.19}/src/conduct_cli.egg-info/entry_points.txt +0 -0
- {conduct_cli-0.4.17 → conduct_cli-0.4.19}/src/conduct_cli.egg-info/requires.txt +0 -0
- {conduct_cli-0.4.17 → conduct_cli-0.4.19}/src/conduct_cli.egg-info/top_level.txt +0 -0
|
@@ -274,7 +274,7 @@ def _scan_codex_tokens(transcript_path):
|
|
|
274
274
|
buf = f.read(read_size) + buf
|
|
275
275
|
text = buf.decode("utf-8", errors="ignore")
|
|
276
276
|
# Split; if we haven't reached the start the first fragment may be partial
|
|
277
|
-
parts = text.split("
|
|
277
|
+
parts = text.split("\\n")
|
|
278
278
|
start = 1 if pos > 0 else 0
|
|
279
279
|
for line in reversed(parts[start:]):
|
|
280
280
|
if "token_count" not in line or not line.strip():
|
|
@@ -502,10 +502,12 @@ def _install_codex_hook(hook_path: Path) -> None:
|
|
|
502
502
|
hook_section = hooks.setdefault("hooks", {})
|
|
503
503
|
|
|
504
504
|
# PreToolUse
|
|
505
|
-
pre_cmd = f"
|
|
505
|
+
pre_cmd = f"{sys.executable} {hook_path}"
|
|
506
|
+
hook_path_str = str(hook_path)
|
|
506
507
|
pre = hook_section.setdefault("PreToolUse", [])
|
|
508
|
+
# Match by hook path so old python3/python3.11 entries are treated as already registered
|
|
507
509
|
pre_already = any(
|
|
508
|
-
e.get("command")
|
|
510
|
+
hook_path_str in e.get("command", "")
|
|
509
511
|
for h in pre
|
|
510
512
|
for e in h.get("hooks", [])
|
|
511
513
|
)
|
|
@@ -513,9 +515,16 @@ def _install_codex_hook(hook_path: Path) -> None:
|
|
|
513
515
|
if not pre_already:
|
|
514
516
|
pre.append({"matcher": ".*", "hooks": [{"type": "command", "command": pre_cmd}]})
|
|
515
517
|
changed = True
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
518
|
+
else:
|
|
519
|
+
# Update existing entry to use current sys.executable
|
|
520
|
+
for h in pre:
|
|
521
|
+
for e in h.get("hooks", []):
|
|
522
|
+
if hook_path_str in e.get("command", "") and e["command"] != pre_cmd:
|
|
523
|
+
e["command"] = pre_cmd
|
|
524
|
+
changed = True
|
|
525
|
+
|
|
526
|
+
# PostToolUse
|
|
527
|
+
post_cmd = f"{sys.executable} {hook_path} post"
|
|
519
528
|
post = hook_section.setdefault("PostToolUse", [])
|
|
520
529
|
# Remove stale conductguard-post entries registered by older CLI versions
|
|
521
530
|
stale = "conductguard-post"
|
|
@@ -527,7 +536,7 @@ def _install_codex_hook(hook_path: Path) -> None:
|
|
|
527
536
|
cleaned = True
|
|
528
537
|
post[:] = [h for h in post if h.get("hooks")]
|
|
529
538
|
post_already = any(
|
|
530
|
-
e.get("command")
|
|
539
|
+
hook_path_str in e.get("command", "")
|
|
531
540
|
for h in post
|
|
532
541
|
for e in h.get("hooks", [])
|
|
533
542
|
)
|
|
@@ -610,9 +619,10 @@ def _install_claude_hook(hook_path: Path) -> None:
|
|
|
610
619
|
|
|
611
620
|
# PreToolUse — existing hook script
|
|
612
621
|
pre = hooks.setdefault("PreToolUse", [])
|
|
613
|
-
pre_cmd = f"
|
|
622
|
+
pre_cmd = f"{sys.executable} {hook_path}"
|
|
623
|
+
hook_path_str = str(hook_path)
|
|
614
624
|
pre_already = any(
|
|
615
|
-
e.get("command")
|
|
625
|
+
hook_path_str in e.get("command", "")
|
|
616
626
|
for h in pre
|
|
617
627
|
for e in h.get("hooks", [])
|
|
618
628
|
)
|
|
@@ -620,10 +630,17 @@ def _install_claude_hook(hook_path: Path) -> None:
|
|
|
620
630
|
if not pre_already:
|
|
621
631
|
pre.append({"matcher": ".*", "hooks": [{"type": "command", "command": pre_cmd}]})
|
|
622
632
|
changed = True
|
|
623
|
-
|
|
624
|
-
|
|
633
|
+
else:
|
|
634
|
+
# Update existing entry to use current sys.executable
|
|
635
|
+
for h in pre:
|
|
636
|
+
for e in h.get("hooks", []):
|
|
637
|
+
if hook_path_str in e.get("command", "") and e["command"] != pre_cmd:
|
|
638
|
+
e["command"] = pre_cmd
|
|
639
|
+
changed = True
|
|
640
|
+
|
|
641
|
+
# PostToolUse
|
|
625
642
|
post = hooks.setdefault("PostToolUse", [])
|
|
626
|
-
post_cmd = f"
|
|
643
|
+
post_cmd = f"{sys.executable} {hook_path} post"
|
|
627
644
|
# Remove stale conductguard-post entries registered by older CLI versions
|
|
628
645
|
stale = "conductguard-post"
|
|
629
646
|
cleaned = False
|
|
@@ -634,7 +651,7 @@ def _install_claude_hook(hook_path: Path) -> None:
|
|
|
634
651
|
cleaned = True
|
|
635
652
|
post[:] = [h for h in post if h.get("hooks")]
|
|
636
653
|
post_already = any(
|
|
637
|
-
e.get("command")
|
|
654
|
+
hook_path_str in e.get("command", "")
|
|
638
655
|
for h in post
|
|
639
656
|
for e in h.get("hooks", [])
|
|
640
657
|
)
|
|
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
|