gitvow 0.2.0__tar.gz → 0.2.1__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.
Files changed (29) hide show
  1. {gitvow-0.2.0/src/gitvow.egg-info → gitvow-0.2.1}/PKG-INFO +1 -1
  2. {gitvow-0.2.0 → gitvow-0.2.1}/pyproject.toml +1 -1
  3. gitvow-0.2.1/src/gitvow/__main__.py +7 -0
  4. {gitvow-0.2.0 → gitvow-0.2.1}/src/gitvow/install.py +19 -2
  5. {gitvow-0.2.0 → gitvow-0.2.1/src/gitvow.egg-info}/PKG-INFO +1 -1
  6. {gitvow-0.2.0 → gitvow-0.2.1}/src/gitvow.egg-info/SOURCES.txt +1 -0
  7. {gitvow-0.2.0 → gitvow-0.2.1}/tests/test_install_cli.py +26 -0
  8. {gitvow-0.2.0 → gitvow-0.2.1}/LICENSE +0 -0
  9. {gitvow-0.2.0 → gitvow-0.2.1}/README.md +0 -0
  10. {gitvow-0.2.0 → gitvow-0.2.1}/setup.cfg +0 -0
  11. {gitvow-0.2.0 → gitvow-0.2.1}/src/gitvow/__init__.py +0 -0
  12. {gitvow-0.2.0 → gitvow-0.2.1}/src/gitvow/cli.py +0 -0
  13. {gitvow-0.2.0 → gitvow-0.2.1}/src/gitvow/collect.py +0 -0
  14. {gitvow-0.2.0 → gitvow-0.2.1}/src/gitvow/default_policy.json +0 -0
  15. {gitvow-0.2.0 → gitvow-0.2.1}/src/gitvow/hooks/__init__.py +0 -0
  16. {gitvow-0.2.0 → gitvow-0.2.1}/src/gitvow/policy.py +0 -0
  17. {gitvow-0.2.0 → gitvow-0.2.1}/src/gitvow/redact.py +0 -0
  18. {gitvow-0.2.0 → gitvow-0.2.1}/src/gitvow/selftest.py +0 -0
  19. {gitvow-0.2.0 → gitvow-0.2.1}/src/gitvow/state.py +0 -0
  20. {gitvow-0.2.0 → gitvow-0.2.1}/src/gitvow/transcript.py +0 -0
  21. {gitvow-0.2.0 → gitvow-0.2.1}/src/gitvow.egg-info/dependency_links.txt +0 -0
  22. {gitvow-0.2.0 → gitvow-0.2.1}/src/gitvow.egg-info/entry_points.txt +0 -0
  23. {gitvow-0.2.0 → gitvow-0.2.1}/src/gitvow.egg-info/requires.txt +0 -0
  24. {gitvow-0.2.0 → gitvow-0.2.1}/src/gitvow.egg-info/top_level.txt +0 -0
  25. {gitvow-0.2.0 → gitvow-0.2.1}/tests/test_collect.py +0 -0
  26. {gitvow-0.2.0 → gitvow-0.2.1}/tests/test_hooks.py +0 -0
  27. {gitvow-0.2.0 → gitvow-0.2.1}/tests/test_packaging.py +0 -0
  28. {gitvow-0.2.0 → gitvow-0.2.1}/tests/test_policy.py +0 -0
  29. {gitvow-0.2.0 → gitvow-0.2.1}/tests/test_redact.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gitvow
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Provenance and policy gate for AI-agent coding sessions: session trailers on commits, redacted session notes in git, a tool-call gate, and a local ledger. No runtime dependencies.
5
5
  Author-email: Nikhil Bora <nikhil@wirevow.com>
6
6
  License: Apache-2.0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "gitvow"
7
- version = "0.2.0"
7
+ version = "0.2.1"
8
8
  description = "Provenance and policy gate for AI-agent coding sessions: session trailers on commits, redacted session notes in git, a tool-call gate, and a local ledger. No runtime dependencies."
9
9
  readme = "README.md"
10
10
  license = {text = "Apache-2.0"}
@@ -0,0 +1,7 @@
1
+ """Allow `python -m gitvow`."""
2
+
3
+ import sys
4
+
5
+ from .cli import main
6
+
7
+ sys.exit(main())
@@ -5,6 +5,7 @@ from __future__ import annotations
5
5
  import json
6
6
  import os
7
7
  import shutil
8
+ import sys
8
9
  from typing import Any
9
10
 
10
11
  from .state import git
