@codacy/verity-cli 0.29.4-experimental.c9a3712 → 0.29.4-experimental.cfb4bd2
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/bin/verity.js +137 -15
- package/package.json +1 -1
package/bin/verity.js
CHANGED
|
@@ -10390,11 +10390,11 @@ var MAX_DELTA_BYTES = 194560;
|
|
|
10390
10390
|
var MAX_FILES = 40;
|
|
10391
10391
|
var MAX_FILE_BYTES = 51200;
|
|
10392
10392
|
var DEBOUNCE_SECONDS = 30;
|
|
10393
|
-
var MAX_SPEC_FILES =
|
|
10394
|
-
var MAX_SPEC_FILE_BYTES =
|
|
10395
|
-
var MAX_TOTAL_SPEC_BYTES =
|
|
10393
|
+
var MAX_SPEC_FILES = 6;
|
|
10394
|
+
var MAX_SPEC_FILE_BYTES = 512e3;
|
|
10395
|
+
var MAX_TOTAL_SPEC_BYTES = 512e3;
|
|
10396
10396
|
var MAX_PLAN_FILES = 3;
|
|
10397
|
-
var MAX_PLAN_FILE_BYTES =
|
|
10397
|
+
var MAX_PLAN_FILE_BYTES = 512e3;
|
|
10398
10398
|
var MAX_INTENT_CHARS = 2e3;
|
|
10399
10399
|
var SNAPSHOT_DIR = `${VERITY_DIR}/.snapshot`;
|
|
10400
10400
|
var BASELINE_DIR = `${VERITY_DIR}/.baseline`;
|
|
@@ -15060,8 +15060,10 @@ function recordVerdict(d, v) {
|
|
|
15060
15060
|
if (summary) appendEvent(d, { k: "goal_delivered", summary });
|
|
15061
15061
|
}
|
|
15062
15062
|
const lines = /* @__PURE__ */ new Map();
|
|
15063
|
+
const sent = new Set(v.sentPaths);
|
|
15063
15064
|
for (const f of v.findings) {
|
|
15064
15065
|
if (!f.file || typeof f.line !== "number" || !f.pattern_id) continue;
|
|
15066
|
+
if (!sent.has(f.file)) continue;
|
|
15065
15067
|
if (!lines.has(f.file)) {
|
|
15066
15068
|
try {
|
|
15067
15069
|
const abs = (0, import_node_path12.join)(root, f.file);
|
|
@@ -16765,6 +16767,30 @@ function formatRunEvidence(run, startedAt) {
|
|
|
16765
16767
|
out += row("", `${cov.outsideRepo} authored path(s) refused as outside the repo`);
|
|
16766
16768
|
}
|
|
16767
16769
|
}
|
|
16770
|
+
if (run.foldResult?.tools?.length) {
|
|
16771
|
+
const shown = run.foldResult.tools.slice(0, 6).map((t) => {
|
|
16772
|
+
const outcome = t.failed > 0 ? `${t.failed} failed` : t.last_status === 0 ? "ok" : "?";
|
|
16773
|
+
const where = t.targets.length > 0 ? ` \u2192 ${t.targets.slice(0, 2).join(", ")}` : "";
|
|
16774
|
+
return `${t.runs}\xD7 ${t.name} (${outcome})${where}`;
|
|
16775
|
+
});
|
|
16776
|
+
const more = run.foldResult.tools.length > 6 ? ` \u2026 +${run.foldResult.tools.length - 6} more` : "";
|
|
16777
|
+
out += row("tools", shown.join(" \xB7 ") + more);
|
|
16778
|
+
if (run.foldResult.coverage.toolNamesDropped > 0) {
|
|
16779
|
+
out += row("", `\u26A0 ${run.foldResult.coverage.toolNamesDropped} tool name(s) refused by the cap`);
|
|
16780
|
+
}
|
|
16781
|
+
}
|
|
16782
|
+
if (run.foldResult?.tasks?.length) {
|
|
16783
|
+
const t = run.foldResult.tasks;
|
|
16784
|
+
const done2 = t.filter((x) => x.status === "completed").length;
|
|
16785
|
+
out += row("tasks", `${t.length} \xB7 ${done2} completed \xB7 ` + list(t.slice(0, 4).map((x) => `#${x.id} ${x.name} [${x.status}]`), 4));
|
|
16786
|
+
}
|
|
16787
|
+
if (run.specs?.length) {
|
|
16788
|
+
const readThisSession = new Set(run.actionSummary?.files_read ?? []);
|
|
16789
|
+
const labelled = run.specs.map(
|
|
16790
|
+
(s) => `${s.path}${readThisSession.has(s.path) ? " (read)" : " (positional)"}`
|
|
16791
|
+
);
|
|
16792
|
+
out += row("specs", `${run.specs.length} \xB7 ${list(labelled, 5)}`);
|
|
16793
|
+
}
|
|
16768
16794
|
if (run.staticResults.findings.length > 0) {
|
|
16769
16795
|
out += row("static", `${run.staticResults.findings.length} finding(s) from ${run.staticResults.summary.tools_run.join(", ") || "no tools"}`);
|
|
16770
16796
|
}
|
|
@@ -17216,7 +17242,7 @@ function channelSilence(input) {
|
|
|
17216
17242
|
// src/lib/cli-version.ts
|
|
17217
17243
|
function cliVersion() {
|
|
17218
17244
|
try {
|
|
17219
|
-
return true ? "0.29.4-experimental.
|
|
17245
|
+
return true ? "0.29.4-experimental.cfb4bd2" : "dev";
|
|
17220
17246
|
} catch {
|
|
17221
17247
|
return "dev";
|
|
17222
17248
|
}
|
|
@@ -17567,18 +17593,26 @@ var SPEC_CANDIDATES = [
|
|
|
17567
17593
|
"docs/API.md",
|
|
17568
17594
|
"spec/ARCHITECTURE.md"
|
|
17569
17595
|
];
|
|
17570
|
-
|
|
17596
|
+
var DOC_EXT = /\.(md|mdx|ya?ml|txt|rst|adoc)$/i;
|
|
17597
|
+
var UNCONSULTED_FILE_BYTES = 10240;
|
|
17598
|
+
var UNCONSULTED_TOTAL_BYTES = 30720;
|
|
17599
|
+
function discoverSpecs(consulted = []) {
|
|
17571
17600
|
const result = [];
|
|
17572
17601
|
const seen = /* @__PURE__ */ new Set();
|
|
17573
17602
|
let totalBytes = 0;
|
|
17574
|
-
const
|
|
17603
|
+
const consultedDocs = new Set(
|
|
17604
|
+
consulted.filter((p) => DOC_EXT.test(p) && !p.startsWith("/") && !p.includes(".."))
|
|
17605
|
+
);
|
|
17606
|
+
const addSpec = (specPath, relevant = false) => {
|
|
17575
17607
|
if (result.length >= MAX_SPEC_FILES) return false;
|
|
17576
|
-
|
|
17608
|
+
const totalCap = relevant ? MAX_TOTAL_SPEC_BYTES : UNCONSULTED_TOTAL_BYTES;
|
|
17609
|
+
if (totalBytes >= totalCap) return false;
|
|
17577
17610
|
if (seen.has(specPath)) return true;
|
|
17578
17611
|
if (!(0, import_node_fs21.existsSync)(specPath)) return true;
|
|
17579
17612
|
seen.add(specPath);
|
|
17580
|
-
const remaining =
|
|
17581
|
-
const
|
|
17613
|
+
const remaining = totalCap - totalBytes;
|
|
17614
|
+
const fileCap = relevant ? MAX_SPEC_FILE_BYTES : UNCONSULTED_FILE_BYTES;
|
|
17615
|
+
const readBytes = Math.min(fileCap, remaining);
|
|
17582
17616
|
try {
|
|
17583
17617
|
const buf = Buffer.alloc(readBytes);
|
|
17584
17618
|
const fd = (0, import_node_fs21.openSync)(specPath, "r");
|
|
@@ -17592,6 +17626,9 @@ function discoverSpecs() {
|
|
|
17592
17626
|
}
|
|
17593
17627
|
return true;
|
|
17594
17628
|
};
|
|
17629
|
+
for (const doc of consultedDocs) {
|
|
17630
|
+
if (!addSpec(doc, true)) break;
|
|
17631
|
+
}
|
|
17595
17632
|
for (const candidate of SPEC_CANDIDATES) {
|
|
17596
17633
|
if (!addSpec(candidate)) break;
|
|
17597
17634
|
}
|
|
@@ -17662,7 +17699,7 @@ function discoverPlans() {
|
|
|
17662
17699
|
async function intentInputs(run) {
|
|
17663
17700
|
const { actionSummary, allForReview, assistantResponse, baseline, baselineSessionId } = run;
|
|
17664
17701
|
const conversation = await readAndClearConversationBuffer(baselineSessionId);
|
|
17665
|
-
const specs = discoverSpecs();
|
|
17702
|
+
const specs = discoverSpecs(actionSummary?.files_read ?? []);
|
|
17666
17703
|
const plans = discoverPlans();
|
|
17667
17704
|
const agentAuthoredCodeThisTurn = !!(actionSummary && (actionSummary.files_edited.length > 0 || actionSummary.files_created.length > 0));
|
|
17668
17705
|
const turnAuthoredCode = agentAuthoredCodeThisTurn || !!baseline && allForReview.some((f) => changedSinceBaseline(f, baseline));
|
|
@@ -18178,6 +18215,18 @@ function commandShape(cmd) {
|
|
|
18178
18215
|
return out.join(" ").slice(0, COMMAND_HEAD_CHARS);
|
|
18179
18216
|
}
|
|
18180
18217
|
var COMMAND_HEAD_CHARS = 80;
|
|
18218
|
+
var MAX_TOOL_NAMES = 64;
|
|
18219
|
+
var MAX_TOOL_TARGETS = 3;
|
|
18220
|
+
var MAX_TASKS = 64;
|
|
18221
|
+
var TASK_NAME_CHARS = 120;
|
|
18222
|
+
function toolTarget(name, input) {
|
|
18223
|
+
if (name === "Bash") return null;
|
|
18224
|
+
for (const key of ["file_path", "notebook_path", "path", "filePath"]) {
|
|
18225
|
+
const v = input[key];
|
|
18226
|
+
if (typeof v === "string" && v) return v.slice(0, 120);
|
|
18227
|
+
}
|
|
18228
|
+
return null;
|
|
18229
|
+
}
|
|
18181
18230
|
var rootCandidateCache = /* @__PURE__ */ new Map();
|
|
18182
18231
|
function candidateRoots(repoRoot2) {
|
|
18183
18232
|
const cached2 = rootCandidateCache.get(repoRoot2);
|
|
@@ -18220,6 +18269,8 @@ function fold(transcriptPath, opts = {}) {
|
|
|
18220
18269
|
authored: [],
|
|
18221
18270
|
unobserved: [],
|
|
18222
18271
|
commands: [],
|
|
18272
|
+
tools: [],
|
|
18273
|
+
tasks: [],
|
|
18223
18274
|
unknownTypes: [],
|
|
18224
18275
|
coverage: {
|
|
18225
18276
|
recordCounts: {},
|
|
@@ -18227,6 +18278,7 @@ function fold(transcriptPath, opts = {}) {
|
|
|
18227
18278
|
malformed: 0,
|
|
18228
18279
|
subagentFiles: 0,
|
|
18229
18280
|
outsideRepo: 0,
|
|
18281
|
+
toolNamesDropped: 0,
|
|
18230
18282
|
dispatched: 0,
|
|
18231
18283
|
userMessages: 0,
|
|
18232
18284
|
subagentSkipped: 0,
|
|
@@ -18237,6 +18289,10 @@ function fold(transcriptPath, opts = {}) {
|
|
|
18237
18289
|
const byPath = /* @__PURE__ */ new Map();
|
|
18238
18290
|
const commandStats = /* @__PURE__ */ new Map();
|
|
18239
18291
|
const pendingByToolUse = /* @__PURE__ */ new Map();
|
|
18292
|
+
const toolStats = /* @__PURE__ */ new Map();
|
|
18293
|
+
const pendingToolName = /* @__PURE__ */ new Map();
|
|
18294
|
+
const taskById = /* @__PURE__ */ new Map();
|
|
18295
|
+
const pendingTaskName = /* @__PURE__ */ new Map();
|
|
18240
18296
|
const unknown = /* @__PURE__ */ new Set();
|
|
18241
18297
|
const ingest = (raw, owner) => {
|
|
18242
18298
|
for (const line of raw.split("\n")) {
|
|
@@ -18256,7 +18312,7 @@ function fold(transcriptPath, opts = {}) {
|
|
|
18256
18312
|
result.coverage.compactions++;
|
|
18257
18313
|
}
|
|
18258
18314
|
if (type === "user" && hasUserText(record)) result.coverage.userMessages++;
|
|
18259
|
-
collectFromRecord(record, owner, byPath, commandStats, pendingByToolUse, opts.repoRoot, result.coverage);
|
|
18315
|
+
collectFromRecord(record, owner, byPath, commandStats, pendingByToolUse, toolStats, pendingToolName, taskById, pendingTaskName, opts.repoRoot, result.coverage);
|
|
18260
18316
|
}
|
|
18261
18317
|
};
|
|
18262
18318
|
try {
|
|
@@ -18314,6 +18370,14 @@ function fold(transcriptPath, opts = {}) {
|
|
|
18314
18370
|
result.authored = [...byPath.values()].sort((a, b) => a.p.localeCompare(b.p));
|
|
18315
18371
|
result.unknownTypes = [...unknown].sort();
|
|
18316
18372
|
result.commands = [...commandStats.entries()].map(([cls, s]) => ({ class: cls, ...s })).sort((a, b) => a.class.localeCompare(b.class));
|
|
18373
|
+
result.tools = [...toolStats.entries()].map(([name, s]) => ({
|
|
18374
|
+
name,
|
|
18375
|
+
runs: s.runs,
|
|
18376
|
+
failed: s.failed,
|
|
18377
|
+
last_status: s.last_status,
|
|
18378
|
+
targets: [...s.targets].map((t) => toRepoRelative(t, opts.repoRoot)).sort()
|
|
18379
|
+
})).sort((a, b) => b.runs - a.runs || a.name.localeCompare(b.name));
|
|
18380
|
+
result.tasks = [...taskById.entries()].map(([id, t]) => ({ id, name: t.name, status: t.status })).sort((a, b) => (Number(a.id) || 0) - (Number(b.id) || 0));
|
|
18317
18381
|
const authoredPaths = new Set(result.authored.map((a) => a.p));
|
|
18318
18382
|
for (const raw of opts.changedFiles ?? []) {
|
|
18319
18383
|
const p = toRepoRelative(raw, opts.repoRoot);
|
|
@@ -18332,7 +18396,7 @@ function classifyUnobserved(path) {
|
|
|
18332
18396
|
if (/\.(png|jpg|jpeg|gif|pdf|zip|woff2?|ico|mp4)$/i.test(path)) return "binary";
|
|
18333
18397
|
return "no_edit_record";
|
|
18334
18398
|
}
|
|
18335
|
-
function collectFromRecord(record, owner, byPath, commandStats, pendingByToolUse, repoRoot2, tally) {
|
|
18399
|
+
function collectFromRecord(record, owner, byPath, commandStats, pendingByToolUse, toolStats, pendingToolName, taskById, pendingTaskName, repoRoot2, tally) {
|
|
18336
18400
|
const message = record.message;
|
|
18337
18401
|
const content = message?.content ?? record.content;
|
|
18338
18402
|
const blocks = Array.isArray(content) ? content : content && typeof content === "object" ? [content] : [];
|
|
@@ -18341,6 +18405,32 @@ function collectFromRecord(record, owner, byPath, commandStats, pendingByToolUse
|
|
|
18341
18405
|
if (blockType === "tool_use") {
|
|
18342
18406
|
const name = String(block.name ?? "");
|
|
18343
18407
|
const input = block.input ?? {};
|
|
18408
|
+
if (name && toolStats.size < MAX_TOOL_NAMES) {
|
|
18409
|
+
const prev = toolStats.get(name) ?? { runs: 0, failed: 0, last_status: null, targets: /* @__PURE__ */ new Set() };
|
|
18410
|
+
prev.targets = prev.targets ?? /* @__PURE__ */ new Set();
|
|
18411
|
+
if (prev.targets.size < MAX_TOOL_TARGETS) {
|
|
18412
|
+
const target = toolTarget(name, input);
|
|
18413
|
+
if (target) prev.targets.add(target);
|
|
18414
|
+
}
|
|
18415
|
+
toolStats.set(name, { runs: prev.runs + 1, failed: prev.failed, last_status: null, targets: prev.targets });
|
|
18416
|
+
const toolId = typeof block.id === "string" ? block.id : null;
|
|
18417
|
+
if (toolId) pendingToolName.set(toolId, name);
|
|
18418
|
+
} else if (name && tally) {
|
|
18419
|
+
tally.toolNamesDropped += 1;
|
|
18420
|
+
}
|
|
18421
|
+
if (name === "TaskCreate") {
|
|
18422
|
+
const subject = typeof input.subject === "string" ? input.subject : "";
|
|
18423
|
+
const taskId = typeof block.id === "string" ? block.id : null;
|
|
18424
|
+
if (subject && taskId) pendingTaskName.set(taskId, subject.slice(0, TASK_NAME_CHARS));
|
|
18425
|
+
}
|
|
18426
|
+
if (name === "TaskUpdate") {
|
|
18427
|
+
const id = typeof input.taskId === "string" ? input.taskId : "";
|
|
18428
|
+
const status = typeof input.status === "string" ? input.status : "";
|
|
18429
|
+
if (id && status) {
|
|
18430
|
+
const entry = taskById.get(id);
|
|
18431
|
+
taskById.set(id, { name: entry?.name ?? `#${id}`, status });
|
|
18432
|
+
}
|
|
18433
|
+
}
|
|
18344
18434
|
if (EDIT_TOOLS.has(name)) {
|
|
18345
18435
|
const rawPath = typeof input.notebook_path === "string" ? input.notebook_path : typeof input.file_path === "string" ? input.file_path : null;
|
|
18346
18436
|
if (rawPath && !isInsideRepo(rawPath, repoRoot2)) {
|
|
@@ -18380,6 +18470,31 @@ function collectFromRecord(record, owner, byPath, commandStats, pendingByToolUse
|
|
|
18380
18470
|
}
|
|
18381
18471
|
if (blockType === "tool_result") {
|
|
18382
18472
|
const id = typeof block.tool_use_id === "string" ? block.tool_use_id : null;
|
|
18473
|
+
const taskName = id ? pendingTaskName.get(id) : void 0;
|
|
18474
|
+
if (taskName) {
|
|
18475
|
+
pendingTaskName.delete(id);
|
|
18476
|
+
const body = typeof block.content === "string" ? block.content : "";
|
|
18477
|
+
const created = /Task #(\d+)/.exec(body);
|
|
18478
|
+
if (created && taskById.size < MAX_TASKS) {
|
|
18479
|
+
taskById.set(created[1], { name: taskName, status: taskById.get(created[1])?.status ?? "created" });
|
|
18480
|
+
}
|
|
18481
|
+
}
|
|
18482
|
+
const toolName = id ? pendingToolName.get(id) : void 0;
|
|
18483
|
+
if (toolName) {
|
|
18484
|
+
pendingToolName.delete(id);
|
|
18485
|
+
const prevTool = toolStats.get(toolName);
|
|
18486
|
+
if (prevTool) {
|
|
18487
|
+
const failed = block.is_error === true;
|
|
18488
|
+
toolStats.set(toolName, {
|
|
18489
|
+
runs: prevTool.runs,
|
|
18490
|
+
failed: prevTool.failed + (failed ? 1 : 0),
|
|
18491
|
+
last_status: block.is_error === true ? 1 : block.is_error === false ? 0 : null,
|
|
18492
|
+
// Carried, not rebuilt: the targets were collected on the `tool_use`
|
|
18493
|
+
// side and dropping them here would empty the ledger on every result.
|
|
18494
|
+
targets: prevTool.targets
|
|
18495
|
+
});
|
|
18496
|
+
}
|
|
18497
|
+
}
|
|
18383
18498
|
const cls = id ? pendingByToolUse.get(id) : void 0;
|
|
18384
18499
|
if (!cls) continue;
|
|
18385
18500
|
pendingByToolUse.delete(id);
|
|
@@ -19373,6 +19488,8 @@ async function buildRequest(run) {
|
|
|
19373
19488
|
authored_since_verdict: memorySession ? foldDossier(memorySession.d).authored_all.filter((a) => a.hash_now !== a.hash_at_last_verdict).map((a) => a.path) : [],
|
|
19374
19489
|
unobserved: foldResult?.unobserved ?? [],
|
|
19375
19490
|
commands: foldResult?.commands ?? [],
|
|
19491
|
+
tools: foldResult?.tools ?? [],
|
|
19492
|
+
tasks: foldResult?.tasks ?? [],
|
|
19376
19493
|
unknown_types: foldResult?.unknownTypes ?? [],
|
|
19377
19494
|
coverage: foldResult?.coverage ?? { recordCounts: {}, totalRecords: 0, malformed: 0, subagentFiles: 0, subagentSkipped: 0, complete: false },
|
|
19378
19495
|
// INV-19, computed client-side and sent so a conservation failure is
|
|
@@ -19746,6 +19863,11 @@ async function reconcile(run) {
|
|
|
19746
19863
|
decision,
|
|
19747
19864
|
branch: getCurrentBranch(),
|
|
19748
19865
|
watermarkSha: watermarkIsPartial ? null : watermarkHash,
|
|
19866
|
+
// The byte witness — the same "only honest definition of reviewed" the
|
|
19867
|
+
// coverage column uses. A finding on a path outside this set records no
|
|
19868
|
+
// statement (plan-mode prose anchored to unsent files must not become
|
|
19869
|
+
// "STILL OPEN … the tree is not clean").
|
|
19870
|
+
sentPaths,
|
|
19749
19871
|
findings: response.findings?.map((f) => ({
|
|
19750
19872
|
file: f.file,
|
|
19751
19873
|
line: f.line,
|
|
@@ -21999,8 +22121,8 @@ function registerTelemetryCommands(program2) {
|
|
|
21999
22121
|
}
|
|
22000
22122
|
|
|
22001
22123
|
// src/cli.ts
|
|
22002
|
-
program.name("verity").description("CLI for Verity quality gate service").version("0.29.4-experimental.
|
|
22003
|
-
installStderrLog(actionCommand.name(), process.argv.slice(2), "0.29.4-experimental.
|
|
22124
|
+
program.name("verity").description("CLI for Verity quality gate service").version("0.29.4-experimental.cfb4bd2").option("--token <token>", "Override authentication token").option("--service-url <url>", "Override service URL").option("--verbose", "Log HTTP requests/responses to stderr").hook("preAction", async (_thisCommand, actionCommand) => {
|
|
22125
|
+
installStderrLog(actionCommand.name(), process.argv.slice(2), "0.29.4-experimental.cfb4bd2");
|
|
22004
22126
|
setUserNamedServiceUrl(program.opts().serviceUrl);
|
|
22005
22127
|
try {
|
|
22006
22128
|
await foldLegacyLocalCredential();
|
package/package.json
CHANGED