@kb-labs/quality-entry 2.109.0 → 2.111.0

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 (51) hide show
  1. package/dist/cli/commands/build-order.d.ts +1 -3
  2. package/dist/cli/commands/build-order.js +4 -4
  3. package/dist/cli/commands/build-order.js.map +1 -1
  4. package/dist/cli/commands/check-builds.js +2 -5
  5. package/dist/cli/commands/check-builds.js.map +1 -1
  6. package/dist/cli/commands/check-layers.d.ts +1 -3
  7. package/dist/cli/commands/check-layers.js +3 -3
  8. package/dist/cli/commands/check-layers.js.map +1 -1
  9. package/dist/cli/commands/check-tests.js +2 -6
  10. package/dist/cli/commands/check-tests.js.map +1 -1
  11. package/dist/cli/commands/check-types.js +2 -6
  12. package/dist/cli/commands/check-types.js.map +1 -1
  13. package/dist/cli/commands/context.d.ts +1 -3
  14. package/dist/cli/commands/context.js +5 -5
  15. package/dist/cli/commands/context.js.map +1 -1
  16. package/dist/cli/commands/coupling.d.ts +1 -3
  17. package/dist/cli/commands/coupling.js +2 -2
  18. package/dist/cli/commands/coupling.js.map +1 -1
  19. package/dist/cli/commands/cycles.d.ts +3 -1
  20. package/dist/cli/commands/cycles.js +1 -4
  21. package/dist/cli/commands/cycles.js.map +1 -1
  22. package/dist/cli/commands/dead-code.d.ts +1 -3
  23. package/dist/cli/commands/dead-code.js +4 -4
  24. package/dist/cli/commands/dead-code.js.map +1 -1
  25. package/dist/cli/commands/fix-deps.js +3 -3
  26. package/dist/cli/commands/fix-deps.js.map +1 -1
  27. package/dist/cli/commands/gate.d.ts +1 -3
  28. package/dist/cli/commands/gate.js +3 -3
  29. package/dist/cli/commands/gate.js.map +1 -1
  30. package/dist/cli/commands/health.d.ts +1 -3
  31. package/dist/cli/commands/health.js +2 -2
  32. package/dist/cli/commands/health.js.map +1 -1
  33. package/dist/cli/commands/history.d.ts +1 -3
  34. package/dist/cli/commands/history.js +3 -3
  35. package/dist/cli/commands/history.js.map +1 -1
  36. package/dist/cli/commands/index.d.ts +1 -0
  37. package/dist/cli/commands/index.js +32 -46
  38. package/dist/cli/commands/index.js.map +1 -1
  39. package/dist/cli/commands/snapshot.d.ts +1 -3
  40. package/dist/cli/commands/snapshot.js +1 -1
  41. package/dist/cli/commands/snapshot.js.map +1 -1
  42. package/dist/cli/commands/stats.d.ts +1 -3
  43. package/dist/cli/commands/stats.js +2 -2
  44. package/dist/cli/commands/stats.js.map +1 -1
  45. package/dist/cli/commands/visualize.d.ts +4 -9
  46. package/dist/cli/commands/visualize.js +1 -1
  47. package/dist/cli/commands/visualize.js.map +1 -1
  48. package/dist/widgets/mf-manifest.json +12 -12
  49. package/dist/widgets/mf-stats.json +16 -16
  50. package/dist/widgets/remoteEntry.js +2 -2
  51. package/package.json +4 -4
@@ -34,11 +34,11 @@ var build_order_default = defineCommand({
34
34
  }))
35
35
  });
36
36
  }
37
- return { exitCode: 1 };
37
+ return { ok: false, error: "Command failed" };
38
38
  }
39
39
  if (flags.json) {
40
40
  ctx.ui?.json?.(result);
41
- return { exitCode: 0 };
41
+ return { ok: true };
42
42
  }
