{"skill":{"slug":"solo-deploy","displayName":"Deploy","summary":"Deploy project to hosting platform — read stack YAML for exact config, detect local CLI tools (vercel, wrangler, supabase, fly, sst), set up database, push c...","description":"---\nname: solo-deploy\ndescription: Deploy project to hosting platform — read stack YAML for exact config, detect local CLI tools (vercel, wrangler, supabase, fly, sst), set up database, push code, verify live deployment. Use when user says \"deploy it\", \"push to production\", \"set up hosting\", or after /build completes. Do NOT use before build is complete.\nlicense: MIT\nmetadata:\n  author: fortunto2\n  version: \"1.2.1\"\n  openclaw:\n    emoji: \"🚀\"\nallowed-tools: Read, Grep, Bash, Glob, Write, Edit, mcp__solograph__session_search, mcp__solograph__project_code_search, mcp__solograph__codegraph_query\nargument-hint: \"[platform]\"\n---\n\n# /deploy\n\nDeploy the project to its hosting platform. Reads the stack template YAML (`templates/stacks/{stack}.yaml`) for exact deploy config (platform, CLI tools, infra tier, CI/CD, monitoring), detects installed CLI tools, sets up database and environment, pushes code, and verifies deployment is live.\n\n## References\n\n- `templates/principles/dev-principles.md` — CI/CD, secrets, DNS, shared infra rules\n- `templates/stacks/*.yaml` — Stack templates with deploy, infra, ci_cd, monitoring fields\n\n> Paths are relative to the skill's plugin root. Search for these files via Glob if not found at expected location.\n\n## When to use\n\nAfter `/build` has completed all tasks (build stage is complete). This is the deployment engine.\n\nPipeline: `/build` → **`/deploy`** → `/review`\n\n## MCP Tools (use if available)\n\n- `session_search(query)` — find how similar projects were deployed before\n- `project_code_search(query, project)` — find deployment patterns across projects\n- `codegraph_query(query)` — check project dependencies and stack\n\nIf MCP tools are not available, fall back to Glob + Grep + Read.\n\n## Pre-flight Checks\n\n### 1. Verify build is complete (optional)\n- If pipeline state tracking exists (`.solo/states/` directory), check `.solo/states/build`.\n- If `.solo/states/` exists but `build` marker is missing: warn \"Build may not be complete. Consider running `/build` first.\"\n- If `.solo/states/` does not exist: skip this check and proceed with deployment.\n\n### 2. Detect available CLI tools\n\nRun in parallel — detect what's installed locally:\n```bash\nvercel --version 2>/dev/null && echo \"VERCEL_CLI=yes\" || echo \"VERCEL_CLI=no\"\nwrangler --version 2>/dev/null && echo \"WRANGLER_CLI=yes\" || echo \"WRANGLER_CLI=no\"\nnpx supabase --version 2>/dev/null && echo \"SUPABASE_CLI=yes\" || echo \"SUPABASE_CLI=no\"\nfly version 2>/dev/null && echo \"FLY_CLI=yes\" || echo \"FLY_CLI=no\"\nsst version 2>/dev/null && echo \"SST_CLI=yes\" || echo \"SST_CLI=no\"\ngh --version 2>/dev/null && echo \"GH_CLI=yes\" || echo \"GH_CLI=no\"\n```\n\nRecord which tools are available. Use them directly when found — do NOT `npx` if CLI is already installed globally.\n\n### 3. Load project context (parallel reads)\n- `CLAUDE.md` — stack name, architecture, deploy platform\n- `docs/prd.md` — product requirements, deployment notes\n- `docs/workflow.md` — CI/CD policy (if exists)\n- `package.json` or `pyproject.toml` — dependencies, scripts\n- `fly.toml`, `wrangler.toml`, `sst.config.ts` — platform configs (if exist)\n- `docs/plan/*/plan.md` — **active plan** (look for deploy-related phases/tasks)\n\n**Plan-driven deploy:** If the active plan contains deploy phases or tasks (e.g. \"deploy Python backend to VPS\", \"run deploy.sh\", \"set up Docker on server\"), treat those as **primary deploy instructions**. The plan knows the project-specific deploy targets that the generic stack YAML may not cover. Execute plan deploy tasks in addition to (or instead of) the standard platform deploy below.\n\n### 4. Read stack template YAML\n\nExtract the **stack name** from `CLAUDE.md` (look for `stack:` field or tech stack section).\n\nRead the stack template to get exact deploy configuration:\n\n**Search order** (first found wins):\n1. `templates/stacks/{stack}.yaml` — relative to this skill's plugin root\n2. `.solo/stacks/{stack}.yaml` — user's local overrides (from `/init`)\n3. Search via Glob for `**/stacks/{stack}.yaml` in project or parent directories\n\nExtract these fields from the YAML:\n- `deploy` — target platform(s): `vercel`, `cloudflare_workers`, `cloudflare_pages`, `fly.io`, `docker`, `app_store`, `play_store`, `local`\n- `deploy_cli` — CLI tools and their use cases (e.g. `vercel (local preview, env vars, promote)`)\n- `infra` — infrastructure tool and tier (e.g. `sst (sst.config.ts) — Tier 1`)\n- `ci_cd` — CI/CD system (e.g. `github_actions`)\n- `monitoring` — monitoring/analytics (e.g. `posthog`)\n- `database` / `orm` — database and ORM if any (affects migration step)\n- `storage` — storage services if any (R2, D1, KV, etc.)\n- `notes` — stack-specific deployment notes\n\n**Use the YAML values as the source of truth** for all deploy decisions below. The YAML overrides the fallback tier matrix.\n\n### 5. Detect platform (fallback if no YAML)\n\nIf stack YAML was not found, use this fallback matrix:\n\n| Stack | Platform | Tier |\n|-------|----------|------|\n| `nextjs-supabase` / `nextjs-ai-agents` | Vercel + Supabase | Tier 1 |\n| `cloudflare-workers` | Cloudflare Workers (wrangler) | Tier 1 |\n| `astro-static` / `astro-hybrid` | Cloudflare Pages (wrangler) | Tier 1 |\n| `python-api` | Fly.io (quick) or Pulumi + Hetzner (production) | Tier 2/4 |\n| `python-ml` | skip (CLI tool, no hosting needed) | — |\n| `ios-swift` | skip (App Store is manual) | — |\n| `kotlin-android` | skip (Play Store is manual) | — |\n\nIf `$ARGUMENTS` specifies a platform, use that instead of auto-detection or YAML.\n\n**Auto-deploy platforms** (from YAML `deploy` field or fallback):\n- `vercel` / `cloudflare_pages` — auto-deploy on push. Push to GitHub is sufficient if project is already linked. Only run manual deploy for initial setup.\n- `cloudflare_workers` — `wrangler deploy` needed (no git-based auto-deploy for Workers).\n- `fly.io` — `fly deploy` needed.\n\n## Deployment Steps\n\n### Step 1. Git — Clean State + Push\n\n```bash\ngit status\ngit log --oneline -5\n```\n\nIf dirty, commit remaining changes:\n```bash\ngit add -A\ngit commit -m \"chore: pre-deploy cleanup\"\n```\n\nEnsure remote exists and push:\n```bash\ngit remote -v\ngit push origin main\n```\n\nIf no remote, create GitHub repo:\n```bash\ngh repo create {project-name} --private --source=. --push\n```\n\n**For platforms with auto-deploy (Vercel, CF Pages):** pushing to main triggers deployment automatically. Skip manual deploy commands if project is already linked.\n\n### Step 2. Database Setup\n\n**Supabase** (if `supabase/` dir or Supabase deps detected):\n```bash\n# If supabase CLI available:\nsupabase db push          # apply migrations\nsupabase gen types --lang=typescript --local > db/types.ts  # optional: regenerate types\n```\nIf no CLI: guide user to Supabase dashboard for migration.\n\n**Drizzle ORM** (if `drizzle.config.ts` exists):\n```bash\nnpx drizzle-kit push      # push schema to database\nnpx drizzle-kit generate  # generate migration files (if needed)\n```\n\n**D1 (Cloudflare)** (if `wrangler.toml` has D1 bindings):\n```bash\nwrangler d1 migrations apply {db-name}\n```\n\nIf database is not configured yet, list what's needed and continue — don't block on it.\n\n### Step 3. Environment Variables\n\nRead `.env.example` or `.env.local.example` to identify required variables.\n\nGenerate platform-specific instructions:\n\n**Vercel:**\n```bash\n# If vercel CLI is available and project is linked:\nvercel env ls  # show current env vars\n\n# Guide user:\necho \"Set env vars: vercel env add VARIABLE_NAME\"\necho \"Or via dashboard: https://vercel.com/[team]/[project]/settings/environment-variables\"\n```\n\n**Cloudflare:**\n```bash\nwrangler secret put VARIABLE_NAME  # interactive prompt for value\n# Or in wrangler.toml [vars] section for non-secret values\n```\n\n**Fly.io:**\n```bash\nfly secrets set VARIABLE_NAME=value\nfly secrets list\n```\n\n**Do NOT create or modify `.env` files with real secrets.**\nList what's needed, let user set values.\n\n### Step 4. Platform Deploy\n\n**Vercel** (if not auto-deploying):\n```bash\nvercel link          # first time: link to project\nvercel               # deploy preview\nvercel --prod        # deploy production (after verifying preview)\n```\n\n**Cloudflare Workers/Pages:**\n```bash\nwrangler deploy              # Workers\nwrangler pages deploy ./out  # Pages (check build output dir)\n```\n\n**Fly.io:**\n```bash\nfly launch   # first time — creates app, sets region\nfly deploy   # subsequent deploys\n```\n\n**SST** (if sst.config.ts exists):\n```bash\nsst deploy --stage prod    # production\nsst deploy --stage dev     # staging\n```\n\n### Step 5. Verify Deployment\n\nAfter deployment, verify it actually works:\n\n```bash\n# 1. HTTP status check\nSTATUS=$(curl -s -o /dev/null -w \"%{http_code}\" https://{deployment-url})\n\n# 2. Check for runtime errors in page body\nBODY=$(curl -s https://{deployment-url} | head -200)\n\n# 3. Check Vercel deployment logs for errors\nvercel logs --output=short 2>&1 | tail -30\n```\n\n**If HTTP status is not 200, or page contains error messages:**\n1. Check `vercel env ls` — are all required env vars set on the platform?\n2. If env vars missing: add them with `vercel env add NAME production <<< \"value\"`\n3. If env vars set but wrong: `vercel env rm NAME production` then re-add\n4. After fixing env vars: redeploy with `vercel --prod --yes`\n5. Re-check HTTP status and page content\n\n**Common runtime errors and fixes:**\n- \"Supabase URL/Key required\" → add `NEXT_PUBLIC_SUPABASE_URL` + `NEXT_PUBLIC_SUPABASE_ANON_KEY` to Vercel\n- \"DATABASE_URL not set\" → add `DATABASE_URL` to Vercel\n- \"STRIPE_SECRET_KEY missing\" → add Stripe keys or remove Stripe code if not ready\n- Blank page / hydration error → check build logs, may need `vercel --prod` redeploy\n\n**Do NOT output `<solo:done/>` until the live URL returns HTTP 200 and page loads without errors.** If you cannot fix the issue, output `<solo:redo/>` to go back to build. Output pipeline signals ONLY if `.solo/states/` directory exists.\n\n### Step 6. Post-Deploy Log Monitoring\n\nAfter verifying HTTP 200, **tail production logs** to catch runtime errors that only appear under real conditions (missing env vars, DB connection issues, SSR crashes, API timeouts).\n\nRead the `logs` field from the stack YAML to get platform-specific commands:\n\n**Vercel (Next.js):**\n```bash\nvercel logs --output=short 2>&1 | tail -50\n```\nLook for: `Error`, `FUNCTION_INVOCATION_FAILED`, `EDGE_FUNCTION_INVOCATION_FAILED`, `504 GATEWAY_TIMEOUT`, unhandled rejections.\n\n**Cloudflare Workers:**\n```bash\nwrangler tail --format=pretty 2>&1 | head -100\n```\nLook for: `Error`, uncaught exceptions, D1 query failures, R2 access errors.\n\n**Cloudflare Pages (Astro):**\n```bash\nwrangler pages deployment tail --project-name={name} 2>&1 | head -100\n```\n\n**Fly.io (Python API):**\n```bash\nfly logs --app {name} 2>&1 | tail -50\nfly status --app {name}\n```\nLook for: `ERROR`, `CRITICAL`, unhealthy instances, OOM kills, connection refused.\n\n**Supabase Edge Functions (if used):**\n```bash\nsupabase functions logs --scroll 2>&1 | tail -30\n```\n\n**What to do with log errors:**\n- **Env var missing** → fix with platform CLI (see Step 3), redeploy\n- **DB connection error** → check connection string, IP allowlist\n- **Runtime crash / unhandled error** → if `.solo/states/` exists, output `<solo:redo/>` to go back to build with fix; otherwise fix and redeploy\n- **No errors in 30 lines of logs** → proceed to report\n\n**If logs show zero traffic (fresh deploy), make a few test requests:**\n```bash\ncurl -s https://{deployment-url}/           # homepage\ncurl -s https://{deployment-url}/api/health  # API health (if exists)\n```\nThen re-check logs for any errors triggered by these requests.\n\n### Step 7. Post-Deploy Report\n\n```\nDeployment: {project-name}\n\n  Platform:  {platform}\n  URL:       {deployment-url}\n  Branch:    main\n  Commit:    {sha}\n\n  Done:\n    - [x] Code pushed to GitHub\n    - [x] Deployed to {platform}\n    - [x] Database migrations applied (or N/A)\n\n  Manual steps remaining:\n    - [ ] Set environment variables (listed above)\n    - [ ] Custom domain (optional)\n    - [ ] PostHog / analytics setup (optional)\n\n  Next: /review — final quality gate\n```\n\n## Completion\n\n### Signal completion\n\nIf `.solo/states/` directory exists, output this exact tag ONCE and ONLY ONCE — the pipeline detects the first occurrence:\n```\n<solo:done/>\n```\n**Do NOT repeat the signal tag anywhere else in the response.** One occurrence only.\nIf `.solo/states/` directory does not exist, skip the signal tag.\n\n## Error Handling\n\n### CLI not found\n**Cause:** Platform CLI not installed.\n**Fix:** Install the specific CLI: `npm i -g vercel`, `npm i -g wrangler`, `brew install flyctl`, `brew install supabase/tap/supabase`.\n\n### Deploy fails — build error\n**Cause:** Build works locally but fails on platform (different Node version, missing env vars).\n**Fix:** Check platform build logs. Ensure `engines` in package.json matches platform. Set missing env vars.\n\n### Database connection fails\n**Cause:** DATABASE_URL not set or network rules block connection.\n**Fix:** Check connection string, platform's DB dashboard, IP allowlist.\n\n### Git push rejected\n**Cause:** Remote has diverged.\n**Fix:** `git pull --rebase origin main`, resolve conflicts, push again.\n\n## Verification Gate\n\nBefore reporting \"deployment successful\":\n1. **Run** `curl -s -o /dev/null -w \"%{http_code}\"` against the deployment URL.\n2. **Verify** HTTP 200 (not 404, 500, or redirect loop).\n3. **Check** the actual page content matches expectations (not a blank page or error).\n4. **Only then** report the deployment as successful.\n\nNever say \"deployment should be live\" — verify it IS live.\n\n## Critical Rules\n\n1. **Use installed CLIs** — detect `vercel`, `wrangler`, `supabase`, `fly`, `sst` before falling back to `npx`.\n2. **Auto-deploy aware** — if platform auto-deploys on push, just push. Don't run manual deploy commands unnecessarily.\n3. **NEVER commit secrets** — no .env files with real values, no API keys in code.\n4. **Preview before production** — deploy preview first, verify, then promote to prod.\n5. **Check build locally first** — `pnpm build` / `uv build` (or equivalent) before deploying.\n6. **Check production logs** — always tail logs after deploy, catch runtime errors before declaring success.\n7. **Report all URLs** — deployment URL + platform dashboard links.\n8. **Infrastructure in repo** — prefer `sst.config.ts` or `fly.toml` over manual dashboard config.\n9. **Verify before claiming done** — HTTP 200 from the live URL + clean logs, not just \"deploy command succeeded\".\n","tags":{"latest":"1.2.1"},"stats":{"comments":0,"downloads":459,"installsAllTime":17,"installsCurrent":0,"stars":0,"versions":2},"createdAt":1771616105232,"updatedAt":1778991937391},"latestVersion":{"version":"1.2.1","createdAt":1771711574598,"changelog":"Universalize: remove project-specific references, add SearXNG recommendation","license":null},"metadata":{"setup":[],"os":null,"systems":null},"owner":{"handle":"fortunto2","userId":"s17ccp4nxta4tm3ahx4kexjbq5885bd3","displayName":"Rust","image":"https://avatars.githubusercontent.com/u/1236751?v=4"},"moderation":{"isSuspicious":false,"isMalwareBlocked":false,"verdict":"clean","reasonCodes":["review.llm_review"],"summary":"Review: review.llm_review","engineVersion":"v2.4.24","updatedAt":1779943568415}}