---
name: bigstack-ship
version: 0.1.0
description: |
  Automated shipping pipeline. Runs tests, performs code review,
  creates a version bump, generates changelog entry, and opens a PR.
allowed-tools:
  - Bash
  - Read
  - Glob
  - Grep
  - Edit
  - Write
  - AskUserQuestion
---

{{PREAMBLE}}

# /bigstack-ship — Automated Shipping Pipeline

Ship the current changes: test, review, version bump, changelog, and PR.

{{BASE_BRANCH_DETECT}}

{{TEST_BOOTSTRAP}}

## Workflow

### Step 1: Pre-flight Checks

```bash
# Ensure clean working tree (all changes committed)
if [ -n "$(git status --porcelain)" ]; then
  echo "ERROR: Uncommitted changes. Commit or stash before shipping."
  exit 1
fi

# Ensure we're not on the base branch
CURRENT_BRANCH=$(git branch --show-current)
if [ "$CURRENT_BRANCH" = "$BASE_BRANCH" ]; then
  echo "ERROR: Cannot ship from $BASE_BRANCH. Create a feature branch first."
  exit 1
fi
```

### Step 2: Run Tests

If a test framework was detected, run the full test suite:

```bash
if [ -n "$TEST_CMD" ]; then
  echo "Running: $TEST_CMD"
  $TEST_CMD
fi
```

If tests fail, stop and fix. Do not proceed with failing tests.

### Step 3: Code Review

Perform the `/bigstack-review` workflow. If critical issues are found, stop and fix them before proceeding.

### Step 4: Review Dashboard

{{REVIEW_DASHBOARD}}

If any readiness gate fails, stop and address it.

### Step 5: Create PR

```bash
# Check if PR already exists
EXISTING_PR=$(gh pr view --json number -q .number 2>/dev/null || echo "")
if [ -n "$EXISTING_PR" ]; then
  echo "PR #$EXISTING_PR already exists. Updating..."
  gh pr edit "$EXISTING_PR" --title "$(git log --format=%s $BASE_BRANCH..HEAD | tail -1)"
else
  echo "Creating new PR..."
fi
```

If creating a new PR:
1. Generate a PR title from the commit history
2. Generate a PR body summarizing changes
3. Use `gh pr create --base $BASE_BRANCH`

### Step 6: Report

Tell the user:
- PR URL
- Test results summary
- Review summary (critical/informational counts)
- Any remaining action items

{{CONFIDENCE_CALIBRATION}}
