# Tasks — Add @suaveplan/telegram-client ## 1. Spec authoring - [x] 1.1 Read `../suaveplan/enterprise/telegram-client.md` end-to-end - [x] 1.2 Read `openspec/specs/telegram-client/spec.md` (does not exist yet — new cap) - [x] 1.3 Read `openspec/templates/README.md` (substitute for missing AGENTS.md) - [x] 1.4 Draft `proposal.md` from `openspec/templates/proposal.md` - [x] 1.5 Fill `## Source mapping` — every requirement cites file/line or appears in the no-source table - [x] 1.6 Draft `specs/telegram-client/spec.md` from `openspec/templates/spec-delta.md` - [x] 1.7 Every requirement carries a `**Verified by:**` line naming concrete `it(...)` titles ## 2. Implementation - [x] 2.1 Scaffold package layout at `packages/messaging/telegram-client/` - [x] 2.2 Author `src/types/telegram-bot-config.ts` with Zod schema + runtime type - [x] 2.3 Author `src/types/telegram-client.types.ts` covering every upstream surface type - [x] 2.4 Author `src/errors/telegram-client-error.ts` with `defineCodes` + class - [x] 2.5 Author `src/utils/build-bodies.ts` (pure body / reply-markup builders) - [x] 2.6 Author `src/utils/classify-error.ts` (pure status + retry-after classifier) - [x] 2.7 Author `src/core/telegram-bot-client/telegram-bot-client.ts` (client, OTel, injectable fetch+clock) - [x] 2.8 Author barrel `src/index.ts` with explicit named exports + subpath exports - [x] 2.9 `package.json` with `0.1.0`, `sideEffects:false`, subpath exports, deps - [x] 2.10 `vite.config.ts` + `vitest.config.ts` + `tsconfig.lib.json` + `tsconfig.json` - [x] 2.11 `tests/setup/polyfills.ts` and `tests/dep-graph.test.ts` - [x] 2.12 `README.md` at root, no category-level READMEs ## 3. Tests - [x] 3.1 Unit tests at `src/core/telegram-bot-client/telegram-bot-client.test.ts` covering every scenario - [x] 3.2 Pure-helper tests at `src/utils/build-bodies.test.ts`, `src/utils/classify-error.test.ts` - [x] 3.3 Error registry tests at `src/errors/telegram-client-error.test.ts` - [x] 3.4 Zod schema tests at `src/types/telegram-bot-config.test.ts` - [x] 3.5 Every `it(...)` carries `{ timeout: 5000 }` (or 30000 for genuinely async) - [x] 3.6 No `vi.mock`, no `globalThis.fetch` spy — injectable fetch only ## 4. Documentation - [x] 4.1 Sibling `.md` for every implementation `.ts` (≥200 words, basic + advanced examples) - [x] 4.2 README links every co-located `.md` under `## Modules` ## 5. Pre-archive verification (the 5-gate triple) - [x] 5.1 `bun run check` — Biome 0 errors / 0 warnings / 0 info - [x] 5.2 `bunx turbo lint typecheck test --filter=@suaveplan/telegram-client` — green - [x] 5.3 `bunx turbo test:coverage --filter=@suaveplan/telegram-client` — 100/100/100/100 - [x] 5.4 `bun scripts/openspec-conformance.ts @suaveplan/telegram-client` — exit 0 - [x] 5.5 `bunx turbo build --filter=@suaveplan/telegram-client` — green ## 6. Pre-archive 7-row checklist - [x] 6.1 Generics threaded; `expectTypeOf` assertions on every literal-type claim - [x] 6.2 Zod schemas wired at every declared boundary (config) - [x] 6.3 Every error code in `error-codes.ts` thrown by at least one production path - [x] 6.4 Strict-mode behaviors tested (Zod parse rejects) - [x] 6.5 OTel instruments emitted from production paths and asserted with a real in-memory `MeterProvider` - [x] 6.6 Lifecycle dedup — N/A (stateless client) - [x] 6.7 No retroactive tick — every box above reflects work done in this change ## 7. Archive - [x] 7.1 Fold spec delta into `openspec/specs/telegram-client/spec.md` - [x] 7.2 Move `openspec/changes/add-telegram-client/` → `openspec/archive/2026-05-18-add-telegram-client/`