"""Synthetic seed used for the Cursor Task live-stream comparison.
Usage: python3 seed-demo.py <empty-demo-directory>
Then add that directory using: node apps/server/src/bin.ts project add --base-dir .t3 --title 'Task streaming demo' <demo-directory>
Start a turn with: node apps/server/src/bin.ts thread start --base-dir .t3 --provider cursor --model grok-4.6 --title 'Cursor Task live progress' --json <demo-directory> '<PROMPT below>'
Open the emitted parent thread, then its running Task child; record through completion.
Both dev servers must use T3CODE_DEV_SEED=0, separate worktrees and fresh .t3 state.
Browser: Chromium, 1280x800 CSS pixels, light theme. Evidence crops the conversation to omit environment identity.
"""
import json
from pathlib import Path
import subprocess
import sys
FILES = {'order-service.ts': "import {Repository} from './repository';\nimport {NotificationService} from './notification-service';\nexport class OrderService {\n constructor(private repo: Repository, private notifications: NotificationService) {}\n async create(userId: string, items: string[]) {\n const order = await this.repo.saveOrder(userId, items);\n await this.notifications.send(userId, 'Order created');\n return order;\n }\n}\n", 'handlers.ts': "import {UserService} from './user-service';\nimport {OrderService} from './order-service';\nexport class Handlers {\n constructor(private users: UserService, private orders: OrderService) {}\n async createOrder(userId: string, items: string[]) {\n const user = await this.users.find(userId);\n if (!user) throw new Error('Unknown user');\n return this.orders.create(user.id, items);\n }\n}\n", 'index.ts': "import {Handlers} from './handlers';\nimport {UserService} from './user-service';\nimport {OrderService} from './order-service';\nimport {Repository} from './repository';\nimport {NotificationService} from './notification-service';\nconst repo = new Repository();\nconst notifications = new NotificationService();\nexport const handlers = new Handlers(new UserService(repo), new OrderService(repo, notifications));\n", 'repository.ts': "export class Repository {\n async user(id: string) { return {id, name: 'Demo customer'}; }\n async saveOrder(userId: string, items: string[]) { return {id:'order-1',userId,items}; }\n}\n", 'notification-service.ts': 'export class NotificationService {\n async send(userId: string, message: string) { return {userId,message,delivered:true}; }\n}\n', 'user-service.ts': "import {Repository} from './repository';\nexport class UserService {\n constructor(private repo: Repository) {}\n async find(id: string) { return this.repo.user(id); }\n}\n"}
PROMPT = 'Use your native Task tool to delegate this work to one subagent. Ask it to read all six files under src/ one at a time with individual read calls, then write a detailed multi-paragraph summary explaining how handlers and services relate, their dependencies, the request flow, and error handling. Do not read the files yourself. Do not modify any files. Have the subagent narrate its findings as it works.'
root = Path(sys.argv[1])
(root / "src").mkdir(parents=True, exist_ok=True)
for name, contents in FILES.items():
    (root / "src" / name).write_text(contents)
subprocess.run(["git", "init", "-q", str(root)], check=True)
subprocess.run(["git", "-C", str(root), "add", "."], check=True)
subprocess.run(["git", "-C", str(root), "-c", "user.name=Demo", "-c", "user.email=demo@example.com", "commit", "--allow-empty", "-qm", "Demo handlers and services"], check=True)
print(PROMPT)
