agentimization 0.1.2 → 0.1.3

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 +212 -142
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -6892,11 +6892,11 @@ var auditLocal = async (dirPath, config = {}) => {
6892
6892
  };
6893
6893
 
6894
6894
  // src/ui/app.tsx
6895
- import { useState as useState4, useEffect as useEffect2 } from "react";
6896
- import { Box as Box6, Text as Text6 } from "ink";
6895
+ import { useState as useState4 } from "react";
6896
+ import { Box as Box6, Text as Text6, Static, useStdout } from "ink";
6897
6897
 
6898
6898
  // src/ui/hero-card.tsx
6899
- import { useEffect, useState } from "react";
6899
+ import { useState } from "react";
6900
6900
  import { Box, Text } from "ink";
6901
6901
 
6902
6902
  // src/ui/color.ts
@@ -6941,11 +6941,16 @@ var toInkColor = (input) => {
6941
6941
  return out;
6942
6942
  };
6943
6943
 
6944
+ // src/hooks/use-mount-effect.ts
6945
+ import { useEffect } from "react";
6946
+ var useMountEffect = (effect) => {
6947
+ useEffect(effect, []);
6948
+ };
6949
+
6944
6950
  // src/ui/hero-card.tsx
6945
6951
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6946
- var CARD_WIDTH = 46;
6952
+ var DEFAULT_CARD_WIDTH = 46;
6947
6953
  var PATTERN_ROWS = 4;
6948
- var PATTERN_COLS = CARD_WIDTH - 4;
6949
6954
  var PATTERN_GLYPHS = ["\u2591", "\u2592", "\u2593", "\u2588"];
6950
6955
  var ACCENT_BY_PHASE = {
6951
6956
  init: "oklch(0.787 0.119 304.8)",
@@ -7018,10 +7023,10 @@ var MiniLoader = ({
7018
7023
  intervalMs = 120
7019
7024
  }) => {
7020
7025
  const [frame, setFrame] = useState(0);
7021
- useEffect(() => {
7026
+ useMountEffect(() => {
7022
7027
  const timer = setInterval(() => setFrame((f) => (f + 1) % 1e3), intervalMs);
7023
7028
  return () => clearInterval(timer);
7024
- }, [intervalMs]);
7029
+ });
7025
7030
  const segments = [];
7026
7031
  let current = null;
7027
7032
  for (let c = 0; c < MINI_COLS; c++) {
@@ -7043,6 +7048,7 @@ var MiniLoader = ({
7043
7048
  var Pattern = ({
7044
7049
  accent,
7045
7050
  frame,
7051
+ cols,
7046
7052
  overlay
7047
7053
  }) => {
7048
7054
  const overlayStart = overlay ? overlay.col : -1;
@@ -7051,7 +7057,7 @@ var Pattern = ({
7051
7057
  const segments = [];
7052
7058
  let current = null;
7053
7059
  const isOverlayRow = overlay && r === overlay.row;
7054
- for (let c = 0; c < PATTERN_COLS; c++) {
7060
+ for (let c = 0; c < cols; c++) {
7055
7061
  let char;
7056
7062
  let color;
7057
7063
  if (isOverlayRow && c >= overlayStart && c < overlayEnd) {
@@ -7099,13 +7105,13 @@ var shimmerColor = (index, head, cycleLen, accent) => {
7099
7105
  };
7100
7106
  var Shimmer = ({ text, accent }) => {
7101
7107
  const [head, setHead] = useState(0);
7102
- useEffect(() => {
7108
+ useMountEffect(() => {
7103
7109
  const cycleLen2 = text.length + SHIMMER_GAP;
7104
7110
  const timer = setInterval(() => {
7105
7111
  setHead((h) => (h + 1) % cycleLen2);
7106
7112
  }, SHIMMER_INTERVAL_MS);
7107
7113
  return () => clearInterval(timer);
7108
- }, [text.length]);
7114
+ });
7109
7115
  const cycleLen = text.length + SHIMMER_GAP;
7110
7116
  const segments = [];
7111
7117
  let current = null;
@@ -7122,6 +7128,14 @@ var Shimmer = ({ text, accent }) => {
7122
7128
  if (current) segments.push(current);
7123
7129
  return /* @__PURE__ */ jsx(Text, { children: segments.map((s, i) => /* @__PURE__ */ jsx(Text, { color: toInkColor(s.color), children: s.text }, i)) });
7124
7130
  };
7131
+ var AnimatedPattern = ({ accent, cols, overlay }) => {
7132
+ const [frame, setFrame] = useState(0);
7133
+ useMountEffect(() => {
7134
+ const timer = setInterval(() => setFrame((f) => (f + 1) % 1e3), 120);
7135
+ return () => clearInterval(timer);
7136
+ });
7137
+ return /* @__PURE__ */ jsx(Pattern, { accent, frame, cols, overlay });
7138
+ };
7125
7139
  var HeroCard = ({
7126
7140
  target,
7127
7141
  isLocal,
@@ -7130,18 +7144,21 @@ var HeroCard = ({
7130
7144
  checksTotal,
7131
7145
  grade,
7132
7146
  score,
7133
- gradeColor
7147
+ gradeColor,
7148
+ width = DEFAULT_CARD_WIDTH
7134
7149
  }) => {
7135
- const [frame, setFrame] = useState(0);
7136
- useEffect(() => {
7137
- if (phase === "done" || phase === "error") return;
7138
- const timer = setInterval(() => setFrame((f) => (f + 1) % 1e3), 120);
7139
- return () => clearInterval(timer);
7140
- }, [phase]);
7150
+ const cols = width - 4;
7141
7151
  const accent = phase === "done" && gradeColor ? gradeColor : ACCENT_BY_PHASE[phase];
7142
7152
  const status = STATUS_BY_PHASE(phase, isLocal, checksDone, checksTotal);
7143
- const targetLabel = truncate(target, PATTERN_COLS);
7153
+ const targetLabel = truncate(target, cols);
7144
7154
  const showGrade = phase === "done" && grade !== void 0 && score !== void 0;
7155
+ const isActive = phase !== "done" && phase !== "error";
7156
+ const overlay = {
7157
+ row: PATTERN_ROWS - 1,
7158
+ col: cols - "agentimization".length - 1,
7159
+ chars: Array.from(" agentimization"),
7160
+ color: accent
7161
+ };
7145
7162
  return /* @__PURE__ */ jsxs(
7146
7163
  Box,
7147
7164
  {
@@ -7149,21 +7166,9 @@ var HeroCard = ({
7149
7166
  borderStyle: "round",
7150
7167
  borderColor: dim(accent, FRAME_INNER_FACTOR),
7151
7168
  paddingX: 1,
7152
- width: CARD_WIDTH,
7169
+ width,
7153
7170
  children: [
7154
- /* @__PURE__ */ jsx(
7155
- Pattern,
7156
- {
7157
- accent,
7158
- frame,
7159
- overlay: {
7160
- row: PATTERN_ROWS - 1,
7161
- col: PATTERN_COLS - "agentimization".length - 1,
7162
- chars: Array.from(" agentimization"),
7163
- color: accent
7164
- }
7165
- }
7166
- ),
7171
+ isActive ? /* @__PURE__ */ jsx(AnimatedPattern, { accent, cols, overlay }) : /* @__PURE__ */ jsx(Pattern, { accent, frame: 0, cols, overlay }),
7167
7172
  /* @__PURE__ */ jsx(Box, { marginTop: 1, children: /* @__PURE__ */ jsx(Text, { children: targetLabel }) }),
7168
7173
  /* @__PURE__ */ jsx(Box, { marginTop: 1, children: showGrade ? /* @__PURE__ */ jsxs(Fragment, { children: [
7169
7174
  /* @__PURE__ */ jsx(Text, { color: toInkColor(accent), children: grade }),
@@ -7176,7 +7181,7 @@ var HeroCard = ({
7176
7181
  " ",
7177
7182
  status
7178
7183
  ] })
7179
- ] }) : /* @__PURE__ */ jsx(Shimmer, { text: status, accent }) })
7184
+ ] }) : /* @__PURE__ */ jsx(Shimmer, { text: status, accent }, status) })
7180
7185
  ]
7181
7186
  }
7182
7187
  );
@@ -7222,7 +7227,7 @@ var ACCENT_BLUE = "oklch(0.766 0.111 259.9)";
7222
7227
  var TEXT_DIM = "oklch(0.550 0.034 277.1)";
7223
7228
 
7224
7229
  // src/ui/result-card.tsx
7225
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
7230
+ import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
7226
7231
  var SCORE_PAIRS = {
7227
7232
  pass: { bright: "oklch(0.858 0.109 142.7)", dim: "oklch(0.584 0.102 139.1)" },
7228
7233
  warn: { bright: "oklch(0.824 0.101 52.6)", dim: "oklch(0.572 0.072 53.0)" },
@@ -7230,8 +7235,7 @@ var SCORE_PAIRS = {
7230
7235
  empty: { bright: "oklch(0.404 0.032 280.2)", dim: "oklch(0.324 0.032 282.0)" }
7231
7236
  };
7232
7237
  var RESULT_CARD_WIDTH = 46;
7233
- var RESULT_BAR_WIDTH = RESULT_CARD_WIDTH - 4;
7234
- var SCORE_FIELD_ROWS = 2;
7238
+ var SCORE_FIELD_ROWS = 1;
7235
7239
  var SCORE_GLYPHS = ["\u2591", "\u2592", "\u2593", "\u2588"];
7236
7240
  var scoreCell = (row, col) => {
7237
7241
  const v = (row * 7 + col * 13) % 17;
@@ -7242,16 +7246,18 @@ var scoreCell = (row, col) => {
7242
7246
  var ScoreField = ({
7243
7247
  passWidth,
7244
7248
  warnWidth,
7245
- failWidth
7249
+ failWidth,
7250
+ barWidth
7246
7251
  }) => {
7252
+ const emptyWidth = Math.max(0, barWidth - passWidth - warnWidth - failWidth);
7247
7253
  const colorAtCol = (col, bright) => {
7248
- const pair = col < passWidth ? SCORE_PAIRS.pass : col < passWidth + warnWidth ? SCORE_PAIRS.warn : col < passWidth + warnWidth + failWidth ? SCORE_PAIRS.fail : SCORE_PAIRS.empty;
7254
+ const pair = col < emptyWidth ? SCORE_PAIRS.empty : col < emptyWidth + passWidth ? SCORE_PAIRS.pass : col < emptyWidth + passWidth + warnWidth ? SCORE_PAIRS.warn : SCORE_PAIRS.fail;
7249
7255
  return bright ? pair.bright : pair.dim;
7250
7256
  };
7251
7257
  return /* @__PURE__ */ jsx2(Box2, { flexDirection: "column", children: Array.from({ length: SCORE_FIELD_ROWS }, (_, r) => {
7252
7258
  const segments = [];
7253
7259
  let current = null;
7254
- for (let c = 0; c < RESULT_BAR_WIDTH; c++) {
7260
+ for (let c = 0; c < barWidth; c++) {
7255
7261
  const cell = scoreCell(r, c);
7256
7262
  const color = colorAtCol(c, cell.bright);
7257
7263
  if (current && current.color === color) {
@@ -7265,15 +7271,21 @@ var ScoreField = ({
7265
7271
  return /* @__PURE__ */ jsx2(Text2, { children: segments.map((s, i) => /* @__PURE__ */ jsx2(Text2, { color: toInkColor(s.color), children: s.text }, i)) }, r);
7266
7272
  }) });
7267
7273
  };
7268
- var ResultCard = ({ result, target }) => {
7274
+ var ResultCard = ({
7275
+ result,
7276
+ target,
7277
+ width = RESULT_CARD_WIDTH
7278
+ }) => {
7269
7279
  const { grade, overall_score, summary, latency_ms } = result;
7270
7280
  const gc = GRADE_COLORS[grade] ?? "red";
7281
+ const barWidth = width - 4;
7271
7282
  const total = summary.total || 1;
7272
- const passWidth = Math.max(Math.round(summary.passed / total * RESULT_BAR_WIDTH), summary.passed > 0 ? 1 : 0);
7273
- const warnWidth = Math.max(Math.round(summary.warned / total * RESULT_BAR_WIDTH), summary.warned > 0 ? 1 : 0);
7274
- const failWidth = Math.max(Math.round(summary.failed / total * RESULT_BAR_WIDTH), summary.failed > 0 ? 1 : 0);
7283
+ const passWidth = Math.max(Math.round(summary.passed / total * barWidth), summary.passed > 0 ? 1 : 0);
7284
+ const warnWidth = Math.max(Math.round(summary.warned / total * barWidth), summary.warned > 0 ? 1 : 0);
7285
+ const failWidth = Math.max(Math.round(summary.failed / total * barWidth), summary.failed > 0 ? 1 : 0);
7275
7286
  const seconds = (latency_ms / 1e3).toFixed(1);
7276
- const targetMax = RESULT_BAR_WIDTH;
7287
+ const headerChrome = `${grade} ${overall_score}/100`.length + 3 + 3 + `${seconds}s`.length;
7288
+ const targetMax = Math.max(8, barWidth - headerChrome);
7277
7289
  const targetLabel = target.length <= targetMax ? target : target.slice(0, targetMax - 1) + "\u2026";
7278
7290
  return /* @__PURE__ */ jsxs2(
7279
7291
  Box2,
@@ -7283,7 +7295,7 @@ var ResultCard = ({ result, target }) => {
7283
7295
  borderStyle: "round",
7284
7296
  borderColor: dim(gc, FRAME_INNER_FACTOR),
7285
7297
  paddingX: 1,
7286
- width: RESULT_CARD_WIDTH,
7298
+ width,
7287
7299
  children: [
7288
7300
  /* @__PURE__ */ jsxs2(Box2, { children: [
7289
7301
  /* @__PURE__ */ jsx2(Text2, { color: toInkColor(gc), children: grade }),
@@ -7292,22 +7304,34 @@ var ResultCard = ({ result, target }) => {
7292
7304
  overall_score,
7293
7305
  "/100"
7294
7306
  ] }),
7307
+ /* @__PURE__ */ jsxs2(Text2, { dimColor: true, children: [
7308
+ " ",
7309
+ targetLabel
7310
+ ] }),
7295
7311
  /* @__PURE__ */ jsxs2(Text2, { dimColor: true, children: [
7296
7312
  " ",
7297
7313
  seconds,
7298
7314
  "s"
7299
7315
  ] })
7300
7316
  ] }),
7301
- /* @__PURE__ */ jsx2(Text2, { children: targetLabel }),
7302
7317
  /* @__PURE__ */ jsx2(Box2, { marginTop: 1, children: /* @__PURE__ */ jsx2(
7303
7318
  ScoreField,
7304
7319
  {
7305
7320
  passWidth,
7306
7321
  warnWidth,
7307
- failWidth
7322
+ failWidth,
7323
+ barWidth
7308
7324
  }
7309
7325
  ) }),
7310
7326
  /* @__PURE__ */ jsxs2(Box2, { marginTop: 1, children: [
7327
+ summary.skipped > 0 ? /* @__PURE__ */ jsxs2(Fragment2, { children: [
7328
+ /* @__PURE__ */ jsxs2(Text2, { dimColor: true, children: [
7329
+ STATUS_ICONS.skip,
7330
+ " ",
7331
+ summary.skipped
7332
+ ] }),
7333
+ /* @__PURE__ */ jsx2(Text2, { dimColor: true, children: " " })
7334
+ ] }) : null,
7311
7335
  /* @__PURE__ */ jsxs2(Text2, { color: toInkColor(SCORE_PAIRS.pass.bright), children: [
7312
7336
  STATUS_ICONS.pass,
7313
7337
  " ",
@@ -7324,12 +7348,6 @@ var ResultCard = ({ result, target }) => {
7324
7348
  STATUS_ICONS.fail,
7325
7349
  " ",
7326
7350
  summary.failed
7327
- ] }),
7328
- /* @__PURE__ */ jsx2(Text2, { dimColor: true, children: " " }),
7329
- /* @__PURE__ */ jsxs2(Text2, { dimColor: true, children: [
7330
- STATUS_ICONS.skip,
7331
- " ",
7332
- summary.skipped
7333
7351
  ] })
7334
7352
  ] })
7335
7353
  ]
@@ -7363,14 +7381,13 @@ var CheckLine = ({ check, loaderColor }) => {
7363
7381
  r.id
7364
7382
  ] })
7365
7383
  ] }),
7366
- /* @__PURE__ */ jsxs3(Text3, { dimColor: true, children: [
7367
- " ",
7368
- r.message
7369
- ] }),
7370
- showSuggestion ? /* @__PURE__ */ jsxs3(Text3, { color: toInkColor("oklch(0.858 0.109 142.7)"), children: [
7371
- " \u2192 ",
7372
- r.suggestion
7373
- ] }) : null
7384
+ /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", paddingLeft: 2, children: [
7385
+ /* @__PURE__ */ jsx3(Text3, { dimColor: true, children: r.message }),
7386
+ showSuggestion ? /* @__PURE__ */ jsxs3(Text3, { color: toInkColor("oklch(0.858 0.109 142.7)"), children: [
7387
+ "\u2192 ",
7388
+ r.suggestion
7389
+ ] }) : null
7390
+ ] })
7374
7391
  ] });
7375
7392
  }
7376
7393
  return null;
@@ -7551,7 +7568,7 @@ var copyToClipboard = async (text) => {
7551
7568
  // src/ui/action-menu.tsx
7552
7569
  import { writeFileSync } from "fs";
7553
7570
  import { resolve } from "path";
7554
- import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
7571
+ import { Fragment as Fragment3, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
7555
7572
  var FEEDBACK_OK = "oklch(0.858 0.109 142.7)";
7556
7573
  var FEEDBACK_ERR = "oklch(0.718 0.181 10.0)";
7557
7574
  var buildMenuOptions = (hasIssues) => [
@@ -7679,7 +7696,7 @@ var ActionMenu = ({
7679
7696
  ] }) : null
7680
7697
  ] }, opt.value);
7681
7698
  }) }),
7682
- feedback ? /* @__PURE__ */ jsxs4(Fragment2, { children: [
7699
+ feedback ? /* @__PURE__ */ jsxs4(Fragment3, { children: [
7683
7700
  /* @__PURE__ */ jsx4(Box4, { marginTop: 1, paddingLeft: 2, children: /* @__PURE__ */ jsx4(Text4, { color: toInkColor(feedback.startsWith("\u2713") ? FEEDBACK_OK : FEEDBACK_ERR), children: feedback }) }),
7684
7701
  /* @__PURE__ */ jsx4(Box4, { height: 1, children: /* @__PURE__ */ jsx4(Text4, { children: " " }) })
7685
7702
  ] }) : null
@@ -7812,7 +7829,7 @@ var resolveTarget = (input) => {
7812
7829
  };
7813
7830
 
7814
7831
  // src/ui/app.tsx
7815
- import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
7832
+ import { Fragment as Fragment4, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
7816
7833
  var App = ({
7817
7834
  target: initialTarget,
7818
7835
  isLocal: initialIsLocal,
@@ -7822,22 +7839,95 @@ var App = ({
7822
7839
  }) => {
7823
7840
  const [target, setTarget] = useState4(initialTarget);
7824
7841
  const [isLocal, setIsLocal] = useState4(initialIsLocal);
7842
+ const [retryError, setRetryError] = useState4(null);
7843
+ const { stdout } = useStdout();
7844
+ const [columns, setColumns] = useState4(stdout?.columns ?? 80);
7845
+ useMountEffect(() => {
7846
+ if (!stdout) return;
7847
+ const onResize = () => setColumns(stdout.columns);
7848
+ stdout.on("resize", onResize);
7849
+ return () => {
7850
+ stdout.off("resize", onResize);
7851
+ };
7852
+ });
7853
+ const cardWidth = Math.max(40, Math.min(columns - 2, 72));
7854
+ const handleRetry = (newInput) => {
7855
+ const resolved = resolveTarget(newInput);
7856
+ if ("error" in resolved) {
7857
+ setRetryError(resolved.error);
7858
+ return;
7859
+ }
7860
+ setRetryError(null);
7861
+ setTarget(resolved.target);
7862
+ setIsLocal(resolved.isLocal);
7863
+ };
7864
+ if (retryError) {
7865
+ return /* @__PURE__ */ jsx6(ErrorCard, { message: retryError, target, cardWidth, onRetry: handleRetry });
7866
+ }
7867
+ return /* @__PURE__ */ jsx6(
7868
+ AuditRunner,
7869
+ {
7870
+ target,
7871
+ isLocal,
7872
+ categories,
7873
+ sampleSize,
7874
+ autoDetectedFrom,
7875
+ cardWidth,
7876
+ onRetry: handleRetry
7877
+ },
7878
+ `${target}|${isLocal}`
7879
+ );
7880
+ };
7881
+ var ErrorCard = ({
7882
+ message,
7883
+ target,
7884
+ cardWidth,
7885
+ onRetry
7886
+ }) => {
7887
+ const errorColor = "oklch(0.718 0.181 10.0)";
7888
+ const lines = message.split("\n");
7889
+ return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", paddingLeft: 1, children: [
7890
+ /* @__PURE__ */ jsxs6(
7891
+ Box6,
7892
+ {
7893
+ flexDirection: "column",
7894
+ marginTop: 1,
7895
+ borderStyle: "round",
7896
+ borderColor: dim(errorColor, FRAME_INNER_FACTOR),
7897
+ paddingX: 1,
7898
+ width: cardWidth,
7899
+ children: [
7900
+ /* @__PURE__ */ jsx6(Text6, { bold: true, color: toInkColor(errorColor), children: "Error" }),
7901
+ /* @__PURE__ */ jsx6(Text6, { children: target }),
7902
+ /* @__PURE__ */ jsx6(Box6, { marginTop: 1, flexDirection: "column", children: lines.map((line, i) => /* @__PURE__ */ jsx6(Text6, { dimColor: i > 0, children: line }, i)) })
7903
+ ]
7904
+ }
7905
+ ),
7906
+ /* @__PURE__ */ jsx6(ErrorActions, { onRetry })
7907
+ ] });
7908
+ };
7909
+ var AuditRunner = ({
7910
+ target,
7911
+ isLocal,
7912
+ categories,
7913
+ sampleSize,
7914
+ autoDetectedFrom,
7915
+ cardWidth,
7916
+ onRetry
7917
+ }) => {
7825
7918
  const [phase, setPhase] = useState4("init");
7826
7919
  const [checks, setChecks] = useState4([]);
7827
7920
  const [result, setResult] = useState4(null);
7828
7921
  const [error, setError] = useState4(null);
7829
7922
  const [networkSkipped, setNetworkSkipped] = useState4(0);
7830
- useEffect2(() => {
7923
+ useMountEffect(() => {
7831
7924
  const onEvent = (event) => {
7832
7925
  switch (event.type) {
7833
7926
  case "phase":
7834
7927
  setPhase(event.phase);
7835
7928
  break;
7836
7929
  case "check-start":
7837
- setChecks((prev) => [
7838
- ...prev,
7839
- { ...event.check, status: "running" }
7840
- ]);
7930
+ setChecks((prev) => [...prev, { ...event.check, status: "running" }]);
7841
7931
  break;
7842
7932
  case "check-complete":
7843
7933
  setChecks(
@@ -7868,89 +7958,69 @@ var App = ({
7868
7958
  }
7869
7959
  };
7870
7960
  run();
7871
- }, [target, isLocal, categories, sampleSize]);
7872
- const handleRetry = (newInput) => {
7873
- const resolved = resolveTarget(newInput);
7874
- if ("error" in resolved) {
7875
- setError(resolved.error);
7876
- return;
7877
- }
7878
- setError(null);
7879
- setResult(null);
7880
- setChecks([]);
7881
- setNetworkSkipped(0);
7882
- setPhase("init");
7883
- setTarget(resolved.target);
7884
- setIsLocal(resolved.isLocal);
7885
- };
7961
+ });
7886
7962
  const checksByCategory = /* @__PURE__ */ new Map();
7887
7963
  for (const check of checks) {
7888
7964
  const existing = checksByCategory.get(check.category) ?? [];
7889
7965
  existing.push(check);
7890
7966
  checksByCategory.set(check.category, existing);
7891
7967
  }
7968
+ const categoryEntries = [...checksByCategory.entries()];
7969
+ const committedCount = phase === "done" ? categoryEntries.length : Math.max(0, categoryEntries.length - 1);
7970
+ const committedCategories = categoryEntries.slice(0, committedCount);
7971
+ const liveCategory = categoryEntries[committedCount];
7892
7972
  if (phase === "error") {
7893
- const errorColor = "oklch(0.718 0.181 10.0)";
7894
- const lines = (error ?? "Unknown error").split("\n");
7895
- return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", paddingLeft: 1, children: [
7896
- /* @__PURE__ */ jsxs6(
7897
- Box6,
7898
- {
7899
- flexDirection: "column",
7900
- marginTop: 1,
7901
- borderStyle: "round",
7902
- borderColor: dim(errorColor, FRAME_INNER_FACTOR),
7903
- paddingX: 1,
7904
- width: RESULT_CARD_WIDTH,
7905
- children: [
7906
- /* @__PURE__ */ jsx6(Text6, { bold: true, color: toInkColor(errorColor), children: "Error" }),
7907
- /* @__PURE__ */ jsx6(Text6, { children: target }),
7908
- /* @__PURE__ */ jsx6(Box6, { marginTop: 1, flexDirection: "column", children: lines.map((line, i) => /* @__PURE__ */ jsx6(Text6, { dimColor: i > 0, children: line }, i)) })
7909
- ]
7910
- }
7911
- ),
7912
- /* @__PURE__ */ jsx6(ErrorActions, { onRetry: handleRetry })
7913
- ] });
7914
- }
7915
- const checksDone = checks.filter((c) => c.status === "done").length;
7916
- const accent = result ? GRADE_COLORS[result.grade] ?? ACCENT_BY_PHASE[phase] : ACCENT_BY_PHASE[phase];
7917
- return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", paddingLeft: 1, children: [
7918
- /* @__PURE__ */ jsx6(Box6, { marginTop: 1, children: /* @__PURE__ */ jsx6(
7919
- HeroCard,
7973
+ return /* @__PURE__ */ jsx6(
7974
+ ErrorCard,
7920
7975
  {
7976
+ message: error ?? "Unknown error",
7921
7977
  target,
7922
- isLocal,
7923
- phase,
7924
- checksDone,
7925
- checksTotal: checks.length,
7926
- grade: result?.grade,
7927
- score: result?.overall_score,
7928
- gradeColor: result ? GRADE_COLORS[result.grade] : void 0
7978
+ cardWidth,
7979
+ onRetry
7929
7980
  }
7930
- ) }),
7931
- autoDetectedFrom ? /* @__PURE__ */ jsxs6(Text6, { dimColor: true, children: [
7932
- "auto-detected build output (was ",
7933
- autoDetectedFrom,
7934
- ")"
7935
- ] }) : null,
7936
- isLocal && networkSkipped > 0 && phase === "done" ? /* @__PURE__ */ jsxs6(Text6, { dimColor: true, children: [
7937
- networkSkipped,
7938
- " network-only checks skipped"
7939
- ] }) : null,
7940
- checks.length > 0 ? /* @__PURE__ */ jsx6(Box6, { flexDirection: "column", children: [...checksByCategory.entries()].map(([cat, catChecks]) => /* @__PURE__ */ jsx6(
7941
- CategorySection,
7942
- {
7943
- category: cat,
7944
- checks: catChecks,
7945
- score: result?.categories[cat]?.score,
7946
- loaderColor: accent
7947
- },
7948
- cat
7949
- )) }) : null,
7950
- result ? /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", children: [
7951
- /* @__PURE__ */ jsx6(ResultCard, { result, target }),
7952
- /* @__PURE__ */ jsx6(ActionMenu, { result, target, isLocal, onRetry: handleRetry })
7953
- ] }) : null
7981
+ );
7982
+ }
7983
+ const checksDone = checks.filter((c) => c.status === "done").length;
7984
+ const accent = result ? GRADE_COLORS[result.grade] ?? ACCENT_BY_PHASE[phase] : ACCENT_BY_PHASE[phase];
7985
+ return /* @__PURE__ */ jsxs6(Fragment4, { children: [
7986
+ /* @__PURE__ */ jsx6(Static, { items: committedCategories, children: ([cat, catChecks]) => /* @__PURE__ */ jsx6(Box6, { paddingLeft: 1, children: /* @__PURE__ */ jsx6(CategorySection, { category: cat, checks: catChecks, loaderColor: accent }) }, cat) }),
7987
+ /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", paddingLeft: 1, children: [
7988
+ /* @__PURE__ */ jsx6(Box6, { marginTop: 1, children: /* @__PURE__ */ jsx6(
7989
+ HeroCard,
7990
+ {
7991
+ target,
7992
+ isLocal,
7993
+ phase,
7994
+ checksDone,
7995
+ checksTotal: checks.length,
7996
+ grade: result?.grade,
7997
+ score: result?.overall_score,
7998
+ gradeColor: result ? GRADE_COLORS[result.grade] : void 0,
7999
+ width: cardWidth
8000
+ }
8001
+ ) }),
8002
+ autoDetectedFrom ? /* @__PURE__ */ jsxs6(Text6, { dimColor: true, children: [
8003
+ "auto-detected build output (was ",
8004
+ autoDetectedFrom,
8005
+ ")"
8006
+ ] }) : null,
8007
+ isLocal && networkSkipped > 0 && phase === "done" ? /* @__PURE__ */ jsxs6(Text6, { dimColor: true, children: [
8008
+ networkSkipped,
8009
+ " network-only checks skipped"
8010
+ ] }) : null,
8011
+ liveCategory ? /* @__PURE__ */ jsx6(
8012
+ CategorySection,
8013
+ {
8014
+ category: liveCategory[0],
8015
+ checks: liveCategory[1],
8016
+ loaderColor: accent
8017
+ }
8018
+ ) : null,
8019
+ result ? /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", children: [
8020
+ /* @__PURE__ */ jsx6(ResultCard, { result, target, width: cardWidth }),
8021
+ /* @__PURE__ */ jsx6(ActionMenu, { result, target, isLocal, onRetry })
8022
+ ] }) : null
8023
+ ] })
7954
8024
  ] });
7955
8025
  };
7956
8026
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentimization",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "GEO audit CLI — check if your website is agent-ready",
5
5
  "license": "MIT",
6
6
  "author": "Anthony Lio <hello@antl.io>",