@codacy/verity-cli 0.31.3 → 0.31.4

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
@@ -24,6 +24,16 @@ installs and updates it for you.
24
24
  plugin is present it owns the hooks, and the settings.json copy stands down.
25
25
  `verity init` detects the plugin and removes the duplicate wiring.
26
26
 
27
+ ### 🚪 A project that was never set up is left alone
28
+
29
+ Every hook now asks the same question the same way. `verity analyze` used to run
30
+ in a project that had never seen `verity init`, create `.verity/` there, and then —
31
+ with no baseline to compare against — review nothing. It now stands down like the
32
+ other hooks always have, so installing Verity no longer scatters state through
33
+ directories you merely opened. On the first session in such a project, Claude is
34
+ told once that the gate is off here and can offer `/verity:setup` (or `verity init`
35
+ on an npm install). Works correctly from linked git worktrees.
36
+
27
37
  ### ⚙️ Git-moment gating moved into the project
28
38
 
29
39
  `verity guard` now reads `.verity/config.json` instead of taking its moments from
package/bin/verity.js CHANGED
@@ -17849,6 +17849,9 @@ function createRun(opts, globals) {
17849
17849
  };
17850
17850
  }
17851
17851
 
17852
+ // src/commands/analyze/index.ts
17853
+ var import_node_fs38 = require("node:fs");
17854
+
17852
17855
  // src/lib/repo-context.ts
17853
17856
  var import_node_child_process7 = require("node:child_process");
17854
17857
  var import_node_os3 = require("node:os");
