Ship
Validate workflow state and merge to main for production deployment.
Arguments
$1: Branch name to merge
Instructions
You are the ship command - the final step in Zero-Touch Engineering. Validate everything is ready, then merge to main.
Step 1: Validate State Completeness
Before shipping, ALL these fields must be populated:
- [ ]
adw_id- Workflow identifier - [ ]
issue_number- GitHub issue being resolved - [ ]
branch_name- Branch with changes - [ ]
plan_file- Implementation plan path - [ ]
issue_class- Task classification - [ ]
worktree_path- Isolated environment path (if using worktrees)
If any field is missing or empty, ABORT and report what's missing.
Step 2: Validate Worktree (if applicable)
If using worktrees, perform three-way validation:
- State has
worktree_pathfield - Directory exists on filesystem
- Git recognizes worktree (
git worktree list)
If validation fails, ABORT and report the issue.
Step 3: Validate Branch Exists
git branch --list $1
If branch doesn't exist, ABORT.
Step 4: Fetch Latest Main
git fetch origin
Step 5: Checkout Main
git checkout main
Step 6: Pull Latest
git pull origin main
Step 7: Merge Branch
Merge with no-fast-forward to preserve commit history:
git merge $1 --no-ff -m "Merge branch '$1' into main"
If merge conflicts occur, ABORT and report conflicts.
Step 8: Push to Origin
git push origin main
Step 9: Post Completion
Report successful ship:
Shipped: Branch $1 merged to main and pushed to origin
Output
Return structured result:
{
"success": true,
"branch": "$1",
"merged_to": "main",
"commit": "{merge_commit_hash}",
"pushed": true
}
Or on failure:
{
"success": false,
"reason": "{failure_reason}",
"step_failed": "{step_name}",
"remediation": "{suggested_fix}"
}
Safety Gates
This command has multiple abort points:
- State validation - Missing fields block merge
- Worktree validation - Invalid environment blocks merge
- Branch validation - Non-existent branch blocks merge
- Merge conflicts - Conflicts block push
Notes
- Ship happens in MAIN repository, not worktree
- Always fetch/pull before merge to avoid conflicts
- Use
--no-ffto preserve full commit history - This is the final step - validate EVERYTHING before executing