add-deploy
[ADD v0.11.0] Environment-aware commit, push, and deploy workflow
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
[ADD v0.11.0] Environment-aware commit, push, and deploy workflow
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
[ADD v0.11.0] Generate or sync a portable AGENTS.md from ADD project state — writes, checks drift, or merges with hand-curated content
[ADD v0.11.0] Declare absence — get autonomous work plan for the duration
[ADD v0.11.0] Return from absence — get briefing on autonomous work
[ADD v0.11.0] View project branding — accent color, palette, drift detection, image gen status
[ADD v0.11.0] Update project branding — new colors, fonts, tone, audit artifacts
[ADD v0.11.0] Generate or refresh CHANGELOG.md from conventional commits
| name | add-deploy |
| description | [ADD v0.11.0] Environment-aware commit, push, and deploy workflow |
| argument-hint | [--env local|dev|staging|production] [--skip-verify] |
Execute environment-aware deployment: commit changes, push to remote, trigger CI/CD, and verify successful deployment.
The Deploy skill orchestrates the final step of the development workflow:
The skill is environment-aware: deployment to production is gated with additional safety checks and requires human approval.
Deployment flows:
Verify code quality
Load configuration
Verify git repository
Determine environment
Check for uncommitted changes
git statusVerify feature branch
Check for session handoff
.add/handoff.md if it existsUnless --skip-verify:
# Run full quality gates
npm test # all tests pass
npm run lint # no lint errors
npm run build # builds successfully
# or Python equivalent
python -m pytest # all tests pass
python -m flake8 # no lint errors
# or other language equivalents
Capture results:
If any verification fails:
Before composing the commit message, run the shared secrets gate per ~/.codex/add/references/secrets-gate.md — the same gate as /add-verify Gate 4.6. The executable scanner (~/.codex/add/lib/scan-secrets.sh against the staged diff) is the single point of truth — do NOT re-implement the catalog inline. Scanner invocation, exit codes, finding format, --allow-secret confirm-phrase matching rules, .secretsignore handling, and edge cases are all in the reference.
Deploy-specific behavior:
Blocking vs advisory by maturity: at POC maturity the gate is advisory — report findings and continue only with explicit user acknowledgment. At Alpha and above, any unsuppressed finding aborts the commit: no commit is created, and staged changes are preserved so the user can fix and retry.
Overrides: interactive override via /add-deploy --allow-secret (exact confirm phrase, matched literally per the reference), or the automation-friendly commit-message trailer [ADD-SECRET-OVERRIDE: {SEC-NNN} (reason)] — the scanner accepts the trailer when --commit-msg-file points at the message and the trailer enumerates the SEC codes being overridden.
On a successful override, before proceeding to Step 2, append to .add/observations.md:
{YYYY-MM-DD HH:MM} | deploy | secrets-gate override: {file}:{line} {PATTERN_NAME} | reason: {user's stated reason}
and append the override record to .add/redaction-log.json under { "artifact": "deploy-gate-override", ... } if the log exists.
.secretsignore-listed files staged anyway (SEC-998 findings) are treated the same as catalog matches — abort unless overridden; the file should not be committed at all.
Compose a detailed commit message following conventions:
{type}: {short description under 50 chars} — types are feat, fix, refactor, test, docs, perf, ci, chore.Closes: #{issue-number} if applicable.Full format specification and a worked example: ~/.codex/add/templates/commit-message.md.
Stage relevant files (not sensitive files):
# Stage implementation files
git add src/
git add tests/
git add docs/
# Verify staging
git status
git diff --cached
# Do NOT stage:
# - .env files
# - Secrets or credentials
# - node_modules/
# - Build artifacts (unless necessary)
# - .DS_Store, IDE files
Ask user to verify staged changes:
Staged files:
- src/form.ts
- src/api/submit.ts
- tests/form.test.ts
- tests/api.test.ts
- docs/performance.md
Proceed with commit? [yes/no]
Wait for explicit confirmation before committing.
Create commit:
git commit -m "$(cat <<'EOF'
feat: Add form submission with email validation
[full message as prepared in Step 2]
EOF
)"
Verify commit:
git log -1 --oneline
# Output: abc1234 feat: Add form submission with email validation
For Dev/Staging Environments:
Determine target branch:
Push to remote:
git push origin {feature-branch}
# or
git push -u origin {feature-branch}
Verify push succeeded:
For Production Environment:
Production requires PR/merge request workflow:
Create PR/MR with:
Request reviews:
Merge to main:
# After PR approved and CI passes
git checkout main
git pull origin main
git merge {feature-branch}
# or use GitHub/GitLab merge button
Tag release:
git tag -a v{version} -m "Release {feature-name} v{version}"
git push origin v{version}
CI/CD Pipeline:
Check if CI is enabled in config (ci.enabled):
If enabled:
Trigger CI (if not automatic)
Monitor pipeline progress
Check gate results
CI Pipeline Status: 🟡 In Progress
Jobs:
- Lint: ✓ PASSED (2 min)
- Type Check: ✓ PASSED (3 min)
- Unit Tests: 🟡 IN PROGRESS (4/32 tests)
- Integration Tests: ⊘ PENDING
- Deploy to Staging: ⊘ PENDING
Elapsed: 5 minutes
ETA: 8 minutes
Wait for completion
If CI disabled:
This gate is a runtime check, not a behavioral rule. The skill MUST NOT proceed to any production deployment action without capturing the exact confirmation phrase below. This applies regardless of --promote, away mode, or any other autonomy granting — production is the one boundary that remains human-gated at all maturities.
Also required: .add/config.json → environments.production.autoPromote must be false. If it is true, halt with: "autoPromote: true on production is not permitted — ADD refuses to proceed. Edit .add/config.json to set autoPromote: false."
⚠️ PRODUCTION DEPLOYMENT
Feature: Form submission with email validation
Commit: abc1234
Branch: feature/form-submission
Target: main
Changes:
- 3 files modified
- 450 lines added, 20 lines removed
Testing:
- ✓ All 32 tests passing
- ✓ 87% code coverage
- ✓ Lint and type checks passing
Acceptance Criteria Verified:
- AC-001: ✓ User can submit valid form
- AC-002: ✓ Validation errors shown
- AC-003: ✓ Network errors handled
Risk Assessment:
- Integration Points: 1 (Email service)
- Database Changes: None
- Breaking Changes: None
- Rollback Plan: Revert commit + redeploy previous tag
Ask the user:
"To proceed with production deployment, type
DEPLOY TO PRODUCTION(all caps, exactly) and press enter. Any other response — including 'yes', 'y', 'ok', or silence — will cancel."
Matching rules — implemented literally in the skill, not left to agent judgment:
DEPLOY TO PRODUCTION (no quotes, no leading/trailing whitespace other than a trailing newline).deploy to production does NOT pass. Deploy to Production does NOT pass.DEPLOY TO PRODUCTION please does NOT pass.If the match succeeds: proceed to Step 7. If the match fails for any reason: halt and output:
Production deployment CANCELLED. No changes made.
Re-run /add-deploy --env production when ready to deploy.
The confirm-phrase gate exists to prevent automation, rushed approvals,
and ambiguous consent from deploying to production.
Why this gate exists: ADD's autonomous-execution model is powerful enough that "please approve" prompts during away mode get fuzzy. Requiring a specific literal string means no agent, no script, no accidental enter-key can trigger a production deploy without the human actively typing the phrase. This is a technical gate, not a behavioral rule.
.add/deploy-log.md with commit hash, branch, and confirm-phrase timestampApproved via DEPLOY TO PRODUCTION phrase at {UTC timestamp}.add/away-log.md and move to the next task.For Dev Environment:
# Direct deploy (no CI required)
npm run deploy:dev
# or
./scripts/deploy-dev.sh
For Staging Environment:
# After CI passes
npm run deploy:staging
# or
./scripts/deploy-staging.sh
For Production Environment:
# After approval, merge to main, and CI passes
npm run deploy:production
# or
./scripts/deploy-production.sh
# This typically:
# - Pulls latest from main
# - Builds production bundle
# - Uploads to production servers
# - Runs database migrations if needed
# - Restarts services
# - Runs health checks
Monitor deployment:
After deployment completes:
Run smoke tests
npm run test:smoke -- --environment production
# or equivalent
Smoke tests check:
Verify application health
curl https://api.example.com/health
# Response should indicate health: 200 OK
Check user-facing changes
Monitor error logs
Verify metrics
Success Criteria:
Failure Response:
Upon successful deployment, output a "Deployment Complete" report covering: deployment summary (environment, feature, commit, branch, timestamp, duration), code changes, pre-deploy quality gates, CI/CD job results, post-deployment verification (smoke tests, health check, error rate, response time), deployment details (strategy + rollback plan), deployed files, notifications, and next steps. Render per the sample report in ~/.codex/add/templates/deploy-reference.md.
Quality gates fail (--skip-verify not set)
Uncommitted changes detected
Branch protection rules block push
CI pipeline fails
Smoke tests fail after deployment
Production deployment approval timeout
Deployment script fails
When deploying to a multi-environment project (Tier 2+), the deploy skill supports automatic promotion through environments:
--promote)When invoked with --promote (or during away mode), the skill climbs the promotion ladder:
verifyCommand for that environmentautoPromote: true → deploy to next environmentautoPromote: false is reached/add-deploy --promote --env dev
→ deploys to dev
→ runs dev verifyCommand (integration tests)
→ PASS → auto-promotes to staging
→ runs staging verifyCommand (e2e + perf)
→ PASS → stops (production requires human approval)
→ logs: "Verified through staging. Production queued for human approval."
If verification fails after deploying to an environment:
rollbackStrategy from config for that environment:
revert-commit: git revert {commit} && git push → redeployredeploy-previous-tag: find last stable tag → checkout → redeployDuring away mode, the deploy skill automatically uses --promote behavior:
autoPromote: true environmentsautoPromote: false environment (always production)--promote for automatic environment ladder climbingDeploy reads: git.* (defaultBranch, requirePR, requireReviews), ci.* (enabled, provider, timeout), deployment.* (strategy, rollbackEnabled, smokeTestScript), and per-environment environments.{env} settings (branch, requireApproval, requireReviews, targetHost). Full annotated example: ~/.codex/add/templates/deploy-reference.md.
Before deploying to production, walk the 15-item pre-production checklist in ~/.codex/add/templates/deploy-reference.md (ACs implemented, tests + coverage, reviews, spec compliance, performance, migrations, docs, release notes, rollback plan, notifications, monitoring, smoke tests).
If production deployment fails: revert the problematic commit (or check out the previous stable tag), push, redeploy the previous version, then verify health with smoke tests against production. Commands: ~/.codex/add/templates/deploy-reference.md.
Document: what broke, why it broke, how to prevent it in future, and the incident timeline.
After production deployment:
End-of-skill epilogue: follow ~/.codex/add/references/skill-epilogue.md (observation + learning checkpoint + progress tracking).
Deploy specifics: progress-task phases are pre-deploy checks → prepare → deploy → smoke tests; the observation line uses skill name deploy; the learning checkpoint uses the "After Deployment" trigger in ~/.codex/add/references/learning-reference.md.