From 073eec71935f016c9406893b9c49949ba1fa0c2a Mon Sep 17 00:00:00 2001 From: Simone Cavalli Date: Thu, 14 May 2026 23:33:03 +0200 Subject: [PATCH] feat(seed): add seed script + fix Tailwind scanning adjacent projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - scripts/seed.ts: inserts one complete test client with 3 phases, 6 tasks, 4 deliverables, 2 payments, 2 documents, 2 notes; prints shareable URL to console - globals.css: add @source not directives to exclude .01_projects/ and .claude/ — Tailwind v4 was scanning the SparklingOrbit .venv Python files and generating invalid CSS class [-:|] from a regex pattern in a markdown-it table parser, causing dev server 500s Co-Authored-By: Claude Sonnet 4.6 --- scripts/seed.ts | 107 ++++++++++++++++++++++++++++++++++++++++++++ src/app/globals.css | 3 ++ 2 files changed, 110 insertions(+) create mode 100644 scripts/seed.ts diff --git a/scripts/seed.ts b/scripts/seed.ts new file mode 100644 index 0000000..a0f3cf2 --- /dev/null +++ b/scripts/seed.ts @@ -0,0 +1,107 @@ +import { db } from '@/db'; +import { + clients, + phases, + tasks, + deliverables, + payments, + documents, + notes, +} from '@/db/schema'; +import { nanoid } from 'nanoid'; + +async function seed() { + console.log('🌱 Seeding database...\n'); + + try { + const clientToken = nanoid(); + const [client] = await db + .insert(clients) + .values({ + name: 'Test Client Inc.', + brand_name: 'TestBrand', + brief: + 'A comprehensive personal branding overhaul, positioning as a premium consultancy in the digital transformation space.', + token: clientToken, + accepted_total: '5000.00', + }) + .returning(); + + console.log(`āœ“ Client created: ${client.name} (ID: ${client.id})`); + + const [phase1, phase2, phase3] = await db + .insert(phases) + .values([ + { client_id: client.id, title: 'Discovery & Strategy', sort_order: 1, status: 'done' }, + { client_id: client.id, title: 'Design & Messaging', sort_order: 2, status: 'active' }, + { client_id: client.id, title: 'Implementation & Launch', sort_order: 3, status: 'upcoming' }, + ]) + .returning(); + + console.log('āœ“ Phases created (3 total)'); + + const [task1, task2, task3, task4, task5, task6] = await db + .insert(tasks) + .values([ + { phase_id: phase1.id, title: 'Stakeholder interviews', description: 'In-depth conversations with leadership team', sort_order: 1, status: 'done' }, + { phase_id: phase1.id, title: 'Competitive analysis', description: 'Research top 10 competitors in the space', sort_order: 2, status: 'done' }, + { phase_id: phase2.id, title: 'Brand positioning document', description: 'Write and refine the core positioning statement', sort_order: 1, status: 'in_progress' }, + { phase_id: phase2.id, title: 'Visual identity design', description: 'Logo, color palette, typography', sort_order: 2, status: 'in_progress' }, + { phase_id: phase3.id, title: 'Website build & launch', description: 'Design and develop new company website', sort_order: 1, status: 'todo' }, + { phase_id: phase3.id, title: 'Social media rollout', description: 'Launch branded social media accounts', sort_order: 2, status: 'todo' }, + ]) + .returning(); + + console.log('āœ“ Tasks created (6 total)'); + + await db + .insert(deliverables) + .values([ + { task_id: task1.id, title: 'Interview notes & synthesis', url: 'https://docs.google.com/document/d/1example', status: 'approved', approved_at: new Date('2026-04-15') }, + { task_id: task2.id, title: 'Competitive landscape report', url: 'https://docs.google.com/presentation/d/1example', status: 'approved', approved_at: new Date('2026-04-20') }, + { task_id: task3.id, title: 'Brand positioning document (draft)', url: 'https://docs.google.com/document/d/2example', status: 'submitted', approved_at: null }, + { task_id: task4.id, title: 'Logo concepts (3 variations)', url: 'https://www.figma.com/file/example', status: 'pending', approved_at: null }, + ]); + + console.log('āœ“ Deliverables created (4 total)'); + + await db + .insert(payments) + .values([ + { client_id: client.id, label: 'Acconto 50%', amount: '2500.00', status: 'saldato', paid_at: new Date('2026-04-01') }, + { client_id: client.id, label: 'Saldo 50%', amount: '2500.00', status: 'inviata', paid_at: null }, + ]); + + console.log('āœ“ Payments created (2 total)'); + + await db + .insert(documents) + .values([ + { client_id: client.id, label: 'Brand Guidelines PDF', url: 'https://example.com/brand-guidelines.pdf' }, + { client_id: client.id, label: 'Design Mockups Figma', url: 'https://www.figma.com/file/example' }, + ]); + + console.log('āœ“ Documents created (2 total)'); + + await db + .insert(notes) + .values([ + { client_id: client.id, body: 'Initial strategy session completed. Key insight: positioning needs to emphasize tech expertise and creative thinking balance.', created_at: new Date('2026-04-10') }, + { client_id: client.id, body: 'Phase 1 approved. Moving forward with design phase. Stakeholders excited about direction.', created_at: new Date('2026-04-22') }, + ]); + + console.log('āœ“ Notes created (2 total)'); + + console.log('\n✨ Seed complete!\n'); + console.log('šŸ“Ž Shareable client link:'); + console.log(` http://localhost:3000/c/${clientToken}\n`); + console.log('This link is unique and secret. Send it to the client via Slack or email.\n'); + + process.exit(0); + } catch (error) { + console.error('āŒ Seed failed:', error); + process.exit(1); + } +} + +seed(); \ No newline at end of file diff --git a/src/app/globals.css b/src/app/globals.css index 0aa95a5..af66a74 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -1,4 +1,7 @@ @import "tailwindcss"; +@source not "../../.01_projects/**"; +@source not "../../.claude/**"; +@source not "../../scripts/**"; /* ========================================================= Design tokens — light & clean palette (Tailwind v4 @theme)