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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: conduct-cli
3
- Version: 0.4.16
3
+ Version: 0.4.17
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.16"
7
+ version = "0.4.17"
8
8
  description = "CLI for Conduct AI — install agents, manage projects, run tests"
9
9
  readme = "README.md"
10
10
  license = { text = "MIT" }
@@ -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.write_text(_HOOK_SCRIPT)
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.write_text(_HOOK_SCRIPT)
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.write_text(_HOOK_SCRIPT)
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.write_text(_HOOK_SCRIPT)
817
- hook_path.chmod(0o755)
831
+ _write_hook(hook_path)
818
832
  except Exception:
819
833
  pass
820
834
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: conduct-cli
3
- Version: 0.4.16
3
+ Version: 0.4.17
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