@codacy/verity-cli 0.35.1 → 0.35.3-experimental.f980d82

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/CHANGELOG.md CHANGED
@@ -64,6 +64,23 @@ installs are untouched.
64
64
  which is the ordinary case for someone whose first Verity install *is* the
65
65
  plugin.
66
66
 
67
+ ## [0.35.2] — 2026-10-30
68
+
69
+ ### 🔧 Fixes
70
+
71
+ - **`verity init --standard new` works when `.verity/standard.yaml` already
72
+ exists.** Init sets your file aside (a copy goes to
73
+ `.verity/standard.<time>.yaml`) and builds a new Standard with review packs
74
+ and, if you send the repository profile, project rules. Before, init kept
75
+ the old file and ignored the flag.
76
+ - **A kept Standard that does not use review packs says how to move it:**
77
+ `verity standard push` keeps your rules, and `verity init --standard new`
78
+ starts over.
79
+ - **A copy of your Standard never replaces an earlier copy.** `verity init
80
+ --standard new` and `verity standard pull` create the copy as a new file.
81
+ If a copy with the same time exists, the new copy gets the next name
82
+ (`standard.<time>-1.yaml`).
83
+
67
84
  ## [0.35.1] — 2026-10-30
68
85
 
69
86
  ### 📐 Standards
package/bin/verity.js CHANGED
@@ -14733,7 +14733,7 @@ var SECURITY_PATTERNS = [
14733
14733
  /(^|\/)gradle\.lockfile$/
14734
14734
  ];
14735
14735
  var PROD_SERVICE_URL = "https://ofcamwrjwrkazqvdchko.supabase.co/functions/v1";
14736
- var DEFAULT_SERVICE_URL = "".length > 0 ? "" : PROD_SERVICE_URL;
14736
+ var DEFAULT_SERVICE_URL = "https://wukeddyzpijoegyajtnc.supabase.co/functions/v1".length > 0 ? "https://wukeddyzpijoegyajtnc.supabase.co/functions/v1" : PROD_SERVICE_URL;
14737
14737
  var GITHUB_CLIENT_ID = "Iv23li88HxAi3ZrbYzWh";
14738
14738
  var GITHUB_DEVICE_CODE_URL = "https://github.com/login/device/code";
14739
14739
  var GITHUB_ACCESS_TOKEN_URL = "https://github.com/login/oauth/access_token";
