@codacy/verity-cli 0.29.4-experimental.d8678a8 → 0.29.4-experimental.e818a8a

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 CHANGED
@@ -15516,6 +15516,33 @@ ${addedLines}`,
15516
15516
  }
15517
15517
  return { diffs, has_snapshots: true };
15518
15518
  }
15519
+ function ensureSnapshotGitignored() {
15520
+ let content = "";
15521
+ try {
15522
+ content = (0, import_node_fs15.readFileSync)(".gitignore", "utf-8");
15523
+ } catch {
15524
+ }
15525
+ let ignored = null;
15526
+ try {
15527
+ (0, import_node_child_process6.execSync)("git check-ignore -q -- .verity/.snapshot/__probe__", { stdio: "pipe" });
15528
+ ignored = true;
15529
+ } catch (err) {
15530
+ ignored = err.status === 1 ? false : null;
15531
+ }
15532
+ if (ignored === true) return "covered";
15533
+ if (ignored === null) {
15534
+ const lines = content.split("\n").map((l) => l.trim());
15535
+ const covering = [".verity/.snapshot/", ".verity/.snapshot", ".verity/", ".verity", ".verity/*"];
15536
+ if (lines.some((l) => covering.includes(l))) return "covered";
15537
+ }
15538
+ try {
15539
+ const block = "# Verity \u2014 snapshots of analyzed files (machine state, never commit)\n.verity/.snapshot/\n";
15540
+ (0, import_node_fs15.writeFileSync)(".gitignore", content ? content + (content.endsWith("\n") ? "" : "\n") + "\n" + block : block);
15541
+ return "added";
15542
+ } catch {
15543
+ return "failed";
15544
+ }
15545
+ }
15519
15546
  function saveSnapshots(files) {
15520
15547
  const snapshotPaths = /* @__PURE__ */ new Set();
15521
15548
  for (const file of files) {
@@ -15560,7 +15587,7 @@ function cleanStaleSnapshots(dir, keepSet) {
15560
15587
  try {
15561
15588
  const entries = (0, import_node_fs15.readdirSync)(dir, { withFileTypes: true });
15562
15589
  for (const entry of entries) {
15563
- if (entry.name.startsWith(".")) continue;
15590
+ if (dir === SNAPSHOT_DIR && (entry.name === ".diff-old.tmp" || entry.name === ".diff-new.tmp")) continue;
15564
15591
  const fullPath = (0, import_node_path14.join)(dir, entry.name);
15565
15592
  if (entry.isDirectory()) {
15566
15593
  cleanStaleSnapshots(fullPath, keepSet);
@@ -17149,6 +17176,39 @@ async function bootstrap(run) {
17149
17176
  Object.assign(run, { actionSummary, assistantResponse, baseline, baselineSessionId, reachability, sessionId, stopReason, tokenResult, transcriptPath, turnId });
17150
17177
  }
17151
17178
 
17179
+ // src/lib/self-scope.ts
17180
+ var LEGACY_GATE_SKILLS = /* @__PURE__ */ new Set([
17181
+ "gate-setup",
17182
+ "gate-analyze",
17183
+ "gate-review",
17184
+ "gate-status",
17185
+ "gate-feedback",
17186
+ "gate-insights",
17187
+ "gate-learn",
17188
+ "gate-memory",
17189
+ "gate-reflect"
17190
+ ]);
17191
+ function isVerityOwned(path) {
17192
+ const segments = path.replace(/\\/g, "/").split("/");
17193
+ for (let i = 0; i < segments.length; i++) {
17194
+ const seg = segments[i];
17195
+ if (seg === ".verity" || seg === ".codacy") return true;
17196
+ if (i === segments.length - 1 && (seg === "VERITY.md" || seg === "GATE.md")) return true;
17197
+ if (seg === ".claude" && segments[i + 1] === "skills" && typeof segments[i + 2] === "string") {
17198
+ const skill = segments[i + 2];
17199
+ if (skill.startsWith("verity-") || LEGACY_GATE_SKILLS.has(skill)) return true;
17200
+ }
17201
+ if (seg === ".claude" && segments[i + 1] === "settings.json") return true;
17202
+ }
17203
+ return false;
17204
+ }
17205
+ function partitionVerityOwned(paths) {
17206
+ const kept = [];
17207
+ const owned = [];
17208
+ for (const p of paths) (isVerityOwned(p) ? owned : kept).push(p);
17209
+ return { kept, owned };
17210
+ }
17211
+
17152
17212
  // src/lib/channel.ts
17153
17213
  var MAX_AGENT_CONTEXT_CHARS = 1500;
17154
17214
  var MAX_AGENT_ITEMS = 5;
@@ -17266,7 +17326,7 @@ function channelSilence(input) {
17266
17326
  // src/lib/cli-version.ts
17267
17327
  function cliVersion() {
17268
17328
  try {
17269
- return true ? "0.29.4-experimental.d8678a8" : "dev";
17329
+ return true ? "0.29.4-experimental.e818a8a" : "dev";
17270
17330
  } catch {
17271
17331
  return "dev";
17272
17332
  }
@@ -17588,9 +17648,10 @@ async function scope(run) {
17588
17648
  const { assistantResponse } = run;
17589
17649
  const { files: allChanged, hasRecentCommitFiles } = getChangedFiles();
17590
17650
  run.changedUniverse = allChanged;
17591
- const analyzable = filterAnalyzable(allChanged);
17592
- const reviewable = filterReviewable(allChanged);
17593
- const securityFiles = filterSecurity(allChanged);
17651
+ const { kept: external } = partitionVerityOwned(allChanged);
17652
+ const analyzable = filterAnalyzable(external);
17653
+ const reviewable = filterReviewable(external);
17654
+ const securityFiles = filterSecurity(external);
17594
17655
  const noFilesChanged = analyzable.length === 0 && reviewable.length === 0 && securityFiles.length === 0;
17595
17656
  if (noFilesChanged && !assistantResponse) {
17596
17657
  await passAndExit(run, "No analyzable files changed", "no-analyzable-files");
@@ -18851,7 +18912,8 @@ function gatherContextFiles(contextPaths, deltaFiles) {
18851
18912
  // src/commands/analyze/phases/07-context-files.ts
18852
18913
  async function contextFiles(run) {
18853
18914
  const { codeDelta, contextFilePaths } = run;
18854
- const contextFiles2 = gatherContextFiles(contextFilePaths, codeDelta.files);
18915
+ const { kept: externalContext } = partitionVerityOwned(contextFilePaths ?? []);
18916
+ const contextFiles2 = gatherContextFiles(externalContext, codeDelta.files);
18855
18917
  for (const f of codeDelta.files) {
18856
18918
  f.role = "delta";
18857
18919
  }
@@ -19910,6 +19972,7 @@ async function reconcile(run) {
19910
19972
  } catch {
19911
19973
  }
19912
19974
  }
19975
+ const { kept: externalChanged, owned: verityOwned } = partitionVerityOwned(allChanged);
19913
19976
  const reviewCoverage = {
19914
19977
  reviewed: sentPaths,
19915
19978
  // Declared drops from the stages that DO report themselves today. The other
@@ -19951,11 +20014,20 @@ async function reconcile(run) {
19951
20014
  stage: "baseline-scoping",
19952
20015
  kind: "policy"
19953
20016
  })),
20017
+ // ⚠ VERITY'S OWN FILES, named as such — not laundered into the
20018
+ // extension bucket below, where "we do not review our own installer's
20019
+ // dirt" would read as "a changed README". See self-scope.ts.
20020
+ ...verityOwned.map((path) => ({
20021
+ path,
20022
+ reason: "verity-owned",
20023
+ stage: "self-scope",
20024
+ kind: "policy"
20025
+ })),
19954
20026
  // The extension allowlist. POLICY: a changed README was never going to be
19955
20027
  // reviewed, and calling that a coverage gap would downgrade nearly every
19956
20028
  // PASS to WARN until WARN meant nothing. Recorded so the ledger balances and
19957
20029
  // so "what did Verity ignore entirely" is answerable.
19958
- ...allChanged.filter((p) => !analyzable.includes(p) && !reviewable.includes(p) && !securityFiles.includes(p)).map((path) => ({
20030
+ ...externalChanged.filter((p) => !analyzable.includes(p) && !reviewable.includes(p) && !securityFiles.includes(p)).map((path) => ({
19959
20031
  path,
19960
20032
  reason: "not-a-reviewed-file-type",
19961
20033
  stage: "extension-allowlist",
@@ -21653,6 +21725,12 @@ function registerInitCommand(program2) {
21653
21725
  }
21654
21726
  await (0, import_promises13.mkdir)(VERITY_DIR, { recursive: true });
21655
21727
  await ensureMemoryDir();
21728
+ const ignoreResult = ensureSnapshotGitignored();
21729
+ if (ignoreResult === "failed") {
21730
+ printWarn(" .gitignore: could not add .verity/.snapshot/ \u2014 add it manually (it holds copies of analyzed files)");
21731
+ } else {
21732
+ printInfo(` .gitignore: .verity/.snapshot/ ${ignoreResult === "added" ? "added" : "already covered"} \u2713`);
21733
+ }
21656
21734
  try {
21657
21735
  await ensureClaudeMdPointer();
21658
21736
  printInfo(" CLAUDE.md memory pointer \u2713");
@@ -22335,8 +22413,8 @@ function registerTelemetryCommands(program2) {
22335
22413
  }
22336
22414
 
22337
22415
  // src/cli.ts
22338
- program.name("verity").description("CLI for Verity quality gate service").version("0.29.4-experimental.d8678a8").option("--token <token>", "Override authentication token").option("--service-url <url>", "Override service URL").option("--verbose", "Log HTTP requests/responses to stderr").hook("preAction", async (_thisCommand, actionCommand) => {
22339
- installStderrLog(actionCommand.name(), process.argv.slice(2), "0.29.4-experimental.d8678a8");
22416
+ program.name("verity").description("CLI for Verity quality gate service").version("0.29.4-experimental.e818a8a").option("--token <token>", "Override authentication token").option("--service-url <url>", "Override service URL").option("--verbose", "Log HTTP requests/responses to stderr").hook("preAction", async (_thisCommand, actionCommand) => {
22417
+ installStderrLog(actionCommand.name(), process.argv.slice(2), "0.29.4-experimental.e818a8a");
22340
22418
  setUserNamedServiceUrl(program.opts().serviceUrl);
22341
22419
  try {
22342
22420
  await foldLegacyLocalCredential();
@@ -711,18 +711,31 @@ to-be-pushed diff before it lands.
711
711
  Add these entries to `.gitignore` (create it if it doesn't exist, append if it does):
712
712
 
713
713
  ```
714
- # Verity
715
- .verity/.cache/
716
- .verity/.logs/
717
- .verity/.last-analysis
718
- .verity/.iteration-count
719
- .verity/.last-pass-hash
720
- .verity/.last-intent
721
- .verity/.memory-sync-state.json
714
+ # Verity — machine-local state. Everything in .verity/ is ignored EXCEPT the
715
+ # shared standard and the knowledge graph, which are meant to be committed.
716
+ .verity/*
717
+ !.verity/standard.yaml
718
+ !.verity/memory/
722
719
  .verity/memory/log.md
723
720
  .claude/settings.local.json
724
721
  ```
725
722
 
723
+ This is a whitelist on purpose: `.verity/` accumulates state files over time
724
+ (`.snapshot/` holds byte-for-byte copies of analyzed files — including any
725
+ secret the gate just flagged — plus `.cache/`, `.logs/`, `.baseline`,
726
+ `.task-context`, session-suffixed `.last-analysis.*` files, and whatever comes
727
+ next). Enumerating them one by one is how `.snapshot/` ended up committed in a
728
+ real repo; ignoring everything and re-including the two shared artifacts means
729
+ a future state file can never repeat that.
730
+
731
+ **If the repo previously committed Verity state** (check with
732
+ `git ls-files .verity`), untrack everything except the shared artifacts once:
733
+
734
+ ```bash
735
+ git rm -r --cached .verity
736
+ git add .verity/standard.yaml .verity/memory
737
+ ```
738
+
726
739
  `.claude/settings.local.json` is machine-local Claude Code config (telemetry endpoint + an
727
740
  `otelHeadersHelper` reference — no token). `verity telemetry install` adds this entry
728
741
  automatically.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codacy/verity-cli",
3
- "version": "0.29.4-experimental.d8678a8",
3
+ "version": "0.29.4-experimental.e818a8a",
4
4
  "description": "CLI for Verity quality gate service",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "homepage": "https://verity.md",