Skip to content

Commit 0dd83d6

Browse files
marcusgollclaude
andcommitted
fix(deployment): repair broken command references in deployment workflow
- ship.md: Change /ship-staging and /ship-prod from SlashCommand to Task() spawns - ship.md: Fix /deploy-prod inconsistency (now uses Task(ship-prod-phase-agent)) - ship-staging-phase-agent: Remove phantom /phase-1-ship reference, execute via gh CLI - ship-prod-phase-agent: Remove phantom /phase-2-ship reference, execute via gh CLI - budget.md: Update /phase-1-ship → /ship --staging - budget.md: Update /validate-deploy → /validate-staging The deployment commands now properly wire to their agents via Task() spawning, matching the pattern used by feature.md and epic.md. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent d77f89a commit 0dd83d6

File tree

4 files changed

+200
-60
lines changed

4 files changed

+200
-60
lines changed

.claude/agents/phase/ship-prod.md

Lines changed: 57 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: ship-prod-phase-agent
3-
description: Orchestrates production deployment by promoting validated staging builds to production. Use after staging validation is complete to trigger production workflow, create GitHub releases, and update roadmap to Shipped status. Handles release versioning and deployment verification.
4-
tools: Read, Grep, Bash, SlashCommand
3+
description: Orchestrates production deployment by promoting validated staging builds to production. Spawned by /ship command to trigger production workflow, create GitHub releases, and update roadmap status.
4+
tools: Read, Grep, Bash
55
model: sonnet
66
---
77

@@ -22,11 +22,12 @@ Your mission: Execute Phase 7 (Production Deployment) in an isolated context win
2222
</focus_areas>
2323

2424
<responsibilities>
25-
- Call `/phase-2-ship` slash command to promote validated staging builds to production
25+
- Trigger production deployment workflow via gh CLI and GitHub Actions
2626
- Extract deployment status, release version, and production URLs from deployment reports
27+
- Create GitHub release with proper semantic versioning
2728
- Return structured summary for orchestrator with deployment verification results
2829
- Ensure secret sanitization in all reports and summaries
29-
- Validate GitHub release creation and roadmap synchronization
30+
- Update roadmap GitHub issue to "Shipped" status
3031
- Skip production deployment gracefully for local-only projects
3132
</responsibilities>
3233

@@ -98,31 +99,61 @@ If project type is "local-only", skip this phase and return:
9899
**Rationale**: Local-only projects have no remote deployment target, so production deployment is not applicable.
99100
</step>
100101

101-
<step number="2" name="execute_slash_command">
102-
**Call /phase-2-ship slash command**
102+
<step number="2" name="execute_deployment">
103+
**Execute production deployment workflow**
103104

104-
For remote projects (staging-prod or direct-prod), use SlashCommand tool to execute:
105+
For remote projects (staging-prod or direct-prod), execute deployment directly via gh CLI:
105106

106107
```bash
107-
/phase-2-ship
108+
# Determine next version (semantic versioning)
109+
CURRENT_VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
110+
NEXT_VERSION=$(echo "$CURRENT_VERSION" | awk -F. '{$NF = $NF + 1;} 1' | sed 's/ /./g')
111+
112+
# Trigger production deployment workflow
113+
gh workflow run deploy-production.yml \
114+
--ref main \
115+
-f version="$NEXT_VERSION" \
116+
-f feature_slug="$FEATURE_SLUG"
117+
118+
# Wait for workflow to complete (poll every 30s for up to 10 minutes)
119+
WORKFLOW_RUN_ID=$(gh run list --workflow=deploy-production.yml --limit 1 --json databaseId -q '.[0].databaseId')
120+
121+
for i in {1..20}; do
122+
STATUS=$(gh run view "$WORKFLOW_RUN_ID" --json conclusion -q '.conclusion' 2>/dev/null)
123+
if [ "$STATUS" = "success" ]; then
124+
echo "DEPLOYMENT_STATUS=success"
125+
break
126+
elif [ "$STATUS" = "failure" ]; then
127+
echo "DEPLOYMENT_STATUS=failed"
128+
break
129+
fi
130+
sleep 30
131+
done
132+
133+
# Create GitHub release if deployment succeeded
134+
if [ "$STATUS" = "success" ]; then
135+
gh release create "$NEXT_VERSION" \
136+
--title "Release $NEXT_VERSION" \
137+
--notes "Production deployment for $FEATURE_SLUG" \
138+
--target main
139+
fi
108140
```
109141

110-
This performs:
142+
This workflow performs:
111143

