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.
Files changed (280) hide show
  1. checksums.yaml +4 -4
  2. data/.github/copilot-instructions.md +67 -2705
  3. data/.github/pull_request_template.md +3 -1
  4. data/.github/skills/breaking-change-analysis/SKILL.md +102 -0
  5. data/.github/skills/ci-cd-troubleshooting/SKILL.md +264 -0
  6. data/.github/skills/command-implementation/REFERENCE.md +993 -0
  7. data/.github/skills/command-implementation/SKILL.md +229 -0
  8. data/.github/skills/command-test-conventions/SKILL.md +660 -0
  9. data/.github/skills/command-yard-documentation/SKILL.md +426 -0
  10. data/.github/skills/dependency-management/SKILL.md +72 -0
  11. data/.github/skills/development-workflow/SKILL.md +506 -0
  12. data/.github/skills/extract-command-from-lib/SKILL.md +487 -0
  13. data/.github/skills/extract-facade-from-base-lib/SKILL.md +586 -0
  14. data/.github/skills/facade-implementation/REFERENCE.md +840 -0
  15. data/.github/skills/facade-implementation/SKILL.md +260 -0
  16. data/.github/skills/facade-test-conventions/SKILL.md +380 -0
  17. data/.github/skills/facade-yard-documentation/SKILL.md +429 -0
  18. data/.github/skills/make-skill-template/SKILL.md +176 -0
  19. data/.github/skills/pr-readiness-review/SKILL.md +185 -0
  20. data/.github/skills/project-context/SKILL.md +313 -0
  21. data/.github/skills/pull-request-review/SKILL.md +168 -0
  22. data/.github/skills/refactor-command-to-commandlineresult/SKILL.md +131 -0
  23. data/.github/skills/release-management/SKILL.md +125 -0
  24. data/.github/skills/review-arguments-dsl/CHECKLIST.md +788 -0
  25. data/.github/skills/review-arguments-dsl/SKILL.md +214 -0
  26. data/.github/skills/review-backward-compatibility/SKILL.md +275 -0
  27. data/.github/skills/review-cross-command-consistency/SKILL.md +139 -0
  28. data/.github/skills/reviewing-skills/SKILL.md +189 -0
  29. data/.github/skills/rspec-unit-testing-standards/SKILL.md +639 -0
  30. data/.github/skills/tdd-refactor-step/SKILL.md +236 -0
  31. data/.github/skills/test-debugging/SKILL.md +160 -0
  32. data/.github/skills/yard-documentation/SKILL.md +793 -0
  33. data/.github/workflows/continuous_integration.yml +3 -2
  34. data/.github/workflows/enforce_conventional_commits.yml +1 -1
  35. data/.github/workflows/experimental_continuous_integration.yml +2 -2
  36. data/.github/workflows/release.yml +3 -4
  37. data/.gitignore +8 -0
  38. data/.husky/pre-commit +13 -0
  39. data/.release-please-manifest.json +1 -1
  40. data/.rspec +3 -0
  41. data/.rubocop.yml +7 -3
  42. data/.rubocop_todo.yml +23 -5
  43. data/.yardopts +1 -0
  44. data/CHANGELOG.md +0 -40
  45. data/CONTRIBUTING.md +694 -53
  46. data/README.md +17 -5
  47. data/Rakefile +61 -9
  48. data/commitlint.test +4 -0
  49. data/git.gemspec +14 -8
  50. data/lib/git/args_builder.rb +0 -8
  51. data/lib/git/base.rb +486 -410
  52. data/lib/git/branch.rb +380 -43
  53. data/lib/git/branch_delete_failure.rb +31 -0
  54. data/lib/git/branch_delete_result.rb +63 -0
  55. data/lib/git/branch_info.rb +178 -0
  56. data/lib/git/branches.rb +130 -24
  57. data/lib/git/command_line/base.rb +245 -0
  58. data/lib/git/command_line/capturing.rb +249 -0
  59. data/lib/git/command_line/result.rb +96 -0
  60. data/lib/git/command_line/streaming.rb +194 -0
  61. data/lib/git/command_line.rb +43 -322
  62. data/lib/git/command_line_result.rb +4 -88
  63. data/lib/git/commands/add.rb +131 -0
  64. data/lib/git/commands/am/abort.rb +43 -0
  65. data/lib/git/commands/am/apply.rb +252 -0
  66. data/lib/git/commands/am/continue.rb +43 -0
  67. data/lib/git/commands/am/quit.rb +43 -0
  68. data/lib/git/commands/am/retry.rb +47 -0
  69. data/lib/git/commands/am/show_current_patch.rb +64 -0
  70. data/lib/git/commands/am/skip.rb +42 -0
  71. data/lib/git/commands/am.rb +33 -0
  72. data/lib/git/commands/apply.rb +237 -0
  73. data/lib/git/commands/archive/list_formats.rb +46 -0
  74. data/lib/git/commands/archive.rb +140 -0
  75. data/lib/git/commands/arguments.rb +3510 -0
  76. data/lib/git/commands/base.rb +403 -0
  77. data/lib/git/commands/branch/copy.rb +94 -0
  78. data/lib/git/commands/branch/create.rb +173 -0
  79. data/lib/git/commands/branch/delete.rb +80 -0
  80. data/lib/git/commands/branch/list.rb +162 -0
  81. data/lib/git/commands/branch/move.rb +94 -0
  82. data/lib/git/commands/branch/set_upstream.rb +86 -0
  83. data/lib/git/commands/branch/show_current.rb +49 -0
  84. data/lib/git/commands/branch/unset_upstream.rb +57 -0
  85. data/lib/git/commands/branch.rb +34 -0
  86. data/lib/git/commands/cat_file/batch.rb +364 -0
  87. data/lib/git/commands/cat_file/filtered.rb +105 -0
  88. data/lib/git/commands/cat_file/raw.rb +210 -0
  89. data/lib/git/commands/cat_file.rb +49 -0
  90. data/lib/git/commands/checkout/branch.rb +151 -0
  91. data/lib/git/commands/checkout/files.rb +115 -0
  92. data/lib/git/commands/checkout.rb +38 -0
  93. data/lib/git/commands/checkout_index.rb +105 -0
  94. data/lib/git/commands/clean.rb +100 -0
  95. data/lib/git/commands/clone.rb +240 -0
  96. data/lib/git/commands/commit.rb +272 -0
  97. data/lib/git/commands/commit_tree.rb +100 -0
  98. data/lib/git/commands/config_option_syntax/add.rb +83 -0
  99. data/lib/git/commands/config_option_syntax/get.rb +117 -0
  100. data/lib/git/commands/config_option_syntax/get_all.rb +115 -0
  101. data/lib/git/commands/config_option_syntax/get_color.rb +91 -0
  102. data/lib/git/commands/config_option_syntax/get_color_bool.rb +93 -0
  103. data/lib/git/commands/config_option_syntax/get_regexp.rb +115 -0
  104. data/lib/git/commands/config_option_syntax/get_urlmatch.rb +102 -0
  105. data/lib/git/commands/config_option_syntax/list.rb +107 -0
  106. data/lib/git/commands/config_option_syntax/remove_section.rb +74 -0
  107. data/lib/git/commands/config_option_syntax/rename_section.rb +78 -0
  108. data/lib/git/commands/config_option_syntax/replace_all.rb +104 -0
  109. data/lib/git/commands/config_option_syntax/set.rb +114 -0
  110. data/lib/git/commands/config_option_syntax/unset.rb +89 -0
  111. data/lib/git/commands/config_option_syntax/unset_all.rb +89 -0
  112. data/lib/git/commands/config_option_syntax.rb +56 -0
  113. data/lib/git/commands/describe.rb +155 -0
  114. data/lib/git/commands/diff.rb +656 -0
  115. data/lib/git/commands/diff_files.rb +518 -0
  116. data/lib/git/commands/diff_index.rb +496 -0
  117. data/lib/git/commands/fetch.rb +352 -0
  118. data/lib/git/commands/fsck.rb +136 -0
  119. data/lib/git/commands/gc.rb +132 -0
  120. data/lib/git/commands/grep.rb +338 -0
  121. data/lib/git/commands/init.rb +99 -0
  122. data/lib/git/commands/log.rb +632 -0
  123. data/lib/git/commands/ls_files.rb +191 -0
  124. data/lib/git/commands/ls_remote.rb +155 -0
  125. data/lib/git/commands/ls_tree.rb +131 -0
  126. data/lib/git/commands/maintenance/register.rb +75 -0
  127. data/lib/git/commands/maintenance/run.rb +104 -0
  128. data/lib/git/commands/maintenance/start.rb +66 -0
  129. data/lib/git/commands/maintenance/stop.rb +55 -0
  130. data/lib/git/commands/maintenance/unregister.rb +79 -0
  131. data/lib/git/commands/maintenance.rb +31 -0
  132. data/lib/git/commands/merge/abort.rb +44 -0
  133. data/lib/git/commands/merge/continue.rb +44 -0
  134. data/lib/git/commands/merge/quit.rb +46 -0
  135. data/lib/git/commands/merge/start.rb +245 -0
  136. data/lib/git/commands/merge.rb +28 -0
  137. data/lib/git/commands/merge_base.rb +86 -0
  138. data/lib/git/commands/mv.rb +77 -0
  139. data/lib/git/commands/name_rev.rb +114 -0
  140. data/lib/git/commands/pull.rb +377 -0
  141. data/lib/git/commands/push.rb +246 -0
  142. data/lib/git/commands/read_tree.rb +149 -0
  143. data/lib/git/commands/remote/add.rb +91 -0
  144. data/lib/git/commands/remote/get_url.rb +66 -0
  145. data/lib/git/commands/remote/list.rb +54 -0
  146. data/lib/git/commands/remote/prune.rb +61 -0
  147. data/lib/git/commands/remote/remove.rb +52 -0
  148. data/lib/git/commands/remote/rename.rb +69 -0
  149. data/lib/git/commands/remote/set_branches.rb +63 -0
  150. data/lib/git/commands/remote/set_head.rb +82 -0
  151. data/lib/git/commands/remote/set_url.rb +71 -0
  152. data/lib/git/commands/remote/set_url_add.rb +61 -0
  153. data/lib/git/commands/remote/set_url_delete.rb +64 -0
  154. data/lib/git/commands/remote/show.rb +71 -0
  155. data/lib/git/commands/remote/update.rb +72 -0
  156. data/lib/git/commands/remote.rb +42 -0
  157. data/lib/git/commands/repack.rb +277 -0
  158. data/lib/git/commands/reset.rb +147 -0
  159. data/lib/git/commands/rev_parse.rb +297 -0
  160. data/lib/git/commands/revert/abort.rb +45 -0
  161. data/lib/git/commands/revert/continue.rb +57 -0
  162. data/lib/git/commands/revert/quit.rb +47 -0
  163. data/lib/git/commands/revert/skip.rb +44 -0
  164. data/lib/git/commands/revert/start.rb +153 -0
  165. data/lib/git/commands/revert.rb +29 -0
  166. data/lib/git/commands/rm.rb +114 -0
  167. data/lib/git/commands/show.rb +632 -0
  168. data/lib/git/commands/show_ref/exclude_existing.rb +120 -0
  169. data/lib/git/commands/show_ref/exists.rb +78 -0
  170. data/lib/git/commands/show_ref/list.rb +145 -0
  171. data/lib/git/commands/show_ref/verify.rb +120 -0
  172. data/lib/git/commands/show_ref.rb +42 -0
  173. data/lib/git/commands/stash/apply.rb +75 -0
  174. data/lib/git/commands/stash/branch.rb +65 -0
  175. data/lib/git/commands/stash/clear.rb +41 -0
  176. data/lib/git/commands/stash/create.rb +58 -0
  177. data/lib/git/commands/stash/drop.rb +67 -0
  178. data/lib/git/commands/stash/list.rb +39 -0
  179. data/lib/git/commands/stash/pop.rb +78 -0
  180. data/lib/git/commands/stash/push.rb +103 -0
  181. data/lib/git/commands/stash/show.rb +149 -0
  182. data/lib/git/commands/stash/store.rb +63 -0
  183. data/lib/git/commands/stash.rb +38 -0
  184. data/lib/git/commands/status.rb +169 -0
  185. data/lib/git/commands/symbolic_ref/delete.rb +68 -0
  186. data/lib/git/commands/symbolic_ref/read.rb +95 -0
  187. data/lib/git/commands/symbolic_ref/update.rb +76 -0
  188. data/lib/git/commands/symbolic_ref.rb +38 -0
  189. data/lib/git/commands/tag/create.rb +139 -0
  190. data/lib/git/commands/tag/delete.rb +55 -0
  191. data/lib/git/commands/tag/list.rb +143 -0
  192. data/lib/git/commands/tag/verify.rb +71 -0
  193. data/lib/git/commands/tag.rb +26 -0
  194. data/lib/git/commands/update_ref/batch.rb +140 -0
  195. data/lib/git/commands/update_ref/delete.rb +92 -0
  196. data/lib/git/commands/update_ref/update.rb +106 -0
  197. data/lib/git/commands/update_ref.rb +42 -0
  198. data/lib/git/commands/version.rb +52 -0
  199. data/lib/git/commands/worktree/add.rb +140 -0
  200. data/lib/git/commands/worktree/list.rb +64 -0
  201. data/lib/git/commands/worktree/lock.rb +58 -0
  202. data/lib/git/commands/worktree/management_base.rb +51 -0
  203. data/lib/git/commands/worktree/move.rb +66 -0
  204. data/lib/git/commands/worktree/prune.rb +67 -0
  205. data/lib/git/commands/worktree/remove.rb +63 -0
  206. data/lib/git/commands/worktree/repair.rb +76 -0
  207. data/lib/git/commands/worktree/unlock.rb +47 -0
  208. data/lib/git/commands/worktree.rb +43 -0
  209. data/lib/git/commands/write_tree.rb +68 -0
  210. data/lib/git/commands.rb +89 -0
  211. data/lib/git/detached_head_info.rb +54 -0
  212. data/lib/git/diff.rb +297 -7
  213. data/lib/git/diff_file_numstat_info.rb +29 -0
  214. data/lib/git/diff_file_patch_info.rb +134 -0
  215. data/lib/git/diff_file_raw_info.rb +127 -0
  216. data/lib/git/diff_info.rb +169 -0
  217. data/lib/git/diff_path_status.rb +78 -19
  218. data/lib/git/diff_result.rb +32 -0
  219. data/lib/git/diff_stats.rb +59 -14
  220. data/lib/git/dirstat_info.rb +86 -0
  221. data/lib/git/errors.rb +65 -2
  222. data/lib/git/execution_context/global.rb +56 -0
  223. data/lib/git/execution_context/repository.rb +147 -0
  224. data/lib/git/execution_context.rb +482 -0
  225. data/lib/git/file_ref.rb +74 -0
  226. data/lib/git/fsck_object.rb +9 -9
  227. data/lib/git/fsck_result.rb +1 -1
  228. data/lib/git/lib.rb +1606 -1028
  229. data/lib/git/log.rb +15 -2
  230. data/lib/git/object.rb +92 -22
  231. data/lib/git/parsers/branch.rb +224 -0
  232. data/lib/git/parsers/cat_file.rb +111 -0
  233. data/lib/git/parsers/diff.rb +585 -0
  234. data/lib/git/parsers/fsck.rb +133 -0
  235. data/lib/git/parsers/grep.rb +42 -0
  236. data/lib/git/parsers/ls_tree.rb +58 -0
  237. data/lib/git/parsers/stash.rb +208 -0
  238. data/lib/git/parsers/tag.rb +257 -0
  239. data/lib/git/remote.rb +133 -9
  240. data/lib/git/repository/branching.rb +572 -0
  241. data/lib/git/repository/committing.rb +191 -0
  242. data/lib/git/repository/configuring.rb +156 -0
  243. data/lib/git/repository/diffing.rb +775 -0
  244. data/lib/git/repository/inspecting.rb +153 -0
  245. data/lib/git/repository/logging.rb +247 -0
  246. data/lib/git/repository/merging.rb +295 -0
  247. data/lib/git/repository/object_operations.rb +1101 -0
  248. data/lib/git/repository/path_resolver.rb +207 -0
  249. data/lib/git/repository/remote_operations.rb +753 -0
  250. data/lib/git/repository/shared_private.rb +51 -0
  251. data/lib/git/repository/staging.rb +390 -0
  252. data/lib/git/repository/stashing.rb +107 -0
  253. data/lib/git/repository/status_operations.rb +180 -0
  254. data/lib/git/repository/worktree_operations.rb +159 -0
  255. data/lib/git/repository.rb +264 -1
  256. data/lib/git/stash.rb +85 -4
  257. data/lib/git/stash_info.rb +104 -0
  258. data/lib/git/stashes.rb +130 -13
  259. data/lib/git/status.rb +224 -18
  260. data/lib/git/tag_delete_failure.rb +31 -0
  261. data/lib/git/tag_delete_result.rb +63 -0
  262. data/lib/git/tag_info.rb +105 -0
  263. data/lib/git/version.rb +109 -2
  264. data/lib/git/version_constraint.rb +81 -0
  265. data/lib/git/worktree.rb +120 -5
  266. data/lib/git/worktrees.rb +107 -7
  267. data/lib/git.rb +114 -18
  268. data/redesign/1_architecture_existing.md +54 -18
  269. data/redesign/2_architecture_redesign.md +365 -46
  270. data/redesign/3_architecture_implementation.md +1451 -54
  271. data/tasks/gem_tasks.rake +4 -0
  272. data/tasks/npm_tasks.rake +7 -0
  273. data/tasks/rspec.rake +48 -0
  274. data/tasks/test.rake +13 -1
  275. data/tasks/yard.rake +34 -7
  276. metadata +349 -20
  277. data/lib/git/index.rb +0 -6
  278. data/lib/git/path.rb +0 -38
  279. data/lib/git/working_directory.rb +0 -6
  280. /data/{release-please-config.json → .release-please-config.json} +0 -0
