| diataxis_type | how-to |
|---|---|
| diataxis_goal | Configure the refactor plugin to automatically commit, create PRs, and publish reports |
This guide shows you how to set up automatic commits, pull requests, and report publishing so the refactor plugin handles your git workflow end-to-end.
- Refactor plugin installed and working (see Tutorial)
- Git repository with a remote configured
- GitHub CLI (
gh) installed and authenticated (for PR and publishing features)
Edit .claude/refactor.config.json and set commitStrategy:
Commit after each iteration — useful for tracking incremental progress:
{
"postRefactor": {
"commitStrategy": "per-iteration"
}
}Each iteration produces a commit: refactor(iteration 1/3): {summary}
Single commit when done — cleaner git history:
{
"postRefactor": {
"commitStrategy": "single-final"
}
}One commit at the end: refactor: {scope} — clean code 8/10, architecture 9/10
When using --focus, commit messages include the focus area: refactor(security): {scope} — security posture 8/10
Set createPR to true. Use prDraft to control whether the PR opens as a draft:
{
"postRefactor": {
"commitStrategy": "single-final",
"createPR": true,
"prDraft": true
}
}If you are on main, master, or develop, the plugin creates a refactor/{scope}-{date} branch automatically.
To publish the quality report as a GitHub issue:
{
"postRefactor": {
"publishReport": "github-issue"
}
}To publish as a GitHub Discussion:
{
"postRefactor": {
"publishReport": "github-discussion",
"discussionCategory": "Engineering"
}
}To publish to a different repository (e.g., a central tracking repo):
{
"postRefactor": {
"publishReport": "github-issue",
"reportRepository": "myorg/engineering-reports"
}
}/refactor src/The plugin will commit, push, create the PR, and publish the report according to your configuration.
After the refactor completes:
- Check
git logto verify commits were created with the expected format - Check your GitHub repository for the PR (if enabled)
- Check GitHub Issues or Discussions for the published report (if enabled)
If commits fail, ensure your working directory is a git repository with at least one prior commit. If PR creation fails, verify gh auth status shows you are authenticated. If report publishing fails, verify the target repository exists and you have write access.
All GitHub operations are non-blocking — failures log a warning but do not stop the refactor.
- Configuration Reference — full schema and field details
- Tutorial: Your First Refactor — getting started