git 5.1.0 → 5.2.0

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.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +45 -0
  3. data/CONTRIBUTING.md +185 -165
  4. data/LICENSE +1 -1
  5. data/README.md +151 -151
  6. data/git.gemspec +35 -3
  7. data/lib/git/command_line/base.rb +1 -2
  8. data/lib/git/commands/base.rb +1 -1
  9. data/lib/git/commands/cat_file/raw.rb +8 -7
  10. data/lib/git/repository/branching.rb +79 -5
  11. data/lib/git/version.rb +1 -1
  12. metadata +5 -94
  13. data/.claude/commands/address-copilot-reviews.md +0 -14
  14. data/.claude/settings.json +0 -16
  15. data/.claude/skills +0 -1
  16. data/.commitlintrc.yml +0 -38
  17. data/.dockerignore +0 -27
  18. data/.github/copilot-instructions.md +0 -30
  19. data/.github/hooks/bin-setup-on-worktree.json +0 -11
  20. data/.github/hooks/run-bin-setup-once.sh +0 -20
  21. data/.github/issue_template.md +0 -15
  22. data/.github/prompts/iteratively-address-copilot-reviews.prompt.md +0 -188
  23. data/.github/pull_request_template.md +0 -21
  24. data/.github/skills/breaking-change-analysis/SKILL.md +0 -99
  25. data/.github/skills/ci-cd-troubleshooting/SKILL.md +0 -264
  26. data/.github/skills/command-implementation/REFERENCE.md +0 -994
  27. data/.github/skills/command-implementation/SKILL.md +0 -230
  28. data/.github/skills/command-test-conventions/SKILL.md +0 -664
  29. data/.github/skills/command-yard-documentation/SKILL.md +0 -434
  30. data/.github/skills/dependency-management/SKILL.md +0 -72
  31. data/.github/skills/development-workflow/SKILL.md +0 -512
  32. data/.github/skills/facade-implementation/REFERENCE.md +0 -837
  33. data/.github/skills/facade-implementation/SKILL.md +0 -269
  34. data/.github/skills/facade-test-conventions/SKILL.md +0 -391
  35. data/.github/skills/facade-yard-documentation/SKILL.md +0 -435
  36. data/.github/skills/make-skill-template/SKILL.md +0 -226
  37. data/.github/skills/pr-readiness-review/SKILL.md +0 -205
  38. data/.github/skills/project-context/SKILL.md +0 -306
  39. data/.github/skills/pull-request-review/SKILL.md +0 -168
  40. data/.github/skills/rebase/SKILL.md +0 -148
  41. data/.github/skills/refactor-command-to-commandlineresult/SKILL.md +0 -131
  42. data/.github/skills/release-management/SKILL.md +0 -125
  43. data/.github/skills/resolve-feedback/SKILL.md +0 -288
  44. data/.github/skills/review-arguments-dsl/CHECKLIST.md +0 -788
  45. data/.github/skills/review-arguments-dsl/SKILL.md +0 -214
  46. data/.github/skills/review-cross-command-consistency/SKILL.md +0 -139
  47. data/.github/skills/reviewing-skills/SKILL.md +0 -214
  48. data/.github/skills/rspec-unit-testing-standards/SKILL.md +0 -685
  49. data/.github/skills/tdd-refactor-step/SKILL.md +0 -236
  50. data/.github/skills/test-debugging/SKILL.md +0 -161
  51. data/.github/skills/yard-documentation/SKILL.md +0 -981
  52. data/.github/skills/yard-documentation/element-rules.md +0 -162
  53. data/.github/skills-deprecated/README.md +0 -21
  54. data/.github/skills-deprecated/extract-command-from-lib/SKILL.md +0 -487
  55. data/.github/skills-deprecated/extract-facade-from-base-lib/KEYWORD_ARG_REMEDIATION.md +0 -22
  56. data/.github/skills-deprecated/extract-facade-from-base-lib/SKILL.md +0 -600
  57. data/.github/skills-deprecated/review-backward-compatibility/SKILL.md +0 -275
  58. data/.github/workflows/continuous_integration.yml +0 -358
  59. data/.github/workflows/enforce_conventional_commits.yml +0 -35
  60. data/.github/workflows/experimental_continuous_integration.yml +0 -59
  61. data/.github/workflows/release.yml +0 -52
  62. data/.github/workflows/warm_bundler_caches.yml +0 -82
  63. data/.gitignore +0 -30
  64. data/.husky/commit-msg +0 -1
  65. data/.husky/pre-commit +0 -13
  66. data/.release-please-config.json +0 -36
  67. data/.release-please-manifest.json +0 -3
  68. data/.rspec +0 -2
  69. data/.rubocop.yml +0 -44
  70. data/.rubocop_todo.yml +0 -30
  71. data/.yard-lint.yml +0 -75
  72. data/CLAUDE.md +0 -11
  73. data/Gemfile +0 -22
  74. data/Rakefile +0 -41
  75. data/docker/test/Dockerfile +0 -32
  76. data/docker/test/docker-compose.yml +0 -0
  77. data/package.json +0 -10
  78. data/redesign/1_architecture_existing.md +0 -102
  79. data/redesign/2_architecture_redesign.md +0 -449
  80. data/redesign/3_architecture_implementation.md +0 -1623
  81. data/redesign/Phase 4 - Step A.md +0 -366
  82. data/redesign/Phase 4 - Step B.md +0 -921
  83. data/redesign/Phase 4 - Step C.md +0 -833
  84. data/redesign/beta_release.md +0 -107
  85. data/redesign/branch_parse_refactor_plan.md +0 -163
  86. data/redesign/c1a-public-api-scope.tsv +0 -256
  87. data/redesign/c1c2_audit.md +0 -566
  88. data/redesign/c1c2_bucket6_lib_orphans.md +0 -626
  89. data/redesign/config_design.rb +0 -501
  90. data/redesign/index.md +0 -34
  91. data/redesign/info_object_migration_plan.md +0 -126
  92. data/redesign/integration_test_analysis.md +0 -521
  93. data/redesign/phase-4-step-b-test-audit.tsv +0 -485
  94. data/redesign/remote_refactor_plan.md +0 -164
  95. data/redesign/reverse_dependencies.sql +0 -44
  96. data/tasks/gem_tasks.rake +0 -14
  97. data/tasks/npm_tasks.rake +0 -7
  98. data/tasks/rspec.rake +0 -111
  99. data/tasks/rubocop.rake +0 -5
  100. data/tasks/test_gem.rake +0 -12
  101. data/tasks/yard.rake +0 -57