@@ -15325,7 +15325,7 @@ function pinRefusalMessage(verdict, targetUrl) {
15325
15325
  // src/lib/cli-version.ts
15326
15326
  function cliVersion() {
15327
15327
  try {
15328
- return true ? "0.35.1" : "dev";
15328
+ return true ? "0.35.3-experimental.f980d82" : "dev";
15329
15329
  } catch {
15330
15330
  return "dev";
15331
15331
  }
@@ -16683,12 +16683,14 @@ function removeIfOurs(fd, path) {
16683
16683
  } catch {
16684
16684
  }
16685
16685
  }
16686
- function openTarget(path, append2) {
16686
+ function openTarget(path, append2, createOnly = false) {
16687
16687
  const base = import_node_fs7.constants.O_WRONLY | (append2 ? import_node_fs7.constants.O_APPEND : 0) | O_NOFOLLOW;
16688
- try {
16689
- return { fd: (0, import_node_fs7.openSync)(path, base), created: false };
16690
- } catch (e) {
16691
- if (e.code !== "ENOENT") return null;
16688
+ if (!createOnly) {
16689
+ try {
16690
+ return { fd: (0, import_node_fs7.openSync)(path, base), created: false };
16691
+ } catch (e) {
16692
+ if (e.code !== "ENOENT") return null;
16693
+ }
16692
16694
  }
16693
16695
  try {
16694
16696
  return { fd: (0, import_node_fs7.openSync)(path, base | import_node_fs7.constants.O_CREAT | import_node_fs7.constants.O_EXCL, 384), created: true };
@@ -16696,13 +16698,13 @@ function openTarget(path, append2) {
16696
16698
  return null;
16697
16699
  }
16698
16700
  }
16699
- function writeVerified(root, name2, hooks, append2, write) {
16701
+ function writeVerified(root, name2, hooks, append2, write, createOnly = false) {
16700
16702
  const r = validateRoot(root);
16701
16703
  if (!r || !bareName(name2)) return false;
16702
16704
  const path = (0, import_node_path7.join)(r.real, name2);
16703
16705
  if (!absentOrRegular(path)) return false;
16704
16706
  if (!runHook(hooks)) return false;
16705
- const opened = openTarget(path, append2);
16707
+ const opened = openTarget(path, append2, createOnly);
16706
16708
  if (!opened) return false;
16707
16709
  try {
16708
16710
  if (!verifyOpened(opened.fd, path, r)) {
@@ -16739,6 +16741,11 @@ function replaceInRoot(root, name2, text3, hooks = {}) {
16739
16741
  (0, import_node_fs7.writeSync)(fd, text3, 0);
16740
16742
  });
16741
16743
  }
16744
+ function createInRoot(root, name2, text3, hooks = {}) {
16745
+ return writeVerified(root, name2, hooks, false, (fd) => {
16746
+ (0, import_node_fs7.writeSync)(fd, text3, 0);
16747
+ }, true);
16748
+ }
16742
16749
 
16743
16750
  // src/lib/repo-file.ts
16744
16751
  var DEFAULT_MAX_BYTES = 512 * 1024;
@@ -16748,6 +16755,16 @@ function writeRepoFile(relative9, body2) {
16748
16755
  throw new Error(`refused to write ${relative9}: it, or its folder, is a link or not a regular file`);
16749
16756
  }
16750
16757
  }
16758
+ var COPY_NAMES = 10;
16759
+ function keepStandardCopy(body2, now = /* @__PURE__ */ new Date()) {
16760
+ const stamp2 = now.toISOString().replace(/[:.]/g, "-");
16761
+ for (let n2 = 0; n2 < COPY_NAMES; n2++) {
16762
+ const relative9 = `${VERITY_DIR}/standard.${stamp2}${n2 === 0 ? "" : `-${n2}`}.yaml`;
16763
+ const path = projectPath(relative9);
16764
+ if (createInRoot((0, import_node_path8.dirname)(path), (0, import_node_path8.basename)(path), body2)) return relative9;
16765
+ }
16766
+ throw new Error(`refused to create ${VERITY_DIR}/standard.${stamp2}.yaml: ${VERITY_DIR} is a link or not a folder, or ${COPY_NAMES} copies with that time exist`);
16767
+ }
16751
16768
  function readRepoFile(relative9, maxBytes = DEFAULT_MAX_BYTES) {
16752
16769
  const root = repoRoot();
16753
16770
  if (throughLinkedFolder(root, relative9)) return null;
@@ -25786,9 +25803,8 @@ async function pullStandard(globals, opts = {}) {
25786
25803
  if (local && typeof local === "object" && !Array.isArray(local) && sameStandard(local, remote.standard.content)) {
25787
25804
  return { status: "same", version };
25788
25805
  }
25789
- backup = `.verity/standard.${(/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-")}.yaml`;
25790
25806
  try {
25791
- writeRepoFile(backup, raw);
25807
+ backup = keepStandardCopy(raw);
25792
25808
  } catch (err2) {
25793
25809
  return { status: "failed", message: `Could not keep a copy of ${STANDARD_FILE} (${terminalText(err2 instanceof Error ? err2.message : String(err2), 200)}), so it was not replaced. Nothing changed.` };
25794
25810
  }
@@ -43538,6 +43554,16 @@ function sayAdopted(ui, team) {
43538
43554
  }
43539
43555
 
43540
43556
  // src/commands/init/standard.ts
43557
+ function usesReviewPacks() {
43558
+ const raw = readRepoFile(STANDARD_FILE);
43559
+ if (raw === null) return true;
43560
+ try {
43561
+ const content = (0, import_yaml10.parse)(raw);
43562
+ return Array.isArray(content?.extends);
43563
+ } catch {
43564
+ return true;
43565
+ }
43566
+ }
43541
43567
  function hasProjectRules() {
43542
43568
  const raw = readRepoFile(STANDARD_FILE);
43543
43569
  if (raw === null) return true;
@@ -43602,7 +43628,7 @@ function localStandardProblem() {
43602
43628
  if (!valid.ok) return `${STANDARD_FILE} is not a Standard the service accepts: ${terminalText(valid.error, 200)}`;
43603
43629
  return null;
43604
43630
  }
43605
- function removeDerivedStandard() {
43631
+ function removeLocalStandard() {
43606
43632
  const path = projectPath(STANDARD_FILE);
43607
43633
  try {
43608
43634
  const folder = (0, import_node_fs77.lstatSync)((0, import_node_path66.dirname)(path));
@@ -43611,6 +43637,19 @@ function removeDerivedStandard() {
43611
43637
  } catch {
43612
43638
  }
43613
43639
  }
43640
+ function setLocalStandardAside(now = /* @__PURE__ */ new Date(), remove = removeLocalStandard) {
43641
+ const raw = readRepoFile(STANDARD_FILE);
43642
+ if (raw === null) return { ok: false, message: `${STANDARD_FILE} is a link, not a regular file, or larger than 512 KB, so it was not set aside.` };
43643
+ let path;
43644
+ try {
43645
+ path = keepStandardCopy(raw, now);
43646
+ } catch (err2) {
43647
+ return { ok: false, message: `Could not keep a copy of ${STANDARD_FILE} (${terminalText(err2 instanceof Error ? err2.message : String(err2), 200)}), so it was not set aside.` };
43648
+ }
43649
+ remove();
43650
+ if ((0, import_node_fs77.existsSync)(projectPath(STANDARD_FILE))) return { ok: false, message: `Could not remove ${STANDARD_FILE} after copying it to ${path}.` };
43651
+ return { ok: true, path };
43652
+ }
43614
43653
  async function standardStep(ui, ctx) {
43615
43654
  const { rail } = ui;
43616
43655
  const s = ui.screen.s;
@@ -43639,7 +43678,7 @@ async function standardStep(ui, ctx) {
43639
43678
  sayAdopted(ui, again);
43640
43679
  return end({ source: "adopted", version: again.version, profile: profile2 });
43641
43680
  }
43642
- removeDerivedStandard();
43681
+ removeLocalStandard();
43643
43682
  if (again.status === "write-failed" || again.status === "unavailable") rail.line(terminalText(again.reason, 300));
43644
43683
  return { ...leaveTeamStandard(again.status === "write-failed" ? "write-failed" : "unavailable", null), profile: profile2 };
43645
43684
  };
@@ -43670,12 +43709,25 @@ async function standardStep(ui, ctx) {
43670
43709
  rail.line(team2.status === "none" ? `There is no Standard on the service either, so reviews have no rules. Fix ${STANDARD_FILE}, or delete it, then run verity init again.` : team2.status === "unavailable" ? `The Verity service did not answer (${terminalText(team2.reason, 200)}), so no Standard is confirmed. Fix ${STANDARD_FILE}, then run verity init again.` : `No Standard on the service was looked up. Fix ${STANDARD_FILE}, or sign in, then run verity init again.`);
43671
43710
  return end({ source: "none", version: null, profile: notAsked });
43672
43711
  };
43712
+ if (ctx.standard === "new" && (0, import_node_fs77.lstatSync)(projectPath(STANDARD_FILE), { throwIfNoEntry: false })) {
43713
+ const aside = setLocalStandardAside();
43714
+ if (!aside.ok) {
43715
+ rail.warn("Could not set your Standard aside for a new one");
43716
+ rail.line(terminalText(aside.message, 300));
43717
+ rail.line("Your Standard is as it was. Fix the cause, or move the file yourself, then run verity init --standard new again.");
43718
+ return end({ source: "none", version: null, profile: notAsked });
43719
+ }
43720
+ rail.done(`Set your Standard aside ${s.gray}\xB7 a copy is in ${aside.path}${s.reset}`);
43721
+ }
43673
43722
  if ((0, import_node_fs77.existsSync)(projectPath(STANDARD_FILE))) {
43674
43723
  const problem = localStandardProblem();
43675
43724
  if (problem !== null) return unusableHere(problem);
43676
43725
  const sync = await pushLocalStandardIfMissing(ctx.globals);
43677
43726
  rail.done("Kept your Standard");
43678
43727
  rail.line(`${STANDARD_FILE} is already here, so this run leaves it as it is. Edit it there, then share the change: verity standard push`);
43728
+ if (!usesReviewPacks()) {
43729
+ rail.line("It does not use review packs. To move it to packs and keep your rules: verity standard push. To build a new one: verity init --standard new", "muted");
43730
+ }
43679
43731
  if (sync.status === "pushed") {
43680
43732
  rail.line(sync.version !== null ? `It was only on this machine. It is shared now as v${sync.version}.` : "It is only on this machine:", sync.version !== null ? "muted" : "warn");
43681
43733
  for (const line2 of sync.lines) if (!line2.startsWith("Standard pushed")) rail.line(terminalText(line2, 600), "warn");
@@ -44360,7 +44412,7 @@ async function recordAnswers(ui, momentIds, telemetry, completed) {
44360
44412
  moments: momentIds,
44361
44413
  ...telemetry ? { telemetry } : {},
44362
44414
  // A failed run also clears an earlier stamp: "done" describes this checkout now.
44363
- init: completed ? { completed_at: (/* @__PURE__ */ new Date()).toISOString(), cli_version: true ? "0.35.1" : "dev" } : void 0
44415
+ init: completed ? { completed_at: (/* @__PURE__ */ new Date()).toISOString(), cli_version: true ? "0.35.3-experimental.f980d82" : "dev" } : void 0
44364
44416
  });
44365
44417
  } catch (err2) {
44366
44418
  ui.rail.line(`Could not record the setup answers: ${terminalText(err2.message, 200)}`, "warn");
@@ -46283,10 +46335,10 @@ function registerLeanCommand(program2) {
46283
46335
  }
46284
46336
 
46285
46337
  // src/cli.ts
46286
- program.name("verity").description("CLI for Verity quality gate service").version("0.35.1").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) => {
46338
+ program.name("verity").description("CLI for Verity quality gate service").version("0.35.3-experimental.f980d82").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) => {
46287
46339
  const isTelemetryHelper = actionCommand.name() === "headers" && actionCommand.parent?.name() === "telemetry";
46288
46340
  if (!isTelemetryHelper) {
46289
- installStderrLog(actionCommand.name(), process.argv.slice(2), "0.35.1");
46341
+ installStderrLog(actionCommand.name(), process.argv.slice(2), "0.35.3-experimental.f980d82");
46290
46342
  }
46291
46343
  setUserNamedServiceUrl(program.opts().serviceUrl);
46292
46344
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codacy/verity-cli",
3
- "version": "0.35.1",
3
+ "version": "0.35.3-experimental.f980d82",
4
4
  "description": "CLI for Verity quality gate service",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "homepage": "https://verity.md",