git-agent-verdict 0.0.0 → 2.0.3
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 +99 -0
- package/bin/git-agent-verdict.js +40 -0
- package/package.json +14 -3
package/README.md
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
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
|
+
[](https://crates.io/crates/git-agent-verdict)
|
|
5
|
+
[](https://github.com/fredrikolis/git-agent-verdict/actions/workflows/ci.yml)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
|
|
8
|
+
`git-agent-verdict` is a CLI tool that blocks agents from committing code that does not comply with
|
|
9
|
+
your organization's standards. It uses git's built-in `commit-msg` hook to enforce that every commit
|
|
10
|
+
carries a passing verdict. Built for repos where an agent is the sole maintainer and no human is
|
|
11
|
+
expected to see the diff before it lands.
|
|
12
|
+
|
|
13
|
+

|
|
14
|
+
|
|
15
|
+
**Review is mandatory**, and happens before the commit exists.
|
|
16
|
+
|
|
17
|
+
**No self-review.** The tool invokes the reviewer, not the agent, and the one line the agent supplies
|
|
18
|
+
is auto-rejected if it argues for the change instead of stating what it does.
|
|
19
|
+
|
|
20
|
+
**The verdict rides in the commit**, with the neutral intent as the subject. `git log` is the audit
|
|
21
|
+
trail: what changed, who reviewed it, what they found.
|
|
22
|
+
|
|
23
|
+
## Expected agent usage
|
|
24
|
+
|
|
25
|
+
The agent finds the tool by hitting it. Nothing has to be read first.
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
Bash(git commit -am "add retry to the uploader")
|
|
29
|
+
⎿ git-agent-verdict: error: standards: no reviewable trailer
|
|
30
|
+
use `git agent-verdict attest --intent "<one line>"` to commit
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
The agent states in one neutral line what the diff does, spawns the reviewer, and waits for it.
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
Bash(git agent-verdict attest --intent "retry a failed upload three times")
|
|
37
|
+
⎿ git-agent-verdict: spawned attestation process (pid 48213)
|
|
38
|
+
use `git agent-verdict await` to wait for it
|
|
39
|
+
|
|
40
|
+
Bash(git agent-verdict await)
|
|
41
|
+
⎿ git-agent-verdict: BLOCKED
|
|
42
|
+
1-standards.log # BLOCKED
|
|
43
|
+
address the reported findings, then: git agent-verdict attest
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
The agent reads the log, fixes the MAJOR findings, and attests again. A gate that has passed is not
|
|
47
|
+
re-reviewed. Committing is its own call, so findings under a passing verdict are read before
|
|
48
|
+
anything lands.
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
Bash(git agent-verdict commit)
|
|
52
|
+
⎿ [main 3f9a1c2] retry a failed upload three times
|
|
53
|
+
Reviewed-standards: reviewer=claude-opus-5 major=0 moderate=2 minor=1 token=1f0c...
|
|
54
|
+
Reviewed-docs: reviewer=claude-opus-5 major=0 moderate=0 minor=0 token=8ba7...
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Install
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
cargo install git-agent-verdict
|
|
61
|
+
git config --global agent-verdict.runner claude
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Installs as `git agent-verdict`.
|
|
65
|
+
|
|
66
|
+
## Configure a repo
|
|
67
|
+
|
|
68
|
+
Declare one gate per line in the `commit-msg` hook. Line order is review order, and the gate name
|
|
69
|
+
becomes the trailer key.
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
#!/usr/bin/env bash
|
|
73
|
+
set -euo pipefail
|
|
74
|
+
git agent-verdict --require-version 2.0
|
|
75
|
+
|
|
76
|
+
git agent-verdict "$1" standards --model opus \
|
|
77
|
+
--standard programming --standard testing --path .
|
|
78
|
+
|
|
79
|
+
git agent-verdict "$1" docs --simple --doc docs/house-style.md --path "*.md"
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
`.git/hooks/commit-msg` is the standard location and needs no configuration, but git does not track
|
|
83
|
+
it, so each clone and each agent would install its own. To make the gates a property of the repo,
|
|
84
|
+
commit the hook and point git at it:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
chmod +x .githooks/commit-msg
|
|
88
|
+
git config core.hooksPath .githooks
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
`git agent-verdict --repo-setup-guide` prints the full reference: every flag a declaration takes,
|
|
92
|
+
what `--simple` and `--read-only` change, and how to feed a gate a rubric that lives outside the
|
|
93
|
+
repo. `--help` is the flag grammar.
|
|
94
|
+
|
|
95
|
+
## Contributing
|
|
96
|
+
|
|
97
|
+
The reviewer runs on Claude Code today. **Please help us add support for other agents.** The seam is
|
|
98
|
+
`src/runner.rs` and `src/agent.rs`: an agent is an argv, a session, and an answer this tool parses
|
|
99
|
+
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": "
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.0.3",
|
|
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
|
-
"
|
|
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.3",
|
|
14
|
+
"git-agent-verdict-linux-arm64-musl": "2.0.3",
|
|
15
|
+
"git-agent-verdict-darwin-x64": "2.0.3",
|
|
16
|
+
"git-agent-verdict-darwin-arm64": "2.0.3"
|
|
17
|
+
}
|
|
7
18
|
}
|