@vitest-agent/ui 5.2.2 → 6.0.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.
package/counts.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { VitestAgentStatus } from "./theme.js";
2
- import { Doc, Render } from "@effected/cli";
2
+ import { Doc, Render } from "@effected/cli-kit";
3
3
 
4
4
  // src/counts.ts
5
5
  /** The test counters a totals line folds into its `n/total`. */
@@ -1,7 +1,7 @@
1
1
  import { buildFooter } from "../footer.js";
2
2
  import { formatDisplayDuration } from "../../format-duration.js";
3
3
  import { soleModulePath } from "../helpers.js";
4
- import { Fmt } from "@effected/cli";
4
+ import { Fmt } from "@effected/cli-kit";
5
5
 
6
6
  // src/dispatcher/cells/single-file-pass.ts
7
7
  const renderAgent = (inputs) => {
@@ -1,7 +1,7 @@
1
1
  import { buildFooter } from "../footer.js";
2
2
  import { formatDisplayDuration } from "../../format-duration.js";
3
3
  import { formatCoverageSummaryLines, soleModulePath } from "../helpers.js";
4
- import { Fmt } from "@effected/cli";
4
+ import { Fmt } from "@effected/cli-kit";
5
5
 
6
6
  // src/dispatcher/cells/single-file-threshold.ts
7
7
  const renderAgent = (inputs) => {
@@ -1,6 +1,6 @@
1
1
  import { buildFooter } from "../footer.js";
2
2
  import { formatTotals } from "../helpers.js";
3
- import { Fmt } from "@effected/cli";
3
+ import { Fmt } from "@effected/cli-kit";
4
4
 
5
5
  // src/dispatcher/cells/single-project-pass.ts
6
6
  const renderAgent = (inputs) => {
@@ -1,5 +1,5 @@
1
- import { buildFooter } from "../footer.js";
2
1
  import { statusGlyph } from "../../theme.js";
2
+ import { buildFooter } from "../footer.js";
3
3
  import { formatDisplayDuration } from "../../format-duration.js";
4
4
  import { formatFailure, formatTestName, soleTest } from "../helpers.js";
5
5
 
@@ -1,5 +1,5 @@
1
- import { buildFooter } from "../footer.js";
2
1
  import { statusGlyph } from "../../theme.js";
2
+ import { buildFooter } from "../footer.js";
3
3
  import { formatDisplayDuration } from "../../format-duration.js";
4
4
  import { formatTestName, soleTest } from "../helpers.js";
5
5
 
@@ -1,4 +1,3 @@
1
- import { formatSuggestedActionLines } from "./helpers.js";
2
1
  import { renderSingleFileFail } from "./cells/single-file-fail.js";
3
2
  import { renderSingleFilePass } from "./cells/single-file-pass.js";
4
3
  import { renderSingleFileThreshold } from "./cells/single-file-threshold.js";
@@ -11,6 +10,7 @@ import { renderSingleTestThreshold } from "./cells/single-test-threshold.js";
11
10
  import { renderWorkspaceFail } from "./cells/workspace-fail.js";
12
11
  import { renderWorkspacePass } from "./cells/workspace-pass.js";
13
12
  import { renderWorkspaceThreshold } from "./cells/workspace-threshold.js";
13
+ import { formatSuggestedActionLines } from "./helpers.js";
14
14
  import { formatConsoleLeaksNote, formatScopedCoverageNote, formatStrayOutputNote } from "@vitest-agent/sdk";
15
15
 
16
16
  // src/dispatcher/dispatch.ts
@@ -1,7 +1,7 @@
1
- import { statusGlyph } from "../theme.js";
2
1
  import { formatTotalsLine } from "../counts.js";
3
2
  import { formatDisplayDuration } from "../format-duration.js";
4
- import { Doc, Fmt, Render } from "@effected/cli";
3
+ import { statusGlyph } from "../theme.js";
4
+ import { Doc, Fmt, Render } from "@effected/cli-kit";
5
5
 
6
6
  // src/dispatcher/helpers.ts
7
7
  /**
@@ -1,4 +1,4 @@
1
- import { Fmt } from "@effected/cli";
1
+ import { Fmt } from "@effected/cli-kit";
2
2
 
3
3
  // src/format-duration.ts
4
4
  /**
@@ -9,7 +9,7 @@ import { Fmt } from "@effected/cli";
9
9
  * the single formatter every render path calls — `render-agent.ts`,
10
10
  * the `render-ink/` components, the dispatcher cells, and `StreamApp`
11
11
  * — so a duration looks the same wherever it appears. It delegates to
12
- * `@effected/cli`'s `Fmt.duration`, so it also matches every other kit
12
+ * `@effected/cli-kit`'s `Fmt.duration`, so it also matches every other kit
13
13
  * CLI's output.
14
14
  *
15
15
  * Display only. Full-precision durations continue to persist to the
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Schema } from "effect";
2
- import { CoreStatusName, GlyphSet, Status, Style, TokenName } from "@effected/cli";
2
+ import { CoreStatusName, GlyphSet, Status, Style, TokenName } from "@effected/cli-kit";
3
3
  /**
4
4
  * Aggregate coverage percentages across four istanbul metrics.
5
5
  * @public
@@ -522,7 +522,7 @@ interface DispatchInputs {
522
522
  /**
523
523
  * Where a file link points: a path, with an optional line and column.
524
524
  *
525
- * The file half of `@effected/cli`'s `LinkTarget`, spelled structurally so
525
+ * The file half of `@effected/cli-kit`'s `LinkTarget`, spelled structurally so
526
526
  * this platform-free contract names no kit type. A relative path resolves
527
527
  * against the working directory the kit's `CliLinks` layer was built with.
528
528
  * @public
@@ -546,7 +546,7 @@ interface CellOptions {
546
546
  * Writes a file path as a link for the audience and terminal the output
547
547
  * is for: the label wrapped in an OSC 8 hyperlink when the reader can
548
548
  * follow it, the label unchanged otherwise. The kit decides both halves
549
- * (`@effected/cli`'s `CliLinks.linker`, `Render.context("stdout").link`):
549
+ * (`@effected/cli-kit`'s `CliLinks.linker`, `Render.context("stdout").link`):
550
550
  * `vscode://file/<path>:<line>:<col>` under VS Code, `file://` otherwise,
551
551
  * never for an agent audience, and nothing on a terminal that cannot
552
552
  * render hyperlinks (a pipe, tmux, GNU screen, `NO_COLOR`).
@@ -1314,7 +1314,7 @@ export declare const buildFooter: (inputs: DispatchInputs) => string;
1314
1314
  * the single formatter every render path calls — `render-agent.ts`,
1315
1315
  * the `render-ink/` components, the dispatcher cells, and `StreamApp`
1316
1316
  * — so a duration looks the same wherever it appears. It delegates to
1317
- * `@effected/cli`'s `Fmt.duration`, so it also matches every other kit
1317
+ * `@effected/cli-kit`'s `Fmt.duration`, so it also matches every other kit
1318
1318
  * CLI's output.
1319
1319
  *
1320
1320
  * Display only. Full-precision durations continue to persist to the
@@ -1588,15 +1588,19 @@ interface InkTextStyle {
1588
1588
  readonly underline?: boolean;
1589
1589
  }
1590
1590
  /**
1591
- * Ink `<Text>` props for a semantic token or an explicit style.
1591
+ * Ink `<Text>` props for a semantic token or an explicit style, from the
1592
+ * default palette.
1592
1593
  *
1593
1594
  * @remarks
1594
1595
  * Resolves the token through the kit's pure `Token.resolve` and maps the
1595
- * `Style` with the kit's `inkProps`. No colour level reaches this call
1596
- * site, so `inkProps` with no level emits every prop and Ink's own chalk
1597
- * level, set by `CliUi.live` or `CliUi.context`, gates what is drawn.
1596
+ * `Style` with the kit's `inkProps`. It sees no mounted theme, so a consumer's
1597
+ * token override never reaches it. No colour level reaches this call site
1598
+ * either, so `inkProps` with no level emits every prop and Ink's own chalk
1599
+ * level gates what is drawn.
1598
1600
  *
1599
1601
  * @param token - a token name or a `Style`
1602
+ * @deprecated Ignores the mounted theme. In a component use `useStyle` or
1603
+ * `Styled` from `@effected/cli-kit/ui`, which take the same token.
1600
1604
  * @public
1601
1605
  */
1602
1606
  export declare const inkStyle: (token: TokenName | Style) => InkTextStyle;
@@ -1610,9 +1614,12 @@ export declare const inkStyle: (token: TokenName | Style) => InkTextStyle;
1610
1614
  */
1611
1615
  export declare const statusGlyph: (name: VitestAgentStatusName, glyphs?: GlyphSet) => string;
1612
1616
  /**
1613
- * Ink `<Text>` props for a status's glyph.
1617
+ * Ink `<Text>` props for a status's glyph, from the default palette.
1614
1618
  *
1615
1619
  * @param name - a status in {@link VitestAgentStatus}
1620
+ * @deprecated Ignores the mounted theme. In a component pass
1621
+ * `VitestAgentStatus.def(name).token` to `useStyle` or `Styled` from
1622
+ * `@effected/cli-kit/ui`.
1616
1623
  * @public
1617
1624
  */
1618
1625
  export declare const statusInkStyle: (name: VitestAgentStatusName) => InkTextStyle;
package/index.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import { classifyOutcome, classifyRunShape } from "./dispatcher/classify.js";
2
+ import { dispatch, dispatcherTable } from "./dispatcher/dispatch.js";
2
3
  import { buildFooter, dominantClassification } from "./dispatcher/footer.js";
3
- import { VitestAgentStatus, VitestAgentTokens, inkStyle, statusGlyph, statusInkStyle } from "./theme.js";
4
- import { formatDisplayDuration } from "./format-duration.js";
5
4
  import { formatSuggestedActionLines } from "./dispatcher/helpers.js";
6
- import { dispatch, dispatcherTable } from "./dispatcher/dispatch.js";
5
+ import { formatDisplayDuration } from "./format-duration.js";
7
6
  import { reduceRenderState, reduceRenderStateAll } from "./reducer.js";
8
7
  import { renderAgent } from "./render-agent.js";
9
8
  import { SPINNER_FRAMES, SPINNER_FRAME_MS, spinnerFrame } from "./spinner.js";
10
9
  import { SUITE_FAILURE_LABEL, SUITE_LOAD_FAILURE_LABEL, synthesizeFromAgentReport, synthesizeRunEvents } from "./synthesize.js";
10
+ import { VitestAgentStatus, VitestAgentTokens, inkStyle, statusGlyph, statusInkStyle } from "./theme.js";
11
11
  import { ActionSeverity, CoverageFile, CoverageGap, CoverageMetric, CoverageRenderState, FailureRecord, ModuleRecord, RenderState, RenderTotals, RunEvent, SuggestedActionRecord, TestRecord, initialRenderState } from "@vitest-agent/sdk";
12
12
 
13
13
  // src/index.ts
@@ -18,6 +18,6 @@ import { ActionSeverity, CoverageFile, CoverageGap, CoverageMetric, CoverageRend
18
18
  *
19
19
  * @public
20
20
  */
21
- const CURRENT_UI_VERSION = "5.2.2";
21
+ const CURRENT_UI_VERSION = "6.0.0";
22
22
 
23
23
  export { ActionSeverity, CURRENT_UI_VERSION, CoverageFile, CoverageGap, CoverageMetric, CoverageRenderState, FailureRecord, ModuleRecord, RenderState, RenderTotals, RunEvent, SPINNER_FRAMES, SPINNER_FRAME_MS, SUITE_FAILURE_LABEL, SUITE_LOAD_FAILURE_LABEL, SuggestedActionRecord, TestRecord, VitestAgentStatus, VitestAgentTokens, buildFooter, classifyOutcome, classifyRunShape, dispatch, dispatcherTable, dominantClassification, formatDisplayDuration, formatSuggestedActionLines, initialRenderState, inkStyle, reduceRenderState, reduceRenderStateAll, renderAgent, spinnerFrame, statusGlyph, statusInkStyle, synthesizeFromAgentReport, synthesizeRunEvents };
@@ -1,6 +1,6 @@
1
- import { VitestAgentTokens, inkStyle, statusGlyph, statusInkStyle } from "../theme.js";
2
- import { Fmt } from "@effected/cli";
3
- import { useGlyphs } from "@effected/cli/ui";
1
+ import { VitestAgentTokens, statusGlyph, statusToken } from "../theme.js";
2
+ import { Fmt } from "@effected/cli-kit";
3
+ import { Styled, useGlyphs } from "@effected/cli-kit/ui";
4
4
  import { Text } from "ink";
5
5
  import { jsxs } from "react/jsx-runtime";
6
6
 
@@ -13,8 +13,8 @@ import { jsxs } from "react/jsx-runtime";
13
13
  * @public
14
14
  */
15
15
  const DURATION_CELL_WIDTH = 7;
16
- const cell = (count, status, glyphs) => /* @__PURE__ */ jsxs(Text, {
17
- ...count > 0 ? statusInkStyle(status) : inkStyle(VitestAgentTokens.zero),
16
+ const cell = (count, status, glyphs) => /* @__PURE__ */ jsxs(Styled, {
17
+ token: count > 0 ? statusToken(status) : VitestAgentTokens.zero,
18
18
  children: [Fmt.pad(String(count), 4, { align: "right" }), statusGlyph(status, glyphs)]
19
19
  });
20
20
  /**
@@ -1,6 +1,6 @@
1
- import { inkStyle } from "../theme.js";
2
1
  import { useFileLink } from "./FileLink.js";
3
- import { Fmt } from "@effected/cli";
2
+ import { Fmt } from "@effected/cli-kit";
3
+ import { useStyle } from "@effected/cli-kit/ui";
4
4
  import { Box, Text } from "ink";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
 
@@ -16,8 +16,6 @@ const METRIC_ORDER = [
16
16
  ];
17
17
  /** Coverage metrics arrive on istanbul's 0–100 scale. */
18
18
  const formatPercent = (n) => Fmt.percent(n, { scale: 100 });
19
- /** A metric below its threshold is a coverage threshold failure: the kit's `failure` token. */
20
- const FAILURE = inkStyle("failure");
21
19
  /**
22
20
  * Renders the coverage section: per-metric percentages, threshold
23
21
  * violations, and top-N gap entries sorted by missing line count.
@@ -29,6 +27,7 @@ const CoverageBlock = ({ coverage, maxGaps = 3 }) => {
29
27
  const topGaps = maxGaps > 0 ? sortedGaps.slice(0, maxGaps) : [];
30
28
  const elidedGaps = maxGaps > 0 ? coverage.gaps.length - topGaps.length : 0;
31
29
  const link = useFileLink();
30
+ const failure = useStyle("failure");
32
31
  return /* @__PURE__ */ jsxs(Box, {
33
32
  flexDirection: "column",
34
33
  children: [
@@ -43,7 +42,7 @@ const CoverageBlock = ({ coverage, maxGaps = 3 }) => {
43
42
  return /* @__PURE__ */ jsxs(Box, { children: [
44
43
  /* @__PURE__ */ jsx(Text, { children: ` ${metric}: ` }),
45
44
  failing ? /* @__PURE__ */ jsx(Text, {
46
- ...FAILURE,
45
+ ...failure,
47
46
  children: formatPercent(actual)
48
47
  }) : /* @__PURE__ */ jsx(Text, { children: formatPercent(actual) }),
49
48
  threshold !== void 0 ? /* @__PURE__ */ jsxs(Text, {
@@ -59,10 +58,10 @@ const CoverageBlock = ({ coverage, maxGaps = 3 }) => {
59
58
  coverage.violations.length > 0 ? /* @__PURE__ */ jsxs(Box, {
60
59
  flexDirection: "column",
61
60
  children: [/* @__PURE__ */ jsx(Text, {
62
- ...FAILURE,
61
+ ...failure,
63
62
  children: "Violations"
64
63
  }), coverage.violations.map((v) => /* @__PURE__ */ jsx(Text, {
65
- ...FAILURE,
64
+ ...failure,
66
65
  children: ` ${v.metric}: ${formatPercent(v.actual)} < ${formatPercent(v.expected)}`
67
66
  }, v.metric))]
68
67
  }) : null,
@@ -1,6 +1,6 @@
1
- import { inkStyle, statusGlyph, statusInkStyle } from "../theme.js";
1
+ import { statusGlyph, statusToken } from "../theme.js";
2
2
  import { useFileLink } from "./FileLink.js";
3
- import { useGlyphs } from "@effected/cli/ui";
3
+ import { Styled, useGlyphs, useStyle } from "@effected/cli-kit/ui";
4
4
  import { Box, Text } from "ink";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
 
@@ -14,12 +14,14 @@ const FailureRow = ({ failure, includeStack }) => {
14
14
  const classification = failure.classification !== null ? ` [${failure.classification}]` : "";
15
15
  const glyphs = useGlyphs();
16
16
  const link = useFileLink();
17
+ const failureStyle = useStyle("failure");
18
+ const successStyle = useStyle("success");
17
19
  return /* @__PURE__ */ jsxs(Box, {
18
20
  flexDirection: "column",
19
21
  children: [
20
22
  /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Text, { children: [
21
- /* @__PURE__ */ jsx(Text, {
22
- ...statusInkStyle("failure"),
23
+ /* @__PURE__ */ jsx(Styled, {
24
+ token: statusToken("failure"),
23
25
  children: statusGlyph("failure", glyphs)
24
26
  }),
25
27
  ` ${link({ file: failure.modulePath }, failure.modulePath)} > ${suite}${failure.testName}`,
@@ -29,17 +31,17 @@ const FailureRow = ({ failure, includeStack }) => {
29
31
  }) : null
30
32
  ] }) }),
31
33
  failure.error?.message !== void 0 ? /* @__PURE__ */ jsx(Text, {
32
- ...inkStyle("failure"),
34
+ ...failureStyle,
33
35
  children: ` ${failure.error.message.split("\n", 1)[0] ?? ""}`
34
36
  }) : null,
35
37
  failure.error?.diff !== void 0 ? failure.error.diff.split("\n").map((line, idx) => {
36
38
  const key = `diff-${idx}`;
37
39
  if (line.startsWith("-")) return /* @__PURE__ */ jsx(Text, {
38
- ...inkStyle("failure"),
40
+ ...failureStyle,
39
41
  children: ` ${line}`
40
42
  }, key);
41
43
  if (line.startsWith("+")) return /* @__PURE__ */ jsx(Text, {
42
- ...inkStyle("success"),
44
+ ...successStyle,
43
45
  children: ` ${line}`
44
46
  }, key);
45
47
  return /* @__PURE__ */ jsx(Text, { children: ` ${line}` }, key);
@@ -1,6 +1,6 @@
1
- import { VitestAgentTokens, inkStyle, statusGlyph, statusInkStyle } from "../theme.js";
1
+ import { VitestAgentTokens, statusGlyph, statusToken } from "../theme.js";
2
2
  import { useFileLink } from "./FileLink.js";
3
- import { useGlyphs } from "@effected/cli/ui";
3
+ import { Styled, useGlyphs } from "@effected/cli-kit/ui";
4
4
  import { Box, Text } from "ink";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
 
@@ -51,14 +51,14 @@ const FailuresSection = ({ failures, limit }) => {
51
51
  children: [
52
52
  /* @__PURE__ */ jsxs(Text, { children: [
53
53
  " ",
54
- /* @__PURE__ */ jsx(Text, {
55
- ...statusInkStyle(failureStatus(f)),
54
+ /* @__PURE__ */ jsx(Styled, {
55
+ token: statusToken(failureStatus(f)),
56
56
  children: statusGlyph(failureStatus(f), glyphs)
57
57
  }),
58
58
  " ",
59
59
  pathOf(f, link),
60
- f.classification !== null ? /* @__PURE__ */ jsxs(Text, {
61
- ...inkStyle(VitestAgentTokens.classification),
60
+ f.classification !== null ? /* @__PURE__ */ jsxs(Styled, {
61
+ token: VitestAgentTokens.classification,
62
62
  children: [
63
63
  " [",
64
64
  f.classification,
package/ink/ProjectRow.js CHANGED
@@ -1,9 +1,10 @@
1
- import { statusInkStyle } from "../theme.js";
2
1
  import { formatDisplayDuration } from "../format-duration.js";
2
+ import { statusToken } from "../theme.js";
3
3
  import { CountColumns, DURATION_CELL_WIDTH } from "./CountColumns.js";
4
4
  import { StatusIcon } from "./StatusIcon.js";
5
5
  import { TagColumns } from "./TagColumns.js";
6
- import { Fmt } from "@effected/cli";
6
+ import { Fmt } from "@effected/cli-kit";
7
+ import { Styled } from "@effected/cli-kit/ui";
7
8
  import { Box, Text } from "ink";
8
9
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
10
 
@@ -21,8 +22,8 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
21
22
  * failures, no timeouts) resolve to `↷`, not a false-positive `✓`.
22
23
  */
23
24
  const projectGlyph = (counts, running, timedOut, frame) => {
24
- if (running && !timedOut) return /* @__PURE__ */ jsx(Text, {
25
- ...statusInkStyle("running"),
25
+ if (running && !timedOut) return /* @__PURE__ */ jsx(Styled, {
26
+ token: statusToken("running"),
26
27
  children: frame
27
28
  });
28
29
  if (counts.failCount > 0) return /* @__PURE__ */ jsx(StatusIcon, { status: "failed" });
package/ink/StatusIcon.js CHANGED
@@ -1,6 +1,5 @@
1
- import { statusGlyph, statusInkStyle } from "../theme.js";
2
- import { useGlyphs } from "@effected/cli/ui";
3
- import { Text } from "ink";
1
+ import { statusGlyph, statusToken } from "../theme.js";
2
+ import { Styled, useGlyphs } from "@effected/cli-kit/ui";
4
3
  import { jsx } from "react/jsx-runtime";
5
4
 
6
5
  // src/ink/StatusIcon.tsx
@@ -33,8 +32,8 @@ const STATUS = {
33
32
  */
34
33
  const StatusIcon = ({ status }) => {
35
34
  const glyphs = useGlyphs();
36
- return /* @__PURE__ */ jsx(Text, {
37
- ...statusInkStyle(STATUS[status]),
35
+ return /* @__PURE__ */ jsx(Styled, {
36
+ token: statusToken(STATUS[status]),
38
37
  children: statusGlyph(STATUS[status], glyphs)
39
38
  });
40
39
  };
package/ink/StreamApp.js CHANGED
@@ -1,17 +1,17 @@
1
1
  import { classifyRunShape } from "../dispatcher/classify.js";
2
- import { VitestAgentTokens, inkStyle, statusGlyph, statusInkStyle } from "../theme.js";
3
2
  import { formatDisplayDuration } from "../format-duration.js";
4
3
  import { spinnerFrame } from "../spinner.js";
4
+ import { VitestAgentTokens, statusGlyph, statusToken } from "../theme.js";
5
5
  import { CountColumns, DURATION_CELL_WIDTH } from "./CountColumns.js";
6
6
  import { useFileLink } from "./FileLink.js";
7
+ import { ProjectRow } from "./ProjectRow.js";
7
8
  import { StatusIcon } from "./StatusIcon.js";
8
9
  import { TagColumns, tagUnion } from "./TagColumns.js";
9
- import { ProjectRow } from "./ProjectRow.js";
10
10
  import { TestRow } from "./TestRow.js";
11
11
  import { TrendLine } from "./TrendLine.js";
12
12
  import { formatConsoleLeaksNote, formatStrayOutputNote } from "@vitest-agent/sdk";
13
- import { Fmt } from "@effected/cli";
14
- import { useGlyphs } from "@effected/cli/ui";
13
+ import { Fmt } from "@effected/cli-kit";
14
+ import { Styled, useGlyphs, useStyle } from "@effected/cli-kit/ui";
15
15
  import { Box, Text } from "ink";
16
16
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
17
17
 
@@ -123,8 +123,8 @@ const ModuleStreamRow = ({ module, nowMs, frame, nameWidth, timedOut, tagUnion:
123
123
  children: " not started — killed before reaching this module"
124
124
  });
125
125
  } else glyph = /* @__PURE__ */ jsx(StatusIcon, { status: "timed-out" });
126
- } else if (running) glyph = /* @__PURE__ */ jsx(Text, {
127
- ...statusInkStyle("running"),
126
+ } else if (running) glyph = /* @__PURE__ */ jsx(Styled, {
127
+ token: statusToken("running"),
128
128
  children: frame
129
129
  });
130
130
  else glyph = /* @__PURE__ */ jsx(StatusIcon, { status: moduleIcon(module) });
@@ -194,8 +194,8 @@ const UnhandledErrorItem = ({ error }) => {
194
194
  flexDirection: "column",
195
195
  children: [/* @__PURE__ */ jsxs(Text, { children: [
196
196
  " ",
197
- /* @__PURE__ */ jsx(Text, {
198
- ...statusInkStyle("failure"),
197
+ /* @__PURE__ */ jsx(Styled, {
198
+ token: statusToken("failure"),
199
199
  children: statusGlyph("failure", glyphs)
200
200
  }),
201
201
  " unhandled error"
@@ -220,14 +220,14 @@ const FailureItem = ({ failure }) => {
220
220
  flexDirection: "column",
221
221
  children: [/* @__PURE__ */ jsxs(Text, { children: [
222
222
  " ",
223
- /* @__PURE__ */ jsx(Text, {
224
- ...statusInkStyle(failureStatus(failure)),
223
+ /* @__PURE__ */ jsx(Styled, {
224
+ token: statusToken(failureStatus(failure)),
225
225
  children: statusGlyph(failureStatus(failure), glyphs)
226
226
  }),
227
227
  " ",
228
228
  failurePath(failure, link),
229
- failure.classification !== null ? /* @__PURE__ */ jsxs(Text, {
230
- ...inkStyle(VitestAgentTokens.classification),
229
+ failure.classification !== null ? /* @__PURE__ */ jsxs(Styled, {
230
+ token: VitestAgentTokens.classification,
231
231
  children: [
232
232
  " [",
233
233
  failure.classification,
@@ -237,6 +237,16 @@ const FailureItem = ({ failure }) => {
237
237
  ] }), /* @__PURE__ */ jsx(InlineError, { failure })]
238
238
  });
239
239
  };
240
+ /** The bold line above the totals when the run timed out. */
241
+ const RunTimedOutLine = () => {
242
+ const glyphs = useGlyphs();
243
+ const style = useStyle(statusToken("timeout"));
244
+ return /* @__PURE__ */ jsxs(Text, {
245
+ ...style,
246
+ bold: true,
247
+ children: [statusGlyph("timeout", glyphs), " Run timed out"]
248
+ });
249
+ };
240
250
  /**
241
251
  * The bottom `Total:` rollup line. In the workspace view `labelWidth`
242
252
  * pads the label to the project-row prefix width so the count columns
@@ -274,8 +284,8 @@ const CoverageItem = ({ state }) => {
274
284
  children: "Coverage:"
275
285
  }),
276
286
  " ",
277
- /* @__PURE__ */ jsx(Text, {
278
- ...statusInkStyle(status),
287
+ /* @__PURE__ */ jsx(Styled, {
288
+ token: statusToken(status),
279
289
  children: statusGlyph(status, glyphs)
280
290
  }),
281
291
  " ",
@@ -338,11 +348,7 @@ const liveRegion = (state, shape, nowMs, frame, glyphs, link) => {
338
348
  const trendItem = state.trend !== null ? /* @__PURE__ */ jsx(TrendLine, { trend: state.trend }) : null;
339
349
  const totalsItem = (labelWidth) => /* @__PURE__ */ jsxs(Box, {
340
350
  flexDirection: "column",
341
- children: [finished && timedOut ? /* @__PURE__ */ jsxs(Text, {
342
- ...statusInkStyle("timeout"),
343
- bold: true,
344
- children: [statusGlyph("timeout", glyphs), " Run timed out"]
345
- }) : null, /* @__PURE__ */ jsx(TotalsLine, {
351
+ children: [finished && timedOut ? /* @__PURE__ */ jsx(RunTimedOutLine, {}) : null, /* @__PURE__ */ jsx(TotalsLine, {
346
352
  totals: state.totals,
347
353
  labelWidth
348
354
  })]
@@ -509,6 +515,7 @@ const StreamApp = ({ state, frameIndex, nowMs }) => {
509
515
  const now = nowMs ?? Date.now();
510
516
  const glyphs = useGlyphs();
511
517
  const link = useFileLink();
518
+ const warningStyle = useStyle(statusToken("warning"));
512
519
  const frame = spinnerFrame(frameIndex, glyphs);
513
520
  const projects = groupByProject(state).map((g) => buildProjectSummary(g.name, sumCounts(g.modules)));
514
521
  const shape = classifyRunShape(state, projects);
@@ -524,7 +531,7 @@ const StreamApp = ({ state, frameIndex, nowMs }) => {
524
531
  flexDirection: "column",
525
532
  marginTop: 1,
526
533
  children: stray.map((line, i) => /* @__PURE__ */ jsx(Text, {
527
- ...i === 0 ? statusInkStyle("warning") : {},
534
+ ...i === 0 ? warningStyle : {},
528
535
  children: line
529
536
  }, `stray:${i}`))
530
537
  }) : null,
@@ -532,7 +539,7 @@ const StreamApp = ({ state, frameIndex, nowMs }) => {
532
539
  flexDirection: "column",
533
540
  marginTop: 1,
534
541
  children: leaks.map((line, i) => /* @__PURE__ */ jsx(Text, {
535
- ...i === 0 ? statusInkStyle("warning") : {},
542
+ ...i === 0 ? warningStyle : {},
536
543
  children: line
537
544
  }, `leaks:${i}`))
538
545
  }) : null
@@ -1,5 +1,5 @@
1
- import { inkStyle } from "../theme.js";
2
- import { Token } from "@effected/cli";
1
+ import { Token } from "@effected/cli-kit";
2
+ import { useStyle } from "@effected/cli-kit/ui";
3
3
  import { Box, Text } from "ink";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
5
 
@@ -9,6 +9,15 @@ const SEVERITY_TOKEN = {
9
9
  warn: "warning",
10
10
  blocker: "failure"
11
11
  };
12
+ /** One action's bold severity label: a component so the hook runs once per row. */
13
+ const SeverityLabel = ({ severity }) => {
14
+ const style = useStyle(SEVERITY_TOKEN[severity]);
15
+ return /* @__PURE__ */ jsx(Text, {
16
+ ...style,
17
+ bold: true,
18
+ children: ` ${severity}: `
19
+ });
20
+ };
12
21
  /**
13
22
  * Renders the suggested-actions queue as severity-prefixed rows with
14
23
  * optional tool hints. Returns `null` when the actions list is empty.
@@ -25,11 +34,7 @@ const SuggestedActions = ({ actions }) => {
25
34
  }), actions.map((action, idx) => /* @__PURE__ */ jsxs(Box, {
26
35
  flexDirection: "column",
27
36
  children: [/* @__PURE__ */ jsxs(Box, { children: [
28
- /* @__PURE__ */ jsx(Text, {
29
- ...inkStyle(SEVERITY_TOKEN[action.severity]),
30
- bold: true,
31
- children: ` ${action.severity}: `
32
- }),
37
+ /* @__PURE__ */ jsx(SeverityLabel, { severity: action.severity }),
33
38
  /* @__PURE__ */ jsx(Text, { children: action.title }),
34
39
  action.targetTool !== void 0 ? /* @__PURE__ */ jsxs(Text, {
35
40
  dimColor: true,
package/ink/TagColumns.js CHANGED
@@ -1,5 +1,6 @@
1
- import { VitestAgentTokens, inkStyle } from "../theme.js";
2
- import { Fmt } from "@effected/cli";
1
+ import { VitestAgentTokens } from "../theme.js";
2
+ import { Fmt } from "@effected/cli-kit";
3
+ import { Styled } from "@effected/cli-kit/ui";
3
4
  import { Text } from "ink";
4
5
  import { jsx, jsxs } from "react/jsx-runtime";
5
6
 
@@ -35,8 +36,8 @@ const TagColumns = ({ tags, counts }) => {
35
36
  if (tags.length === 0) return null;
36
37
  return /* @__PURE__ */ jsx(Text, { children: tags.map((tag, i) => {
37
38
  const count = counts?.[tag] ?? 0;
38
- return /* @__PURE__ */ jsxs(Text, {
39
- ...inkStyle(count > 0 ? VitestAgentTokens.tag : VitestAgentTokens.zero),
39
+ return /* @__PURE__ */ jsxs(Styled, {
40
+ token: count > 0 ? VitestAgentTokens.tag : VitestAgentTokens.zero,
40
41
  children: [
41
42
  i > 0 ? " " : "",
42
43
  tag,
package/ink/TrendLine.js CHANGED
@@ -1,5 +1,6 @@
1
- import { VitestAgentTokens, inkStyle } from "../theme.js";
2
- import { Fmt } from "@effected/cli";
1
+ import { VitestAgentTokens } from "../theme.js";
2
+ import { Fmt } from "@effected/cli-kit";
3
+ import { Styled } from "@effected/cli-kit/ui";
3
4
  import { Text } from "ink";
4
5
  import { jsx, jsxs } from "react/jsx-runtime";
5
6
 
@@ -23,8 +24,8 @@ const TrendLine = ({ trend }) => {
23
24
  children: "Trend:"
24
25
  }),
25
26
  " ",
26
- /* @__PURE__ */ jsx(Text, {
27
- ...inkStyle(TOKEN[trend.direction]),
27
+ /* @__PURE__ */ jsx(Styled, {
28
+ token: TOKEN[trend.direction],
28
29
  children: trend.direction
29
30
  }),
30
31
  /* @__PURE__ */ jsxs(Text, {
@@ -42,6 +42,11 @@ const inkDispatcherTable = {
42
42
  * note on a partial run. Returns `null` when the matched cell has no Ink
43
43
  * half — callers fall back to the root entry's `dispatch` string then.
44
44
  *
45
+ * @remarks
46
+ * Calling this needs no React context, but drawing the element does: the cells
47
+ * paint through the mounted theme, so it must render inside the kit's providers
48
+ * (a `CliUi` screen, or a `UiProvider` holding `CliUi.context`'s value).
49
+ *
45
50
  * @param inputs - the classified dispatch inputs
46
51
  * @param opts - cell rendering options
47
52
  * @returns the Ink React element, or `null` when the cell has no Ink half
@@ -1,4 +1,5 @@
1
- import { inkStyle, statusGlyph, statusInkStyle } from "../theme.js";
1
+ import { statusGlyph, statusToken } from "../theme.js";
2
+ import { Styled } from "@effected/cli-kit/ui";
2
3
  import { Box, Text } from "ink";
3
4
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
5
 
@@ -21,8 +22,8 @@ const glyphLine = (line, glyph, status) => {
21
22
  const idx = line.indexOf(glyph);
22
23
  return /* @__PURE__ */ jsxs(Fragment, { children: [
23
24
  line.slice(0, idx),
24
- /* @__PURE__ */ jsx(Text, {
25
- ...statusInkStyle(status),
25
+ /* @__PURE__ */ jsx(Styled, {
26
+ token: statusToken(status),
26
27
  children: glyph
27
28
  }),
28
29
  line.slice(idx + glyph.length)
@@ -45,8 +46,8 @@ const colorize = (line) => {
45
46
  const trimmed = line.trimStart();
46
47
  if (trimmed.startsWith(SUCCESS_GLYPH)) return glyphLine(line, SUCCESS_GLYPH, "success");
47
48
  if (trimmed.startsWith(FAILURE_GLYPH)) return glyphLine(line, FAILURE_GLYPH, "failure");
48
- for (const [prefix, token] of LINE_STYLES) if (line.startsWith(prefix)) return /* @__PURE__ */ jsx(Text, {
49
- ...inkStyle(token),
49
+ for (const [prefix, token] of LINE_STYLES) if (line.startsWith(prefix)) return /* @__PURE__ */ jsx(Styled, {
50
+ token,
50
51
  children: line
51
52
  });
52
53
  return line;
package/ink.d.ts CHANGED
@@ -460,7 +460,7 @@ interface DispatchInputs {
460
460
  /**
461
461
  * Where a file link points: a path, with an optional line and column.
462
462
  *
463
- * The file half of `@effected/cli`'s `LinkTarget`, spelled structurally so
463
+ * The file half of `@effected/cli-kit`'s `LinkTarget`, spelled structurally so
464
464
  * this platform-free contract names no kit type. A relative path resolves
465
465
  * against the working directory the kit's `CliLinks` layer was built with.
466
466
  * @public
@@ -484,7 +484,7 @@ interface CellOptions {
484
484
  * Writes a file path as a link for the audience and terminal the output
485
485
  * is for: the label wrapped in an OSC 8 hyperlink when the reader can
486
486
  * follow it, the label unchanged otherwise. The kit decides both halves
487
- * (`@effected/cli`'s `CliLinks.linker`, `Render.context("stdout").link`):
487
+ * (`@effected/cli-kit`'s `CliLinks.linker`, `Render.context("stdout").link`):
488
488
  * `vscode://file/<path>:<line>:<col>` under VS Code, `file://` otherwise,
489
489
  * never for an agent audience, and nothing on a terminal that cannot
490
490
  * render hyperlinks (a pipe, tmux, GNU screen, `NO_COLOR`).
@@ -566,6 +566,11 @@ export declare const inkDispatcherTable: Readonly<Record<RunShape, Readonly<Reco
566
566
  * note on a partial run. Returns `null` when the matched cell has no Ink
567
567
  * half — callers fall back to the root entry's `dispatch` string then.
568
568
  *
569
+ * @remarks
570
+ * Calling this needs no React context, but drawing the element does: the cells
571
+ * paint through the mounted theme, so it must render inside the kit's providers
572
+ * (a `CliUi` screen, or a `UiProvider` holding `CliUi.context`'s value).
573
+ *
569
574
  * @param inputs - the classified dispatch inputs
570
575
  * @param opts - cell rendering options
571
576
  * @returns the Ink React element, or `null` when the cell has no Ink half
package/ink.js CHANGED
@@ -1,16 +1,16 @@
1
1
  import { CountColumns, DURATION_CELL_WIDTH } from "./ink/CountColumns.js";
2
- import { FileLinkProvider, useFileLink } from "./ink/FileLink.js";
3
2
  import { CoverageBlock } from "./ink/CoverageBlock.js";
4
3
  import { dispatchInk, inkDispatcherTable } from "./ink/dispatch-ink.js";
5
4
  import { FailureSection } from "./ink/FailureSection.js";
6
5
  import { FailuresSection } from "./ink/FailuresSection.js";
7
- import { StatusIcon } from "./ink/StatusIcon.js";
6
+ import { FileLinkProvider, useFileLink } from "./ink/FileLink.js";
8
7
  import { ModuleHeader } from "./ink/ModuleHeader.js";
9
- import { TagColumns, tagUnion } from "./ink/TagColumns.js";
10
8
  import { ProjectRow } from "./ink/ProjectRow.js";
11
- import { TestRow } from "./ink/TestRow.js";
12
- import { TrendLine } from "./ink/TrendLine.js";
9
+ import { StatusIcon } from "./ink/StatusIcon.js";
13
10
  import { StreamApp } from "./ink/StreamApp.js";
14
11
  import { SuggestedActions } from "./ink/SuggestedActions.js";
12
+ import { TagColumns, tagUnion } from "./ink/TagColumns.js";
13
+ import { TestRow } from "./ink/TestRow.js";
14
+ import { TrendLine } from "./ink/TrendLine.js";
15
15
 
16
16
  export { CountColumns, CoverageBlock, DURATION_CELL_WIDTH, FailureSection, FailuresSection, FileLinkProvider, ModuleHeader, ProjectRow, StatusIcon, StreamApp, SuggestedActions, TagColumns, TestRow, TrendLine, dispatchInk, inkDispatcherTable, tagUnion, useFileLink };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitest-agent/ui",
3
- "version": "5.2.2",
3
+ "version": "6.0.0",
4
4
  "private": false,
5
5
  "description": "Shared event-sourced renderer for vitest-agent. React Ink view for humans, plain-string view for agents, both fed by the same reducer over a RunEvent stream.",
6
6
  "keywords": [
@@ -44,15 +44,14 @@
44
44
  "./package.json": "./package.json"
45
45
  },
46
46
  "dependencies": {
47
- "@vitest-agent/sdk": "9.0.2",
48
- "effect": "~4.1.1"
47
+ "@vitest-agent/sdk": "9.0.3",
48
+ "effect": "~4.1.2"
49
49
  },
50
50
  "peerDependencies": {
51
- "@effected/cli": "^0.25.0",
52
- "@effected/config-file": "^0.23.0",
53
- "@effected/env": "^0.9.0",
54
- "@effected/glob": "^0.17.0",
55
- "@effected/walker": "^0.24.0",
51
+ "@effected/cli-kit": "^0.27.0",
52
+ "@effected/env": "^0.11.0",
53
+ "@effected/glob": "^0.19.0",
54
+ "@effected/walker": "^0.25.1",
56
55
  "ink": "^8.0.0",
57
56
  "react": "^19.3.0"
58
57
  },
@@ -62,9 +61,6 @@
62
61
  },
63
62
  "react": {
64
63
  "optional": true
65
- },
66
- "@effected/config-file": {
67
- "optional": true
68
64
  }
69
65
  },
70
66
  "engines": {
package/render-agent.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { formatTotalsLine } from "./counts.js";
2
2
  import { formatFailure as formatFailure$1, formatGlobShortfallLines, formatSuggestedActionLines } from "./dispatcher/helpers.js";
3
3
  import { formatConsoleLeaksNote, formatStrayOutputNote } from "@vitest-agent/sdk";
4
- import { Fmt } from "@effected/cli";
4
+ import { Fmt } from "@effected/cli-kit";
5
5
 
6
6
  // src/render-agent.ts
7
7
  /**
package/spinner.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Glyphs } from "@effected/cli";
1
+ import { Glyphs } from "@effected/cli-kit";
2
2
 
3
3
  // src/spinner.ts
4
4
  /**
package/theme.js CHANGED
@@ -1,5 +1,5 @@
1
- import { Glyphs, Status, Token } from "@effected/cli";
2
- import { inkProps } from "@effected/cli/ui";
1
+ import { Glyphs, Status, Token } from "@effected/cli-kit";
2
+ import { inkProps } from "@effected/cli-kit/ui";
3
3
 
4
4
  // src/theme.ts
5
5
  /**
@@ -49,15 +49,19 @@ const VitestAgentTokens = {
49
49
  tag: Token.named("cyan")
50
50
  };
51
51
  /**
52
- * Ink `<Text>` props for a semantic token or an explicit style.
52
+ * Ink `<Text>` props for a semantic token or an explicit style, from the
53
+ * default palette.
53
54
  *
54
55
  * @remarks
55
56
  * Resolves the token through the kit's pure `Token.resolve` and maps the
56
- * `Style` with the kit's `inkProps`. No colour level reaches this call
57
- * site, so `inkProps` with no level emits every prop and Ink's own chalk
58
- * level, set by `CliUi.live` or `CliUi.context`, gates what is drawn.
57
+ * `Style` with the kit's `inkProps`. It sees no mounted theme, so a consumer's
58
+ * token override never reaches it. No colour level reaches this call site
59
+ * either, so `inkProps` with no level emits every prop and Ink's own chalk
60
+ * level gates what is drawn.
59
61
  *
60
62
  * @param token - a token name or a `Style`
63
+ * @deprecated Ignores the mounted theme. In a component use `useStyle` or
64
+ * `Styled` from `@effected/cli-kit/ui`, which take the same token.
61
65
  * @public
62
66
  */
63
67
  const inkStyle = (token) => inkProps(Token.resolve(token));
@@ -71,11 +75,22 @@ const inkStyle = (token) => inkProps(Token.resolve(token));
71
75
  */
72
76
  const statusGlyph = (name, glyphs = Glyphs.unicode) => VitestAgentStatus.glyph(name, glyphs);
73
77
  /**
74
- * Ink `<Text>` props for a status's glyph.
78
+ * The token a status paints with, for the Ink components to resolve against the
79
+ * mounted theme. Not part of the package entry: a consumer reads
80
+ * `VitestAgentStatus.def(name).token`.
81
+ *
82
+ * @internal
83
+ */
84
+ const statusToken = (name) => VitestAgentStatus.def(name).token;
85
+ /**
86
+ * Ink `<Text>` props for a status's glyph, from the default palette.
75
87
  *
76
88
  * @param name - a status in {@link VitestAgentStatus}
89
+ * @deprecated Ignores the mounted theme. In a component pass
90
+ * `VitestAgentStatus.def(name).token` to `useStyle` or `Styled` from
91
+ * `@effected/cli-kit/ui`.
77
92
  * @public
78
93
  */
79
94
  const statusInkStyle = (name) => inkStyle(VitestAgentStatus.def(name).token);
80
95
 
81
- export { VitestAgentStatus, VitestAgentTokens, inkStyle, statusGlyph, statusInkStyle };
96
+ export { VitestAgentStatus, VitestAgentTokens, inkStyle, statusGlyph, statusInkStyle, statusToken };
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.60.0"
8
+ "packageVersion": "7.60.1"
9
9
  }
10
10
  ]
11
11
  }