Files
telegram-bot-workers/package.json
kappa 45e0677ab0 refactor: code quality improvements (P3)
## Type Safety
- Add zod runtime validation for external API responses
  * Namecheap API responses (domain-register.ts)
  * n8n webhook responses (n8n-service.ts)
  * User request bodies (routes/api.ts)
  * Replaced unsafe type assertions with safeParse()
  * Proper error handling and logging

## Dead Code Removal
- Remove unused callDepositAgent function (127 lines)
  * Legacy Assistants API code no longer needed
  * Now using direct code execution
  * File reduced from 469 → 345 lines (26.4% reduction)

## Configuration Management
- Extract hardcoded URLs to environment variables
  * Added 7 new vars in wrangler.toml:
    OPENAI_API_BASE, NAMECHEAP_API_URL, WHOIS_API_URL,
    CONTEXT7_API_BASE, BRAVE_API_BASE, WTTR_IN_URL, HOSTING_SITE_URL
  * Updated Env interface in types.ts
  * All URLs have fallback to current production values
  * Enables environment-specific configuration (dev/staging/prod)

## Dependencies
- Add zod 4.3.5 for runtime type validation

## Files Modified
- Configuration: wrangler.toml, types.ts, package.json
- Services: 11 TypeScript files with URL/validation updates
- Total: 15 files, +196/-189 lines

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-19 22:06:01 +09:00

32 lines
818 B
JSON

{
"name": "telegram-summary-bot",
"version": "1.0.0",
"description": "Telegram bot with rolling summary using Cloudflare Workers + D1",
"main": "src/index.ts",
"scripts": {
"dev": "wrangler dev",
"deploy": "wrangler deploy",
"db:create": "wrangler d1 create telegram-summary-db",
"db:init": "wrangler d1 execute telegram-summary-db --file=schema.sql",
"db:init:local": "wrangler d1 execute telegram-summary-db --local --file=schema.sql",
"tail": "wrangler tail",
"chat": "npx tsx scripts/chat.ts"
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20241127.0",
"typescript": "^5.3.3",
"wrangler": "^4.59.2"
},
"keywords": [
"telegram",
"bot",
"cloudflare",
"workers",
"d1",
"ai"
],
"dependencies": {
"zod": "^4.3.5"
}
}