Cursor rule
.cursor/rules/core.mdcCursor rules
Quality
60/100
Scores the file, not the repository.Length
356 words
5 headings · 0 code blocksRepository
4.0k
— · pushed 2 days agoLast changed
3 days ago
First indexed 3 days ago.12345## Core (packages/core)67- **Role**: Event-driven "kernel" containing domain logic, database access, and message processing. It must stay UI-agnostic and transport-agnostic.8- **Design rules**:9 - New domain behavior belongs here first, then is exposed to clients via events.10 - Separate **event handlers** from **services**:11 - Event handlers translate `ToCoreEvent` / `FromCoreEvent` into service calls.12 - Services encapsulate business logic, DB queries, and Telegram API access.1314### Events & CoreContext1516- Keep `CoreContext` the single point of coordination:17 - One instance per session in server mode or browser mode.18 - All cross-module collaboration flows through its event emitter and helpers.19- When introducing new events:20 - Add them to the typed `ToCoreEvent` / `FromCoreEvent` maps.21 - Wire them through:22 - `packages/core/src/event-handlers`23 - `packages/client` adapters and event handler maps24 - `@tg-search/server/types` for WS mode25 - Provide **clear names** in `<domain>:<action>` form.2627### Database & Drizzle2829- Use `initDrizzle` as the only entry point for DB initialization:30 - It must support both PostgreSQL and PGlite via the `DatabaseType` enum and `Config.database`.31 - Avoid leaking raw `pg` or PGlite APIs outside dedicated DB modules (`pg.ts`, `pglite*.ts`).32- For queries:33 - Prefer Drizzle ORM APIs for type safety and portability.34 - Reserve raw SQL for performance-critical paths and keep them well-documented.35- When adding migrations:36 - Update TypeScript schemas/models first.37 - Use `drizzle-kit` to generate SQL migrations and avoid manual edits except for surgical fixes.3839### Message Resolvers & Pipelines4041- Resolvers under `src/message-resolvers` must:42 - Treat messages as **streams**, not immutable global state.43 - Be **idempotent**: re-running on the same input should not corrupt data.44 - Rely on message IDs for ordering and deduplication.45- Expensive operations (embeddings, link resolution) should:46 - Cache results whenever reasonable.47 - Defer to background-like processing while exposing progress events to clients.4849### Error Handling & Logging5051- Use `ctx.withError(error, description)` for all unexpected failures inside core services and handlers.52- Emit errors as events suitable for user-facing handling:53 - Avoid leaking raw Telegram or DB internals into error payloads.54 - Prefer structured error codes + contextual fields.55- Use `@guiiai/logg` consistently:56 - Attach domain-specific fields (chat/message IDs, operation names) instead of dumping entire payloads.5758
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/db.mdc · 4.0k | Cursor rules | styletypesdatabaseperformance | 59/100 | 3 days ago | |
| groupultra/telegram-search.cursor/rules/events.mdc · 4.0k | Cursor rules | style | 60/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/db.mdc Diff against .cursor/rules/events.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 |