@@ -1,205 +0,0 @@
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. Example
9
- request:
10
-
11
- > I've completed the implementation. Please perform a comprehensive PR readiness
12
- > review.
13
-
14
- ## Contents
15
-
16
- - [Contents](#contents)
17
- - [How to use this skill](#how-to-use-this-skill)
18
- - [Prerequisites](#prerequisites)
19
- - [Related skills](#related-skills)
20
- - [1. Run Final Validation](#1-run-final-validation)
21
- - [2. Verify Testing Quality](#2-verify-testing-quality)
22
- - [3. Review Code Quality](#3-review-code-quality)
23
- - [4. Verify Against Git Documentation](#4-verify-against-git-documentation)
24
- - [5. Check Commit Quality](#5-check-commit-quality)
25
- - [6. Review Documentation](#6-review-documentation)
26
- - [7. Verify Branch Placement](#7-verify-branch-placement)
27
- - [8. Generate PR Summary](#8-generate-pr-summary)
28
-
29
- ## How to use this skill
30
-
31
- Attach this file to your Copilot Chat context, then invoke it after
32
- implementation is complete and before opening a pull request. This workflow is a
33
- final quality gate and reporting template.
34
-
35
- ## Prerequisites
36
-
37
- Before starting, you **MUST** load the following skill(s) in their entirety:
38
-
39
- - [YARD Documentation](../yard-documentation/SKILL.md) — authoritative
40
- source for YARD formatting rules and writing standards;
41
-
42
- ## Related skills
43
-
44
- - [RSpec Unit Testing Standards](../rspec-unit-testing-standards/SKILL.md) — baseline rules that all unit tests must
45
- comply with, including testing only via public interfaces; these standards take precedence over any older guidance
46
- - [Development Workflow](../development-workflow/SKILL.md) — primary
47
- implementation process prior to readiness checks
48
- - [Command Test Conventions](../command-test-conventions/SKILL.md) — unit/integration
49
- test conventions for command classes
50
- - [Command YARD Documentation](../command-yard-documentation/SKILL.md)
51
- — verify command documentation completeness and consistency
52
- - [Facade Test Conventions](../facade-test-conventions/SKILL.md) —
53
- unit/integration test conventions for `Git::Repository::*` facade methods
54
- - [Facade YARD Documentation](../facade-yard-documentation/SKILL.md) — verify
55
- facade module/method documentation completeness and consistency
56
- - [Reviewing Skills](../reviewing-skills/SKILL.md) — audit skill quality,
57
- discoverability, reference structure, and cross-skill links when skill files
58
- change
59
-
60
- ## 1. Run Final Validation
61
-
62
- Execute and report results for:
63
-
64
- - `bundle exec rake default` - all tests and linters must pass
65
- - Check test output for any Ruby warnings
66
-
67
- ## 2. Verify Testing Quality
68
-
69
- **Unit Tests (Critical):**
70
-
71
- - [ ] **100% coverage of all changed code** - every branch, edge case, error condition
72
- - [ ] All external dependencies properly mocked (execution_context, git commands)
73
- - [ ] Each test verifies one specific behavior
74
- - [ ] Comprehensive coverage: success paths, failures, edge cases, error handling
75
- - [ ] Test only through public interfaces (see RSpec Unit Testing Standards Rule 6)
76
-
77
- **Integration Tests (Essential Only):**
78
-
79
- - [ ] **Minimal and purposeful** - only test what unit tests cannot verify
80
- - [ ] Each test validates one specific git interaction pattern
81
- - [ ] Tests verify mocked assumptions match real git behavior
82
- - [ ] No redundancy - don't duplicate what unit tests already cover
83
- - [ ] Follow CONTRIBUTING.md guidelines: test gem's interaction with git, not git itself
84
-
85
- **Command Tests (if any `Git::Commands::*` specs are included):**
86
-
87
- - [ ] Apply the [Command Test Conventions](../command-test-conventions/SKILL.md) skill to
88
- every new or modified unit and integration spec file for command classes. Resolve
89
- all findings before proceeding.
90
-
91
- ## 3. Review Code Quality
92
-
93
- - [ ] YARD documentation complete for all public methods/classes
94
- - [ ] Include `@api public` or `@api private` tags appropriately
95
- - [ ] Usage examples in YARD docs show common patterns
96
- - [ ] **Command YARD Docs (if any `Git::Commands::*` source files are included):**
97
- Apply the [Command YARD Documentation](../command-yard-documentation/SKILL.md)
98
- skill to every new or modified command source file. Resolve all findings before
99
- proceeding.
100
- - [ ] No breaking changes (or properly marked with `!` in commits)
101
- - [ ] Cross-platform compatible on all supported OSes; any platform-specific logic is properly guarded and tested
102
- - [ ] No security issues (command injection, path traversal, etc.)
103
- - [ ] Uses Arguments DSL for building git commands
104
-
105
- ## 4. Verify Against Git Documentation
106
-
107
- - [ ] Determine the repository's minimum supported Git version from project metadata
108
- - [ ] Read version-matched upstream documentation for the implemented command
109
- - [ ] Inspect version-matched upstream source when docs are ambiguous about exact option forms
110
- - [ ] Use local `git <command> -h` output only as a supplemental check for the installed Git
111
- - [ ] Confirm all documented options are considered
112
- - [ ] All edge cases from git documentation are tested
113
- - [ ] Error handling matches git's actual behavior
114
- - [ ] Exit codes handled correctly (especially partial failures)
115
-
116
- ## 5. Check Commit Quality
117
-
118
- - [ ] All commits follow Conventional Commits format: `type: description`
119
- - [ ] Description is lowercase, no ending period, under 100 chars
120
- - [ ] Valid types: feat, fix, docs, test, refactor, chore, perf, build, ci, style, revert
121
- - [ ] Breaking changes marked with `!` and include `BREAKING CHANGE:` footer
122
- - [ ] Each commit is atomic and has a clear purpose
123
-
124
- ## 6. Review Documentation
125
-
126
- - [ ] Architecture docs updated if new patterns introduced (redesign/*.md)
127
- - [ ] If command migration work is included, `redesign/3_architecture_implementation.md`
128
- is synchronized (checklist status, Phase 2 count, and "Next Task")
129
- - [ ] Run a stale-doc audit for command migration docs by comparing unchecked
130
- `Git::Commands::*` entries against files in `lib/git/commands/`
131
- - [ ] Verify command spec references in redesign docs point to `spec/unit/...` or
132
- `spec/integration/...` as applicable (not `spec/git/...`)
133
- - [ ] README.md updated if public API changed
134
- - [ ] Examples are clear and demonstrate common use cases
135
- - [ ] All `@param`, `@return`, `@raise` tags are accurate
136
- - [ ] **Skill docs (if any `.github/skills/**` files are included):** Apply the
137
- [Reviewing Skills](../reviewing-skills/SKILL.md) skill to every new or
138
- modified skill. Verify TOC anchors, relative links, cross-skill deep links,
139
- referenced files, and any stated inheritance/override relationships.
140
-
141
- ## 7. Verify Branch Placement
142
-
143
- Before creating the PR, confirm the branch situation:
144
-
145
- - [ ] Changes are on a feature branch (not `main` or `4.x`), named
146
- `<type>/<short-description>`
147
- - [ ] Branch targets the correct base: `main` for features/breaking changes;
148
- `4.x` for security fixes and backward-compatible v4.x-only changes
149
-
150
- **If changes are on the wrong branch:** Create a new branch from the appropriate
151
- base (`origin/main` or `origin/4.x`) and relocate the existing work using the
152
- most appropriate Git approach — cherry-pick (specific commits), rebase (linear
153
- history), or recommit (uncommitted changes) — based on the situation.
154
-
155
- ## 8. Generate PR Summary
156
-
157
- Provide a comprehensive report with:
158
-
159
- **Implementation Summary:**
160
-
161
- - What was implemented and why
162
- - Key design decisions made
163
- - Any trade-offs or limitations
164
-
165
- **Test Coverage:**
166
-
167
- - Unit tests: X examples covering Y scenarios
168
- - Integration tests: Z examples validating specific git interactions
169
- - Coverage: 100% of changed lines (or explain gaps)
170
- - Edge cases tested: [list critical ones]
171
-
172
- **Quality Verification:**
173
-
174
- - ✅ Items that passed all checks
175
- - ⚠️ Items that need attention (if any)
176
- - Reference to relevant documentation verified
177
-
178
- **Suggested PR Materials:**
179
-
180
- - PR Title: `type: clear description of change`
181
- - PR Description draft including:
182
- - Summary of changes
183
- - Why this change is needed
184
- - Test coverage details
185
- - Breaking changes (if any)
186
- - Checklist from .github/pull_request_template.md
187
-
188
- **PR Body Editing Safety:**
189
-
190
- - The terminal tool mangles multi-line markdown (backticks, asterisks, newlines) in
191
- any shell command, including heredocs. Always write the PR body using the
192
- **`create_file` tool** (the VS Code Copilot agent tool that writes file content
193
- directly, bypassing the terminal entirely), then reference the file:
194
- - `gh pr create --body-file <path>` when opening
195
- - `gh pr edit <number> --body-file <path>` when updating
196
- - **Never** use inline `--body "..."` or `cat > file << 'EOF'` heredocs for PR bodies
197
- - After any body update, verify the stored text with:
198
- - `gh pr view <number> --json body --jq '.body'`
199
- - If the body is garbled, rewrite the file with `create_file` and re-run `gh pr edit`
200
-
201
- **Next Steps:**
202
-
203
- - Any remaining items to address before PR submission
204
- - Confirmation that all checklist items are complete
205
- - Make sure to create a feature branch for the PR -- never push directly to main
@@ -1,306 +0,0 @@
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 gem's public API layer
38
- - [YARD Documentation](../yard-documentation/SKILL.md) — documentation
39
- standards
40
-
41
- ## Architecture & Module Organization
42
-
43
- **Key modules and their roles:**
44
-
45
- | Class | Role |
46
- | --- | --- |
47
- | `Git::Repository` | Main facade — entry point for all user-facing operations; methods live in `Git::Repository::*` topic modules under `lib/git/repository/`, included into the class |
48
- | `Git::ExecutionContext::*` | Configured subprocess runner; holds binary path, env vars, and global opts; provides `#command_capturing`/`#command_streaming` to command classes |
49
- | `Git::Commands::*` | Command classes: define CLI API, bind args, execute → return `CommandLineResult` |
50
- | `Git::CommandLine` | Subprocess execution: escaping, timeout, stdout/stderr capture |
51
- | `Git::Parsers::*` | Transform raw stdout into structured data |
52
- | `Git::Object::*` | Immutable Git objects (Commit, Tree, Blob, Tag) |
53
- | `Git::Status` | Working-directory status (enumerable `StatusFile` collection) |
54
- | `Git::Diff` | Diff operations (enumerable `DiffFile` collection) |
55
- | `Git::Log` | Chainable commit-history query builder |
56
- | `Git::Branch/Branches` | Branch management (local + remote) |
57
- | `Git::Remote` | Remote repository references |
58
- | `Git::Worktree/Worktrees` | Worktree support |
59
- | `Git::Stash/Stashes` | Stash management |
60
-
61
- **Key directories:**
62
-
63
- - `lib/git/` — Core library code
64
- - `lib/git/commands/` — Command classes (new architecture)
65
- - `lib/git/repository/` — Facade topic modules (`Git::Repository::*`)
66
- - `spec/unit/` — RSpec unit tests (mocked execution context)
67
- - `spec/integration/` — RSpec integration tests (real git repositories)
68
- - `spec/support/` — Shared test contexts and helpers
69
- - `redesign/` — Architecture redesign documentation
70
- - `redesign/3_architecture_implementation.md` is a living migration tracker.
71
- When command migrations land, keep checklist states, "Next Task", and Phase 2
72
- progress counts synchronized with `lib/git/commands/` and current spec paths.
73
-
74
- ## Layer Responsibilities
75
-
76
- The three-layer architecture separates concerns cleanly:
77
-
78
- ```
79
- Git::Repository (facade — topic modules under lib/git/repository/)
80
- └── Git::Commands::* (defines CLI API, binds args, executes via execution_context)
81
- └── Git::ExecutionContext::* (configured subprocess runner: env, binary, global opts)
82
- └── Git::CommandLine (subprocess execution)
83
- ```
84
-
85
- - **Commands layer** (`Git::Commands::*`): Owns the git CLI contract. Declares
86
- arguments via DSL, executes command, returns `CommandLineResult`. No parsing.
87
- - `literal` entries are **only** for operation selectors (subcommand names,
88
- mode flags like `--delete` that define what the class does). Output-format
89
- flags, parser-contract options, and other caller-controlled options belong as
90
- `flag_option` / `value_option` — not as `literal` entries.
91
- - Each command class represents **one operation**, not one output format.
92
- Output-mode flags (`--patch`, `--numstat`, `--raw`, `--format=…`) are options
93
- declared in the DSL; the facade chooses which to pass. Separate subclasses
94
- for the same operation with different output modes are an anti-pattern.
95
- - **Parser layer** (`Git::Parsers::*`): Transforms raw stdout/stderr into structured
96
- Ruby data. No execution.
97
- - **Facade layer** (`Git::Repository::*`): Pre-processes caller arguments, invokes
98
- the right command class, calls parsers, constructs rich response objects.
99
- **Parser-contract options** (e.g. `no_color: true`, `pretty: 'raw'`,
100
- `format: FORMAT_STRING`) are passed explicitly at the facade call site — this makes
101
- the parser contract auditable by reading the topic module method.
102
-
103
- `Git::Commands::Base` provides default `#initialize(execution_context)` and `#call`.
104
- Command classes that need non-zero successful exits declare
105
- `allow_exit_status <Range>` with a rationale comment.
106
-
107
- ### Command-layer neutrality
108
-
109
- Command classes are neutral, faithful representations of the git CLI. They declare
110
- options via the DSL but never embed policy choices (output-control flags, editor
111
- suppression, progress, verbose mode). The facade (`Git::Repository::*`) sets safe defaults
112
- at each call site. Some defaults are **fixed** (not in `ALLOWED_OPTS` — rejected by
113
- `assert_valid_opts!` before reaching the command); others are **overridable** (in
114
- `ALLOWED_OPTS`, placed before the caller's `**opts` so the caller's value wins).
115
- The execution layer (`GIT_EDITOR='true'`) is an unconditional safety net.
116
-
117
- > **Anti-pattern:** `literal '--no-edit'`, `literal '--verbose'`,
118
- > `literal '--no-progress'` inside a command class.
119
- >
120
- > **Correct pattern:** `flag_option :edit, negatable: true` in the command;
121
- > `no_edit: true` passed from the facade call site.
122
-
123
- ### Validation Boundaries
124
-
125
- Command classes use per-argument validation parameters (`required:`, `type:`,
126
- `allow_nil:`, etc.) and operand format validation. They generally do **not** declare
127
- cross-argument constraint methods (`conflicts`, `requires`, `requires_one_of`,
128
- `requires_exactly_one_of`, `forbid_values`, `allowed_values`) — git is the single source of truth for its
129
- own option semantics. The narrow exception is **arguments git cannot observe in
130
- its argv**: if an argument is `skip_cli: true`, git never sees it and cannot detect
131
- incompatibilities — `conflicts` and/or `requires_one_of` are appropriate. Example:
132
- `cat-file --batch` uses both because `:objects` is `skip_cli: true`:
133
-
134
- | Validated by Commands | Mechanism |
135
- | --- | --- |
136
- | Unknown options | `validate_unsupported_options!` in Arguments DSL |
137
- | Required options | `required: true` in Arguments DSL |
138
- | Type checking | `type:` in Arguments DSL |
139
- | Option-like operand rejection | Automatic for operands before `--` |
140
-
141
- | Delegated to git (semantic) | Surfaced as |
142
- | --- | --- |
143
- | Option conflicts (`--soft` vs `--hard`) | `Git::FailedError` |
144
- | Option dependencies (`--all-match` requires `--grep`) | `Git::FailedError` |
145
- | At-least-one-of groups | `Git::FailedError` |
146
- | Value-set membership | `Git::FailedError` |
147
- | Forbidden value combinations | `Git::FailedError` |
148
-
149
- The constraint DSL infrastructure (`conflicts`, `requires`, `requires_one_of`,
150
- `requires_exactly_one_of`, `forbid_values`, `allowed_values`) remains available in `Git::Commands::Arguments`
151
- and is used only for `skip_cli: true` argument constraints, and in narrow documented cases for
152
- git-visible arguments whose combination causes silent data loss (no error, wrong result).
153
- See `redesign/3_architecture_implementation.md` Insight 6 for the full policy and exception criteria.
154
-
155
- ## Coding Standards
156
-
157
- ### Ruby Style
158
-
159
- - `frozen_string_literal: true` at the top of every Ruby file
160
- - Ruby 3.2.0+ idioms; keyword arguments for multi-parameter methods
161
- - `private` keyword form (not `private :method_name`)
162
- - Pattern matching for complex conditionals where appropriate
163
-
164
- ### Naming
165
-
166
- | Kind | Convention | Example |
167
- | --- | --- | --- |
168
- | Class/Module | PascalCase | `Git::CommandLine` |
169
- | Method/variable | snake_case | `current_branch` |
170
- | Constant | UPPER_SNAKE_CASE | `VERSION` |
171
- | Predicate | ends with `?` | `bare?` |
172
- | Mutating method | ends with `!` | `reset!` |
173
- | Parsed metadata struct (top-level `Git::`) | `*Info` suffix | `BranchInfo`, `TagInfo`, `StashInfo` |
174
- | Mutating-operation outcome struct (top-level `Git::`) | `*Result` suffix | `BranchDeleteResult`, `TagDeleteResult` |
175
-
176
- **Result class constraints:**
177
-
178
- - `*Info` / `*Result` suffixes are reserved for top-level `Git::` data structs.
179
- Never apply them to `Git::Commands::*` classes — command classes are subprocess
180
- runners, not data structs, and a name like `Commands::Foo::BarInfo` misleads
181
- readers.
182
- - Never name a sub-command class `Object` — it shadows Ruby's `::Object`.
183
-
184
- ### Code Organization
185
-
186
- - Single-responsibility classes; one public class per file as a general rule
187
- - Tightly-coupled helper classes may share a file
188
- - Core code in `lib/git/`; command classes in `lib/git/commands/`
189
-
190
- ### Documentation
191
-
192
- - YARD for all public methods: `@param`, `@return`, `@raise`, `@example`
193
- - Use `@overload` with explicit keyword params when methods use `**`
194
- - `@api private` on internal methods
195
- - Document edge cases, platform differences, security considerations
196
-
197
- ## Design Philosophy
198
-
199
- See [CONTRIBUTING.md](../../CONTRIBUTING.md) for authoritative, complete guidelines.
200
-
201
- **Summary:**
202
-
203
- - **Lightweight wrapper** — minimal abstraction over `git` CLI
204
- - **Principle of least surprise** — predictable, follows git conventions
205
- - **Direct CLI mapping** — `git add` → `Git::Repository#add`; use prefix + suffix for
206
- multi-purpose commands (`#ls_files_untracked`, `#ls_files_staged`)
207
- - **Parameter naming** mirrors long CLI options
208
- - **Rich output objects** — translate git output to Ruby objects when useful to
209
- callers
210
- - **No unnecessary extensions** — stay close to git's actual behavior
211
-
212
- ## Key Technical Details
213
-
214
- ### Error Hierarchy
215
-
216
- All gem errors inherit from `Git::Error`:
217
-
218
- - `Git::FailedError` — non-zero exit status
219
- - `Git::SignaledError` — killed by signal
220
- - `Git::TimeoutError` — exceeded timeout (subclass of `SignaledError`)
221
- - `ArgumentError` — invalid arguments
222
-
223
- All errors include structured data (command, output, status) for debugging. Never
224
- swallow exceptions silently.
225
-
226
- ### Path Handling
227
-
228
- - Working-directory paths: relative to repo working directory
229
- - Paths stored as `Pathname` objects on `Git::Repository`
230
- - `Git::EscapedPath` for paths with special characters
231
- - Handle Windows path separators; test with Unicode filenames
232
-
233
- ### Encoding
234
-
235
- - Use `rchardet` for automatic encoding detection
236
- - Handle UTF-8, ASCII, and platform-default encodings
237
- - Be aware of binary vs. text mode differences on Windows
238
-
239
- ### Timeouts
240
-
241
- - Global timeout configurable; per-command override available
242
- - `Git::TimeoutError` is raised on expiry
243
- - Built into `Git::CommandLine`; document implications in YARD
244
-
245
- ### Dependencies
246
-
247
- - `activesupport` (≥ 5.0) — utilities and deprecation handling
248
- - `addressable` (~> 2.8) — URI parsing
249
- - `process_executer` (~> 4.0) — subprocess execution with timeout
250
- - `rchardet` (~> 1.9) — character encoding detection
251
-
252
- ## Compatibility
253
-
254
- - **Minimum Ruby (language level):** 3.2.0
255
- - **Supported Rubies:** MRI (macOS, Linux, Windows); latest JRuby and TruffleRuby on Linux
256
- - **Minimum Git:** 2.28.0
257
- - **Platforms:** macOS, Linux, Windows (JRuby/TruffleRuby officially supported on Linux only)
258
- - Use `File.join` and forward slashes; avoid platform-specific paths in tests
259
- - Windows has different path handling, file-system behavior, and line endings; JRuby on Windows is not supported
260
- - Document git version requirements for features that need newer git
261
-
262
- ## Performance
263
-
264
- ### Commands and subprocesses
265
-
266
- - Commands execute with global or per-command configurable timeout
267
- - Subprocess execution is handled by `Git::CommandLine`; do not shell out directly
268
- - Clean up resources (file handles, temp files) after every operation
269
- - Handle large repository operations efficiently
270
-
271
- ### Memory
272
-
273
- - Lazy-load Git objects when possible; cache appropriately
274
- - Stream large outputs rather than buffering everything
275
- - Be mindful of memory with large diffs and logs
276
-
277
- ### Repository operations
278
-
279
- - Minimize Git command executions; use batch operations where possible
280
- - Cache Git objects when appropriate
281
- - Consider performance implications of deep history traversal
282
-
283
- ## Implementation Notes
284
-
285
- ### Adding new commands
286
-
287
- Follow the three-layer pattern: command class (CLI contract) → parser (output
288
- transform) → `Git::Repository::*` facade method (orchestration + rich object). See
289
- [Command Implementation](../command-implementation/SKILL.md).
290
-
291
- ### Working with paths
292
-
293
- - Store as `Pathname`; use `Git::EscapedPath` for special chars
294
- - Test with Unicode filenames and Windows separators
295
-
296
- ### Working with repository objects
297
-
298
- - Handle missing/invalid objects gracefully
299
- - Test with all object types (commits, trees, blobs, tags)
300
-
301
- ### Security
302
-
303
- - Use `Git::CommandLine` for all command execution — it handles proper escaping
304
- - Validate and sanitize user-supplied paths and arguments
305
- - Document security implications in YARD
306
- - Be aware of git hook execution risks
@@ -1,168 +0,0 @@
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.
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.