112-
- Validates staging deployment (for staging-prod workflow)
113-
- Triggers production workflow via GitHub Actions
114-
- Waits for deployment completion
115-
- Creates GitHub release with version tag
144+
- Determines next semantic version from git tags
145+
- Triggers production deployment via GitHub Actions workflow
146+
- Monitors workflow completion status
147+
- Creates GitHub release with version tag on success
116148
- Updates roadmap GitHub issue to "Shipped" section
117-
- Generates ship-report.md with deployment metadata
118149

119150
**Expected duration**: 3-8 minutes (varies with deployment complexity and CI/CD speed)
120151
</step>
121152

122153
<step number="3" name="extract_deployment_metadata">
123154
**Extract key deployment information**
124155

125-
After `/phase-2-ship` completes, analyze artifacts:
156+
After deployment workflow completes, analyze artifacts:
126157

127158
```bash
128159
FEATURE_DIR="specs/$SLUG"
@@ -287,7 +318,7 @@ Return structured JSON to orchestrator:
287318
Production deployment phase is complete when:
288319

289320
- ✅ Project type checked (skip if local-only)
290-
-`/phase-2-ship` slash command executed successfully (for remote projects)
321+
-Production deployment workflow executed successfully (for remote projects)
291322
- ✅ Production workflow succeeded (exit code 0)
292323
- ✅ GitHub release created with correct version tag
293324
- ✅ Roadmap updated to "Shipped" section with deployment link
@@ -299,20 +330,20 @@ Production deployment phase is complete when:
299330
</success_criteria>
300331

301332
<error_handling>
302-
<scenario name="slash_command_failure">
303-
**Cause**: `/phase-2-ship` command fails to execute
333+
<scenario name="workflow_execution_failure">
334+
**Cause**: Production deployment workflow fails to execute
304335

305336
**Symptoms**:
306337

307-
- SlashCommand tool returns error
308-
- Command times out or crashes
309-
- Tool permissions issue
338+
- gh CLI command returns error
339+
- GitHub Actions workflow not found
340+
- Workflow times out or crashes
310341

311342
**Recovery**:
312343

313344
1. Return blocked status with specific error message
314-
2. Include error details from slash command output in blockers array
315-
3. Report tool failure to orchestrator
345+
2. Include error details from gh CLI output in blockers array
346+
3. Report workflow failure to orchestrator
316347
4. Do NOT mark deployment complete
317348

318349
**Example**:
@@ -321,10 +352,10 @@ Production deployment phase is complete when:
321352
{
322353
"phase": "ship-production",
323354
"status": "blocked",
324-
"summary": "Production deployment failed: /phase-2-ship command execution error",
355+
"summary": "Production deployment failed: workflow execution error",
325356
"blockers": [
326-
"SlashCommand tool failed: Permission denied",
327-
"Unable to trigger production workflow"
357+
"GitHub workflow dispatch failed: workflow file not found",
358+
"Unable to trigger production deployment"
328359
],
329360
"next_phase": null
330361
}

.claude/agents/phase/ship-staging.md

Lines changed: 46 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
name: ship-staging-phase-agent
3-
description: Orchestrates staging deployment via /phase-1-ship command. Handles PR creation, CI monitoring, auto-merge, and deployment verification. Use when shipping features to staging environment for validation. Triggers on staging deployment, ship to staging, phase 6, pre-production deployment.
3+
description: Orchestrates staging deployment by creating PRs, monitoring CI, auto-merging, and verifying deployment. Spawned by /ship command for staging-prod deployment model.
44
model: sonnet # Complex orchestration requiring PR management, CI monitoring, and error handling
5-
tools: Read, Grep, Bash, SlashCommand
5+
tools: Read, Grep, Bash
66
---
77

88
<role>
@@ -19,12 +19,12 @@ You are a senior DevOps engineer specializing in staging deployment orchestratio
1919
</focus_areas>
2020

2121
<responsibilities>
22-
1. Execute `/phase-1-ship` slash command to initiate staging deployment
23-
2. Monitor PR creation, CI checks, and auto-merge completion
22+
1. Create PR from feature branch to main/staging branch via gh CLI
23+
2. Enable auto-merge and monitor CI checks to completion
2424
3. Extract deployment metadata (PR number, CI status, deployment URLs)
2525
4. Validate quality gates (PR created, CI passing, auto-merged successfully)
2626
5. Sanitize all secrets before writing deployment records or summaries
27-
6. Return structured JSON summary to orchestrator for decision-making
27+
6. Return structured summary to orchestrator with deployment status
2828
</responsibilities>
2929

3030
<security_sanitization>
@@ -99,24 +99,54 @@ Return skip status and proceed to next appropriate phase (finalize for local-onl
9999
</step>
100100

101101
<step name="execute_deployment">
102-
For staging-prod deployment model, execute the staging deployment slash command.
102+
For staging-prod deployment model, execute the staging deployment directly via gh CLI.
103103

104104
```bash
105-
/phase-1-ship
105+
# Get current branch and feature slug
106+
CURRENT_BRANCH=$(git branch --show-current)
107+
FEATURE_SLUG=$(basename "$FEATURE_DIR")
108+
109+
# Create PR from feature branch to main
110+
PR_URL=$(gh pr create --base main --head "$CURRENT_BRANCH" \
111+
--title "feat: $FEATURE_SLUG" \
112+
--body "Automated staging deployment for $FEATURE_SLUG" \
113+
2>/dev/null || echo "")
114+
115+
# If PR already exists, get its URL
116+
if [ -z "$PR_URL" ]; then
117+
PR_URL=$(gh pr view --json url -q '.url' 2>/dev/null || echo "")
118+
fi
119+
120+
# Extract PR number
121+
PR_NUMBER=$(echo "$PR_URL" | grep -o '[0-9]*$')
122+
123+
# Enable auto-merge
124+
gh pr merge "$PR_NUMBER" --auto --squash 2>/dev/null || true
125+
126+
# Monitor CI status (poll every 30s for up to 10 minutes)
127+
for i in {1..20}; do
128+
CI_STATUS=$(gh pr checks "$PR_NUMBER" --json state -q '.[].state' 2>/dev/null | sort -u)
129+
if echo "$CI_STATUS" | grep -q "FAILURE"; then
130+
echo "CI_STATUS=failed"
131+
break
132+
elif echo "$CI_STATUS" | grep -qv "PENDING"; then
133+
echo "CI_STATUS=passed"
134+
break
135+
fi
136+
sleep 30
137+
done
106138
```
107139

108-
The `/phase-1-ship` command orchestrates:
109-
1. **PR Creation**: Creates pull request from feature branch to staging/main branch
140+
This workflow orchestrates:
141+
1. **PR Creation**: Creates pull request from feature branch to main branch
110142
2. **Auto-merge**: Configures PR to auto-merge when all checks pass
111-
3. **CI Monitoring**: Waits for CI/CD checks to complete
143+
3. **CI Monitoring**: Polls CI/CD checks every 30 seconds
112144
4. **Merge Execution**: Auto-merges PR when CI checks are green
113-
5. **Deployment Trigger**: Triggers staging deployment via CI/CD pipeline
114-
6. **Record Creation**: Generates deployment metadata in staging-ship-report.md
145+
5. **Deployment Trigger**: Merge to main triggers staging deployment via CI/CD pipeline
115146

116147
Creates artifacts:
117148
- `specs/$SLUG/staging-ship-report.md` - Deployment summary with PR info and CI results
118149
- Updates `specs/$SLUG/NOTES.md` - Appends deployment status
119-
- `specs/$SLUG/deployment-metadata.json` - Structured deployment data (if available)
120150
</step>
121151

122152
<step name="extract_metadata">
@@ -262,7 +292,7 @@ Return structured JSON summary to orchestrator:
262292
<success_criteria>
263293
Staging deployment phase is complete when:
264294
- ✅ Project type validated (skipped if local-only or direct-prod)
265-
-`/phase-1-ship` slash command executed successfully (for staging-prod)
295+
-PR created and CI monitoring executed successfully (for staging-prod)
266296
- ✅ PR created to staging branch with valid PR number
267297
- ✅ CI checks initiated and monitored to completion
268298
- ✅ Auto-merge configuration verified
@@ -277,7 +307,7 @@ Staging deployment phase is complete when:
277307

278308
<error_handling>
279309
<command_failure>
280-
If `/phase-1-ship` slash command fails to execute:
310+
If PR creation or CI monitoring fails:
281311

282312
1. Check prerequisites:
283313
```bash
@@ -296,7 +326,7 @@ If `/phase-1-ship` slash command fails to execute:
296326
{
297327
"phase": "ship-staging",
298328
"status": "blocked",
299-
"summary": "Staging deployment failed: slash command execution error",
329+
"summary": "Staging deployment failed: PR creation or CI monitoring error",
300330
"blockers": [
301331
"Git remote not configured - cannot create PR",
302332
"Feature branch missing - run git checkout -b feature/$SLUG first",

.claude/commands/deployment/budget.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ Track deployment quota usage and predict remaining capacity to prevent rate limi
114114
Next Deployment Impact
115115
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
116116
117-
Next /phase-1-ship will use:
117+
Next /ship --staging will use:
118118
Marketing: 1 deployment
119119
App: 1 deployment
120120
Total: 2 deployments
@@ -146,7 +146,7 @@ Track deployment quota usage and predict remaining capacity to prevent rate limi
146146
- Unlimited usage
147147
148148
Preview mode usage:
149-
/phase-1-ship
149+
/ship --staging
150150
→ Select 'preview' when prompted
151151
```
152152
- **If warning status**:
@@ -156,13 +156,13 @@ Track deployment quota usage and predict remaining capacity to prevent rate limi
156156
⚠️ Use quota carefully
157157
158158
Best practices:
159-
1. Run /validate-deploy before every deployment
159+
1. Run /validate-staging before every deployment
160160
2. Use preview mode for CI testing
161161
3. Use staging mode only for actual staging deploys
162162
4. Fix issues locally before pushing
163163
164164
Workflow:
165-
/validate-deploy → /ship (preview) → verify → /ship (staging)
165+
/validate-staging → /ship (preview) → verify → /ship (staging)
166166
```
167167
- **If normal status**:
168168
```
@@ -171,7 +171,7 @@ Track deployment quota usage and predict remaining capacity to prevent rate limi
171171
✅ Enough quota for normal workflow
172172
173173
Best practices:
174-
1. Still run /validate-deploy to catch issues early
174+
1. Still run /validate-staging to catch issues early
175175
2. Use preview mode for experimental changes
176176
3. Monitor quota with /deployment-budget
177177
```
@@ -186,7 +186,7 @@ Track deployment quota usage and predict remaining capacity to prevent rate limi
186186
187187
🚨 HIGH failure rate detected
188188
Run /debug to investigate issues
189-
Use /validate-deploy before deploying
189+
Use /validate-staging before deploying
190190
```
191191
192192
9. **Display final summary**:
@@ -210,7 +210,7 @@ Track deployment quota usage and predict remaining capacity to prevent rate limi
210210
Remaining: {remaining} / 100
211211
After next deploy: ~{projected}
212212
213-
Run /validate-deploy before deploying
213+
Run /validate-staging before deploying
214214
```
215215
- **Normal**:
216216
```
@@ -308,7 +308,7 @@ Remaining: {remaining} / 100
308308
- Vercel limit: 100 deployments / 24 hours (rolling window)
309309
- Warning threshold: 20 remaining (allows ~10 more staging deploys)
310310
- Critical threshold: 10 remaining (allows ~5 more deploys)
311-
- Deployment cost: 2 per /phase-1-ship (Marketing + App)
311+
- Deployment cost: 2 per /ship --staging (Marketing + App)
312312
- Failure rate threshold: 30% (indicates systematic issues)
313313
- Read-only operations (never modify quotas)
314314
- Non-blocking (always returns exit code 0)
@@ -331,7 +331,7 @@ Remaining: {remaining} / 100
331331
- **Normal**: >= 20 remaining (✅ Safe to deploy)
332332
333333
**Deployment costs:**
334-
- `/phase-1-ship` (staging): 2 deployments (Marketing + App)
334+
- `/ship --staging` (staging): 2 deployments (Marketing + App)
335335
- Preview mode: 0 deployments (doesn't count toward quota)
336336
337337
**Rolling window calculation:**
@@ -346,8 +346,8 @@ Remaining: {remaining} / 100
346346
- Reserve staging mode for actual staging updates
347347
348348
**Related commands:**
349-
- `/validate-deploy` - Validate deployment locally (doesn't consume quota)
350-
- `/phase-1-ship` - Deploy to staging (consumes 2 quota)
349+
- `/validate-staging` - Validate deployment locally (doesn't consume quota)
350+
- `/ship --staging` - Deploy to staging (consumes 2 quota)
351351
- `/ship` - Unified deployment orchestrator
352352
- `/debug` - Investigate deployment failures
353353
@@ -358,7 +358,7 @@ Remaining: {remaining} / 100
358358
- **API errors**: Fall back to last known status
359359
360360
**Usage scenarios:**
361-
- **Before `/phase-1-ship`**: Check if enough quota remains
361+
- **Before `/ship --staging`**: Check if enough quota remains
362362
- **Approaching limits**: Plan deployment strategy (preview vs staging)
363363
- **After failures**: Analyze failure rate to identify systematic issues
364364
- **Quota exhausted**: Calculate reset time to plan next deployment window

0 commit comments

Comments
 (0)