@codacy/verity-cli 0.27.2-experimental.5fb996a → 0.27.2-experimental.ad71767
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 +52 -123
- package/package.json +1 -1
package/bin/verity.js
CHANGED
|
@@ -11827,7 +11827,7 @@ function registerHooksCommands(program2) {
|
|
|
11827
11827
|
}
|
|
11828
11828
|
|
|
11829
11829
|
// src/commands/intent.ts
|
|
11830
|
-
var
|
|
11830
|
+
var import_node_crypto3 = require("node:crypto");
|
|
11831
11831
|
|
|
11832
11832
|
// src/lib/conversation-buffer.ts
|
|
11833
11833
|
var import_promises6 = require("node:fs/promises");
|
|
@@ -11946,19 +11946,6 @@ function getRecentCommitMessages() {
|
|
|
11946
11946
|
}
|
|
11947
11947
|
}
|
|
11948
11948
|
|
|
11949
|
-
// src/lib/context-identity.ts
|
|
11950
|
-
var import_node_crypto2 = require("node:crypto");
|
|
11951
|
-
function contextIdentity(token, sessionId) {
|
|
11952
|
-
const t = (token ?? "").trim();
|
|
11953
|
-
const s = (sessionId ?? "").trim();
|
|
11954
|
-
const userKey = t.length > 0 ? (0, import_node_crypto2.createHash)("sha256").update(t).digest("hex").slice(0, 12) : "anon";
|
|
11955
|
-
const sessionKey2 = s.length > 0 ? (0, import_node_crypto2.createHash)("sha256").update(s).digest("hex").slice(0, 16) : "_default";
|
|
11956
|
-
return { userKey, sessionKey: sessionKey2, bucket: `${userKey}/${sessionKey2}` };
|
|
11957
|
-
}
|
|
11958
|
-
function sessionScopeKey(token, sessionId) {
|
|
11959
|
-
return contextIdentity(token, sessionId).bucket;
|
|
11960
|
-
}
|
|
11961
|
-
|
|
11962
11949
|
// src/lib/task-context-buffer.ts
|
|
11963
11950
|
var import_promises7 = require("node:fs/promises");
|
|
11964
11951
|
var import_node_fs4 = require("node:fs");
|
|
@@ -12246,7 +12233,7 @@ async function retrieveForInjection(promptText, taskFiles = [], budgetTokens = D
|
|
|
12246
12233
|
var import_promises9 = require("node:fs/promises");
|
|
12247
12234
|
var import_node_fs6 = require("node:fs");
|
|
12248
12235
|
var import_node_path9 = require("node:path");
|
|
12249
|
-
var
|
|
12236
|
+
var import_node_crypto2 = require("node:crypto");
|
|
12250
12237
|
|
|
12251
12238
|
// src/lib/glob-match.ts
|
|
12252
12239
|
function globToRegex(glob) {
|
|
@@ -12344,7 +12331,7 @@ async function buildManifest() {
|
|
|
12344
12331
|
const fullPath = (0, import_node_path9.join)(memoryDir2(), filePath);
|
|
12345
12332
|
try {
|
|
12346
12333
|
const content = await (0, import_promises9.readFile)(fullPath, "utf-8");
|
|
12347
|
-
const hash = (0,
|
|
12334
|
+
const hash = (0, import_node_crypto2.createHash)("sha256").update(content).digest("hex").slice(0, 16);
|
|
12348
12335
|
nodes.push({ path: filePath, content_hash: `sha256:${hash}` });
|
|
12349
12336
|
} catch {
|
|
12350
12337
|
}
|
|
@@ -12355,7 +12342,7 @@ async function buildManifest() {
|
|
|
12355
12342
|
let indexHash = null;
|
|
12356
12343
|
try {
|
|
12357
12344
|
const indexContent = await (0, import_promises9.readFile)((0, import_node_path9.join)(memoryDir2(), "index.md"), "utf-8");
|
|
12358
|
-
indexHash = `sha256:${(0,
|
|
12345
|
+
indexHash = `sha256:${(0, import_node_crypto2.createHash)("sha256").update(indexContent).digest("hex").slice(0, 16)}`;
|
|
12359
12346
|
} catch {
|
|
12360
12347
|
}
|
|
12361
12348
|
let logLength = 0;
|
|
@@ -12367,7 +12354,7 @@ async function buildManifest() {
|
|
|
12367
12354
|
return { schema_version: 1, nodes, index_hash: indexHash, log_length: logLength };
|
|
12368
12355
|
}
|
|
12369
12356
|
function hashContent(content) {
|
|
12370
|
-
return `sha256:${(0,
|
|
12357
|
+
return `sha256:${(0, import_node_crypto2.createHash)("sha256").update(content).digest("hex").slice(0, 16)}`;
|
|
12371
12358
|
}
|
|
12372
12359
|
async function readOnDiskNodes() {
|
|
12373
12360
|
const out = /* @__PURE__ */ new Map();
|
|
@@ -12812,10 +12799,7 @@ function registerIntentCommands(program2) {
|
|
|
12812
12799
|
if (!prompt) {
|
|
12813
12800
|
process.exit(0);
|
|
12814
12801
|
}
|
|
12815
|
-
|
|
12816
|
-
const scopeToken = authForScope.ok ? authForScope.data.token : void 0;
|
|
12817
|
-
const scopeSession = event.session_id || process.env.CLAUDE_SESSION_ID || "";
|
|
12818
|
-
await appendToConversationBuffer(prompt, sessionScopeKey(scopeToken, scopeSession));
|
|
12802
|
+
await appendToConversationBuffer(prompt, event.session_id ?? "");
|
|
12819
12803
|
try {
|
|
12820
12804
|
await ensureMemoryDir();
|
|
12821
12805
|
const injection = await retrieveForInjection(prompt);
|
|
@@ -12857,7 +12841,7 @@ async function fireClassify(prompt, sessionId) {
|
|
|
12857
12841
|
logEvent("classify_skipped", { reason: "no_service_url", detail: urlResult.error });
|
|
12858
12842
|
return;
|
|
12859
12843
|
}
|
|
12860
|
-
const promptHash = (0,
|
|
12844
|
+
const promptHash = (0, import_node_crypto3.createHash)("sha256").update(prompt).digest("hex");
|
|
12861
12845
|
const result = await apiRequest({
|
|
12862
12846
|
method: "POST",
|
|
12863
12847
|
path: "/classify-task",
|
|
@@ -13515,10 +13499,10 @@ function collectCodeDelta(files, opts) {
|
|
|
13515
13499
|
|
|
13516
13500
|
// src/lib/debounce.ts
|
|
13517
13501
|
var import_node_fs9 = require("node:fs");
|
|
13518
|
-
var
|
|
13502
|
+
var import_node_crypto4 = require("node:crypto");
|
|
13519
13503
|
function scopedFile(base, sessionId) {
|
|
13520
13504
|
if (!sessionId) return base;
|
|
13521
|
-
return `${base}.${(0,
|
|
13505
|
+
return `${base}.${(0, import_node_crypto4.createHash)("sha1").update(sessionId).digest("hex").slice(0, 12)}`;
|
|
13522
13506
|
}
|
|
13523
13507
|
function checkDebounce(debounceSeconds = DEBOUNCE_SECONDS, sessionId) {
|
|
13524
13508
|
const file = scopedFile(DEBOUNCE_FILE, sessionId);
|
|
@@ -13559,7 +13543,7 @@ function checkMtime(files, bypassForRecentCommits, sessionId) {
|
|
|
13559
13543
|
return "No files modified since last analysis";
|
|
13560
13544
|
}
|
|
13561
13545
|
function computeContentHash(files) {
|
|
13562
|
-
const hash = (0,
|
|
13546
|
+
const hash = (0, import_node_crypto4.createHash)("sha1");
|
|
13563
13547
|
const sorted = [...files].sort();
|
|
13564
13548
|
for (const f of sorted) {
|
|
13565
13549
|
const resolved = resolveFile(f) ?? f;
|
|
@@ -13947,14 +13931,14 @@ function cleanStaleSnapshots(dir, keepSet) {
|
|
|
13947
13931
|
// src/lib/baseline.ts
|
|
13948
13932
|
var import_node_fs13 = require("node:fs");
|
|
13949
13933
|
var import_node_path13 = require("node:path");
|
|
13950
|
-
var
|
|
13934
|
+
var import_node_crypto5 = require("node:crypto");
|
|
13951
13935
|
var BASELINE_VERSION = 1;
|
|
13952
13936
|
var BASELINE_TTL_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
13953
13937
|
var MIRROR_MAX_BYTES = 2 * 1024 * 1024;
|
|
13954
13938
|
var DEFAULT_SESSION_KEY = "_default";
|
|
13955
13939
|
function sessionKey(sessionId) {
|
|
13956
13940
|
if (!sessionId) return DEFAULT_SESSION_KEY;
|
|
13957
|
-
return (0,
|
|
13941
|
+
return (0, import_node_crypto5.createHash)("sha256").update(sessionId).digest("hex").slice(0, 16);
|
|
13958
13942
|
}
|
|
13959
13943
|
function sessionDir(key) {
|
|
13960
13944
|
return (0, import_node_path13.join)(projectPath(BASELINE_DIR), key);
|
|
@@ -14136,75 +14120,13 @@ function pruneOldBaselines() {
|
|
|
14136
14120
|
}
|
|
14137
14121
|
}
|
|
14138
14122
|
|
|
14139
|
-
// src/lib/task-context.ts
|
|
14140
|
-
var import_node_child_process9 = require("node:child_process");
|
|
14141
|
-
var CLOSING_RE = /\b(close[sd]?|fix(?:e[sd])?|resolve[sd]?)\b[\s:]*#(\d+)/i;
|
|
14142
|
-
var BRANCH_RE = /(?:^|[/_-])(?:issue|gh|fix)[-_/]?(\d+)\b/i;
|
|
14143
|
-
function parseLinkedIssue(sources) {
|
|
14144
|
-
for (const c of sources.commits ?? []) {
|
|
14145
|
-
const m = CLOSING_RE.exec(c);
|
|
14146
|
-
if (m) return { issue: parseInt(m[2], 10), via: `commit:${m[1].toLowerCase()}` };
|
|
14147
|
-
}
|
|
14148
|
-
if (sources.branch) {
|
|
14149
|
-
const m = BRANCH_RE.exec(sources.branch);
|
|
14150
|
-
if (m) return { issue: parseInt(m[1], 10), via: "branch" };
|
|
14151
|
-
}
|
|
14152
|
-
return null;
|
|
14153
|
-
}
|
|
14154
|
-
function safeExec(cmd, timeout) {
|
|
14155
|
-
try {
|
|
14156
|
-
return (0, import_node_child_process9.execSync)(cmd, { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], timeout }).trim();
|
|
14157
|
-
} catch {
|
|
14158
|
-
return "";
|
|
14159
|
-
}
|
|
14160
|
-
}
|
|
14161
|
-
function defaultGhFetch(issue) {
|
|
14162
|
-
const raw = safeExec(`gh issue view ${issue} --json title,body`, 5e3);
|
|
14163
|
-
if (!raw) return null;
|
|
14164
|
-
try {
|
|
14165
|
-
const j = JSON.parse(raw);
|
|
14166
|
-
return j.title ? { title: j.title, body: j.body ?? "" } : null;
|
|
14167
|
-
} catch {
|
|
14168
|
-
return null;
|
|
14169
|
-
}
|
|
14170
|
-
}
|
|
14171
|
-
function resolveTaskContext(opts) {
|
|
14172
|
-
const branch = opts?.branch ?? safeExec("git rev-parse --abbrev-ref HEAD", 3e3);
|
|
14173
|
-
const commits = opts?.commits ?? safeExec("git log -5 --format=%s%n%b", 3e3).split("\n").map((l) => l.trim()).filter(Boolean);
|
|
14174
|
-
const linked = parseLinkedIssue({ branch, commits });
|
|
14175
|
-
if (!linked) return null;
|
|
14176
|
-
const issue = (opts?.ghFetch ?? defaultGhFetch)(linked.issue);
|
|
14177
|
-
if (!issue) return null;
|
|
14178
|
-
const body = (issue.body ?? "").slice(0, 4e3).trim();
|
|
14179
|
-
const goal = `[#${linked.issue}] ${issue.title}${body ? "\n\n" + body : ""}`;
|
|
14180
|
-
return { number: linked.issue, title: issue.title, goal, via: linked.via };
|
|
14181
|
-
}
|
|
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
14123
|
// src/lib/offline.ts
|
|
14202
14124
|
var import_node_fs14 = require("node:fs");
|
|
14203
|
-
var
|
|
14125
|
+
var import_node_crypto6 = require("node:crypto");
|
|
14204
14126
|
function cacheRequest(body) {
|
|
14205
14127
|
try {
|
|
14206
14128
|
(0, import_node_fs14.mkdirSync)(CACHE_DIR, { recursive: true });
|
|
14207
|
-
const suffix = (0,
|
|
14129
|
+
const suffix = (0, import_node_crypto6.randomBytes)(4).toString("hex");
|
|
14208
14130
|
const filename = `pending-${Math.floor(Date.now() / 1e3)}-${suffix}.json`;
|
|
14209
14131
|
(0, import_node_fs14.writeFileSync)(`${CACHE_DIR}/${filename}`, JSON.stringify(body));
|
|
14210
14132
|
} catch {
|
|
@@ -15096,10 +15018,7 @@ async function runAnalyze(opts, globals) {
|
|
|
15096
15018
|
}
|
|
15097
15019
|
const { assistantMessage: assistantResponse, stopReason, transcriptPath, sessionId } = await readStopHookStdin();
|
|
15098
15020
|
const actionSummary = transcriptPath ? await extractActionSummary(transcriptPath) : null;
|
|
15099
|
-
const
|
|
15100
|
-
const scopeToken = tokenResult.ok ? tokenResult.data.token : void 0;
|
|
15101
|
-
const rawSessionId = sessionId || process.env.CLAUDE_SESSION_ID || void 0;
|
|
15102
|
-
const baselineSessionId = sessionScopeKey(scopeToken, rawSessionId);
|
|
15021
|
+
const baselineSessionId = sessionId || process.env.CLAUDE_SESSION_ID || void 0;
|
|
15103
15022
|
const baseline = readBaseline(baselineSessionId);
|
|
15104
15023
|
if (baseline) {
|
|
15105
15024
|
logEvent("baseline_loaded", {
|
|
@@ -15117,7 +15036,7 @@ async function runAnalyze(opts, globals) {
|
|
|
15117
15036
|
passAndExit("No analyzable files changed");
|
|
15118
15037
|
}
|
|
15119
15038
|
const allForReview = Array.from(/* @__PURE__ */ new Set([...analyzable, ...reviewable]));
|
|
15120
|
-
const conversation = await readAndClearConversationBuffer(
|
|
15039
|
+
const conversation = await readAndClearConversationBuffer(sessionId ?? void 0);
|
|
15121
15040
|
const specs = discoverSpecs();
|
|
15122
15041
|
const plans = discoverPlans();
|
|
15123
15042
|
const latestPrompt = conversation?.prompts?.[conversation.prompts.length - 1]?.prompt ?? "";
|
|
@@ -15131,6 +15050,7 @@ async function runAnalyze(opts, globals) {
|
|
|
15131
15050
|
if (isReflectionQuestion(assistantResponse) && !agentAuthoredCodeThisTurn) {
|
|
15132
15051
|
passAndExit("Reflection-prompt turn \u2014 skipping analysis");
|
|
15133
15052
|
}
|
|
15053
|
+
const tokenResult = await resolveToken(globals.token);
|
|
15134
15054
|
const urlResult = await resolveServiceUrl(globals.serviceUrl);
|
|
15135
15055
|
if (!tokenResult.ok || !urlResult.ok) {
|
|
15136
15056
|
localOnlyAndExit(runLocalStatic(analyzable, securityFiles, baseline, !!opts.skipStatic));
|
|
@@ -15358,9 +15278,7 @@ async function runAnalyze(opts, globals) {
|
|
|
15358
15278
|
if (snapshotResult.has_snapshots && snapshotResult.diffs.length > 0) {
|
|
15359
15279
|
requestBody.snapshot_diffs = snapshotResult.diffs;
|
|
15360
15280
|
}
|
|
15361
|
-
const
|
|
15362
|
-
const w4Task = noHumanPrompt && resolveRunMode() === "autonomous" ? resolveTaskContext() : null;
|
|
15363
|
-
const hasIntent = (conversation?.prompts?.length ?? 0) > 0 || specs.length > 0 || plans.length > 0 || !!assistantResponse || !!w4Task;
|
|
15281
|
+
const hasIntent = (conversation?.prompts?.length ?? 0) > 0 || specs.length > 0 || plans.length > 0 || !!assistantResponse;
|
|
15364
15282
|
if (hasIntent) {
|
|
15365
15283
|
const intentContext = {};
|
|
15366
15284
|
if (conversation && conversation.prompts.length > 0) {
|
|
@@ -15375,10 +15293,6 @@ async function runAnalyze(opts, globals) {
|
|
|
15375
15293
|
intentContext.recent_commits = conversation.recent_commits;
|
|
15376
15294
|
}
|
|
15377
15295
|
}
|
|
15378
|
-
if (w4Task && !intentContext.user_prompt) {
|
|
15379
|
-
intentContext.user_prompt = w4Task.goal;
|
|
15380
|
-
logEvent("w4_issue_anchor", { issue: w4Task.number, via: w4Task.via });
|
|
15381
|
-
}
|
|
15382
15296
|
if (assistantResponse) {
|
|
15383
15297
|
const cap = analysisMode === "plan" ? MAX_ASSISTANT_RESPONSE_CHARS_PLAN : MAX_ASSISTANT_RESPONSE_CHARS_DEFAULT;
|
|
15384
15298
|
intentContext.assistant_response = assistantResponse.length > cap ? assistantResponse.slice(0, cap) : assistantResponse;
|
|
@@ -15671,10 +15585,7 @@ function registerBaselineCommands(program2) {
|
|
|
15671
15585
|
}
|
|
15672
15586
|
}
|
|
15673
15587
|
}
|
|
15674
|
-
const
|
|
15675
|
-
const scopeToken = authForScope.ok ? authForScope.data.token : void 0;
|
|
15676
|
-
const scopeSession = sessionId || process.env.CLAUDE_SESSION_ID || void 0;
|
|
15677
|
-
const result = captureBaseline({ sessionId: sessionScopeKey(scopeToken, scopeSession), source });
|
|
15588
|
+
const result = captureBaseline({ sessionId, source });
|
|
15678
15589
|
logEvent("baseline_capture", {
|
|
15679
15590
|
created: result.created,
|
|
15680
15591
|
source: source ?? null,
|
|
@@ -16120,20 +16031,20 @@ function writeBlockMessage(moment, response) {
|
|
|
16120
16031
|
var import_node_fs24 = require("node:fs");
|
|
16121
16032
|
var import_promises13 = require("node:fs/promises");
|
|
16122
16033
|
var import_node_path19 = require("node:path");
|
|
16123
|
-
var
|
|
16034
|
+
var import_node_child_process10 = require("node:child_process");
|
|
16124
16035
|
var readline2 = __toESM(require("node:readline/promises"));
|
|
16125
16036
|
|
|
16126
16037
|
// src/commands/migrate.ts
|
|
16127
16038
|
var import_node_fs23 = require("node:fs");
|
|
16128
16039
|
var import_node_path18 = require("node:path");
|
|
16129
|
-
var
|
|
16040
|
+
var import_node_child_process9 = require("node:child_process");
|
|
16130
16041
|
var LEGACY_NPM_PACKAGE = "@codacy/gate-cli";
|
|
16131
16042
|
function defaultNpmRemover(pkg) {
|
|
16132
|
-
(0,
|
|
16043
|
+
(0, import_node_child_process9.execSync)(`npm rm -g ${pkg}`, { stdio: "pipe", timeout: 12e4 });
|
|
16133
16044
|
}
|
|
16134
16045
|
function isGitTracked(cwd, relPath) {
|
|
16135
16046
|
try {
|
|
16136
|
-
(0,
|
|
16047
|
+
(0, import_node_child_process9.execSync)(`git ls-files --error-unmatch ${relPath}`, { cwd, stdio: "pipe" });
|
|
16137
16048
|
return true;
|
|
16138
16049
|
} catch {
|
|
16139
16050
|
return false;
|
|
@@ -16141,7 +16052,7 @@ function isGitTracked(cwd, relPath) {
|
|
|
16141
16052
|
}
|
|
16142
16053
|
function isGitRepo(cwd) {
|
|
16143
16054
|
try {
|
|
16144
|
-
(0,
|
|
16055
|
+
(0, import_node_child_process9.execSync)("git rev-parse --is-inside-work-tree", { cwd, stdio: "pipe" });
|
|
16145
16056
|
return true;
|
|
16146
16057
|
} catch {
|
|
16147
16058
|
return false;
|
|
@@ -16180,7 +16091,7 @@ function migrateProjectDirRename(root, gateDir, verityDir, actions) {
|
|
|
16180
16091
|
);
|
|
16181
16092
|
}
|
|
16182
16093
|
try {
|
|
16183
|
-
(0,
|
|
16094
|
+
(0, import_node_child_process9.execSync)("git mv .gate .verity", { cwd: root, stdio: "pipe" });
|
|
16184
16095
|
actions.push("Moved .gate/ \u2192 .verity/ (git mv, staged)");
|
|
16185
16096
|
moved = true;
|
|
16186
16097
|
} catch {
|
|
@@ -16259,7 +16170,7 @@ function migrateStandardFile(root, actions) {
|
|
|
16259
16170
|
let moved = false;
|
|
16260
16171
|
if (isGitRepo(root) && isGitTracked(root, "GATE.md")) {
|
|
16261
16172
|
try {
|
|
16262
|
-
(0,
|
|
16173
|
+
(0, import_node_child_process9.execSync)("git mv GATE.md VERITY.md", { cwd: root, stdio: "pipe" });
|
|
16263
16174
|
moved = true;
|
|
16264
16175
|
} catch {
|
|
16265
16176
|
}
|
|
@@ -16315,7 +16226,7 @@ function readFileSyncSafe(path) {
|
|
|
16315
16226
|
}
|
|
16316
16227
|
function hasStagedChanges(root) {
|
|
16317
16228
|
try {
|
|
16318
|
-
(0,
|
|
16229
|
+
(0, import_node_child_process9.execSync)("git diff --cached --quiet", { cwd: root, stdio: "pipe" });
|
|
16319
16230
|
return false;
|
|
16320
16231
|
} catch {
|
|
16321
16232
|
return true;
|
|
@@ -16434,7 +16345,7 @@ async function runOptionalAuth(serviceUrl) {
|
|
|
16434
16345
|
}
|
|
16435
16346
|
let remote = "";
|
|
16436
16347
|
try {
|
|
16437
|
-
remote = (0,
|
|
16348
|
+
remote = (0, import_node_child_process10.execSync)("git remote get-url origin", { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }).trim();
|
|
16438
16349
|
} catch {
|
|
16439
16350
|
}
|
|
16440
16351
|
const localOnlyNote = () => {
|
|
@@ -16530,30 +16441,30 @@ function registerInitCommand(program2) {
|
|
|
16530
16441
|
}
|
|
16531
16442
|
printInfo(` Node.js ${nodeVersion} \u2713`);
|
|
16532
16443
|
try {
|
|
16533
|
-
const gitVersion = (0,
|
|
16444
|
+
const gitVersion = (0, import_node_child_process10.execSync)("git --version", { encoding: "utf-8" }).trim();
|
|
16534
16445
|
printInfo(` ${gitVersion} \u2713`);
|
|
16535
16446
|
} catch {
|
|
16536
16447
|
printError("git is required but not installed. Install from https://git-scm.com");
|
|
16537
16448
|
process.exit(1);
|
|
16538
16449
|
}
|
|
16539
16450
|
try {
|
|
16540
|
-
(0,
|
|
16451
|
+
(0, import_node_child_process10.execSync)("which claude", { encoding: "utf-8" });
|
|
16541
16452
|
printInfo(" Claude Code \u2713");
|
|
16542
16453
|
} catch {
|
|
16543
16454
|
printWarn(" Claude Code not found \u2014 hooks will be configured but need Claude Code to run.");
|
|
16544
16455
|
}
|
|
16545
16456
|
try {
|
|
16546
|
-
(0,
|
|
16457
|
+
(0, import_node_child_process10.execSync)("which codacy-analysis", { encoding: "utf-8", stdio: "pipe" });
|
|
16547
16458
|
printInfo(" @codacy/analysis-cli \u2713");
|
|
16548
16459
|
} catch {
|
|
16549
16460
|
printInfo(" Installing @codacy/analysis-cli...");
|
|
16550
16461
|
try {
|
|
16551
|
-
(0,
|
|
16462
|
+
(0, import_node_child_process10.execSync)("npm install -g @codacy/analysis-cli", { encoding: "utf-8", stdio: "pipe", timeout: 12e4 });
|
|
16552
16463
|
printInfo(" @codacy/analysis-cli installed \u2713");
|
|
16553
16464
|
} catch {
|
|
16554
16465
|
try {
|
|
16555
16466
|
printWarn(" Retrying with sudo...");
|
|
16556
|
-
(0,
|
|
16467
|
+
(0, import_node_child_process10.execSync)("sudo npm install -g @codacy/analysis-cli", { encoding: "utf-8", stdio: "inherit", timeout: 12e4 });
|
|
16557
16468
|
printInfo(" @codacy/analysis-cli installed \u2713");
|
|
16558
16469
|
} catch {
|
|
16559
16470
|
printWarn(" Could not install @codacy/analysis-cli automatically.");
|
|
@@ -16992,6 +16903,24 @@ function registerResetCommand(program2) {
|
|
|
16992
16903
|
});
|
|
16993
16904
|
}
|
|
16994
16905
|
|
|
16906
|
+
// src/lib/run-mode.ts
|
|
16907
|
+
function parseAutonomousEnv(raw) {
|
|
16908
|
+
if (raw === void 0) return void 0;
|
|
16909
|
+
const v = raw.trim().toLowerCase();
|
|
16910
|
+
if (v === "") return void 0;
|
|
16911
|
+
if (v === "0" || v === "false" || v === "off" || v === "no") return false;
|
|
16912
|
+
return true;
|
|
16913
|
+
}
|
|
16914
|
+
function resolveRunMode(inputs = {}) {
|
|
16915
|
+
if (inputs.autonomousFlag === true) return "autonomous";
|
|
16916
|
+
if (inputs.autonomousFlag === false) return "interactive";
|
|
16917
|
+
const env = inputs.env ?? process.env;
|
|
16918
|
+
const envDecision = parseAutonomousEnv(env.VERITY_AUTONOMOUS);
|
|
16919
|
+
if (envDecision !== void 0) return envDecision ? "autonomous" : "interactive";
|
|
16920
|
+
const isTTY = inputs.isTTY ?? Boolean(process.stdin?.isTTY);
|
|
16921
|
+
return isTTY ? "interactive" : "autonomous";
|
|
16922
|
+
}
|
|
16923
|
+
|
|
16995
16924
|
// src/commands/reflect.ts
|
|
16996
16925
|
function registerReflectCommand(program2) {
|
|
16997
16926
|
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 +17282,7 @@ function registerTelemetryCommands(program2) {
|
|
|
17353
17282
|
}
|
|
17354
17283
|
|
|
17355
17284
|
// src/cli.ts
|
|
17356
|
-
program.name("verity").description("CLI for Verity quality gate service").version("0.27.2-experimental.
|
|
17285
|
+
program.name("verity").description("CLI for Verity quality gate service").version("0.27.2-experimental.ad71767").option("--token <token>", "Override authentication token").option("--service-url <url>", "Override service URL").option("--verbose", "Log HTTP requests/responses to stderr");
|
|
17357
17286
|
registerAuthCommands(program);
|
|
17358
17287
|
registerLoginCommand(program);
|
|
17359
17288
|
registerHooksCommands(program);
|