Cursor rule
.cursor/rules/events.mdcCursor rules
Quality
60/100
Scores the file, not the repository.Length
430 words
6 headings · 0 code blocksRepository
4.0k
— · pushed 2 days agoLast changed
3 days ago
First indexed 3 days ago.1234## Cross-Layer Events & Protocol Design56- **Scope**: Any change that adds/renames/removes events flowing between:7 - Vue/Pinia (apps/web)8 - `packages/client`9 - `apps/server` WebSocket layer10 - `packages/core` event handlers & services1112### 1. Before You Add or Change an Event1314- Answer, in your head or in an RFC:15 - **Where is the bottleneck?** (UX latency? DB load? Telegram API limits?)16 - **What is the minimal new behavior?** (One sentence, domain language.)17 - **What is the data flow?** (Component → store → client adapter → WS/core → DB → back.)18 - **How does this handle failure?**19 - Core error?20 - Network loss?21 - Partial success (e.g. some messages processed)?2223### 2. Event Naming & Payloads2425- Naming:26 - Use `<domain>:<action>` or `<domain>:<action>:<subaction>`.27 - Avoid generic verbs like `update`, `done`; always include the domain (`message`, `storage`, `auth`, etc.).28- Payloads:29 - Prefer **IDs + small shapes** over dumping full DB rows or Telegram objects.30 - Do not leak raw internal schemas as event payloads unless they are explicitly part of the public model.31 - Include enough context to render the UI without requiring a second roundtrip when reasonable.3233### 3. End-to-End Wiring Checklist3435When adding a new event, ensure all of the following are updated **in one change**:3637- **Types & contracts**:38 - `@tg-search/core` `ToCoreEvent` / `FromCoreEvent`.39 - `@tg-search/server/types` WS mappings (`WsEventToServer`, `WsEventToClient`).40 - Client event handler maps in `packages/client`.41- **Handlers**:42 - Core event handler under `packages/core/src/event-handlers`.43 - Service function(s) in `packages/core/src/services`.44 - Client-side handler that maps `FromCoreEvent` into Pinia state.45- **UI**:46 - Minimal component/store changes to actually use the new event.4748### 4. Backwards Compatibility & Refactors4950- Prefer **adding** new events over changing semantics of existing ones.51- If an event must change:52 - Keep the old event name working for at least one release where possible.53 - Introduce a new event name for the new behavior and migrate callers gradually.54- For refactors across layers (e.g. renaming a domain or action):55 - Do a **mechanical rename** across types, handlers, and callers in one PR.56 - Avoid long-lived “mixed” states where some code uses old names and some uses new ones.5758### 5. Errors, Timeouts & Idempotency5960- Treat every event as potentially:61 - Lost (network issues).62 - Duplicated (retries).63 - Delayed (backpressure).64- Design handlers to be **idempotent** where possible:65 - Re-applying the same event should not corrupt state.66 - Use message IDs and versioning to detect duplicates.67- Error semantics:68 - Core should emit structured error events with codes and key context, not just strings.69 - Client should surface user-friendly messages and, where safe, allow retry.7071
Also in groupultra/telegram-search
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 |
|---|---|---|---|---|---|
| groupultra/telegram-search.cursor/rules/testing.mdc · 4.0k | Cursor rules | teststyletesting-strategydatabase | 55/100 | 3 days ago | |
| groupultra/telegram-search.cursor/rules/architecture.mdc · 4.0k | Cursor rules | buildtestlint-formatarch+4 | 89/100 | 3 days ago | |
| groupultra/telegram-search.cursor/rules/backend-server.mdc · 4.0k | Cursor rules | setupsecuritymonorepo | 52/100 | 3 days ago | |
| groupultra/telegram-search.cursor/rules/client.mdc · 4.0k | Cursor rules | stylearchtypesdependencies+1 | 60/100 | 3 days ago | |
| groupultra/telegram-search.cursor/rules/contributing.mdc · 4.0k | Cursor rules | styletypesgit | 56/100 | 3 days ago | |
| groupultra/telegram-search.cursor/rules/core.mdc · 4.0k | Cursor rules | stylearchdependenciesdatabase+1 | 60/100 | 3 days ago | |
| groupultra/telegram-search.cursor/rules/db.mdc · 4.0k | Cursor rules | styletypesdatabaseperformance | 59/100 | 3 days ago | |
| groupultra/telegram-search.cursor/rules/frontend-web.mdc · 4.0k | Cursor rules | stylesecurityuimonorepo | 56/100 | 3 days ago | |
| groupultra/telegram-search.cursor/rules/pglite-inspector.mdc · 4.0k | Cursor rules | securityapi | 47/100 | 3 days ago | |
| groupultra/telegram-search.cursor/rules/tooling.mdc · 4.0k | Cursor rules | buildlint-formatstyledeployment+1 | 67/100 | 3 days ago | |
| groupultra/telegram-search.github/copilot-instructions.md · 4.0k | Copilot instructions | teststyleagent-behaviour | 76/100 | 3 days ago | |
| groupultra/telegram-searchAGENTS.md · 4.0k | AGENTS.md | setupbuildtestlint-format+10 | 83/100 | 3 days ago |
Diff against .cursor/rules/testing.mdc Diff against .cursor/rules/architecture.mdc Diff against .cursor/rules/backend-server.mdc Diff against .cursor/rules/client.mdc Diff against .cursor/rules/contributing.mdc Diff against .cursor/rules/core.mdc Diff against .cursor/rules/db.mdc Diff against .cursor/rules/frontend-web.mdc Diff against .cursor/rules/pglite-inspector.mdc Diff against .cursor/rules/tooling.mdc Diff against .github/copilot-instructions.md Diff against AGENTS.md
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126 | Cursor rules | setupbuildtestlint-format+6 | 100/100 | 3 days ago | |
| TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 45 | Cursor rules | testlint-formatstylearch+5 | 100/100 | 3 days ago | |
| markstev/mark-starter.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+6 | 99/100 | 3 days ago | |
| Allymahmoud/case-intake-platform.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| dodgecfr/combatfilms-webapp.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| deifos/clipmira-subtitles.cursor/rules/frontend.mdc · 1 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| langflow-ai/langflow.cursor/rules/docs_development.mdc · 153k | Cursor rules | setupbuildtestlint-format+7 | 97/100 | 3 days ago | |
| TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 45 | Cursor rules | teststyletesting-strategysecurity+3 | 97/100 | 3 days ago |
