git-agent-verdict 0.0.0 → 2.0.4

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.
package/README.md ADDED
@@ -0,0 +1,100 @@
1
+ <!-- Concern: what this tool is worth to a repo running agents, the loop an agent follows to commit, and how to install it | Non-concern: the flags (--help) or the wiring (--repo-setup-guide) | IO: none -->
2
+ # git-agent-verdict
3
+
4
+ [![crates.io](https://img.shields.io/crates/v/git-agent-verdict.svg)](https://crates.io/crates/git-agent-verdict)
5
+ [![npm](https://img.shields.io/npm/v/git-agent-verdict.svg)](https://www.npmjs.com/package/git-agent-verdict)
6
+ [![CI](https://github.com/fredrikolis/git-agent-verdict/actions/workflows/ci.yml/badge.svg)](https://github.com/fredrikolis/git-agent-verdict/actions/workflows/ci.yml)
7
+ [![license](https://img.shields.io/crates/l/git-agent-verdict.svg)](LICENSE)
8
+
9
+ `git-agent-verdict` is a CLI tool that blocks agents from committing code that does not comply with
10
+ your organization's standards. It uses git's built-in `commit-msg` hook to enforce that every commit
11
+ carries a passing verdict. Built for repos where an agent is the sole maintainer and no human is
12
+ expected to see the diff before it lands.
13
+
14
+ ![you-shall-not-pass.gif](https://media2.giphy.com/media/v1.Y2lkPTc5MGI3NjExOGN1MTdmZzM3OWpwMXg0MjZrcGsyZmZ3MjN6Y2dsb3I3MzdydHc3byZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/YkfhemFXalh7O/giphy.gif)
15
+
16
+ **Review is mandatory**, and happens before the commit exists.
17
+
18
+ **No self-review.** The tool invokes the reviewer, not the agent, and the one line the agent supplies
19
+ is auto-rejected if it argues for the change instead of stating what it does.
20
+
21
+ **The verdict rides in the commit**, with the neutral intent as the subject. `git log` is the audit
22
+ trail: what changed, who reviewed it, what they found.
23
+
24
+ ## Expected agent usage
25
+
26
+ The agent finds the tool by hitting it. Nothing has to be read first.
27
+
28
+ ```
29
+ Bash(git commit -am "add retry to the uploader")
30
+ ⎿ git-agent-verdict: error: standards: no reviewable trailer
31
+ use `git agent-verdict attest --intent "<one line>"` to commit
32
+ ```
33
+
34
+ The agent states in one neutral line what the diff does, spawns the reviewer, and waits for it.
35
+
36
+ ```
37
+ Bash(git agent-verdict attest --intent "retry a failed upload three times")
38
+ ⎿ git-agent-verdict: spawned attestation process (pid 48213)
39
+ use `git agent-verdict await` to wait for it
40
+
41
+ Bash(git agent-verdict await)
42
+ ⎿ git-agent-verdict: BLOCKED
43
+ 1-standards.log # BLOCKED
44
+ address the reported findings, then: git agent-verdict attest
45
+ ```
46
+
47
+ The agent reads the log, fixes the MAJOR findings, and attests again. A gate that has passed is not
48
+ re-reviewed. Committing is its own call, so findings under a passing verdict are read before
49
+ anything lands.
50
+
51
+ ```
52
+ Bash(git agent-verdict commit)
53
+ ⎿ [main 3f9a1c2] retry a failed upload three times
54
+ Reviewed-standards: reviewer=claude-opus-5 major=0 moderate=2 minor=1 token=1f0c...
55
+ Reviewed-docs: reviewer=claude-opus-5 major=0 moderate=0 minor=0 token=8ba7...
56
+ ```
57
+
58
+ ## Install
59
+
60
+ ```bash
61
+ cargo install git-agent-verdict
62
+ git config --global agent-verdict.runner claude
63
+ ```
64
+
65
+ Installs as `git agent-verdict`.
66
+
67
+ ## Configure a repo
68
+
69
+ Declare one gate per line in the `commit-msg` hook. Line order is review order, and the gate name
70
+ becomes the trailer key.
71
+
72
+ ```bash
73
+ #!/usr/bin/env bash
74
+ set -euo pipefail
75
+ git agent-verdict --require-version 2.0
76
+
77
+ git agent-verdict "$1" standards --model opus \
78
+ --standard programming --standard testing --path .
79
+
80
+ git agent-verdict "$1" docs --simple --doc docs/house-style.md --path "*.md"
81
+ ```
82
+
83
+ `.git/hooks/commit-msg` is the standard location and needs no configuration, but git does not track
84
+ it, so each clone and each agent would install its own. To make the gates a property of the repo,
85
+ commit the hook and point git at it:
86
+
87
+ ```bash
88
+ chmod +x .githooks/commit-msg
89
+ git config core.hooksPath .githooks
90
+ ```
91
+
92
+ `git agent-verdict --repo-setup-guide` prints the full reference: every flag a declaration takes,
93
+ what `--simple` and `--read-only` change, and how to feed a gate a rubric that lives outside the
94
+ repo. `--help` is the flag grammar.
95
+
96
+ ## Contributing
97
+
98
+ The reviewer runs on Claude Code today. **Please help us add support for other agents.** The seam is
99
+ `src/runner.rs` and `src/agent.rs`: an agent is an argv, a session, and an answer this tool parses
100
+ verdicts out of. Nothing above that layer knows which one answered.
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const path = require("path");
5
+ const { execFileSync } = require("child_process");
6
+
7
+ const PACKAGES = {
8
+ "linux-x64": "git-agent-verdict-linux-x64-musl",
9
+ "linux-arm64": "git-agent-verdict-linux-arm64-musl",
10
+ "darwin-x64": "git-agent-verdict-darwin-x64",
11
+ "darwin-arm64": "git-agent-verdict-darwin-arm64",
12
+ };
13
+
14
+ function fail(message) {
15
+ process.stderr.write(`git-agent-verdict: ${message}\n`);
16
+ process.exit(1);
17
+ }
18
+
19
+ const key = `${process.platform}-${process.arch}`;
20
+ const pkg = PACKAGES[key];
21
+ if (!pkg) {
22
+ fail(`no prebuilt binary is published for ${key}: cargo install git-agent-verdict`);
23
+ }
24
+
25
+ let bin;
26
+ try {
27
+ bin = path.join(path.dirname(require.resolve(`${pkg}/package.json`)), "git-agent-verdict");
28
+ } catch (_err) {
29
+ fail(`the binary for ${key} is missing: npm install -g git-agent-verdict, without --no-optional`);
30
+ }
31
+
32
+ try {
33
+ execFileSync(bin, process.argv.slice(2), { stdio: "inherit" });
34
+ } catch (err) {
35
+ // The binary's own status, which is what a commit-msg hook reads.
36
+ if (typeof err.status === "number") {
37
+ process.exit(err.status);
38
+ }
39
+ fail(err.signal ? `killed by signal ${err.signal}` : err.message);
40
+ }
package/package.json CHANGED
@@ -1,7 +1,18 @@
1
1
  {
2
2
  "name": "git-agent-verdict",
3
- "version": "0.0.0",
4
- "description": "Name placeholder. The first release supersedes this version.",
3
+ "version": "2.0.4",
4
+ "description": "Blocks agents from committing code that does not comply with your organization's standards.",
5
+ "keywords": ["cli", "git", "hook", "code-review", "agents"],
6
+ "homepage": "https://github.com/fredrikolis/git-agent-verdict",
7
+ "repository": { "type": "git", "url": "git+https://github.com/fredrikolis/git-agent-verdict.git" },
5
8
  "license": "MIT",
6
- "files": []
9
+ "bin": { "git-agent-verdict": "bin/git-agent-verdict.js" },
10
+ "files": ["bin/git-agent-verdict.js"],
11
+ "engines": { "node": ">=18" },
12
+ "optionalDependencies": {
13
+ "git-agent-verdict-linux-x64-musl": "2.0.4",
14
+ "git-agent-verdict-linux-arm64-musl": "2.0.4",
15
+ "git-agent-verdict-darwin-x64": "2.0.4",
16
+ "git-agent-verdict-darwin-arm64": "2.0.4"
17
+ }
7
18
  }