43
43
  if (flags.script) {
44
44
  for (let i = 0; i < result.layers.length; i++) {
@@ -46,7 +46,7 @@ var build_order_default = defineCommand({
46
46
  if (!layer) continue;
47
47
  ctx.ui?.success?.(`# Layer ${i + 1}`, { sections: [{ header: "", items: layer.map((p) => `pnpm --filter "${p}" run build`) }] });
48
48
  }
49
- return { exitCode: 0 };
49
+ return { ok: true };
50
50
  }
51
51
  const sections = flags.layers ? result.layers.map((layer, i) => ({
52
52
  header: `Layer ${i + 1} \u2014 ${layer.length} package(s) (parallel)`,
@@ -57,7 +57,7 @@ var build_order_default = defineCommand({
57
57
  items: [`${result.packageCount} packages in ${result.layerCount} layers`]
58
58
  });
59
59
  ctx.ui?.success?.(flags.package ? `Build order for ${flags.package}` : "Monorepo build order", { sections });
60
- return { exitCode: 0 };
60
+ return { ok: true };
61
61
  }
62
62
  }
63
63
  });
@@ -73,7 +73,7 @@ var check_builds_default = defineCommand({
73
73
  const cached = await platform.cache.get(cacheKey);
74
74
  if (cached) {
75
75
  outputBuildCheck({ ...cached, cached: true }, flags, ui);
76
- return { exitCode: cached.failing > 0 ? 1 : 0, result: cached };
76
+ return cached.failing > 0 ? { ok: false, error: "Build failures found", result: cached } : { ok: true, result: cached };
77
77
  }
78
78
  }
79
79
  const result = await checkBuilds(ctx.cwd, {
@@ -90,10 +90,7 @@ var check_builds_default = defineCommand({
90
90
  packageSpecific: !!flags.package
91
91
  });
92
92
  outputBuildCheck({ ...result, cached: false }, flags, ui);
93
- return {
94
- exitCode: result.failing > 0 ? 1 : 0,
95
- result
96
- };
93
+ return result.failing > 0 ? { ok: false, error: "Build failures found", result } : { ok: true, result };
97
94
  }
98
95
  }
99
96
  });
@@ -157,7 +154,7 @@ var check_tests_default = defineCommand({
157
154
  const cached = await platform.cache.get(cacheKey);
158
155
  if (cached) {
159
156
  outputTestResults({ ...cached, cached: true }, flags, ui);
160
- return { exitCode: cached.failing > 0 ? 1 : 0, result: cached };
157
+ return cached.failing > 0 ? { ok: false, error: "Test failures found", result: cached } : { ok: true, result: cached };
161
158
  }
162
159
  }
163
160
  const result = await runTests(ctx.cwd, {
@@ -176,11 +173,7 @@ var check_tests_default = defineCommand({
176
173
  cached: false
177
174
  });
178
175
  outputTestResults({ ...result, cached: false }, flags, ui);
179
- return {
180
- exitCode: result.failing > 0 ? 1 : 0,
181
- result,
182
- meta: { cached: false }
183
- };
176
+ return result.failing > 0 ? { ok: false, error: "Test failures found", result, meta: { cached: false } } : { ok: true, result, meta: { cached: false } };
184
177
  }
185
178
  }
186
179
  });
@@ -262,7 +255,7 @@ var check_types_default = defineCommand({
262
255
  const cached = await platform.cache.get(cacheKey);
263
256
  if (cached) {
264
257
  outputTypeAnalysis({ ...cached, cached: true }, flags, ui);
265
- return { exitCode: cached.totalErrors > 0 ? 1 : 0, result: cached };
258
+ return cached.totalErrors > 0 ? { ok: false, error: "Type errors found", result: cached } : { ok: true, result: cached };
266
259
  }
267
260
  }
268
261
  const result = await analyzeTypes(ctx.cwd, {
@@ -278,11 +271,7 @@ var check_types_default = defineCommand({
278
271
  cached: false
279
272
  });
280
273
  outputTypeAnalysis({ ...result, cached: false }, flags, ui);
281
- return {
282
- exitCode: result.totalErrors > 0 ? 1 : 0,
283
- result,
284
- meta: { cached: false }
285
- };
274
+ return result.totalErrors > 0 ? { ok: false, error: "Type errors found", result, meta: { cached: false } } : { ok: true, result, meta: { cached: false } };
286
275
  }
287
276
  }
288
277
  });
