@lexq/cli 0.1.5 → 0.1.6

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.js CHANGED
@@ -1315,6 +1315,7 @@ function registerAnalyticsCommands(program) {
1315
1315
  sim.command("status").description("Get simulation status and results").requiredOption("--id <simulationId>", "Simulation ID").action(async (opts) => {
1316
1316
  try {
1317
1317
  const globalOpts = program.opts();
1318
+ const format = globalOpts.format ?? "json";
1318
1319
  const data = await apiRequest(
1319
1320
  "GET",
1320
1321
  `analytics/simulations/${opts.id}`,
@@ -1325,7 +1326,48 @@ function registerAnalyticsCommands(program) {
1325
1326
  verbose: globalOpts.verbose
1326
1327
  }
1327
1328
  );
1328
- printJson(data);
1329
+ if (format === "table") {
1330
+ console.log(`Status: ${data.status}`);
1331
+ console.log(`Progress: ${data.progress}%`);
1332
+ if (data.summary) {
1333
+ console.log(`
1334
+ \u2500\u2500 Summary \u2500\u2500`);
1335
+ console.log(`Records: ${data.summary.totalRecords.toLocaleString()}`);
1336
+ console.log(`Matched: ${data.summary.matchedRecords.toLocaleString()}`);
1337
+ console.log(`Match Rate: ${data.summary.matchRate.toFixed(1)}%`);
1338
+ console.log(`Time: ${data.summary.executionTimeMs.toLocaleString()}ms`);
1339
+ }
1340
+ if (data.metricSummary) {
1341
+ console.log(`
1342
+ \u2500\u2500 Metric: ${data.metricSummary.targetVariable} (${data.metricSummary.aggregationType}) \u2500\u2500`);
1343
+ console.log(`Baseline: ${data.metricSummary.baselineValue.toLocaleString()}`);
1344
+ console.log(`Simulated: ${data.metricSummary.simulatedValue.toLocaleString()}`);
1345
+ console.log(`Delta: ${data.metricSummary.delta > 0 ? "+" : ""}${data.metricSummary.delta.toLocaleString()}`);
1346
+ console.log(`Change: ${data.metricSummary.deltaPercentage > 0 ? "+" : ""}${data.metricSummary.deltaPercentage.toFixed(1)}%`);
1347
+ }
1348
+ if (data.policyImpact?.comparison) {
1349
+ const diff = data.policyImpact.comparison.difference;
1350
+ console.log(`
1351
+ \u2500\u2500 Impact \u2500\u2500`);
1352
+ console.log(`Matched \u0394: ${diff.matchedCountDelta > 0 ? "+" : ""}${diff.matchedCountDelta}`);
1353
+ console.log(`Rate \u0394: ${diff.matchedRateDelta > 0 ? "+" : ""}${diff.matchedRateDelta.toFixed(1)}%`);
1354
+ console.log(`Metric \u0394: ${diff.metricValueDelta > 0 ? "+" : ""}${diff.metricValueDelta.toLocaleString()}`);
1355
+ }
1356
+ if (data.ruleStats?.length) {
1357
+ console.log("");
1358
+ printTable(
1359
+ ["Rule", "Matched", "Metric"],
1360
+ data.ruleStats.map((r) => [
1361
+ r.ruleName,
1362
+ r.matchedCount.toLocaleString(),
1363
+ r.metricValue.toLocaleString()
1364
+ ]),
1365
+ { truncate: 30 }
1366
+ );
1367
+ }
1368
+ } else {
1369
+ printJson(data);
1370
+ }
1329
1371
  } catch (error) {
1330
1372
  printError(error);
1331
1373
  process.exit(1);
@@ -1361,7 +1403,7 @@ function registerAnalyticsCommands(program) {
1361
1403
  s.policyGroupName,
1362
1404
  s.targetVersionName ?? "\u2013",
1363
1405
  s.status,
1364
- `${(s.matchRate * 100).toFixed(1)}%`,
1406
+ `${s.matchRate.toFixed(1)}%`,
1365
1407
  String(s.totalRecords),
1366
1408
  s.createdAt.substring(0, 16)
1367
1409
  ]),