Cline rules
.clinerules/protobuf-development.mdCline rules
Quality
74/100
Scores the file, not the repository.Length
450 words
8 headings · 4 code blocksRepository
66k
— · pushed 0 days agoLast changed
3 days ago
First indexed 3 days ago.1# Cline Protobuf Development Guide23This guide outlines how to add new gRPC endpoints for communication between the webview (frontend) and the extension host (backend).45## Overview67Cline uses [Protobuf](https://protobuf.dev/) to define a strongly-typed API, ensuring efficient and type-safe communication. All definitions are in the `/proto` directory. The compiler and plugins are included as project dependencies, so no manual installation is needed.89## Key Concepts & Best Practices1011- **File Structure**: Each feature domain should have its own `.proto` file (e.g., `account.proto`, `task.proto`).12- **Message Design**:13 - For simple, single-value data, use the shared types in `proto/common.proto` (e.g., `StringRequest`, `Empty`, `Int64Request`). This promotes consistency.14 - For complex data structures, define custom messages within the feature's `.proto` file (see `task.proto` for examples like `NewTaskRequest`).15- **Naming Conventions**:16 - Services: `PascalCaseService` (e.g., `AccountService`).17 - RPCs: `camelCase` (e.g., `accountEmailIdentified`).18 - Messages: `PascalCase` (e.g., `StringRequest`).19- **Streaming**: For server-to-client streaming, use the `stream` keyword on the response type. See `subscribeToAuthCallback` in `account.proto` for an example.2021---2223## 4-Step Development Workflow2425Here’s how to add a new RPC, using `scrollToSettings` as an example.2627### 1. Define the RPC in a `.proto` File2829Add your service method to the appropriate file in the `proto/` directory.3031**File: `proto/ui.proto`**32```proto33service UiService {34 // ... other RPCs35 // Scrolls to a specific settings section in the settings view36 rpc scrollToSettings(StringRequest) returns (KeyValuePair);37}38```39Here, we use the common `StringRequest` and `KeyValuePair` types.4041### 2. Compile Definitions4243After editing a `.proto` file, regenerate the TypeScript code. From the project root, run:44```bash45bun run protos46```47This command compiles all `.proto` files and outputs the generated code to `src/generated/` and `src/shared/`. Do not edit these generated files manually.4849### 3. Implement the Backend Handler5051Create the RPC implementation in the backend. Handlers are located in `src/core/controller/[service-name]/`.5253**File: `src/core/controller/ui/scrollToSettings.ts`**54```typescript55import { Controller } from ".."56import { StringRequest, KeyValuePair } from "../../../shared/proto/common"5758/**59 * Executes a scroll to settings action60 * @param controller The controller instance61 * @param request The request containing the ID of the settings section to scroll to62 * @returns KeyValuePair with action and value fields for the UI to process63 */64export async function scrollToSettings(controller: Controller, request: StringRequest): Promise<KeyValuePair> {65 return KeyValuePair.create({66 key: "scrollToSettings",67 value: request.value || "",68 })69}70```7172### 4. Call the RPC from the Webview7374Call the new RPC from a React component in `webview-ui/`. The generated client makes this simple.7576**File: `webview-ui/src/components/browser/BrowserSettingsMenu.tsx`** (Example)77```tsx78import { UiServiceClient } from "../../../services/grpc"79import { StringRequest } from "../../../../shared/proto/common"8081// ... inside a React component82const handleMenuClick = async () => {83 try {84 await UiServiceClient.scrollToSettings(StringRequest.create({ value: "browser" }))85 } catch (error) {86 console.error("Error scrolling to browser settings:", error)87 }88}89```90
Also in cline/cline
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| cline/cline.clinerules/bun-and-node.md · 66k | Cline rules | setuptestmonorepodo-not | 74/100 | 3 days ago | |
| cline/cline.clinerules/cline-overview.md · 66k | Cline rules | archtypesapi | 54/100 | 3 days ago | |
| cline/cline.clinerules/debug-harness.md · 66k | Cline rules | buildtesttesting-strategysecurity+1 | 85/100 | 3 days ago | |
| cline/cline.clinerules/general.md · 66k | Cline rules | setupbuildstylearch+2 | 86/100 | 3 days ago | |
| cline/cline.clinerules/network.md · 66k | Cline rules | styletesting-strategydependencies | 54/100 | 3 days ago | |
| cline/cline.clinerules/sdk-migration.md · 66k | Cline rules | style | 59/100 | 3 days ago | |
| cline/cline.clinerules/storage.md · 66k | Cline rules | stylearchdatabasedo-not | 65/100 | 3 days ago | |
| cline/cline.github/copilot-instructions.md · 66k | Copilot instructions | buildteststyleapi+1 | 75/100 | 3 days ago | |
| cline/clineAGENTS.md · 66k | AGENTS.md | buildtestlint-formatstyle+2 | 83/100 | 3 days ago | |
| cline/clinesdk/AGENTS.md · 66k | AGENTS.md | setupbuildteststyle+5 | 89/100 | 3 days ago | |
| cline/clinesdk/packages/llms/AGENTS.md · 66k | AGENTS.md | no sections | 45/100 | 3 days ago |
Diff against .clinerules/bun-and-node.md Diff against .clinerules/cline-overview.md Diff against .clinerules/debug-harness.md Diff against .clinerules/general.md Diff against .clinerules/network.md Diff against .clinerules/sdk-migration.md Diff against .clinerules/storage.md Diff against .github/copilot-instructions.md Diff against AGENTS.md Diff against sdk/AGENTS.md Diff against sdk/packages/llms/AGENTS.md
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| bashdeban/fastmind.clinerules/.project-consistency-keeper2.md · 5 | Cline rules | setupbuildtestlint-format+11 | 100/100 | 3 days ago | |
| JCodesMore/ai-website-cloner-template.clinerules · 31k | Cline rules | buildlint-formatstylearch+3 | 97/100 | 2 days ago | |
| BryaanF/LiantPortfolio.clinerules/project-guidelines.md · 0 | Cline rules | buildstylearchgit+2 | 96/100 | 3 days ago | |
| u9401066/zotero-keeper.clinerules/50-pubmed-project.md · 6 | Cline rules | testlint-formatstylearch+1 | 94/100 | 3 days ago | |
| u9401066/zotero-keepervscode-extension/resources/repo-assets/pubmed-search-mcp/.clinerules/50-pubmed-project.md · 6 | Cline rules | testlint-formatstylearch+1 | 94/100 | 3 days ago | |
| VaillerTeeter/HoshimiNest.clinerules/project-identity.md · 1 | Cline rules | setuparchtypesdo-not | 93/100 | yesterday | |
| HerringtonDarkholme/megarepo.clinerules/02-development.md · 17 | Cline rules | setupbuildteststyle+3 | 92/100 | 3 days ago | |
| blendsdk/codeops-mcp.clinerules/project.md · 0 | Cline rules | buildteststylearch+7 | 91/100 | 3 days ago |
