Commit changes and create or update a pull request following project standards. Use when the user wants to commit work, create a PR, update an existing PR, or use the /pr command.
git branch --show-currentgit status --shortgh pr view --json number,title,url 2>/dev/null || echo "No PR exists"git log main..HEAD --oneline 2>/dev/null || git log -3 --onelineIf not on main and a PR already exists for the current branch, check if it has been merged:
gh pr view --json state --jq '.state'
If the state is MERGED:
git stash --include-untracked (skip if working tree is clean)git checkout maingit pullgit stash popgit diff --cached --stat):
git add anything else)If no PR exists: Create a new PR following the standards below.
If a PR already exists (and is OPEN):
Show the user the existing PR (number, title, URL) and ask for confirmation using AskUserQuestion:
If the user chose "Update existing PR":
a. Read the existing PR:
gh pr view --json title,body,labels,number
gh pr diff --stat
Read specific files directly rather than dumping the full diff.
b. Review whether the PR content accurately reflects the current diff:
c. Update if needed:
gh pr edit <number> --title "new title" --body "new body"
d. Push any new commits (regular push, not force push)
If the user chose "Create new branch & PR":
a. Create a new branch from the current HEAD with a descriptive name based on the user's notes or the staged changes b. Push the new branch to the remote c. Create a new PR following the standards below
Search for related issues and link them using Closes #123 or Relates to #123.
Committing automatically runs the linter. Fix any lint/type errors unless they require meaningful code changes—in that case, notify the user:
I can't create/update this PR because [reason]. Would you like me to [suggestion]?
Never force commit or force push.
Use semantic PR titles (Conventional Commits):
<type>(<scope>): <description>
feat - New featurefix - Bug fixdocs - Documentation onlyrefactor - Code change that neither fixes a bug nor adds a featureperf - Performance improvementtest - Adding or fixing testschore - Maintenance tasksA noun describing the affected area: fix(editor):, feat(sync):, docs(examples):
feat(editor): add snap threshold configuration optionfix(arrows): correct binding behavior with rotated shapesdocs: update sync documentation<description paragraph>
### Change type
- [x] `bugfix` | `improvement` | `feature` | `api` | `other`
### Test plan
1. Step to test...
- [ ] Unit tests
- [ ] End to end tests
### Release notes
- Brief description of changes for users
Start with: "In order to X, this PR does Y."
[x]Include when changes affect api-report.md:
### API changes
- Added `Editor.newMethod()` for X
- Breaking! Removed `Editor.oldMethod()`