@@ -38,6 +39,21 @@ def _unset_notes_config(cwd: str, scope: list[str]) -> None:
38
39
  git(["config", *scope, "--unset", key, "^" + NOTES_GLOB.replace("*", "\\*").replace(".", "\\.") + "$"], cwd)
39
40
 
40
41
 
42
+ def executable_command() -> str:
43
+ """The command Claude Code should run for this install of gitvow.
44
+
45
+ Hooks run in a shell that may not have a virtualenv or pipx path activated, and a hook that
46
+ cannot be found exits non-zero without blocking, which would silently switch the gate off.
47
+ A per-user install therefore records the absolute path of the console script when one exists,
48
+ falling back to `<python> -m gitvow`; per-repo installs keep the bare name because the settings
49
+ file is shared by people with different paths.
50
+ """
51
+ exe = shutil.which("gitvow", path=os.path.dirname(sys.executable)) or shutil.which("gitvow")
52
+ if exe:
53
+ return exe
54
+ return f"{sys.executable} -m gitvow"
55
+
56
+
41
57
  def _hook_entries(cmd_prefix: str) -> dict[str, list[dict[str, Any]]]:
42
58
  def entry(event: str, matcher: str | None) -> dict[str, Any]:
43
59
  e: dict[str, Any] = {"hooks": [{"type": "command", "command": f"{cmd_prefix} hook {event}"}]}
@@ -95,10 +111,11 @@ def _write_git_hook(dirpath: str) -> str:
95
111
  return p
96
112
 
97
113
 
98
- def install_user(home: str, cmd_prefix: str = "gitvow") -> list[str]:
114
+ def install_user(home: str, cmd_prefix: str | None = None) -> list[str]:
99
115
  base = os.path.join(home, ".gitvow")
100
116
  os.makedirs(base, exist_ok=True)
101
- done = []
117
+ cmd_prefix = cmd_prefix or executable_command()
118
+ done = [f"hook command → {cmd_prefix}"]
102
119
  pol = os.path.join(base, "policy.json")
103
120
  if not os.path.exists(pol):
104
121
  from .policy import DEFAULT_POLICY_PATH
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gitvow
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Provenance and policy gate for AI-agent coding sessions: session trailers on commits, redacted session notes in git, a tool-call gate, and a local ledger. No runtime dependencies.
5
5
  Author-email: Nikhil Bora <nikhil@wirevow.com>
6
6
  License: Apache-2.0
@@ -2,6 +2,7 @@ LICENSE
2
2
  README.md
3
3
  pyproject.toml
4
4
  src/gitvow/__init__.py
5
+ src/gitvow/__main__.py
5
6
  src/gitvow/cli.py
6
7
  src/gitvow/collect.py
7
8
  src/gitvow/default_policy.json
@@ -139,3 +139,29 @@ def test_default_policy_confirms_edits_to_redaction_rules(monkeypatch, repo, cap
139
139
  monkeypatch.chdir(repo)
140
140
  assert cli.main(["check", "--path", ".gitvow/redact-rules.json"]) == 2
141
141
  assert cli.main(["check", "--path", ".gitvow/git-hooks/prepare-commit-msg"]) == 2
142
+
143
+
144
+ def test_user_install_records_absolute_hook_command(home):
145
+ from gitvow.install import executable_command
146
+
147
+ install_user(str(home))
148
+ s = json.loads((home / ".claude" / "settings.json").read_text())
149
+ cmd = s["hooks"]["PreToolUse"][0]["hooks"][0]["command"]
150
+ assert cmd == f"{executable_command()} hook PreToolUse"
151
+ assert cmd.startswith("/") or " -m gitvow " in cmd # never a bare name that depends on PATH
152
+ uninstall_user(str(home))
153
+ assert not (home / ".claude" / "settings.json").exists() # marker still recognised with the absolute path
154
+
155
+
156
+ def test_repo_install_keeps_bare_name(repo, home):
157
+ install_repo(str(repo))
158
+ s = json.loads((repo / ".claude" / "settings.json").read_text())
159
+ assert s["hooks"]["PreToolUse"][0]["hooks"][0]["command"] == "gitvow hook PreToolUse"
160
+
161
+
162
+ def test_python_m_gitvow_entrypoint():
163
+ import subprocess
164
+ import sys
165
+
166
+ r = subprocess.run([sys.executable, "-m", "gitvow", "--version"], capture_output=True, text=True)
167
+ assert r.returncode == 0 and r.stdout.startswith("gitvow ")
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
File without changes
File without changes
File without changes
File without changes