2026-02-16 13:31:52 -06:00
|
|
|
import { createDb } from "./client.js";
|
Expand data model with companies, approvals, costs, and heartbeats
Add new DB schemas: companies, agent_api_keys, approvals, cost_events,
heartbeat_runs, issue_comments. Add corresponding shared types and
validators. Update existing schemas (agents, goals, issues, projects)
with new fields for company association, budgets, and richer metadata.
Generate initial Drizzle migration. Update seed data.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:07:22 -06:00
|
|
|
import { companies, agents, goals, projects, issues } from "./schema/index.js";
|
2026-02-16 13:31:52 -06:00
|
|
|
|
|
|
|
|
const url = process.env.DATABASE_URL;
|
|
|
|
|
if (!url) throw new Error("DATABASE_URL is required");
|
|
|
|
|
|
|
|
|
|
const db = createDb(url);
|
|
|
|
|
|
|
|
|
|
console.log("Seeding database...");
|
|
|
|
|
|
Expand data model with companies, approvals, costs, and heartbeats
Add new DB schemas: companies, agent_api_keys, approvals, cost_events,
heartbeat_runs, issue_comments. Add corresponding shared types and
validators. Update existing schemas (agents, goals, issues, projects)
with new fields for company association, budgets, and richer metadata.
Generate initial Drizzle migration. Update seed data.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:07:22 -06:00
|
|
|
const [company] = await db
|
|
|
|
|
.insert(companies)
|
|
|
|
|
.values({
|
|
|
|
|
name: "Paperclip Demo Co",
|
|
|
|
|
description: "A demo autonomous company",
|
|
|
|
|
status: "active",
|
|
|
|
|
budgetMonthlyCents: 50000,
|
|
|
|
|
})
|
2026-02-16 13:31:52 -06:00
|
|
|
.returning();
|
|
|
|
|
|
Expand data model with companies, approvals, costs, and heartbeats
Add new DB schemas: companies, agent_api_keys, approvals, cost_events,
heartbeat_runs, issue_comments. Add corresponding shared types and
validators. Update existing schemas (agents, goals, issues, projects)
with new fields for company association, budgets, and richer metadata.
Generate initial Drizzle migration. Update seed data.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:07:22 -06:00
|
|
|
const [ceo] = await db
|
|
|
|
|
.insert(agents)
|
|
|
|
|
.values({
|
|
|
|
|
companyId: company!.id,
|
|
|
|
|
name: "CEO Agent",
|
|
|
|
|
role: "ceo",
|
|
|
|
|
title: "Chief Executive Officer",
|
|
|
|
|
status: "idle",
|
|
|
|
|
adapterType: "process",
|
|
|
|
|
adapterConfig: { command: "echo", args: ["hello from ceo"] },
|
|
|
|
|
budgetMonthlyCents: 15000,
|
|
|
|
|
})
|
|
|
|
|
.returning();
|
2026-02-16 13:31:52 -06:00
|
|
|
|
Expand data model with companies, approvals, costs, and heartbeats
Add new DB schemas: companies, agent_api_keys, approvals, cost_events,
heartbeat_runs, issue_comments. Add corresponding shared types and
validators. Update existing schemas (agents, goals, issues, projects)
with new fields for company association, budgets, and richer metadata.
Generate initial Drizzle migration. Update seed data.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:07:22 -06:00
|
|
|
const [engineer] = await db
|
|
|
|
|
.insert(agents)
|
|
|
|
|
.values({
|
|
|
|
|
companyId: company!.id,
|
|
|
|
|
name: "Engineer Agent",
|
|
|
|
|
role: "engineer",
|
|
|
|
|
title: "Software Engineer",
|
|
|
|
|
status: "idle",
|
|
|
|
|
reportsTo: ceo!.id,
|
|
|
|
|
adapterType: "process",
|
|
|
|
|
adapterConfig: { command: "echo", args: ["hello from engineer"] },
|
|
|
|
|
budgetMonthlyCents: 10000,
|
|
|
|
|
})
|
2026-02-16 13:31:52 -06:00
|
|
|
.returning();
|
|
|
|
|
|
|
|
|
|
const [goal] = await db
|
|
|
|
|
.insert(goals)
|
Expand data model with companies, approvals, costs, and heartbeats
Add new DB schemas: companies, agent_api_keys, approvals, cost_events,
heartbeat_runs, issue_comments. Add corresponding shared types and
validators. Update existing schemas (agents, goals, issues, projects)
with new fields for company association, budgets, and richer metadata.
Generate initial Drizzle migration. Update seed data.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:07:22 -06:00
|
|
|
.values({
|
|
|
|
|
companyId: company!.id,
|
|
|
|
|
title: "Ship V1",
|
|
|
|
|
description: "Deliver first control plane release",
|
|
|
|
|
level: "company",
|
|
|
|
|
status: "active",
|
|
|
|
|
ownerAgentId: ceo!.id,
|
|
|
|
|
})
|
|
|
|
|
.returning();
|
|
|
|
|
|
|
|
|
|
const [project] = await db
|
|
|
|
|
.insert(projects)
|
|
|
|
|
.values({
|
|
|
|
|
companyId: company!.id,
|
|
|
|
|
goalId: goal!.id,
|
|
|
|
|
name: "Control Plane MVP",
|
|
|
|
|
description: "Implement core board + agent loop",
|
|
|
|
|
status: "in_progress",
|
|
|
|
|
leadAgentId: ceo!.id,
|
|
|
|
|
})
|
2026-02-16 13:31:52 -06:00
|
|
|
.returning();
|
|
|
|
|
|
|
|
|
|
await db.insert(issues).values([
|
|
|
|
|
{
|
Expand data model with companies, approvals, costs, and heartbeats
Add new DB schemas: companies, agent_api_keys, approvals, cost_events,
heartbeat_runs, issue_comments. Add corresponding shared types and
validators. Update existing schemas (agents, goals, issues, projects)
with new fields for company association, budgets, and richer metadata.
Generate initial Drizzle migration. Update seed data.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:07:22 -06:00
|
|
|
companyId: company!.id,
|
2026-02-16 13:31:52 -06:00
|
|
|
projectId: project!.id,
|
|
|
|
|
goalId: goal!.id,
|
Expand data model with companies, approvals, costs, and heartbeats
Add new DB schemas: companies, agent_api_keys, approvals, cost_events,
heartbeat_runs, issue_comments. Add corresponding shared types and
validators. Update existing schemas (agents, goals, issues, projects)
with new fields for company association, budgets, and richer metadata.
Generate initial Drizzle migration. Update seed data.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:07:22 -06:00
|
|
|
title: "Implement atomic task checkout",
|
|
|
|
|
description: "Ensure in_progress claiming is conflict-safe",
|
|
|
|
|
status: "todo",
|
|
|
|
|
priority: "high",
|
|
|
|
|
assigneeAgentId: engineer!.id,
|
|
|
|
|
createdByAgentId: ceo!.id,
|
2026-02-16 13:31:52 -06:00
|
|
|
},
|
|
|
|
|
{
|
Expand data model with companies, approvals, costs, and heartbeats
Add new DB schemas: companies, agent_api_keys, approvals, cost_events,
heartbeat_runs, issue_comments. Add corresponding shared types and
validators. Update existing schemas (agents, goals, issues, projects)
with new fields for company association, budgets, and richer metadata.
Generate initial Drizzle migration. Update seed data.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:07:22 -06:00
|
|
|
companyId: company!.id,
|
2026-02-16 13:31:52 -06:00
|
|
|
projectId: project!.id,
|
|
|
|
|
goalId: goal!.id,
|
Expand data model with companies, approvals, costs, and heartbeats
Add new DB schemas: companies, agent_api_keys, approvals, cost_events,
heartbeat_runs, issue_comments. Add corresponding shared types and
validators. Update existing schemas (agents, goals, issues, projects)
with new fields for company association, budgets, and richer metadata.
Generate initial Drizzle migration. Update seed data.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:07:22 -06:00
|
|
|
title: "Add budget auto-pause",
|
|
|
|
|
description: "Pause agent at hard budget ceiling",
|
|
|
|
|
status: "backlog",
|
|
|
|
|
priority: "medium",
|
|
|
|
|
createdByAgentId: ceo!.id,
|
2026-02-16 13:31:52 -06:00
|
|
|
},
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
console.log("Seed complete");
|
|
|
|
|
process.exit(0);
|