@vitest-agent/ui 5.2.3 → 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/index.d.ts +12 -5
- package/index.js +1 -1
- package/ink/CountColumns.js +4 -4
- package/ink/CoverageBlock.js +5 -6
- package/ink/FailureSection.js +9 -7
- package/ink/FailuresSection.js +6 -6
- package/ink/ProjectRow.js +4 -3
- package/ink/StatusIcon.js +4 -5
- package/ink/StreamApp.js +26 -19
- package/ink/SuggestedActions.js +11 -6
- package/ink/TagColumns.js +4 -3
- package/ink/TrendLine.js +4 -3
- package/ink/dispatch-ink.js +5 -0
- package/ink/ink-helpers.js +6 -5
- package/ink.d.ts +5 -0
- package/package.json +5 -9
- package/theme.js +21 -6
package/index.d.ts
CHANGED
|
@@ -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`.
|
|
1596
|
-
*
|
|
1597
|
-
*
|
|
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
|
@@ -18,6 +18,6 @@ import { ActionSeverity, CoverageFile, CoverageGap, CoverageMetric, CoverageRend
|
|
|
18
18
|
*
|
|
19
19
|
* @public
|
|
20
20
|
*/
|
|
21
|
-
const CURRENT_UI_VERSION = "
|
|
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 };
|
package/ink/CountColumns.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { VitestAgentTokens,
|
|
1
|
+
import { VitestAgentTokens, statusGlyph, statusToken } from "../theme.js";
|
|
2
2
|
import { Fmt } from "@effected/cli-kit";
|
|
3
|
-
import { useGlyphs } from "@effected/cli-kit/ui";
|
|
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(
|
|
17
|
-
|
|
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
|
/**
|
package/ink/CoverageBlock.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { inkStyle } from "../theme.js";
|
|
2
1
|
import { useFileLink } from "./FileLink.js";
|
|
3
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
|
-
...
|
|
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
|
-
...
|
|
61
|
+
...failure,
|
|
63
62
|
children: "Violations"
|
|
64
63
|
}), coverage.violations.map((v) => /* @__PURE__ */ jsx(Text, {
|
|
65
|
-
...
|
|
64
|
+
...failure,
|
|
66
65
|
children: ` ${v.metric}: ${formatPercent(v.actual)} < ${formatPercent(v.expected)}`
|
|
67
66
|
}, v.metric))]
|
|
68
67
|
}) : null,
|
package/ink/FailureSection.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { statusGlyph, statusToken } from "../theme.js";
|
|
2
2
|
import { useFileLink } from "./FileLink.js";
|
|
3
|
-
import { useGlyphs } from "@effected/cli-kit/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(
|
|
22
|
-
|
|
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
|
-
...
|
|
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
|
-
...
|
|
40
|
+
...failureStyle,
|
|
39
41
|
children: ` ${line}`
|
|
40
42
|
}, key);
|
|
41
43
|
if (line.startsWith("+")) return /* @__PURE__ */ jsx(Text, {
|
|
42
|
-
...
|
|
44
|
+
...successStyle,
|
|
43
45
|
children: ` ${line}`
|
|
44
46
|
}, key);
|
|
45
47
|
return /* @__PURE__ */ jsx(Text, { children: ` ${line}` }, key);
|
package/ink/FailuresSection.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { VitestAgentTokens,
|
|
1
|
+
import { VitestAgentTokens, statusGlyph, statusToken } from "../theme.js";
|
|
2
2
|
import { useFileLink } from "./FileLink.js";
|
|
3
|
-
import { useGlyphs } from "@effected/cli-kit/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(
|
|
55
|
-
|
|
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(
|
|
61
|
-
|
|
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
1
|
import { formatDisplayDuration } from "../format-duration.js";
|
|
2
|
-
import {
|
|
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
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(
|
|
25
|
-
|
|
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,
|
|
2
|
-
import { useGlyphs } from "@effected/cli-kit/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(
|
|
37
|
-
|
|
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,7 +1,7 @@
|
|
|
1
1
|
import { classifyRunShape } from "../dispatcher/classify.js";
|
|
2
2
|
import { formatDisplayDuration } from "../format-duration.js";
|
|
3
3
|
import { spinnerFrame } from "../spinner.js";
|
|
4
|
-
import { VitestAgentTokens,
|
|
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
7
|
import { ProjectRow } from "./ProjectRow.js";
|
|
@@ -11,7 +11,7 @@ import { TestRow } from "./TestRow.js";
|
|
|
11
11
|
import { TrendLine } from "./TrendLine.js";
|
|
12
12
|
import { formatConsoleLeaksNote, formatStrayOutputNote } from "@vitest-agent/sdk";
|
|
13
13
|
import { Fmt } from "@effected/cli-kit";
|
|
14
|
-
import { useGlyphs } from "@effected/cli-kit/ui";
|
|
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(
|
|
127
|
-
|
|
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(
|
|
198
|
-
|
|
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(
|
|
224
|
-
|
|
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(
|
|
230
|
-
|
|
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(
|
|
278
|
-
|
|
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__ */
|
|
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 ?
|
|
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 ?
|
|
542
|
+
...i === 0 ? warningStyle : {},
|
|
536
543
|
children: line
|
|
537
544
|
}, `leaks:${i}`))
|
|
538
545
|
}) : null
|
package/ink/SuggestedActions.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { inkStyle } from "../theme.js";
|
|
2
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(
|
|
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
|
|
1
|
+
import { VitestAgentTokens } from "../theme.js";
|
|
2
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(
|
|
39
|
-
|
|
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
|
|
1
|
+
import { VitestAgentTokens } from "../theme.js";
|
|
2
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(
|
|
27
|
-
|
|
27
|
+
/* @__PURE__ */ jsx(Styled, {
|
|
28
|
+
token: TOKEN[trend.direction],
|
|
28
29
|
children: trend.direction
|
|
29
30
|
}),
|
|
30
31
|
/* @__PURE__ */ jsxs(Text, {
|
package/ink/dispatch-ink.js
CHANGED
|
@@ -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
|
package/ink/ink-helpers.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
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(
|
|
25
|
-
|
|
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(
|
|
49
|
-
|
|
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
|
@@ -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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitest-agent/ui",
|
|
3
|
-
"version": "
|
|
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": [
|
|
@@ -48,11 +48,10 @@
|
|
|
48
48
|
"effect": "~4.1.2"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@effected/cli-kit": "^0.
|
|
52
|
-
"@effected/
|
|
53
|
-
"@effected/
|
|
54
|
-
"@effected/
|
|
55
|
-
"@effected/walker": "^0.25.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/theme.js
CHANGED
|
@@ -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`.
|
|
57
|
-
*
|
|
58
|
-
*
|
|
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
|
-
*
|
|
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 };
|