kappa
2756dbe804
refactor: migrate HTTP routing to Hono framework
...
- Add hono dependency
- Replace if/else routing chain with Hono app
- Convert all HTTP routes to Hono format:
- GET /health, /setup-webhook, /webhook-info
- POST /webhook
- ALL /api/*
- GET /
- Keep email, scheduled, queue handlers unchanged
- Maintain 100% backward compatibility
Benefits:
- Cleaner declarative routing
- Type-safe Env bindings
- Ready for future middleware (CORS, rate limiting)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-01-29 09:40:38 +09:00
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