@@ -20,46 +20,66 @@ Invoke with: `ship`, `ship it`, or `ship this`
20203 . ** Stop on failure** — if any step fails, stop and report. Don't improvise fixes.
21214 . ** Speed** — minimum tool calls, fastest completion.
2222
23+ ## Pre-flight Checks
24+
25+ Before starting, verify the environment:
26+
27+ 1 . ** Is this a git repo?** Run ` git rev-parse --is-inside-work-tree ` . If not → stop and report "Not a git repository."
28+ 2 . ** Is there a remote?** Run ` git remote -v ` . If no remote → stop and report "No git remote configured."
29+ 3 . ** Detect hosting platform** from remote URL:
30+ - ` github.com ` → use GitHub API for PR
31+ - ` gitlab.com ` → use GitLab API for MR
32+ - Other → push only, skip PR creation, report "PR skipped: unsupported hosting platform"
33+
2334## Workflow
2435
2536### 1. Verify State
2637``` bash
38+ # Confirm in a git repo
39+ git rev-parse --is-inside-work-tree || { echo " ❌ Not a git repository." ; exit 1; }
40+
2741# Confirm on a feature branch
2842BRANCH=$( git branch --show-current)
29- if [ " $BRANCH " = " main" ] || [ " $BRANCH " = " master" ]; then
30- echo " ❌ You're on main. Can't ship. Switch to a feature branch first."
43+ DEFAULT=$( git symbolic-ref refs/remotes/origin/HEAD 2> /dev/null | sed ' s@^refs/remotes/origin/@@' || echo " main" )
44+ if [ " $BRANCH " = " $DEFAULT " ]; then
45+ echo " ❌ You're on $DEFAULT . Can't ship. Switch to a feature branch first."
3146 exit 1
3247fi
3348
3449# Confirm no uncommitted changes
35- git status --porcelain
50+ if [ -n " $( git status --porcelain) " ]; then
51+ echo " ❌ Uncommitted changes. Commit or stash first."
52+ exit 1
53+ fi
3654```
3755
38- ### 2. Sync Main
56+ ### 2. Sync with default branch
3957``` bash
4058git fetch origin
41- git rebase origin/main
59+ git rebase origin/$DEFAULT
4260# If conflict → stop and report. Don't resolve automatically.
4361```
4462
4563### 3. Run Tests (if the repo has them)
46- ``` bash
47- # Detect test framework and run
48- # npm test / bun test / pytest / go test / cargo test / etc.
49- # Failure → stop and report
50- ```
64+ Detect and run:
65+ - ` package.json ` with test script → ` npm test ` or ` bun test `
66+ - ` pytest.ini ` / ` pyproject.toml ` / ` setup.py ` → ` pytest `
67+ - ` go.mod ` → ` go test ./... `
68+ - ` Cargo.toml ` → ` cargo test `
69+ - ` Makefile ` with test target → ` make test `
70+ - None found → skip, report "⏭️ no tests detected"
71+
72+ Failure → stop and report.
5173
5274### 4. Push
5375``` bash
5476git push origin HEAD
5577```
5678
57- ### 5. Open PR
58- Create a PR via GitHub API:
59- - Title: concise summary of the changes
60- - Body: auto-generated from commit messages
61- - Labels: detect from context if possible
62- - Base: ` main `
79+ ### 5. Open PR / MR
80+ - ** GitHub** : create PR via API. Title from branch name or first commit. Body from commit log.
81+ - ** GitLab** : create MR via API.
82+ - ** Other** : skip, report push URL only.
6383
6484### 6. Report
6585
@@ -72,11 +92,13 @@ Create a PR via GitHub API:
7292
7393| Step | Status |
7494| ------| --------|
75- | Branch check | ✅ ` {branch} ` |
76- | Sync main | ✅ / ❌ conflict |
95+ | Git repo | ✅ / ❌ not a repo |
96+ | Branch check | ✅ ` {branch} ` / ❌ on default branch |
97+ | Clean state | ✅ / ❌ uncommitted changes |
98+ | Sync | ✅ / ❌ conflict |
7799| Tests | ✅ / ⏭️ no tests / ❌ failed |
78100| Push | ✅ |
79- | PR | ✅ {PR URL} |
101+ | PR/MR | ✅ {URL} / ⏭️ unsupported platform |
80102
81103## Commits ({N})
82104- {commit 1}
@@ -92,3 +114,4 @@ Create a PR via GitHub API:
92114- The entire flow should take no more than 10 tool calls
93115- Don't add changelog/version bump unless the repo has that convention
94116- PR opened = done. Don't wait for review.
117+ - If the platform is unsupported for PR, a successful push is still a successful ship.
0 commit comments