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
@@ -0,0 +1,426 @@
1
+ ---
2
+ name: command-yard-documentation
3
+ description: "Command-specific YARD documentation rules for Git::Commands::Base subclasses, overriding and extending the general yard-documentation skill. Use when writing or reviewing YARD docs for command classes."
4
+ ---
5
+
6
+ # Command YARD Documentation
7
+
8
+ Write and verify YARD documentation for command classes aligned with
9
+ the `Git::Commands::Base` pattern. Use this skill when writing or reviewing
10
+ YARD docs on command classes — it overrides and extends the general
11
+ [YARD Documentation](../yard-documentation/SKILL.md) skill with
12
+ command-specific rules.
13
+
14
+ This skill verifies that YARD docs accurately mirror the `arguments do` block
15
+ as-implemented. It does not re-adjudicate which options belong based on Git
16
+ version — version gating is the domain of the DSL and the
17
+ [Command Implementation](../command-implementation/SKILL.md) skill, not YARD review.
18
+
19
+ ## Contents
20
+
21
+ - [Contents](#contents)
22
+ - [Related skills](#related-skills)
23
+ - [Input](#input)
24
+ - [Reference](#reference)
25
+ - [Required documentation model](#required-documentation-model)
26
+ - [No `def call` override (simple commands)](#no-def-call-override-simple-commands)
27
+ - [Explicit `def call` override](#explicit-def-call-override)
28
+ - [DSL-to-YARD type mapping](#dsl-to-yard-type-mapping)
29
+ - [Common issues](#common-issues)
30
+ - [Workflow](#workflow)
31
+ - [1. Class-level docs](#1-class-level-docs)
32
+ - [2. Arguments docs](#2-arguments-docs)
33
+ - [3. Return and raise tags](#3-return-and-raise-tags)
34
+ - [4. `allow_exit_status` rationale consistency](#4-allow_exit_status-rationale-consistency)
35
+ - [5. Formatting consistency](#5-formatting-consistency)
36
+ - [6. Avoid internal implementation detail leakage](#6-avoid-internal-implementation-detail-leakage)
37
+ - [Output](#output)
38
+ - [When writing new YARD docs](#when-writing-new-yard-docs)
39
+ - [When reviewing existing YARD docs](#when-reviewing-existing-yard-docs)
40
+
41
+ ## Related skills
42
+
43
+ - [YARD Documentation](../yard-documentation/SKILL.md) — authoritative
44
+ source for general YARD formatting rules and writing standards
45
+ - [Review Arguments DSL](../review-arguments-dsl/SKILL.md) — verifying DSL entries
46
+ match git CLI
47
+ - [Command Implementation](../command-implementation/SKILL.md) — class
48
+ structure, phased rollout gates, and internal compatibility contracts
49
+ - [Command Test Conventions](../command-test-conventions/SKILL.md) — unit/integration
50
+ test conventions for command classes
51
+
52
+ ## Input
53
+
54
+ Before starting, you **MUST** load the following skill(s) in their entirety:
55
+
56
+ - [YARD Documentation](../yard-documentation/SKILL.md) — authoritative
57
+ source for YARD formatting rules and writing standards
58
+
59
+ Then gather the following for each command under review:
60
+
61
+ 1. **Command source** — one or more files from `lib/git/commands/` containing:
62
+ - `class < Git::Commands::Base`
63
+ - `arguments do ... end`
64
+ - optional `allow_exit_status`
65
+ - either a `# @!method call(*, **)` YARD directive (when no `def call` override)
66
+ or YARD doc comments directly above an explicit `def call` override
67
+
68
+ 2. **Git documentation for the git command**
69
+
70
+ - **Latest-version online command documentation**
71
+
72
+ Read the **entire** official git documentation online man page for the command
73
+ for the latest version of git. This version will be used as the primary
74
+ authority for verifying option names, aliases, descriptions, and ordering.
75
+ Fetch this version from the URL `https://git-scm.com/docs/git-{command}`
76
+ (this URL always serves the latest release).
77
+
78
+ - **Minimum-version online command documentation**
79
+
80
+ Read the **entire** official git documentation online man page for the command
81
+ for the `Git::MINIMUM_GIT_VERSION` version of git. This will be used to
82
+ confirm whether the command/class is gated by `requires_git_version` and,
83
+ when it is, that the YARD docs include a continuation paragraph noting the
84
+ minimum version requirement. Fetch this version from the URL
85
+ `https://git-scm.com/docs/git-{command}/{version}`.
86
+
87
+ Do **not** rely on local `git <command> -h` output — the installed Git version
88
+ is unknown and may differ from the minimum or latest supported version.
89
+
90
+ ## Reference
91
+
92
+ ### Required documentation model
93
+
94
+ The placement of `call` documentation depends on whether the command class overrides
95
+ `def call`.
96
+
97
+ #### No `def call` override (simple commands)
98
+
99
+ When the class does **not** define `def call`, use the `# @!method call(*, **)` YARD
100
+ directive. This tells YARD to attach per-command docs to the inherited `call` method
101
+ without a method definition in the subclass:
102
+
103
+ ```ruby
104
+ # @!method call(*, **)
105
+ #
106
+ # @overload call(**options)
107
+ #
108
+ # Execute the git ... command.
109
+ #
110
+ # @param options [Hash] command options
111
+ #
112
+ # @option options [Boolean, nil] :force (nil) ...
113
+ #
114
+ # @return [Git::CommandLineResult]
115
+ ```
116
+
117
+ Note the placement rules:
118
+
119
+ - The `@overload` description text **must appear inside the `@overload` block** (indented
120
+ one extra level, as in the template above). Do **not** place the description between
121
+ the `@!method` line and the `@overload` tag — that level belongs to any `@!method`-scope
122
+ prose that is not part of any overload, which is rarely needed.
123
+ - Place the directive inside the class body, after the `arguments do` block (and after
124
+ `allow_exit_status` when present). Do **not** combine `@!method` with an explicit
125
+ `def call`.
126
+
127
+ #### Explicit `def call` override
128
+
129
+ When the class defines `def call` explicitly (for input validation, stdin feeding, or
130
+ non-trivial option routing), place YARD docs **directly above** the `def call`
131
+ method. Do **not** use `@!method` — YARD will read the normal doc comment on the real
132
+ method:
133
+
134
+ ```ruby
135
+ # @overload call(*revision_range, **options)
136
+ #
137
+ # Execute the `git log` command.
138
+ #
139
+ # @param revision_range [Array<String>] zero or more revision specifiers
140
+ #
141
+ # @param options [Hash] command options
142
+ #
143
+ # @option options [Boolean, nil] :all (nil) ...
144
+ #
145
+ # @return [Git::CommandLineResult] the result of calling `git log`
146
+ #
147
+ # @raise [ArgumentError] if conflicting options are given
148
+ #
149
+ # @raise [Git::FailedError] if git exits with a non-zero exit status
150
+ def call(*, **kwargs)
151
+ # custom logic …
152
+ super
153
+ end
154
+ ```
155
+
156
+ Using `@!method` when `def call` already exists causes YARD to generate duplicate or
157
+ conflicting documentation for the method.
158
+
159
+ ### DSL-to-YARD type mapping
160
+
161
+ | DSL method | YARD type |
162
+ | --- | --- |
163
+ | `flag_option` | `[Boolean, nil]` — default `(nil)` (flag not emitted by default; both `false` and `nil` suppress the flag) |
164
+ | `flag_option ..., max_times: N` | `[Boolean, Integer, nil]` |
165
+ | `flag_option ..., negatable: true` | registers two entries; document **two** `@option` tags: positive key `[Boolean, nil]` (`true` → `--flag`; default `(nil)` → nothing), negative key `[Boolean, nil]` (`true` → `--no-flag`; default `(nil)` → nothing) |
166
+ | `flag_or_value_option` | `[Boolean, String, nil]` (or the specific value type with `nil` appended) |
167
+ | `flag_or_value_option ..., negatable: true` | registers two entries; document **two** `@option` tags: positive key `[Boolean, String, nil]` (`true` → `--flag`; string → `--flag=value` with `inline: true`, or `--flag <value>` without; default `(nil)` → nothing), negative key `[Boolean, nil]` (`true` → `--no-flag`; default `(nil)` → nothing) |
168
+ | `value_option` | `[String]` — `value_option` does not enforce types; it accepts any non-nil value and converts it to a string. Use `[String]` unless callers are expected to pass a narrower type, in which case widen the annotation to reflect reality (e.g. `[Integer, String]` for options documented as taking `<n>` lines/bytes). Never use a bare numeric type such as `[Integer]` alone — that misrepresents what the implementation accepts. |
169
+ | `operand` (repeatable) | `[Array<String>]` |
170
+ | `operand` (single) | `[String]` |
171
+
172
+ ### Common issues
173
+
174
+ - Using `# @!method call(*, **)` when an explicit `def call` override exists — causes
175
+ YARD to generate duplicate or conflicting documentation; remove the `@!method`
176
+ directive and place the `@overload` docs directly above `def call`
177
+ - Missing `# @!method call(*, **)` directive when there is no `def call` override
178
+ (loses child-specific docs in generated YARD)
179
+ - `@option` docs out of sync with `arguments do`
180
+ - **Missing `@raise [ArgumentError]` when `**options` is in the overload signature** —
181
+ every `@overload` that includes `**options` requires
182
+ `@raise [ArgumentError] if unsupported options are provided`. The base `ArgsBuilder`
183
+ always raises this at bind time for unknown keys. For commands whose `arguments`
184
+ block declares **no** options (only `operand` entries), drop `**options` from the
185
+ signature entirely — then no `@raise [ArgumentError]` is needed.
186
+ - **`**options` in `@overload` without `@param options [Hash]`** — whenever an
187
+ `@overload` signature includes `**options`, a corresponding `@param options [Hash]`
188
+ tag is required. For commands whose `arguments` block declares **no** options (only
189
+ `operand` entries), omit `**options` from the `@overload` signature entirely and
190
+ remove any `@raise [ArgumentError] if unsupported options are provided` tag.
191
+
192
+ ```ruby
193
+ # ❌ No options in DSL but **options appears in overload without @param
194
+ # @overload call(name, **options)
195
+ # @param name [String] the remote name to remove
196
+ # @raise [ArgumentError] if unsupported options are provided
197
+
198
+ # ✅ Operand-only command: drop **options from the signature
199
+ # @overload call(name)
200
+ # @param name [String] the remote name to remove
201
+ ```
202
+ - **Missing second `@option` tag for `negatable:` options** — when the DSL declares
203
+ `flag_option :foo, negatable: true` or `flag_or_value_option :foo, negatable: true`,
204
+ two separate `@option` entries are required: one for the positive key (`:foo`) and
205
+ one for the negative companion key (`:no_foo`). A single tag documents only half
206
+ the interface.
207
+
208
+ ```ruby
209
+ # ❌ Missing negative companion tag
210
+ # @option options [Boolean, nil] :create_reflog (nil) create the branch's reflog
211
+
212
+ # ✅ Both forms documented with separate tags
213
+ # @option options [Boolean, nil] :create_reflog (nil) create the branch's reflog
214
+ #
215
+ # @option options [Boolean, nil] :no_create_reflog (nil) suppress branch reflog
216
+ # creation (`--no-create-reflog`)
217
+ ```
218
+ - Missing/incorrect `@raise` guidance for `allow_exit_status`
219
+ - **Overly specific `@raise [Git::FailedError]` description** — do not enumerate
220
+ specific failure causes (e.g., "if the branch doesn't exist", "if the target
221
+ already exists"). Git can fail for many reasons beyond any list (invalid ref name,
222
+ not a git repository, permission error, etc.). Use the generic range-based form:
223
+
224
+ ```ruby
225
+ # ❌ Overly specific — does not cover all failure cases
226
+ # @raise [Git::FailedError] if the branch doesn't exist or target exists (without force)
227
+
228
+ # ✅ Correct — generic, matches sibling commands, accurate for all failure causes
229
+ # @raise [Git::FailedError] if git exits with a non-zero exit status
230
+ ```
231
+
232
+ For commands with a non-default range (e.g. `allow_exit_status 0..1`):
233
+
234
+ ```ruby
235
+ # ✅ Correct for allow_exit_status 0..1
236
+ # @raise [Git::FailedError] if git exits outside the allowed range (exit code > 1)
237
+ ```
238
+ - Legacy references to `ARGS` constant or command-specific `initialize`
239
+ - **`@option` description references a short flag instead of the emitted long flag** —
240
+ `@option` prose must describe behavior using the emitted CLI form (the long flag),
241
+ not the git man-page synopsis short notation. The DSL emits the primary (long) flag
242
+ regardless of which alias the caller uses.
243
+
244
+ ```ruby
245
+ # ❌ Wrong — describes -v as if it is emitted
246
+ # @option options [Boolean, Integer, nil] :verbose (nil) ...
247
+ # Pass `true` for `-v`; pass `2` for `-v -v`.
248
+
249
+ # ✅ Correct — describes the actually emitted flag
250
+ # @option options [Boolean, Integer, nil] :verbose (nil) ...
251
+ # Pass `true` for `--verbose`; pass `2` for `--verbose --verbose`.
252
+ ```
253
+
254
+ - Description leaks internal mechanics (e.g., "written via IO pipe") instead of
255
+ describing caller-facing behavior
256
+ - **Uppercase first letter or trailing period on tag short descriptions** — the
257
+ summary text of every `@option`, `@param`, `@return`, and `@raise` tag must start
258
+ with a **lowercase** letter and must not end with punctuation (`.`, `,`, `;`, `:`).
259
+ Git man pages start descriptions with uppercase and end them with periods; both
260
+ mistakes are easy to copy verbatim. Run `bundle exec rake yard` to catch trailing
261
+ periods — YARD treats any failure as fatal. Correct form:
262
+
263
+ ```ruby
264
+ # ❌ Copied verbatim from the git man page
265
+ # @option options [Boolean, nil] :force (nil) Allow renaming even if target already exists.
266
+
267
+ # ✅ Correct — lowercase start, no trailing period
268
+ # @option options [Boolean, nil] :force (nil) allow renaming even if target already exists
269
+ ```
270
+ - **Raw blank line inside a doc comment block** — a raw blank line (an empty line
271
+ with no leading `#`) silently terminates the YARD block. Any comment lines after
272
+ the raw blank line are dropped from generated docs. Replace every raw blank line
273
+ inside a block with a blank comment line (`#`). This is easy to miss in
274
+ continuation paragraphs and alias notes. Correct form:
275
+
276
+ ```ruby
277
+ # @option options [Boolean, nil] :ipv4 (nil) use IPv4 addresses only
278
+ #
279
+ # Alias: :"4"
280
+ ```
281
+
282
+ - **Multi-sentence short description without a blank comment line** — when an
283
+ `@option` needs more than one sentence, the first sentence is the short description
284
+ and all additional detail must go in a continuation paragraph separated by a blank
285
+ `#` line. Writing both sentences on the same run-in line violates YARD's
286
+ short-description rule. Correct form:
287
+
288
+ ```ruby
289
+ # @option options [Boolean, nil] :update_head_ok (nil) allow updating HEAD ref
290
+ #
291
+ # When true, passes --update-head-ok. By default git fetch refuses to update HEAD.
292
+ ```
293
+
294
+ ## Workflow
295
+
296
+ For each command file, run through these checks in order:
297
+
298
+ ### 1. Class-level docs
299
+
300
+ - [ ] one-line summary
301
+ - [ ] brief behavior description
302
+ - [ ] `@example` blocks with representative usage
303
+ - [ ] ``@note `arguments` block audited against https://git-scm.com/docs/git-{command}/<version>`` —
304
+ present and recording the latest git version at the time of the last DSL audit.
305
+ Flag as an error if missing or if the version in the URL does not match the
306
+ current latest git version (run `bin/latest-git-version` from the repo root to
307
+ check; a stale version means the DSL may be missing options added in later releases)
308
+ - [ ] `@see` to parent command module where applicable
309
+ - [ ] `@see` to the full documentation URL (e.g., `@see https://git-scm.com/docs/git-show-ref`)
310
+ - [ ] `@api private`
311
+
312
+ ### 2. Arguments docs
313
+
314
+ - [ ] `@overload` blocks cover valid call shapes
315
+ - [ ] every positional arg has `@param`
316
+ - [ ] every applicable option has `@option`
317
+ - [ ] `@option` entries appear in the same order as the corresponding entries in the
318
+ `arguments do` block
319
+ - [ ] `@option` types match the DSL method (see
320
+ [DSL-to-YARD type mapping](#dsl-to-yard-type-mapping))
321
+ - [ ] `@option` defaults match the DSL method — `flag_option` (plain or negatable)
322
+ always uses `(nil)` for both the positive and negative `no_` companion tag;
323
+ `value_option` uses `(nil)`. Check every `@option` default tag against the DSL entry.
324
+ For `negatable:` options, verify that **two** `@option` tags are present (one
325
+ for the positive key, one for the `no_` companion key) and that both use `(nil)`.
326
+ - [ ] option defaults/types are consistent with DSL definitions
327
+ - [ ] `@option` descriptions for options that have an `allowed_values` declaration
328
+ enumerate the accepted values in the description text, e.g.: `@option options
329
+ [String] :cleanup (nil) Cleanup mode — one of verbatim, whitespace, or
330
+ strip`
331
+
332
+ ### 3. Return and raise tags
333
+
334
+ - [ ] `@return [Git::CommandLineResult]` with wording: "the result of calling `git
335
+ <subcommand>`"
336
+ - [ ] `@api public` is present at the end of the `@overload` block (after all `@raise`
337
+ tags) — every command class is `@api private` at the class level, but `call` is
338
+ the public contract and must be marked `@api public`
339
+ - [ ] whenever the `@overload` signature includes `**options`, include
340
+ `@raise [ArgumentError] if unsupported options are provided` — the base
341
+ `ArgsBuilder` always raises this at bind time for unknown keys
342
+ - [ ] `@raise [Git::FailedError]` uses the canonical generic wording — **never**
343
+ enumerate specific failure causes; use the form that matches the command's
344
+ declared exit-status range:
345
+
346
+ | `allow_exit_status` | Canonical `@raise` wording |
347
+ | --- | --- |
348
+ | none declared (default `0..0`) | `if git exits with a non-zero exit status` |
349
+ | `allow_exit_status 0..1` | `if git exits outside the allowed range (exit code > 1)` |
350
+ | `allow_exit_status 0..N` | `if git exits outside the allowed range (exit code > N)` |
351
+
352
+ ### 4. `allow_exit_status` rationale consistency
353
+
354
+ When command declares non-default exit range:
355
+
356
+ - [ ] includes short rationale comment above declaration
357
+ - [ ] YARD `@raise` text does not contradict accepted status behavior
358
+
359
+ ### 5. Formatting consistency
360
+
361
+ - [ ] every YARD tag (`@param`, `@option`, `@return`, `@raise`, `@overload`,
362
+ `@see`, `@api`, etc.) is preceded by a blank comment line (`#`)
363
+ - [ ] no raw blank lines (lines with no leading `#`) appear inside any doc block —
364
+ a raw blank line silently terminates the block and drops everything after it
365
+ - [ ] tag short descriptions (the first sentence of each `@param`, `@option`,
366
+ `@return`, `@raise`, etc.) do not end with punctuation (no `.`, `,`, `;`, `:`)
367
+ - [ ] multi-paragraph tag descriptions have a blank comment line (`#`) between the
368
+ short description and each continuation paragraph
369
+ - [ ] `@option`, `@param`, `@return`, and `@raise` short descriptions all start with a
370
+ **lowercase** letter (e.g. `show the HEAD ref even when filtered`, `the path to the
371
+ repository`, `the result of calling \`git show-ref\``, `if git exits with a non-zero
372
+ status`)
373
+ - [ ] consistent option wording and defaults across sibling commands
374
+ - [ ] `max_times:` flags use `[Boolean, Integer]` type, not just `[Boolean]`, and
375
+ include a continuation paragraph explaining integer semantics (e.g. "When an
376
+ integer is given, the flag is repeated that many times")
377
+ - [ ] no stale references to removed per-command implementation details
378
+ - [ ] all other general formatting rules from [YARD
379
+ Documentation](../yard-documentation/SKILL.md) are satisfied
380
+
381
+ ### 6. Avoid internal implementation detail leakage
382
+
383
+ Prefer interface-level wording (what callers can pass/expect), not internals.
384
+
385
+ **Common example — stdin transport mechanism:**
386
+
387
+ ```ruby
388
+ # Bad: leaks implementation detail (IO pipe, threading)
389
+ # Object names are written to the process's stdin via an in-memory IO pipe;
390
+ # this avoids spawning additional processes and works with the --batch protocol.
391
+
392
+ # Good: describes caller-facing behavior
393
+ # Object names are passed to the git process's stdin using the --batch protocol.
394
+ ```
395
+
396
+ - [ ] description does not mention `IO.pipe`, threads, or pipe buffer management
397
+ - [ ] description does not reference internal method names (`with_stdin`,
398
+ `run_batch`)
399
+ - [ ] description describes what the caller passes and what they get back
400
+
401
+ ## Output
402
+
403
+ ### When writing new YARD docs
404
+
405
+ Produce the complete YARD doc block(s) for the command class, then self-verify
406
+ by running every checklist item from [Workflow](#workflow) against your output.
407
+ If any issues are found, fix and re-verify until all checks pass.
408
+
409
+ ### When reviewing existing YARD docs
410
+
411
+ For each file, provide:
412
+
413
+ 1. issue table
414
+
415
+ | Check | Status | Issue |
416
+ | --- | --- | --- |
417
+
418
+ 2. corrected doc block snippets (only where needed)
419
+
420
+ 3. **Self-verify before concluding** — after writing corrected snippets, re-run
421
+ every checklist item from [Workflow](#workflow) against your proposed
422
+ snippets. If any new issues are found, update the snippets and repeat until all
423
+ checks pass. Only then write the final issue table marking everything as passing.
424
+
425
+ > **Branch workflow:** Implement any fixes on a feature branch. Never commit or push
426
+ > directly to `main` — open a pull request when changes are ready to merge.
@@ -0,0 +1,72 @@
1
+ ---
2
+ name: dependency-management
3
+ description: "Updates gem dependencies, handles CVEs, and manages gemspec rules. Use when updating dependencies, checking for outdated gems, or fixing security vulnerabilities."
4
+ ---
5
+
6
+ # Dependency Management Workflow
7
+
8
+ ## Contents
9
+
10
+ - [How to use this skill](#how-to-use-this-skill)
11
+ - [Related skills](#related-skills)
12
+ - [Project-Specific Rules](#project-specific-rules)
13
+ - [Update Process](#update-process)
14
+ - [Key Considerations](#key-considerations)
15
+ - [Commit Guidelines](#commit-guidelines)
16
+
17
+ ## How to use this skill
18
+
19
+ Attach this file to your Copilot Chat context, then invoke it with the specific
20
+ dependency update or CVE remediation scope. Apply this workflow before changing
21
+ version constraints so updates remain consistent with gem project rules.
22
+
23
+ ## Related skills
24
+
25
+ - [CI/CD Troubleshooting](../ci-cd-troubleshooting/SKILL.md) — diagnose failures
26
+ introduced by dependency updates
27
+ - [Development Workflow](../development-workflow/SKILL.md) — drive any required
28
+ code changes via TDD
29
+ - [Release Management](../release-management/SKILL.md) — understand how
30
+ dependency changes flow into automated releases
31
+
32
+ ## Project-Specific Rules
33
+
34
+ - **All dependencies go in `git.gemspec`** (both runtime and development) - enforced by Rubocop
35
+ - **`Gemfile` should remain minimal/empty** - do not add dependencies here
36
+ - **`Gemfile.lock` is NOT committed** - this is a gem/library project
37
+
38
+ ## Update Process
39
+
40
+ 1. **Assess:** Run `bundle outdated` and `bundle audit check --update` (if available)
41
+ 2. **Update:** Edit `git.gemspec` if constraints need changing, then run `bundle update`
42
+ 3. **Test:** Run `bundle exec rake default` - must pass on all supported Ruby versions (see CI matrix in `.github/workflows/` and minimum version in `git.gemspec`)
43
+ 4. **Commit:** Use conventional commit format:
44
+ - Security: `fix(deps): update <gem> to fix CVE-XXXX-XXXX`
45
+ - Regular: `chore(deps): update dependencies`
46
+ - Breaking: `chore(deps)!: update <gem>` with `BREAKING CHANGE:` footer
47
+
48
+ ## Key Considerations
49
+
50
+ - Security vulnerabilities are highest priority - address immediately
51
+ - For gem projects, version constraints in gemspec must be carefully chosen since users resolve dependencies independently
52
+ - Breaking changes in dependencies may require code changes (use TDD workflow)
53
+ - Test with both minimum supported versions and latest versions when possible
54
+ - If tests fail, isolate by updating gems one at a time or use binary search
55
+
56
+ ## Commit Guidelines
57
+
58
+ This project uses [Conventional Commits](https://www.conventionalcommits.org/). A
59
+ commit hook enforces the format. See the "Commit message guidelines" section in
60
+ `CONTRIBUTING.md` for the full format and allowed types.
61
+
62
+ **Issue and PR references in the body:** Do not use `#<number>` in the commit
63
+ body — write `issue 1000` not `issue #1000`. A commitlint parser flaw treats any
64
+ line containing `#<number>` as a footer token, breaking the body/footer split. To
65
+ close an issue/PR, use `Closes`/`Fixes`/`Resolves #<number>` in the footer. To
66
+ merely mention one for context, omit the `#` and no footer line is needed.
67
+
68
+ To validate a commit message file before committing:
69
+
70
+ ```bash
71
+ npx commitlint --format @commitlint/format < commit_msg.txt
72
+ ```