Create a new Graphite stacked diff from current changes
Creates a Graphite stacked diff from current changes with AI-generated conventional commit messages.
/plugin marketplace add DataflightSolutions/claude-plugins/plugin install graphite@dataflight-claude-pluginsCreate a stacked diff (commit + branch) from current changes using the Graphite CLI.
Each diff in a stack should represent exactly one logical change. This makes code review easier and allows changes to land independently. When generating commit messages, think about what single thing this diff accomplishes.
Good examples of atomic changes:
Avoid combining unrelated changes in a single diff.
Execute these steps in order. Stop and report errors if any step fails.
Run both commands to verify the environment is ready:
git rev-parse --is-inside-work-tree
If this fails, tell the user: "Not in a git repository. Navigate to a git repo first."
gt --version
If this fails, tell the user: "Graphite CLI not found. Install with: npm install -g @withgraphite/graphite-cli@latest"
git status --short
If output is empty, tell the user: "No changes to commit." and stop.
git diff --stat
Note the files changed count and line changes for the summary.
Run these commands to understand what changed:
git diff
git diff --staged
Also check recent commit style:
git log -5 --oneline
Based on the diff analysis, write a commit message following these rules:
Subject line (first line):
type(scope): descriptionBody (optional, separated by blank line):
Footer (required):
Co-Authored-By: Claude Code
Example commit message:
fix(auth): handle expired JWT tokens gracefully
Return 401 with clear error message instead of 500 when token
validation fails due to expiration.
Co-Authored-By: Claude Code
Run the gt create command with the generated message:
gt create --all -m "<commit_message>"
The --all flag stages all changes automatically. Pass the full commit message including the footer.
After successful creation, report to the user:
Example output format:
Diff created on branch: feature/auth-token-handling
Commit: fix(auth): handle expired JWT tokens gracefully
Changes: 3 files, +45 -12
If gt create fails:
gt init if the repo hasn't been set up with Graphite/graphite:submit (or /gt:submit) when ready to open a PR for this diff