Files
agent-bounty-protocol/apps/web/seed.ts
OG T 384274f5c1
Some checks failed
Deploy to 110 WOOO Server / deploy (push) Failing after 8s
feat: translate frontend to TC and add seed tasks
2026-06-07 14:06:43 +08:00

52 lines
3.7 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { PrismaClient } from "./prisma/generated/client";
const prisma = new PrismaClient();
const SEED_TASKS = [
{ id: "SW-01", title: "Hello VibeWork 標題元件", price: 100, difficulty: "HELLO_WORLD", desc: "在頁面渲染 <h1>Hello VibeWork</h1>" },
{ id: "SW-02", title: "單色「開始任務」按鈕", price: 100, difficulty: "HELLO_WORLD", desc: "按鈕文案「Start」與 bg-blue-500 text-white rounded-md px-4 py-2" },
{ id: "SW-03", title: "小字元件預留區Badge", price: 100, difficulty: "HELLO_WORLD", desc: "渲染圓角白底字元標籤,包含 text-sm" },
{ id: "SW-04", title: "靜態標籤列3 個 chip", price: 100, difficulty: "HELLO_WORLD", desc: "渲染 3 個 .chip 區塊,僅樣式與字串一致" },
{ id: "SW-05", title: "簡易 Footer", price: 100, difficulty: "HELLO_WORLD", desc: "包含「Copyright」與年份字串" },
{ id: "SW-06", title: "Hero 區塊(無互動)", price: 100, difficulty: "HELLO_WORLD", desc: "包含主標與副標,副標長度 > 15" },
{ id: "SW-07", title: "空白頁 + 預留插槽", price: 100, difficulty: "HELLO_WORLD", desc: "渲染空白卡片與「No data」提示" },
{ id: "SW-08", title: "單欄價格卡片", price: 500, difficulty: "EASY", desc: "顯示 title / price / description需有 3 列布局" },
{ id: "SW-09", title: "Login Primary Button 組件", price: 500, difficulty: "EASY", desc: "包含「登入」字樣與 onClick prop 傳遞" },
{ id: "SW-10", title: "Secondary Buttonoutline 變體)", price: 500, difficulty: "EASY", desc: "需有 variant propoutline 時 border 不透明" },
{ id: "SW-11", title: "Alert Bannersuccess / error", price: 500, difficulty: "EASY", desc: "兩種 type 切換字體色與 icon class" },
{ id: "SW-12", title: "Modal Trigger無邏輯", price: 500, difficulty: "EASY", desc: "可見觸發按鈕並渲染 Modal 區塊框" },
{ id: "SW-13", title: "輸入框 + 標籤組件", price: 500, difficulty: "EASY", desc: "<label> 與 <input placeholder> 一一對應" },
{ id: "SW-14", title: "卡片列表3 欄)", price: 500, difficulty: "EASY", desc: "items 渲染為固定 3 張卡,含標題與小標" },
{ id: "SW-15", title: "導航列desktop", price: 500, difficulty: "EASY", desc: "左側品牌、右側 3 個連結,含 active 狀態 class" },
{ id: "SW-16", title: "結帳摘要面板", price: 1000, difficulty: "MEDIUM", desc: "呈現 plan name / amount / tax / total含灰階邊框" },
{ id: "SW-17", title: "靜態 KPI Dashboard", price: 1000, difficulty: "MEDIUM", desc: "3 張數據卡 + 1 張圓餅圖占位 SVG" },
{ id: "SW-18", title: "訂閱設定卡片區", price: 1000, difficulty: "MEDIUM", desc: "包含「月費/年費」切換 UI僅 UI 不需真正切換)" },
{ id: "SW-19", title: "產品特性對照表", price: 1000, difficulty: "MEDIUM", desc: "3 行比較表(欄位固定)" },
{ id: "SW-20", title: "活躍通知列表頁", price: 1000, difficulty: "MEDIUM", desc: "渲染 4 列通知項目與「read/unread」狀態色" },
];
async function main() {
console.log("Seeding 20 official tasks...");
for (const t of SEED_TASKS) {
await prisma.task.create({
data: {
title: `[${t.id}] ${t.title}`,
description: t.desc,
status: "OPEN",
difficulty: t.difficulty as any,
scope_clarity_score: 0.95,
reward_amount: t.price,
reward_currency: "USD",
acceptance_criteria: {
validation_mode: "VITEST_UNIT",
test_file_content: "import { expect, test } from 'vitest'; test('it works', () => expect(1).toBe(1));"
},
required_stack: ["React", "TailwindCSS"],
}
});
}
console.log("Seeding complete!");
}
main().catch(console.error).finally(() => prisma.$disconnect());