Prompt file imported from AdrianRogowski/auto-sdd (
.cursor/commands/ralph-setup.md). Copyright stays with the author.
/ralph-setup — Interactive Environment Setup Wizard
Set up .env.local for the SDD build loop with interactive prompts and auto-detection.
What This Command Does
- Detect project — framework, test runner, build tool, package manager
- Ask key questions — CLI provider, branch strategy, integrations, parallelism
- Generate
.env.local— sensible defaults with auto-detected commands pre-populated - Validate tooling — check that
agentorclaudeCLI exists,ghinstalled if PRs enabled - Print summary — "you're ready" with the exact command to run next
Instructions
Step 1: Check for Existing Config
Read .env.local if it exists. If it does:
- Tell the user what's currently configured
- Ask if they want to reconfigure or just update specific sections
- Preserve any values they don't want to change
If .env.local doesn't exist, copy from .env.local.example as a starting point.
Step 2: Detect Project Type
Scan the project directory to determine:
- Framework: Check for package.json (Next.js, Vite, etc.), Cargo.toml, go.mod, pyproject.toml, etc.
- Package manager: pnpm-lock.yaml, yarn.lock, bun.lockb, package-lock.json
- Test runner: vitest, jest, pytest, cargo test, go test
- Build tool: tsc, vite build, cargo build, go build
- Lint tool: eslint, biome, ruff, clippy
- ORM/DB: drizzle, prisma, alembic, diesel
- E2E: playwright, cypress
Report what was detected.
Step 3: Ask Configuration Questions
Use the AskQuestion tool for each section. Group related questions together:
Core Settings:
- CLI provider: Cursor (
agent) or Claude Code (claude)? - Branch strategy: chained (default), independent, sequential, parallel, or both?
- If parallel:
- How many concurrent features? (default: 3) →
PARALLEL_FEATURES - Rebuild conflicted features on integrated code instead of blocking them? (default: true) →
REBUILD_ON_CONFLICT. When a feature branch can't be merged (or breaks build/tests/drift after merge), it gets rebuilt sequentially in a fresh worktree forked from the integration branch, then merged again. Set false to restore the old behavior (mark ⏸️ and preserve the branch for a human). - Model for the merge-resolution agent? (default: same as
AGENT_MODEL) →MERGE_MODEL. This agent resolves source-file merge conflicts semantically during integration; a stronger model here pays off since bad resolutions cost a full rebuild.
- How many concurrent features? (default: 3) →
- Max features per run? (default: 50 for local, 4 for overnight)
Integrations (optional):
- Do you use Slack for feature requests? → configure SLACK_* vars
- Do you use Jira for tracking? → configure JIRA_* vars
- Want draft PRs on completion? → requires
ghCLI
Build Validation: Show auto-detected commands and ask if they look right:
- Build:
{detected}— correct? Override? - Test:
{detected}— correct? Override? - Lint:
{detected}— correct? Override? - Migration:
{detected}— correct? Override? - E2E:
{detected}— correct? Override?
Model Selection (optional):
- Default model for all steps? (recommend
composer-1.5for Cursor) - Want different models per phase? (show the phase list: spec, build, refactor, drift, compound, review, merge)
Overnight Automation (optional):
- Want to set up overnight scheduled runs? → guide through
setup-overnight.sh
Step 4: Generate .env.local
Write the .env.local file with:
- All configured values
- Comments explaining each section
- Auto-detected commands filled in (not empty strings)
- Unconfigured optional sections commented out
Step 5: Validate
Run these checks:
- CLI exists:
which agentorwhich claude(depending on provider) - If PRs enabled:
which gh - If mapping generation needed:
which yq(optional, has fallback) - Build command works: quick dry-run of BUILD_CHECK_CMD
- Test command works: quick dry-run of TEST_CHECK_CMD
Report any issues with fix instructions.
Step 6: Dev Ports Config
Ask about dev server ports:
- What ports does your dev server use? (auto-detect from package.json scripts, vite config, etc.)
- Set
DEV_PORTSandDEV_CMDin.env.localfor/clean-slate
Step 7: Summary
Print a clear summary:
✓ ralph-setup complete!
CLI: cursor (agent)
Strategy: chained
Build: npx tsc --noEmit
Test: pnpm test
Lint: pnpm lint
Models: composer-1.5 (all phases)
Dev ports: 3000,5173
Dev cmd: pnpm dev
Next steps:
/ralph-run — launch the build loop
/clean-slate — kill dev servers and restart
/spec-first {feat} — build a single feature
If Things Go Wrong
If auto-detection fails for any command, set it to empty ("") and tell the user:
- The build loop will try to auto-detect after the first feature creates project infrastructure
- They can always run
/ralph-setupagain to reconfigure
