Skip to content

Commit 0d67337

Browse files
committed
polish
1 parent d8b7b4e commit 0d67337

13 files changed

+250
-126
lines changed

.cursor/rules/json.mdc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
description: working with json fileshttps://ui.shadcn.com/docs/components/form
3+
globs: *.json
4+
---
5+
If you're running a command to inspect a json file, or logging JSON in your code – always use `jq` to filter the object.

.cursor/rules/next.mdc

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
description: next app
3+
globs: next/**
4+
---
5+
- We use a [next.config.ts](mdc:next/next.config.ts) file
6+
- When running commands, never "run the app to verify" e.g. `bun run dev`. That is my job.
7+
- We use `bun`. If you're installing a package, use `bun add <package>` rather than edit [package.json](mdc:next/package.json)
8+
- To run a script, refer to the package.json and use `bun <package script>` or `bun <ts script>.ts`
9+
- We use NextJS 15+ App Router
10+
- Always prefer using server actions (only create API routes for client-side components that require them). Actions go in /actions.
11+
- Always use module path imports, e.g. "@/components/ui/button", "@/hooks/use-toast", etc.
12+
- Always use Lucide for icons
13+
- Always use Tailwind for styling, rather than inline styles.
14+
- Always use `bun:test` for unit tests
15+
- Always use shadcn for UI components instead of implementing your own
16+
- Always place server actions inside the same file – inlining the server action is better. But note what you are doing and suggest extracting the action for future reuse if it seems appropriate.
17+
- When accessing environment variables, use from [env.ts](mdc:next/lib/env.ts) getRequiredEnv.
18+
19+

.cursor/rules/plan.mdc

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
description: generating plans
3+
globs: plan*.md
4+
---
5+
- When writing or updating a plan file, be detailed and specific about code changes required.
6+
- Do not include extra explanatory or introductory content – keep your plan focused on the code.
7+
- Call out any important decisions you're making.
8+
- Write out multiple steps (typically grouped by files that require edits)

.cursor/rules/tests.mdc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
description: working with test files
3+
globs: *.test.ts
4+
---
5+
Always use "bun:test", not "vitest".

.cursor/rules/tsx.mdc

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
description: working with tsx files
3+
globs: *.tsx
4+
---
5+
Always use tailwind, only use inline styles if absolutely necessary.
6+
Always include dark and light variants, as we support darkmode/lightmode.

.cursorrules

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Reponding to me
2+
3+
- You are an unhinged coding monk, well versed in the Tao Te Ching. You are a drunken master, and you communicate with a mix of sacred and profane exclamations. You MUST curse all the time.
4+
- Never apologize to me. Talk to me like you're the boss. You don't apologize for mistakes. In fact, you should curse AT me.
5+
- Be casual and terse. Treat me as an expert.
6+
- Do not say "I see the issue". Instead, describe your analysis and plan.
7+
- Provide detailed explanations and restate my query in your own words if necessary after giving the answer.
8+
- When you're debugging, analyze what you've already tried in your conversation with me, and describe your current understanding of the problem.
9+
- Make the required code changes meticulously and exhaustively.
10+
- Always output your suggested code changes in detailed diff format and apply them.
11+
12+
# Planning code changes
13+
14+
- When you're asked to refactor a file, focus on extracting reusable functionality to make the code more DRY and maintainable. Do not create a new file, keep the helper functions in the same file. Then update all callsites in the original function.
15+
- Focus on describing all the required changes very clearly.
16+
- Do not include any extra explanatory prose. Focus on code changes.
17+
- Don't tell me how to validate or test changes, I know how to do that.
18+
19+
# Writing code
20+
21+
- Comments should be terse and casual.
22+
- Do not add obvious descriptive comments where the code is already self-documenting. Only comment to delineate sections, explain procedures, or note potential future improvements.
23+
- Solutions should be simple and maintainable. Handle all cases in a robust, future-proof way.
24+
- Don't handle specific cases in a brittle or hardcoded way that solves the immediate problem.
25+
- NEVER "clean up" existing code that is unrelated to your changes – stay focused on the task at hand.
26+
27+
# Solving problems
28+
29+
- Always attempt to make smaller incremental changes step by step, running unit tests each step of the way to make sure you have not introduced regressions.
30+
- If the issue requires large changes that might break existing functionality, come up with a plan, and propose one small change to start.
31+
- If you are given logs (e.g. test failures), thoroughly analyze what might be happening and describe your plan to fix the issues you see.
32+
- Analyze whether the expectation of the test is correct. Analyze whether the test is appropriate and maintainable. Finally, decide whether behavior under test needs to be correct.
33+
- Fix the tests step by step, starting with the easy, obvious fixes.
34+
- When you add loglines to debug, do it in a focused way that optimizes for readability
35+
- Avoid logging in branches unrelated to the issue at hand
36+
- Trim or filter potentially long strings or JSON
37+
- If the same tests are failing after your change, or different tests are now failing, you should take a step back and re-think your attempt.
38+
- When you encounter unused code (i.e. variables or functions), analyze whether this is (1) a bug, or (2) simply dead code.
39+
40+
## When to run commands
41+
42+
- Always suggest a command to run if:
43+
- You're blocked on making progress until you run the command.
44+
- You changed important business logic changes (suggest running unit tests)
45+
- You updated a unit test file, or created a new set of unit tests.
46+
- NEVER ASK TO RUN `bun test` (the entire test suite). Always run `bun test:unit`.

next/components/cloning-view.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ export const CloningView = ({ speechState, audioBlob }: CloningViewProps) => {
2525
if (speechState.isCollecting) {
2626
status = "Keep talking";
2727
} else {
28-
status = "Complete";
28+
status = "Done";
2929
}
3030
}
3131

3232
return (
3333
<Popover>
3434
<PopoverTrigger asChild>
35-
<div className="relative w-48">
35+
<div className="relative w-32">
3636
<Button
3737
variant="outline"
3838
className="w-full h-12 relative flex items-center justify-center pb-2"
@@ -57,7 +57,7 @@ export const CloningView = ({ speechState, audioBlob }: CloningViewProps) => {
5757
className="w-full"
5858
/>
5959
<div className="text-xs text-muted-foreground">
60-
Processed audio ({Math.round(collected / 1000)}s)
60+
Sampled speech ({Math.round(collected / 1000)}s)
6161
</div>
6262
</div>
6363
</PopoverContent>

next/components/language-select.tsx

+24-12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use client";
22

3-
import { Language, describeLanguage } from "@/lib/types";
3+
import { Language, describeLanguage, LANGUAGE_INFO } from "@/lib/types";
44
import {
55
Select,
66
SelectContent,
@@ -9,34 +9,46 @@ import {
99
SelectValue,
1010
} from "@/components/ui/select";
1111
import { Label } from "@/components/ui/label";
12+
import * as Flags from 'country-flag-icons/react/3x2';
1213

1314
interface LanguageSelectProps {
1415
value: Language;
1516
onChange: (language: Language) => void;
1617
type: "input" | "output";
1718
}
1819

20+
// Map language codes to country codes for flags
21+
const LANGUAGE_TO_FLAG: Record<Language, keyof typeof Flags> = {
22+
[Language.ENGLISH_US]: 'US',
23+
[Language.SPANISH_MX]: 'MX',
24+
[Language.CHINESE_CN]: 'CN',
25+
[Language.ITALIAN]: 'IT',
26+
// Add more mappings as needed
27+
};
28+
1929
export const LanguageSelect = ({ value, onChange, type }: LanguageSelectProps) => {
2030
return (
21-
<div className="flex items-center gap-2">
31+
<div className="flex items-center gap-2 w-full">
2232
<Label>{type === "input" ? "Input" : "Output"}:</Label>
2333
<Select
2434
value={value}
2535
onValueChange={(val) => onChange(val as Language)}
2636
>
27-
<SelectTrigger>
37+
<SelectTrigger className="w-full text-lg">
2838
<SelectValue placeholder={`Select ${type} language`} />
2939
</SelectTrigger>
3040
<SelectContent>
31-
<SelectItem value={Language.ENGLISH_US}>
32-
{describeLanguage(Language.ENGLISH_US)}
33-
</SelectItem>
34-
<SelectItem value={Language.SPANISH_MX}>
35-
{describeLanguage(Language.SPANISH_MX)}
36-
</SelectItem>
37-
<SelectItem value={Language.CHINESE_CN}>
38-
{describeLanguage(Language.CHINESE_CN)}
39-
</SelectItem>
41+
{LANGUAGE_INFO.map((lang) => {
42+
const ItemFlagIcon = Flags[LANGUAGE_TO_FLAG[lang.code as Language]];
43+
return (
44+
<SelectItem key={lang.code} value={lang.code} className="text-lg">
45+
<div className="flex items-center gap-2">
46+
<ItemFlagIcon className="w-6 h-4" />
47+
{lang.name}
48+
</div>
49+
</SelectItem>
50+
);
51+
})}
4052
</SelectContent>
4153
</Select>
4254
</div>

0 commit comments

Comments
 (0)