Summary
Add a cy2play init command that scaffolds a cy2play.config.json configuration file interactively.
Motivation
The README documents cy2play.config.json and the config loader already supports it, but there's no CLI command to generate one. Users currently have to create it manually. The .gitignore already references 'Generated config (from cy2play init)', indicating this was a planned feature.
Proposed Behavior
Interactive Flow
�ash $ npx cy2play init
The command should prompt the user for:
- Conversion mode - Select from: strict, hybrid, pure-ai (default: hybrid)
- Output directory - Where to write generated files (default: ./playwright-tests)
- LLM provider - Select from: none, openai, anthropic, local (default: none for strict, openai for hybrid/pure-ai)
- Model - If provider selected (default: gpt-4o for openai, claude-3-5-sonnet for anthropic, codellama for local)
- API key source - env:OPENAI_API_KEY format or direct entry
- Local LLM URL - If local provider (default: http://localhost:11434/v1)
- Custom command mappings - Ask if they have custom Cypress commands (can be skipped)
Output
Generates cy2play.config.json:
json { mode: hybrid, targetDir: ./playwright-tests, llm: { provider: openai, model: gpt-4o, apiKey: env:OPENAI_API_KEY, temperature: 0.2 }, customMappings: {} }
CLI flags for non-interactive use
�ash cy2play init --mode strict --output ./tests cy2play init --yes # Accept all defaults
Implementation Plan
- Add a dependency for interactive prompts (e.g., inquirer or lighter prompts)
- Create src/init.ts with the initialization logic
- Register the init command in src/cli.ts
- Add tests in ests/init.test.ts
- Update README Quick Start section
Acceptance Criteria
Summary
Add a cy2play init command that scaffolds a cy2play.config.json configuration file interactively.
Motivation
The README documents cy2play.config.json and the config loader already supports it, but there's no CLI command to generate one. Users currently have to create it manually. The .gitignore already references 'Generated config (from cy2play init)', indicating this was a planned feature.
Proposed Behavior
Interactive Flow
�ash $ npx cy2play initThe command should prompt the user for:
Output
Generates cy2play.config.json:
json { mode: hybrid, targetDir: ./playwright-tests, llm: { provider: openai, model: gpt-4o, apiKey: env:OPENAI_API_KEY, temperature: 0.2 }, customMappings: {} }CLI flags for non-interactive use
�ash cy2play init --mode strict --output ./tests cy2play init --yes # Accept all defaultsImplementation Plan
Acceptance Criteria
esolveOptions function