AI CodeOps

Next.js app: gated staging deploy, then production

Build a Next.js UI change with UI Implementation, merge it through the gate, call your staging deploy webhook, and release to production only after staging.

Use this template

A pricing page is a change you want people to click through before customers do. This template builds a Next.js UI change, sends it to staging through your own pipeline once it merges, and stops production until staging has it.

Which agents run

StepAgent
UI planUI Designer
ImplementBuilder
Code reviewReviewer
Behavior testTester

The UI Designer plans layout, states and accessibility (focus order, labels, the toggle's pressed state). Then the code pass writes the change, your package.json test script runs in an offline sandbox, and the findings review reads the diff. Open high or critical findings and failing tests block, and a second person approves before the pull request opens.

Send merges to staging

Open Release → Deployments, choose Deploy targets, and for the project enter:

FieldExample value
Deploy webhook URLhttps://deploy.example.com/hooks/web-staging
Environmentstaging
Signing secreta random string your pipeline also knows

When you merge the pull request from the console, the quality gate runs again first. Then AI CodeOps sends a pr_merged POST, signed with X-CodeOps-Signature, and records a deployment as in progress. Your pipeline builds and deploys to staging. A failed webhook call opens an incident.

Promote to production only from staging

Your pipeline can't report the final result back, so once staging is healthy, choose Record deployment: environment staging, status succeeded, and the Commit SHA you deployed. The production job then asks the gate:

curl -sf -X POST "https://console.aicodeops.dev/api/release/check" \
  -H "Authorization: Bearer $WORKSPACE_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"pullRequestURL\":\"$PR_URL\",\"commitSHA\":\"$COMMIT_SHA\",\"requireDeployedTo\":\"staging\"}" \
  | jq -e '.allowed == true'

The pull request URL finds the session; the commit SHA must match the staging record. Without one, the answer is denied: "Not yet deployed to "staging" — promote there before releasing". See gated deploys.

If production goes wrong, roll back in your pipeline and mark the deployment rolled back, as in rollback. For the review side of the same app, start with the Next.js PR review template.

Frequently asked questions

Does AI CodeOps host a preview or staging environment?

No. It calls the deploy webhook you set, and your own pipeline deploys. AI CodeOps holds no credentials for your infrastructure.

Why does the production check say the change isn't in staging yet?

A webhook deploy stays in progress, because your pipeline can't report back. Record the staging deploy as succeeded, with its commit SHA, before releasing.