@codacy/verity-cli 0.24.0-experimental.b35bbc7 → 0.24.0-experimental.bdf0db7

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.
Files changed (2) hide show
  1. package/bin/verity.js +24 -32
  2. package/package.json +1 -1
package/bin/verity.js CHANGED
@@ -13255,15 +13255,10 @@ function collectCodeDelta(files, opts) {
13255
13255
  // src/lib/debounce.ts
13256
13256
  var import_node_fs9 = require("node:fs");
13257
13257
  var import_node_crypto3 = require("node:crypto");
13258
- function scopedFile(base, sessionId) {
13259
- if (!sessionId) return base;
13260
- return `${base}.${(0, import_node_crypto3.createHash)("sha1").update(sessionId).digest("hex").slice(0, 12)}`;
13261
- }
13262
- function checkDebounce(debounceSeconds = DEBOUNCE_SECONDS, sessionId) {
13263
- const file = scopedFile(DEBOUNCE_FILE, sessionId);
13264
- if (!(0, import_node_fs9.existsSync)(file)) return null;
13258
+ function checkDebounce(debounceSeconds = DEBOUNCE_SECONDS) {
13259
+ if (!(0, import_node_fs9.existsSync)(DEBOUNCE_FILE)) return null;
13265
13260
  try {
13266
- const lastTs = parseInt((0, import_node_fs9.readFileSync)(file, "utf-8").trim(), 10);
13261
+ const lastTs = parseInt((0, import_node_fs9.readFileSync)(DEBOUNCE_FILE, "utf-8").trim(), 10);
13267
13262
  const nowTs = Math.floor(Date.now() / 1e3);
13268
13263
  const elapsed = nowTs - lastTs;
13269
13264
  if (elapsed < debounceSeconds) {
@@ -13273,13 +13268,12 @@ function checkDebounce(debounceSeconds = DEBOUNCE_SECONDS, sessionId) {
13273
13268
  }
13274
13269
  return null;
13275
13270
  }
13276
- function checkMtime(files, bypassForRecentCommits, sessionId) {
13271
+ function checkMtime(files, bypassForRecentCommits) {
13277
13272
  if (bypassForRecentCommits) return null;
13278
- const file = scopedFile(DEBOUNCE_FILE, sessionId);
13279
- if (!(0, import_node_fs9.existsSync)(file)) return null;
13273
+ if (!(0, import_node_fs9.existsSync)(DEBOUNCE_FILE)) return null;
13280
13274
  let debounceTime;
13281
13275
  try {
13282
- debounceTime = (0, import_node_fs9.statSync)(file).mtimeMs;
13276
+ debounceTime = (0, import_node_fs9.statSync)(DEBOUNCE_FILE).mtimeMs;
13283
13277
  } catch {
13284
13278
  return null;
13285
13279
  }
@@ -13311,12 +13305,11 @@ function computeContentHash(files) {
13311
13305
  }
13312
13306
  return hash.digest("hex");
13313
13307
  }
13314
- function checkContentHash(files, sessionId) {
13308
+ function checkContentHash(files) {
13315
13309
  const hash = computeContentHash(files);
13316
- const file = scopedFile(HASH_FILE, sessionId);
13317
- if ((0, import_node_fs9.existsSync)(file)) {
13310
+ if ((0, import_node_fs9.existsSync)(HASH_FILE)) {
13318
13311
  try {
13319
- const storedHash = (0, import_node_fs9.readFileSync)(file, "utf-8").trim();
13312
+ const storedHash = (0, import_node_fs9.readFileSync)(HASH_FILE, "utf-8").trim();
13320
13313
  if (hash === storedHash) {
13321
13314
  return { skip: "No source changes since last analysis", hash };
13322
13315
  }
@@ -13325,19 +13318,18 @@ function checkContentHash(files, sessionId) {
13325
13318
  }
13326
13319
  return { skip: null, hash };
13327
13320
  }
13328
- function recordAnalysisStart(sessionId) {
13321
+ function recordAnalysisStart() {
13329
13322
  (0, import_node_fs9.mkdirSync)(VERITY_DIR, { recursive: true });
13330
- (0, import_node_fs9.writeFileSync)(scopedFile(DEBOUNCE_FILE, sessionId), String(Math.floor(Date.now() / 1e3)));
13323
+ (0, import_node_fs9.writeFileSync)(DEBOUNCE_FILE, String(Math.floor(Date.now() / 1e3)));
13331
13324
  }
13332
- function recordPassHash(hash, sessionId) {
13333
- (0, import_node_fs9.writeFileSync)(scopedFile(HASH_FILE, sessionId), hash);
13325
+ function recordPassHash(hash) {
13326
+ (0, import_node_fs9.writeFileSync)(HASH_FILE, hash);
13334
13327
  }
13335
- function narrowToRecent(files, sessionId) {
13336
- const file = scopedFile(DEBOUNCE_FILE, sessionId);
13337
- if (!(0, import_node_fs9.existsSync)(file)) return files;
13328
+ function narrowToRecent(files) {
13329
+ if (!(0, import_node_fs9.existsSync)(DEBOUNCE_FILE)) return files;
13338
13330
  let debounceTime;
13339
13331
  try {
13340
- debounceTime = (0, import_node_fs9.statSync)(file).mtimeMs;
13332
+ debounceTime = (0, import_node_fs9.statSync)(DEBOUNCE_FILE).mtimeMs;
13341
13333
  } catch {
13342
13334
  return files;
13343
13335
  }
@@ -14843,7 +14835,7 @@ async function runAnalyze(opts, globals) {
14843
14835
  let currentCommit = "";
14844
14836
  if (analysisMode !== "plan") {
14845
14837
  const debounceSeconds = parseInt(opts.debounce, 10);
14846
- const debounceSkip = checkDebounce(debounceSeconds, baselineSessionId);
14838
+ const debounceSkip = checkDebounce(debounceSeconds);
14847
14839
  if (debounceSkip) {
14848
14840
  if (assistantResponse) {
14849
14841
  analysisMode = "plan";
@@ -14853,7 +14845,7 @@ async function runAnalyze(opts, globals) {
14853
14845
  }
14854
14846
  if (analysisMode !== "plan") {
14855
14847
  const allCheckable = Array.from(/* @__PURE__ */ new Set([...analyzable, ...reviewable, ...securityFiles]));
14856
- const mtimeSkip = checkMtime(allCheckable, hasRecentCommitFiles, baselineSessionId);
14848
+ const mtimeSkip = checkMtime(allCheckable, hasRecentCommitFiles);
14857
14849
  if (mtimeSkip) {
14858
14850
  if (assistantResponse) {
14859
14851
  analysisMode = "plan";
@@ -14863,9 +14855,9 @@ async function runAnalyze(opts, globals) {
14863
14855
  }
14864
14856
  }
14865
14857
  if (analysisMode !== "plan") {
14866
- recordAnalysisStart(baselineSessionId);
14858
+ recordAnalysisStart();
14867
14859
  const allCheckable = Array.from(/* @__PURE__ */ new Set([...analyzable, ...reviewable, ...securityFiles]));
14868
- const hashResult = checkContentHash(allCheckable, baselineSessionId);
14860
+ const hashResult = checkContentHash(allCheckable);
14869
14861
  if (hashResult.skip) {
14870
14862
  if (assistantResponse) {
14871
14863
  analysisMode = "plan";
@@ -14877,7 +14869,7 @@ async function runAnalyze(opts, globals) {
14877
14869
  if (analysisMode !== "plan") {
14878
14870
  const agentNarrowed = narrowToAgentAuthored(allForReview, actionSummary);
14879
14871
  const baseForReview = agentNarrowed.length > 0 ? agentNarrowed : allForReview;
14880
- const recentForReview = narrowToRecent(baseForReview, baselineSessionId);
14872
+ const recentForReview = narrowToRecent(baseForReview);
14881
14873
  if (!opts.skipStatic && isCodacyAvailable()) {
14882
14874
  let allScannable = Array.from(/* @__PURE__ */ new Set([...analyzable, ...securityFiles]));
14883
14875
  if (baseline) {
@@ -15252,7 +15244,7 @@ async function runAnalyze(opts, globals) {
15252
15244
  }
15253
15245
  case "PASS": {
15254
15246
  writeIteration(1, currentCommit, contentHash ?? void 0);
15255
- if (contentHash) recordPassHash(contentHash, baselineSessionId);
15247
+ if (contentHash) recordPassHash(contentHash);
15256
15248
  if (currentCommit && currentCommit !== "no-git") writeBaselineSha(currentCommit);
15257
15249
  let userSummary = response.user_summary ?? "Verity: PASS";
15258
15250
  const viewUrl = response.view_url ?? "";
@@ -15263,7 +15255,7 @@ async function runAnalyze(opts, globals) {
15263
15255
  break;
15264
15256
  }
15265
15257
  case "WARN": {
15266
- if (contentHash) recordPassHash(contentHash, baselineSessionId);
15258
+ if (contentHash) recordPassHash(contentHash);
15267
15259
  if (currentCommit && currentCommit !== "no-git") writeBaselineSha(currentCommit);
15268
15260
  let userSummary = response.user_summary ?? "Verity: WARN";
15269
15261
  const viewUrl = response.view_url ?? "";
@@ -16921,7 +16913,7 @@ function registerTelemetryCommands(program2) {
16921
16913
  }
16922
16914
 
16923
16915
  // src/cli.ts
16924
- program.name("verity").description("CLI for Verity quality gate service").version("0.24.0-experimental.b35bbc7").option("--token <token>", "Override authentication token").option("--service-url <url>", "Override service URL").option("--verbose", "Log HTTP requests/responses to stderr");
16916
+ program.name("verity").description("CLI for Verity quality gate service").version("0.24.0-experimental.bdf0db7").option("--token <token>", "Override authentication token").option("--service-url <url>", "Override service URL").option("--verbose", "Log HTTP requests/responses to stderr");
16925
16917
  registerAuthCommands(program);
16926
16918
  registerHooksCommands(program);
16927
16919
  registerIntentCommands(program);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codacy/verity-cli",
3
- "version": "0.24.0-experimental.b35bbc7",
3
+ "version": "0.24.0-experimental.bdf0db7",
4
4
  "description": "CLI for Verity quality gate service",
5
5
  "homepage": "https://verity.md",
6
6
  "repository": {