agent-guardrails 0.3.7 → 0.3.8
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.
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
* Triggered by: Edit, Write, MultiEdit tool usage
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
const fs = require("node:fs");
|
|
13
|
+
const path = require("node:path");
|
|
14
14
|
|
|
15
15
|
const projectDir = process.env.CLAUDE_PROJECT_DIR || process.cwd();
|
|
16
16
|
const resultFile = path.join(projectDir, ".agent-guardrails", "daemon-result.json");
|
|
@@ -20,14 +20,14 @@ if (!fs.existsSync(resultFile)) process.exit(0);
|
|
|
20
20
|
try {
|
|
21
21
|
const data = JSON.parse(fs.readFileSync(resultFile, "utf8"));
|
|
22
22
|
|
|
23
|
-
if (!data.ok && data.result
|
|
23
|
+
if (!data.ok && data.result && data.result.findings && data.result.findings.length > 0) {
|
|
24
24
|
const errors = data.result.findings
|
|
25
25
|
.filter(f => f.severity === "error")
|
|
26
|
-
.map(f =>
|
|
26
|
+
.map(f => "[" + f.code + "] " + f.message)
|
|
27
27
|
.join("\n");
|
|
28
28
|
|
|
29
29
|
if (errors) {
|
|
30
|
-
process.stderr.write(
|
|
30
|
+
process.stderr.write("Guardrails daemon detected issues:\n" + errors + "\n");
|
|
31
31
|
process.exit(2);
|
|
32
32
|
}
|
|
33
33
|
}
|