deploy
Use when deploying to any environment (staging, production) or when a deployment pipeline needs to run.
Deploy
Automated deployment pipeline with pre-flight checks.
Arguments
/deploy— deploy to staging (default)/deploy production— deploy to production (requires confirmation)/deploy --skip-tests— skip test phase/deploy --dry-run— show what would happen without executing/deploy <env> --rollback— rollback to previous version
Workflow
Phase 1: Detect Project Type & Deploy Target
- Read
package.json,docker-compose.yml,Dockerfile,vercel.json,railway.json,ecosystem.config.js,Makefile - Detect stack: Node/Bun/Python/Go/Docker
- Detect deploy target: Docker Compose, PM2, SSH, Vercel, Railway, custom script
- Determine environment from argument (default: staging)
Phase 2: Pre-flight Checks
Run in parallel where possible:
- Git status: working tree clean (warn if dirty)
- Branch check: correct branch for target env (production → main/master)
- Tests:
npm test/pytest/go test ./...(skip with--skip-tests) - Lint:
npm run lintif available - Type-check:
npx tsc --noEmitif TypeScript - Build:
npm run build/docker build
If any check fails → stop and report.
Phase 3: Deploy
| Target | Command |
|---|---|
| Docker Compose | docker compose build && docker compose up -d |
| PM2 | pm2 reload ecosystem.config.js --env <env> |
| SSH | ssh <host> "cd <path> && git pull && npm install && npm run build && pm2 reload all" |
| Vercel | vercel --prod or vercel (preview) |
| Custom | npm run deploy:<env> or make deploy |
Phase 4: Post-deploy Verification
- Health check: curl the health endpoint
- Check logs for startup errors
- Report: deployed version, environment, status
Rules
- ALWAYS require explicit confirmation for production deploys
- NEVER deploy with failing tests (unless
--skip-tests) - NEVER deploy from dirty working tree without warning
- Show summary before deploying: branch, env, target, version
- If deploy target can't be detected, ask the user