@codacy/verity-cli 0.27.2-experimental.76115e4 → 0.27.2-experimental.cef3fb9
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 +37 -137
- 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://yyfaqvcgslcrzvrbvqik.supabase.co/functions/v1".length > 0 ? "https://yyfaqvcgslcrzvrbvqik.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_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,57 +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
14123
|
// src/lib/offline.ts
|
|
14184
14124
|
var import_node_fs14 = require("node:fs");
|
|
14185
|
-
var
|
|
14125
|
+
var import_node_crypto6 = require("node:crypto");
|
|
14186
14126
|
function cacheRequest(body) {
|
|
14187
14127
|
try {
|
|
14188
14128
|
(0, import_node_fs14.mkdirSync)(CACHE_DIR, { recursive: true });
|
|
14189
|
-
const suffix = (0,
|
|
14129
|
+
const suffix = (0, import_node_crypto6.randomBytes)(4).toString("hex");
|
|
14190
14130
|
const filename = `pending-${Math.floor(Date.now() / 1e3)}-${suffix}.json`;
|
|
14191
14131
|
(0, import_node_fs14.writeFileSync)(`${CACHE_DIR}/${filename}`, JSON.stringify(body));
|
|
14192
14132
|
} catch {
|
|
@@ -14391,30 +14331,6 @@ function detectAnalysisMode(noFilesChanged, assistantResponse, conversationPromp
|
|
|
14391
14331
|
}
|
|
14392
14332
|
return "standard";
|
|
14393
14333
|
}
|
|
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
|
-
function scopeToAuthored(files, actionSummary) {
|
|
14413
|
-
if (!actionSummary) return { files, signal: "no-transcript" };
|
|
14414
|
-
const touched = [...actionSummary.files_edited ?? [], ...actionSummary.files_created ?? []];
|
|
14415
|
-
if (touched.length === 0) return { files: [], signal: "none-authored" };
|
|
14416
|
-
return { files: narrowToAgentAuthored(files, actionSummary), signal: "authored" };
|
|
14417
|
-
}
|
|
14418
14334
|
function narrowToAgentAuthored(files, actionSummary) {
|
|
14419
14335
|
if (!actionSummary) return files;
|
|
14420
14336
|
const touched = [
|
|
@@ -14617,7 +14533,6 @@ function buildSummary(lines) {
|
|
|
14617
14533
|
searches++;
|
|
14618
14534
|
break;
|
|
14619
14535
|
case "Agent":
|
|
14620
|
-
case "Task":
|
|
14621
14536
|
subagents++;
|
|
14622
14537
|
break;
|
|
14623
14538
|
case "WebFetch":
|
|
@@ -15097,10 +15012,7 @@ async function runAnalyze(opts, globals) {
|
|
|
15097
15012
|
}
|
|
15098
15013
|
const { assistantMessage: assistantResponse, stopReason, transcriptPath, sessionId } = await readStopHookStdin();
|
|
15099
15014
|
const actionSummary = transcriptPath ? await extractActionSummary(transcriptPath) : null;
|
|
15100
|
-
const
|
|
15101
|
-
const scopeToken = tokenResult.ok ? tokenResult.data.token : void 0;
|
|
15102
|
-
const rawSessionId = sessionId || process.env.CLAUDE_SESSION_ID || void 0;
|
|
15103
|
-
const baselineSessionId = sessionScopeKey(scopeToken, rawSessionId);
|
|
15015
|
+
const baselineSessionId = sessionId || process.env.CLAUDE_SESSION_ID || void 0;
|
|
15104
15016
|
const baseline = readBaseline(baselineSessionId);
|
|
15105
15017
|
if (baseline) {
|
|
15106
15018
|
logEvent("baseline_loaded", {
|
|
@@ -15118,7 +15030,7 @@ async function runAnalyze(opts, globals) {
|
|
|
15118
15030
|
passAndExit("No analyzable files changed");
|
|
15119
15031
|
}
|
|
15120
15032
|
const allForReview = Array.from(/* @__PURE__ */ new Set([...analyzable, ...reviewable]));
|
|
15121
|
-
const conversation = await readAndClearConversationBuffer(
|
|
15033
|
+
const conversation = await readAndClearConversationBuffer(sessionId ?? void 0);
|
|
15122
15034
|
const specs = discoverSpecs();
|
|
15123
15035
|
const plans = discoverPlans();
|
|
15124
15036
|
const latestPrompt = conversation?.prompts?.[conversation.prompts.length - 1]?.prompt ?? "";
|
|
@@ -15132,6 +15044,7 @@ async function runAnalyze(opts, globals) {
|
|
|
15132
15044
|
if (isReflectionQuestion(assistantResponse) && !agentAuthoredCodeThisTurn) {
|
|
15133
15045
|
passAndExit("Reflection-prompt turn \u2014 skipping analysis");
|
|
15134
15046
|
}
|
|
15047
|
+
const tokenResult = await resolveToken(globals.token);
|
|
15135
15048
|
const urlResult = await resolveServiceUrl(globals.serviceUrl);
|
|
15136
15049
|
if (!tokenResult.ok || !urlResult.ok) {
|
|
15137
15050
|
localOnlyAndExit(runLocalStatic(analyzable, securityFiles, baseline, !!opts.skipStatic));
|
|
@@ -15225,11 +15138,8 @@ async function runAnalyze(opts, globals) {
|
|
|
15225
15138
|
}
|
|
15226
15139
|
contentHash = hashResult.hash;
|
|
15227
15140
|
if (analysisMode !== "plan") {
|
|
15228
|
-
const
|
|
15229
|
-
|
|
15230
|
-
passAndExit("No agent-authored code this turn \u2014 working-tree changes were not authored by this session");
|
|
15231
|
-
}
|
|
15232
|
-
const baseForReview = scoped.signal === "authored" && scoped.files.length > 0 ? scoped.files : allForReview;
|
|
15141
|
+
const agentNarrowed = narrowToAgentAuthored(allForReview, actionSummary);
|
|
15142
|
+
const baseForReview = agentNarrowed.length > 0 ? agentNarrowed : allForReview;
|
|
15233
15143
|
const recentForReview = narrowToRecent(baseForReview, baselineSessionId);
|
|
15234
15144
|
if (!opts.skipStatic && isCodacyAvailable()) {
|
|
15235
15145
|
let allScannable = Array.from(/* @__PURE__ */ new Set([...analyzable, ...securityFiles]));
|
|
@@ -15359,10 +15269,7 @@ async function runAnalyze(opts, globals) {
|
|
|
15359
15269
|
if (snapshotResult.has_snapshots && snapshotResult.diffs.length > 0) {
|
|
15360
15270
|
requestBody.snapshot_diffs = snapshotResult.diffs;
|
|
15361
15271
|
}
|
|
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;
|
|
15365
|
-
const hasIntent = (conversation?.prompts?.length ?? 0) > 0 || specs.length > 0 || plans.length > 0 || !!assistantResponse || !!w4Task;
|
|
15272
|
+
const hasIntent = (conversation?.prompts?.length ?? 0) > 0 || specs.length > 0 || plans.length > 0 || !!assistantResponse;
|
|
15366
15273
|
if (hasIntent) {
|
|
15367
15274
|
const intentContext = {};
|
|
15368
15275
|
if (conversation && conversation.prompts.length > 0) {
|
|
@@ -15377,10 +15284,6 @@ async function runAnalyze(opts, globals) {
|
|
|
15377
15284
|
intentContext.recent_commits = conversation.recent_commits;
|
|
15378
15285
|
}
|
|
15379
15286
|
}
|
|
15380
|
-
if (w4Task && !intentContext.user_prompt) {
|
|
15381
|
-
intentContext.user_prompt = w4Task.goal;
|
|
15382
|
-
logEvent("w4_issue_anchor", { issue: w4Task.number, via: w4Task.via });
|
|
15383
|
-
}
|
|
15384
15287
|
if (assistantResponse) {
|
|
15385
15288
|
const cap = analysisMode === "plan" ? MAX_ASSISTANT_RESPONSE_CHARS_PLAN : MAX_ASSISTANT_RESPONSE_CHARS_DEFAULT;
|
|
15386
15289
|
intentContext.assistant_response = assistantResponse.length > cap ? assistantResponse.slice(0, cap) : assistantResponse;
|
|
@@ -15673,10 +15576,7 @@ function registerBaselineCommands(program2) {
|
|
|
15673
15576
|
}
|
|
15674
15577
|
}
|
|
15675
15578
|
}
|
|
15676
|
-
const
|
|
15677
|
-
const scopeToken = authForScope.ok ? authForScope.data.token : void 0;
|
|
15678
|
-
const scopeSession = sessionId || process.env.CLAUDE_SESSION_ID || void 0;
|
|
15679
|
-
const result = captureBaseline({ sessionId: sessionScopeKey(scopeToken, scopeSession), source });
|
|
15579
|
+
const result = captureBaseline({ sessionId, source });
|
|
15680
15580
|
logEvent("baseline_capture", {
|
|
15681
15581
|
created: result.created,
|
|
15682
15582
|
source: source ?? null,
|
|
@@ -16122,20 +16022,20 @@ function writeBlockMessage(moment, response) {
|
|
|
16122
16022
|
var import_node_fs24 = require("node:fs");
|
|
16123
16023
|
var import_promises13 = require("node:fs/promises");
|
|
16124
16024
|
var import_node_path19 = require("node:path");
|
|
16125
|
-
var
|
|
16025
|
+
var import_node_child_process10 = require("node:child_process");
|
|
16126
16026
|
var readline2 = __toESM(require("node:readline/promises"));
|
|
16127
16027
|
|
|
16128
16028
|
// src/commands/migrate.ts
|
|
16129
16029
|
var import_node_fs23 = require("node:fs");
|
|
16130
16030
|
var import_node_path18 = require("node:path");
|
|
16131
|
-
var
|
|
16031
|
+
var import_node_child_process9 = require("node:child_process");
|
|
16132
16032
|
var LEGACY_NPM_PACKAGE = "@codacy/gate-cli";
|
|
16133
16033
|
function defaultNpmRemover(pkg) {
|
|
16134
|
-
(0,
|
|
16034
|
+
(0, import_node_child_process9.execSync)(`npm rm -g ${pkg}`, { stdio: "pipe", timeout: 12e4 });
|
|
16135
16035
|
}
|
|
16136
16036
|
function isGitTracked(cwd, relPath) {
|
|
16137
16037
|
try {
|
|
16138
|
-
(0,
|
|
16038
|
+
(0, import_node_child_process9.execSync)(`git ls-files --error-unmatch ${relPath}`, { cwd, stdio: "pipe" });
|
|
16139
16039
|
return true;
|
|
16140
16040
|
} catch {
|
|
16141
16041
|
return false;
|
|
@@ -16143,7 +16043,7 @@ function isGitTracked(cwd, relPath) {
|
|
|
16143
16043
|
}
|
|
16144
16044
|
function isGitRepo(cwd) {
|
|
16145
16045
|
try {
|
|
16146
|
-
(0,
|
|
16046
|
+
(0, import_node_child_process9.execSync)("git rev-parse --is-inside-work-tree", { cwd, stdio: "pipe" });
|
|
16147
16047
|
return true;
|
|
16148
16048
|
} catch {
|
|
16149
16049
|
return false;
|
|
@@ -16182,7 +16082,7 @@ function migrateProjectDirRename(root, gateDir, verityDir, actions) {
|
|
|
16182
16082
|
);
|
|
16183
16083
|
}
|
|
16184
16084
|
try {
|
|
16185
|
-
(0,
|
|
16085
|
+
(0, import_node_child_process9.execSync)("git mv .gate .verity", { cwd: root, stdio: "pipe" });
|
|
16186
16086
|
actions.push("Moved .gate/ \u2192 .verity/ (git mv, staged)");
|
|
16187
16087
|
moved = true;
|
|
16188
16088
|
} catch {
|
|
@@ -16261,7 +16161,7 @@ function migrateStandardFile(root, actions) {
|
|
|
16261
16161
|
let moved = false;
|
|
16262
16162
|
if (isGitRepo(root) && isGitTracked(root, "GATE.md")) {
|
|
16263
16163
|
try {
|
|
16264
|
-
(0,
|
|
16164
|
+
(0, import_node_child_process9.execSync)("git mv GATE.md VERITY.md", { cwd: root, stdio: "pipe" });
|
|
16265
16165
|
moved = true;
|
|
16266
16166
|
} catch {
|
|
16267
16167
|
}
|
|
@@ -16317,7 +16217,7 @@ function readFileSyncSafe(path) {
|
|
|
16317
16217
|
}
|
|
16318
16218
|
function hasStagedChanges(root) {
|
|
16319
16219
|
try {
|
|
16320
|
-
(0,
|
|
16220
|
+
(0, import_node_child_process9.execSync)("git diff --cached --quiet", { cwd: root, stdio: "pipe" });
|
|
16321
16221
|
return false;
|
|
16322
16222
|
} catch {
|
|
16323
16223
|
return true;
|
|
@@ -16436,7 +16336,7 @@ async function runOptionalAuth(serviceUrl) {
|
|
|
16436
16336
|
}
|
|
16437
16337
|
let remote = "";
|
|
16438
16338
|
try {
|
|
16439
|
-
remote = (0,
|
|
16339
|
+
remote = (0, import_node_child_process10.execSync)("git remote get-url origin", { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }).trim();
|
|
16440
16340
|
} catch {
|
|
16441
16341
|
}
|
|
16442
16342
|
const localOnlyNote = () => {
|
|
@@ -16532,30 +16432,30 @@ function registerInitCommand(program2) {
|
|
|
16532
16432
|
}
|
|
16533
16433
|
printInfo(` Node.js ${nodeVersion} \u2713`);
|
|
16534
16434
|
try {
|
|
16535
|
-
const gitVersion = (0,
|
|
16435
|
+
const gitVersion = (0, import_node_child_process10.execSync)("git --version", { encoding: "utf-8" }).trim();
|
|
16536
16436
|
printInfo(` ${gitVersion} \u2713`);
|
|
16537
16437
|
} catch {
|
|
16538
16438
|
printError("git is required but not installed. Install from https://git-scm.com");
|
|
16539
16439
|
process.exit(1);
|
|
16540
16440
|
}
|
|
16541
16441
|
try {
|
|
16542
|
-
(0,
|
|
16442
|
+
(0, import_node_child_process10.execSync)("which claude", { encoding: "utf-8" });
|
|
16543
16443
|
printInfo(" Claude Code \u2713");
|
|
16544
16444
|
} catch {
|
|
16545
16445
|
printWarn(" Claude Code not found \u2014 hooks will be configured but need Claude Code to run.");
|
|
16546
16446
|
}
|
|
16547
16447
|
try {
|
|
16548
|
-
(0,
|
|
16448
|
+
(0, import_node_child_process10.execSync)("which codacy-analysis", { encoding: "utf-8", stdio: "pipe" });
|
|
16549
16449
|
printInfo(" @codacy/analysis-cli \u2713");
|
|
16550
16450
|
} catch {
|
|
16551
16451
|
printInfo(" Installing @codacy/analysis-cli...");
|
|
16552
16452
|
try {
|
|
16553
|
-
(0,
|
|
16453
|
+
(0, import_node_child_process10.execSync)("npm install -g @codacy/analysis-cli", { encoding: "utf-8", stdio: "pipe", timeout: 12e4 });
|
|
16554
16454
|
printInfo(" @codacy/analysis-cli installed \u2713");
|
|
16555
16455
|
} catch {
|
|
16556
16456
|
try {
|
|
16557
16457
|
printWarn(" Retrying with sudo...");
|
|
16558
|
-
(0,
|
|
16458
|
+
(0, import_node_child_process10.execSync)("sudo npm install -g @codacy/analysis-cli", { encoding: "utf-8", stdio: "inherit", timeout: 12e4 });
|
|
16559
16459
|
printInfo(" @codacy/analysis-cli installed \u2713");
|
|
16560
16460
|
} catch {
|
|
16561
16461
|
printWarn(" Could not install @codacy/analysis-cli automatically.");
|
|
@@ -17373,7 +17273,7 @@ function registerTelemetryCommands(program2) {
|
|
|
17373
17273
|
}
|
|
17374
17274
|
|
|
17375
17275
|
// src/cli.ts
|
|
17376
|
-
program.name("verity").description("CLI for Verity quality gate service").version("0.27.2-experimental.
|
|
17276
|
+
program.name("verity").description("CLI for Verity quality gate service").version("0.27.2-experimental.cef3fb9").option("--token <token>", "Override authentication token").option("--service-url <url>", "Override service URL").option("--verbose", "Log HTTP requests/responses to stderr");
|
|
17377
17277
|
registerAuthCommands(program);
|
|
17378
17278
|
registerLoginCommand(program);
|
|
17379
17279
|
registerHooksCommands(program);
|