Skip to content

Commit 6557a7b

Browse files
committed
style: apply biome formatter to recently-touched files
Pure reformatting — import reorders, keyword-list verticalization, no behavioral change. Runs the formatter on the files this session expanded so future diffs aren't mostly whitespace noise.
1 parent c7c545f commit 6557a7b

7 files changed

Lines changed: 176 additions & 56 deletions

File tree

src/agent/agent.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,6 @@ export function createAgent(opts: CreateAgentOptions = {}): AgentBundle {
275275
hooks,
276276
diagnostics,
277277
subscribe,
278-
resumedFrom: resumed
279-
? { updatedAt: resumed.updatedAt, messageCount: resumed.messages.length }
280-
: undefined,
278+
resumedFrom: resumed ? { updatedAt: resumed.updatedAt, messageCount: resumed.messages.length } : undefined,
281279
};
282280
}

src/commands/registry.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ export class CommandRegistry {
5959
if (!command) {
6060
const suggestion = this.suggestClosest(name);
6161
ctx.emit(
62-
suggestion ? `unknown command: /${name}. Did you mean /${suggestion}?` : `unknown command: /${name}. Try /help.`,
62+
suggestion
63+
? `unknown command: /${name}. Did you mean /${suggestion}?`
64+
: `unknown command: /${name}. Try /help.`,
6365
);
6466
return { handled: true };
6567
}

src/ui/Input.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { Box, Text, useInput } from "ink";
22
import { useMemo, useRef, useState } from "react";
3-
import { completePath, findAtTokenAt } from "./path-complete.js";
43
import {
54
backspace,
65
deleteForward,
@@ -16,6 +15,7 @@ import {
1615
undo,
1716
yank,
1817
} from "./input-state.js";
18+
import { completePath, findAtTokenAt } from "./path-complete.js";
1919

2020
export interface SlashCommandSuggestion {
2121
name: string;
@@ -376,9 +376,7 @@ function RenderedBuffer({ buffer, cursor }: RenderedBufferProps) {
376376
const cursorOnThisLine = cursor >= lineStart && cursor <= lineEnd;
377377
consumed = lineEnd + 1;
378378
if (!cursorOnThisLine) {
379-
return (
380-
<Text key={`line-${idx}-${line.slice(0, 8)}`}>{line.length === 0 ? " " : line}</Text>
381-
);
379+
return <Text key={`line-${idx}-${line.slice(0, 8)}`}>{line.length === 0 ? " " : line}</Text>;
382380
}
383381
return (
384382
<SingleLineBuffer

src/ui/Markdown.tsx

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,15 @@ function MarkdownBlock({ block, width, keyPrefix }: { block: Block; width: numbe
105105
* the per-line key invariant from the rest of the renderer holds.
106106
* Unsupported languages render in the original cyan tone.
107107
*/
108-
function HighlightedCodeBlock({ text, lang, keyPrefix }: { text: string; lang: string | undefined; keyPrefix: string }) {
108+
function HighlightedCodeBlock({
109+
text,
110+
lang,
111+
keyPrefix,
112+
}: {
113+
text: string;
114+
lang: string | undefined;
115+
keyPrefix: string;
116+
}) {
109117
const rules = rulesFor(lang);
110118
if (!rules) {
111119
const lines = text.split("\n");
@@ -134,7 +142,10 @@ function HighlightedCodeBlock({ text, lang, keyPrefix }: { text: string; lang: s
134142
return (
135143
<Box flexDirection="column" marginLeft={2}>
136144
{rows.map((row, i) => {
137-
const previewKey = row.map((c) => c.text).join("").slice(0, 12);
145+
const previewKey = row
146+
.map((c) => c.text)
147+
.join("")
148+
.slice(0, 12);
138149
return (
139150
<Text key={`${keyPrefix}-hl-${i}-${previewKey}`}>
140151
{row.length === 0
@@ -174,14 +185,7 @@ function ListRow({ item, width, keyPrefix }: { item: ListItem; width: number; ke
174185
return (
175186
<Box key={rowKey} flexDirection="row">
176187
<Text>{" ".repeat(indentCols)}</Text>
177-
{lineIdx === 0 ? (
178-
<Text color="cyan">
179-
{item.marker}
180-
{" "}
181-
</Text>
182-
) : (
183-
<Text>{" ".repeat(markerCol)}</Text>
184-
)}
188+
{lineIdx === 0 ? <Text color="cyan">{item.marker} </Text> : <Text>{" ".repeat(markerCol)}</Text>}
185189
<Box flexGrow={1}>
186190
{/* biome-ignore lint/suspicious/noArrayIndexKey: pure presentational */}
187191
<Text>

src/ui/Message.tsx

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { relative as relativePath, sep as pathSep } from "node:path";
1+
import { sep as pathSep, relative as relativePath } from "node:path";
22
import type { AgentMessage } from "@earendil-works/pi-agent-core";
33
import { Box, Text } from "ink";
44
import { type ReactNode, useEffect, useState } from "react";
@@ -96,14 +96,7 @@ function MessageBody({
9696
const text = message.content
9797
.map((block) => (block.type === "text" ? block.text : `[image:${block.mimeType}]`))
9898
.join("");
99-
return (
100-
<TruncatedOutput
101-
text={text}
102-
width={width}
103-
keyPrefix="tool"
104-
color={message.isError ? "red" : undefined}
105-
/>
106-
);
99+
return <TruncatedOutput text={text} width={width} keyPrefix="tool" color={message.isError ? "red" : undefined} />;
107100
}
108101

109102
return null;
@@ -299,8 +292,7 @@ function CollapsedReadGroup({
299292
<Box flexDirection="column" marginLeft={2}>
300293
{calls.map((c) => {
301294
const a = (c.arguments ?? {}) as Record<string, unknown>;
302-
const rawPath =
303-
typeof a.path === "string" ? a.path : typeof a.file_path === "string" ? a.file_path : "";
295+
const rawPath = typeof a.path === "string" ? a.path : typeof a.file_path === "string" ? a.file_path : "";
304296
const path = displayPath(rawPath);
305297
const status = tools?.get(c.id)?.status;
306298
const failed = status === "error";
@@ -511,13 +503,7 @@ function WrappedLines({ text, width, keyPrefix, color, dimColor, italic }: Wrapp
511503
* blocks render as a dim "image (PNG, 142 KB)" line so the user can
512504
* see at a glance that an image was sent.
513505
*/
514-
function UserBlocks({
515-
blocks,
516-
width,
517-
}: {
518-
blocks: unknown;
519-
width: number;
520-
}) {
506+
function UserBlocks({ blocks, width }: { blocks: unknown; width: number }) {
521507
if (!Array.isArray(blocks)) return null;
522508
const rows: ReactNode[] = [];
523509
for (let i = 0; i < blocks.length; i++) {

src/ui/Welcome.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ export function Welcome({ modelName, source, cwd, resumedFrom }: WelcomeProps) {
7575
{gitInfo ? (
7676
<Text dimColor>
7777
{gitInfo.branch}
78-
{gitInfo.dirty > 0 ? ` · ${gitInfo.dirty} uncommitted change${gitInfo.dirty === 1 ? "" : "s"}` : " · clean"}
78+
{gitInfo.dirty > 0
79+
? ` · ${gitInfo.dirty} uncommitted change${gitInfo.dirty === 1 ? "" : "s"}`
80+
: " · clean"}
7981
</Text>
8082
) : null}
8183
</Box>

src/ui/highlight.ts

Lines changed: 149 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -35,34 +35,164 @@ interface Rule {
3535
}
3636

3737
const TS_KEYWORDS = [
38-
"abstract", "as", "async", "await", "break", "case", "catch", "class",
39-
"const", "continue", "debugger", "declare", "default", "delete", "do",
40-
"else", "enum", "export", "extends", "finally", "for", "from", "function",
41-
"get", "if", "implements", "import", "in", "infer", "instanceof", "interface",
42-
"is", "keyof", "let", "namespace", "new", "null", "of", "package", "private",
43-
"protected", "public", "readonly", "return", "set", "static", "super", "switch",
44-
"this", "throw", "true", "false", "try", "type", "typeof", "undefined",
45-
"var", "void", "while", "with", "yield",
38+
"abstract",
39+
"as",
40+
"async",
41+
"await",
42+
"break",
43+
"case",
44+
"catch",
45+
"class",
46+
"const",
47+
"continue",
48+
"debugger",
49+
"declare",
50+
"default",
51+
"delete",
52+
"do",
53+
"else",
54+
"enum",
55+
"export",
56+
"extends",
57+
"finally",
58+
"for",
59+
"from",
60+
"function",
61+
"get",
62+
"if",
63+
"implements",
64+
"import",
65+
"in",
66+
"infer",
67+
"instanceof",
68+
"interface",
69+
"is",
70+
"keyof",
71+
"let",
72+
"namespace",
73+
"new",
74+
"null",
75+
"of",
76+
"package",
77+
"private",
78+
"protected",
79+
"public",
80+
"readonly",
81+
"return",
82+
"set",
83+
"static",
84+
"super",
85+
"switch",
86+
"this",
87+
"throw",
88+
"true",
89+
"false",
90+
"try",
91+
"type",
92+
"typeof",
93+
"undefined",
94+
"var",
95+
"void",
96+
"while",
97+
"with",
98+
"yield",
4699
];
47100

48101
const PY_KEYWORDS = [
49-
"and", "as", "assert", "async", "await", "break", "class", "continue",
50-
"def", "del", "elif", "else", "except", "False", "finally", "for", "from",
51-
"global", "if", "import", "in", "is", "lambda", "None", "nonlocal", "not",
52-
"or", "pass", "raise", "return", "True", "try", "while", "with", "yield",
102+
"and",
103+
"as",
104+
"assert",
105+
"async",
106+
"await",
107+
"break",
108+
"class",
109+
"continue",
110+
"def",
111+
"del",
112+
"elif",
113+
"else",
114+
"except",
115+
"False",
116+
"finally",
117+
"for",
118+
"from",
119+
"global",
120+
"if",
121+
"import",
122+
"in",
123+
"is",
124+
"lambda",
125+
"None",
126+
"nonlocal",
127+
"not",
128+
"or",
129+
"pass",
130+
"raise",
131+
"return",
132+
"True",
133+
"try",
134+
"while",
135+
"with",
136+
"yield",
53137
];
54138

55139
const GO_KEYWORDS = [
56-
"break", "case", "chan", "const", "continue", "default", "defer", "else",
57-
"fallthrough", "for", "func", "go", "goto", "if", "import", "interface",
58-
"map", "package", "range", "return", "select", "struct", "switch", "type",
59-
"var", "nil", "true", "false",
140+
"break",
141+
"case",
142+
"chan",
143+
"const",
144+
"continue",
145+
"default",
146+
"defer",
147+
"else",
148+
"fallthrough",
149+
"for",
150+
"func",
151+
"go",
152+
"goto",
153+
"if",
154+
"import",
155+
"interface",
156+
"map",
157+
"package",
158+
"range",
159+
"return",
160+
"select",
161+
"struct",
162+
"switch",
163+
"type",
164+
"var",
165+
"nil",
166+
"true",
167+
"false",
60168
];
61169

62170
const SH_KEYWORDS = [
63-
"if", "then", "else", "elif", "fi", "for", "in", "do", "done", "while",
64-
"until", "case", "esac", "function", "return", "exit", "break", "continue",
65-
"local", "export", "readonly", "declare", "set", "unset", "shift",
171+
"if",
172+
"then",
173+
"else",
174+
"elif",
175+
"fi",
176+
"for",
177+
"in",
178+
"do",
179+
"done",
180+
"while",
181+
"until",
182+
"case",
183+
"esac",
184+
"function",
185+
"return",
186+
"exit",
187+
"break",
188+
"continue",
189+
"local",
190+
"export",
191+
"readonly",
192+
"declare",
193+
"set",
194+
"unset",
195+
"shift",
66196
];
67197

68198
const TS_RULES: Rule[] = [

0 commit comments

Comments
 (0)