---
description: Complete sprint and ship to production
allowed-tools: Task, Read, Write, Bash, Grep, Glob
argument-hint: "[message] [--skip-tests] [--no-pr] [--force]"
ship:
  auto_test: true
  auto_pr: true
  commit_prefix: "feat(sprint)"
related_skills:
  - autonomous/project-orchestration
  - omega/omega-sprint
  - devops/workflow-config
related_commands:
  - /sprint:sprint-end
  - /git:ship
  - /git:commit
  - /git:pr
---

# Sprint Ship: $ARGUMENTS

Complete the current sprint and ship all changes to production in a single workflow.

## Overview

This command combines sprint completion with git operations to streamline the release process:

1. **Validate** - Check sprint status and task completion
2. **Test** - Run tests to ensure quality
3. **End Sprint** - Generate retrospective and archive
4. **Commit** - Stage and commit all changes
5. **Push** - Push to remote repository
6. **PR/Deploy** - Create PR or trigger CI/CD

## Options

| Option | Description | Default |
|--------|-------------|---------|
| `message` | Commit message (uses sprint name if not provided) | Sprint name |
| `--skip-tests` | Skip running tests before ship | `false` |
| `--no-pr` | Push directly without creating PR | `false` |
| `--force` | Force ship even with incomplete tasks | `false` |

## Workflow Diagram

```
/sprint:ship "Sprint 1 - Auth"
              │
              ▼
┌─────────────────────────────────────────────────────────────┐
│  PHASE 1: VALIDATION                                         │
├─────────────────────────────────────────────────────────────┤
│  ✓ Check current sprint exists                               │
│  ✓ Verify sprint is active/in_progress                       │
│  ✓ Check task completion (warn if incomplete)                │
│  ✓ Check for uncommitted changes                             │
└─────────────────────────────────────────────────────────────┘
              │
              ▼
┌─────────────────────────────────────────────────────────────┐
│  PHASE 2: TESTING (unless --skip-tests)                      │
├─────────────────────────────────────────────────────────────┤
│  ► Run: npm test (or configured test command)                │
│  ► Check coverage gates from workflow.yaml                   │
│  ► FAIL if tests don't pass                                  │
└─────────────────────────────────────────────────────────────┘
              │
              ▼
┌─────────────────────────────────────────────────────────────┐
│  PHASE 3: SPRINT END                                         │
├─────────────────────────────────────────────────────────────┤
│  ► Set status: completed                                     │
│  ► Calculate metrics (completed tasks, velocity)             │
│  ► Generate retrospective                                    │
│  ► Archive to .omgkit/sprints/archive/                       │
└─────────────────────────────────────────────────────────────┘
              │
              ▼
┌─────────────────────────────────────────────────────────────┐
│  PHASE 4: GIT OPERATIONS                                     │
├─────────────────────────────────────────────────────────────┤
│  ► git add .                                                 │
│  ► git commit -m "feat(sprint): [message]"                   │
│     └── Include retrospective summary in body                │
│  ► git push origin [branch]                                  │
└─────────────────────────────────────────────────────────────┘
              │
              ▼
┌─────────────────────────────────────────────────────────────┐
│  PHASE 5: PR/CI (unless --no-pr)                             │
├─────────────────────────────────────────────────────────────┤
│  ► Create PR with sprint summary                             │
│  ► Add labels: sprint-complete                               │
│  ► Link CI/CD status                                         │
└─────────────────────────────────────────────────────────────┘
              │
              ▼
┌─────────────────────────────────────────────────────────────┐
│  PHASE 6: REPORT                                             │
├─────────────────────────────────────────────────────────────┤
│  📊 Sprint Summary                                           │
│  📝 Commit: abc1234                                          │
│  🔗 PR: https://github.com/org/repo/pull/123                 │
│  🚀 CI/CD: Running...                                        │
└─────────────────────────────────────────────────────────────┘
```

## Configuration

Configure ship behavior in `.omgkit/workflow.yaml`:

```yaml
ship:
  # Run tests before shipping
  auto_test: true

  # Test command to run
  test_command: "npm test"

  # Create PR instead of direct push
  create_pr: true

  # PR settings
  pr:
    draft: false
    reviewers: []
    labels: ["sprint-complete"]

  # Commit message format
  commit:
    prefix: "feat(sprint)"
    include_retrospective: true
    include_metrics: true

  # Force ship even with incomplete tasks
  allow_incomplete: false

  # Archive sprint after ship
  archive_sprint: true
```

## Examples

### Basic Usage

```bash
# Ship with auto-generated message from sprint name
/sprint:ship

# Ship with custom message
/sprint:ship "Sprint 1 - User Authentication Complete"
```

### With Options

```bash
# Skip tests (use with caution)
/sprint:ship "Hotfix Sprint" --skip-tests

# Push directly without PR (for trunk-based development)
/sprint:ship "Sprint 1" --no-pr

# Force ship even with incomplete tasks
/sprint:ship "MVP Sprint" --force

# Combine options
/sprint:ship "Quick Fix" --skip-tests --no-pr
```

### Full Workflow Example

```bash
# 1. Start sprint
/sprint:sprint-new "Auth Feature" --ref=.omgkit/artifacts/prd-auth.md

# 2. Work on sprint
/sprint:team-run
/dev:feature "implement login"
/dev:feature "implement signup"

# 3. Ship when done
/sprint:ship "Sprint 1 - Auth Feature Complete"
```

## Output

### Sprint Summary

```markdown
## Sprint Shipped: Auth Feature

### Metrics
- Completed: 8/10 tasks (80%)
- Velocity: 2.5 tasks/day
- Duration: 4 days

### Retrospective
**What Went Well:**
- Fast iteration on login flow
- Good test coverage achieved

**What Could Improve:**
- Better estimation for OAuth integration

### Git
- Commit: `abc1234`
- Branch: `main`
- PR: #123

### CI/CD
- Status: Running
- URL: https://github.com/org/repo/actions/runs/123
```

## Error Handling

### No Active Sprint

```
❌ Error: No active sprint found
   Run /sprint:sprint-new to create a sprint first
```

### Tests Failed

```
❌ Error: Tests failed (12 failing)
   Fix tests before shipping or use --skip-tests (not recommended)
```

### Incomplete Tasks

```
⚠️ Warning: 2 tasks incomplete
   - [ ] Implement password reset
   - [ ] Add email verification

   Use --force to ship anyway, or complete tasks first
```

## Best Practices

1. **Always run tests** - Don't use `--skip-tests` in production
2. **Complete tasks** - Ship complete sprints, not partial work
3. **Use meaningful messages** - Commit messages should describe the sprint's value
4. **Review before ship** - Run `/dev:review` before `/sprint:ship`
5. **Configure workflow.yaml** - Set team preferences for ship behavior

## Comparison with Other Commands

| Command | Purpose | When to Use |
|---------|---------|-------------|
| `/sprint:sprint-end` | End sprint only | When not ready to commit |
| `/git:ship` | Commit and PR | For non-sprint commits |
| `/git:commit` | Commit only | For WIP commits |
| `/sprint:ship` | Full workflow | Sprint completion |

## Related Commands

- `/sprint:sprint-new` - Create new sprint
- `/sprint:sprint-end` - End sprint (without shipping)
- `/sprint:team-run` - Execute sprint tasks
- `/git:ship` - Ship code (standalone)
- `/git:pr` - Create pull request
