agentsys 5.3.0 → 5.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/.cursor/commands/audit-project-agents.md +454 -0
  4. package/.cursor/commands/audit-project-github.md +141 -0
  5. package/.cursor/commands/audit-project.md +330 -0
  6. package/.cursor/commands/consult.md +417 -0
  7. package/.cursor/commands/debate.md +381 -0
  8. package/.cursor/commands/delivery-approval.md +334 -0
  9. package/.cursor/commands/deslop.md +142 -0
  10. package/.cursor/commands/drift-detect.md +259 -0
  11. package/.cursor/commands/enhance.md +172 -0
  12. package/.cursor/commands/learn.md +165 -0
  13. package/.cursor/commands/next-task.md +519 -0
  14. package/.cursor/commands/perf.md +464 -0
  15. package/.cursor/commands/repo-map.md +124 -0
  16. package/.cursor/commands/ship-ci-review-loop.md +468 -0
  17. package/.cursor/commands/ship-deployment.md +348 -0
  18. package/.cursor/commands/ship-error-handling.md +265 -0
  19. package/.cursor/commands/ship.md +517 -0
  20. package/.cursor/commands/sync-docs.md +171 -0
  21. package/.cursor/commands/web-ctl.md +101 -0
  22. package/.cursor/skills/consult/SKILL.md +425 -0
  23. package/.cursor/skills/debate/SKILL.md +316 -0
  24. package/.cursor/skills/deslop/SKILL.md +204 -0
  25. package/.cursor/skills/discover-tasks/SKILL.md +297 -0
  26. package/.cursor/skills/drift-analysis/SKILL.md +324 -0
  27. package/.cursor/skills/enhance-agent-prompts/SKILL.md +277 -0
  28. package/.cursor/skills/enhance-claude-memory/SKILL.md +387 -0
  29. package/.cursor/skills/enhance-cross-file/SKILL.md +110 -0
  30. package/.cursor/skills/enhance-docs/SKILL.md +298 -0
  31. package/.cursor/skills/enhance-hooks/SKILL.md +554 -0
  32. package/.cursor/skills/enhance-orchestrator/SKILL.md +255 -0
  33. package/.cursor/skills/enhance-plugins/SKILL.md +319 -0
  34. package/.cursor/skills/enhance-prompts/SKILL.md +340 -0
  35. package/.cursor/skills/enhance-skills/SKILL.md +436 -0
  36. package/.cursor/skills/learn/SKILL.md +349 -0
  37. package/.cursor/skills/orchestrate-review/SKILL.md +260 -0
  38. package/.cursor/skills/perf-analyzer/SKILL.md +37 -0
  39. package/.cursor/skills/perf-baseline-manager/SKILL.md +30 -0
  40. package/.cursor/skills/perf-benchmarker/SKILL.md +52 -0
  41. package/.cursor/skills/perf-code-paths/SKILL.md +32 -0
  42. package/.cursor/skills/perf-investigation-logger/SKILL.md +41 -0
  43. package/.cursor/skills/perf-profiler/SKILL.md +42 -0
  44. package/.cursor/skills/perf-theory-gatherer/SKILL.md +35 -0
  45. package/.cursor/skills/perf-theory-tester/SKILL.md +36 -0
  46. package/.cursor/skills/repo-mapping/SKILL.md +83 -0
  47. package/.cursor/skills/sync-docs/SKILL.md +351 -0
  48. package/.cursor/skills/validate-delivery/SKILL.md +186 -0
  49. package/.cursor/skills/web-auth/SKILL.md +177 -0
  50. package/.cursor/skills/web-browse/SKILL.md +516 -0
  51. package/.kiro/agents/agent-enhancer.json +12 -0
  52. package/.kiro/agents/ci-fixer.json +13 -0
  53. package/.kiro/agents/ci-monitor.json +12 -0
  54. package/.kiro/agents/claudemd-enhancer.json +12 -0
  55. package/.kiro/agents/consult-agent.json +13 -0
  56. package/.kiro/agents/cross-file-enhancer.json +12 -0
  57. package/.kiro/agents/debate-orchestrator.json +13 -0
  58. package/.kiro/agents/delivery-validator.json +12 -0
  59. package/.kiro/agents/deslop-agent.json +12 -0
  60. package/.kiro/agents/docs-enhancer.json +12 -0
  61. package/.kiro/agents/exploration-agent.json +12 -0
  62. package/.kiro/agents/hooks-enhancer.json +11 -0
  63. package/.kiro/agents/implementation-agent.json +13 -0
  64. package/.kiro/agents/learn-agent.json +12 -0
  65. package/.kiro/agents/map-validator.json +11 -0
  66. package/.kiro/agents/perf-analyzer.json +12 -0
  67. package/.kiro/agents/perf-code-paths.json +11 -0
  68. package/.kiro/agents/perf-investigation-logger.json +12 -0
  69. package/.kiro/agents/perf-orchestrator.json +13 -0
  70. package/.kiro/agents/perf-theory-gatherer.json +12 -0
  71. package/.kiro/agents/perf-theory-tester.json +13 -0
  72. package/.kiro/agents/plan-synthesizer.json +12 -0
  73. package/.kiro/agents/planning-agent.json +12 -0
  74. package/.kiro/agents/plugin-enhancer.json +12 -0
  75. package/.kiro/agents/prompt-enhancer.json +12 -0
  76. package/.kiro/agents/reviewer-perf-test.json +11 -0
  77. package/.kiro/agents/reviewer-quality-security.json +11 -0
  78. package/.kiro/agents/simple-fixer.json +13 -0
  79. package/.kiro/agents/skills-enhancer.json +11 -0
  80. package/.kiro/agents/sync-docs-agent.json +13 -0
  81. package/.kiro/agents/task-discoverer.json +12 -0
  82. package/.kiro/agents/test-coverage-checker.json +12 -0
  83. package/.kiro/agents/web-session.json +12 -0
  84. package/.kiro/agents/worktree-manager.json +13 -0
  85. package/.kiro/skills/consult/SKILL.md +425 -0
  86. package/.kiro/skills/debate/SKILL.md +316 -0
  87. package/.kiro/skills/deslop/SKILL.md +204 -0
  88. package/.kiro/skills/discover-tasks/SKILL.md +297 -0
  89. package/.kiro/skills/drift-analysis/SKILL.md +324 -0
  90. package/.kiro/skills/enhance-agent-prompts/SKILL.md +277 -0
  91. package/.kiro/skills/enhance-claude-memory/SKILL.md +387 -0
  92. package/.kiro/skills/enhance-cross-file/SKILL.md +110 -0
  93. package/.kiro/skills/enhance-docs/SKILL.md +298 -0
  94. package/.kiro/skills/enhance-hooks/SKILL.md +554 -0
  95. package/.kiro/skills/enhance-orchestrator/SKILL.md +255 -0
  96. package/.kiro/skills/enhance-plugins/SKILL.md +319 -0
  97. package/.kiro/skills/enhance-prompts/SKILL.md +340 -0
  98. package/.kiro/skills/enhance-skills/SKILL.md +436 -0
  99. package/.kiro/skills/learn/SKILL.md +349 -0
  100. package/.kiro/skills/orchestrate-review/SKILL.md +260 -0
  101. package/.kiro/skills/perf-analyzer/SKILL.md +37 -0
  102. package/.kiro/skills/perf-baseline-manager/SKILL.md +30 -0
  103. package/.kiro/skills/perf-benchmarker/SKILL.md +52 -0
  104. package/.kiro/skills/perf-code-paths/SKILL.md +32 -0
  105. package/.kiro/skills/perf-investigation-logger/SKILL.md +41 -0
  106. package/.kiro/skills/perf-profiler/SKILL.md +42 -0
  107. package/.kiro/skills/perf-theory-gatherer/SKILL.md +35 -0
  108. package/.kiro/skills/perf-theory-tester/SKILL.md +36 -0
  109. package/.kiro/skills/repo-mapping/SKILL.md +83 -0
  110. package/.kiro/skills/sync-docs/SKILL.md +351 -0
  111. package/.kiro/skills/validate-delivery/SKILL.md +186 -0
  112. package/.kiro/skills/web-auth/SKILL.md +177 -0
  113. package/.kiro/skills/web-browse/SKILL.md +516 -0
  114. package/.kiro/steering/audit-project-agents.md +459 -0
  115. package/.kiro/steering/audit-project-github.md +146 -0
  116. package/.kiro/steering/audit-project.md +330 -0
  117. package/.kiro/steering/consult.md +422 -0
  118. package/.kiro/steering/debate.md +386 -0
  119. package/.kiro/steering/delivery-approval.md +339 -0
  120. package/.kiro/steering/deslop.md +149 -0
  121. package/.kiro/steering/drift-detect.md +264 -0
  122. package/.kiro/steering/enhance.md +177 -0
  123. package/.kiro/steering/learn.md +166 -0
  124. package/.kiro/steering/next-task.md +481 -0
  125. package/.kiro/steering/perf.md +469 -0
  126. package/.kiro/steering/repo-map.md +126 -0
  127. package/.kiro/steering/ship-ci-review-loop.md +473 -0
  128. package/.kiro/steering/ship-deployment.md +353 -0
  129. package/.kiro/steering/ship-error-handling.md +270 -0
  130. package/.kiro/steering/ship.md +522 -0
  131. package/.kiro/steering/sync-docs.md +178 -0
  132. package/.kiro/steering/web-ctl.md +106 -0
  133. package/CHANGELOG.md +15 -0
  134. package/bin/cli.js +2 -2
  135. package/lib/adapter-transforms.js +34 -2
  136. package/package.json +1 -1
  137. package/site/content.json +1 -1