@@ -368,11 +357,11 @@ var check_layers_default = defineCommand({
368
357
  } : report;
369
358
  if (flags.json) {
370
359
  ctx.ui?.json?.(filtered);
371
- return { exitCode: filtered.totalViolations > 0 ? 1 : 0 };
360
+ return filtered.totalViolations > 0 ? { ok: false, error: "Layer violations found", result: filtered } : { ok: true, result: filtered };
372
361
  }
373
362
  if (filtered.totalViolations === 0) {
374
363
  ctx.ui?.success?.("No layering violations found");
375
- return { exitCode: 0 };
364
+ return { ok: true };
376
365
  }
377
366
  const byPackage = /* @__PURE__ */ new Map();
378
367
  for (const v of filtered.violations) {
@@ -385,7 +374,7 @@ var check_layers_default = defineCommand({
385
374
  items: vs.map((v) => `\u2192 ${v.toPackage} (Layer ${v.toLayer}) ${v.importSpecifier}`)
386
375
  }));
387
376
  ctx.ui?.error?.(`${filtered.totalViolations} layering violation(s) in ${filtered.affectedPackages.length} package(s)`, { sections });
388
- return { exitCode: 1 };
377
+ return { ok: false, error: "Command failed" };
389
378
  }
390
379
  }
391
380
  });
@@ -400,7 +389,7 @@ var coupling_default = defineCommand({
400
389
  const report = analyzeCoupling({ rootDir: cwd, layerMap: config?.layers, topN: flags.top });
401
390
  if (flags.json) {
402
391
  ctx.ui?.json?.(report);
403
- return { exitCode: 0 };
392
+ return { ok: true };
404
393
  }
405
394
  const sorted = flags.sort === "coupled" ? [...report.packages].sort((a, b) => b.afferent + b.efferent - (a.afferent + a.efferent)) : [...report.packages].sort((a, b) => b.instability - a.instability);
406
395
  const top = sorted.slice(0, flags.top ?? 10);
@@ -412,7 +401,7 @@ var coupling_default = defineCommand({
412
401
  ctx.ui?.success?.(`Coupling \u2014 avg instability: ${report.avgInstability.toFixed(2)}`, {
413
402
  sections: [{ header: `Top ${top.length} by instability`, items }]
414
403
  });
415
- return { exitCode: 0 };
404
+ return { ok: true };
416
405
  }
417
406
  }
418
407
  });
@@ -426,10 +415,7 @@ var cycles_default = defineCommand({
426
415
  const graph = buildDependencyGraph(ctx.cwd);
427
416
  const cycles = findCircularDependencies(graph);
428
417
  outputCycles(cycles, flags, ui);
429
- return {
430
- exitCode: cycles.length > 0 ? 1 : 0,
431
- cycles
432
- };
418
+ return cycles.length > 0 ? { ok: false, error: "Circular dependencies found", result: { cycles } } : { ok: true, result: { cycles } };
433
419
  }
434
420
  }
435
421
  });
@@ -504,16 +490,16 @@ var dead_code_default = defineCommand({
504
490
  const cfg = config ?? defaultQualityConfig;
505
491
  if (!cfg.knip.enabled) {
506
492
  ctx.ui?.success?.("knip is disabled in config (knip.enabled = false)");
507
- return { exitCode: 0 };
493
+ return { ok: true };
508
494
  }
509
495
  const report = await runKnip({ shell: ctx.api.shell, rootDir: cwd });
510
496
  if (flags.json) {
511
497
  ctx.ui?.json?.(report);
512
- return { exitCode: report.totalIssues > 0 ? 1 : 0 };
498
+ return report.totalIssues > 0 ? { ok: false, error: "Dead code found", result: report } : { ok: true, result: report };
513
499
  }
514
500
  if (report.totalIssues === 0) {
515
501
  ctx.ui?.success?.("No dead code detected");
516
- return { exitCode: 0 };
502
+ return { ok: true };
517
503
  }
518
504
  const sections = [];
519
505
  if (report.unusedFiles.length > 0) {
@@ -541,7 +527,7 @@ var dead_code_default = defineCommand({
541
527
  });
542
528
  }
543
529
  ctx.ui?.error?.(`${report.totalIssues} dead code issue(s) found`, { sections });
544
- return { exitCode: 1 };
530
+ return { ok: false, error: "Command failed" };
545
531
  }
546
532
  }
547
533
  });
