@codacy/verity-cli 0.34.0-experimental.421a631 → 0.34.0-experimental.675f6d2

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 +42 -13
  2. package/package.json +1 -1
package/bin/verity.js CHANGED
@@ -17250,10 +17250,10 @@ function readProjectConfigRaw() {
17250
17250
  function readProjectConfig() {
17251
17251
  const cfg = readProjectConfigRaw();
17252
17252
  if (cfg.formal !== "push" || !cfg.path) return cfg;
17253
- const refused = formalRefusal(cfg.path);
17254
- if (!refused) return cfg;
17253
+ const refused2 = formalRefusal(cfg.path);
17254
+ if (!refused2) return cfg;
17255
17255
  const { formal: _dropped, ...rest } = cfg;
17256
- return { ...rest, formal_refused: refused };
17256
+ return { ...rest, formal_refused: refused2 };
17257
17257
  }
17258
17258
  function formalRefusalMessage(reason) {
17259
17259
  switch (reason) {
@@ -24161,9 +24161,9 @@ function registerConfigCommands(program2) {
24161
24161
  process.exit(1);
24162
24162
  }
24163
24163
  writeProjectConfig({ formal: state === "push" ? "push" : void 0 });
24164
- const refused = state === "push" ? readProjectConfig().formal_refused : void 0;
24165
- if (refused) {
24166
- printWarn(`Formal verification at push: still off \u2014 ${formalRefusalMessage(refused)}`);
24164
+ const refused2 = state === "push" ? readProjectConfig().formal_refused : void 0;
24165
+ if (refused2) {
24166
+ printWarn(`Formal verification at push: still off \u2014 ${formalRefusalMessage(refused2)}`);
24167
24167
  return;
24168
24168
  }
24169
24169
  printInfo(state === "push" ? "Formal verification at push: on for this checkout (Lean must be installed \u2014 verity lean status)" : "Formal verification at push: off");
@@ -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.421a631" : "dev";
27076
+ return true ? "0.34.0-experimental.675f6d2" : "dev";
27077
27077
  } catch {
27078
27078
  return "dev";
27079
27079
  }
@@ -35989,10 +35989,35 @@ function runAsync(tc, cwd, args2, timeoutMs) {
35989
35989
  }
35990
35990
  var DEFAULT_BUILD_TIMEOUT_MS = 10 * 6e4;
35991
35991
  var DEFAULT_CHECK_TIMEOUT_MS = 12e4;
35992
+ function proofsWorkspaceProblem(root) {
35993
+ for (const rel of [".verity", PROOFS_DIR, `${PROOFS_DIR}/.lake`]) {
35994
+ let st;
35995
+ try {
35996
+ st = (0, import_node_fs58.lstatSync)((0, import_node_path43.join)(root, rel));
35997
+ } catch {
35998
+ break;
35999
+ }
36000
+ if (st.isSymbolicLink()) return `${rel} is a symlink; Lean is not run through it`;
36001
+ }
36002
+ const r = runGitSync(root, ["ls-files", "-z", "--", PROOFS_DIR], { timeoutMs: 5e3 });
36003
+ if (!r.ok) return `could not confirm with git that ${PROOFS_DIR} holds no committed files; Lean is not run`;
36004
+ const tracked = r.stdout.split("\0").filter(Boolean);
36005
+ if (tracked.length > 0) {
36006
+ return `${tracked.length} file(s) under ${PROOFS_DIR} are tracked in git (e.g. ${tracked[0]}); Lean is not run on a workspace the repository supplies \u2014 untrack them with: git rm -r --cached ${PROOFS_DIR}`;
36007
+ }
36008
+ return null;
36009
+ }
36010
+ function refused(problem) {
36011
+ return { ok: false, stdout: "", stderr: problem, durationMs: 0, timedOut: false };
36012
+ }
35992
36013
  function buildLibrary(tc, root, timeoutMs = DEFAULT_BUILD_TIMEOUT_MS) {
36014
+ const problem = proofsWorkspaceProblem(root);
36015
+ if (problem) return refused(problem);
35993
36016
  return run2(tc, (0, import_node_path43.join)(root, PROOFS_DIR), ["build"], timeoutMs);
35994
36017
  }
35995
- function buildLibraryAsync(tc, root, timeoutMs = DEFAULT_BUILD_TIMEOUT_MS) {
36018
+ async function buildLibraryAsync(tc, root, timeoutMs = DEFAULT_BUILD_TIMEOUT_MS) {
36019
+ const problem = proofsWorkspaceProblem(root);
36020
+ if (problem) return refused(problem);
35996
36021
  return runAsync(tc, (0, import_node_path43.join)(root, PROOFS_DIR), ["build"], timeoutMs);
35997
36022
  }
35998
36023
  function isModelInRoot(modelsAbs, rel) {
@@ -36019,13 +36044,15 @@ function trimDiagnostics(text) {
36019
36044
  function checkModel(tc, root, modelFile, opts = {}) {
36020
36045
  const proofsAbs = (0, import_node_path43.join)(root, PROOFS_DIR);
36021
36046
  const rel = (0, import_node_path43.relative)(proofsAbs, modelFile);
36022
- const res = run2(tc, proofsAbs, ["env", "lean", rel], opts.timeoutMs ?? DEFAULT_CHECK_TIMEOUT_MS);
36047
+ const problem = proofsWorkspaceProblem(root);
36048
+ const res = problem ? refused(problem) : run2(tc, proofsAbs, ["env", "lean", rel], opts.timeoutMs ?? DEFAULT_CHECK_TIMEOUT_MS);
36023
36049
  return toReport(res, root, modelFile, opts.timeoutMs ?? DEFAULT_CHECK_TIMEOUT_MS);
36024
36050
  }
36025
36051
  async function checkModelAsync(tc, root, modelFile, opts = {}) {
36026
36052
  const proofsAbs = (0, import_node_path43.join)(root, PROOFS_DIR);
36027
36053
  const rel = (0, import_node_path43.relative)(proofsAbs, modelFile);
36028
- const res = await runAsync(tc, proofsAbs, ["env", "lean", rel], opts.timeoutMs ?? DEFAULT_CHECK_TIMEOUT_MS);
36054
+ const problem = proofsWorkspaceProblem(root);
36055
+ const res = problem ? refused(problem) : await runAsync(tc, proofsAbs, ["env", "lean", rel], opts.timeoutMs ?? DEFAULT_CHECK_TIMEOUT_MS);
36029
36056
  return toReport(res, root, modelFile, opts.timeoutMs ?? DEFAULT_CHECK_TIMEOUT_MS);
36030
36057
  }
36031
36058
  function toReport(res, root, modelFile, timeoutMs) {
@@ -36845,6 +36872,8 @@ async function prepareFormalPhase(root, env = process.env, auth2, readSource, co
36845
36872
  const apiKey = direct ? env.OPENAI_API_KEY : void 0;
36846
36873
  const toolchain = findToolchain(env);
36847
36874
  if (!toolchain) return { ok: false, skip: "no-toolchain" };
36875
+ const untrusted = proofsWorkspaceProblem(root);
36876
+ if (untrusted) return { ok: false, skip: "workspace-untrusted", detail: untrusted.slice(0, 200) };
36848
36877
  try {
36849
36878
  scaffoldProofs(root);
36850
36879
  } catch (err2) {
@@ -39872,7 +39901,7 @@ function registerInitCommand(program2) {
39872
39901
  ...telemetryChoice ? { telemetry: telemetryChoice } : {},
39873
39902
  init: {
39874
39903
  completed_at: (/* @__PURE__ */ new Date()).toISOString(),
39875
- cli_version: true ? "0.34.0-experimental.421a631" : "dev"
39904
+ cli_version: true ? "0.34.0-experimental.675f6d2" : "dev"
39876
39905
  }
39877
39906
  });
39878
39907
  } catch (err2) {
@@ -41345,8 +41374,8 @@ function registerLeanCommand(program2) {
41345
41374
  }
41346
41375
 
41347
41376
  // src/cli.ts
41348
- program.name("verity").description("CLI for Verity quality gate service").version("0.34.0-experimental.421a631").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) => {
41349
- installStderrLog(actionCommand.name(), process.argv.slice(2), "0.34.0-experimental.421a631");
41377
+ program.name("verity").description("CLI for Verity quality gate service").version("0.34.0-experimental.675f6d2").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.675f6d2");
41350
41379
  setUserNamedServiceUrl(program.opts().serviceUrl);
41351
41380
  try {
41352
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.421a631",
3
+ "version": "0.34.0-experimental.675f6d2",
4
4
  "description": "CLI for Verity quality gate service",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "homepage": "https://verity.md",