@codacy/verity-cli 0.27.2-experimental.5fb996a → 0.27.2-experimental.76115e4
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 +41 -21
- package/package.json +1 -1
package/bin/verity.js
CHANGED
|
@@ -14180,24 +14180,6 @@ function resolveTaskContext(opts) {
|
|
|
14180
14180
|
return { number: linked.issue, title: issue.title, goal, via: linked.via };
|
|
14181
14181
|
}
|
|
14182
14182
|
|
|
14183
|
-
// src/lib/run-mode.ts
|
|
14184
|
-
function parseAutonomousEnv(raw) {
|
|
14185
|
-
if (raw === void 0) return void 0;
|
|
14186
|
-
const v = raw.trim().toLowerCase();
|
|
14187
|
-
if (v === "") return void 0;
|
|
14188
|
-
if (v === "0" || v === "false" || v === "off" || v === "no") return false;
|
|
14189
|
-
return true;
|
|
14190
|
-
}
|
|
14191
|
-
function resolveRunMode(inputs = {}) {
|
|
14192
|
-
if (inputs.autonomousFlag === true) return "autonomous";
|
|
14193
|
-
if (inputs.autonomousFlag === false) return "interactive";
|
|
14194
|
-
const env = inputs.env ?? process.env;
|
|
14195
|
-
const envDecision = parseAutonomousEnv(env.VERITY_AUTONOMOUS);
|
|
14196
|
-
if (envDecision !== void 0) return envDecision ? "autonomous" : "interactive";
|
|
14197
|
-
const isTTY = inputs.isTTY ?? Boolean(process.stdin?.isTTY);
|
|
14198
|
-
return isTTY ? "interactive" : "autonomous";
|
|
14199
|
-
}
|
|
14200
|
-
|
|
14201
14183
|
// src/lib/offline.ts
|
|
14202
14184
|
var import_node_fs14 = require("node:fs");
|
|
14203
14185
|
var import_node_crypto7 = require("node:crypto");
|
|
@@ -14409,6 +14391,24 @@ function detectAnalysisMode(noFilesChanged, assistantResponse, conversationPromp
|
|
|
14409
14391
|
}
|
|
14410
14392
|
return "standard";
|
|
14411
14393
|
}
|
|
14394
|
+
var FILE_MUTATE_RE = /(?:^|[\s|&;(`])(?:sed\s+-i|perl\s+-i|awk\b|tee\b|dd\b|cp\b|mv\b|ln\b|install\b|touch\b|patch\b|git\s+(?:apply|am)\b|cargo\s+build|go\s+generate|make\b|--write\b|--fix\b|--in-place\b)|>>?(?![&>])/i;
|
|
14395
|
+
var GIT_PLUMBING_RE = /^\s*git\s+(?:merge|rebase|stash|cherry-pick|revert|pull|fetch|checkout|switch|reset|restore|clean)\b/i;
|
|
14396
|
+
var READ_ONLY_RE = /^\s*(?:git\s+(?:status|diff|log|show|branch|remote|config|rev-parse|ls-files|blame|describe)|ls|cat|head|tail|less|grep|rg|find|pwd|echo|printf|wc|which|type|tree|stat|file|env|printenv|date|whoami)\b/i;
|
|
14397
|
+
var CHAIN_RE = /&&|\|\||;|\$\(|\x60/;
|
|
14398
|
+
function hasNonEditAuthorship(actionSummary, sessionAuthoredCode) {
|
|
14399
|
+
if (!actionSummary) return sessionAuthoredCode;
|
|
14400
|
+
if ((actionSummary.subagents ?? 0) > 0) return true;
|
|
14401
|
+
if (Object.keys(actionSummary.tool_counts ?? {}).some((t) => t.startsWith("mcp__"))) return true;
|
|
14402
|
+
const commands = actionSummary.commands ?? [];
|
|
14403
|
+
if (commands.some((c) => FILE_MUTATE_RE.test(c))) return true;
|
|
14404
|
+
if (sessionAuthoredCode) {
|
|
14405
|
+
const allSafe = commands.length > 0 && commands.every(
|
|
14406
|
+
(c) => !CHAIN_RE.test(c) && (GIT_PLUMBING_RE.test(c) || READ_ONLY_RE.test(c))
|
|
14407
|
+
);
|
|
14408
|
+
if (!allSafe) return true;
|
|
14409
|
+
}
|
|
14410
|
+
return false;
|
|
14411
|
+
}
|
|
14412
14412
|
function scopeToAuthored(files, actionSummary) {
|
|
14413
14413
|
if (!actionSummary) return { files, signal: "no-transcript" };
|
|
14414
14414
|
const touched = [...actionSummary.files_edited ?? [], ...actionSummary.files_created ?? []];
|
|
@@ -14617,6 +14617,7 @@ function buildSummary(lines) {
|
|
|
14617
14617
|
searches++;
|
|
14618
14618
|
break;
|
|
14619
14619
|
case "Agent":
|
|
14620
|
+
case "Task":
|
|
14620
14621
|
subagents++;
|
|
14621
14622
|
break;
|
|
14622
14623
|
case "WebFetch":
|
|
@@ -15225,7 +15226,7 @@ async function runAnalyze(opts, globals) {
|
|
|
15225
15226
|
contentHash = hashResult.hash;
|
|
15226
15227
|
if (analysisMode !== "plan") {
|
|
15227
15228
|
const scoped = scopeToAuthored(allForReview, actionSummary);
|
|
15228
|
-
if (scoped.signal === "none-authored" && (actionSummary
|
|
15229
|
+
if (scoped.signal === "none-authored" && !hasNonEditAuthorship(actionSummary, sessionAuthoredCode)) {
|
|
15229
15230
|
passAndExit("No agent-authored code this turn \u2014 working-tree changes were not authored by this session");
|
|
15230
15231
|
}
|
|
15231
15232
|
const baseForReview = scoped.signal === "authored" && scoped.files.length > 0 ? scoped.files : allForReview;
|
|
@@ -15359,7 +15360,8 @@ async function runAnalyze(opts, globals) {
|
|
|
15359
15360
|
requestBody.snapshot_diffs = snapshotResult.diffs;
|
|
15360
15361
|
}
|
|
15361
15362
|
const noHumanPrompt = (conversation?.prompts?.length ?? 0) === 0;
|
|
15362
|
-
const
|
|
15363
|
+
const explicitlyAutonomous = /^(1|true|yes|on)$/i.test(process.env.VERITY_AUTONOMOUS ?? "") || !!process.env.CI || !!process.env.GITHUB_ACTIONS;
|
|
15364
|
+
const w4Task = noHumanPrompt && explicitlyAutonomous ? resolveTaskContext() : null;
|
|
15363
15365
|
const hasIntent = (conversation?.prompts?.length ?? 0) > 0 || specs.length > 0 || plans.length > 0 || !!assistantResponse || !!w4Task;
|
|
15364
15366
|
if (hasIntent) {
|
|
15365
15367
|
const intentContext = {};
|
|
@@ -16992,6 +16994,24 @@ function registerResetCommand(program2) {
|
|
|
16992
16994
|
});
|
|
16993
16995
|
}
|
|
16994
16996
|
|
|
16997
|
+
// src/lib/run-mode.ts
|
|
16998
|
+
function parseAutonomousEnv(raw) {
|
|
16999
|
+
if (raw === void 0) return void 0;
|
|
17000
|
+
const v = raw.trim().toLowerCase();
|
|
17001
|
+
if (v === "") return void 0;
|
|
17002
|
+
if (v === "0" || v === "false" || v === "off" || v === "no") return false;
|
|
17003
|
+
return true;
|
|
17004
|
+
}
|
|
17005
|
+
function resolveRunMode(inputs = {}) {
|
|
17006
|
+
if (inputs.autonomousFlag === true) return "autonomous";
|
|
17007
|
+
if (inputs.autonomousFlag === false) return "interactive";
|
|
17008
|
+
const env = inputs.env ?? process.env;
|
|
17009
|
+
const envDecision = parseAutonomousEnv(env.VERITY_AUTONOMOUS);
|
|
17010
|
+
if (envDecision !== void 0) return envDecision ? "autonomous" : "interactive";
|
|
17011
|
+
const isTTY = inputs.isTTY ?? Boolean(process.stdin?.isTTY);
|
|
17012
|
+
return isTTY ? "interactive" : "autonomous";
|
|
17013
|
+
}
|
|
17014
|
+
|
|
16995
17015
|
// src/commands/reflect.ts
|
|
16996
17016
|
function registerReflectCommand(program2) {
|
|
16997
17017
|
program2.command("reflect").description("Capture learnings \u2014 auto-extract or submit a human reflection").option("--user-input <text>", "The reflection to record (the agent-drafted or user-confirmed text)").option("--kind <kind>", "Node kind (decision, gotcha, pattern, security, quality, intent, domain, integration)", "gotcha").option("--task-id <id>", "Task to reflect on (defaults to current task)").option("--autonomous", "Record the drafted reflection without a confirm step (auto-detected from TTY / VERITY_AUTONOMOUS when omitted)").action(async (opts) => {
|
|
@@ -17353,7 +17373,7 @@ function registerTelemetryCommands(program2) {
|
|
|
17353
17373
|
}
|
|
17354
17374
|
|
|
17355
17375
|
// src/cli.ts
|
|
17356
|
-
program.name("verity").description("CLI for Verity quality gate service").version("0.27.2-experimental.
|
|
17376
|
+
program.name("verity").description("CLI for Verity quality gate service").version("0.27.2-experimental.76115e4").option("--token <token>", "Override authentication token").option("--service-url <url>", "Override service URL").option("--verbose", "Log HTTP requests/responses to stderr");
|
|
17357
17377
|
registerAuthCommands(program);
|
|
17358
17378
|
registerLoginCommand(program);
|
|
17359
17379
|
registerHooksCommands(program);
|