viberails 0.5.1 → 0.5.2

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/dist/index.cjs CHANGED
@@ -361,11 +361,10 @@ function buildMenuOptions(state, packageCount) {
361
361
  hint: state.fileNamingValue
362
362
  });
363
363
  }
364
- options.push({
365
- value: "testCoverage",
366
- label: "Test coverage target",
367
- hint: state.testCoverage === 0 ? "0 (disabled)" : `${state.testCoverage}%`
368
- });
364
+ const isMonorepo = packageCount > 0;
365
+ const coverageLabel = isMonorepo ? "Default coverage target" : "Test coverage target";
366
+ const coverageHint = state.testCoverage === 0 ? "0 (disabled)" : isMonorepo ? `${state.testCoverage}% (per-package default)` : `${state.testCoverage}%`;
367
+ options.push({ value: "testCoverage", label: coverageLabel, hint: coverageHint });
369
368
  options.push({
370
369
  value: "enforceMissingTests",
371
370
  label: "Enforce missing tests",
@@ -375,16 +374,16 @@ function buildMenuOptions(state, packageCount) {
375
374
  options.push(
376
375
  {
377
376
  value: "coverageSummaryPath",
378
- label: "Coverage summary path",
377
+ label: isMonorepo ? "Default coverage summary path" : "Coverage summary path",
379
378
  hint: state.coverageSummaryPath
380
379
  },
381
380
  {
382
381
  value: "coverageCommand",
383
- label: "Coverage command",
382
+ label: isMonorepo ? "Default coverage command" : "Coverage command",
384
383
  hint: state.coverageCommand ?? "auto-detect from package.json test runner"
385
384
  }
386
385
  );
387
- if (packageCount > 0) {
386
+ if (isMonorepo) {
388
387
  options.push({
389
388
  value: "packageOverrides",
390
389
  label: "Per-package coverage overrides",
@@ -1676,6 +1675,56 @@ function displayRulesPreview(config) {
1676
1675
  );
1677
1676
  console.log("");
1678
1677
  }
1678
+ function displayInitSummary(config, exemptedPackages) {
1679
+ const root = config.packages.find((p) => p.path === ".") ?? config.packages[0];
1680
+ const isMonorepo = config.packages.length > 1;
1681
+ const ok = import_chalk4.default.green("\u2713");
1682
+ const off = import_chalk4.default.dim("\u25CB");
1683
+ console.log("");
1684
+ console.log(` ${import_chalk4.default.bold("Rules to apply:")}`);
1685
+ console.log(` ${ok} Max file size: ${import_chalk4.default.cyan(`${config.rules.maxFileLines} lines`)}`);
1686
+ if (config.rules.enforceNaming && root?.conventions?.fileNaming) {
1687
+ console.log(` ${ok} File naming: ${import_chalk4.default.cyan(root.conventions.fileNaming)}`);
1688
+ } else {
1689
+ console.log(` ${off} File naming: ${import_chalk4.default.dim("not enforced")}`);
1690
+ }
1691
+ if (config.rules.enforceMissingTests && root?.structure?.testPattern) {
1692
+ console.log(` ${ok} Missing tests: ${import_chalk4.default.cyan(`enforced (${root.structure.testPattern})`)}`);
1693
+ } else if (config.rules.enforceMissingTests) {
1694
+ console.log(` ${ok} Missing tests: ${import_chalk4.default.cyan("enforced")}`);
1695
+ } else {
1696
+ console.log(` ${off} Missing tests: ${import_chalk4.default.dim("not enforced")}`);
1697
+ }
1698
+ if (config.rules.testCoverage > 0) {
1699
+ if (isMonorepo) {
1700
+ const withCoverage = config.packages.filter(
1701
+ (p) => (p.rules?.testCoverage ?? config.rules.testCoverage) > 0
1702
+ );
1703
+ console.log(
1704
+ ` ${ok} Coverage: ${import_chalk4.default.cyan(`${config.rules.testCoverage}%`)} default ${import_chalk4.default.dim(`(${withCoverage.length}/${config.packages.length} packages)`)}`
1705
+ );
1706
+ } else {
1707
+ console.log(` ${ok} Coverage: ${import_chalk4.default.cyan(`${config.rules.testCoverage}%`)}`);
1708
+ }
1709
+ } else {
1710
+ console.log(` ${off} Coverage: ${import_chalk4.default.dim("disabled")}`);
1711
+ }
1712
+ if (exemptedPackages.length > 0) {
1713
+ console.log(
1714
+ ` ${import_chalk4.default.dim(" exempted:")} ${import_chalk4.default.dim(exemptedPackages.join(", "))} ${import_chalk4.default.dim("(types-only)")}`
1715
+ );
1716
+ }
1717
+ if (isMonorepo) {
1718
+ console.log(
1719
+ `
1720
+ ${import_chalk4.default.dim(`${config.packages.length} packages scanned \xB7 warns on violation \xB7 use --enforce in CI`)}`
1721
+ );
1722
+ } else {
1723
+ console.log(`
1724
+ ${import_chalk4.default.dim("warns on violation \xB7 use --enforce in CI to block")}`);
1725
+ }
1726
+ console.log("");
1727
+ }
1679
1728
 
1680
1729
  // src/display-text.ts
1681
1730
  function plainConfidenceLabel(convention) {
@@ -1716,10 +1765,13 @@ function formatConventionsText(scanResult) {
1716
1765
  }
1717
1766
  function formatRulesText(config) {
1718
1767
  const root = config.packages.find((p) => p.path === ".") ?? config.packages[0];
1768
+ const isMonorepo = config.packages.length > 1;
1719
1769
  const lines = [];
1720
1770
  lines.push(`Max file size: ${config.rules.maxFileLines} lines`);
1721
1771
  if (config.rules.testCoverage > 0) {
1722
- lines.push(`Test coverage target: ${config.rules.testCoverage}%`);
1772
+ const label = isMonorepo ? "Default coverage target" : "Test coverage target";
1773
+ const suffix = isMonorepo ? " (per-package)" : "";
1774
+ lines.push(`${label}: ${config.rules.testCoverage}%${suffix}`);
1723
1775
  } else {
1724
1776
  lines.push("Test coverage target: disabled");
1725
1777
  }
@@ -2967,11 +3019,8 @@ async function initInteractive(projectRoot, configPath, options) {
2967
3019
  );
2968
3020
  }
2969
3021
  clack8.note(formatScanResultsText(scanResult), "Scan results");
2970
- const rulesLines = formatRulesText(config);
2971
3022
  const exemptedPkgs = getExemptedPackages(config);
2972
- if (exemptedPkgs.length > 0)
2973
- rulesLines.push(`Auto-exempted from coverage: ${exemptedPkgs.join(", ")} (types-only)`);
2974
- clack8.note(rulesLines.join("\n"), "Rules");
3023
+ displayInitSummary(config, exemptedPkgs);
2975
3024
  const decision = await promptInitDecision();
2976
3025
  if (decision === "customize") {
2977
3026
  const rootPkg = config.packages.find((p) => p.path === ".") ?? config.packages[0];
@@ -3153,7 +3202,7 @@ ${import_chalk12.default.bold("Synced:")}`);
3153
3202
  }
3154
3203
 
3155
3204
  // src/index.ts
3156
- var VERSION = "0.5.1";
3205
+ var VERSION = "0.5.2";
3157
3206
  var program = new import_commander.Command();
3158
3207
  program.name("viberails").description("Guardrails for vibe coding").version(VERSION);
3159
3208
  program.command("init", { isDefault: true }).description("Scan your project and set up enforcement guardrails").option("-y, --yes", "Non-interactive mode (use defaults, high-confidence only)").option("-f, --force", "Re-initialize, replacing existing config").action(async (options) => {