Skip to content

Commit d965698

Browse files
authored
fix: biome & tsc setup across repo (#493)
* fix: biome lint issues * fix: code quality workflow * fix: all lint issues * chore: test lefthook pre-commit hook * chore: test lefthook with agent file * chore: revert test comment from lefthook verification * feat: setup tsgo for typechecking agent * fix: typecheck cli command * fix: early return to prevent errors
1 parent 50b2f45 commit d965698

50 files changed

Lines changed: 414 additions & 167 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/code-quality.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
branches:
66
- main
77
paths:
8-
- 'packages/browseros-agent/**'
8+
- "packages/browseros-agent/**"
99

1010
jobs:
1111
biome:
@@ -50,6 +50,9 @@ jobs:
5050
- name: Install dependencies
5151
run: bun ci
5252

53+
- name: Prepare wxt
54+
run: VITE_PUBLIC_BROWSEROS_API=http://localhost:3000 bun run --cwd apps/agent wxt prepare
55+
5356
- name: Run codegen
5457
run: bun run --cwd apps/agent codegen
5558

lefthook.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
commit-msg:
2+
commands:
3+
conventional:
4+
run: |
5+
msg=$(head -1 {1})
6+
if [[ ! "$msg" =~ ^(feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert)(\(.+\))?\!?:\ .+ ]]; then
7+
echo "Commit message must follow Conventional Commits format:"
8+
echo " <type>(<optional scope>): <description>"
9+
echo " Types: feat, fix, docs, style, refactor, perf, test, chore, ci, build, revert"
10+
echo ""
11+
echo "Examples:"
12+
echo " feat(auth): add OAuth2 support"
13+
echo " fix: resolve null pointer exception"
14+
exit 1
15+
fi
16+
17+
pre-commit:
18+
commands:
19+
biome-check:
20+
root: "packages/browseros-agent/"
21+
glob: "*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}"
22+
run: npx @biomejs/biome check --write --no-errors-on-unmatched --files-ignore-unknown=true --colors=off {staged_files}
23+
stage_fixed: true
24+
25+
file-length:
26+
root: "packages/browseros-agent/"
27+
glob: "*.{ts,tsx}"
28+
exclude: "*.{test,spec,d}.ts|*.{test,spec}.tsx|**/__tests__/**|**/tests/**|**/*.generated.*"
29+
run: |
30+
for file in {staged_files}; do
31+
if [[ -f "$file" ]]; then
32+
lines=$(wc -l < "$file" | tr -d ' ')
33+
if [[ $lines -gt 400 ]]; then
34+
echo "⚠️ Warning: $file has $lines lines (threshold: 400)"
35+
echo " Consider splitting this file if it has multiple responsibilities."
36+
fi
37+
fi
38+
done
39+
40+
pre-push:
41+
commands:
42+
branch-name:
43+
run: |
44+
branch=$(git rev-parse --abbrev-ref HEAD)
45+
if [[ "$branch" == "main" || "$branch" == "master" ]]; then
46+
exit 0
47+
fi
48+
if [[ ! "$branch" =~ ^(feat|fix|bugfix|hotfix|release|docs|refactor|test|chore|experiment)/[a-z0-9-]+$ ]]; then
49+
echo "⚠️ Warning: Branch name '$branch' doesn't match recommended format."
50+
echo " Use: <type>/<short-description>"
51+
echo " Types: feat, fix, bugfix, hotfix, release, docs, refactor, test, chore, experiment"
52+
echo " Example: feat/add-auth, fix/login-crash"
53+
echo ""
54+
echo " To rename your branch:"
55+
echo " git branch -m <new-name>"
56+
echo " git push -u origin <new-name>"
57+
fi

packages/browseros-agent/apps/agent/components/ui/alert-dialog.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -176,14 +176,14 @@ function AlertDialogCancel({
176176

177177
export {
178178
AlertDialog,
179-
AlertDialogPortal,
180-
AlertDialogOverlay,
181-
AlertDialogTrigger,
179+
AlertDialogAction,
180+
AlertDialogCancel,
182181
AlertDialogContent,
183-
AlertDialogHeader,
182+
AlertDialogDescription,
184183
AlertDialogFooter,
184+
AlertDialogHeader,
185+
AlertDialogOverlay,
186+
AlertDialogPortal,
185187
AlertDialogTitle,
186-
AlertDialogDescription,
187-
AlertDialogAction,
188-
AlertDialogCancel,
188+
AlertDialogTrigger,
189189
}

packages/browseros-agent/apps/agent/components/ui/alert.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,4 @@ function AlertDescription({
7272
)
7373
}
7474

75-
export { Alert, AlertTitle, AlertDescription }
75+
export { Alert, AlertDescription, AlertTitle }

packages/browseros-agent/apps/agent/components/ui/card.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@ function CardFooter({ className, ...props }: React.ComponentProps<'div'>) {
104104

105105
export {
106106
Card,
107-
CardHeader,
108-
CardFooter,
109-
CardTitle,
110107
CardAction,
111-
CardDescription,
112108
CardContent,
109+
CardDescription,
110+
CardFooter,
111+
CardHeader,
112+
CardTitle,
113113
}

packages/browseros-agent/apps/agent/components/ui/carousel.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,10 +251,10 @@ function CarouselNext({
251251
}
252252

253253
export {
254-
type CarouselApi,
255254
Carousel,
255+
type CarouselApi,
256256
CarouselContent,
257257
CarouselItem,
258-
CarouselPrevious,
259258
CarouselNext,
259+
CarouselPrevious,
260260
}

packages/browseros-agent/apps/agent/components/ui/collapsible.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ function CollapsibleContent({
3939
)
4040
}
4141

42-
export { Collapsible, CollapsibleTrigger, CollapsibleContent }
42+
export { Collapsible, CollapsibleContent, CollapsibleTrigger }

packages/browseros-agent/apps/agent/components/ui/command.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,11 @@ function CommandShortcut({
198198
export {
199199
Command,
200200
CommandDialog,
201-
CommandInput,
202-
CommandList,
203201
CommandEmpty,
204202
CommandGroup,
203+
CommandInput,
205204
CommandItem,
206-
CommandShortcut,
205+
CommandList,
207206
CommandSeparator,
207+
CommandShortcut,
208208
}

packages/browseros-agent/apps/agent/components/ui/dropdown-menu.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -283,18 +283,18 @@ function DropdownMenuSubContent({
283283

284284
export {
285285
DropdownMenu,
286-
DropdownMenuPortal,
287-
DropdownMenuTrigger,
286+
DropdownMenuCheckboxItem,
288287
DropdownMenuContent,
289288
DropdownMenuGroup,
290-
DropdownMenuLabel,
291289
DropdownMenuItem,
292-
DropdownMenuCheckboxItem,
290+
DropdownMenuLabel,
291+
DropdownMenuPortal,
293292
DropdownMenuRadioGroup,
294293
DropdownMenuRadioItem,
295294
DropdownMenuSeparator,
296295
DropdownMenuShortcut,
297296
DropdownMenuSub,
298-
DropdownMenuSubTrigger,
299297
DropdownMenuSubContent,
298+
DropdownMenuSubTrigger,
299+
DropdownMenuTrigger,
300300
}

packages/browseros-agent/apps/agent/components/ui/form.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,12 @@ function FormMessage({ className, ...props }: React.ComponentProps<'p'>) {
179179
}
180180

181181
export {
182-
useFormField,
183182
Form,
184-
FormItem,
185-
FormLabel,
186183
FormControl,
187184
FormDescription,
188-
FormMessage,
189185
FormField,
186+
FormItem,
187+
FormLabel,
188+
FormMessage,
189+
useFormField,
190190
}

0 commit comments

Comments
 (0)