@@ -0,0 +1,353 @@
1
+ ---
2
+ inclusion: manual
3
+ name: "ship-deployment"
4
+ description: "Use when deploying and validating during /ship. Details Railway/Vercel deployment, smoke testing, and rollback procedures."
5
+ ---
6
+
7
+ # Phases 7-10: Deploy & Validate - Reference
8
+
9
+ This file contains platform-specific deployment and validation for `/ship`.
10
+
11
+ **Parent document**: `ship.md`
12
+
13
+ **Note**: Skip all phases if `WORKFLOW="single-branch"`.
14
+
15
+ ## Phase 7: Deploy to Development
16
+
17
+ ### Railway
18
+
19
+ ```bash
20
+ if [ "$DEPLOYMENT" = "railway" ]; then
21
+ echo "Waiting for Railway development deployment..."
22
+
23
+ SERVICE_NAME=$(railway service list --json | jq -r '.[0].name')
24
+ DEPLOY_ID=$(railway deployment list --service $SERVICE_NAME --json | jq -r '.[0].id')
25
+
26
+ while true; do
27
+ STATUS=$(railway deployment get $DEPLOY_ID --json | jq -r '.status')
28
+
29
+ if [ "$STATUS" = "SUCCESS" ]; then
30
+ DEV_URL=$(railway domain list --service $SERVICE_NAME --json | jq -r '.[0].domain')
31
+ echo "[OK] Deployed to development: https://$DEV_URL"
32
+ break
33
+ elif [ "$STATUS" = "FAILED" ]; then
34
+ echo "[ERROR] Development deployment failed"
35
+ railway logs --deployment $DEPLOY_ID
36
+ exit 1
37
+ fi
38
+
39
+ sleep 10
40
+ done
41
+ fi
42
+ ```
43
+
44
+ ### Vercel
45
+
46
+ ```bash
47
+ if [ "$DEPLOYMENT" = "vercel" ]; then
48
+ echo "Waiting for Vercel development deployment..."
49
+
50
+ DEPLOY_URL=$(vercel ls --json | jq -r '.[0].url')
51
+
52
+ while true; do
53
+ STATUS=$(vercel inspect $DEPLOY_URL --json | jq -r '.readyState')
54
+
55
+ if [ "$STATUS" = "READY" ]; then
56
+ echo "[OK] Deployed to development: https://$DEPLOY_URL"
57
+ DEV_URL="https://$DEPLOY_URL"
58
+ break
59
+ elif [ "$STATUS" = "ERROR" ]; then
60
+ echo "[ERROR] Development deployment failed"
61
+ vercel logs $DEPLOY_URL
62
+ exit 1
63
+ fi
64
+
65
+ sleep 10
66
+ done
67
+ fi
68
+ ```
69
+
70
+ ### Netlify
71
+
72
+ ```bash
73
+ if [ "$DEPLOYMENT" = "netlify" ]; then
74
+ echo "Waiting for Netlify development deployment..."
75
+
76
+ SITE_ID=$(netlify status --json | jq -r '.site_id')
77
+ DEPLOY_ID=$(netlify api listSiteDeploys --data "{ \"site_id\": \"$SITE_ID\" }" | jq -r '.[0].id')
78
+
79
+ while true; do
80
+ STATUS=$(netlify api getDeploy --data "{ \"deploy_id\": \"$DEPLOY_ID\" }" | jq -r '.state')
81
+
82
+ if [ "$STATUS" = "ready" ]; then
83
+ DEV_URL=$(netlify api getDeploy --data "{ \"deploy_id\": \"$DEPLOY_ID\" }" | jq -r '.deploy_ssl_url')
84
+ echo "[OK] Deployed to development: $DEV_URL"
85
+ break
86
+ elif [ "$STATUS" = "error" ]; then
87
+ echo "[ERROR] Development deployment failed"
88
+ exit 1
89
+ fi
90
+
91
+ sleep 10
92
+ done
93
+ fi
94
+ ```
95
+
96
+ ### Generic / Unknown
97
+
98
+ ```bash
99
+ if [ -z "$DEPLOYMENT" ] || [ "$DEPLOYMENT" = "null" ]; then
100
+ echo "No deployment platform detected"
101
+ echo "Assuming merge to $MAIN_BRANCH means deployment"
102
+ DEV_URL="N/A"
103
+ fi
104
+ ```
105
+
106
+ ## Phase 8: Validate Development
107
+
108
+ ### Health Check
109
+
110
+ ```bash
111
+ echo "Running smoke tests on development..."
112
+
113
+ # Wait for deployment to stabilize
114
+ sleep 30
115
+
116
+ # Basic health check
117
+ HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" $DEV_URL/health || echo "000")
118
+
119
+ if [ "$HTTP_STATUS" = "200" ] || [ "$HTTP_STATUS" = "301" ] || [ "$HTTP_STATUS" = "302" ]; then
120
+ echo "[OK] Health check passed: $HTTP_STATUS"
121
+ else
122
+ echo "[ERROR] Health check failed: $HTTP_STATUS"
123
+ echo "Investigate deployment issues before proceeding to production"
124
+ exit 1
125
+ fi
126
+ ```
127
+
128
+ ### Error Log Monitoring
129
+
130
+ ```bash
131
+ echo "Checking logs for errors..."
132
+
133
+ if [ "$DEPLOYMENT" = "railway" ]; then
134
+ ERROR_COUNT=$(railway logs --tail 100 | grep -iE "(error|exception|fatal)" | wc -l)
135
+ elif [ "$DEPLOYMENT" = "vercel" ]; then
136
+ ERROR_COUNT=$(vercel logs $DEV_URL --since 5m | grep -iE "(error|exception|fatal)" | wc -l)
137
+ elif [ "$DEPLOYMENT" = "netlify" ]; then
138
+ ERROR_COUNT=$(netlify logs --since 5m | grep -iE "(error|exception|fatal)" | wc -l)
139
+ else
140
+ ERROR_COUNT=0
141
+ fi
142
+
143
+ if [ "$ERROR_COUNT" -gt 10 ]; then
144
+ echo "[ERROR] High error rate detected: $ERROR_COUNT errors in last 5 minutes"
145
+ echo "Review logs before proceeding to production"
146
+ exit 1
147
+ else
148
+ echo "[OK] Error rate acceptable: $ERROR_COUNT errors"
149
+ fi
150
+ ```
151
+
152
+ ### Project Smoke Tests
153
+
154
+ ```bash
155
+ if jq -e '.scripts["smoke-test"]' package.json > /dev/null 2>&1; then
156
+ echo "Running project smoke tests..."
157
+
158
+ export SMOKE_TEST_URL=$DEV_URL
159
+ $PACKAGE_MGR run smoke-test
160
+
161
+ if [ $? -eq 0 ]; then
162
+ echo "[OK] Smoke tests passed"
163
+ else
164
+ echo "[ERROR] Smoke tests failed"
165
+ exit 1
166
+ fi
167
+ fi
168
+ ```
169
+
170
+ ### Validation Summary
171
+
172
+ ```markdown
173
+ ## Development Validation [OK]
174
+
175
+ **URL**: ${DEV_URL}
176
+ **Health Check**: [OK] ${HTTP_STATUS}
177
+ **Error Rate**: [OK] ${ERROR_COUNT} errors
178
+ **Smoke Tests**: [OK] Passed
179
+
180
+ Proceeding to production...
181
+ ```
182
+
183
+ ## Phase 9: Deploy to Production
184
+
185
+ ### Merge to Production Branch
186
+
187
+ ```bash
188
+ # Worktree check must come first - multi-branch deployment requires branch checkout
189
+ if [ -f "$(git rev-parse --show-toplevel 2>/dev/null)/.git" ]; then
190
+ MAIN_REPO=$(dirname "$(git rev-parse --git-common-dir 2>/dev/null)")
191
+ echo "[ERROR] Multi-branch deployment is not supported from a worktree"
192
+ echo "Run from the main repo: cd $MAIN_REPO"
193
+ exit 1
194
+ fi
195
+
196
+ echo "Merging $MAIN_BRANCH → $PROD_BRANCH..."
197
+
198
+ git checkout $PROD_BRANCH
199
+ git pull origin $PROD_BRANCH
200
+
201
+ git merge $MAIN_BRANCH --no-edit
202
+
203
+ if [ $? -ne 0 ]; then
204
+ echo "[ERROR] Merge to production failed (conflicts)"
205
+ git merge --abort
206
+ exit 1
207
+ fi
208
+
209
+ git push origin $PROD_BRANCH
210
+
211
+ if [ $? -eq 0 ]; then
212
+ PROD_SHA=$(git rev-parse HEAD)
213
+ echo "[OK] Production branch at: $PROD_SHA"
214
+ else
215
+ echo "[ERROR] Push to production failed"
216
+ exit 1
217
+ fi
218
+ ```
219
+
220
+ ### Wait for Production Deployment
221
+
222
+ Same platform-specific logic as Phase 7, but targeting production environment.
223
+
224
+ ```bash
225
+ echo "Waiting for production deployment..."
226
+
227
+ # Platform-specific deployment monitoring
228
+ # (Similar to Phase 7)
229
+
230
+ echo "[OK] Deployed to production: $PROD_URL"
231
+ ```
232
+
233
+ ## Phase 10: Validate Production
234
+
235
+ ### Conservative Validation
236
+
237
+ ```bash
238
+ echo "Validating production deployment..."
239
+
240
+ # Wait longer for production to stabilize
241
+ sleep 60
242
+
243
+ # Health check
244
+ HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" $PROD_URL/health || echo "000")
245
+
246
+ if [ "$HTTP_STATUS" = "200" ] || [ "$HTTP_STATUS" = "301" ] || [ "$HTTP_STATUS" = "302" ]; then
247
+ echo "[OK] Production health check: $HTTP_STATUS"
248
+ else
249
+ echo "[ERROR] Production health check failed: $HTTP_STATUS"
250
+ rollback_production
251
+ fi
252
+ ```
253
+
254
+ ### Production Error Monitoring
255
+
256
+ ```bash
257
+ echo "Monitoring production logs..."
258
+
259
+ if [ "$DEPLOYMENT" = "railway" ]; then
260
+ ERROR_COUNT=$(railway logs --tail 100 | grep -iE "(error|exception|fatal)" | wc -l)
261
+ elif [ "$DEPLOYMENT" = "vercel" ]; then
262
+ ERROR_COUNT=$(vercel logs $PROD_URL --since 5m | grep -iE "(error|exception|fatal)" | wc -l)
263
+ fi
264
+
265
+ if [ "$ERROR_COUNT" -gt 20 ]; then
266
+ echo "[ERROR] CRITICAL: High error rate in production: $ERROR_COUNT errors"
267
+ rollback_production
268
+ else
269
+ echo "[OK] Production error rate acceptable: $ERROR_COUNT errors"
270
+ fi
271
+ ```
272
+
273
+ ### Production Smoke Tests
274
+
275
+ ```bash
276
+ if jq -e '.scripts["smoke-test:prod"]' package.json > /dev/null 2>&1; then
277
+ echo "Running production smoke tests..."
278
+
279
+ export SMOKE_TEST_URL=$PROD_URL
280
+ $PACKAGE_MGR run smoke-test:prod
281
+
282
+ if [ $? -ne 0 ]; then
283
+ echo "[ERROR] Production smoke tests failed"
284
+ rollback_production
285
+ fi
286
+ fi
287
+ ```
288
+
289
+ ## Rollback Mechanism
290
+
291
+ **Triggered automatically on any production validation failure.**
292
+
293
+ ```bash
294
+ rollback_production() {
295
+ # Worktree check must come first
296
+ if [ -f "$(git rev-parse --show-toplevel 2>/dev/null)/.git" ]; then
297
+ MAIN_REPO=$(dirname "$(git rev-parse --git-common-dir 2>/dev/null)")
298
+ echo "[ERROR] Rollback is not supported from a worktree"
299
+ echo "Run from the main repo: cd $MAIN_REPO"
300
+ exit 1
301
+ fi
302
+
303
+ echo "========================================"
304
+ echo "ROLLBACK INITIATED"
305
+ echo "========================================"
306
+
307
+ echo "WARNING: Force pushing to $PROD_BRANCH to revert"
308
+
309
+ git checkout $PROD_BRANCH
310
+ git reset --hard HEAD~1
311
+
312
+ # Use --force-with-lease for safety
313
+ if ! git push --force-with-lease origin $PROD_BRANCH; then
314
+ echo "[ERROR] Force push failed - remote may have unexpected changes"
315
+ echo "Manual intervention required"
316
+ exit 1
317
+ fi
318
+
319
+ echo "[OK] Rolled back production to previous deployment"
320
+ echo "Previous version will redeploy automatically"
321
+
322
+ # Wait for rollback deployment
323
+ sleep 30
324
+
325
+ # Verify rollback succeeded
326
+ HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" $PROD_URL/health || echo "000")
327
+ if [ "$HTTP_STATUS" = "200" ]; then
328
+ echo "[OK] Rollback successful, production is healthy"
329
+ else
330
+ echo "[WARN] Rollback deployed but health check unclear"
331
+ echo "Manual investigation required"
332
+ fi
333
+
334
+ exit 1
335
+ }
336
+ ```
337
+
338
+ ## Platform Detection Reference
339
+
340
+ The `detect-platform.js` script returns:
341
+
342
+ ```json
343
+ {
344
+ "ci": "github-actions|gitlab-ci|circleci|jenkins|travis|null",
345
+ "deployment": "railway|vercel|netlify|heroku|null",
346
+ "branchStrategy": "single-branch|multi-branch",
347
+ "mainBranch": "main|master",
348
+ "projectType": "nodejs|python|rust|go",
349
+ "packageManager": "npm|yarn|pnpm|pip|cargo"
350
+ }
351
+ ```
352
+
353
+ Use these values to adapt deployment monitoring to your specific platform.
@@ -0,0 +1,270 @@
1
+ ---
2
+ inclusion: manual
3
+ name: "ship-error-handling"
4
+ description: "Use when handling and recovering from /ship command errors."
5
+ ---
6
+
7
+ # Error Handling & Recovery - Reference
8
+
9
+ This file contains error handling procedures for `/ship`.
10
+
11
+ **Parent document**: `ship.md`
12
+
13
+ ## GitHub CLI Not Available
14
+
15
+ ```markdown
16
+ ERROR: GitHub CLI (gh) not found
17
+
18
+ Install: https://cli.github.com
19
+
20
+ Or use package manager:
21
+ macOS: brew install gh
22
+ Windows: winget install GitHub.cli
23
+ Linux: See https://github.com/cli/cli/blob/trunk/docs/install_linux.md
24
+
25
+ Then authenticate:
26
+ gh auth login
27
+ ```
28
+
29
+ ## CI Failure
30
+
31
+ ```markdown
32
+ [ERROR] CI checks failed for PR #${PR_NUMBER}
33
+
34
+ View details:
35
+ ${CI_URL}
36
+
37
+ Fix the failing tests/checks and push again.
38
+ The /ship command will resume from Phase 4 (CI monitoring).
39
+
40
+ To retry:
41
+ git push
42
+ /ship
43
+ ```
44
+
45
+ ### CI Fix with ci-fixer Agent
46
+
47
+ When CI fails, use the ci-fixer agent:
48
+
49
+ ```javascript
50
+ Task({
51
+ subagent_type: "ci-fixer",
52
+ prompt: `Fix CI failure for PR #${PR_NUMBER}
53
+
54
+ CI Output:
55
+ ${CI_OUTPUT}
56
+
57
+ Failed checks:
58
+ ${FAILED_CHECKS}
59
+
60
+ Requirements:
61
+ 1. Analyze the failure reason
62
+ 2. Make minimal fix to pass CI
63
+ 3. Do not introduce unrelated changes
64
+ 4. Ensure all tests pass after fix`
65
+ });
66
+ ```
67
+
68
+ ## Merge Conflicts
69
+
70
+ ```markdown
71
+ [ERROR] Cannot merge PR #${PR_NUMBER}: conflicts with ${MAIN_BRANCH}
72
+
73
+ Resolve conflicts:
74
+ git fetch origin
75
+ git merge origin/${MAIN_BRANCH}
76
+ # Resolve conflicts in your editor
77
+ git add .
78
+ git commit
79
+ git push
80
+
81
+ Then retry:
82
+ /ship
83
+ ```
84
+
85
+ ## Deployment Failure
86
+
87
+ ```markdown
88
+ [ERROR] Deployment failed
89
+
90
+ ${WORKFLOW === 'dev-prod' ? 'Development' : 'Production'} deployment did not succeed.
91
+
92
+ Check deployment logs:
93
+ ${DEPLOYMENT === 'railway' ? 'railway logs' : ''}
94
+ ${DEPLOYMENT === 'vercel' ? 'vercel logs' : ''}
95
+ ${DEPLOYMENT === 'netlify' ? 'netlify logs' : ''}
96
+
97
+ Once fixed, deployment will retry automatically.
98
+ ```
99
+
100
+ ## Production Validation Failure with Rollback
101
+
102
+ ```markdown
103
+ [ERROR] Production validation failed
104
+
105
+ ROLLBACK INITIATED
106
+
107
+ Production has been rolled back to previous version.
108
+ Previous deployment: ${PREVIOUS_SHA}
109
+
110
+ Issues detected:
111
+ ${VALIDATION_ISSUES}
112
+
113
+ Fix the issues and try shipping again:
114
+ /ship
115
+ ```
116
+
117
+ ## Push Failure
118
+
119
+ ```markdown
120
+ [ERROR] Push to remote failed
121
+
122
+ Possible causes:
123
+ 1. Authentication issue: gh auth status
124
+ 2. Remote branch protected: check branch protection rules
125
+ 3. Out of date: git pull --rebase origin ${CURRENT_BRANCH}
126
+
127
+ Resolve and retry:
128
+ /ship
129
+ ```
130
+
131
+ ## PR Creation Failure
132
+
133
+ ```markdown
134
+ [ERROR] Failed to create PR
135
+
136
+ Possible causes:
137
+ 1. Already exists: gh pr list --head ${CURRENT_BRANCH}
138
+ 2. No commits: git log ${MAIN_BRANCH}..HEAD
139
+ 3. Same branch: ensure not on ${MAIN_BRANCH}
140
+
141
+ Check existing PRs:
142
+ gh pr list --state all --head ${CURRENT_BRANCH}
143
+ ```
144
+
145
+ ## Max Review Iterations Reached
146
+
147
+ ```markdown
148
+ [ERROR] Max iterations (${MAX_ITERATIONS}) reached
149
+
150
+ Unable to resolve all review comments automatically.
151
+ Manual intervention required.
152
+
153
+ Remaining unresolved threads: ${UNRESOLVED_COUNT}
154
+
155
+ View PR: ${PR_URL}
156
+
157
+ Options:
158
+ 1. Manually address remaining comments
159
+ 2. Request reviewer to close non-blocking items
160
+ 3. Continue with /ship after resolving
161
+ ```
162
+
163
+ ## Worktree Cleanup Failure
164
+
165
+ ```markdown
166
+ [WARN] Failed to clean up worktree
167
+
168
+ Worktree at: ${WORKTREE_PATH}
169
+
170
+ Manual cleanup:
171
+ git worktree remove ${WORKTREE_PATH} --force
172
+ git worktree prune
173
+ ```
174
+
175
+ ## Force Push Safety
176
+
177
+ When rollback requires force push:
178
+
179
+ ```bash
180
+ # ALWAYS use --force-with-lease instead of --force
181
+ # This prevents overwriting unexpected remote changes
182
+
183
+ if ! git push --force-with-lease origin $PROD_BRANCH; then
184
+ echo "[ERROR] Force push failed - remote has unexpected changes"
185
+ echo "Someone else may have pushed to production"
186
+ echo "Manual investigation required"
187
+ exit 1
188
+ fi
189
+ ```
190
+
191
+ ## Recovery Procedures
192
+
193
+ ### Resume After CI Fix
194
+
195
+ ```bash
196
+ # After fixing CI locally
197
+ git add .
198
+ git commit -m "fix: address CI failures"
199
+ git push
200
+
201
+ # Resume shipping
202
+ /ship
203
+ ```
204
+
205
+ ### Resume After Conflict Resolution
206
+
207
+ ```bash
208
+ # After resolving merge conflicts
209
+ git add .
210
+ git commit
211
+ git push
212
+
213
+ # Resume shipping
214
+ /ship
215
+ ```
216
+
217
+ ### Resume After Manual Review Resolution
218
+
219
+ ```bash
220
+ # After manually addressing review comments
221
+ git add .
222
+ git commit -m "fix: address review feedback"
223
+ git push
224
+
225
+ # Resume shipping
226
+ /ship
227
+ ```
228
+
229
+ ### Cancel and Cleanup
230
+
231
+ ```bash
232
+ # Detect worktree
233
+ IS_WORKTREE="false"
234
+ if [ -f "$(git rev-parse --show-toplevel 2>/dev/null)/.git" ]; then
235
+ IS_WORKTREE="true"
236
+ fi
237
+
238
+ if [ "$IS_WORKTREE" = "true" ]; then
239
+ # In worktree: close PR and delete remote branch separately
240
+ gh pr close $PR_NUMBER
241
+ git push origin --delete "$CURRENT_BRANCH" 2>&1 || echo "[WARN] Remote branch deletion failed - may need manual cleanup"
242
+ echo "[OK] PR closed (worktree mode - local cleanup deferred to worktree removal)"
243
+ else
244
+ gh pr close $PR_NUMBER --delete-branch
245
+ git checkout $MAIN_BRANCH
246
+ git branch -D $CURRENT_BRANCH
247
+ fi
248
+ ```
249
+
250
+ ## Exit Codes
251
+
252
+ | Code | Meaning |
253
+ |------|---------|
254
+ | 0 | Success - PR merged |
255
+ | 1 | General failure |
256
+ | 2 | CI failure (retryable) |
257
+ | 3 | Review timeout (manual intervention) |
258
+ | 4 | Deployment failure |
259
+ | 5 | Rollback triggered |
260
+
261
+ ## Logging for Debugging
262
+
263
+ Enable verbose logging:
264
+
265
+ ```bash
266
+ export SHIP_DEBUG=1
267
+ /ship
268
+ ```
269
+
270
+ This will output detailed information about each phase for troubleshooting.