/** * preview-generation.ts * * Implements the pwpilot_preview_generation MCP tool. * * This tool is always called FIRST — before any browser interaction, DOM analysis, * or code generation. It runs entirely locally (no browser, no DOM, no AI tokens) * and produces a human-readable plan showing: * - The exact file paths that will be created * - The test name and slug * - The detected codebase style (new project vs. existing Playwright project) * - The ordered tool sequence that will run after user confirmation * * Claude must show the confirmationMessage to the user and wait for their "yes" * before calling any other Playwright Pilot AI tool. * * Supports three generation sources: * - live-browser: launch browser → analyze page → generate test * - video: extract frames from recording → generate test * - steps: user-supplied natural-language steps → generate test * * Role in the overall flow: * User prompt → pwpilot_preview_generation → user confirms → live-browser / video / steps flow */ import { z } from 'zod'; /** * Zod schema for validating the input to preview_generation. */ export declare const PreviewGenerationSchema: z.ZodObject<{ url: z.ZodString; prompt: z.ZodString; cwd: z.ZodString; videoPath: z.ZodOptional; userSteps: z.ZodOptional>; }, "strip", z.ZodTypeAny, { url: string; prompt: string; cwd: string; videoPath?: string | undefined; userSteps?: string[] | undefined; }, { url: string; prompt: string; cwd: string; videoPath?: string | undefined; userSteps?: string[] | undefined; }>; /** Input type inferred from PreviewGenerationSchema. */ export type PreviewGenerationInput = z.infer; /** * The complete generation plan returned to the MCP server. */ export interface GenerationPlan { /** Human-readable test name (verbatim user prompt). */ testName: string; /** URL-safe slug derived from the prompt, e.g. "empty-login-validation". */ slug: string; /** Relative path where the Page Object Model will be written. */ pomPath: string; /** Relative path where the Playwright spec will be written. */ testPath: string; /** Relative path for the StepTracker helper file. */ helperPath: string; /** Relative path for the intent JSON file. */ intentPath: string; /** Detected codebase test style, e.g. "pwpilot" or "vanilla-playwright". */ codebaseStyle: string; /** True if no existing Playwright tests were found in the project. */ isNewCodebase: boolean; /** * True when the target directory is empty and PlayGen will auto-scaffold * a production-standard Playwright project before writing the test files. */ willScaffold: boolean; /** Where the test content comes from. */ source: 'live-browser' | 'video' | 'steps'; /** Ordered list of tools that will run after the user confirms. */ toolSequence: ToolStep[]; /** The exact message Claude should show to the user before asking for confirmation. */ confirmationMessage: string; } /** * Describes one step in the ordered tool execution plan. */ export interface ToolStep { /** 1-based position in the sequence. */ order: number; /** MCP tool name. */ tool: string; /** Human-readable description of what this step does. */ description: string; /** True = runs entirely in MCP with zero AI tokens; false = calls Claude once. */ local: boolean; } /** * Build a generation plan for a test without opening a browser or calling any AI. * * Detects the target project's codebase style, derives all file paths, determines * the generation source (live-browser / video / steps), and builds the ordered * tool sequence and a user-facing confirmation message. * * @param input - Validated input with URL, prompt, optional video path and user steps. * @param projectRoot - Absolute path to the PlayGen project root (used as default cwd). * @returns A GenerationPlan with file paths, tool sequence, and confirmation message. */ export declare function previewGeneration(input: PreviewGenerationInput, projectRoot: string): Promise; //# sourceMappingURL=preview-generation.d.ts.map