@principal-ade/code-quality-panels 0.1.18 → 0.1.19

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.
@@ -2186,9 +2186,10 @@ const RepositoryQualityGridPanelContent = ({
2186
2186
  };
2187
2187
  const RepositoryQualityGridPanel = RepositoryQualityGridPanelContent;
2188
2188
  function groupResultsByPackage(results) {
2189
+ var _a;
2189
2190
  const map = /* @__PURE__ */ new Map();
2190
2191
  for (const result of results) {
2191
- const key = result.package.name;
2192
+ const key = ((_a = result.package) == null ? void 0 : _a.name) ?? "unknown";
2192
2193
  const existing = map.get(key) || [];
2193
2194
  existing.push(result);
2194
2195
  map.set(key, existing);
@@ -2234,14 +2235,15 @@ function getSeverityBg(severity) {
2234
2235
  }
2235
2236
  }
2236
2237
  function getPackageSummary(results) {
2238
+ var _a, _b, _c, _d, _e;
2237
2239
  let totalErrors = 0;
2238
2240
  let totalWarnings = 0;
2239
2241
  let passCount = 0;
2240
2242
  let failCount = 0;
2241
2243
  for (const result of results) {
2242
- totalErrors += result.metrics.issuesBySeverity.error;
2243
- totalWarnings += result.metrics.issuesBySeverity.warning;
2244
- if (result.execution.success) {
2244
+ totalErrors += ((_b = (_a = result.metrics) == null ? void 0 : _a.issuesBySeverity) == null ? void 0 : _b.error) ?? 0;
2245
+ totalWarnings += ((_d = (_c = result.metrics) == null ? void 0 : _c.issuesBySeverity) == null ? void 0 : _d.warning) ?? 0;
2246
+ if ((_e = result.execution) == null ? void 0 : _e.success) {
2245
2247
  passCount++;
2246
2248
  } else {
2247
2249
  failCount++;
@@ -2257,7 +2259,7 @@ function LensDataDebugPanel$1({
2257
2259
  onFileClick,
2258
2260
  onPackageSelect
2259
2261
  }) {
2260
- const packageGroups = React2.useMemo(() => groupResultsByPackage(data.results), [data.results]);
2262
+ const packageGroups = React2.useMemo(() => groupResultsByPackage((data == null ? void 0 : data.results) ?? []), [data == null ? void 0 : data.results]);
2261
2263
  const packageNames = React2.useMemo(() => Array.from(packageGroups.keys()), [packageGroups]);
2262
2264
  const [selectedPackage, setSelectedPackage] = React2.useState(
2263
2265
  initialSelectedPackage || (packageNames.length === 1 ? packageNames[0] : null)
@@ -2375,10 +2377,11 @@ function LensDataDebugPanel$1({
2375
2377
  borderRadius: 6
2376
2378
  }, children: "Select a package above to view lens results" }),
2377
2379
  selectedPackage && selectedResults.map((result, idx) => {
2378
- const lensKey = `${result.lens.id}-${idx}`;
2380
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
2381
+ const lensKey = `${((_a = result.lens) == null ? void 0 : _a.id) ?? "unknown"}-${idx}`;
2379
2382
  const isExpanded = expandedLens === lensKey;
2380
- const filesWithIssues = getFilesWithIssues(result.issues);
2381
- const hasIssues = result.issues.length > 0;
2383
+ const filesWithIssues = getFilesWithIssues(result.issues ?? []);
2384
+ const hasIssues = (((_b = result.issues) == null ? void 0 : _b.length) ?? 0) > 0;
2382
2385
  return /* @__PURE__ */ jsxs(
2383
2386
  "div",
2384
2387
  {
@@ -2419,10 +2422,10 @@ function LensDataDebugPanel$1({
2419
2422
  children: /* @__PURE__ */ jsx("polyline", { points: "9,18 15,12 9,6" })
2420
2423
  }
2421
2424
  ),
2422
- /* @__PURE__ */ jsx("span", { style: { fontWeight: 600, color: theme.colors.text }, children: result.lens.id }),
2425
+ /* @__PURE__ */ jsx("span", { style: { fontWeight: 600, color: theme.colors.text }, children: ((_c = result.lens) == null ? void 0 : _c.id) ?? "unknown" }),
2423
2426
  /* @__PURE__ */ jsxs("span", { style: { color: theme.colors.textMuted }, children: [
2424
2427
  "(",
2425
- result.lens.command,
2428
+ ((_d = result.lens) == null ? void 0 : _d.command) ?? "",
2426
2429
  ")"
2427
2430
  ] })
2428
2431
  ] }),
@@ -2431,33 +2434,33 @@ function LensDataDebugPanel$1({
2431
2434
  padding: "2px 6px",
2432
2435
  borderRadius: 4,
2433
2436
  fontSize: 11,
2434
- backgroundColor: result.execution.success ? "rgba(34, 197, 94, 0.1)" : "rgba(239, 68, 68, 0.1)",
2435
- color: result.execution.success ? "#22c55e" : "#ef4444"
2436
- }, children: result.execution.success ? "pass" : "fail" }),
2437
+ backgroundColor: ((_e = result.execution) == null ? void 0 : _e.success) ? "rgba(34, 197, 94, 0.1)" : "rgba(239, 68, 68, 0.1)",
2438
+ color: ((_f = result.execution) == null ? void 0 : _f.success) ? "#22c55e" : "#ef4444"
2439
+ }, children: ((_g = result.execution) == null ? void 0 : _g.success) ? "pass" : "fail" }),
2437
2440
  hasIssues && /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: 6 }, children: [
2438
- result.metrics.issuesBySeverity.error > 0 && /* @__PURE__ */ jsxs("span", { style: {
2441
+ (((_i = (_h = result.metrics) == null ? void 0 : _h.issuesBySeverity) == null ? void 0 : _i.error) ?? 0) > 0 && /* @__PURE__ */ jsxs("span", { style: {
2439
2442
  padding: "2px 6px",
2440
2443
  borderRadius: 4,
2441
2444
  fontSize: 11,
2442
2445
  backgroundColor: getSeverityBg("error"),
2443
2446
  color: getSeverityColor("error")
2444
2447
  }, children: [
2445
- result.metrics.issuesBySeverity.error,
2448
+ ((_k = (_j = result.metrics) == null ? void 0 : _j.issuesBySeverity) == null ? void 0 : _k.error) ?? 0,
2446
2449
  " errors"
2447
2450
  ] }),
2448
- result.metrics.issuesBySeverity.warning > 0 && /* @__PURE__ */ jsxs("span", { style: {
2451
+ (((_m = (_l = result.metrics) == null ? void 0 : _l.issuesBySeverity) == null ? void 0 : _m.warning) ?? 0) > 0 && /* @__PURE__ */ jsxs("span", { style: {
2449
2452
  padding: "2px 6px",
2450
2453
  borderRadius: 4,
2451
2454
  fontSize: 11,
2452
2455
  backgroundColor: getSeverityBg("warning"),
2453
2456
  color: getSeverityColor("warning")
2454
2457
  }, children: [
2455
- result.metrics.issuesBySeverity.warning,
2458
+ ((_o = (_n = result.metrics) == null ? void 0 : _n.issuesBySeverity) == null ? void 0 : _o.warning) ?? 0,
2456
2459
  " warnings"
2457
2460
  ] })
2458
2461
  ] }),
2459
2462
  /* @__PURE__ */ jsxs("span", { style: { fontSize: 12, color: theme.colors.textMuted }, children: [
2460
- result.metrics.filesAnalyzed,
2463
+ ((_p = result.metrics) == null ? void 0 : _p.filesAnalyzed) ?? 0,
2461
2464
  " files"
2462
2465
  ] })
2463
2466
  ] })
@@ -2480,16 +2483,16 @@ function LensDataDebugPanel$1({
2480
2483
  }, children: [
2481
2484
  /* @__PURE__ */ jsxs("div", { children: [
2482
2485
  /* @__PURE__ */ jsx("div", { style: { fontSize: 11, color: theme.colors.textMuted }, children: "Files Analyzed" }),
2483
- /* @__PURE__ */ jsx("div", { style: { fontSize: 16, fontWeight: 600, color: theme.colors.text }, children: result.metrics.filesAnalyzed })
2486
+ /* @__PURE__ */ jsx("div", { style: { fontSize: 16, fontWeight: 600, color: theme.colors.text }, children: ((_q = result.metrics) == null ? void 0 : _q.filesAnalyzed) ?? 0 })
2484
2487
  ] }),
2485
2488
  /* @__PURE__ */ jsxs("div", { children: [
2486
2489
  /* @__PURE__ */ jsx("div", { style: { fontSize: 11, color: theme.colors.textMuted }, children: "Total Issues" }),
2487
- /* @__PURE__ */ jsx("div", { style: { fontSize: 16, fontWeight: 600, color: theme.colors.text }, children: result.metrics.totalIssues })
2490
+ /* @__PURE__ */ jsx("div", { style: { fontSize: 16, fontWeight: 600, color: theme.colors.text }, children: ((_r = result.metrics) == null ? void 0 : _r.totalIssues) ?? 0 })
2488
2491
  ] }),
2489
2492
  /* @__PURE__ */ jsxs("div", { children: [
2490
2493
  /* @__PURE__ */ jsx("div", { style: { fontSize: 11, color: theme.colors.textMuted }, children: "Duration" }),
2491
2494
  /* @__PURE__ */ jsxs("div", { style: { fontSize: 16, fontWeight: 600, color: theme.colors.text }, children: [
2492
- result.execution.duration || 0,
2495
+ ((_s = result.execution) == null ? void 0 : _s.duration) ?? 0,
2493
2496
  "ms"
2494
2497
  ] })
2495
2498
  ] }),
@@ -2706,19 +2709,18 @@ const LensDataDebugPanelContent = ({
2706
2709
  context,
2707
2710
  actions
2708
2711
  }) => {
2709
- var _a, _b, _c;
2710
2712
  const { theme } = useTheme();
2711
2713
  const lensResultsSlice = context.getSlice("lensResults");
2712
2714
  const hasSlice = context.hasSlice("lensResults");
2713
2715
  const isLoading = (lensResultsSlice == null ? void 0 : lensResultsSlice.loading) ?? false;
2714
2716
  const handleFileClick = (file, line) => {
2715
- var _a2, _b2, _c2;
2716
- const repoPath = (_a2 = context.currentScope.repository) == null ? void 0 : _a2.path;
2717
+ var _a, _b, _c;
2718
+ const repoPath = (_a = context.currentScope.repository) == null ? void 0 : _a.path;
2717
2719
  const fullPath = repoPath ? `${repoPath}/${file}` : file;
2718
2720
  if (line) {
2719
- (_b2 = actions.openFile) == null ? void 0 : _b2.call(actions, `${fullPath}:${line}`);
2721
+ (_b = actions.openFile) == null ? void 0 : _b.call(actions, `${fullPath}:${line}`);
2720
2722
  } else {
2721
- (_c2 = actions.openFile) == null ? void 0 : _c2.call(actions, fullPath);
2723
+ (_c = actions.openFile) == null ? void 0 : _c.call(actions, fullPath);
2722
2724
  }
2723
2725
  };
2724
2726
  return /* @__PURE__ */ jsxs(
@@ -2759,19 +2761,14 @@ const LensDataDebugPanelContent = ({
2759
2761
  },
2760
2762
  children: "Lens Data Debug"
2761
2763
  }
2762
- ),
2763
- (lensResultsSlice == null ? void 0 : lensResultsSlice.data) && /* @__PURE__ */ jsxs(Fragment, { children: [
2764
- /* @__PURE__ */ jsx("span", { style: { color: theme.colors.textMuted }, children: "•" }),
2765
- /* @__PURE__ */ jsxs("span", { style: { fontSize: 12, color: theme.colors.textMuted }, children: [
2766
- ((_a = lensResultsSlice.data.metadata.git) == null ? void 0 : _a.repository) || "Unknown",
2767
- " @ ",
2768
- ((_c = (_b = lensResultsSlice.data.metadata.git) == null ? void 0 : _b.commit) == null ? void 0 : _c.slice(0, 7)) || "?"
2769
- ] })
2770
- ] })
2764
+ )
2771
2765
  ] }),
2772
2766
  (lensResultsSlice == null ? void 0 : lensResultsSlice.data) && /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 12, fontSize: 11, color: theme.colors.textMuted }, children: [
2773
2767
  /* @__PURE__ */ jsxs("span", { children: [
2774
- new Set(lensResultsSlice.data.results.map((r2) => r2.package.name)).size,
2768
+ new Set(lensResultsSlice.data.results.map((r2) => {
2769
+ var _a;
2770
+ return ((_a = r2.package) == null ? void 0 : _a.name) ?? "unknown";
2771
+ })).size,
2775
2772
  " packages"
2776
2773
  ] }),
2777
2774
  /* @__PURE__ */ jsxs("span", { children: [