@codacy/verity-cli 0.29.4-experimental.9a4e14c → 0.29.4-experimental.c9a3712

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.
Files changed (2) hide show
  1. package/bin/verity.js +82 -6
  2. package/package.json +1 -1
package/bin/verity.js CHANGED
@@ -16570,6 +16570,7 @@ function createRun(opts, globals) {
16570
16570
  opts,
16571
16571
  globals,
16572
16572
  phaseReached: "",
16573
+ phasesCompleted: [],
16573
16574
  skipReason: null,
16574
16575
  turnId: "",
16575
16576
  // The value `resolveReachability` itself returns when every rung declines.
@@ -16600,6 +16601,7 @@ function createRun(opts, globals) {
16600
16601
  urlResult: { ok: false, error: "unresolved" },
16601
16602
  serviceUrl: "",
16602
16603
  token: "",
16604
+ modeDecision: null,
16603
16605
  sessionIdForMemory: "",
16604
16606
  contextFilePaths: [],
16605
16607
  analysisMode: "standard",
@@ -16710,7 +16712,19 @@ function formatRunEvidence(run, startedAt) {
16710
16712
  out += row("turn", `${run.turnId || "(unminted)"}${run.sessionId ? ` \xB7 session ${run.sessionId}` : ""}`);
16711
16713
  out += row("reached", `${run.phaseReached || "(none)"}${run.skipReason ? ` \xB7 SKIPPED: ${run.skipReason}` : ""} \xB7 ${ms}ms`);
16712
16714
  out += row("changed", `${run.changedUniverse.length} from git \xB7 analyzable ${run.analyzable.length} \xB7 reviewable ${run.reviewable.length} \xB7 security ${run.securityFiles.length} \xB7 forReview ${run.allForReview.length}`);
16713
- out += row("signals", `mode=${run.analysisMode} \xB7 baseline=${run.baseline ? "yes" : "no"} \xB7 authored=${run.turnAuthoredCode ? "yes" : "no"} \xB7 observable=${run.authorshipIsObservable ? "yes" : "no"}` + (run.actionSummary?.transcript_windowed ? ` \xB7 window=${run.actionSummary.transcript_windowed}` : ""));
16715
+ const done = (phase) => run.phasesCompleted.includes(phase);
16716
+ const ifDone = (phase, value) => done(phase) ? value : "?";
16717
+ const md = run.modeDecision;
16718
+ if (md) {
16719
+ const how = md.forced ? "forced by --mode" : `predicted=${md.predicted ?? "none"} \u2192 ${md.resolved}`;
16720
+ out += row("mode", `${md.resolved} \xB7 ${how} \xB7 authored=${md.authored ? "yes" : "no"} \xB7 investigated=${md.investigated ? "yes" : "no"}`);
16721
+ } else {
16722
+ out += row("mode", `? (this run stopped in ${run.phaseReached || "no phase"}, before the mode was decided)`);
16723
+ }
16724
+ out += row("signals", `baseline=${ifDone("bootstrap", run.baseline ? "yes" : "no")} \xB7 authored=${ifDone("intentInputs", run.turnAuthoredCode ? "yes" : "no")} \xB7 observable=${ifDone("intentInputs", run.authorshipIsObservable ? "yes" : "no")}` + (run.actionSummary?.transcript_windowed ? ` \xB7 window=${run.actionSummary.transcript_windowed}` : ""));
16725
+ if (!done("intentInputs")) {
16726
+ out += row("", `(\`?\` = the phase that determines it did not complete \u2014 this run stopped in ${run.phaseReached})`);
16727
+ }
16714
16728
  out += row("sent", `${sent.length} \xB7 ${list(sent)}`);
16715
16729
  if (context.length > 0) out += row("context", `${context.length} \xB7 ${list(context)}`);
16716
16730
  const withheld = run.reviewCoverage.notReviewed;
@@ -16735,6 +16749,22 @@ function formatRunEvidence(run, startedAt) {
16735
16749
  out += row("withheld", "(nothing \u2014 every changed file was reviewed)");
16736
16750
  }
16737
16751
  }
16752
+ const cov = run.foldResult?.coverage;
16753
+ if (cov) {
16754
+ const delegated = run.foldResult.authored.filter((a) => a.owner === "subagent").length;
16755
+ if (cov.dispatched > 0 || cov.subagentFiles > 0 || cov.subagentSkipped > 0) {
16756
+ out += row("delegated", `${cov.dispatched} dispatched \xB7 ${cov.subagentFiles} agent log(s) read \xB7 ${delegated} path(s) attributed to subagents`);
16757
+ }
16758
+ if (cov.subagentSkipped > 0) {
16759
+ out += row("", `\u26A0 ${cov.subagentSkipped} agent log(s) REFUSED by the byte budget \u2014 the authored set above is PARTIAL`);
16760
+ }
16761
+ if (cov.dispatched > 0 && cov.subagentFiles === 0) {
16762
+ out += row("", `\u26A0 this turn dispatched ${cov.dispatched} agent(s) but no agent log was found \u2014 delegated work is unattributed (has the transcript layout moved?)`);
16763
+ }
16764
+ if (cov.outsideRepo > 0) {
16765
+ out += row("", `${cov.outsideRepo} authored path(s) refused as outside the repo`);
16766
+ }
16767
+ }
16738
16768
  if (run.staticResults.findings.length > 0) {
16739
16769
  out += row("static", `${run.staticResults.findings.length} finding(s) from ${run.staticResults.summary.tools_run.join(", ") || "no tools"}`);
16740
16770
  }
@@ -16930,6 +16960,8 @@ function buildSummary(lines) {
16930
16960
  break;
16931
16961
  case "Agent":
16932
16962
  case "Task":
16963
+ case "Workflow":
16964
+ case "SendMessage":
16933
16965
  subagents++;
16934
16966
  break;
16935
16967
  case "WebFetch":
@@ -17184,7 +17216,7 @@ function channelSilence(input) {
17184
17216
  // src/lib/cli-version.ts
17185
17217
  function cliVersion() {
17186
17218
  try {
17187
- return true ? "0.29.4-experimental.9a4e14c" : "dev";
17219
+ return true ? "0.29.4-experimental.c9a3712" : "dev";
17188
17220
  } catch {
17189
17221
  return "dev";
17190
17222
  }
@@ -17853,7 +17885,8 @@ async function mode(run) {
17853
17885
  let analysisMode;
17854
17886
  const sessionAuthoredCode = !!baseline && allForReview.some((f) => changedSinceBaseline(f, baseline));
17855
17887
  const modeOverride = opts.mode;
17856
- if (modeOverride && ["standard", "plan", "debug", "skip"].includes(modeOverride)) {
17888
+ const forced = !!modeOverride && ["standard", "plan", "debug", "skip"].includes(modeOverride);
17889
+ if (forced) {
17857
17890
  analysisMode = modeOverride;
17858
17891
  } else {
17859
17892
  analysisMode = reconcileAnalysisMode(
@@ -17861,6 +17894,25 @@ async function mode(run) {
17861
17894
  { noFilesChanged, assistantResponse, actionSummary, conversationPrompts, sessionAuthoredCode }
17862
17895
  );
17863
17896
  }
17897
+ const investigated = didAgentInvestigate(actionSummary);
17898
+ run.modeDecision = {
17899
+ predicted: predictedMode ?? null,
17900
+ resolved: analysisMode,
17901
+ authored: turnAuthoredCode,
17902
+ investigated,
17903
+ forced
17904
+ };
17905
+ logEvent("mode_resolved", {
17906
+ predicted: predictedMode ?? null,
17907
+ resolved: analysisMode,
17908
+ forced,
17909
+ authored: turnAuthoredCode,
17910
+ investigated,
17911
+ // The two counters that decide `investigated`, so a false reading is
17912
+ // traceable to the tool that was not recognised.
17913
+ subagents: actionSummary?.subagents ?? null,
17914
+ files_read: actionSummary?.files_read.length ?? null
17915
+ });
17864
17916
  if (analysisMode === "skip") {
17865
17917
  await passAndExit(
17866
17918
  run,
@@ -18154,6 +18206,15 @@ function toRepoRelative(path, repoRoot2) {
18154
18206
  }
18155
18207
  return p.replace(/^\/+/, "");
18156
18208
  }
18209
+ function isInsideRepo(path, repoRoot2) {
18210
+ const p = path.replace(/\\/g, "/");
18211
+ if (!isAbsolutePath(p)) return true;
18212
+ if (!repoRoot2) return true;
18213
+ return candidateRoots(repoRoot2).some((root) => p === root || p.startsWith(root + "/"));
18214
+ }
18215
+ function isAbsolutePath(p) {
18216
+ return p.startsWith("/") || /^[A-Za-z]:\//.test(p);
18217
+ }
18157
18218
  function fold(transcriptPath, opts = {}) {
18158
18219
  const result = {
18159
18220
  authored: [],
@@ -18165,6 +18226,7 @@ function fold(transcriptPath, opts = {}) {
18165
18226
  totalRecords: 0,
18166
18227
  malformed: 0,
18167
18228
  subagentFiles: 0,
18229
+ outsideRepo: 0,
18168
18230
  dispatched: 0,
18169
18231
  userMessages: 0,
18170
18232
  subagentSkipped: 0,
@@ -18205,7 +18267,11 @@ function fold(transcriptPath, opts = {}) {
18205
18267
  return result;
18206
18268
  }
18207
18269
  try {
18208
- const sidecarDir = (0, import_node_path18.join)((0, import_node_path18.dirname)(transcriptPath), "subagents");
18270
+ const sidecarDir = (0, import_node_path18.join)(
18271
+ (0, import_node_path18.dirname)(transcriptPath),
18272
+ (0, import_node_path18.basename)(transcriptPath).replace(/\.jsonl$/, ""),
18273
+ "subagents"
18274
+ );
18209
18275
  if ((0, import_node_fs23.existsSync)(sidecarDir)) {
18210
18276
  const maxFiles = opts.maxSidecars ?? 200;
18211
18277
  const maxBytes = opts.maxSidecarBytes ?? 16 * 1024 * 1024;
@@ -18277,6 +18343,10 @@ function collectFromRecord(record, owner, byPath, commandStats, pendingByToolUse
18277
18343
  const input = block.input ?? {};
18278
18344
  if (EDIT_TOOLS.has(name)) {
18279
18345
  const rawPath = typeof input.notebook_path === "string" ? input.notebook_path : typeof input.file_path === "string" ? input.file_path : null;
18346
+ if (rawPath && !isInsideRepo(rawPath, repoRoot2)) {
18347
+ if (tally) tally.outsideRepo += 1;
18348
+ continue;
18349
+ }
18280
18350
  const path = rawPath ? toRepoRelative(rawPath, repoRoot2) : null;
18281
18351
  if (path) {
18282
18352
  const entry = byPath.get(path) ?? { p: path, h: 0, a: 0, d: 0, owner };
@@ -18529,6 +18599,10 @@ function gatherContextFiles(contextPaths, deltaFiles) {
18529
18599
  for (const filePath of contextPaths) {
18530
18600
  if (result.length >= MAX_CONTEXT_FILES) break;
18531
18601
  if (deltaPaths.has(filePath)) continue;
18602
+ if (isVerityOwnedPath(filePath)) {
18603
+ logEvent("context_file_skipped", { path: filePath, reason: "verity_owned" });
18604
+ continue;
18605
+ }
18532
18606
  try {
18533
18607
  const content = (0, import_node_fs25.readFileSync)(filePath, "utf8");
18534
18608
  const bytes = Buffer.byteLength(content);
@@ -20123,10 +20197,12 @@ async function runAnalyze(opts, globals) {
20123
20197
  run.phaseReached = name;
20124
20198
  if (!tracing()) {
20125
20199
  await phase(run);
20200
+ run.phasesCompleted.push(name);
20126
20201
  continue;
20127
20202
  }
20128
20203
  const started = Date.now();
20129
20204
  await phase(run);
20205
+ run.phasesCompleted.push(name);
20130
20206
  process.stderr.write(`verity\xB7phase ${name} ${Date.now() - started}ms
20131
20207
  `);
20132
20208
  }
@@ -21923,8 +21999,8 @@ function registerTelemetryCommands(program2) {
21923
21999
  }
21924
22000
 
21925
22001
  // src/cli.ts
21926
- program.name("verity").description("CLI for Verity quality gate service").version("0.29.4-experimental.9a4e14c").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) => {
21927
- installStderrLog(actionCommand.name(), process.argv.slice(2), "0.29.4-experimental.9a4e14c");
22002
+ program.name("verity").description("CLI for Verity quality gate service").version("0.29.4-experimental.c9a3712").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) => {
22003
+ installStderrLog(actionCommand.name(), process.argv.slice(2), "0.29.4-experimental.c9a3712");
21928
22004
  setUserNamedServiceUrl(program.opts().serviceUrl);
21929
22005
  try {
21930
22006
  await foldLegacyLocalCredential();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codacy/verity-cli",
3
- "version": "0.29.4-experimental.9a4e14c",
3
+ "version": "0.29.4-experimental.c9a3712",
4
4
  "description": "CLI for Verity quality gate service",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "homepage": "https://verity.md",