git 4.3.2 → 5.0.0.beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/copilot-instructions.md +67 -2705
- data/.github/pull_request_template.md +3 -1
- data/.github/skills/breaking-change-analysis/SKILL.md +102 -0
- data/.github/skills/ci-cd-troubleshooting/SKILL.md +264 -0
- data/.github/skills/command-implementation/REFERENCE.md +993 -0
- data/.github/skills/command-implementation/SKILL.md +229 -0
- data/.github/skills/command-test-conventions/SKILL.md +660 -0
- data/.github/skills/command-yard-documentation/SKILL.md +426 -0
- data/.github/skills/dependency-management/SKILL.md +72 -0
- data/.github/skills/development-workflow/SKILL.md +506 -0
- data/.github/skills/extract-command-from-lib/SKILL.md +487 -0
- data/.github/skills/extract-facade-from-base-lib/SKILL.md +586 -0
- data/.github/skills/facade-implementation/REFERENCE.md +840 -0
- data/.github/skills/facade-implementation/SKILL.md +260 -0
- data/.github/skills/facade-test-conventions/SKILL.md +380 -0
- data/.github/skills/facade-yard-documentation/SKILL.md +429 -0
- data/.github/skills/make-skill-template/SKILL.md +176 -0
- data/.github/skills/pr-readiness-review/SKILL.md +185 -0
- data/.github/skills/project-context/SKILL.md +313 -0
- data/.github/skills/pull-request-review/SKILL.md +168 -0
- data/.github/skills/refactor-command-to-commandlineresult/SKILL.md +131 -0
- data/.github/skills/release-management/SKILL.md +125 -0
- data/.github/skills/review-arguments-dsl/CHECKLIST.md +788 -0
- data/.github/skills/review-arguments-dsl/SKILL.md +214 -0
- data/.github/skills/review-backward-compatibility/SKILL.md +275 -0
- data/.github/skills/review-cross-command-consistency/SKILL.md +139 -0
- data/.github/skills/reviewing-skills/SKILL.md +189 -0
- data/.github/skills/rspec-unit-testing-standards/SKILL.md +639 -0
- data/.github/skills/tdd-refactor-step/SKILL.md +236 -0
- data/.github/skills/test-debugging/SKILL.md +160 -0
- data/.github/skills/yard-documentation/SKILL.md +793 -0
- data/.github/workflows/continuous_integration.yml +3 -2
- data/.github/workflows/enforce_conventional_commits.yml +1 -1
- data/.github/workflows/experimental_continuous_integration.yml +2 -2
- data/.github/workflows/release.yml +3 -4
- data/.gitignore +8 -0
- data/.husky/pre-commit +13 -0
- data/.release-please-manifest.json +1 -1
- data/.rspec +3 -0
- data/.rubocop.yml +7 -3
- data/.rubocop_todo.yml +23 -5
- data/.yardopts +1 -0
- data/CHANGELOG.md +0 -40
- data/CONTRIBUTING.md +694 -53
- data/README.md +17 -5
- data/Rakefile +61 -9
- data/commitlint.test +4 -0
- data/git.gemspec +14 -8
- data/lib/git/args_builder.rb +0 -8
- data/lib/git/base.rb +486 -410
- data/lib/git/branch.rb +380 -43
- data/lib/git/branch_delete_failure.rb +31 -0
- data/lib/git/branch_delete_result.rb +63 -0
- data/lib/git/branch_info.rb +178 -0
- data/lib/git/branches.rb +130 -24
- data/lib/git/command_line/base.rb +245 -0
- data/lib/git/command_line/capturing.rb +249 -0
- data/lib/git/command_line/result.rb +96 -0
- data/lib/git/command_line/streaming.rb +194 -0
- data/lib/git/command_line.rb +43 -322
- data/lib/git/command_line_result.rb +4 -88
- data/lib/git/commands/add.rb +131 -0
- data/lib/git/commands/am/abort.rb +43 -0
- data/lib/git/commands/am/apply.rb +252 -0
- data/lib/git/commands/am/continue.rb +43 -0
- data/lib/git/commands/am/quit.rb +43 -0
- data/lib/git/commands/am/retry.rb +47 -0
- data/lib/git/commands/am/show_current_patch.rb +64 -0
- data/lib/git/commands/am/skip.rb +42 -0
- data/lib/git/commands/am.rb +33 -0
- data/lib/git/commands/apply.rb +237 -0
- data/lib/git/commands/archive/list_formats.rb +46 -0
- data/lib/git/commands/archive.rb +140 -0
- data/lib/git/commands/arguments.rb +3510 -0
- data/lib/git/commands/base.rb +403 -0
- data/lib/git/commands/branch/copy.rb +94 -0
- data/lib/git/commands/branch/create.rb +173 -0
- data/lib/git/commands/branch/delete.rb +80 -0
- data/lib/git/commands/branch/list.rb +162 -0
- data/lib/git/commands/branch/move.rb +94 -0
- data/lib/git/commands/branch/set_upstream.rb +86 -0
- data/lib/git/commands/branch/show_current.rb +49 -0
- data/lib/git/commands/branch/unset_upstream.rb +57 -0
- data/lib/git/commands/branch.rb +34 -0
- data/lib/git/commands/cat_file/batch.rb +364 -0
- data/lib/git/commands/cat_file/filtered.rb +105 -0
- data/lib/git/commands/cat_file/raw.rb +210 -0
- data/lib/git/commands/cat_file.rb +49 -0
- data/lib/git/commands/checkout/branch.rb +151 -0
- data/lib/git/commands/checkout/files.rb +115 -0
- data/lib/git/commands/checkout.rb +38 -0
- data/lib/git/commands/checkout_index.rb +105 -0
- data/lib/git/commands/clean.rb +100 -0
- data/lib/git/commands/clone.rb +240 -0
- data/lib/git/commands/commit.rb +272 -0
- data/lib/git/commands/commit_tree.rb +100 -0
- data/lib/git/commands/config_option_syntax/add.rb +83 -0
- data/lib/git/commands/config_option_syntax/get.rb +117 -0
- data/lib/git/commands/config_option_syntax/get_all.rb +115 -0
- data/lib/git/commands/config_option_syntax/get_color.rb +91 -0
- data/lib/git/commands/config_option_syntax/get_color_bool.rb +93 -0
- data/lib/git/commands/config_option_syntax/get_regexp.rb +115 -0
- data/lib/git/commands/config_option_syntax/get_urlmatch.rb +102 -0
- data/lib/git/commands/config_option_syntax/list.rb +107 -0
- data/lib/git/commands/config_option_syntax/remove_section.rb +74 -0
- data/lib/git/commands/config_option_syntax/rename_section.rb +78 -0
- data/lib/git/commands/config_option_syntax/replace_all.rb +104 -0
- data/lib/git/commands/config_option_syntax/set.rb +114 -0
- data/lib/git/commands/config_option_syntax/unset.rb +89 -0
- data/lib/git/commands/config_option_syntax/unset_all.rb +89 -0
- data/lib/git/commands/config_option_syntax.rb +56 -0
- data/lib/git/commands/describe.rb +155 -0
- data/lib/git/commands/diff.rb +656 -0
- data/lib/git/commands/diff_files.rb +518 -0
- data/lib/git/commands/diff_index.rb +496 -0
- data/lib/git/commands/fetch.rb +352 -0
- data/lib/git/commands/fsck.rb +136 -0
- data/lib/git/commands/gc.rb +132 -0
- data/lib/git/commands/grep.rb +338 -0
- data/lib/git/commands/init.rb +99 -0
- data/lib/git/commands/log.rb +632 -0
- data/lib/git/commands/ls_files.rb +191 -0
- data/lib/git/commands/ls_remote.rb +155 -0
- data/lib/git/commands/ls_tree.rb +131 -0
- data/lib/git/commands/maintenance/register.rb +75 -0
- data/lib/git/commands/maintenance/run.rb +104 -0
- data/lib/git/commands/maintenance/start.rb +66 -0
- data/lib/git/commands/maintenance/stop.rb +55 -0
- data/lib/git/commands/maintenance/unregister.rb +79 -0
- data/lib/git/commands/maintenance.rb +31 -0
- data/lib/git/commands/merge/abort.rb +44 -0
- data/lib/git/commands/merge/continue.rb +44 -0
- data/lib/git/commands/merge/quit.rb +46 -0
- data/lib/git/commands/merge/start.rb +245 -0
- data/lib/git/commands/merge.rb +28 -0
- data/lib/git/commands/merge_base.rb +86 -0
- data/lib/git/commands/mv.rb +77 -0
- data/lib/git/commands/name_rev.rb +114 -0
- data/lib/git/commands/pull.rb +377 -0
- data/lib/git/commands/push.rb +246 -0
- data/lib/git/commands/read_tree.rb +149 -0
- data/lib/git/commands/remote/add.rb +91 -0
- data/lib/git/commands/remote/get_url.rb +66 -0
- data/lib/git/commands/remote/list.rb +54 -0
- data/lib/git/commands/remote/prune.rb +61 -0
- data/lib/git/commands/remote/remove.rb +52 -0
- data/lib/git/commands/remote/rename.rb +69 -0
- data/lib/git/commands/remote/set_branches.rb +63 -0
- data/lib/git/commands/remote/set_head.rb +82 -0
- data/lib/git/commands/remote/set_url.rb +71 -0
- data/lib/git/commands/remote/set_url_add.rb +61 -0
- data/lib/git/commands/remote/set_url_delete.rb +64 -0
- data/lib/git/commands/remote/show.rb +71 -0
- data/lib/git/commands/remote/update.rb +72 -0
- data/lib/git/commands/remote.rb +42 -0
- data/lib/git/commands/repack.rb +277 -0
- data/lib/git/commands/reset.rb +147 -0
- data/lib/git/commands/rev_parse.rb +297 -0
- data/lib/git/commands/revert/abort.rb +45 -0
- data/lib/git/commands/revert/continue.rb +57 -0
- data/lib/git/commands/revert/quit.rb +47 -0
- data/lib/git/commands/revert/skip.rb +44 -0
- data/lib/git/commands/revert/start.rb +153 -0
- data/lib/git/commands/revert.rb +29 -0
- data/lib/git/commands/rm.rb +114 -0
- data/lib/git/commands/show.rb +632 -0
- data/lib/git/commands/show_ref/exclude_existing.rb +120 -0
- data/lib/git/commands/show_ref/exists.rb +78 -0
- data/lib/git/commands/show_ref/list.rb +145 -0
- data/lib/git/commands/show_ref/verify.rb +120 -0
- data/lib/git/commands/show_ref.rb +42 -0
- data/lib/git/commands/stash/apply.rb +75 -0
- data/lib/git/commands/stash/branch.rb +65 -0
- data/lib/git/commands/stash/clear.rb +41 -0
- data/lib/git/commands/stash/create.rb +58 -0
- data/lib/git/commands/stash/drop.rb +67 -0
- data/lib/git/commands/stash/list.rb +39 -0
- data/lib/git/commands/stash/pop.rb +78 -0
- data/lib/git/commands/stash/push.rb +103 -0
- data/lib/git/commands/stash/show.rb +149 -0
- data/lib/git/commands/stash/store.rb +63 -0
- data/lib/git/commands/stash.rb +38 -0
- data/lib/git/commands/status.rb +169 -0
- data/lib/git/commands/symbolic_ref/delete.rb +68 -0
- data/lib/git/commands/symbolic_ref/read.rb +95 -0
- data/lib/git/commands/symbolic_ref/update.rb +76 -0
- data/lib/git/commands/symbolic_ref.rb +38 -0
- data/lib/git/commands/tag/create.rb +139 -0
- data/lib/git/commands/tag/delete.rb +55 -0
- data/lib/git/commands/tag/list.rb +143 -0
- data/lib/git/commands/tag/verify.rb +71 -0
- data/lib/git/commands/tag.rb +26 -0
- data/lib/git/commands/update_ref/batch.rb +140 -0
- data/lib/git/commands/update_ref/delete.rb +92 -0
- data/lib/git/commands/update_ref/update.rb +106 -0
- data/lib/git/commands/update_ref.rb +42 -0
- data/lib/git/commands/version.rb +52 -0
- data/lib/git/commands/worktree/add.rb +140 -0
- data/lib/git/commands/worktree/list.rb +64 -0
- data/lib/git/commands/worktree/lock.rb +58 -0
- data/lib/git/commands/worktree/management_base.rb +51 -0
- data/lib/git/commands/worktree/move.rb +66 -0
- data/lib/git/commands/worktree/prune.rb +67 -0
- data/lib/git/commands/worktree/remove.rb +63 -0
- data/lib/git/commands/worktree/repair.rb +76 -0
- data/lib/git/commands/worktree/unlock.rb +47 -0
- data/lib/git/commands/worktree.rb +43 -0
- data/lib/git/commands/write_tree.rb +68 -0
- data/lib/git/commands.rb +89 -0
- data/lib/git/detached_head_info.rb +54 -0
- data/lib/git/diff.rb +297 -7
- data/lib/git/diff_file_numstat_info.rb +29 -0
- data/lib/git/diff_file_patch_info.rb +134 -0
- data/lib/git/diff_file_raw_info.rb +127 -0
- data/lib/git/diff_info.rb +169 -0
- data/lib/git/diff_path_status.rb +78 -19
- data/lib/git/diff_result.rb +32 -0
- data/lib/git/diff_stats.rb +59 -14
- data/lib/git/dirstat_info.rb +86 -0
- data/lib/git/errors.rb +65 -2
- data/lib/git/execution_context/global.rb +56 -0
- data/lib/git/execution_context/repository.rb +147 -0
- data/lib/git/execution_context.rb +482 -0
- data/lib/git/file_ref.rb +74 -0
- data/lib/git/fsck_object.rb +9 -9
- data/lib/git/fsck_result.rb +1 -1
- data/lib/git/lib.rb +1606 -1028
- data/lib/git/log.rb +15 -2
- data/lib/git/object.rb +92 -22
- data/lib/git/parsers/branch.rb +224 -0
- data/lib/git/parsers/cat_file.rb +111 -0
- data/lib/git/parsers/diff.rb +585 -0
- data/lib/git/parsers/fsck.rb +133 -0
- data/lib/git/parsers/grep.rb +42 -0
- data/lib/git/parsers/ls_tree.rb +58 -0
- data/lib/git/parsers/stash.rb +208 -0
- data/lib/git/parsers/tag.rb +257 -0
- data/lib/git/remote.rb +133 -9
- data/lib/git/repository/branching.rb +572 -0
- data/lib/git/repository/committing.rb +191 -0
- data/lib/git/repository/configuring.rb +156 -0
- data/lib/git/repository/diffing.rb +775 -0
- data/lib/git/repository/inspecting.rb +153 -0
- data/lib/git/repository/logging.rb +247 -0
- data/lib/git/repository/merging.rb +295 -0
- data/lib/git/repository/object_operations.rb +1101 -0
- data/lib/git/repository/path_resolver.rb +207 -0
- data/lib/git/repository/remote_operations.rb +753 -0
- data/lib/git/repository/shared_private.rb +51 -0
- data/lib/git/repository/staging.rb +390 -0
- data/lib/git/repository/stashing.rb +107 -0
- data/lib/git/repository/status_operations.rb +180 -0
- data/lib/git/repository/worktree_operations.rb +159 -0
- data/lib/git/repository.rb +264 -1
- data/lib/git/stash.rb +85 -4
- data/lib/git/stash_info.rb +104 -0
- data/lib/git/stashes.rb +130 -13
- data/lib/git/status.rb +224 -18
- data/lib/git/tag_delete_failure.rb +31 -0
- data/lib/git/tag_delete_result.rb +63 -0
- data/lib/git/tag_info.rb +105 -0
- data/lib/git/version.rb +109 -2
- data/lib/git/version_constraint.rb +81 -0
- data/lib/git/worktree.rb +120 -5
- data/lib/git/worktrees.rb +107 -7
- data/lib/git.rb +114 -18
- data/redesign/1_architecture_existing.md +54 -18
- data/redesign/2_architecture_redesign.md +365 -46
- data/redesign/3_architecture_implementation.md +1451 -54
- data/tasks/gem_tasks.rake +4 -0
- data/tasks/npm_tasks.rake +7 -0
- data/tasks/rspec.rake +48 -0
- data/tasks/test.rake +13 -1
- data/tasks/yard.rake +34 -7
- metadata +349 -20
- data/lib/git/index.rb +0 -6
- data/lib/git/path.rb +0 -38
- data/lib/git/working_directory.rb +0 -6
- /data/{release-please-config.json → .release-please-config.json} +0 -0
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pr-readiness-review
|
|
3
|
+
description: "Performs a comprehensive pre-PR readiness review covering tests, code quality, security, and commit conventions. Use at the end of implementation before submitting a pull request."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# PR Readiness Review Workflow
|
|
7
|
+
|
|
8
|
+
Use this at the end of implementation to prepare for PR submission:
|
|
9
|
+
|
|
10
|
+
**"I've completed the implementation. Please perform a comprehensive PR readiness review."**
|
|
11
|
+
|
|
12
|
+
## Contents
|
|
13
|
+
|
|
14
|
+
- [How to use this skill](#how-to-use-this-skill)
|
|
15
|
+
- [Prerequisites](#prerequisites)
|
|
16
|
+
- [Related skills](#related-skills)
|
|
17
|
+
- [1. Run Final Validation](#1-run-final-validation)
|
|
18
|
+
- [2. Verify Testing Quality](#2-verify-testing-quality)
|
|
19
|
+
- [3. Review Code Quality](#3-review-code-quality)
|
|
20
|
+
- [4. Verify Against Git Documentation](#4-verify-against-git-documentation)
|
|
21
|
+
- [5. Check Commit Quality](#5-check-commit-quality)
|
|
22
|
+
- [6. Review Documentation](#6-review-documentation)
|
|
23
|
+
- [7. Verify Branch Placement](#7-verify-branch-placement)
|
|
24
|
+
- [8. Generate PR Summary](#8-generate-pr-summary)
|
|
25
|
+
|
|
26
|
+
## How to use this skill
|
|
27
|
+
|
|
28
|
+
Attach this file to your Copilot Chat context, then invoke it after
|
|
29
|
+
implementation is complete and before opening a pull request. This workflow is a
|
|
30
|
+
final quality gate and reporting template.
|
|
31
|
+
|
|
32
|
+
## Prerequisites
|
|
33
|
+
|
|
34
|
+
Before starting, you **MUST** load the following skill(s) in their entirety:
|
|
35
|
+
|
|
36
|
+
- [YARD Documentation](../yard-documentation/SKILL.md) — authoritative
|
|
37
|
+
source for YARD formatting rules and writing standards;
|
|
38
|
+
|
|
39
|
+
## Related skills
|
|
40
|
+
|
|
41
|
+
- [RSpec Unit Testing Standards](../rspec-unit-testing-standards/SKILL.md) — baseline rules that all unit tests must
|
|
42
|
+
comply with, including testing only via public interfaces; these standards take precedence over any older guidance
|
|
43
|
+
- [Development Workflow](../development-workflow/SKILL.md) — primary
|
|
44
|
+
implementation process prior to readiness checks
|
|
45
|
+
- [Command Test Conventions](../command-test-conventions/SKILL.md) — unit/integration
|
|
46
|
+
test conventions for command classes
|
|
47
|
+
- [Command YARD Documentation](../command-yard-documentation/SKILL.md)
|
|
48
|
+
— verify command documentation completeness and consistency
|
|
49
|
+
- [Facade Test Conventions](../facade-test-conventions/SKILL.md) —
|
|
50
|
+
unit/integration test conventions for `Git::Repository::*` facade methods
|
|
51
|
+
- [Facade YARD Documentation](../facade-yard-documentation/SKILL.md) — verify
|
|
52
|
+
facade module/method documentation completeness and consistency
|
|
53
|
+
|
|
54
|
+
## 1. Run Final Validation
|
|
55
|
+
|
|
56
|
+
Execute and report results for:
|
|
57
|
+
- `bundle exec rake default` - all tests and linters must pass
|
|
58
|
+
- Check test output for any Ruby warnings
|
|
59
|
+
|
|
60
|
+
## 2. Verify Testing Quality
|
|
61
|
+
|
|
62
|
+
**Unit Tests (Critical):**
|
|
63
|
+
- [ ] **100% coverage of all changed code** - every branch, edge case, error condition
|
|
64
|
+
- [ ] All external dependencies properly mocked (execution_context, git commands)
|
|
65
|
+
- [ ] Each test verifies one specific behavior
|
|
66
|
+
- [ ] Comprehensive coverage: success paths, failures, edge cases, error handling
|
|
67
|
+
- [ ] Test only through public interfaces (see RSpec Unit Testing Standards Rule 6)
|
|
68
|
+
|
|
69
|
+
**Integration Tests (Essential Only):**
|
|
70
|
+
- [ ] **Minimal and purposeful** - only test what unit tests cannot verify
|
|
71
|
+
- [ ] Each test validates one specific git interaction pattern
|
|
72
|
+
- [ ] Tests verify mocked assumptions match real git behavior
|
|
73
|
+
- [ ] No redundancy - don't duplicate what unit tests already cover
|
|
74
|
+
- [ ] Follow CONTRIBUTING.md guidelines: test gem's interaction with git, not git itself
|
|
75
|
+
|
|
76
|
+
**Command Tests (if any `Git::Commands::*` specs are included):**
|
|
77
|
+
- [ ] Apply the [Command Test Conventions](../command-test-conventions/SKILL.md) skill to
|
|
78
|
+
every new or modified unit and integration spec file for command classes. Resolve
|
|
79
|
+
all findings before proceeding.
|
|
80
|
+
|
|
81
|
+
## 3. Review Code Quality
|
|
82
|
+
|
|
83
|
+
- [ ] YARD documentation complete for all public methods/classes
|
|
84
|
+
- [ ] Include `@api public` or `@api private` tags appropriately
|
|
85
|
+
- [ ] Usage examples in YARD docs show common patterns
|
|
86
|
+
- [ ] **Command YARD Docs (if any `Git::Commands::*` source files are included):**
|
|
87
|
+
Apply the [Command YARD Documentation](../command-yard-documentation/SKILL.md)
|
|
88
|
+
skill to every new or modified command source file. Resolve all findings before
|
|
89
|
+
proceeding.
|
|
90
|
+
- [ ] No breaking changes (or properly marked with `!` in commits)
|
|
91
|
+
- [ ] Cross-platform compatible on all supported OSes; any platform-specific logic is properly guarded and tested
|
|
92
|
+
- [ ] No security issues (command injection, path traversal, etc.)
|
|
93
|
+
- [ ] Uses Arguments DSL for building git commands
|
|
94
|
+
|
|
95
|
+
## 4. Verify Against Git Documentation
|
|
96
|
+
|
|
97
|
+
- [ ] Determine the repository's minimum supported Git version from project metadata
|
|
98
|
+
- [ ] Read version-matched upstream documentation for the implemented command
|
|
99
|
+
- [ ] Inspect version-matched upstream source when docs are ambiguous about exact option forms
|
|
100
|
+
- [ ] Use local `git <command> -h` output only as a supplemental check for the installed Git
|
|
101
|
+
- [ ] Confirm all documented options are considered
|
|
102
|
+
- [ ] All edge cases from git documentation are tested
|
|
103
|
+
- [ ] Error handling matches git's actual behavior
|
|
104
|
+
- [ ] Exit codes handled correctly (especially partial failures)
|
|
105
|
+
|
|
106
|
+
## 5. Check Commit Quality
|
|
107
|
+
|
|
108
|
+
- [ ] All commits follow Conventional Commits format: `type: description`
|
|
109
|
+
- [ ] Description is lowercase, no ending period, under 100 chars
|
|
110
|
+
- [ ] Valid types: feat, fix, docs, test, refactor, chore, perf, build, ci, style, revert
|
|
111
|
+
- [ ] Breaking changes marked with `!` and include `BREAKING CHANGE:` footer
|
|
112
|
+
- [ ] Each commit is atomic and has a clear purpose
|
|
113
|
+
|
|
114
|
+
## 6. Review Documentation
|
|
115
|
+
|
|
116
|
+
- [ ] Architecture docs updated if new patterns introduced (redesign/*.md)
|
|
117
|
+
- [ ] If command migration work is included, `redesign/3_architecture_implementation.md`
|
|
118
|
+
is synchronized (checklist status, Phase 2 count, and "Next Task")
|
|
119
|
+
- [ ] Run a stale-doc audit for command migration docs by comparing unchecked
|
|
120
|
+
`Git::Commands::*` entries against files in `lib/git/commands/`
|
|
121
|
+
- [ ] Verify command spec references in redesign docs point to `spec/unit/...` or
|
|
122
|
+
`spec/integration/...` as applicable (not `spec/git/...`)
|
|
123
|
+
- [ ] README.md updated if public API changed
|
|
124
|
+
- [ ] Examples are clear and demonstrate common use cases
|
|
125
|
+
- [ ] All `@param`, `@return`, `@raise` tags are accurate
|
|
126
|
+
|
|
127
|
+
## 7. Verify Branch Placement
|
|
128
|
+
|
|
129
|
+
Before creating the PR, confirm the branch situation:
|
|
130
|
+
|
|
131
|
+
- [ ] Changes are on a feature branch (not `main` or `4.x`), named
|
|
132
|
+
`<type>/<short-description>`
|
|
133
|
+
- [ ] Branch targets the correct base: `main` for features/breaking changes;
|
|
134
|
+
`4.x` for security fixes and backward-compatible v4.x-only changes
|
|
135
|
+
|
|
136
|
+
**If changes are on the wrong branch:** Create a new branch from the appropriate
|
|
137
|
+
base (`origin/main` or `origin/4.x`) and relocate the existing work using the
|
|
138
|
+
most appropriate Git approach — cherry-pick (specific commits), rebase (linear
|
|
139
|
+
history), or recommit (uncommitted changes) — based on the situation.
|
|
140
|
+
|
|
141
|
+
## 8. Generate PR Summary
|
|
142
|
+
|
|
143
|
+
Provide a comprehensive report with:
|
|
144
|
+
|
|
145
|
+
**Implementation Summary:**
|
|
146
|
+
- What was implemented and why
|
|
147
|
+
- Key design decisions made
|
|
148
|
+
- Any trade-offs or limitations
|
|
149
|
+
|
|
150
|
+
**Test Coverage:**
|
|
151
|
+
- Unit tests: X examples covering Y scenarios
|
|
152
|
+
- Integration tests: Z examples validating specific git interactions
|
|
153
|
+
- Coverage: 100% of changed lines (or explain gaps)
|
|
154
|
+
- Edge cases tested: [list critical ones]
|
|
155
|
+
|
|
156
|
+
**Quality Verification:**
|
|
157
|
+
- ✅ Items that passed all checks
|
|
158
|
+
- ⚠️ Items that need attention (if any)
|
|
159
|
+
- Reference to relevant documentation verified
|
|
160
|
+
|
|
161
|
+
**Suggested PR Materials:**
|
|
162
|
+
- PR Title: `type: clear description of change`
|
|
163
|
+
- PR Description draft including:
|
|
164
|
+
- Summary of changes
|
|
165
|
+
- Why this change is needed
|
|
166
|
+
- Test coverage details
|
|
167
|
+
- Breaking changes (if any)
|
|
168
|
+
- Checklist from .github/pull_request_template.md
|
|
169
|
+
|
|
170
|
+
**PR Body Editing Safety:**
|
|
171
|
+
- The terminal tool mangles multi-line markdown (backticks, asterisks, newlines) in
|
|
172
|
+
any shell command, including heredocs. Always write the PR body using the
|
|
173
|
+
**`create_file` tool** (the VS Code Copilot agent tool that writes file content
|
|
174
|
+
directly, bypassing the terminal entirely), then reference the file:
|
|
175
|
+
- `gh pr create --body-file <path>` when opening
|
|
176
|
+
- `gh pr edit <number> --body-file <path>` when updating
|
|
177
|
+
- **Never** use inline `--body "..."` or `cat > file << 'EOF'` heredocs for PR bodies
|
|
178
|
+
- After any body update, verify the stored text with:
|
|
179
|
+
- `gh pr view <number> --json body --jq '.body'`
|
|
180
|
+
- If the body is garbled, rewrite the file with `create_file` and re-run `gh pr edit`
|
|
181
|
+
|
|
182
|
+
**Next Steps:**
|
|
183
|
+
- Any remaining items to address before PR submission
|
|
184
|
+
- Confirmation that all checklist items are complete
|
|
185
|
+
- Make sure to create a feature branch for the PR -- never push directly to main
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: project-context
|
|
3
|
+
description: 'Reference guide for ruby-git architecture, coding standards, design philosophy, key technical details, and compatibility requirements. Use when answering architecture questions, deciding where new code belongs, reviewing coding standards, or understanding the layered command/parser/facade design.'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Project Context
|
|
7
|
+
|
|
8
|
+
Reference for ruby-git's architecture, coding standards, design philosophy, and
|
|
9
|
+
technical constraints. Load this skill when answering questions about code structure,
|
|
10
|
+
where logic belongs, or how the layers interact.
|
|
11
|
+
|
|
12
|
+
## Contents
|
|
13
|
+
|
|
14
|
+
- [How to use this skill](#how-to-use-this-skill)
|
|
15
|
+
- [Related skills](#related-skills)
|
|
16
|
+
- [Architecture & Module Organization](#architecture--module-organization)
|
|
17
|
+
- [Layer Responsibilities](#layer-responsibilities)
|
|
18
|
+
- [Coding Standards](#coding-standards)
|
|
19
|
+
- [Design Philosophy](#design-philosophy)
|
|
20
|
+
- [Key Technical Details](#key-technical-details)
|
|
21
|
+
- [Compatibility](#compatibility)
|
|
22
|
+
- [Performance](#performance)
|
|
23
|
+
- [Implementation Notes](#implementation-notes)
|
|
24
|
+
|
|
25
|
+
## How to use this skill
|
|
26
|
+
|
|
27
|
+
Attach this file to your Copilot Chat context when you need architecture guidance,
|
|
28
|
+
coding standard details, or implementation constraints.
|
|
29
|
+
|
|
30
|
+
## Related skills
|
|
31
|
+
|
|
32
|
+
- [Development Workflow](../development-workflow/SKILL.md) — TDD cycle and commit
|
|
33
|
+
conventions for day-to-day work
|
|
34
|
+
- [Command Implementation](../command-implementation/SKILL.md) — generating and
|
|
35
|
+
reviewing command classes in the layered architecture
|
|
36
|
+
- [Facade Implementation](../facade-implementation/SKILL.md) — generating and
|
|
37
|
+
reviewing `Git::Repository::*` facade methods (the planned v5.0.0 facade
|
|
38
|
+
layer is being introduced incrementally during the architectural redesign;
|
|
39
|
+
`Git::Base` / `Git::Lib` remain the current public API until the migration
|
|
40
|
+
completes)
|
|
41
|
+
- [Extract Facade from Base/Lib](../extract-facade-from-base-lib/SKILL.md) —
|
|
42
|
+
migrating public methods from `Git::Base` / `Git::Lib` into facade methods
|
|
43
|
+
- [YARD Documentation](../yard-documentation/SKILL.md) — documentation
|
|
44
|
+
standards
|
|
45
|
+
|
|
46
|
+
## Architecture & Module Organization
|
|
47
|
+
|
|
48
|
+
**Key modules and their roles:**
|
|
49
|
+
|
|
50
|
+
| Class | Role |
|
|
51
|
+
| --- | --- |
|
|
52
|
+
| `Git::Base` | Main facade — entry point for all user-facing operations |
|
|
53
|
+
| `Git::Lib` | Low-level adapter/facade; calls `Git::Commands::*`, builds rich objects via parsers |
|
|
54
|
+
| `Git::Commands::*` | Command classes: define CLI API, bind args, execute → return `CommandLineResult` |
|
|
55
|
+
| `Git::CommandLine` | Subprocess execution: escaping, timeout, stdout/stderr capture |
|
|
56
|
+
| `Git::Parsers::*` | Transform raw stdout into structured data |
|
|
57
|
+
| `Git::Object::*` | Immutable Git objects (Commit, Tree, Blob, Tag) |
|
|
58
|
+
| `Git::Status` | Working-directory status (enumerable `StatusFile` collection) |
|
|
59
|
+
| `Git::Diff` | Diff operations (enumerable `DiffFile` collection) |
|
|
60
|
+
| `Git::Log` | Chainable commit-history query builder |
|
|
61
|
+
| `Git::Branch/Branches` | Branch management (local + remote) |
|
|
62
|
+
| `Git::Remote` | Remote repository references |
|
|
63
|
+
| `Git::Worktree/Worktrees` | Worktree support |
|
|
64
|
+
| `Git::Stash/Stashes` | Stash management |
|
|
65
|
+
|
|
66
|
+
**Key directories:**
|
|
67
|
+
|
|
68
|
+
- `lib/git/` — Core library code
|
|
69
|
+
- `lib/git/commands/` — Command classes (new architecture)
|
|
70
|
+
- `tests/units/` — Legacy Test::Unit suite
|
|
71
|
+
- `spec/unit/` — RSpec unit tests (mocked execution context)
|
|
72
|
+
- `spec/integration/` — RSpec integration tests (real git repositories)
|
|
73
|
+
- `spec/support/` — Shared test contexts and helpers
|
|
74
|
+
- `redesign/` — Architecture redesign documentation
|
|
75
|
+
- `redesign/3_architecture_implementation.md` is a living migration tracker.
|
|
76
|
+
When command migrations land, keep checklist states, "Next Task", and Phase 2
|
|
77
|
+
progress counts synchronized with `lib/git/commands/` and current spec paths.
|
|
78
|
+
|
|
79
|
+
## Layer Responsibilities
|
|
80
|
+
|
|
81
|
+
The three-layer architecture separates concerns cleanly:
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
Git::Base (facade)
|
|
85
|
+
└── Git::Lib (adapter — pre-processes args, builds rich objects)
|
|
86
|
+
└── Git::Commands::* (defines CLI API, binds args, executes)
|
|
87
|
+
└── Git::CommandLine (subprocess execution)
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
- **Commands layer** (`Git::Commands::*`): Owns the git CLI contract. Declares
|
|
91
|
+
arguments via DSL, executes command, returns `CommandLineResult`. No parsing.
|
|
92
|
+
- `literal` entries are **only** for operation selectors (subcommand names,
|
|
93
|
+
mode flags like `--delete` that define what the class does). Output-format
|
|
94
|
+
flags, parser-contract options, and other caller-controlled options belong as
|
|
95
|
+
`flag_option` / `value_option` — not as `literal` entries.
|
|
96
|
+
- Each command class represents **one operation**, not one output format.
|
|
97
|
+
Output-mode flags (`--patch`, `--numstat`, `--raw`, `--format=…`) are options
|
|
98
|
+
declared in the DSL; the facade chooses which to pass. Separate subclasses
|
|
99
|
+
for the same operation with different output modes are an anti-pattern.
|
|
100
|
+
- **Parser layer** (`Git::Parsers::*`): Transforms raw stdout/stderr into structured
|
|
101
|
+
Ruby data. No execution.
|
|
102
|
+
- **Facade layer** (`Git::Lib`): Pre-processes caller arguments, invokes the right
|
|
103
|
+
command class, calls parsers, constructs rich response objects. **Parser-contract
|
|
104
|
+
options** (e.g. `no_color: true`, `pretty: 'raw'`, `format: FORMAT_STRING`) are
|
|
105
|
+
passed explicitly at the facade call site — this makes the parser contract
|
|
106
|
+
auditable by reading `Git::Lib`. Being incrementally migrated to `Git::Repository`.
|
|
107
|
+
- **Interface layer** (`Git::Base`): User-facing API. Delegates to `Git::Lib`.
|
|
108
|
+
Returns domain objects.
|
|
109
|
+
|
|
110
|
+
`Git::Commands::Base` provides default `#initialize(execution_context)` and `#call`.
|
|
111
|
+
Command classes that need non-zero successful exits declare
|
|
112
|
+
`allow_exit_status <Range>` with a rationale comment.
|
|
113
|
+
|
|
114
|
+
### Command-layer neutrality
|
|
115
|
+
|
|
116
|
+
Command classes are neutral, faithful representations of the git CLI. They declare
|
|
117
|
+
options via the DSL but never embed policy choices (output-control flags, editor
|
|
118
|
+
suppression, progress, verbose mode). The facade (`Git::Lib`) sets safe defaults
|
|
119
|
+
at each call site. Some defaults are **fixed** (not in `ALLOWED_OPTS` — rejected by
|
|
120
|
+
`assert_valid_opts!` before reaching the command); others are **overridable** (in
|
|
121
|
+
`ALLOWED_OPTS`, placed before the caller's `**opts` so the caller's value wins).
|
|
122
|
+
The execution layer (`GIT_EDITOR='true'`) is an unconditional safety net.
|
|
123
|
+
|
|
124
|
+
> **Anti-pattern:** `literal '--no-edit'`, `literal '--verbose'`,
|
|
125
|
+
> `literal '--no-progress'` inside a command class.
|
|
126
|
+
>
|
|
127
|
+
> **Correct pattern:** `flag_option :edit, negatable: true` in the command;
|
|
128
|
+
> `no_edit: true` passed from the facade call site.
|
|
129
|
+
|
|
130
|
+
### Validation Boundaries
|
|
131
|
+
|
|
132
|
+
Command classes use per-argument validation parameters (`required:`, `type:`,
|
|
133
|
+
`allow_nil:`, etc.) and operand format validation. They generally do **not** declare
|
|
134
|
+
cross-argument constraint methods (`conflicts`, `requires`, `requires_one_of`,
|
|
135
|
+
`requires_exactly_one_of`, `forbid_values`, `allowed_values`) — git is the single source of truth for its
|
|
136
|
+
own option semantics. The narrow exception is **arguments git cannot observe in
|
|
137
|
+
its argv**: if an argument is `skip_cli: true`, git never sees it and cannot detect
|
|
138
|
+
incompatibilities — `conflicts` and/or `requires_one_of` are appropriate. Example:
|
|
139
|
+
`cat-file --batch` uses both because `:objects` is `skip_cli: true`:
|
|
140
|
+
|
|
141
|
+
| Validated by Commands | Mechanism |
|
|
142
|
+
| --- | --- |
|
|
143
|
+
| Unknown options | `validate_unsupported_options!` in Arguments DSL |
|
|
144
|
+
| Required options | `required: true` in Arguments DSL |
|
|
145
|
+
| Type checking | `type:` in Arguments DSL |
|
|
146
|
+
| Option-like operand rejection | Automatic for operands before `--` |
|
|
147
|
+
|
|
148
|
+
| Delegated to git (semantic) | Surfaced as |
|
|
149
|
+
| --- | --- |
|
|
150
|
+
| Option conflicts (`--soft` vs `--hard`) | `Git::FailedError` |
|
|
151
|
+
| Option dependencies (`--all-match` requires `--grep`) | `Git::FailedError` |
|
|
152
|
+
| At-least-one-of groups | `Git::FailedError` |
|
|
153
|
+
| Value-set membership | `Git::FailedError` |
|
|
154
|
+
| Forbidden value combinations | `Git::FailedError` |
|
|
155
|
+
|
|
156
|
+
The constraint DSL infrastructure (`conflicts`, `requires`, `requires_one_of`,
|
|
157
|
+
`requires_exactly_one_of`, `forbid_values`, `allowed_values`) remains available in `Git::Commands::Arguments`
|
|
158
|
+
and is used only for `skip_cli: true` argument constraints, and in narrow documented cases for
|
|
159
|
+
git-visible arguments whose combination causes silent data loss (no error, wrong result).
|
|
160
|
+
See `redesign/3_architecture_implementation.md` Insight 6 for the full policy and exception criteria.
|
|
161
|
+
|
|
162
|
+
## Coding Standards
|
|
163
|
+
|
|
164
|
+
### Ruby Style
|
|
165
|
+
|
|
166
|
+
- `frozen_string_literal: true` at the top of every Ruby file
|
|
167
|
+
- Ruby 3.2.0+ idioms; keyword arguments for multi-parameter methods
|
|
168
|
+
- `private` keyword form (not `private :method_name`)
|
|
169
|
+
- Pattern matching for complex conditionals where appropriate
|
|
170
|
+
|
|
171
|
+
### Naming
|
|
172
|
+
|
|
173
|
+
| Kind | Convention | Example |
|
|
174
|
+
| --- | --- | --- |
|
|
175
|
+
| Class/Module | PascalCase | `Git::CommandLine` |
|
|
176
|
+
| Method/variable | snake_case | `current_branch` |
|
|
177
|
+
| Constant | UPPER_SNAKE_CASE | `VERSION` |
|
|
178
|
+
| Predicate | ends with `?` | `bare?` |
|
|
179
|
+
| Mutating method | ends with `!` | `reset!` |
|
|
180
|
+
| Parsed metadata struct (top-level `Git::`) | `*Info` suffix | `BranchInfo`, `TagInfo`, `StashInfo` |
|
|
181
|
+
| Mutating-operation outcome struct (top-level `Git::`) | `*Result` suffix | `BranchDeleteResult`, `TagDeleteResult` |
|
|
182
|
+
|
|
183
|
+
**Result class constraints:**
|
|
184
|
+
|
|
185
|
+
- `*Info` / `*Result` suffixes are reserved for top-level `Git::` data structs.
|
|
186
|
+
Never apply them to `Git::Commands::*` classes — command classes are subprocess
|
|
187
|
+
runners, not data structs, and a name like `Commands::Foo::BarInfo` misleads
|
|
188
|
+
readers.
|
|
189
|
+
- Never name a sub-command class `Object` — it shadows Ruby's `::Object`.
|
|
190
|
+
|
|
191
|
+
### Code Organization
|
|
192
|
+
|
|
193
|
+
- Single-responsibility classes; one public class per file as a general rule
|
|
194
|
+
- Tightly-coupled helper classes may share a file
|
|
195
|
+
- Core code in `lib/git/`; command classes in `lib/git/commands/`
|
|
196
|
+
|
|
197
|
+
### Documentation
|
|
198
|
+
|
|
199
|
+
- YARD for all public methods: `@param`, `@return`, `@raise`, `@example`
|
|
200
|
+
- Use `@overload` with explicit keyword params when methods use `**`
|
|
201
|
+
- `@api private` on internal methods
|
|
202
|
+
- Document edge cases, platform differences, security considerations
|
|
203
|
+
|
|
204
|
+
## Design Philosophy
|
|
205
|
+
|
|
206
|
+
See [CONTRIBUTING.md](../../CONTRIBUTING.md) for authoritative, complete guidelines.
|
|
207
|
+
|
|
208
|
+
**Summary:**
|
|
209
|
+
|
|
210
|
+
- **Lightweight wrapper** — minimal abstraction over `git` CLI
|
|
211
|
+
- **Principle of least surprise** — predictable, follows git conventions
|
|
212
|
+
- **Direct CLI mapping** — `git add` → `Git::Base#add`; use prefix + suffix for
|
|
213
|
+
multi-purpose commands (`#ls_files_untracked`, `#ls_files_staged`)
|
|
214
|
+
- **Parameter naming** mirrors long CLI options
|
|
215
|
+
- **Rich output objects** — translate git output to Ruby objects when useful to
|
|
216
|
+
callers
|
|
217
|
+
- **No unnecessary extensions** — stay close to git's actual behavior
|
|
218
|
+
|
|
219
|
+
## Key Technical Details
|
|
220
|
+
|
|
221
|
+
### Error Hierarchy
|
|
222
|
+
|
|
223
|
+
All gem errors inherit from `Git::Error`:
|
|
224
|
+
|
|
225
|
+
- `Git::FailedError` — non-zero exit status
|
|
226
|
+
- `Git::SignaledError` — killed by signal
|
|
227
|
+
- `Git::TimeoutError` — exceeded timeout (subclass of `SignaledError`)
|
|
228
|
+
- `ArgumentError` — invalid arguments
|
|
229
|
+
|
|
230
|
+
All errors include structured data (command, output, status) for debugging. Never
|
|
231
|
+
swallow exceptions silently.
|
|
232
|
+
|
|
233
|
+
### Path Handling
|
|
234
|
+
|
|
235
|
+
- Working-directory paths: relative to repo working directory
|
|
236
|
+
- Paths stored as `Pathname` objects on `Git::Base`
|
|
237
|
+
- `Git::EscapedPath` for paths with special characters
|
|
238
|
+
- Handle Windows path separators; test with Unicode filenames
|
|
239
|
+
|
|
240
|
+
### Encoding
|
|
241
|
+
|
|
242
|
+
- Use `rchardet` for automatic encoding detection
|
|
243
|
+
- Handle UTF-8, ASCII, and platform-default encodings
|
|
244
|
+
- Be aware of binary vs. text mode differences on Windows
|
|
245
|
+
|
|
246
|
+
### Timeouts
|
|
247
|
+
|
|
248
|
+
- Global timeout configurable; per-command override available
|
|
249
|
+
- `Git::TimeoutError` is raised on expiry
|
|
250
|
+
- Built into `Git::CommandLine`; document implications in YARD
|
|
251
|
+
|
|
252
|
+
### Dependencies
|
|
253
|
+
|
|
254
|
+
- `activesupport` (≥ 5.0) — utilities and deprecation handling
|
|
255
|
+
- `addressable` (~> 2.8) — URI parsing
|
|
256
|
+
- `process_executer` (~> 4.0) — subprocess execution with timeout
|
|
257
|
+
- `rchardet` (~> 1.9) — character encoding detection
|
|
258
|
+
|
|
259
|
+
## Compatibility
|
|
260
|
+
|
|
261
|
+
- **Minimum Ruby (language level):** 3.2.0
|
|
262
|
+
- **Supported Rubies:** MRI (macOS, Linux, Windows); latest JRuby and TruffleRuby on Linux
|
|
263
|
+
- **Minimum Git:** 2.28.0
|
|
264
|
+
- **Platforms:** macOS, Linux, Windows (JRuby/TruffleRuby officially supported on Linux only)
|
|
265
|
+
- Use `File.join` and forward slashes; avoid platform-specific paths in tests
|
|
266
|
+
- Windows has different path handling, file-system behavior, and line endings; JRuby on Windows is not supported
|
|
267
|
+
- Document git version requirements for features that need newer git
|
|
268
|
+
|
|
269
|
+
## Performance
|
|
270
|
+
|
|
271
|
+
### Commands and subprocesses
|
|
272
|
+
|
|
273
|
+
- Commands execute with global or per-command configurable timeout
|
|
274
|
+
- Subprocess execution is handled by `Git::CommandLine`; do not shell out directly
|
|
275
|
+
- Clean up resources (file handles, temp files) after every operation
|
|
276
|
+
- Handle large repository operations efficiently
|
|
277
|
+
|
|
278
|
+
### Memory
|
|
279
|
+
|
|
280
|
+
- Lazy-load Git objects when possible; cache appropriately
|
|
281
|
+
- Stream large outputs rather than buffering everything
|
|
282
|
+
- Be mindful of memory with large diffs and logs
|
|
283
|
+
|
|
284
|
+
### Repository operations
|
|
285
|
+
|
|
286
|
+
- Minimize Git command executions; use batch operations where possible
|
|
287
|
+
- Cache Git objects when appropriate
|
|
288
|
+
- Consider performance implications of deep history traversal
|
|
289
|
+
|
|
290
|
+
## Implementation Notes
|
|
291
|
+
|
|
292
|
+
### Adding new commands
|
|
293
|
+
|
|
294
|
+
Follow the three-layer pattern: command class (CLI contract) → parser (output
|
|
295
|
+
transform) → `Git::Lib` method (orchestration + rich object). See
|
|
296
|
+
[Command Implementation](../command-implementation/SKILL.md).
|
|
297
|
+
|
|
298
|
+
### Working with paths
|
|
299
|
+
|
|
300
|
+
- Store as `Pathname`; use `Git::EscapedPath` for special chars
|
|
301
|
+
- Test with Unicode filenames and Windows separators
|
|
302
|
+
|
|
303
|
+
### Working with repository objects
|
|
304
|
+
|
|
305
|
+
- Handle missing/invalid objects gracefully
|
|
306
|
+
- Test with all object types (commits, trees, blobs, tags)
|
|
307
|
+
|
|
308
|
+
### Security
|
|
309
|
+
|
|
310
|
+
- Use `Git::CommandLine` for all command execution — it handles proper escaping
|
|
311
|
+
- Validate and sanitize user-supplied paths and arguments
|
|
312
|
+
- Document security implications in YARD
|
|
313
|
+
- Be aware of git hook execution risks
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pull-request-review
|
|
3
|
+
description: "Reviews pull requests against project standards and posts review comments via the gh CLI. Use when reviewing PRs, checking coding standards compliance, or performing approval reviews."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Pull Request Review Workflow
|
|
7
|
+
|
|
8
|
+
When asked to review a pull request (e.g., "Review PR #999"), follow this workflow to
|
|
9
|
+
analyze the changes, provide feedback, and optionally post the review to GitHub.
|
|
10
|
+
|
|
11
|
+
## Contents
|
|
12
|
+
|
|
13
|
+
- [How to use this skill](#how-to-use-this-skill)
|
|
14
|
+
- [Related skills](#related-skills)
|
|
15
|
+
- [Step 1: Fetch the PR](#step-1-fetch-the-pr)
|
|
16
|
+
- [Step 2: Review Against Project Standards](#step-2-review-against-project-standards)
|
|
17
|
+
- [Step 3: Present Review Findings](#step-3-present-review-findings)
|
|
18
|
+
- [Step 4: Get User Approval](#step-4-get-user-approval)
|
|
19
|
+
- [Step 5: Post the Review](#step-5-post-the-review)
|
|
20
|
+
- [Step 6: Confirm Completion](#step-6-confirm-completion)
|
|
21
|
+
|
|
22
|
+
## How to use this skill
|
|
23
|
+
|
|
24
|
+
Attach this file to your Copilot Chat context, then invoke it with the PR number
|
|
25
|
+
to review. Follow Step 4 explicitly: do not post review comments until the user
|
|
26
|
+
confirms.
|
|
27
|
+
|
|
28
|
+
## Related skills
|
|
29
|
+
|
|
30
|
+
- [RSpec Unit Testing Standards](../rspec-unit-testing-standards/SKILL.md) — RSpec rules to apply when evaluating
|
|
31
|
+
test quality in a PR
|
|
32
|
+
- [PR Readiness Review](../pr-readiness-review/SKILL.md) — internal pre-PR checks
|
|
33
|
+
before formal review
|
|
34
|
+
- [CI/CD Troubleshooting](../ci-cd-troubleshooting/SKILL.md) — investigate failed
|
|
35
|
+
checks discovered during review
|
|
36
|
+
- [Review Backward Compatibility](../review-backward-compatibility/SKILL.md) —
|
|
37
|
+
deeper audit when API compatibility concerns surface
|
|
38
|
+
|
|
39
|
+
## Step 1: Fetch the PR
|
|
40
|
+
|
|
41
|
+
1. **Read PR Details:** Use `gh pr view #999` to get title, description, author, and
|
|
42
|
+
status.
|
|
43
|
+
2. **Get Changed Files:** Use `gh pr diff #999` to see the complete diff.
|
|
44
|
+
3. **Check PR Status:** Note if it's a draft, has merge conflicts, or has existing
|
|
45
|
+
reviews.
|
|
46
|
+
|
|
47
|
+
## Step 2: Review Against Project Standards
|
|
48
|
+
|
|
49
|
+
Evaluate the PR against these criteria:
|
|
50
|
+
|
|
51
|
+
**Code Quality:** Ruby style (Rubocop-compliant), `frozen_string_literal: true`, proper naming (snake_case/PascalCase), single-responsibility, no duplication, Ruby 3.2+ idioms.
|
|
52
|
+
|
|
53
|
+
**Testing:** Changes are covered by atomic RSpec specs (`spec/`), well-named, and passing CI. Legacy Test::Unit tests (`tests/units/`) require justification to modify.
|
|
54
|
+
|
|
55
|
+
**Documentation:** YARD docs on public methods with `@param`, `@return`, `@raise`, `@example`. README updated for user-facing changes. Platform differences and security documented. For `Git::Commands::*` classes, `@raise [Git::FailedError]` must use the canonical generic wording — **never** enumerate failure causes; see the `@raise` wording table in [Command YARD Documentation](../command-yard-documentation/SKILL.md#3-return-and-raise-tags).
|
|
56
|
+
|
|
57
|
+
**Architecture:** Correct layer placement (Base/Lib/CommandLine), principle of least surprise, direct Git command mapping, proper error hierarchy.
|
|
58
|
+
|
|
59
|
+
**Commits:** Conventional Commits format, lowercase subjects under 100 chars, no trailing period. Breaking changes use `!` and `BREAKING CHANGE:` footer.
|
|
60
|
+
|
|
61
|
+
**Compatibility:** Backward compatible (or marked breaking), Ruby 3.2+, Git 2.28.0+, cross-platform (Windows/macOS/Linux).
|
|
62
|
+
|
|
63
|
+
**Security:** No command injection, proper escaping via Git::CommandLine, input validation, resource cleanup.
|
|
64
|
+
|
|
65
|
+
## Step 3: Present Review Findings
|
|
66
|
+
|
|
67
|
+
Present your findings to the user in this format:
|
|
68
|
+
|
|
69
|
+
```text
|
|
70
|
+
# PR Review: #999 - [PR Title]
|
|
71
|
+
|
|
72
|
+
**Author:** [username]
|
|
73
|
+
**Status:** [open/draft/has conflicts/etc.]
|
|
74
|
+
|
|
75
|
+
## Summary
|
|
76
|
+
[Brief description of what the PR does]
|
|
77
|
+
|
|
78
|
+
## Recommendation
|
|
79
|
+
- **Review Type:** [APPROVE / COMMENT / REQUEST CHANGES]
|
|
80
|
+
- **Rationale:** [Why this recommendation]
|
|
81
|
+
|
|
82
|
+
## General Comments
|
|
83
|
+
|
|
84
|
+
[Overall feedback on the PR - architecture decisions, approach, etc.]
|
|
85
|
+
|
|
86
|
+
## Line-Specific Comments
|
|
87
|
+
|
|
88
|
+
[file.rb:123]
|
|
89
|
+
[Specific feedback about this line or section]
|
|
90
|
+
|
|
91
|
+
[file.rb:456-460]
|
|
92
|
+
[Feedback about this range of lines]
|
|
93
|
+
|
|
94
|
+
## Checklist Results
|
|
95
|
+
|
|
96
|
+
**Passing:**
|
|
97
|
+
- Uses proper Ruby style
|
|
98
|
+
- Tests included
|
|
99
|
+
- ...
|
|
100
|
+
|
|
101
|
+
**Issues Found:**
|
|
102
|
+
- Missing YARD documentation on `SomeClass#method`
|
|
103
|
+
- Commit message "Fixed bug" doesn't follow conventional commits
|
|
104
|
+
- ...
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
**Here is the review. Do you have any questions or want additional changes, OR should I go ahead and post this review on the PR?**
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Step 4: Get User Approval
|
|
112
|
+
|
|
113
|
+
Wait for the user to respond. They may:
|
|
114
|
+
|
|
115
|
+
- **Approve posting:** Proceed to Step 5
|
|
116
|
+
- **Request changes to review:** Modify your findings and re-present
|
|
117
|
+
- **Ask questions:** Answer and clarify before proceeding
|
|
118
|
+
- **Decide not to post:** End the workflow
|
|
119
|
+
|
|
120
|
+
Do NOT post the review without explicit user confirmation.
|
|
121
|
+
|
|
122
|
+
## Step 5: Post the Review
|
|
123
|
+
|
|
124
|
+
Once the user confirms, post the review using the GitHub CLI:
|
|
125
|
+
|
|
126
|
+
**For reviews with line-specific comments:**
|
|
127
|
+
|
|
128
|
+
1. Create the review: `gh pr review #999 --comment` (or `--approve` or
|
|
129
|
+
`--request-changes`)
|
|
130
|
+
2. Add the general comment as the review body using `-b "comment text"`
|
|
131
|
+
3. For line-specific comments, you may need to use the GitHub API or instruct the
|
|
132
|
+
user to add them manually in the GitHub UI
|
|
133
|
+
|
|
134
|
+
**For reviews with only general comments:**
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
gh pr review #999 --approve -b "Your general comment here"
|
|
138
|
+
# or
|
|
139
|
+
gh pr review #999 --comment -b "Your general comment here"
|
|
140
|
+
# or
|
|
141
|
+
gh pr review #999 --request-changes -b "Your general comment here"
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
**Note:** The `gh` CLI has limitations with line-specific comments. If the review
|
|
145
|
+
includes line-specific comments, inform the user of this limitation and either:
|
|
146
|
+
|
|
147
|
+
- Post only the general comment via CLI and provide the line comments for manual
|
|
148
|
+
posting
|
|
149
|
+
- Provide the full review text for the user to post manually
|
|
150
|
+
- Use the GitHub API if line-specific commenting is critical
|
|
151
|
+
|
|
152
|
+
## Step 6: Confirm Completion
|
|
153
|
+
|
|
154
|
+
After posting, confirm with the user:
|
|
155
|
+
|
|
156
|
+
```text
|
|
157
|
+
Review posted successfully to PR #999.
|
|
158
|
+
View at: [PR URL from gh pr view output]
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
When editing a PR description as part of follow-up review changes, use a
|
|
162
|
+
file-based flow for reliability:
|
|
163
|
+
|
|
164
|
+
- write/update markdown in a local file
|
|
165
|
+
- run `gh pr edit #999 --body-file <path>`
|
|
166
|
+
- verify the final stored body with `gh pr view #999 --json body`
|
|
167
|
+
|
|
168
|
+
Avoid long multiline inline `--body "..."` commands for complex markdown.
|