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