@codacy/verity-cli 0.34.0-experimental.7e3f52d → 0.34.0-experimental.a0879f9

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 +25 -70
  2. package/package.json +1 -1
package/bin/verity.js CHANGED
@@ -17221,7 +17221,7 @@ function readConfigFile(path) {
17221
17221
  return {
17222
17222
  git_moments: [...new Set(moments)],
17223
17223
  ...source2 ? { git_moments_source: source2 } : {},
17224
- ...raw.formal === "push" || raw.formal === "off" ? { formal: raw.formal } : {}
17224
+ ...raw.formal === "push" ? { formal: "push" } : {}
17225
17225
  };
17226
17226
  } catch {
17227
17227
  return DEFAULTS;
@@ -24152,7 +24152,7 @@ function registerConfigCommands(program2) {
24152
24152
  config.command("formal [state]").description('Get or set formal verification at push: "push" or "off" (needs Lean \u2014 verity lean status)').action((state) => {
24153
24153
  if (state === void 0) {
24154
24154
  const cfg = readProjectConfig();
24155
- process.stdout.write((cfg.formal === "push" ? "push" : "off") + "\n");
24155
+ process.stdout.write((cfg.formal ?? "off") + "\n");
24156
24156
  if (cfg.formal_refused) printWarn(formalRefusalMessage(cfg.formal_refused));
24157
24157
  return;
24158
24158
  }
@@ -24160,7 +24160,7 @@ function registerConfigCommands(program2) {
24160
24160
  printError(`Unrecognised state: ${state}. Use "push" or "off".`);
24161
24161
  process.exit(1);
24162
24162
  }
24163
- writeProjectConfig({ formal: state === "push" ? "push" : "off" });
24163
+ writeProjectConfig({ formal: state === "push" ? "push" : void 0 });
24164
24164
  const refused2 = state === "push" ? readProjectConfig().formal_refused : void 0;
24165
24165
  if (refused2) {
24166
24166
  printWarn(`Formal verification at push: still off \u2014 ${formalRefusalMessage(refused2)}`);
@@ -27073,7 +27073,7 @@ function channelSilence(input) {
27073
27073
  // src/lib/cli-version.ts
27074
27074
  function cliVersion() {
27075
27075
  try {
27076
- return true ? "0.34.0-experimental.7e3f52d" : "dev";
27076
+ return true ? "0.34.0-experimental.a0879f9" : "dev";
27077
27077
  } catch {
27078
27078
  return "dev";
27079
27079
  }
@@ -35910,10 +35910,9 @@ function verityLeanHome(env = process.env) {
35910
35910
  function findToolchain(env = process.env) {
35911
35911
  const managedBin = (0, import_node_path43.join)(verityLeanHome(env), LEAN_TOOLCHAIN.replace(/^leanprover\/lean4:/, ""), "bin");
35912
35912
  const elanBin = (0, import_node_path43.join)(env.HOME ?? (0, import_node_os9.homedir)(), ".elan", "bin");
35913
- const elanHas = (0, import_node_fs58.existsSync)((0, import_node_path43.join)(env.HOME ?? (0, import_node_os9.homedir)(), ".elan", "toolchains", LEAN_TOOLCHAIN.replace("/", "--").replace(":", "---")));
35914
- const userPath = (env.PATH ?? "").split(import_node_path43.delimiter).filter((d) => d && (elanHas || (0, import_node_path43.resolve)(d) !== (0, import_node_path43.resolve)(elanBin)));
35915
- const path = [managedBin, ...elanHas ? [elanBin] : [], ...userPath].join(import_node_path43.delimiter);
35913
+ const path = [managedBin, elanBin, env.PATH ?? ""].filter(Boolean).join(import_node_path43.delimiter);
35916
35914
  const merged = { ...env, PATH: path, ELAN_TOOLCHAIN: env.ELAN_TOOLCHAIN ?? LEAN_TOOLCHAIN };
35915
+ const elanHas = (0, import_node_fs58.existsSync)((0, import_node_path43.join)(env.HOME ?? (0, import_node_os9.homedir)(), ".elan", "toolchains", LEAN_TOOLCHAIN.replace("/", "--").replace(":", "---")));
35917
35916
  const exe = process.platform === "win32" ? "lake.exe" : "lake";
35918
35917
  const candidates2 = [(0, import_node_path43.join)(managedBin, exe), ...elanHas ? [(0, import_node_path43.join)(elanBin, exe)] : [], exe];
35919
35918
  for (const candidate of candidates2) {
@@ -38803,22 +38802,6 @@ var import_promises18 = require("node:stream/promises");
38803
38802
  var import_node_stream = require("node:stream");
38804
38803
  var RELEASES = "https://releases.lean-lang.org/lean4";
38805
38804
  var LEAN_DOWNLOAD_SIZE = "\u2248800 MB download, 2.7 GB on disk";
38806
- var DOWNLOAD_STALL_MS = 6e4;
38807
- var LEAN_DISK_NEEDED_BYTES = 3.75 * 1024 ** 3;
38808
- function freeBytes(dir) {
38809
- let d = dir;
38810
- for (let i2 = 0; i2 < 64; i2++) {
38811
- try {
38812
- const st = (0, import_node_fs63.statfsSync)(d);
38813
- return Number(st.bavail) * Number(st.bsize);
38814
- } catch {
38815
- const up = (0, import_node_path47.join)(d, "..");
38816
- if (up === d) return null;
38817
- d = up;
38818
- }
38819
- }
38820
- return null;
38821
- }
38822
38805
  var LEAN_ASSET_SHA256 = {
38823
38806
  "v4.34.0": {
38824
38807
  "lean-4.34.0-darwin.zip": "75a2a4b8e3d35680e8f51fae5a42c79702f463dd73ee1520fb61e5a9143e336c",
@@ -38877,32 +38860,17 @@ function unzip(zip, dest) {
38877
38860
  }
38878
38861
  return { ok: false, error: errors.join("; ") };
38879
38862
  }
38880
- async function download(url, dest, onProgress, stallMs = DOWNLOAD_STALL_MS) {
38881
- const ctrl = new AbortController();
38882
- let timer;
38883
- const arm = () => {
38884
- clearTimeout(timer);
38885
- timer = setTimeout(() => ctrl.abort(), stallMs);
38886
- };
38887
- arm();
38888
- try {
38889
- const res = await fetch(url, { redirect: "follow", signal: ctrl.signal });
38890
- if (!res.ok || !res.body) throw new Error(`download failed: HTTP ${res.status}`);
38891
- const total = Number(res.headers.get("content-length")) || null;
38892
- let seen = 0;
38893
- const stream = import_node_stream.Readable.fromWeb(res.body);
38894
- stream.on("data", (chunk) => {
38895
- arm();
38896
- seen += chunk.length;
38897
- onProgress(seen, total);
38898
- });
38899
- await (0, import_promises18.pipeline)(stream, (0, import_node_fs63.createWriteStream)(dest), { signal: ctrl.signal });
38900
- } catch (err2) {
38901
- if (ctrl.signal.aborted) throw new Error(`download stalled: nothing received for ${Math.round(stallMs / 1e3)} s`);
38902
- throw err2;
38903
- } finally {
38904
- clearTimeout(timer);
38905
- }
38863
+ async function download(url, dest, onProgress) {
38864
+ const res = await fetch(url, { redirect: "follow" });
38865
+ if (!res.ok || !res.body) throw new Error(`download failed: HTTP ${res.status}`);
38866
+ const total = Number(res.headers.get("content-length")) || null;
38867
+ let seen = 0;
38868
+ const stream = import_node_stream.Readable.fromWeb(res.body);
38869
+ stream.on("data", (chunk) => {
38870
+ seen += chunk.length;
38871
+ onProgress(seen, total);
38872
+ });
38873
+ await (0, import_promises18.pipeline)(stream, (0, import_node_fs63.createWriteStream)(dest));
38906
38874
  }
38907
38875
  function inPlaceProgress(label2, write = (s) => process.stderr.write(s)) {
38908
38876
  let active = false;
@@ -38940,12 +38908,6 @@ async function installLean(opts = {}) {
38940
38908
  const dir = pinnedVersionDir(env);
38941
38909
  const url = `${RELEASES}/${pinnedVersion()}/${asset}`;
38942
38910
  const home = verityLeanHome(env);
38943
- const free = freeBytes(home);
38944
- const needed = opts.minFreeBytes ?? LEAN_DISK_NEEDED_BYTES;
38945
- if (free !== null && free < needed) {
38946
- const gb = (n) => (n / 1024 ** 3).toFixed(1);
38947
- return { ok: false, error: `not enough disk space for Lean: ${gb(free)} GB free where ${home} lives, needs about ${gb(needed)} GB` };
38948
- }
38949
38911
  const tmp = (0, import_node_path47.join)(home, ".tmp");
38950
38912
  (0, import_node_fs63.rmSync)(tmp, { recursive: true, force: true });
38951
38913
  (0, import_node_fs63.mkdirSync)(tmp, { recursive: true });
@@ -39254,10 +39216,8 @@ var INTENSITY_CHOICES = [
39254
39216
  { id: "thorough", label: "thorough", hint: "all tools, all rules (~15s)" }
39255
39217
  ];
39256
39218
  var FORMAL_CHOICES = [
39257
- { id: "yes", label: "yes", hint: "a Lean model of the riskiest changed function; blocks only on a REPRODUCED counterexample" },
39258
- // No is the default (review of #255): "yes" downloads ≈800 MB and unpacks
39259
- // 2.7 GB, and a bare Enter must never do that.
39260
- { id: "no", label: "no", hint: "enable later with: verity config formal push", recommended: true }
39219
+ { id: "yes", label: "yes", hint: "a Lean model of the riskiest changed function; blocks only on a REPRODUCED counterexample", recommended: true },
39220
+ { id: "no", label: "no", hint: "enable later with: verity config formal push" }
39261
39221
  ];
39262
39222
  var MOMENT_CHOICES = [
39263
39223
  { id: "stop", label: "On stop", hint: "after every agent turn \u2014 fast feedback while you work", recommended: true },
@@ -39663,20 +39623,16 @@ async function offerFormalVerification(defaultsOnly, pluginMode) {
39663
39623
  printWarn(` Formal verification: off \u2014 ${formalRefusalMessage(cfg.formal_refused)}`);
39664
39624
  return;
39665
39625
  }
39626
+ const toolchain = findToolchain();
39666
39627
  if (cfg.formal === "push") {
39667
- if (findToolchain()) printInfo(" Formal verification at push \u2713");
39628
+ if (toolchain) printInfo(" Formal verification at push \u2713");
39668
39629
  else printWarn(" Formal verification is on but Lean is missing \u2014 run: verity lean install");
39669
39630
  return;
39670
39631
  }
39671
- if (cfg.formal === "off") {
39672
- printInfo(" Formal verification: off (enable with: verity config formal push)");
39673
- return;
39674
- }
39675
39632
  if (defaultsOnly || !interactive()) {
39676
39633
  printInfo(" Formal verification (a model-based bug finder at push): off \u2014 enable with: verity config formal push");
39677
39634
  return;
39678
39635
  }
39679
- const toolchain = findToolchain();
39680
39636
  console.log("");
39681
39637
  console.log(" Formal verification review \u2014 a model-based bug finder for your riskiest code.");
39682
39638
  console.log(" At push, Verity picks the riskiest changed function, checks a small model of");
@@ -39684,10 +39640,9 @@ async function offerFormalVerification(defaultsOnly, pluginMode) {
39684
39640
  console.log(" Verity for that). Only a reproduced bug can block; most pushes get no model.");
39685
39641
  console.log(` Adds /verity-prove <worry> to check any code on demand.${toolchain ? "" : ` Needs to install Lean 4 (${LEAN_DOWNLOAD_SIZE}) on "yes".`}`);
39686
39642
  console.log("");
39687
- const wants = await promptChoice("Formal verification at push?", FORMAL_CHOICES, "no");
39643
+ const wants = await promptChoice("Formal verification at push?", FORMAL_CHOICES, "yes");
39688
39644
  if (wants === "yes" && pluginMode) printInfo(" Plugin: the push check works now; /verity:verity-prove arrives with the plugin's next release.");
39689
39645
  if (wants !== "yes") {
39690
- writeProjectConfig({ formal: "off" });
39691
39646
  printInfo(" Formal verification: off (enable later with: verity config formal push)");
39692
39647
  return;
39693
39648
  }
@@ -39946,7 +39901,7 @@ function registerInitCommand(program2) {
39946
39901
  ...telemetryChoice ? { telemetry: telemetryChoice } : {},
39947
39902
  init: {
39948
39903
  completed_at: (/* @__PURE__ */ new Date()).toISOString(),
39949
- cli_version: true ? "0.34.0-experimental.7e3f52d" : "dev"
39904
+ cli_version: true ? "0.34.0-experimental.a0879f9" : "dev"
39950
39905
  }
39951
39906
  });
39952
39907
  } catch (err2) {
@@ -41419,8 +41374,8 @@ function registerLeanCommand(program2) {
41419
41374
  }
41420
41375
 
41421
41376
  // src/cli.ts
41422
- program.name("verity").description("CLI for Verity quality gate service").version("0.34.0-experimental.7e3f52d").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) => {
41423
- installStderrLog(actionCommand.name(), process.argv.slice(2), "0.34.0-experimental.7e3f52d");
41377
+ program.name("verity").description("CLI for Verity quality gate service").version("0.34.0-experimental.a0879f9").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) => {
41378
+ installStderrLog(actionCommand.name(), process.argv.slice(2), "0.34.0-experimental.a0879f9");
41424
41379
  setUserNamedServiceUrl(program.opts().serviceUrl);
41425
41380
  try {
41426
41381
  await foldLegacyLocalCredential();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codacy/verity-cli",
3
- "version": "0.34.0-experimental.7e3f52d",
3
+ "version": "0.34.0-experimental.a0879f9",
4
4
  "description": "CLI for Verity quality gate service",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "homepage": "https://verity.md",