@@ -589,11 +575,11 @@ var fix_deps_default = defineCommand({
589
575
  if (showStats) {
590
576
  const stats = await getDependencyStats(ctx.cwd);
591
577
  outputStats(stats, flags, ui);
592
- return { exitCode: 0 };
578
+ return { ok: true };
593
579
  }
594
580
  if (!removeUnused && !addMissing && !alignVersions) {
595
581
  validationError(ctx, "No fix options specified", "Use --remove-unused, --add-missing, --align-versions, or --all", flags.json);
596
- return { exitCode: 1 };
582
+ return { ok: false, error: "Command failed" };
597
583
  }
598
584
  const loader = useLoader("Scanning packages...");
599
585
  loader.start();
@@ -609,7 +595,7 @@ var fix_deps_default = defineCommand({
609
595
  alignedCount: result.alignedDeps.length
610
596
  });
611
597
  outputResults({ ...result, dryRun: false }, flags, ui);
612
- return { exitCode: 0, result };
598
+ return { ok: true, result };
613
599
  }
614
600
  }
615
601
  });
@@ -929,7 +915,7 @@ var health_default = defineCommand({
929
915
  if (cached && !flags.refresh) {
930
916
  const health2 = cached;
931
917
  outputHealth(health2, flags, ctx);
932
- return { exitCode: health2.score < cfg.thresholds.health ? 1 : 0 };
918
+ return health2.score < cfg.thresholds.health ? { ok: false, error: "Health score is below threshold", result: health2 } : { ok: true, result: health2 };
933
919
  }
934
920
  const [layering, types] = await Promise.all([
935
921
  analyzeLayering({ rootDir: cwd, layerMap: cfg.layers }),
@@ -951,7 +937,7 @@ var health_default = defineCommand({
951
937
  });
952
938
  await ctx.platform.cache.set(CACHE_KEYS.HEALTH, health, CACHE_TTLS.FAST);
953
939
  outputHealth(health, flags, ctx);
954
- return { exitCode: health.score < cfg.thresholds.health ? 1 : 0 };
940
+ return health.score < cfg.thresholds.health ? { ok: false, error: "Health score is below threshold", result: health } : { ok: true, result: health };
955
941
  }
956
942
  }
957
943
  });
@@ -980,13 +966,13 @@ var history_default = defineCommand({
980
966
  const { snapshots, delta, latest } = store.history();
981
967
  if (snapshots.length === 0) {
982
968
  ctx.ui?.success?.("No snapshots yet. Run `kb quality snapshot` first.");
983
- return { exitCode: 0 };
969
+ return { ok: true };
984
970
  }
985
971
  const limit = flags.limit ?? 10;
986
972
  const recent = snapshots.slice(-limit).reverse();
987
973
  if (flags.json) {
988
974
  ctx.ui?.json?.({ snapshots: recent, delta, latest });
989
- return { exitCode: 0 };
975
+ return { ok: true };
990
976
  }
991
977
  const items = recent.map((s) => {
992
978
  const date = new Date(s.timestamp).toLocaleString();
@@ -1010,7 +996,7 @@ var history_default = defineCommand({
1010
996
  });
1011
997
  }
1012
998
  ctx.ui?.success?.(`Quality history (${recent.length} snapshots)`, { sections });
1013
- return { exitCode: 0 };
999
+ return { ok: true };
1014
1000
  }
1015
1001
  }
1016
1002
  });
@@ -1092,7 +1078,7 @@ var snapshot_default = defineCommand({
1092
1078
  }]
1093
1079
  });
1094
1080
  }
1095
- return { exitCode: 0 };
1081
+ return { ok: true };
1096
1082
  }
1097
1083
  }
1098
1084
  });
@@ -1106,7 +1092,7 @@ var stats_default = defineCommand({
1106
1092
  const stats = await calculateStats(cwd);
1107
1093
  if (flags.json) {
1108
1094
  ctx.ui?.json?.(stats);
1109
- return { exitCode: 0 };
1095
+ return { ok: true };
1110
1096
  }
1111
1097
  ctx.ui?.success?.("Monorepo statistics", {
1112
1098
  sections: [{
@@ -1118,7 +1104,7 @@ var stats_default = defineCommand({
1118
1104
  ]
1119
1105
  }]
1120
1106
  });
1121
- return { exitCode: 0 };
1107
+ return { ok: true };
1122
1108
  }
1123
1109
  }
1124
1110
  });
@@ -1143,7 +1129,7 @@ var visualize_default = defineCommand({
1143
1129
  } else {
1144
1130
  outputStats2(graph, flags, ui);
1145
1131
  }
1146
- return { exitCode: 0 };
1132
+ return { ok: true, result: { graph } };
1147
1133
  }
1148
1134
  }
1149
1135
  });