Squash commits and create a pull request after feature implementation is complete. Only invoke when user explicitly requests to wrap up, create a PR, prepare for review, or finish the feature.
Prepare completed work for code review: squash commits, generate PR description, create pull request.
Actions:
git statusgit rev-parse --abbrev-ref HEAD → store as CURRENT_BRANCHgit show-ref --verify --quiet refs/heads/main && echo "main" || \
git show-ref --verify --quiet refs/heads/master && echo "master" || \
echo "unknown"
Store as MAIN_BRANCH. If "unknown", ask user: "What is your main branch name?"CURRENT_BRANCH == MAIN_BRANCH, error and exit.specimin/plans/{CURRENT_BRANCH}/ exists.specimin/plans/{CURRENT_BRANCH}/spec.md.specimin/plans/{CURRENT_BRANCH}/plan.md.specimin/plans/{CURRENT_BRANCH}/implementation.mdContext Extraction Goals (from spec/plan):
Error Handling:
Warning: Uncommitted changes detected. Commit or stash before wrapping up. → ExitError: Cannot wrap up main branch. Switch to feature branch first. → ExitError: Specimin not initialized. Run /init first. → ExitError: No commits to squash. Branch up to date with {MAIN_BRANCH}. → Exitgh not installed: Error: GitHub CLI not installed. Install: https://cli.github.com/ → ExitError: Not authenticated with GitHub CLI. Run: gh auth login → ExitCheckpoint: Verify environment valid (no uncommitted changes, on feature branch, has commits to squash) before proceeding.
Actions:
Detect test framework and run appropriate test command:
python3 -m pytest or pytestnpm test or yarn testbundle exec rspec or rake testgo test ./...cargo testmvn test or gradle testMakefile with test target, or ask userRun tests and capture output
Error Handling:
✗ Tests failed. Fix failing tests before wrapping up.
{test failure summary}
Run tests again after fixes and retry wrap.
⚠ No tests detected. Consider adding tests before creating PR.
Proceed anyway? (yes/no)
Checkpoint: Verify all tests pass before proceeding to review changes.
Show user what will be squashed:
Commit history:
git log {MAIN_BRANCH}..HEAD --oneline
Change summary:
git diff {MAIN_BRANCH}...HEAD --stat
Files changed:
git diff {MAIN_BRANCH}...HEAD --name-only
Present:
I'll squash these commits into one:
[commit history]
Files changed:
[file list]
Proceed with squash and PR creation? (yes/no)
Wait for confirmation. If "no", exit gracefully.
Once confirmed:
Generate commit message:
feat:, fix:, refactor:, docs:Perform squash:
git reset --soft {MAIN_BRANCH}
git commit -m "{COMMIT_MESSAGE}"
CRITICAL: No --author, no Co-Authored-By:, no co-authoring metadata. User authorship only.
Verify squash:
git log --oneline -1
Confirm only one commit since main branch.
Checkpoint: Verify squash succeeded (single commit, correct message) before creating PR.
Generate PR title:
Generate PR description (use template below with extracted context):
## Summary
{1-2 sentence feature objective from spec.md}
## Changes
{Bulleted list of high-level changes from plan.md phases or implementation.md completed tasks}
## Testing
{Testing approach from plan.md, or manual test scenarios}
## Acceptance Criteria
{Criteria from spec.md}
Create PR:
gh pr create --title "{PR_TITLE}" --body "$(cat <<'EOF'
{PR_DESCRIPTION}
EOF
)"
Display result:
✓ Squashed {N} commits into 1 commit
✓ Created pull request: {PR_URL}
Your feature is ready for review!
No upstream remote: gh pr create will prompt to push if needed.
Spec objective: "Add user profile management allowing users to update their name and email"
Commit message: