@codacy/verity-cli 0.27.2-experimental.3f072cc → 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 +127 -36
- 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,57 @@ 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
|
+
|
|
14123
14183
|
// src/lib/offline.ts
|
|
14124
14184
|
var import_node_fs14 = require("node:fs");
|
|
14125
|
-
var
|
|
14185
|
+
var import_node_crypto7 = require("node:crypto");
|
|
14126
14186
|
function cacheRequest(body) {
|
|
14127
14187
|
try {
|
|
14128
14188
|
(0, import_node_fs14.mkdirSync)(CACHE_DIR, { recursive: true });
|
|
14129
|
-
const suffix = (0,
|
|
14189
|
+
const suffix = (0, import_node_crypto7.randomBytes)(4).toString("hex");
|
|
14130
14190
|
const filename = `pending-${Math.floor(Date.now() / 1e3)}-${suffix}.json`;
|
|
14131
14191
|
(0, import_node_fs14.writeFileSync)(`${CACHE_DIR}/${filename}`, JSON.stringify(body));
|
|
14132
14192
|
} catch {
|
|
@@ -14331,6 +14391,24 @@ function detectAnalysisMode(noFilesChanged, assistantResponse, conversationPromp
|
|
|
14331
14391
|
}
|
|
14332
14392
|
return "standard";
|
|
14333
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
|
+
}
|
|
14334
14412
|
function scopeToAuthored(files, actionSummary) {
|
|
14335
14413
|
if (!actionSummary) return { files, signal: "no-transcript" };
|
|
14336
14414
|
const touched = [...actionSummary.files_edited ?? [], ...actionSummary.files_created ?? []];
|
|
@@ -14539,6 +14617,7 @@ function buildSummary(lines) {
|
|
|
14539
14617
|
searches++;
|
|
14540
14618
|
break;
|
|
14541
14619
|
case "Agent":
|
|
14620
|
+
case "Task":
|
|
14542
14621
|
subagents++;
|
|
14543
14622
|
break;
|
|
14544
14623
|
case "WebFetch":
|
|
@@ -15018,7 +15097,10 @@ async function runAnalyze(opts, globals) {
|
|
|
15018
15097
|
}
|
|
15019
15098
|
const { assistantMessage: assistantResponse, stopReason, transcriptPath, sessionId } = await readStopHookStdin();
|
|
15020
15099
|
const actionSummary = transcriptPath ? await extractActionSummary(transcriptPath) : null;
|
|
15021
|
-
const
|
|
15100
|
+
const tokenResult = await resolveToken(globals.token);
|
|
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);
|
|
15022
15104
|
const baseline = readBaseline(baselineSessionId);
|
|
15023
15105
|
if (baseline) {
|
|
15024
15106
|
logEvent("baseline_loaded", {
|
|
@@ -15036,7 +15118,7 @@ async function runAnalyze(opts, globals) {
|
|
|
15036
15118
|
passAndExit("No analyzable files changed");
|
|
15037
15119
|
}
|
|
15038
15120
|
const allForReview = Array.from(/* @__PURE__ */ new Set([...analyzable, ...reviewable]));
|
|
15039
|
-
const conversation = await readAndClearConversationBuffer(
|
|
15121
|
+
const conversation = await readAndClearConversationBuffer(baselineSessionId);
|
|
15040
15122
|
const specs = discoverSpecs();
|
|
15041
15123
|
const plans = discoverPlans();
|
|
15042
15124
|
const latestPrompt = conversation?.prompts?.[conversation.prompts.length - 1]?.prompt ?? "";
|
|
@@ -15050,7 +15132,6 @@ async function runAnalyze(opts, globals) {
|
|
|
15050
15132
|
if (isReflectionQuestion(assistantResponse) && !agentAuthoredCodeThisTurn) {
|
|
15051
15133
|
passAndExit("Reflection-prompt turn \u2014 skipping analysis");
|
|
15052
15134
|
}
|
|
15053
|
-
const tokenResult = await resolveToken(globals.token);
|
|
15054
15135
|
const urlResult = await resolveServiceUrl(globals.serviceUrl);
|
|
15055
15136
|
if (!tokenResult.ok || !urlResult.ok) {
|
|
15056
15137
|
localOnlyAndExit(runLocalStatic(analyzable, securityFiles, baseline, !!opts.skipStatic));
|
|
@@ -15145,7 +15226,7 @@ async function runAnalyze(opts, globals) {
|
|
|
15145
15226
|
contentHash = hashResult.hash;
|
|
15146
15227
|
if (analysisMode !== "plan") {
|
|
15147
15228
|
const scoped = scopeToAuthored(allForReview, actionSummary);
|
|
15148
|
-
if (scoped.signal === "none-authored" && (actionSummary
|
|
15229
|
+
if (scoped.signal === "none-authored" && !hasNonEditAuthorship(actionSummary, sessionAuthoredCode)) {
|
|
15149
15230
|
passAndExit("No agent-authored code this turn \u2014 working-tree changes were not authored by this session");
|
|
15150
15231
|
}
|
|
15151
15232
|
const baseForReview = scoped.signal === "authored" && scoped.files.length > 0 ? scoped.files : allForReview;
|
|
@@ -15278,7 +15359,10 @@ async function runAnalyze(opts, globals) {
|
|
|
15278
15359
|
if (snapshotResult.has_snapshots && snapshotResult.diffs.length > 0) {
|
|
15279
15360
|
requestBody.snapshot_diffs = snapshotResult.diffs;
|
|
15280
15361
|
}
|
|
15281
|
-
const
|
|
15362
|
+
const noHumanPrompt = (conversation?.prompts?.length ?? 0) === 0;
|
|
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;
|
|
15282
15366
|
if (hasIntent) {
|
|
15283
15367
|
const intentContext = {};
|
|
15284
15368
|
if (conversation && conversation.prompts.length > 0) {
|
|
@@ -15293,6 +15377,10 @@ async function runAnalyze(opts, globals) {
|
|
|
15293
15377
|
intentContext.recent_commits = conversation.recent_commits;
|
|
15294
15378
|
}
|
|
15295
15379
|
}
|
|
15380
|
+
if (w4Task && !intentContext.user_prompt) {
|
|
15381
|
+
intentContext.user_prompt = w4Task.goal;
|
|
15382
|
+
logEvent("w4_issue_anchor", { issue: w4Task.number, via: w4Task.via });
|
|
15383
|
+
}
|
|
15296
15384
|
if (assistantResponse) {
|
|
15297
15385
|
const cap = analysisMode === "plan" ? MAX_ASSISTANT_RESPONSE_CHARS_PLAN : MAX_ASSISTANT_RESPONSE_CHARS_DEFAULT;
|
|
15298
15386
|
intentContext.assistant_response = assistantResponse.length > cap ? assistantResponse.slice(0, cap) : assistantResponse;
|
|
@@ -15585,7 +15673,10 @@ function registerBaselineCommands(program2) {
|
|
|
15585
15673
|
}
|
|
15586
15674
|
}
|
|
15587
15675
|
}
|
|
15588
|
-
const
|
|
15676
|
+
const authForScope = await resolveToken(program2.opts().token);
|
|
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 });
|
|
15589
15680
|
logEvent("baseline_capture", {
|
|
15590
15681
|
created: result.created,
|
|
15591
15682
|
source: source ?? null,
|
|
@@ -16031,20 +16122,20 @@ function writeBlockMessage(moment, response) {
|
|
|
16031
16122
|
var import_node_fs24 = require("node:fs");
|
|
16032
16123
|
var import_promises13 = require("node:fs/promises");
|
|
16033
16124
|
var import_node_path19 = require("node:path");
|
|
16034
|
-
var
|
|
16125
|
+
var import_node_child_process11 = require("node:child_process");
|
|
16035
16126
|
var readline2 = __toESM(require("node:readline/promises"));
|
|
16036
16127
|
|
|
16037
16128
|
// src/commands/migrate.ts
|
|
16038
16129
|
var import_node_fs23 = require("node:fs");
|
|
16039
16130
|
var import_node_path18 = require("node:path");
|
|
16040
|
-
var
|
|
16131
|
+
var import_node_child_process10 = require("node:child_process");
|
|
16041
16132
|
var LEGACY_NPM_PACKAGE = "@codacy/gate-cli";
|
|
16042
16133
|
function defaultNpmRemover(pkg) {
|
|
16043
|
-
(0,
|
|
16134
|
+
(0, import_node_child_process10.execSync)(`npm rm -g ${pkg}`, { stdio: "pipe", timeout: 12e4 });
|
|
16044
16135
|
}
|
|
16045
16136
|
function isGitTracked(cwd, relPath) {
|
|
16046
16137
|
try {
|
|
16047
|
-
(0,
|
|
16138
|
+
(0, import_node_child_process10.execSync)(`git ls-files --error-unmatch ${relPath}`, { cwd, stdio: "pipe" });
|
|
16048
16139
|
return true;
|
|
16049
16140
|
} catch {
|
|
16050
16141
|
return false;
|
|
@@ -16052,7 +16143,7 @@ function isGitTracked(cwd, relPath) {
|
|
|
16052
16143
|
}
|
|
16053
16144
|
function isGitRepo(cwd) {
|
|
16054
16145
|
try {
|
|
16055
|
-
(0,
|
|
16146
|
+
(0, import_node_child_process10.execSync)("git rev-parse --is-inside-work-tree", { cwd, stdio: "pipe" });
|
|
16056
16147
|
return true;
|
|
16057
16148
|
} catch {
|
|
16058
16149
|
return false;
|
|
@@ -16091,7 +16182,7 @@ function migrateProjectDirRename(root, gateDir, verityDir, actions) {
|
|
|
16091
16182
|
);
|
|
16092
16183
|
}
|
|
16093
16184
|
try {
|
|
16094
|
-
(0,
|
|
16185
|
+
(0, import_node_child_process10.execSync)("git mv .gate .verity", { cwd: root, stdio: "pipe" });
|
|
16095
16186
|
actions.push("Moved .gate/ \u2192 .verity/ (git mv, staged)");
|
|
16096
16187
|
moved = true;
|
|
16097
16188
|
} catch {
|
|
@@ -16170,7 +16261,7 @@ function migrateStandardFile(root, actions) {
|
|
|
16170
16261
|
let moved = false;
|
|
16171
16262
|
if (isGitRepo(root) && isGitTracked(root, "GATE.md")) {
|
|
16172
16263
|
try {
|
|
16173
|
-
(0,
|
|
16264
|
+
(0, import_node_child_process10.execSync)("git mv GATE.md VERITY.md", { cwd: root, stdio: "pipe" });
|
|
16174
16265
|
moved = true;
|
|
16175
16266
|
} catch {
|
|
16176
16267
|
}
|
|
@@ -16226,7 +16317,7 @@ function readFileSyncSafe(path) {
|
|
|
16226
16317
|
}
|
|
16227
16318
|
function hasStagedChanges(root) {
|
|
16228
16319
|
try {
|
|
16229
|
-
(0,
|
|
16320
|
+
(0, import_node_child_process10.execSync)("git diff --cached --quiet", { cwd: root, stdio: "pipe" });
|
|
16230
16321
|
return false;
|
|
16231
16322
|
} catch {
|
|
16232
16323
|
return true;
|
|
@@ -16345,7 +16436,7 @@ async function runOptionalAuth(serviceUrl) {
|
|
|
16345
16436
|
}
|
|
16346
16437
|
let remote = "";
|
|
16347
16438
|
try {
|
|
16348
|
-
remote = (0,
|
|
16439
|
+
remote = (0, import_node_child_process11.execSync)("git remote get-url origin", { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }).trim();
|
|
16349
16440
|
} catch {
|
|
16350
16441
|
}
|
|
16351
16442
|
const localOnlyNote = () => {
|
|
@@ -16441,30 +16532,30 @@ function registerInitCommand(program2) {
|
|
|
16441
16532
|
}
|
|
16442
16533
|
printInfo(` Node.js ${nodeVersion} \u2713`);
|
|
16443
16534
|
try {
|
|
16444
|
-
const gitVersion = (0,
|
|
16535
|
+
const gitVersion = (0, import_node_child_process11.execSync)("git --version", { encoding: "utf-8" }).trim();
|
|
16445
16536
|
printInfo(` ${gitVersion} \u2713`);
|
|
16446
16537
|
} catch {
|
|
16447
16538
|
printError("git is required but not installed. Install from https://git-scm.com");
|
|
16448
16539
|
process.exit(1);
|
|
16449
16540
|
}
|
|
16450
16541
|
try {
|
|
16451
|
-
(0,
|
|
16542
|
+
(0, import_node_child_process11.execSync)("which claude", { encoding: "utf-8" });
|
|
16452
16543
|
printInfo(" Claude Code \u2713");
|
|
16453
16544
|
} catch {
|
|
16454
16545
|
printWarn(" Claude Code not found \u2014 hooks will be configured but need Claude Code to run.");
|
|
16455
16546
|
}
|
|
16456
16547
|
try {
|
|
16457
|
-
(0,
|
|
16548
|
+
(0, import_node_child_process11.execSync)("which codacy-analysis", { encoding: "utf-8", stdio: "pipe" });
|
|
16458
16549
|
printInfo(" @codacy/analysis-cli \u2713");
|
|
16459
16550
|
} catch {
|
|
16460
16551
|
printInfo(" Installing @codacy/analysis-cli...");
|
|
16461
16552
|
try {
|
|
16462
|
-
(0,
|
|
16553
|
+
(0, import_node_child_process11.execSync)("npm install -g @codacy/analysis-cli", { encoding: "utf-8", stdio: "pipe", timeout: 12e4 });
|
|
16463
16554
|
printInfo(" @codacy/analysis-cli installed \u2713");
|
|
16464
16555
|
} catch {
|
|
16465
16556
|
try {
|
|
16466
16557
|
printWarn(" Retrying with sudo...");
|
|
16467
|
-
(0,
|
|
16558
|
+
(0, import_node_child_process11.execSync)("sudo npm install -g @codacy/analysis-cli", { encoding: "utf-8", stdio: "inherit", timeout: 12e4 });
|
|
16468
16559
|
printInfo(" @codacy/analysis-cli installed \u2713");
|
|
16469
16560
|
} catch {
|
|
16470
16561
|
printWarn(" Could not install @codacy/analysis-cli automatically.");
|
|
@@ -17282,7 +17373,7 @@ function registerTelemetryCommands(program2) {
|
|
|
17282
17373
|
}
|
|
17283
17374
|
|
|
17284
17375
|
// src/cli.ts
|
|
17285
|
-
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");
|
|
17286
17377
|
registerAuthCommands(program);
|
|
17287
17378
|
registerLoginCommand(program);
|
|
17288
17379
|
registerHooksCommands(program);
|