---
name: gemini-ship-it
description: "Delegate ship-it (stage, commit, push) to Gemini CLI and report only SUCCESS or ERROR. Use when the user types /gemini-ship-it or says 'gemini ship it'. Manual-only — never auto-invoke."
allowed-tools:
  - Bash
---

# gemini-ship-it

Runs the ship-it workflow via Gemini CLI with suppressed output — reports only a single SUCCESS or ERROR line.

## Trigger

Only activate when the user explicitly types `/gemini-ship-it` or says "gemini ship it". Never auto-invoke.

## Workflow

### 1. Build the ship-it prompt

Construct a one-shot prompt that instructs Gemini to:
- Run `git status --short` to see what's dirty
- Stage all modified/untracked files by explicit path (no `git add -A`)
- Write a single-line commit message (imperative mood, ≤72 chars, no AI attribution)
- Push to every remote via `git remote`

### 2. Execute via Gemini CLI

```bash
RESULT=$(gemini --yolo -m gemini-2.5-flash -o json "
You are running in the BukidBountyApp git repo at $(pwd).

Task: commit and push all currently changed files.
Steps:
1. Run: git status --short
2. Stage each modified file by explicit path (never use git add -A or git add .)
3. Commit with a single imperative-mood subject line (≤72 chars). No body, no trailers, no AI attribution.
4. Run: for remote in \$(git remote); do git push \"\$remote\" \$(git branch --show-current) || git push -u \"\$remote\" \$(git branch --show-current); done

Do this immediately without asking for confirmation.
" 2>&1)
EXIT=$?
```

### 3. Report only SUCCESS or ERROR

Parse the exit code and Gemini JSON output:

```bash
if [ $EXIT -eq 0 ]; then
  # Extract commit SHA from output if possible
  SHA=$(echo "$RESULT" | grep -oP '[0-9a-f]{7,40}' | head -1)
  echo "SUCCESS${SHA:+ — $SHA}"
else
  # Extract first error line
  ERR=$(echo "$RESULT" | grep -i "error\|fatal\|rejected" | head -1)
  echo "ERROR${ERR:+ — $ERR}"
fi
```

Output **nothing else** — no file lists, no diff stats, no Gemini planning text, no explanations.

## Rules

1. Output is exactly one line: `SUCCESS` (optionally `SUCCESS — <sha>`) or `ERROR` (optionally `ERROR — <reason>`).
2. Never print Gemini's raw output or intermediate steps.
3. Never force-push, never skip hooks (`--no-verify`), never touch unrelated files.
4. No AI attribution in the commit message.
5. If Gemini is not installed or not authenticated, output: `ERROR — gemini CLI not available`.
