commit aab61a98f390b207afa688f924015b766e9e45e6 Author: Zhongwei Li Date: Sat Nov 29 18:13:54 2025 +0800 Initial commit diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json new file mode 100644 index 0000000..15f43fe --- /dev/null +++ b/.claude-plugin/plugin.json @@ -0,0 +1,12 @@ +{ + "name": "pull-request-generator", + "description": "Provides comprehensive PR creation guidance with GitHub CLI, enforcing title conventions, following template structure, and offering concrete command examples with best practices.", + "version": "1.0.0", + "author": { + "name": "ClaudeForge Community", + "url": "https://github.com/claudeforge/marketplace" + }, + "commands": [ + "./commands" + ] +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..5bd4996 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# pull-request-generator + +Provides comprehensive PR creation guidance with GitHub CLI, enforcing title conventions, following template structure, and offering concrete command examples with best practices. diff --git a/commands/create-pull-request.md b/commands/create-pull-request.md new file mode 100644 index 0000000..e609f90 --- /dev/null +++ b/commands/create-pull-request.md @@ -0,0 +1,287 @@ +--- +description: Generate pull requests with proper title formatting, structured descriptions, and GitHub CLI integration +version: 1.0.0 +--- + +# Pull Request Generator + +Generate well-formatted pull requests using GitHub CLI with consistent titles, structured descriptions, and proper templates. + +## What It Does + +- Creates pull requests using GitHub CLI +- Formats PR titles with conventional commit prefixes +- Generates structured PR descriptions +- Links related issues automatically +- Sets appropriate labels and reviewers + +## How to Use + +Run after committing and pushing your changes: + +```bash +/create-pull-request +``` + +The command will guide you through PR creation. + +## PR Title Format + +Use conventional commit format with optional emoji: + +``` +(): + +Examples: +feat(auth): add OAuth2 login support +fix(api): resolve rate limiting issue +docs(readme): update installation guide +``` + +## Common Types + +- `feat`: New feature +- `fix`: Bug fix +- `docs`: Documentation changes +- `refactor`: Code restructuring +- `test`: Test additions or modifications +- `chore`: Build/config changes + +## PR Description Template + +```markdown +## Summary +Brief 1-2 sentence overview of changes + +## Changes Made +- Change 1 +- Change 2 +- Change 3 + +## Related Issues +Closes #123 +Relates to #456 + +## Testing +- [ ] Unit tests added/updated +- [ ] Integration tests passing +- [ ] Manual testing completed + +## Screenshots +(if UI changes) +``` + +## GitHub CLI Commands + +**Create PR** +```bash +gh pr create \ + --title "feat(search): add fuzzy search" \ + --body "$(cat <<'EOF' +## Summary +Implement fuzzy search for user queries + +## Changes Made +- Added fuzzysearch library +- Updated search component +- Added tests + +## Related Issues +Closes #234 +EOF +)" +``` + +**Create Draft PR** +```bash +gh pr create --draft --title "WIP: Feature in progress" +``` + +**Set Base Branch** +```bash +gh pr create --base develop --head feature/new-feature +``` + +**Add Reviewers and Labels** +```bash +gh pr create \ + --reviewer alice,bob \ + --label "enhancement,needs-review" \ + --assignee charlie +``` + +## Complete Example + +**Scenario**: Adding export feature + +**Step 1: Commit and Push** +```bash +git add . +git commit -m "feat(export): add CSV export functionality" +git push -u origin feature/csv-export +``` + +**Step 2: Create PR** +```bash +gh pr create \ + --title "feat(export): add CSV export functionality" \ + --body "$(cat <<'EOF' +## Summary +Add ability to export data as CSV files + +## Changes Made +- Created ExportService class +- Added CSV conversion logic +- Added download button to UI +- Wrote unit tests + +## Related Issues +Closes #189 + +## Testing +- [x] Unit tests pass +- [x] Tested with sample data +- [x] Verified file downloads correctly +EOF +)" +``` + +## Use Cases + +- **Feature Development**: Submit new features for review +- **Bug Fixes**: Create PRs for bug resolutions +- **Documentation**: Update docs with clear descriptions +- **Refactoring**: Explain code improvements +- **Dependencies**: Update package versions with changelogs + +## Best Practices + +- **Clear Titles**: Make purpose immediately obvious +- **Detailed Descriptions**: Explain what, why, and how +- **Link Issues**: Reference related issue numbers +- **Test Status**: Document what testing was done +- **Screenshots**: Include for UI changes +- **Breaking Changes**: Clearly mark any breaking changes +- **Small PRs**: Keep focused on one concern + +## PR Types + +**Feature PR** +``` +feat(payments): add Stripe integration + +## Summary +Integrate Stripe for payment processing + +## Changes Made +- Added Stripe SDK +- Created payment service +- Added checkout flow +``` + +**Bug Fix PR** +``` +fix(validation): correct email regex + +## Summary +Fix email validation rejecting valid addresses + +## Changes Made +- Updated regex to allow + signs +- Added test cases +- Fixed edge case handling +``` + +**Documentation PR** +``` +docs(api): update endpoint documentation + +## Summary +Document all REST API endpoints + +## Changes Made +- Added endpoint descriptions +- Included request/response examples +- Updated authentication section +``` + +## Advanced Options + +**Set Milestone** +```bash +gh pr create --milestone "v2.0" +``` + +**Add Projects** +```bash +gh pr create --project "Development Sprint" +``` + +**Template from File** +```bash +gh pr create --body-file pr-template.md +``` + +**Web UI** +```bash +gh pr create --web +``` + +## Checklist for PR + +Before creating, verify: +- [ ] Code is committed and pushed +- [ ] All tests pass locally +- [ ] PR title follows format +- [ ] Description is complete +- [ ] Related issues linked +- [ ] Reviewers assigned +- [ ] Appropriate labels added + +## Troubleshooting + +**Not Authenticated**: Run `gh auth login` + +**No Upstream Branch**: Push with `git push -u origin branch-name` + +**PR Already Exists**: Check existing PRs with `gh pr list` + +**Wrong Base Branch**: Specify with `--base main` + +## After Creating PR + +**View PR** +```bash +gh pr view 123 +``` + +**Check Status** +```bash +gh pr checks +``` + +**Edit PR** +```bash +gh pr edit 123 --title "New title" +``` + +**Add Comment** +```bash +gh pr comment 123 --body "Additional info" +``` + +**Mark Ready** +```bash +gh pr ready 123 +``` + +## Quality Standards + +A good PR includes: +- Descriptive, formatted title +- Clear summary of changes +- Linked related issues +- Testing information +- Appropriate reviewers +- Relevant labels +- Complete description following template diff --git a/plugin.lock.json b/plugin.lock.json new file mode 100644 index 0000000..e3c35b3 --- /dev/null +++ b/plugin.lock.json @@ -0,0 +1,45 @@ +{ + "$schema": "internal://schemas/plugin.lock.v1.json", + "pluginId": "gh:claudeforge/marketplace:plugins/commands/pull-request-generator", + "normalized": { + "repo": null, + "ref": "refs/tags/v20251128.0", + "commit": "883cf1f173f1b6bf3b0a6585cf580b500d3a0f75", + "treeHash": "aff4a6651c52ea61780ca69ac72aaad024df9b0dcd70b133b59df61ed3379f0f", + "generatedAt": "2025-11-28T10:15:35.903063Z", + "toolVersion": "publish_plugins.py@0.2.0" + }, + "origin": { + "remote": "git@github.com:zhongweili/42plugin-data.git", + "branch": "master", + "commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390", + "repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data" + }, + "manifest": { + "name": "pull-request-generator", + "description": "Provides comprehensive PR creation guidance with GitHub CLI, enforcing title conventions, following template structure, and offering concrete command examples with best practices.", + "version": "1.0.0" + }, + "content": { + "files": [ + { + "path": "README.md", + "sha256": "aefe83069012b424c898efa1bef9f33d53993725c7df637d2675e7d95e75cc36" + }, + { + "path": ".claude-plugin/plugin.json", + "sha256": "5d641e5fff0de20de6418c44ad6a62fe60f20e14632f4033c10f1f4609501fd7" + }, + { + "path": "commands/create-pull-request.md", + "sha256": "178b479b18a116f79bdbd546bdd6bb8728b029330ef76af7f0a69e8872bdda2c" + } + ], + "dirSha256": "aff4a6651c52ea61780ca69ac72aaad024df9b0dcd70b133b59df61ed3379f0f" + }, + "security": { + "scannedAt": null, + "scannerVersion": null, + "flags": [] + } +} \ No newline at end of file