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,793 @@
1
+ ---
2
+ name: yard-documentation
3
+ description: "General YARD documentation rules and workflow for all Ruby source code. Use when writing or reviewing YARD doc comments, generating missing docs, updating examples, fixing doc errors, or checking documentation coverage."
4
+ ---
5
+
6
+ # YARD Documentation
7
+
8
+ General YARD documentation rules and workflow for all Ruby source code.
9
+
10
+ ## Contents
11
+
12
+ - [Contents](#contents)
13
+ - [How to use this skill](#how-to-use-this-skill)
14
+ - [Related skills](#related-skills)
15
+ - [Documentation Standards](#documentation-standards)
16
+ - [YARD Formatting Rules](#yard-formatting-rules)
17
+ - [Element-Specific Rules](#element-specific-rules)
18
+ - [Step 1: Identify What Needs Documentation](#step-1-identify-what-needs-documentation)
19
+ - [Step 2: Write Documentation](#step-2-write-documentation)
20
+ - [Standard template (no `@overload`)](#standard-template-no-overload)
21
+ - [Overload template](#overload-template)
22
+ - [Documenting anonymous splats with `@overload`](#documenting-anonymous-splats-with-overload)
23
+ - [Step 3: Verify Documentation](#step-3-verify-documentation)
24
+ - [Command Reference](#command-reference)
25
+
26
+ ## How to use this skill
27
+
28
+ Attach this file to your Copilot Chat context, then invoke it with the source
29
+ files that need YARD updates. Use it when adding new APIs, fixing doc warnings,
30
+ or improving existing YARD quality and examples.
31
+
32
+ ## Related skills
33
+
34
+ - [Command YARD Documentation](../command-yard-documentation/SKILL.md) — command-specific rules for writing and reviewing YARD docs on `Git::Commands::Base` subclasses
35
+
36
+ ## Documentation Standards
37
+
38
+ ruby-git uses YARD for API documentation:
39
+
40
+ All classes, modules, constants, attributes, and methods must have YARD
41
+ documentation. Methods with Ruby `private` visibility require a short description
42
+ and all applicable tags from the [Methods](#methods) rules — `@param`, `@return`,
43
+ `@raise`, `@yield`/`@yieldparam`/`@yieldreturn`, and `@overload` — with the
44
+ exception that `@example` may be omitted unless an example materially clarifies
45
+ the behavior. Private methods still need YARD docs for developer reference in
46
+ source, even though YARD excludes them from generated HTML by default.
47
+
48
+ ### YARD Formatting Rules
49
+
50
+ Doc comments are rendered as **markdown** via the redcarpet gem. Write all
51
+ free-text descriptions, tag values, and examples using markdown syntax. These rules
52
+ apply to all documentation regardless of element type:
53
+
54
+ **Named length limits**
55
+
56
+ Three named limits govern line and description length throughout this document:
57
+
58
+ - **`LINE_LIMIT`** (90 characters) — the preferred maximum length of any
59
+ physical YARD comment line, measured from column 1 and including every
60
+ character: indentation, `#`, tag metadata, and all text. Wrap prose at
61
+ this limit wherever possible.
62
+ - **`LINE_MAX`** (120 characters) — the hard ceiling for lines that cannot
63
+ be wrapped without breaking their meaning. The following content may
64
+ exceed `LINE_LIMIT` up to `LINE_MAX`; it must not exceed `LINE_MAX`:
65
+ - **URLs** — in `@see` tags or markdown links; a URL cannot be split
66
+ - **Long inline code spans** — a `` `backtick` `` span whose content
67
+ alone approaches or exceeds `LINE_LIMIT`
68
+ - **Long `[Type]` expressions** — a type such as
69
+ `[String, Pathname, Array<String, Pathname>]` that fills the tag
70
+ metadata column before any description text begins
71
+ - **`@example` code lines** — real code inside an example block that
72
+ cannot be reflowed without changing its meaning
73
+ - **Markdown table rows** — pipe-delimited table rows that cannot be
74
+ split across lines
75
+ - **`SUMMARY_LIMIT`** (90 characters) — the maximum length of a tag's
76
+ description text, measured by concatenating the description from the first
77
+ tag line with all immediately following indented continuation lines
78
+ (stripping the leading `# ` from each and joining with a single space).
79
+ Applies to the description text only — not the tag name, `[Type]`, option
80
+ key, or `(default)`.
81
+
82
+ **Doc comment placement**
83
+
84
+ YARD doc comments must appear immediately above the element they document (class,
85
+ module, method, constant, or attribute) with no intervening blank lines or
86
+ non-comment code.
87
+
88
+ **Blank lines around tags**
89
+
90
+ Every individual YARD tag must be preceded by a blank comment line (`#`) unless it is the very first line of a doc comment.
91
+ A YARD tag is any comment token matching `@!?[a-z_]+` — that is, `@word` (regular
92
+ tags such as `@param`, `@return`, `@raise`, `@api`, `@abstract`, `@deprecated`,
93
+ etc.) or `@!word` (directives such as `@!attribute`, `@!method`, `@!scope`, etc.).
94
+
95
+ Within the tag block there are no other exceptions: consecutive same-kind tags (e.g.
96
+ multiple `@param` lines) each require their own preceding blank line.
97
+
98
+ **Never use raw blank lines inside a doc comment block**
99
+
100
+ A raw blank line — an empty line with no leading `#` — terminates the YARD doc
101
+ comment block at that point. Any comment lines that follow the raw blank line are
102
+ treated as separate, unattached comments and will not appear in the generated
103
+ documentation. Always use a blank comment line (`#`) to separate paragraphs or
104
+ continuation text within a YARD block:
105
+
106
+ Correct — blank comment line keeps the block intact:
107
+
108
+ ```ruby
109
+ # @option options [Boolean, nil] :ipv4 (nil) use IPv4 addresses only
110
+ #
111
+ # Alias: :"4"
112
+ ```
113
+
114
+ Incorrect — raw blank line silently drops the alias note:
115
+
116
+ ```ruby
117
+ # @option options [Boolean, nil] :ipv4 (nil) use IPv4 addresses only
118
+
119
+ # Alias: :"4"
120
+ ```
121
+
122
+ Watch for editors that auto-strip trailing spaces from `#` lines, silently
123
+ creating raw blank lines.
124
+
125
+ **Short descriptions**
126
+
127
+ The short description (the first sentence of any doc comment, or the inline text of
128
+ a `@param`, `@return`, `@raise`, etc. tag) must:
129
+
130
+ - Be a single sentence
131
+ - Not end with sentence-ending punctuation (`.`, `?`, `!`)
132
+ - **Element-level short descriptions** (on classes, modules, and methods) **start
133
+ with an uppercase letter** (e.g. `Returns the commit count`,
134
+ `Represents a Git branch`)
135
+ - **Tag short descriptions** (`@option`, `@param`, `@return`, `@raise`, `@yield`,
136
+ `@yieldparam`, etc.) **all start with a lowercase letter** (e.g. `@option options
137
+ [Boolean, nil] :force (nil) overwrite existing files`, `@param name [String] the branch
138
+ name`, `@return [String] the result`, `@raise [ArgumentError] when no name is provided`)
139
+
140
+ For tags, the **summary text** is the description that follows the tag
141
+ metadata (tag name, `[Type]`, option key, and `(default)`). For example, in:
142
+
143
+ ```
144
+ @option options [Boolean, nil] :ignore_case (nil) ignore case distinctions
145
+ ```
146
+
147
+ the summary text is `ignore case distinctions`.
148
+
149
+ **Tag line and summary length**
150
+
151
+ Every physical YARD doc line should not exceed `LINE_LIMIT`. When a tag's
152
+ description would push a line past `LINE_LIMIT`, split it at a word boundary
153
+ onto a continuation line indented two extra spaces. For content that cannot
154
+ be wrapped (URLs, long inline code spans, long `[Type]` expressions,
155
+ `@example` code lines, markdown table rows), lines may extend up to
156
+ `LINE_MAX` but must not exceed it.
157
+
158
+ Additionally, the concatenated description — the description text from the
159
+ first tag line joined with all continuation lines — must not exceed
160
+ `SUMMARY_LIMIT`. If the concatenated description exceeds `SUMMARY_LIMIT`,
161
+ shorten it and move the excess detail into a paragraph after a blank `#` line.
162
+
163
+ For example, this tag has a description of 84 characters (within
164
+ `SUMMARY_LIMIT`), but the single physical line is 102 characters (exceeds
165
+ `LINE_LIMIT`) and must be split:
166
+
167
+ ```ruby
168
+ # @return [Array] a two-element tuple `[target, options]` containing the translated checkout arguments
169
+ ```
170
+
171
+ Split so each physical line fits within `LINE_LIMIT`:
172
+
173
+ ```ruby
174
+ # @return [Array] a two-element tuple `[target, options]` containing the
175
+ # translated checkout arguments
176
+ ```
177
+
178
+ If the tag metadata itself is long (e.g. a long `[Type]` or `@option` key),
179
+ start the description on an indented continuation line so only the metadata
180
+ appears on the first physical line.
181
+
182
+ If more explanation is needed, add continuation paragraphs after a blank
183
+ comment line (`#`). Every physical line — in the summary and in any
184
+ continuation paragraph — must independently fit within `LINE_LIMIT`
185
+ (or `LINE_MAX` for unwrappable content such as URLs, long inline code
186
+ spans, long `[Type]` expressions, `@example` code, or table rows).
187
+
188
+ These rules apply equally to tag text (`@param`, `@return`, etc.) — the first
189
+ sentence of a tag is its short description. The no-punctuation rule applies only to
190
+ short descriptions; continuation paragraphs use normal prose punctuation (periods).
191
+ Separate continuation paragraphs with a blank comment line.
192
+
193
+ Correct — tag title without punctuation, blank line before continuation:
194
+
195
+ ```ruby
196
+ # @option options [Boolean, nil] :ignore_case (nil) ignore case
197
+ # distinctions in both the pattern and the file contents
198
+ #
199
+ # Alias: :i
200
+ #
201
+ # @option options [String, Array<String>] :pattern the search pattern
202
+ # (required; must not be nil)
203
+ #
204
+ # Pass a String for a simple pattern (emitted as `-e <pattern>`).
205
+ # Pass an Array of raw CLI arguments for compound boolean
206
+ # expressions.
207
+ #
208
+ # @return [Git::CommandLineResult] the result of calling `git grep`
209
+ #
210
+ # Exit status 0 means matches were found; exit status 1 means no
211
+ # lines were selected (not an error).
212
+ ```
213
+
214
+ Incorrect — trailing period on title, missing blank line before continuation, and `@return` concatenated summary exceeds `SUMMARY_LIMIT` (132 chars):
215
+
216
+ ```ruby
217
+ # @option options [Boolean, nil] :ignore_case (nil) ignore case
218
+ # distinctions in both the pattern and the file contents.
219
+ # Alias: :i
220
+ #
221
+ # @return [Git::CommandLineResult] the result of calling `git grep`.
222
+ # Exit status 0 means matches were found; exit status 1 means no
223
+ # lines were selected (not an error).
224
+ ```
225
+
226
+ **`@return` must always include a type**
227
+
228
+ Every `@return` tag must include a `[Type]` specifier. `@return the value` is
229
+ incorrect; write `@return [Object] the value` (or a more specific type). If the
230
+ return value is the block's return value, use `@return [Object]`.
231
+
232
+ **No shell calls in `@example` blocks**
233
+
234
+ Never use backtick shell calls (`` `true` ``, `` `git version` ``) or process-status
235
+ globals (`$?`, `$CHILD_STATUS`) in `@example` blocks. They are side-effecting,
236
+ environment-dependent, and confuse readers about the type of object being
237
+ demonstrated. Construct example objects directly in Ruby instead:
238
+
239
+ Incorrect:
240
+
241
+ ```ruby
242
+ # @example Incorrect shell call
243
+ # `true`
244
+ # result = Git::CommandLine::Result.new([], $?, '', '')
245
+ ```
246
+
247
+ Correct:
248
+
249
+ ```ruby
250
+ # @example Constructing a result with a double
251
+ # status = instance_double(ProcessExecuter::Result)
252
+ # result = Git::CommandLine::Result.new([], status, '', '')
253
+ ```
254
+
255
+ **Blank lines within `@example` blocks**
256
+
257
+ Within `@example` blocks, blank comment lines (`#`) render as literal blank lines in
258
+ the displayed code. Use them for readability between setup and assertions, but be
259
+ aware they are literal content, not tag separators.
260
+
261
+ **`@example` titles are required**
262
+
263
+ Every `@example` tag must include a title — the descriptive text on the same line
264
+ after `@example`. Write `@example Basic usage`, not bare `@example`. Titles appear
265
+ as headings in generated docs and help readers scan multiple examples.
266
+
267
+ **Cross-reference links only resolve to objects included in generated docs**
268
+
269
+ YARD renders `{ClassName#method}` as a hyperlink only when the target method is
270
+ included in the generated documentation. Public objects are included by default,
271
+ and objects marked with `@api private` remain included with a private annotation.
272
+ Ruby private methods are excluded by default. Do not write
273
+ `{Git::Lib#some_private_method}` — it will render as plain text and may generate
274
+ an unresolved reference warning.
275
+
276
+ If you need to refer to a private method, describe it in prose instead, or link to
277
+ the public method that callers should use.
278
+
279
+ **Inline code formatting**
280
+
281
+ Use backtick code spans for inline code (`` `true` ``, `` `nil` ``, symbols, type
282
+ names, method calls). Do not use the RDoc `+value+` style; it is inconsistent with
283
+ the project's markdown rendering via redcarpet.
284
+
285
+ **Escaping `{` in descriptions**
286
+
287
+ YARD treats `{` as the start of a cross-reference link. Because redcarpet consumes
288
+ one `\` before YARD sees it, write `\\{` (two backslashes) to produce a literal
289
+ `{` — redcarpet reduces `\\` to `\`, leaving `\{` for YARD. For example, use
290
+ `'stash@\\{0}'` to render as `stash@{0}`. Using only `\{` still triggers a YARD
291
+ unresolved link warning.
292
+
293
+ **Cross-reference links**
294
+
295
+ Link to other code objects anywhere in a doc comment using `{ClassName}`,
296
+ `{ClassName#method}`, `{#method_in_same_class}`, or `{Class::CONSTANT}`. An
297
+ optional title follows the reference separated by a space:
298
+ `{Git::Base#log the log method}`. Do not use brace syntax inside `@see` tags —
299
+ `@see` links automatically without braces. `@see` accepts three target forms:
300
+
301
+ - Code objects: `@see Git::Base#log`
302
+ - URLs: `@see https://git-scm.com/docs/git-log`
303
+ - Quoted text: `@see "Pro Git, Chapter 2"`
304
+
305
+ **Type specifier conventions**
306
+
307
+ The `[Types]` field in `@param`, `@return`, `@raise`, etc. supports:
308
+
309
+ - Plain types: `[String]`, `[Integer]`, `[Git::Base]`
310
+ - Multiple types: `[String, nil]`, `[String, Array<String>]`
311
+ - Parametrized types: `[Array<String>]`, `[Hash<Symbol, String>]`
312
+ - Duck-types (responds to): `[#read]`, `[#to_s]`
313
+ - `[Boolean]` — conventional meta-type for `true` or `false` (not a real Ruby class)
314
+ - `[void]` — for `@return` tags on methods whose return value must not be used
315
+
316
+ **`@api private` vs `@private`**
317
+
318
+ Use `@api private` (not `@private`) to mark internal classes and modules. `@api
319
+ private` includes the object in generated docs with a private annotation; YARD's
320
+ `@private` tag excludes the object from docs entirely.
321
+
322
+ **`@since` — do not use**
323
+
324
+ Do not add `@since` tags. The project has no historical `@since` annotations, and
325
+ retroactively tagging existing APIs is impractical at v4.x. Version introduction
326
+ history is tracked through git blame and the CHANGELOG instead.
327
+
328
+ **`@todo` — do not use**
329
+
330
+ Do not add `@todo` tags. Track incomplete work in GitHub Issues, not in source
331
+ comments. YARD renders `@todo` prominently in generated docs, and these annotations
332
+ go stale quickly.
333
+
334
+ **`@abstract`**
335
+
336
+ Use `@abstract` on classes or methods that must be subclassed or overridden before
337
+ use. Include guidance text describing what the subclass must implement:
338
+ `@abstract Subclass and implement {#run}`. Do not use `@abstract` on concrete
339
+ classes or fully implemented methods.
340
+
341
+ ### Element-Specific Rules
342
+
343
+ **Classes**
344
+
345
+ - One-sentence class description as a **noun phrase** (or starting with "Represents…") — the description should pass
346
+ the "This class is a…" litmus test (i.e. you should be able to prefix "This class
347
+ is a" and produce a grammatical sentence). "Represents…" is an accepted convention.
348
+ Do not start descriptions with "This class is…", "Provides…", or "Encapsulates…".
349
+ - Good: `Wrapper around the git binary`, `Immutable value object for a branch
350
+ delete result`, `Represents a git branch`
351
+ - Bad: `This class wraps the git binary`, `Provides branch deletion`,
352
+ `Encapsulates branch state`
353
+ - `@api public` or `@api private` tag to declare visibility — use `@api public` for
354
+ stable user-facing classes; use `@api private` for internal implementation classes
355
+ (e.g., `Git::Lib`, `Git::Commands::*`, parsers)
356
+ - At least one `@example` showing typical instantiation or primary usage — this
357
+ applies to all classes including `@api private` classes
358
+ - Error/exception classes must also state when the error is raised in class-level
359
+ prose, using caller-facing wording such as `Raised when branch deletion fails`
360
+ - Deprecated classes must include `@deprecated` explaining the migration path
361
+ - When present, class-level tags must appear in this order: `@example`, `@note`,
362
+ `@deprecated`, `@see`, `@api`, `@abstract`
363
+
364
+ **Modules**
365
+
366
+ - One-sentence description — "Namespace for…", "Provides helpers for…", or
367
+ "Mixin that adds…"
368
+ - `@api public` or `@api private` — use `@api public` for stable user-facing modules;
369
+ use `@api private` for internal implementation modules
370
+ - No `@example` required unless the module provides standalone methods
371
+ - Deprecated modules must include `@deprecated` explaining the migration path
372
+ - When present, module-level tags must appear in the same order as class-level
373
+ tags: `@example`, `@note`, `@deprecated`, `@see`, `@api`
374
+
375
+ **Constants**
376
+
377
+ - A comment immediately above the constant describing its purpose and valid values
378
+ - No special YARD tag is needed; YARD picks up the preceding comment automatically
379
+ - Add `# @return [Type]` when the constant holds a collection, frozen structure, or
380
+ domain-specific type whose shape is not immediately obvious from the value
381
+
382
+ **Attributes**
383
+
384
+ - For explicitly written `attr_reader`, `attr_accessor`, and `attr_writer` declarations,
385
+ place the documentation directly above the attribute; do **not** use the `@!attribute`
386
+ directive
387
+ - For dynamically created attributes, `Data.define` members, or `Struct.new`
388
+ members, you **must** use a `# @!attribute [r/rw/w] name` YARD directive
389
+ - Must include `@return [Type] description` explaining the value and its units or
390
+ constraints if relevant
391
+ - For explicit `attr_reader`/`attr_accessor`/`attr_writer`, include a short
392
+ description paragraph above the attribute in addition to `@return`
393
+ - For `@!attribute` directives (in `Data.define` / `Struct.new`), the `@return`
394
+ tag inside the directive block serves as the sole documentation — no separate
395
+ short description is needed
396
+ - Tags inside `@!attribute` (and `@!method`) directive blocks must be indented
397
+ two extra spaces relative to the directive itself
398
+ - Must be defined at the class level, not inside method bodies
399
+
400
+ **Dynamically defined methods (`@!method`)**
401
+
402
+ Use the `# @!method name(params)` directive for methods created via
403
+ metaprogramming (`define_method`, method-generating DSLs, etc.) that have no
404
+ literal `def`. Place the directive and its doc comment where the method would
405
+ logically appear in the class body. Tags inside the directive block follow the
406
+ same indentation rule as `@!attribute` — indented two extra spaces relative to
407
+ the directive.
408
+
409
+ **`Data.define` classes**
410
+
411
+ Immutable value objects defined with `Data.define` use the following conventions
412
+ (see `Git::BranchDeleteFailure` for a canonical example):
413
+
414
+ - Class-level doc: noun-phrase short description, `@example`, `@see`, `@api`
415
+ - One `@!attribute [r]` directive per member with `@return [Type] description`
416
+ - Attribute directives are placed after class-level tags and before the
417
+ `Data.define` line
418
+ - Custom methods defined inside the `Data.define` block follow standard method
419
+ rules
420
+
421
+ **`Struct.new` classes**
422
+
423
+ Document `Struct.new` classes using the same conventions as `Data.define` classes:
424
+ class-level doc with a noun-phrase short description, `@example`, `@see`, `@api`,
425
+ and one `@!attribute` directive per member with `@return [Type] description`.
426
+
427
+ ```ruby
428
+ # Immutable value object for a failed branch delete
429
+ #
430
+ # @example Create a failure object
431
+ # failure = Git::BranchDeleteFailure.new(name: 'feature', result: result)
432
+ # failure.name #=> "feature"
433
+ # failure.result #=> #<Git::CommandLineResult ...>
434
+ #
435
+ # @see Git::BranchDeleteResult
436
+ #
437
+ # @api public
438
+ #
439
+ # @!attribute [r] name
440
+ #
441
+ # @return [String] the branch name that failed to delete
442
+ #
443
+ # @!attribute [r] result
444
+ #
445
+ # @return [Git::CommandLineResult] the result of the failed delete
446
+ #
447
+ BranchDeleteFailure = Data.define(:name, :result)
448
+ ```
449
+
450
+ **Methods**
451
+
452
+ - All methods must have a short description that:
453
+ - Starts with a verb (`Returns`, `Resets`, `Finds` — not "The…" or "This method…")
454
+ - Omits the subject — write "Returns the commit count", not "This method returns
455
+ the commit count"
456
+ - States the outcome, not the mechanism — `Finds the nearest tagged ancestor` not
457
+ `Iterates through commits checking tags`
458
+ - Mentions key parameters inline — `Resets HEAD to the given ref` rather than
459
+ relying solely on param tags
460
+ - Avoids restating the method name — add specificity about what kind, from where,
461
+ or what is returned
462
+ - Is specific about return values — `Returns true if the branch exists, false
463
+ otherwise` beats `Returns a Boolean`
464
+ - Omits implementation details — callers don't care about internal loops or temp
465
+ variables
466
+ - Methods use these standard YARD tags:
467
+ - `@param` for each method parameter, in signature order; omit `@param` entirely
468
+ on zero-argument methods
469
+ - `@return` on every method; use `[void]` when the return value must not be used
470
+ - `@raise` for each caller-relevant exception the method can raise as part of its
471
+ contract; omit `@raise` when the method has no documented exceptional path
472
+ - Methods without Ruby `private` visibility must have one or more `@example`s;
473
+ Ruby-private methods may omit `@example` unless usage would otherwise be unclear
474
+ - Methods that yield to a block must include `@yield [param_names]`, one
475
+ `@yieldparam name [Type]` per yielded parameter, and `@yieldreturn [Type]`; omit
476
+ all yield tags on methods that do not yield
477
+ - Use `@overload` when a method has distinct call signatures with different
478
+ parameters or return types — each overload gets its own full set of tags.
479
+ Methods that yield only when an optional block is given should use `@overload`
480
+ to document the with-block and without-block signatures separately
481
+ - Methods whose signature uses an **anonymous keyword splat** (`**`),
482
+ **anonymous positional splat** (`*`), or the **argument forwarding
483
+ parameter** (`...`) must document their call shapes with `@overload` blocks
484
+ that name the parameters. `@param`, `@option`, `@yield`, and `@yieldparam`
485
+ cannot bind to an anonymous splat or to `...` — the named overload signature
486
+ is what gives YARD a parameter to attach the docs to. Do **not** introduce a
487
+ named splat (or expand `...` into `*args, **kwargs, &block`) solely so the
488
+ tags will bind; that conflicts with RuboCop's `Style/ArgumentsForwarding`
489
+ cop, and the `@overload` form satisfies both
490
+ - Use `@note` for callouts that need visual emphasis: thread-safety warnings,
491
+ significant side effects, or platform-specific behaviour
492
+ - Deprecated methods must include `@deprecated` explaining the migration path,
493
+ e.g. `@deprecated Use {#new_method} instead`
494
+ - `@api` is optional on methods — when omitted, the method inherits the containing
495
+ class's `@api` level. Use it only when the method's intended visibility differs
496
+ from the class's level (e.g. an `@api private` helper inside an `@api public`
497
+ class)
498
+
499
+ ## Step 1: Identify What Needs Documentation
500
+
501
+ ```bash
502
+ # Find undocumented objects
503
+ bundle exec yard stats --list-undoc
504
+
505
+ # Check a specific file
506
+ bundle exec yard doc lib/git/base.rb --no-output
507
+ ```
508
+
509
+ ## Step 2: Write Documentation
510
+
511
+ Follow the YARD documentation templates below. Use the **standard template** when a
512
+ method has a single call signature. Use the **overload template** when a method has
513
+ distinct call signatures with different parameters or return types.
514
+
515
+ When `@overload` blocks are present:
516
+
517
+ - Keep `@param`, `@option`, and `@return` inside overload blocks only
518
+ - Keep overload-specific `@raise` inside the relevant overload block
519
+ - Keep shared `@raise` at top level only once (do not duplicate inside overloads)
520
+ - Keep non-signature tags (`@note`, `@deprecated`, `@see`, `@api`) at top level
521
+
522
+ Avoid duplicating the same `@raise` at both top level and overload level. This
523
+ causes conflicting or noisy generated docs.
524
+
525
+ **Trigger: always use `@overload` when the signature contains `*`, `**`, or `...`**
526
+
527
+ Anonymous splats and the forwarding parameter give `@param`, `@option`, `@yield`,
528
+ and `@yieldparam` no named parameter to bind to. YARD silently drops or
529
+ mis-renders these tags when the signature is, for example, `def foo(**)` or
530
+ `def foo(paths = '.', **)` — even though `paths` is named, the keyword options
531
+ have no name so every `@option` is unbound. As soon as any parameter in the
532
+ signature is anonymous (`*`, `**`, or `...`), switch to `@overload` for the entire
533
+ signature (see [Documenting anonymous splats with `@overload`](#documenting-anonymous-splats-with-overload)).
534
+
535
+ ### Standard template (no `@overload`)
536
+
537
+ When present, tags must appear in the order shown. `@param` tags appear in
538
+ parameter order; `@option` tags appear immediately after the `@param` for the hash
539
+ they describe. Every `@option` tag **must** be preceded by a `@param` for the
540
+ options hash, and all `@option` tags under that `@param` must reference the same
541
+ parameter name. For keyword arguments (`**options` or `**kwargs`), use
542
+ `@param options [Hash]` (or the actual splat name) as the preceding `@param`:
543
+
544
+ ```ruby
545
+ # Short description of what the method does
546
+ #
547
+ # Longer description with more details about behavior,
548
+ # edge cases, or important notes.
549
+ #
550
+ # @example Basic usage
551
+ # git = Git.open('/path/to/repo')
552
+ # result = git.method_name('arg')
553
+ #
554
+ # @example With options
555
+ # git.method_name('arg', option: true)
556
+ #
557
+ # @param name [Type] description of parameter
558
+ #
559
+ # @param options [Hash] options hash description
560
+ #
561
+ # @option options [Type] :key description of option
562
+ #
563
+ # @param path [String] a parameter after the options hash
564
+ #
565
+ # @return [Type] description of return value
566
+ #
567
+ # @raise [ArgumentError] when invalid arguments are provided
568
+ #
569
+ # @raise [Git::FailedError] when git exits with a non-zero exit status
570
+ #
571
+ # @yield [commit] passes each commit to the block
572
+ #
573
+ # @yieldparam commit [Git::Object::Commit] a commit object
574
+ #
575
+ # @yieldreturn [void]
576
+ #
577
+ # @note This method is not thread-safe
578
+ #
579
+ # @deprecated Use {#new_method} instead
580
+ #
581
+ # @see #related_method
582
+ #
583
+ # @see Git::RelatedClass
584
+ #
585
+ # @see https://git-scm.com/docs/git-log
586
+ #
587
+ # @api public
588
+ #
589
+ def method_name(name, options = {})
590
+ end
591
+ ```
592
+
593
+ ### Overload template
594
+
595
+ Each `@overload` block carries its own `@example`, `@param`, `@option`, `@return`,
596
+ `@raise`, `@yield`, `@yieldparam`, and `@yieldreturn` tags. Tags that are
597
+ **not** call-signature-specific — `@note`, `@deprecated`, `@see`, `@api` — remain
598
+ at the top level:
599
+
600
+ ```ruby
601
+ # Short description of what the method does
602
+ #
603
+ # Longer description with more details about behavior,
604
+ # edge cases, or important notes.
605
+ #
606
+ # @overload method_name(arg)
607
+ #
608
+ # Single-argument form description
609
+ #
610
+ # @example Basic usage
611
+ # result = git.method_name('arg')
612
+ #
613
+ # @param arg [String] the argument
614
+ #
615
+ # @return [String] the result
616
+ #
617
+ # @overload method_name(arg, options)
618
+ #
619
+ # Two-argument form description
620
+ #
621
+ # @example With options
622
+ # result = git.method_name('arg', force: true)
623
+ #
624
+ # @param arg [String] the argument
625
+ #
626
+ # @param options [Hash] additional options
627
+ #
628
+ # @return [Array<String>] the results
629
+ #
630
+ # @note This method is not thread-safe
631
+ #
632
+ # @deprecated Use {#new_method} instead
633
+ #
634
+ # @see #related_method
635
+ #
636
+ # @see https://git-scm.com/docs/git-log
637
+ #
638
+ # @api public
639
+ #
640
+ def method_name(name, options = {})
641
+ end
642
+ ```
643
+
644
+ ### Overload decision matrix
645
+
646
+ Use this matrix to decide whether to use `@overload` and where to place tags:
647
+
648
+ | Method signature or behavior | Documentation form |
649
+ | --- | --- |
650
+ | Single named signature, no `*`/`**`/`...` | Standard template (no `@overload`) |
651
+ | Uses anonymous `*`, `**`, or `...` | `@overload` required |
652
+ | Multiple call shapes (different params and/or return types) | One `@overload` per shape |
653
+ | Shared errors across all call shapes | Top-level `@raise` once |
654
+ | Error only for specific call shape | `@raise` only in that overload |
655
+
656
+ For overload docs, keep `@param`/`@option`/`@return` in overload blocks. Use
657
+ top-level `@raise` only for errors that apply to every overload.
658
+
659
+ ### Documenting anonymous splats with `@overload`
660
+
661
+ When the method signature uses an anonymous splat — `def foo(*)`, `def foo(**)`,
662
+ `def foo(*, **)` — or the argument forwarding parameter `def foo(...)` —
663
+ `@param`, `@option`, `@yield`, and `@yieldparam` tags have no parameter name
664
+ to bind to. RuboCop's `Style/ArgumentsForwarding` cop prefers these forms when
665
+ arguments are forwarded unchanged, so naming the splat (or expanding `...`
666
+ into `*args, **kwargs, &block`) is **not** an acceptable workaround. Use
667
+ `@overload` blocks that introduce named parameters for documentation purposes
668
+ only:
669
+
670
+ ```ruby
671
+ # Update the index with the current content found in the working tree
672
+ #
673
+ # @overload add(paths = '.', **options)
674
+ #
675
+ # @example Stage a specific file
676
+ # git.add('README.md')
677
+ #
678
+ # @param paths [String, Array<String>] file(s) to add (relative to the
679
+ # worktree root); defaults to `'.'` (all files)
680
+ #
681
+ # @param options [Hash] command options
682
+ #
683
+ # @option options [Boolean, nil] :all (nil) add, modify, and remove index entries to
684
+ # match the worktree
685
+ #
686
+ # @option options [Boolean, nil] :force (nil) allow adding otherwise ignored files
687
+ #
688
+ # @return [String] the command output
689
+ #
690
+ # @raise [Git::FailedError] if `git add` exits with a non-zero status
691
+ #
692
+ def add(paths = '.', **)
693
+ Git::Commands::Add.new(@execution_context).call(*Array(paths), **).stdout
694
+ end
695
+ ```
696
+
697
+ The same approach applies to `...`. The overload signature names the
698
+ parameters; the actual `def` keeps `...` so RuboCop is satisfied:
699
+
700
+ ```ruby
701
+ # Run a command against the underlying execution context
702
+ #
703
+ # @overload run(command, *args, **options, &block)
704
+ #
705
+ # @example Run git status
706
+ # result = git.run('status')
707
+ #
708
+ # @param command [String] the git subcommand to run
709
+ #
710
+ # @param args [Array<String>] positional arguments forwarded to the command
711
+ #
712
+ # @param options [Hash] keyword options forwarded to the command
713
+ #
714
+ # @return [Git::CommandLineResult] the command result
715
+ #
716
+ # @yield [result] yields the command result, when a block is given
717
+ #
718
+ # @yieldparam result [Git::CommandLineResult] the command result
719
+ #
720
+ # @yieldreturn [void]
721
+ #
722
+ def run(command, ...)
723
+ Git::Commands::Run.new(@execution_context).call(command, ...)
724
+ end
725
+ ```
726
+
727
+ When a method has multiple genuinely distinct call shapes, write one
728
+ `@overload` block per shape as in the [Overload template](#overload-template)
729
+ above.
730
+
731
+ **Anonymous block parameter (`&`)** is **not** covered by this rule.
732
+ `@yield`, `@yieldparam`, and `@yieldreturn` describe what is yielded to the
733
+ block, not the block parameter itself, so they bind correctly even with an
734
+ anonymous `&`. Use a named block parameter (`&block`) and a `@param block
735
+ [Proc]` tag only in the rare case where the block is documented as a
736
+ first-class `Proc` value (stored, returned, or passed elsewhere) rather than
737
+ yielded to.
738
+
739
+ ## Step 3: Verify Documentation
740
+
741
+ ```bash
742
+ # Generate and review docs
743
+ bundle exec yard doc
744
+ open doc/index.html
745
+
746
+ # Check for warnings
747
+ bundle exec yard doc 2>&1 | grep -i "warn"
748
+ ```
749
+
750
+ Verify `@example` code runs correctly in `bundle exec bin/console`.
751
+ Check that all `@see` references point to valid targets.
752
+
753
+ **Review checklist — tag line length**
754
+
755
+ For every `@param`, `@return`, `@raise`, `@option`, `@yield`, `@yieldparam`,
756
+ and `@yieldreturn` tag, check both limits:
757
+
758
+ 1. **`LINE_LIMIT`**: Count every character from column 1 (indentation, `#`,
759
+ metadata, text) on each physical line. If any wrappable line exceeds
760
+ `LINE_LIMIT`, split at a word boundary onto a continuation line (indented
761
+ two extra spaces). Apply this check to every continuation line
762
+ independently. Lines containing URLs, long inline code spans, long `[Type]`
763
+ expressions, `@example` code, or markdown table rows may extend up to
764
+ `LINE_MAX`.
765
+ 2. **`SUMMARY_LIMIT`**: Strip `# ` from each continuation line and join
766
+ with a single space. If the concatenated description exceeds
767
+ `SUMMARY_LIMIT`, shorten it and move the excess into a paragraph after
768
+ a blank `#` line.
769
+
770
+ ## Command Reference
771
+
772
+ ```bash
773
+ # Generate documentation
774
+ bundle exec yard doc
775
+
776
+ # Generate and serve locally
777
+ bundle exec yard server --reload
778
+
779
+ # Check documentation coverage
780
+ bundle exec yard stats
781
+
782
+ # List undocumented objects
783
+ bundle exec yard stats --list-undoc
784
+
785
+ # Generate docs for specific file
786
+ bundle exec yard doc lib/git/base.rb
787
+
788
+ # Check for YARD syntax errors
789
+ bundle exec yard doc --no-output 2>&1
790
+
791
+ # View documentation for specific class
792
+ bundle exec yard ri Git::Base
793
+ ```