Files
6e8e640738 feat: initial commit - Table Expiration Watcher
- Monitor de tabelas de planos de saúde prestes a vencer/vencidas
- Stack: Bun + Hono + SQLite + Zod + date-fns
- Alertas via Telegram e WhatsApp (AstraCalls MCP)
- UI de configuração estilo Apple/Planium em /configs
- Scheduler periódico com intervalo configurável
- Testes unitários e de integração (30 testes passando)

Co-Authored-By: Coder <coder@agent.local>
Co-Authored-By: Review <review@agent.local>
Co-Authored-By: Testing <testing@agent.local>
2026-11-25 09:43:00 -03:00

2.2 KiB

Table Expiration Watcher — AGENTS.md

Project Context

This is a new standalone service in the teamIron umbrella repo. It monitors CMS RMS health plan tables for expiration and sends alerts via Telegram/WhatsApp.

Stack: Bun + Hono + SQLite + Zod Port: 3002 Source: CMS RMS API (cms.rmscorretora.com.br)

Where to Commit

  • This project: /Volumes/dock_1TB/workspace/personal/Desenvolvimento_importantes/teamIron/warning-tabeles-expireds/
  • Remote: gitea.rdsnexus.vix.br:Rds/TableExpirationWatcher.git (to be created)
  • Branch: main

Development Rules

  • Never git add -A from teamIron root — commit from inside this directory
  • Bun runtime — use bun commands, not node/npm
  • Type-check: bun run lint (tsc --noEmit)
  • TDD: Write tests first (Red → Green → Refactor)
  • Config: All .env vars must be exposed in /configs UI (Apple Design pattern from Planium)

Commands (run from this directory)

bun install              # install deps
bun run dev              # watch mode
bun run start            # production
bun test                 # all tests
bun run lint             # type-check

Architecture Reference

See CLAUDE.md for full architecture, conventions, and file locations.

Copied Patterns from Planium Automation

  • TelegramNotifier with retry/rate-limit/pacing
  • AstraCallsClient MCP JSON-RPC + phone sanitization
  • Apple Design UI (settings-page.ts) — Onest font, RMS pink/cyan, segmented control
  • Secret Key auth (cookie + header) + health panel
  • SQLite settings persistence (UI > .env > default)

Key Files to Know

Purpose File
Entry + Scheduler src/index.ts
Config (Zod) src/core/config.ts
Domain Types src/domain/models/table.ts
Table Logic (status, sync) src/application/services/table-service.ts
Notifications src/application/services/notification-service.ts
SQLite Repos src/infrastructure/sqlite/repositories.ts
Telegram src/infrastructure/telegram/telegram-notifier.ts
WhatsApp (AstraCalls) src/infrastructure/astracalls/astracalls-client.ts
API Routes src/api/app.ts
UI Config Page src/api/views/settings-page.ts