This file provides guidance to coding agents when working with code in this repository.
This is an auto-moderator application that monitors task deadlines in a Notion database and sends reminders to Discord. It fetches tasks with deadlines within 3 days that are not marked as completed, formats them with assignee mentions, and sends notifications via Discord webhook.
- Start the application:
bun run start - Type checking:
bun run ciorbunx tsc - Linting and formatting:
biome check --write(configured for 120 character line width, 2-space indentation)
The codebase is organized into 4 focused TypeScript modules:
src/main.ts: Main application logic that orchestrates task fetching, formatting, and notification sendingsrc/validator.ts: Valibot schemas for validating Notion API responses and type definitionssrc/io.ts: I/O utilities for environment variables, retry logic, Discord webhooks, and Notion API queriessrc/data.ts: Static mapping between Notion user names and Discord user IDs for @mentions
The application follows a functional architecture with clear separation:
- Data Layer: Notion API integration with type-safe schema validation using Valibot
- Business Logic: Task filtering (3-day deadline window), formatting with Discord mentions
- I/O Layer: Discord webhook notifications with retry mechanism
Required environment variables:
NOTION_API_KEY: Notion integration tokenDISCORD_WEBHOOK_URL: Discord webhook URL for notifications
Lefthook is configured for pre-commit hooks:
- Biome formatting and linting with auto-fix
- TypeScript type checking
Run lefthook install to set up hooks.
- Runtime: Bun
- Language: TypeScript with strict mode
- Validation: Valibot for runtime type safety
- APIs: Notion API v2022-06-28, Discord webhooks
- Tooling: Biome for linting/formatting, Lefthook for git hooks