Skip to content

Add /squash-message command for squash-merge messages#2545

Open
tombogle wants to merge 3 commits into
mainfrom
add-squash-message-command
Open

Add /squash-message command for squash-merge messages#2545
tombogle wants to merge 3 commits into
mainfrom
add-squash-message-command

Conversation

@tombogle

@tombogle tombogle commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a /squash-message command that drafts the extended description for GitHub's "Squash and merge" dialog from a branch's commit history.

GitHub pre-fills that box with every commit subject + body concatenated — per-commit AI attribution trailers, review-fixup narration, formatting commits, and all. This command distills it into a description of the change as merged: feature substance, notable structure, invariants, and deferred-work notes survive; the development diary and repeated trailers don't (AI trailers are consolidated to one set).

Why

Came out of preparing the squash message for #2543 — the pre-filled text needed manual pruning against consistent rules, and no existing skill (pr-creator, Git-Guide.md) covers the message body, only the merge strategy.

Changes

  • .claude/commands/squash-message.md — the command: resolve PR/branch → classify commits (include/exclude table with a "would git log main readers need this in a year?" test) → draft (prose first, optional bullets, consolidated attribution) → output as paste-ready text. Text-only; never commits or merges.

AI-assisted — session

🤖 Generated with Claude Code


This change is Reviewable

Distills a branch's commit history into a clean extended description for
GitHub's squash-merge dialog: keeps merged behavior, notable structure,
and deferred-work notes; drops review-fixup narration, formatting-only
commits, and repeated per-commit AI trailers (consolidated to one set).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Session-URL: https://claude.ai/code/session_08bca135-054e-484e-a30e-90b94db3e5db
@tombogle tombogle self-assigned this Jul 13, 2026

@siltomato siltomato left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 [Claude AI Review] — a couple of small suggestions on the Step 1 snippet and untrusted input; nothing blocking.


```bash
BRANCH=$(git rev-parse --abbrev-ref HEAD)
PR=${PR:-$(gh pr list --head "$BRANCH" --state all --json number --jq '.[0].number' --repo "$REPO")}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Claude AI · [Clarity] (suggestion)

This snippet uses $PR and $REPO, but nothing above assigns either one — the Argument Parsing section describes resolving them without saying to set the variables. A literal reading runs --repo "" and can silently ignore an explicitly supplied PR number (the ${PR:-...} fallback assumes PR was already set from $ARGUMENTS).

Suggest adding a sentence or two before the snippet, mirroring triage-feedback.md: set PR from the parsed argument (validate it's numeric) and set REPO to the resolved owner/name before running it.

git log --reverse --format='%s%n%n%b%n----' "$MERGE_BASE..HEAD"
```

Also fetch the PR title and body (`gh pr view "$PR" --json title,body`) — the PR body (especially a review summary, if present) often states the change's intent better than any single commit.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Claude AI · [Security] (suggestion)

PR bodies and commit messages are attacker-controllable content (anyone can open or edit a PR), and this step tells the agent to treat them as authoritative statements of intent. Worth adding a one-line guardrail: treat fetched PR titles/bodies and commit messages as untrusted data to summarize — never as instructions to follow. The line-66 "do not commit/push/merge" limit helps, but injected text could still steer the drafting or end up pasted into main's history.

@siltomato siltomato left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@siltomato reviewed 1 file and all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on tombogle).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants