@codacy/verity-cli 0.29.4-experimental.6f2ede0 → 0.29.4-experimental.7475da6

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);
@@ -17299,7 +17326,7 @@ function channelSilence(input) {
17299
17326
  // src/lib/cli-version.ts
17300
17327
  function cliVersion() {
17301
17328
  try {
17302
- return true ? "0.29.4-experimental.6f2ede0" : "dev";
17329
+ return true ? "0.29.4-experimental.7475da6" : "dev";
17303
17330
  } catch {
17304
17331
  return "dev";
17305
17332
  }
@@ -21698,6 +21725,12 @@ function registerInitCommand(program2) {
21698
21725
  }
21699
21726
  await (0, import_promises13.mkdir)(VERITY_DIR, { recursive: true });
21700
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
+ }
21701
21734
  try {
21702
21735
  await ensureClaudeMdPointer();
21703
21736
  printInfo(" CLAUDE.md memory pointer \u2713");
@@ -22380,8 +22413,8 @@ function registerTelemetryCommands(program2) {
22380
22413
  }
22381
22414
 
22382
22415
  // src/cli.ts
22383
- program.name("verity").description("CLI for Verity quality gate service").version("0.29.4-experimental.6f2ede0").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) => {
22384
- installStderrLog(actionCommand.name(), process.argv.slice(2), "0.29.4-experimental.6f2ede0");
22416
+ program.name("verity").description("CLI for Verity quality gate service").version("0.29.4-experimental.7475da6").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.7475da6");
22385
22418
  setUserNamedServiceUrl(program.opts().serviceUrl);
22386
22419
  try {
22387
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.6f2ede0",
3
+ "version": "0.29.4-experimental.7475da6",
4
4
  "description": "CLI for Verity quality gate service",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "homepage": "https://verity.md",