Deploy Check
Lint, test, and verify all routes respond before deploying
Claude CodeGeneric
---
allowed-tools: Bash(npx eslint:*), Bash(npx vitest run:*), Bash(node:*), Bash(curl:*), Bash(kill:*), Bash(grep:*), Bash(cat:*), Bash(sleep:*), Read, Glob, Grep
description: Lint, test, and verify all routes respond before deploying
---
## Context
- Lint output: !`npx eslint . --ext .js 2>&1 || true`
- Test output: !`npx vitest run --reporter=verbose 2>&1`
- Registered routes: !`grep -rn "router\.\(get\|post\|put\|patch\|delete\)" src/ 2>&1 || echo "No routes found yet"`
## Task
Run all three deploy-readiness checks in order. Stop and report as soon as a check fails — do not proceed to the next check.
### 1. Lint
Review the lint output above.
- If there are **errors**: fix them in the source files, then re-run `npx eslint . --ext .js` to confirm clean. Repeat until no errors remain.
- Warnings are acceptable — note them but continue.
- If ESLint is not installed or configured, skip this step and note it.
### 2. Tests
Review the test output above.
- If **tests fail**: read the failing test files and the source they exercise. Fix source code (preferred) or wrong test expectations. Re-run `npx vitest run --reporter=verbose` after each fix until all pass.
- If you cannot fix a failure, explain why and stop.
### 3. Route smoke-test
Use the registered routes found above to probe the running server.
Steps:
1. Start the server in the background on port 3999:
PORT=3999 node src/index.js & SERVER_PID=$! sleep 2
2. For each unique route path found (e.g. `GET /tasks`, `POST /tasks/:id`):
- Replace any `:param` segments with a safe placeholder (`0` or `test`).
- Run: `curl -s -o /dev/null -w "%{http_code}" http://localhost:3999<path>`
- A response of 2xx or 4xx (including 404 for missing records) is **passing** — it means the server handled the request.
- A response of 5xx or a connection error is **failing**.
3. Stop the server: `kill $SERVER_PID 2>/dev/null`
4. Report each route with its status code.
5. If any route returned 5xx or failed to connect, read the relevant route handler, fix the error following the CLAUDE.md pattern (catch → structured error response, never throw), and re-run the smoke-test.
### 4. E2E tests
After the route smoke-test passes, run the Playwright E2E suite against the same server:
1. Start the server (if not already running from the smoke-test):
PORT=3999 DB_PATH=:memory: JWT_SECRET=e2e-test-secret node src/index.js & E2E_PID=$! sleep 2
2. Run: `node src/e2e/run.js`
- Exit 0 = all E2E tests passed.
- Exit 1 = one or more E2E tests failed — report each failing flow name and its error detail.
3. Stop the server: `kill $E2E_PID 2>/dev/null`
4. If any E2E test failed, report the failure and stop. Do not attempt to auto-fix E2E failures — they indicate a regression in the running API and require investigation.
### Final report
After all checks pass, output a short summary:
Deploy check passed
Lint ✓
Tests ✓ (
If anything could not be fixed, list each unresolved issue clearly so the user knows what to act on before deploying.
Maintain Deploy Check?
Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.
[Deploy Check on getagentictools](https://getagentictools.com/loops/griboed007-deploy-check?ref=badge) npx agentictools info loops/griboed007-deploy-check The second line is the CLI lookup for this page — handy in READMEs and docs.