@lexq/cli 0.1.47 → 0.1.49

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/dist/index.js +13 -8
  2. package/package.json +2 -1
package/dist/index.js CHANGED
@@ -2055,10 +2055,10 @@ function registerAnalyticsCommands(program) {
2055
2055
  `
2056
2056
  \u2500\u2500 Metric: ${data.metricSummary.targetVariable} (${data.metricSummary.aggregationType}) \u2500\u2500`
2057
2057
  );
2058
- console.log(`Baseline: ${data.metricSummary.baselineValue.toLocaleString()}`);
2059
- console.log(`Simulated: ${data.metricSummary.simulatedValue.toLocaleString()}`);
2058
+ console.log(`Baseline: ${String(data.metricSummary.baselineValue)}`);
2059
+ console.log(`Simulated: ${String(data.metricSummary.simulatedValue)}`);
2060
2060
  console.log(
2061
- `Delta: ${data.metricSummary.delta > 0 ? "+" : ""}${data.metricSummary.delta.toLocaleString()}`
2061
+ `Delta: ${signPrefix(data.metricSummary.delta)}${String(data.metricSummary.delta)}`
2062
2062
  );
2063
2063
  console.log(
2064
2064
  `Change: ${data.metricSummary.deltaPercentage > 0 ? "+" : ""}${data.metricSummary.deltaPercentage.toFixed(1)}%`
@@ -2075,7 +2075,7 @@ function registerAnalyticsCommands(program) {
2075
2075
  `Rate \u0394: ${diff.matchedRateDelta > 0 ? "+" : ""}${diff.matchedRateDelta.toFixed(1)}%`
2076
2076
  );
2077
2077
  console.log(
2078
- `Metric \u0394: ${diff.metricValueDelta > 0 ? "+" : ""}${diff.metricValueDelta.toLocaleString()}`
2078
+ `Metric \u0394: ${signPrefix(diff.metricValueDelta)}${String(diff.metricValueDelta)}`
2079
2079
  );
2080
2080
  }
2081
2081
  if (data.ruleStats?.length) {
@@ -2083,11 +2083,10 @@ function registerAnalyticsCommands(program) {
2083
2083
  printTable(
2084
2084
  ["Rule", "Matched", "Metric"],
2085
2085
  data.ruleStats.map((r) => [
2086
- r.ruleName,
2086
+ r.ruleName.length > 30 ? r.ruleName.substring(0, 30) + "\u2026" : r.ruleName,
2087
2087
  r.matchedCount.toLocaleString(),
2088
- r.metricValue.toLocaleString()
2089
- ]),
2090
- { truncate: 30 }
2088
+ String(r.metricValue)
2089
+ ])
2091
2090
  );
2092
2091
  }
2093
2092
  } else {
@@ -2318,6 +2317,12 @@ ${data.totalElements} total \xB7 page ${data.pageNo + 1}/${data.totalPages}`);
2318
2317
  }
2319
2318
  });
2320
2319
  }
2320
+ function signPrefix(value) {
2321
+ const text = String(value);
2322
+ if (text.startsWith("-")) return "";
2323
+ const significand = text.split(/[eE]/)[0] ?? "";
2324
+ return /[1-9]/.test(significand) ? "+" : "";
2325
+ }
2321
2326
  function resolveBody(opts) {
2322
2327
  if (opts.file) {
2323
2328
  const raw = readFileSync2(opts.file, "utf-8");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lexq/cli",
3
- "version": "0.1.47",
3
+ "version": "0.1.49",
4
4
  "description": "LexQ CLI — manage policies, simulate rules, and deploy from the terminal. Built for humans and AI agents.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -30,6 +30,7 @@
30
30
  "enums": "node scripts/gen-enums.mjs",
31
31
  "enums:check": "node scripts/gen-enums.mjs --check",
32
32
  "start": "node dist/index.js",
33
+ "test:decimals": "pnpm build && node tests/exact-decimals.mjs",
33
34
  "prepublishOnly": "pnpm build",
34
35
  "knip": "knip",
35
36
  "format": "prettier --write \"src/**/*.ts\"",