@@ -19534,7 +19537,7 @@ function channelSilence(input) {
19534
19537
  // src/lib/cli-version.ts
19535
19538
  function cliVersion() {
19536
19539
  try {
19537
- return true ? "0.31.3" : "dev";
19540
+ return true ? "0.31.4" : "dev";
19538
19541
  } catch {
19539
19542
  return "dev";
19540
19543
  }
@@ -22732,6 +22735,10 @@ function registerAnalyzeCommand(program2) {
22732
22735
  }
22733
22736
  var tracing = () => process.env.VERITY_TRACE_PHASES === "1";
22734
22737
  async function runAnalyze(opts, globals) {
22738
+ if (!verityConfigured()) {
22739
+ (0, import_node_fs38.writeSync)(2, '[verity] not set up in this project \u2014 run "verity init" first.\n');
22740
+ process.exit(0);
22741
+ }
22735
22742
  const run2 = createRun(opts, globals);
22736
22743
  installRunEvidence(run2);
22737
22744
  for (const [name, phase] of PIPELINE) {
@@ -22750,7 +22757,6 @@ async function runAnalyze(opts, globals) {
22750
22757
  }
22751
22758
 
22752
22759
  // src/commands/baseline.ts
22753
- var import_node_fs38 = require("node:fs");
22754
22760
  function registerBaselineCommands(program2) {
22755
22761
  const baseline = program2.command("baseline").description("Manage the task-start working-tree baseline");
22756
22762
  baseline.command("capture").description("Snapshot the working tree at task start (used by SessionStart hook)").option("--session-id <id>", "Session id (overrides any value from stdin)").option("--source <source>", "Lifecycle hint: startup|resume|clear|compact").action(async (opts) => {
@@ -22759,7 +22765,16 @@ function registerBaselineCommands(program2) {
22759
22765
  process.chdir(repoRoot());
22760
22766
  } catch {
22761
22767
  }
22762
- if (!(0, import_node_fs38.existsSync)(VERITY_DIR)) {
22768
+ if (!verityConfigured()) {
22769
+ const how = isPluginInvocation() ? "Offer to run /verity:setup for the user." : "Offer to run `verity init` (or /verity-setup) for the user.";
22770
+ process.stdout.write(
22771
+ JSON.stringify({
22772
+ hookSpecificOutput: {
22773
+ hookEventName: "SessionStart",
22774
+ additionalContext: `Verity is installed but this project is not set up yet, so the quality gate will not review anything here. ${how}`
22775
+ }
22776
+ }) + "\n"
22777
+ );
22763
22778
  process.exit(0);
22764
22779
  }
22765
22780
  let sessionId = opts.sessionId;
@@ -24678,6 +24693,61 @@ async function reconcileOwnWiring(moments) {
24678
24693
  printWarn(" Enable one: verity hooks install --moments stop");
24679
24694
  }
24680
24695
  }
24696
+ async function checkPrerequisites(step) {
24697
+ step("Checking prerequisites");
24698
+ const prereqs = await checkPrereqs({ install: true });
24699
+ for (const c of prereqs.checks) {
24700
+ if (c.status === "ok") {
24701
+ if (c.justInstalled) continue;
24702
+ printInfo(` ${c.label} ${c.detail} \u2713`);
24703
+ } else {
24704
+ printWarn(` ${c.label}: ${c.detail}`);
24705
+ if (c.remedy) printWarn(` ${c.remedy}`);
24706
+ }
24707
+ }
24708
+ if (prereqs.blocked) {
24709
+ printError("A required prerequisite is missing \u2014 cannot continue.");
24710
+ process.exit(1);
24711
+ }
24712
+ return prereqs.checks.some((c) => c.id === "claude" && c.status === "ok");
24713
+ }
24714
+ async function scaffoldProject(step, defaultsOnly) {
24715
+ step("Knowledge base, .gitignore and CLAUDE.md");
24716
+ await (0, import_promises14.mkdir)(VERITY_DIR, { recursive: true });
24717
+ await ensureMemoryDir();
24718
+ const ignoreResult = ensureVerityGitignore();
24719
+ if (ignoreResult === "failed") {
24720
+ printWarn(" .gitignore: could not write the Verity block \u2014 add it manually");
24721
+ printWarn(" (.verity/ holds copies of analyzed files, including any secret the gate flagged)");
24722
+ } else if (ignoreResult === "conflict") {
24723
+ printWarn(" .gitignore: the Verity block is in place but git still ignores .verity/standard.yaml");
24724
+ printWarn(" Something outside this file covers it \u2014 a global (~/.gitignore) or nested");
24725
+ printWarn(" .gitignore, or a pattern we do not recognise. Check: git check-ignore -v .verity/standard.yaml");
24726
+ printWarn(" Until it is fixed, the Standard and the knowledge graph cannot be committed.");
24727
+ } else if (ignoreResult === "repaired") {
24728
+ printInfo(" .gitignore: rewrote `.verity/` to `.verity/*` so the standard stays committable \u2713");
24729
+ } else {
24730
+ printInfo(` .gitignore: Verity block ${ignoreResult === "added" ? "added" : "already covered"} \u2713`);
24731
+ }
24732
+ const tracked = committedVerityState();
24733
+ if (tracked.length > 0) {
24734
+ printWarn(` ${tracked.length} Verity state file(s) are tracked in git (e.g. ${tracked[0]}).`);
24735
+ const untrack = defaultsOnly ? false : await promptYes(" Untrack them now (files stay on disk)? [Y/n] ", { nonInteractive: false });
24736
+ if (untrack) {
24737
+ const result = untrackVerityState();
24738
+ if (result === "untracked") printInfo(" Untracked (staged) \u2014 commit to finish \u2713");
24739
+ else if (result === "failed") printWarn(' Could not untrack \u2014 run "git rm -r --cached .verity" manually');
24740
+ } else {
24741
+ printWarn(" Left tracked. Fix with: git rm -r --cached .verity && git add .verity/standard.yaml .verity/memory");
24742
+ }
24743
+ }
24744
+ try {
24745
+ await ensureClaudeMdPointer();
24746
+ printInfo(" CLAUDE.md instructions \u2713");
24747
+ } catch (err) {
24748
+ printWarn(` Could not update CLAUDE.md: ${err.message}`);
24749
+ }
24750
+ }
24681
24751
  function registerInitCommand(program2) {
24682
24752
  program2.command("init").alias("setup").description("Set up Verity in the current project (asks the setup questions, then hands off to /verity-setup)").option("--force", "Reinstall the skills even when they are already up to date (hooks are always reconciled)").option("-y, --yes", "Take the recommended answer for every question (no prompts)").option("--no-setup", "Skip the /verity-setup handoff at the end").option(
24683
24753
  "--plugin-mode",
@@ -24719,22 +24789,7 @@ function registerInitCommand(program2) {
24719
24789
  }
24720
24790
  console.log("");
24721
24791
  }
24722
- step("Checking prerequisites");
24723
- const prereqs = await checkPrereqs({ install: true });
24724
- for (const c of prereqs.checks) {
24725
- if (c.status === "ok") {
24726
- if (c.justInstalled) continue;
24727
- printInfo(` ${c.label} ${c.detail} \u2713`);
24728
- } else {
24729
- printWarn(` ${c.label}: ${c.detail}`);
24730
- if (c.remedy) printWarn(` ${c.remedy}`);
24731
- }
24732
- }
24733
- if (prereqs.blocked) {
24734
- printError("A required prerequisite is missing \u2014 cannot continue.");
24735
- process.exit(1);
24736
- }
24737
- const claudeInstalled = prereqs.checks.some((c) => c.id === "claude" && c.status === "ok");
24792
+ const claudeInstalled = await checkPrerequisites(step);
24738
24793
  console.log("");
24739
24794
  if (pluginMode) {
24740
24795
  printInfo("Skipping skills \u2014 the Verity plugin provides them, namespaced as /verity:<name>.");
@@ -24748,41 +24803,7 @@ function registerInitCommand(program2) {
24748
24803
  if (defaultsOnly) {
24749
24804
  printInfo(` intensity: ${intensity} \xB7 moments: ${moments.join(", ") || "none"} (no questions asked)`);
24750
24805
  }
24751
- step("Knowledge base, .gitignore and CLAUDE.md");
24752
- await (0, import_promises14.mkdir)(VERITY_DIR, { recursive: true });
24753
- await ensureMemoryDir();
24754
- const ignoreResult = ensureVerityGitignore();
24755
- if (ignoreResult === "failed") {
24756
- printWarn(" .gitignore: could not write the Verity block \u2014 add it manually");
24757
- printWarn(" (.verity/ holds copies of analyzed files, including any secret the gate flagged)");
24758
- } else if (ignoreResult === "conflict") {
24759
- printWarn(" .gitignore: the Verity block is in place but git still ignores .verity/standard.yaml");
24760
- printWarn(" Something outside this file covers it \u2014 a global (~/.gitignore) or nested");
24761
- printWarn(" .gitignore, or a pattern we do not recognise. Check: git check-ignore -v .verity/standard.yaml");
24762
- printWarn(" Until it is fixed, the Standard and the knowledge graph cannot be committed.");
24763
- } else if (ignoreResult === "repaired") {
24764
- printInfo(" .gitignore: rewrote `.verity/` to `.verity/*` so the standard stays committable \u2713");
24765
- } else {
24766
- printInfo(` .gitignore: Verity block ${ignoreResult === "added" ? "added" : "already covered"} \u2713`);
24767
- }
24768
- const tracked = committedVerityState();
24769
- if (tracked.length > 0) {
24770
- printWarn(` ${tracked.length} Verity state file(s) are tracked in git (e.g. ${tracked[0]}).`);
24771
- const untrack = defaultsOnly ? false : await promptYes(" Untrack them now (files stay on disk)? [Y/n] ", { nonInteractive: false });
24772
- if (untrack) {
24773
- const result = untrackVerityState();
24774
- if (result === "untracked") printInfo(" Untracked (staged) \u2014 commit to finish \u2713");
24775
- else if (result === "failed") printWarn(' Could not untrack \u2014 run "git rm -r --cached .verity" manually');
24776
- } else {
24777
- printWarn(" Left tracked. Fix with: git rm -r --cached .verity && git add .verity/standard.yaml .verity/memory");
24778
- }
24779
- }
24780
- try {
24781
- await ensureClaudeMdPointer();
24782
- printInfo(" CLAUDE.md instructions \u2713");
24783
- } catch (err) {
24784
- printWarn(` Could not update CLAUDE.md: ${err.message}`);
24785
- }
24806
+ await scaffoldProject(step, defaultsOnly);
24786
24807
  const globalVerityDir = (0, import_node_path29.join)(process.env.HOME ?? "", ".verity");
24787
24808
  await (0, import_promises14.mkdir)(globalVerityDir, { recursive: true });
24788
24809
  console.log("");
@@ -24844,7 +24865,7 @@ function registerInitCommand(program2) {
24844
24865
  ...telemetryChoice ? { telemetry: telemetryChoice } : {},
24845
24866
  init: {
24846
24867
  completed_at: (/* @__PURE__ */ new Date()).toISOString(),
24847
- cli_version: true ? "0.31.3" : "dev"
24868
+ cli_version: true ? "0.31.4" : "dev"
24848
24869
  }
24849
24870
  });
24850
24871
  } catch (err) {
@@ -25513,8 +25534,8 @@ function registerTelemetryCommands(program2) {
25513
25534
  }
25514
25535
 
25515
25536
  // src/cli.ts
25516
- program.name("verity").description("CLI for Verity quality gate service").version("0.31.3").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) => {
25517
- installStderrLog(actionCommand.name(), process.argv.slice(2), "0.31.3");
25537
+ program.name("verity").description("CLI for Verity quality gate service").version("0.31.4").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) => {
25538
+ installStderrLog(actionCommand.name(), process.argv.slice(2), "0.31.4");
25518
25539
  setUserNamedServiceUrl(program.opts().serviceUrl);
25519
25540
  try {
25520
25541
  await foldLegacyLocalCredential();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codacy/verity-cli",
3
- "version": "0.31.3",
3
+ "version": "0.31.4",
4
4
  "description": "CLI for Verity quality gate service",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "homepage": "https://verity.md",