Skip to content

Commit c66e79b

Browse files
authored
implement ai:proxyurl for proxy url access to different models (#2263)
1 parent 559ed2e commit c66e79b

14 files changed

Lines changed: 517 additions & 2 deletions

File tree

File renamed without changes.

.roo/rules/rules.md

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
Wave Terminal is a modern terminal which provides graphical blocks, dynamic layout, workspaces, and SSH connection management. It is cross platform and built on electron.
2+
3+
### Project Structure
4+
5+
It has a TypeScript/React frontend and a Go backend. They talk together over `wshrpc` a custom RPC protocol that is implemented over websocket (and domain sockets).
6+
7+
### Coding Guidelines
8+
9+
- **Go Conventions**:
10+
- Don't use custom enum types in Go. Instead, use string constants (e.g., `const StatusRunning = "running"` rather than creating a custom type like `type Status string`).
11+
- Use string constants for status values, packet types, and other string-based enumerations.
12+
- in Go code, prefer using Printf() vs Println()
13+
- use "Make" as opposed to "New" for struct initialization func names
14+
- in general const decls go at the top fo the file (before types and functions)
15+
- NEVER run `go build` (especially in weird sub-package directories). we can tell if everything compiles by seeing there are no problems/errors.
16+
- **Synchronization**:
17+
- Always prefer to use the `lock.Lock(); defer lock.Unlock()` pattern for synchronization if possible
18+
- Avoid inline lock/unlock pairs - instead create helper functions that use the defer pattern
19+
- When accessing shared data structures (maps, slices, etc.), ensure proper locking
20+
- Example: Instead of `gc.lock.Lock(); gc.map[key]++; gc.lock.Unlock()`, create a helper function like `getNextValue(key string) int { gc.lock.Lock(); defer gc.lock.Unlock(); gc.map[key]++; return gc.map[key] }`
21+
- **TypeScript Imports**:
22+
- Use `@/...` for imports from different parts of the project (configured in `tsconfig.json` as `"@/*": ["frontend/*"]`).
23+
- Prefer relative imports (`"./name"`) only within the same directory.
24+
- Use named exports exclusively; avoid default exports. It's acceptable to export functions directly (e.g., React Components).
25+
- Our indent is 4 spaces
26+
- **JSON Field Naming**: All fields must be lowercase, without underscores.
27+
- **TypeScript Conventions**
28+
- **Type Handling**:
29+
- In TypeScript we have strict null checks off, so no need to add "| null" to all the types.
30+
- In TypeScript for Jotai atoms, if we want to write, we need to type the atom as a PrimitiveAtom<Type>
31+
- Jotai has a bug with strict null checks off where if you create a null atom, e.g. atom(null) it does not "type" correctly. That's no issue, just cast it to the proper PrimitiveAtom type (no "| null") and it will work fine.
32+
- Generally never use "=== undefined" or "!== undefined". This is bad style. Just use a "== null" or "!= null" unless it is a very specific case where we need to distinguish undefined from null.
33+
- **Coding Style**:
34+
- Use all lowercase filenames (except where case is actually important like Taskfile.yml)
35+
- Import the "cn" function from "@/util/util" to do classname / clsx class merge (it uses twMerge underneath)
36+
- For element variants use class-variance-authority
37+
- **Component Practices**:
38+
- Make sure to add cursor-pointer to buttons/links and clickable items
39+
- NEVER use cursor-help (it looks terrible)
40+
- useAtom() and useAtomValue() are react HOOKS, so they must be called at the component level not inline in JSX
41+
- If you use React.memo(), make sure to add a displayName for the component
42+
43+
### Styling
44+
45+
- We use tailwind v4 to style. Custom stuff is defined in tailwindsetup.css.
46+
- _never_ use cursor-help (it looks terrible)
47+
- We have custom CSS setup as well, so it is a hybrid system. For new code we prefer tailwind, and are working to migrate code to all use tailwind.
48+
49+
### Code Generation
50+
51+
- **TypeScript Types**: TypeScript types are automatically generated from Go types. After modifying Go types in `pkg/wshrpc/wshrpctypes.go`, run `task generate` to update the TypeScript type definitions in `frontend/types/gotypes.d.ts`.
52+
- **Manual Edits**: Do not manually edit generated files like `frontend/types/gotypes.d.ts` or `frontend/app/store/wshclientapi.ts`. Instead, modify the source Go types and run `task generate`.
53+
54+
### Documentation References
55+
56+
Found in /aiprompts
57+
58+
- config-system.md -- for help with adding new config or settings values
59+
- contextmenu.md
60+
- getsetconfigvar.md
61+
- view-prompt.md -- view model guide
62+
63+
### Frontend Architecture
64+
65+
- The application uses Jotai for state management.
66+
- When working with Jotai atoms that need to be updated, define them as `PrimitiveAtom<Type>` rather than just `atom<Type>`.
67+
68+
### Notes
69+
70+
- **CRITICAL: Completion format MUST be: "Done: [one-line description]"**
71+
- **Keep your Task Completed summaries VERY short**
72+
- **No lengthy pre-completion summaries** - Do not provide detailed explanations of implementation before using attempt_completion
73+
- **No recaps of changes** - Skip explaining what was done before completion
74+
- **Go directly to completion** - After making changes, proceed directly to attempt_completion without summarizing
75+
- The project is currently an un-released POC / MVP. Do not worry about backward compatibility when making changes
76+
- With React hooks, always complete all hook calls at the top level before any conditional returns (including jotai hook calls useAtom and useAtomValue); when a user explicitly tells you a function handles null inputs, trust them and stop trying to "protect" it with unnecessary checks or workarounds.
77+
- **Match response length to question complexity** - For simple, direct questions in Ask mode (especially those that can be answered in 1-2 sentences), provide equally brief answers. Save detailed explanations for complex topics or when explicitly requested.
78+
- **CRITICAL** - useAtomValue and useAtom are React HOOKS. They cannot be used inline in JSX code, they must appear at the top of a component in the hooks area of the react code.
79+
80+
### Strict Comment Rules
81+
82+
- **NEVER add comments that merely describe what code is doing**:
83+
-`mutex.Lock() // Lock the mutex`
84+
-`counter++ // Increment the counter`
85+
-`buffer.Write(data) // Write data to buffer`
86+
-`// Header component for app run list` (above AppRunListHeader)
87+
-`// Updated function to include onClick parameter`
88+
-`// Changed padding calculation`
89+
-`// Removed unnecessary div`
90+
-`// Using the model's width value here`
91+
- **Only use comments for**:
92+
- Explaining WHY a particular approach was chosen
93+
- Documenting non-obvious edge cases or side effects
94+
- Warning about potential pitfalls in usage
95+
- Explaining complex algorithms that can't be simplified
96+
- **When in doubt, leave it out**. No comment is better than a redundant comment.
97+
- **Never add comments explaining code changes** - The code should speak for itself, and version control tracks changes. The one exception to this rule is if it is a very unobvious implementation. Something that someone would typically implement in a different (wrong) way. Then the comment helps us remember WHY we changed it to a less obvious implementation.
98+
99+
### Tool Use
100+
101+
Do NOT use write_to_file unless it is a new file or very short. Always prefer to use replace_in_file. Often your diffs fail when a file may be out of date in your cache vs the actual on-disk format. You should RE-READ the file and try to create diffs again if your diffs fail rather than fall back to write_to_file. If you feel like your ONLY option is to use write_to_file please ask first.
102+
103+
Also when adding content to the end of files prefer to use the new append_file tool rather than trying to create a diff (as your diffs are often not specific enough and end up inserting code in the middle of existing functions).
104+
105+
### Directory Awareness
106+
107+
- **ALWAYS verify the current working directory before executing commands**
108+
- Either run "pwd" first to verify the directory, or do a "cd" to the correct absolute directory before running commands
109+
- When running tests, do not "cd" to the pkg directory and then run the test. This screws up the cwd and you never recover. run the test from the project root instead.

0 commit comments

Comments
 (0)