import { useState } from "react"; import type { Meta, StoryObj } from "@storybook/react-vite"; import type { Agent, CatalogTeamImportPreviewResult, CompanyPortabilityCollisionStrategy, } from "@paperclipai/shared"; import { ApplyProgress, ApplySuccess, StepPreview, StepSkillPlan, StepSourcePolicy, StepTargetManager, TeamCard, TeamDetailPane, TeamRow, } from "@/pages/TeamCatalog"; import { currentInstalledState, onboardingTeams, optionalTeam, outOfDateInstalledState, sampleTeam as baseTeam, warnTeam, } from "@/pages/TeamCatalog.fixtures"; // --------------------------------------------------------------------------- // Fixtures // // Team fixtures (baseTeam/optionalTeam/warnTeam) are shared with the in-app // /design-guide showcase via @/pages/TeamCatalog.fixtures so the two surfaces // stay in sync. Preview/agent fixtures below are story-only. // --------------------------------------------------------------------------- const companyAgents: Agent[] = [ makeAgent("agent-1", "Founder", "ceo"), makeAgent("agent-2", "Head of Eng", "engineer"), makeAgent("agent-3", "Ops Lead", "general"), ]; function makeAgent(id: string, name: string, role: string): Agent { return { id, companyId: "company-storybook", name, urlKey: name.toLowerCase().replace(/\s+/g, "-"), role: role as Agent["role"], title: null, icon: null, status: "active", reportsTo: null, capabilities: null, adapterType: "claude_local" as Agent["adapterType"], adapterConfig: {}, runtimeConfig: {} as Agent["runtimeConfig"], budgetMonthlyCents: 0, spentMonthlyCents: 0, pauseReason: null, pausedAt: null, permissions: {} as Agent["permissions"], lastHeartbeatAt: null, metadata: null, createdAt: new Date("2026-01-01T00:00:00.000Z"), updatedAt: new Date("2026-01-01T00:00:00.000Z"), }; } function makePreview(errors: string[] = []): CatalogTeamImportPreviewResult { return { team: baseTeam, portabilityPreview: { include: { company: false, agents: true, projects: true, issues: false, skills: true }, targetCompanyId: "company-storybook", targetCompanyName: "Paperclip", collisionStrategy: "rename", selectedAgentSlugs: ["ceo", "cto", "cmo"], plan: { companyAction: "none", agentPlans: [ { slug: "ceo", action: "create", plannedName: "CEO", existingAgentId: null, reason: null }, { slug: "cto", action: "create", plannedName: "CTO", existingAgentId: null, reason: null }, { slug: "cmo", action: "create", plannedName: "CMO (from Core Exec Team)", existingAgentId: "agent-x", reason: "Renamed — name collision with existing agent" }, ], projectPlans: [ { slug: "launch", action: "create", plannedName: "Launch", existingProjectId: null, reason: null }, ], issuePlans: [ { slug: "kickoff", action: "skip", plannedTitle: "Kickoff", reason: "Starter tasks not selected" }, ], }, manifest: { schemaVersion: 1, generatedAt: "2026-06-03T00:00:00.000Z", source: null, includes: { company: false, agents: true, projects: true, issues: false, skills: true }, company: null, sidebar: null, agents: [ manifestAgent("ceo", "CEO"), manifestAgent("cto", "CTO"), manifestAgent("cmo", "CMO"), ], skills: [], projects: [], issues: [], envInputs: [], }, files: {}, envInputs: [ { key: "OPENAI_API_KEY", description: "API key for the CTO agent", agentSlug: "cto", projectSlug: null, kind: "secret", requirement: "required", defaultValue: null, portability: "system_dependent" }, { key: "DEFAULT_TIMEZONE", description: "Project timezone", agentSlug: null, projectSlug: "launch", kind: "plain", requirement: "optional", defaultValue: "UTC", portability: "portable" }, ], warnings: ["Skill acme/growth-playbook will be imported from an external GitHub source."], errors, }, skillPreparations: [ { type: "catalog", ref: "engineering/code-review", agentSlugs: ["cto"], action: "already_in_package", catalogSkillId: "skill-1", catalogSkillKey: "engineering/code-review", sourceLocator: null, sourceRef: null, reason: null }, { type: "github", ref: "acme/growth-playbook@v1.2.0", agentSlugs: ["cmo"], action: "external_import_required", catalogSkillId: null, catalogSkillKey: null, sourceLocator: "github.com/acme/growth-playbook", sourceRef: "v1.2.0", reason: "Resolved from GitHub at install time" }, ], warnings: [], errors, }; } // eslint-disable-next-line @typescript-eslint/no-explicit-any function manifestAgent(slug: string, name: string): any { return { slug, name, path: `agents/${slug}/AGENTS.md`, skills: [], role: slug, title: null, icon: null, capabilities: null, reportsToSlug: slug === "ceo" ? null : "ceo", adapterType: "claude_local", adapterConfig: {}, runtimeConfig: {}, permissions: {}, budgetMonthlyCents: 0, metadata: null, }; } const noop = () => {}; function Frame({ children, width = "max-w-3xl" }: { children: React.ReactNode; width?: string }) { return
We'll set up agents, projects, and routines so you can start with a working team.