Add Zod validation layer and AI blog generation
Introduce a schema-first validation layer and an AI blog generation feature, plus one-command Cloudflare provisioning. - src/schemas/ holds Zod input schemas for post, content, case, settings, AI, and keywords; parseForm() in src/lib/form.ts validates FormData and returns per-field errors. - Migrate all admin POST handlers to parseForm, showing field-level errors and only redirecting once validation passes. - Add blog_keywords table and posts.focus_keyword (migration 0002); uniqueSlug() centralised in src/data/content.ts. - Add src/lib/ai.ts (OpenAI-compatible chat completions + optional Tavily research) and /admin/ai for AI settings, keyword queue, and draft generation. - Add scripts/setup.mjs (npm run setup) to provision D1/KV, set secrets, and optionally migrate, seed, and deploy. - Document AI secrets, Workers Builds deploy flow, and new schemas across README and AGENTS docs.
This commit is contained in:
+4
-2
@@ -19,7 +19,8 @@
|
||||
"db:studio": "drizzle-kit studio",
|
||||
"kv:create": "wrangler kv namespace create CACHE",
|
||||
"secret": "wrangler secret put ADMIN_PASSWORD",
|
||||
"types": "wrangler types"
|
||||
"types": "wrangler types",
|
||||
"setup": "node scripts/setup.mjs"
|
||||
},
|
||||
"dependencies": {
|
||||
"@astrojs/cloudflare": "^14.3.1",
|
||||
@@ -33,7 +34,8 @@
|
||||
"lucide-react": "^1.44.0",
|
||||
"marked": "^18.0.12",
|
||||
"react": "^19.3.0",
|
||||
"react-dom": "^19.3.0"
|
||||
"react-dom": "^19.3.0",
|
||||
"zod": "^4.6.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^22.20.2",
|
||||
|
||||
Reference in New Issue
Block a user