agent-gauntlet 0.2.1 → 0.2.2
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/package.json +1 -1
- package/src/config/loader.ts +9 -6
- package/src/config/schema.ts +0 -1
- package/src/config/types.ts +1 -0
- package/src/gates/review.ts +0 -1
- package/src/output/console.ts +1 -37
package/package.json
CHANGED
package/src/config/loader.ts
CHANGED
|
@@ -44,16 +44,19 @@ export async function loadConfig(
|
|
|
44
44
|
const filePath = path.join(checksPath, file);
|
|
45
45
|
const content = await fs.readFile(filePath, "utf-8");
|
|
46
46
|
const raw = YAML.parse(content);
|
|
47
|
-
|
|
47
|
+
const name = path.basename(file, path.extname(file));
|
|
48
48
|
const parsed: CheckGateConfig = checkGateSchema.parse(raw);
|
|
49
49
|
|
|
50
50
|
// Load fix instructions if specified
|
|
51
|
-
const loadedCheck: LoadedCheckGateConfig = {
|
|
51
|
+
const loadedCheck: LoadedCheckGateConfig = {
|
|
52
|
+
...parsed,
|
|
53
|
+
name,
|
|
54
|
+
};
|
|
52
55
|
if (parsed.fix_instructions) {
|
|
53
56
|
// Security: Reject absolute paths to prevent reading arbitrary files
|
|
54
57
|
if (path.isAbsolute(parsed.fix_instructions)) {
|
|
55
58
|
throw new Error(
|
|
56
|
-
`Fix instructions path must be relative to .gauntlet/ directory, got absolute path: ${parsed.fix_instructions} (referenced by check "${
|
|
59
|
+
`Fix instructions path must be relative to .gauntlet/ directory, got absolute path: ${parsed.fix_instructions} (referenced by check "${name}")`,
|
|
57
60
|
);
|
|
58
61
|
}
|
|
59
62
|
|
|
@@ -75,12 +78,12 @@ export async function loadConfig(
|
|
|
75
78
|
relativePath === ""
|
|
76
79
|
) {
|
|
77
80
|
throw new Error(
|
|
78
|
-
`Fix instructions path must stay within .gauntlet/ directory and point to a file: ${parsed.fix_instructions} resolves to ${fixInstructionsPath} (referenced by check "${
|
|
81
|
+
`Fix instructions path must stay within .gauntlet/ directory and point to a file: ${parsed.fix_instructions} resolves to ${fixInstructionsPath} (referenced by check "${name}")`,
|
|
79
82
|
);
|
|
80
83
|
}
|
|
81
84
|
if (!(await fileExists(fixInstructionsPath))) {
|
|
82
85
|
throw new Error(
|
|
83
|
-
`Fix instructions file not found: ${fixInstructionsPath} (referenced by check "${
|
|
86
|
+
`Fix instructions file not found: ${fixInstructionsPath} (referenced by check "${name}")`,
|
|
84
87
|
);
|
|
85
88
|
}
|
|
86
89
|
loadedCheck.fixInstructionsContent = await fs.readFile(
|
|
@@ -89,7 +92,7 @@ export async function loadConfig(
|
|
|
89
92
|
);
|
|
90
93
|
}
|
|
91
94
|
|
|
92
|
-
checks[
|
|
95
|
+
checks[name] = loadedCheck;
|
|
93
96
|
}
|
|
94
97
|
}
|
|
95
98
|
}
|
package/src/config/schema.ts
CHANGED
package/src/config/types.ts
CHANGED
package/src/gates/review.ts
CHANGED
|
@@ -462,7 +462,6 @@ export class ReviewGateExecutor {
|
|
|
462
462
|
const resultMsg = `Review result (${adapter.name}): ${evaluation.status} - ${evaluation.message}`;
|
|
463
463
|
await adapterLogger(`${resultMsg}\n`);
|
|
464
464
|
|
|
465
|
-
|
|
466
465
|
return { adapter: adapter.name, evaluation };
|
|
467
466
|
} catch (error: unknown) {
|
|
468
467
|
const err = error as { message?: string };
|
package/src/output/console.ts
CHANGED
|
@@ -44,8 +44,7 @@ export class ConsoleReporter {
|
|
|
44
44
|
let logInfo = "";
|
|
45
45
|
if (result.status !== "pass") {
|
|
46
46
|
// Try to find a relevant log path
|
|
47
|
-
const logPath =
|
|
48
|
-
result.logPath || (result.logPaths && result.logPaths[0]);
|
|
47
|
+
const logPath = result.logPath || result.logPaths?.[0];
|
|
49
48
|
if (logPath) {
|
|
50
49
|
logInfo = `\n Log: ${logPath}`;
|
|
51
50
|
}
|
|
@@ -261,39 +260,4 @@ export class ConsoleReporter {
|
|
|
261
260
|
|
|
262
261
|
return details;
|
|
263
262
|
}
|
|
264
|
-
|
|
265
|
-
private printFailureDetails(result: GateResult, details: string[]) {
|
|
266
|
-
const statusColor = result.status === "error" ? chalk.magenta : chalk.red;
|
|
267
|
-
const statusLabel = result.status === "error" ? "ERROR" : "FAIL";
|
|
268
|
-
|
|
269
|
-
console.log(statusColor(`[${statusLabel}] ${result.jobId}`));
|
|
270
|
-
if (result.message) {
|
|
271
|
-
console.log(chalk.dim(` Summary: ${result.message}`));
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
if (details.length > 0) {
|
|
275
|
-
console.log(chalk.dim(" Details:"));
|
|
276
|
-
details.forEach((detail) => {
|
|
277
|
-
console.log(detail);
|
|
278
|
-
});
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
if (result.logPaths && result.logPaths.length > 0) {
|
|
282
|
-
result.logPaths.forEach((p) => {
|
|
283
|
-
console.log(chalk.dim(` Log: ${p}`));
|
|
284
|
-
});
|
|
285
|
-
} else if (result.logPath) {
|
|
286
|
-
console.log(chalk.dim(` Log: ${result.logPath}`));
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
if (result.fixInstructions) {
|
|
290
|
-
console.log(
|
|
291
|
-
chalk.cyan(
|
|
292
|
-
` Fix instructions: available (${result.fixInstructions.split("\n").length} lines)`,
|
|
293
|
-
),
|
|
294
|
-
);
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
console.log(""); // Empty line between failures
|
|
298
|
-
}
|
|
299
263
|
}
|