Skip to content

Commit f14777a

Browse files
committed
biome all the things
1 parent 7e73e86 commit f14777a

File tree

12 files changed

+200
-234
lines changed

12 files changed

+200
-234
lines changed

.posthog/.gitignore

Lines changed: 0 additions & 12 deletions
This file was deleted.

.posthog/2348a2cd-5fd7-4637-91d9-1b7f6957cbfc/plan.md

Lines changed: 0 additions & 54 deletions
This file was deleted.

package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@
5959
"yaml": "^2.8.1"
6060
},
6161
"dependencies": {
62-
"@posthog/agent": "^1.3.1",
63-
"@radix-ui/react-icons": "^1.3.2",
64-
"@radix-ui/themes": "^3.2.1",
6562
"@tiptap/extension-link": "^3.6.6",
6663
"@tiptap/extension-mention": "^3.6.6",
6764
"@tiptap/extension-placeholder": "^3.6.6",

src/main/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import {
99
type MenuItemConstructorOptions,
1010
} from "electron";
1111
import { registerAgentIpc, type TaskController } from "./services/agent.js";
12+
import { registerFsIpc } from "./services/fs.js";
1213
import { registerOsIpc } from "./services/os.js";
1314
import { registerPosthogIpc } from "./services/posthog.js";
14-
import { registerFsIpc } from "./services/fs.js";
1515

1616
const __filename = fileURLToPath(import.meta.url);
1717
const __dirname = path.dirname(__filename);

src/main/services/fs.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import { exec } from "node:child_process";
12
import fs from "node:fs";
23
import path from "node:path";
34
import { promisify } from "node:util";
4-
import { exec } from "node:child_process";
55
import { type IpcMainInvokeEvent, ipcMain } from "electron";
66

77
const execAsync = promisify(exec);
@@ -123,7 +123,7 @@ export function registerFsIpc(): void {
123123
}
124124

125125
// Filter by query if provided
126-
if (query && query.trim()) {
126+
if (query?.trim()) {
127127
const lowerQuery = query.toLowerCase();
128128
return allFiles
129129
.filter(
@@ -142,4 +142,3 @@ export function registerFsIpc(): void {
142142
},
143143
);
144144
}
145-

src/renderer/components/FileMentionList.tsx

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { Box, Flex, Text } from "@radix-ui/themes";
2-
import { type SuggestionKeyDownProps } from "@tiptap/suggestion";
2+
import type { SuggestionKeyDownProps } from "@tiptap/suggestion";
33
import {
4+
type ForwardedRef,
45
forwardRef,
56
useEffect,
67
useImperativeHandle,
78
useRef,
89
useState,
9-
type ForwardedRef,
1010
} from "react";
1111

1212
export interface FileMentionListProps {
@@ -19,26 +19,23 @@ export interface FileMentionListRef {
1919
}
2020

2121
export const FileMentionList = forwardRef(
22-
(
23-
props: FileMentionListProps,
24-
ref: ForwardedRef<FileMentionListRef>,
25-
) => {
22+
(props: FileMentionListProps, ref: ForwardedRef<FileMentionListRef>) => {
2623
const [selectedIndex, setSelectedIndex] = useState(0);
2724
const containerRef = useRef<HTMLDivElement>(null);
2825
const itemRefs = useRef<(HTMLDivElement | null)[]>([]);
2926

3027
const scrollIntoView = (index: number) => {
3128
const container = containerRef.current;
3229
const item = itemRefs.current[index];
33-
30+
3431
if (!container || !item) return;
35-
32+
3633
const containerTop = container.scrollTop;
3734
const containerBottom = containerTop + container.clientHeight;
38-
35+
3936
const itemTop = item.offsetTop;
4037
const itemBottom = itemTop + item.offsetHeight;
41-
38+
4239
if (itemTop < containerTop) {
4340
// Item is above visible area
4441
container.scrollTop = itemTop;
@@ -56,7 +53,8 @@ export const FileMentionList = forwardRef(
5653
};
5754

5855
const upHandler = () => {
59-
const newIndex = (selectedIndex + props.items.length - 1) % props.items.length;
56+
const newIndex =
57+
(selectedIndex + props.items.length - 1) % props.items.length;
6058
setSelectedIndex(newIndex);
6159
setTimeout(() => scrollIntoView(newIndex), 0);
6260
};
@@ -71,8 +69,8 @@ export const FileMentionList = forwardRef(
7169
selectItem(selectedIndex);
7270
};
7371

74-
useEffect(() => setSelectedIndex(0), [props.items]);
75-
72+
useEffect(() => setSelectedIndex(0), []);
73+
7674
useEffect(() => {
7775
// Initialize refs array to match items length
7876
itemRefs.current = itemRefs.current.slice(0, props.items.length);
@@ -136,15 +134,15 @@ export const FileMentionList = forwardRef(
136134
{props.items.map((item, index) => (
137135
<Flex
138136
key={item.path}
139-
ref={(el) => (itemRefs.current[index] = el)}
137+
ref={(el) => {
138+
itemRefs.current[index] = el;
139+
}}
140140
className={`file-mention-item ${index === selectedIndex ? "is-selected" : ""}`}
141141
onClick={() => selectItem(index)}
142142
onMouseEnter={() => setSelectedIndex(index)}
143143
>
144144
<Flex direction="column" gap="1">
145-
<Text size="1">
146-
{item.path}
147-
</Text>
145+
<Text size="1">{item.path}</Text>
148146
</Flex>
149147
</Flex>
150148
))}
@@ -154,4 +152,3 @@ export const FileMentionList = forwardRef(
154152
);
155153

156154
FileMentionList.displayName = "FileMentionList";
157-

src/renderer/components/FormattingToolbar.tsx

Lines changed: 37 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import { IconButton, Flex, Separator, Select } from "@radix-ui/themes";
21
import {
2+
CodeIcon,
33
FontBoldIcon,
44
FontItalicIcon,
5-
UnderlineIcon,
6-
StrikethroughIcon,
7-
CodeIcon,
8-
QuoteIcon,
95
Link1Icon,
106
ListBulletIcon,
7+
QuoteIcon,
8+
StrikethroughIcon,
9+
UnderlineIcon,
1110
} from "@radix-ui/react-icons";
11+
import { Flex, IconButton, Select, Separator } from "@radix-ui/themes";
1212
import type { Editor } from "@tiptap/react";
1313

1414
interface FormattingToolbarProps {
@@ -22,12 +22,15 @@ export function FormattingToolbar({ editor }: FormattingToolbarProps) {
2222
const toggleStrike = () => editor.chain().focus().toggleStrike().run();
2323
const toggleCode = () => editor.chain().focus().toggleCode().run();
2424
const toggleCodeBlock = () => editor.chain().focus().toggleCodeBlock().run();
25-
const toggleBlockquote = () => editor.chain().focus().toggleBlockquote().run();
26-
const toggleBulletList = () => editor.chain().focus().toggleBulletList().run();
27-
const toggleOrderedList = () => editor.chain().focus().toggleOrderedList().run();
28-
25+
const toggleBlockquote = () =>
26+
editor.chain().focus().toggleBlockquote().run();
27+
const toggleBulletList = () =>
28+
editor.chain().focus().toggleBulletList().run();
29+
const toggleOrderedList = () =>
30+
editor.chain().focus().toggleOrderedList().run();
31+
2932
const setLink = () => {
30-
const url = window.prompt('Enter URL:');
33+
const url = window.prompt("Enter URL:");
3134
if (url) {
3235
editor.chain().focus().setLink({ href: url }).run();
3336
}
@@ -39,14 +42,14 @@ export function FormattingToolbar({ editor }: FormattingToolbarProps) {
3942

4043
const getCurrentHeading = () => {
4144
for (let i = 1; i <= 6; i++) {
42-
if (editor.isActive('heading', { level: i })) {
45+
if (editor.isActive("heading", { level: i })) {
4346
return i.toString();
4447
}
4548
}
46-
if (editor.isActive('paragraph')) {
47-
return 'paragraph';
49+
if (editor.isActive("paragraph")) {
50+
return "paragraph";
4851
}
49-
return 'paragraph';
52+
return "paragraph";
5053
};
5154

5255
return (
@@ -66,15 +69,15 @@ export function FormattingToolbar({ editor }: FormattingToolbarProps) {
6669
<Select.Root
6770
value={getCurrentHeading()}
6871
onValueChange={(value) => {
69-
if (value === 'paragraph') {
72+
if (value === "paragraph") {
7073
editor.chain().focus().setParagraph().run();
7174
} else {
72-
setHeading(parseInt(value) as 1 | 2 | 3 | 4 | 5 | 6);
75+
setHeading(parseInt(value, 10) as 1 | 2 | 3 | 4 | 5 | 6);
7376
}
7477
}}
7578
size="1"
7679
>
77-
<Select.Trigger style={{ minWidth: '80px' }} />
80+
<Select.Trigger style={{ minWidth: "80px" }} />
7881
<Select.Content>
7982
<Select.Item value="paragraph">Paragraph</Select.Item>
8083
<Select.Item value="1">Heading 1</Select.Item>
@@ -91,34 +94,34 @@ export function FormattingToolbar({ editor }: FormattingToolbarProps) {
9194
{/* Text Formatting */}
9295
<IconButton
9396
size="1"
94-
variant={editor.isActive('bold') ? 'solid' : 'ghost'}
97+
variant={editor.isActive("bold") ? "solid" : "ghost"}
9598
onClick={toggleBold}
9699
title="Bold (Ctrl+B)"
97100
>
98101
<FontBoldIcon />
99102
</IconButton>
100-
103+
101104
<IconButton
102105
size="1"
103-
variant={editor.isActive('italic') ? 'solid' : 'ghost'}
106+
variant={editor.isActive("italic") ? "solid" : "ghost"}
104107
onClick={toggleItalic}
105108
title="Italic (Ctrl+I)"
106109
>
107110
<FontItalicIcon />
108111
</IconButton>
109-
112+
110113
<IconButton
111114
size="1"
112-
variant={editor.isActive('underline') ? 'solid' : 'ghost'}
115+
variant={editor.isActive("underline") ? "solid" : "ghost"}
113116
onClick={toggleUnderline}
114117
title="Underline (Ctrl+U)"
115118
>
116119
<UnderlineIcon />
117120
</IconButton>
118-
121+
119122
<IconButton
120123
size="1"
121-
variant={editor.isActive('strike') ? 'solid' : 'ghost'}
124+
variant={editor.isActive("strike") ? "solid" : "ghost"}
122125
onClick={toggleStrike}
123126
title="Strikethrough (Ctrl+Shift+X)"
124127
>
@@ -130,16 +133,16 @@ export function FormattingToolbar({ editor }: FormattingToolbarProps) {
130133
{/* Code */}
131134
<IconButton
132135
size="1"
133-
variant={editor.isActive('code') ? 'solid' : 'ghost'}
136+
variant={editor.isActive("code") ? "solid" : "ghost"}
134137
onClick={toggleCode}
135138
title="Inline Code (Ctrl+E)"
136139
>
137140
<CodeIcon />
138141
</IconButton>
139-
142+
140143
<IconButton
141144
size="1"
142-
variant={editor.isActive('codeBlock') ? 'solid' : 'ghost'}
145+
variant={editor.isActive("codeBlock") ? "solid" : "ghost"}
143146
onClick={toggleCodeBlock}
144147
title="Code Block (Ctrl+Shift+C)"
145148
>
@@ -151,25 +154,25 @@ export function FormattingToolbar({ editor }: FormattingToolbarProps) {
151154
{/* Lists and Blocks */}
152155
<IconButton
153156
size="1"
154-
variant={editor.isActive('bulletList') ? 'solid' : 'ghost'}
157+
variant={editor.isActive("bulletList") ? "solid" : "ghost"}
155158
onClick={toggleBulletList}
156159
title="Bullet List (Ctrl+Shift+8)"
157160
>
158161
<ListBulletIcon />
159162
</IconButton>
160-
163+
161164
<IconButton
162165
size="1"
163-
variant={editor.isActive('orderedList') ? 'solid' : 'ghost'}
166+
variant={editor.isActive("orderedList") ? "solid" : "ghost"}
164167
onClick={toggleOrderedList}
165168
title="Numbered List (Ctrl+Shift+7)"
166169
>
167-
<span style={{ fontSize: '11px', fontWeight: 'bold' }}>1.</span>
170+
<span style={{ fontSize: "11px", fontWeight: "bold" }}>1.</span>
168171
</IconButton>
169-
172+
170173
<IconButton
171174
size="1"
172-
variant={editor.isActive('blockquote') ? 'solid' : 'ghost'}
175+
variant={editor.isActive("blockquote") ? "solid" : "ghost"}
173176
onClick={toggleBlockquote}
174177
title="Blockquote (Ctrl+Shift+B)"
175178
>
@@ -181,13 +184,12 @@ export function FormattingToolbar({ editor }: FormattingToolbarProps) {
181184
{/* Links */}
182185
<IconButton
183186
size="1"
184-
variant={editor.isActive('link') ? 'solid' : 'ghost'}
187+
variant={editor.isActive("link") ? "solid" : "ghost"}
185188
onClick={setLink}
186189
title="Link (Ctrl+K)"
187190
>
188191
<Link1Icon />
189192
</IconButton>
190-
191193
</Flex>
192194
);
193195
}

0 commit comments

Comments
 (0)