conduct-cli 0.4.16__tar.gz → 0.4.17__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.16 → conduct_cli-0.4.17}/PKG-INFO +1 -1
- {conduct_cli-0.4.16 → conduct_cli-0.4.17}/pyproject.toml +1 -1
- {conduct_cli-0.4.16 → conduct_cli-0.4.17}/src/conduct_cli/guard.py +22 -8
- {conduct_cli-0.4.16 → conduct_cli-0.4.17}/src/conduct_cli.egg-info/PKG-INFO +1 -1
- {conduct_cli-0.4.16 → conduct_cli-0.4.17}/README.md +0 -0
- {conduct_cli-0.4.16 → conduct_cli-0.4.17}/setup.cfg +0 -0
- {conduct_cli-0.4.16 → conduct_cli-0.4.17}/setup.py +0 -0
- {conduct_cli-0.4.16 → conduct_cli-0.4.17}/src/conduct_cli/__init__.py +0 -0
- {conduct_cli-0.4.16 → conduct_cli-0.4.17}/src/conduct_cli/api.py +0 -0
- {conduct_cli-0.4.16 → conduct_cli-0.4.17}/src/conduct_cli/guardmcp.py +0 -0
- {conduct_cli-0.4.16 → conduct_cli-0.4.17}/src/conduct_cli/main.py +0 -0
- {conduct_cli-0.4.16 → conduct_cli-0.4.17}/src/conduct_cli.egg-info/SOURCES.txt +0 -0
- {conduct_cli-0.4.16 → conduct_cli-0.4.17}/src/conduct_cli.egg-info/dependency_links.txt +0 -0
- {conduct_cli-0.4.16 → conduct_cli-0.4.17}/src/conduct_cli.egg-info/entry_points.txt +0 -0
- {conduct_cli-0.4.16 → conduct_cli-0.4.17}/src/conduct_cli.egg-info/requires.txt +0 -0
- {conduct_cli-0.4.16 → conduct_cli-0.4.17}/src/conduct_cli.egg-info/top_level.txt +0 -0
|
@@ -402,6 +402,24 @@ if __name__ == "__main__":
|
|
|
402
402
|
main()
|
|
403
403
|
'''
|
|
404
404
|
|
|
405
|
+
# ── Hook write helper ─────────────────────────────────────────────────────────
|
|
406
|
+
|
|
407
|
+
def _write_hook(path: Path) -> None:
|
|
408
|
+
"""Write _HOOK_SCRIPT to path, then py_compile-validate it.
|
|
409
|
+
Raises RuntimeError if the written file fails to compile — prevents
|
|
410
|
+
silently deploying a syntactically broken hook."""
|
|
411
|
+
import py_compile, tempfile, os
|
|
412
|
+
path.write_text(_HOOK_SCRIPT)
|
|
413
|
+
path.chmod(0o755)
|
|
414
|
+
try:
|
|
415
|
+
py_compile.compile(str(path), doraise=True)
|
|
416
|
+
except py_compile.PyCompileError as exc:
|
|
417
|
+
path.unlink(missing_ok=True)
|
|
418
|
+
raise RuntimeError(
|
|
419
|
+
f"hook.py failed syntax check after write — hook NOT installed.\n{exc}"
|
|
420
|
+
) from exc
|
|
421
|
+
|
|
422
|
+
|
|
405
423
|
# ── Guard config helpers ──────────────────────────────────────────────────────
|
|
406
424
|
|
|
407
425
|
def _load_guard_config() -> dict:
|
|
@@ -698,8 +716,7 @@ def cmd_guard_install(args):
|
|
|
698
716
|
|
|
699
717
|
# Write hook script
|
|
700
718
|
hook_path = GUARD_DIR / "hook.py"
|
|
701
|
-
hook_path
|
|
702
|
-
hook_path.chmod(0o755)
|
|
719
|
+
_write_hook(hook_path)
|
|
703
720
|
|
|
704
721
|
# Install PreToolUse hooks — Claude Code + Codex (real interception)
|
|
705
722
|
_install_claude_hook(hook_path)
|
|
@@ -748,8 +765,7 @@ def cmd_guard_join(args):
|
|
|
748
765
|
|
|
749
766
|
# Write hook script
|
|
750
767
|
hook_path = GUARD_DIR / "hook.py"
|
|
751
|
-
hook_path
|
|
752
|
-
hook_path.chmod(0o755)
|
|
768
|
+
_write_hook(hook_path)
|
|
753
769
|
print(f" {GREEN}Hook script written:{RESET} {hook_path}")
|
|
754
770
|
|
|
755
771
|
# Install PreToolUse hook in ~/.claude/settings.json
|
|
@@ -781,8 +797,7 @@ def cmd_guard_sync(args):
|
|
|
781
797
|
|
|
782
798
|
# Refresh hook script + re-register in all tools
|
|
783
799
|
hook_path = GUARD_DIR / "hook.py"
|
|
784
|
-
hook_path
|
|
785
|
-
hook_path.chmod(0o755)
|
|
800
|
+
_write_hook(hook_path)
|
|
786
801
|
_install_claude_hook(hook_path)
|
|
787
802
|
_install_codex_hook(hook_path)
|
|
788
803
|
cfg2 = _load_guard_config()
|
|
@@ -813,8 +828,7 @@ def cmd_guard_status(args):
|
|
|
813
828
|
_save_guard_config(cfg)
|
|
814
829
|
# Rewrite hook script so future events carry the email
|
|
815
830
|
hook_path = GUARD_DIR / "hook.py"
|
|
816
|
-
hook_path
|
|
817
|
-
hook_path.chmod(0o755)
|
|
831
|
+
_write_hook(hook_path)
|
|
818
832
|
except Exception:
|
|
819
833
|
pass
|
|
820
834
|
|
|
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
|