@@ -13,5 +13,7 @@ Review our [guidelines for contributing](https://github.com/ruby-git/ruby-git/bl
13
13
  - [ ] I reviewed and applied the project's [AI Policy](../AI_POLICY.md). I understand
14
14
  and verify any AI-assisted changes included in this PR and ensured they meet
15
15
  quality, security, and licensing standards.
16
- - [ ] Tests added/updated as needed and `rake` passes locally.
16
+ - [ ] I ran `bundle exec rake` locally on this branch and it passed (see
17
+ [Local development setup](../CONTRIBUTING.md#local-development-setup)).
18
+ - [ ] Tests added/updated as needed.
17
19
  - [ ] Documentation updated where applicable (README and/or YARD).
@@ -0,0 +1,102 @@
1
+ ---
2
+ name: breaking-change-analysis
3
+ description: "Assesses the impact of API changes before implementation to understand what code would break and plan appropriate migration paths. Use when removing methods, changing interfaces, or planning deprecations."
4
+ ---
5
+
6
+ # Breaking Change Analysis Workflow
7
+
8
+ Assess the impact of API changes before implementation. Use when removing methods,
9
+ changing method signatures, altering return types/values, changing exception types,
10
+ or modifying default behavior.
11
+
12
+ ## Contents
13
+
14
+ - [How to use this skill](#how-to-use-this-skill)
15
+ - [Related skills](#related-skills)
16
+ - [Step 1: Identify the Change Scope](#step-1-identify-the-change-scope)
17
+ - [Step 2: Find All Usages](#step-2-find-all-usages)
18
+ - [Step 3: Assess and Document Impact](#step-3-assess-and-document-impact)
19
+ - [Step 4: Plan Migration Path](#step-4-plan-migration-path)
20
+
21
+ ## How to use this skill
22
+
23
+ Attach this file to your Copilot Chat context, then invoke it with the specific
24
+ API/method change you are considering. Use this workflow before coding to assess
25
+ impact and plan migration.
26
+
27
+ ## Related skills
28
+
29
+ - [Review Backward Compatibility](../review-backward-compatibility/SKILL.md) —
30
+ verify backward compatibility after command migrations
31
+ - [Development Workflow](../development-workflow/SKILL.md) — implement required
32
+ changes using strict TDD
33
+
34
+ ## Step 1: Identify the Change Scope
35
+
36
+ 1. Determine which classes and methods are affected.
37
+ 2. Check API visibility (`@api public` vs `@api private` in YARD docs).
38
+ 3. Check if the change affects `Git::Lib` (facade layer used by most callers).
39
+
40
+ ## Step 2: Find All Usages
41
+
42
+ 1. **Internal usages:**
43
+
44
+ ```bash
45
+ grep -rn "method_name" lib/ tests/ spec/
46
+ ```
47
+
48
+ 2. **External usage (if applicable):**
49
+
50
+ ```bash
51
+ gh search code "Git::Base#method_name language:ruby"
52
+ ```
53
+
54
+ ## Step 3: Assess and Document Impact
55
+
56
+ Produce an impact assessment:
57
+
58
+ ```markdown
59
+ ## Breaking Change Impact Assessment
60
+
61
+ ### Change Description
62
+ [What is being changed]
63
+
64
+ ### Affected API
65
+ - Class: `Git::SomeClass`
66
+ - Method: `#some_method`
67
+ - Current signature: `def some_method(arg, opts = {})`
68
+ - Proposed signature: `def some_method(arg, force: false)`
69
+
70
+ ### Internal Impact
71
+ - Files affected: X
72
+ - Tests to update: Y
73
+
74
+ ### External Impact
75
+ - Severity: [High/Medium/Low]
76
+ - Migration difficulty: [Easy/Medium/Hard]
77
+
78
+ ### Migration Path
79
+ [How users should update their code]
80
+ ```
81
+
82
+ ## Step 4: Plan Migration Path
83
+
84
+ **Project versioning policy:**
85
+ - Current release line: v4.x (heading to v5.0.0)
86
+ - Breaking changes are batched for major releases (v5.0.0)
87
+ - Use deprecation warnings in the current release line before removal in the next major
88
+
89
+ **Deprecation approach:**
90
+
91
+ ```ruby
92
+ # @deprecated Use {#new_method} instead. Will be removed in v5.0.
93
+ def old_method(*args)
94
+ warn "[DEPRECATION] `old_method` is deprecated. Use `new_method` instead."
95
+ new_method(*args)
96
+ end
97
+ ```
98
+
99
+ **Documentation requirements:**
100
+ - Add `@deprecated` YARD tag with migration guidance
101
+ - Mark commits with `!` for breaking changes and include `BREAKING CHANGE:` footer
102
+ - DO NOT update CHANGELOG.md — it is auto-generated from commit messages
@@ -0,0 +1,264 @@
1
+ ---
2
+ name: ci-cd-troubleshooting
3
+ description: "Diagnoses and fixes CI/CD failures in GitHub Actions workflows. Use when CI is failing on a PR, builds are broken, or tests pass locally but fail in CI."
4
+ ---
5
+
6
+ # CI/CD Troubleshooting Workflow
7
+
8
+ When asked to diagnose or fix CI/CD failures (e.g., "Why is CI failing on PR #999?",
9
+ "Fix the failing build"), follow this workflow to identify the root cause and
10
+ optionally implement fixes.
11
+
12
+ ## Contents
13
+
14
+ - [How to use this skill](#how-to-use-this-skill)
15
+ - [Related skills](#related-skills)
16
+ - [Step 1: Identify the Failure](#step-1-identify-the-failure)
17
+ - [Step 2: Fetch Relevant Logs](#step-2-fetch-relevant-logs)
18
+ - [Step 3: Diagnose Root Cause](#step-3-diagnose-root-cause)
19
+ - [Step 4: Reproduce Locally (if applicable)](#step-4-reproduce-locally-if-applicable)
20
+ - [Step 5: Report Findings or Fix](#step-5-report-findings-or-fix)
21
+ - [Option A: Diagnostic Report ("Why is CI failing?")](#option-a-diagnostic-report-why-is-ci-failing)
22
+ - [Option B: Implement Fix ("Fix the failing build")](#option-b-implement-fix-fix-the-failing-build)
23
+ - [Step 6: Verify Fix](#step-6-verify-fix)
24
+ - [Special Troubleshooting Considerations](#special-troubleshooting-considerations)
25
+
26
+ ## How to use this skill
27
+
28
+ Attach this file to your Copilot Chat context, then invoke it with a failing PR
29
+ number, branch, or CI run context. Use Option A for diagnosis-only requests and
30
+ Option B when the user explicitly asks for a fix.
31
+
32
+ ## Related skills
33
+
34
+ - [Test Debugging](../test-debugging/SKILL.md) — deep-dive test failure analysis
35
+ and flakiness fixes
36
+ - [Development Workflow](../development-workflow/SKILL.md) — full TDD execution
37
+ when implementing CI fixes
38
+ - [PR Readiness Review](../pr-readiness-review/SKILL.md) — final validation
39
+ before opening or updating a PR
40
+
41
+ ## Step 1: Identify the Failure
42
+
43
+ 1. **Get CI Status:**
44
+ - For PRs: `gh pr checks #999`
45
+ - For branches: `gh run list --branch <branch-name> --limit 5`
46
+ - Note which jobs passed and which failed
47
+
48
+ 2. **Categorize the Failure Type:**
49
+ - **Test failures** - Unit tests, integration tests failing
50
+ - **Linter failures** - Rubocop, YARD documentation issues
51
+ - **Build failures** - Dependency installation, compilation errors
52
+ - **Timeout failures** - Jobs exceeding time limits
53
+ - **Platform-specific failures** - Failing on specific Ruby version or OS
54
+
55
+ 3. **Identify Specific Failing Steps:**
56
+ - Note the exact job name and step that failed
57
+ - Record the Ruby version, OS, and other environment details
58
+
59
+ ## Step 2: Fetch Relevant Logs
60
+
61
+ **CRITICAL: CI logs can be massive (100K+ lines) and exceed token limits.**
62
+
63
+ 1. **Get the Run ID:**
64
+
65
+ ```bash
66
+ gh run list --branch <branch> --limit 1 --json databaseId --jq '.[0].databaseId'
67
+ ```
68
+
69
+ 2. **Fetch Failed Job Logs Only:**
70
+
71
+ ```bash
72
+ gh run view <run-id> --log-failed
73
+ ```
74
+
75
+ This limits output to only failed jobs, making it manageable.
76
+
77
+ 3. **Extract Key Error Information:**
78
+
79
+ - For test failures: Look for stack traces, assertion errors, specific test names
80
+ - For linter failures: Extract file names, line numbers, and violation types
81
+ - For build failures: Find dependency errors or missing packages
82
+ - Use `grep` to filter logs if still too large:
83
+
84
+ ```bash
85
+ gh run view <run-id> --log-failed | grep -A 10 -B 5 "Error\|FAILED\|Failure"
86
+ ```
87
+
88
+ 4. **Avoid Full Log Downloads:**
89
+
90
+ - Do NOT use `--log` without `--log-failed` unless specifically requested
91
+ - If logs are still too large, focus on the most recent or critical failure
92
+
93
+ ## Step 3: Diagnose Root Cause
94
+
95
+ Based on the failure type, investigate:
96
+
97
+ **For Test Failures:**
98
+
99
+ - Check if the test exists and what it's testing
100
+ - Look for recent changes that might have broken the test
101
+ - Consider environment differences (local vs. CI)
102
+ - Check for flaky tests (intermittent failures)
103
+
104
+ **For Linter Failures:**
105
+
106
+ - Run linters locally: `bundle exec rubocop` and `bundle exec rake yard`
107
+ - Identify specific violations from the log
108
+ - Check if violations are in files related to recent changes
109
+
110
+ **For Build Failures:**
111
+
112
+ - Check dependency versions in `Gemfile` and `git.gemspec`
113
+ - Look for platform-specific dependency issues
114
+ - Verify Ruby version compatibility
115
+
116
+ **For Timeout Failures:**
117
+
118
+ - Identify which test or step is timing out
119
+ - Check for infinite loops or performance regressions
120
+ - Consider if it's a resource limitation in CI environment
121
+
122
+ ## Step 4: Reproduce Locally (if applicable)
123
+
124
+ **For PR Failures:**
125
+
126
+ 1. Fetch the PR branch:
127
+
128
+ ```bash
129
+ gh pr checkout #999
130
+ ```
131
+
132
+ 2. Run the failing tests locally:
133
+
134
+ ```bash
135
+ bundle exec bin/test <test-name>
136
+ ```
137
+
138
+ 3. Run linters:
139
+
140
+ ```bash
141
+ bundle exec rubocop
142
+ bundle exec rake yard
143
+ ```
144
+
145
+ **For Branch Failures:**
146
+
147
+ 1. Checkout the branch.
148
+ 2. Run full CI workflow:
149
+
150
+ ```bash
151
+ bundle exec rake default
152
+ ```
153
+
154
+ ## Step 5: Report Findings or Fix
155
+
156
+ Determine the appropriate action based on the user's request:
157
+
158
+ ### Option A: Diagnostic Report ("Why is CI failing?")
159
+
160
+ Present findings to the user:
161
+
162
+ ````markdown
163
+ # CI Failure Diagnosis: <Branch/PR>
164
+
165
+ **Status:** <X of Y jobs failed>
166
+
167
+ ## Failed Jobs
168
+ 1. **<Job Name>** (<Ruby version>, <OS>)
169
+ - **Step:** <failing step name>
170
+ - **Failure Type:** <test/linter/build/timeout>
171
+
172
+ ## Root Cause
173
+ <Explanation of what's causing the failure>
174
+
175
+ ## Error Details
176
+ ```
177
+ <Relevant error messages and stack traces>
178
+ ```
179
+
180
+ ## Recommendations
181
+ - <Specific fix suggestion 1>
182
+ - <Specific fix suggestion 2>
183
+
184
+ **Would you like me to implement a fix, or do you need more information?**
185
+ ````
186
+
187
+ **STOP here** unless the user asks you to proceed with fixes.
188
+
189
+ ### Option B: Implement Fix ("Fix the failing build")
190
+
191
+ Proceed based on failure type:
192
+
193
+ - **Test Failures:** Use the full TDD workflow (Phase 1-3) to fix the failing tests
194
+ - **Linter Failures:** Fix violations directly, commit with appropriate message
195
+ (e.g., `style: fix rubocop violations in lib/git/base.rb`)
196
+ - **Build Failures:** Update dependencies or configuration as needed
197
+ - **Timeout Failures:** Investigate performance issues, may require user guidance
198
+
199
+ **For PR Failures on Someone Else's PR:**
200
+
201
+ - You may not have push access to their branch
202
+ - Present the fix and ask user to either:
203
+ - Push to the PR branch (if they have access)
204
+ - Comment on the PR with suggested changes
205
+ - Create a new PR with fixes
206
+
207
+ ## Step 6: Verify Fix
208
+
209
+ After implementing fixes:
210
+
211
+ 1. **Run Affected Tests Locally:**
212
+
213
+ ```bash
214
+ bundle exec bin/test <test-name>
215
+ ```
216
+
217
+ 2. **Run Full CI Suite:**
218
+
219
+ ```bash
220
+ bundle exec rake default
221
+ ```
222
+
223
+ 3. **Push and Monitor:**
224
+
225
+ - Push the fixes
226
+ - Monitor CI to confirm the fix worked:
227
+
228
+ ```bash
229
+ gh run watch
230
+ ```
231
+
232
+ 4. **Confirm Resolution:**
233
+
234
+ ```text
235
+ Fix implemented and pushed. Monitoring CI run...
236
+ CI Status: <link to run>
237
+ ```
238
+
239
+ ## Special Troubleshooting Considerations
240
+
241
+ **Platform-Specific Failures:**
242
+
243
+ - If tests pass on macOS but fail on Linux/Windows, document the difference
244
+ - Check for path separator issues (`/` vs. `\`)
245
+ - Look for encoding differences
246
+ - Consider file system case sensitivity
247
+
248
+ **Flaky Tests:**
249
+
250
+ - If a test fails intermittently, note this in your diagnosis
251
+ - Run the test multiple times locally to confirm flakiness
252
+ - Suggest fixes for race conditions or timing issues
253
+
254
+ **Permission Issues:**
255
+
256
+ - If you can't push to a PR branch, clearly communicate this limitation
257
+ - Provide the exact commands or changes needed for the user to apply
258
+
259
+ **Token Limit Management:**
260
+
261
+ - Always use `--log-failed` to limit output
262
+ - If logs are still too large, use `grep` to extract errors
263
+ - Focus on the first failure if multiple failures exist
264
+ - Consider running tests locally instead of relying on full CI logs