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,214 @@
1
+ ---
2
+ name: review-arguments-dsl
3
+ description: "Audits a command class's arguments DSL definition to verify it accurately maps Ruby call arguments to git CLI arguments in the correct order with correct DSL methods and modifiers."
4
+ ---
5
+
6
+ # Review Arguments DSL
7
+
8
+ Verify that a command class's `arguments do ... end` definition accurately maps Ruby
9
+ call arguments to git CLI arguments, in the correct order, with the correct DSL
10
+ methods and modifiers.
11
+
12
+ ## Contents
13
+
14
+ - [Contents](#contents)
15
+ - [Related skills](#related-skills)
16
+ - [Input](#input)
17
+ - [Command source code](#command-source-code)
18
+ - [Command test code](#command-test-code)
19
+ - [Git documentation for the git command](#git-documentation-for-the-git-command)
20
+ - [Reference](#reference)
21
+ - [Architecture Context (Base Pattern)](#architecture-context-base-pattern)
22
+ - [DSL to CLI Mapping](#dsl-to-cli-mapping)
23
+ - [Workflow](#workflow)
24
+ - [Output](#output)
25
+
26
+ ## Related skills
27
+
28
+ - [Command Implementation](../command-implementation/SKILL.md) — class structure, phased rollout gates, and
29
+ internal compatibility contracts
30
+ - [Command Test Conventions](../command-test-conventions/SKILL.md) — unit/integration test conventions for command classes
31
+ - [Command YARD Documentation](../command-yard-documentation/SKILL.md) — documentation completeness for command classes
32
+
33
+ ## Input
34
+
35
+ What the agent requires to run this skill and where to get it.
36
+
37
+ ### Command source code
38
+
39
+ Read the command class from `lib/git/commands/{command}.rb` or, for subcommands,
40
+ `lib/git/commands/{command}/{subcommand}.rb`. For subcommands, also read the
41
+ namespace module at `lib/git/commands/{command}.rb` which should list all sibling
42
+ subcommands and provide the module-level documentation.
43
+
44
+ ### Command test code
45
+
46
+ Read unit tests matching `spec/unit/git/commands/{command}/**/*_spec.rb`. Use these as
47
+ supplemental evidence when tracing the verification chain (Ruby call → bound
48
+ argument → expected git CLI). Coverage completeness is assessed by the
49
+ [Command Test Conventions](../command-test-conventions/SKILL.md) skill.
50
+
51
+ ### Git documentation for the git command
52
+
53
+ - **Latest-version online command documentation**
54
+
55
+ Read the **entire** official git documentation online man page for the command
56
+ for the latest version of git. This version will be used as the primary
57
+ authority for DSL completeness, including the options to include in the
58
+ DSL, argument names, aliases, ordering, etc.
59
+ Fetch this version from the URL `https://git-scm.com/docs/git-{command}`
60
+ (this URL always serves the latest release).
61
+
62
+ - **Minimum-version online command documentation**
63
+
64
+ Read the **entire** official git documentation online man page for the command for
65
+ the `Git::MINIMUM_GIT_VERSION` version of git. This will be used only for
66
+ command-introduction and `requires_git_version` decisions. Fetch this version from
67
+ URL `https://git-scm.com/docs/git-{command}/{version}`.
68
+
69
+ Do **not** scaffold from local `git <command> -h` output alone — the installed Git
70
+ version is unknown and may differ from the latest supported version. Local help should
71
+ NOT be used even as a supplemental check.
72
+
73
+ ## Reference
74
+
75
+ ### Architecture Context (Base Pattern)
76
+
77
+ Command classes follow this structure:
78
+
79
+ - `class < Git::Commands::Base`
80
+ - class-level `arguments do ... end`
81
+ - optional class-level macros such as `allow_exit_status <range>` and
82
+ `requires_git_version <version>`
83
+ - YARD documentation with `@overload` blocks containing `@param`, `@option`,
84
+ `@return`, and `@raise` tags, in one of two forms:
85
+ - **when `#call` is overridden:** standard YARD comments directly above `def call`
86
+ - **when `#call` is not overridden:** a `# @!method call(*, **)` directive with
87
+ nested standard YARD comments
88
+
89
+ The CLI argument mapping is still defined exclusively by the Arguments DSL. The
90
+ `Base` class handles binding and execution.
91
+
92
+ ### DSL to CLI Mapping
93
+
94
+ <!--
95
+ Purpose: gives the agent the mental model for predicting CLI output from a
96
+ DSL definition — the mapping rules needed to execute the verification chain
97
+ (Ruby call → bound argument → expected git CLI).
98
+
99
+ CHECKLIST.md works in the reverse direction: given git man-page behavior,
100
+ which DSL method and modifiers to use.
101
+ -->
102
+
103
+ The Arguments DSL (`arguments do ... end`) declares how Ruby keyword and positional
104
+ arguments map to git CLI flags, options, and operands. See [CHECKLIST.md §
105
+ Verify DSL method per option type](CHECKLIST.md#2-verify-dsl-method-per-option-type)
106
+ for the full DSL method mapping table.
107
+
108
+ Key behaviors:
109
+
110
+ - **Basic emit** — `flag_option :verbose` → `--verbose`; `value_option :message` →
111
+ `--message <value>`; `operand :commit` → bare `<value>` in positional slot.
112
+ - **`flag_or_value_option`** — hybrid: `true` → `--flag`; string → `--flag value`
113
+ (or `--flag=value` with `inline:`); `false`/`nil` → nothing. Supports `negatable:`.
114
+ - **`key_value_option`** — accepts a Hash or Array of pairs; emits `--flag key=value`
115
+ per pair. `key_separator:` overrides `=`; `inline:` joins as `--flag=key=value`.
116
+ - **`custom_option`** — block receives the raw value and returns CLI strings; String
117
+ is appended, Array is concatenated, `nil`/empty emits nothing.
118
+ - **nil / false suppression** — for boolean-style options (`flag_option`,
119
+ `flag_or_value_option` in boolean mode), `false` or `nil` suppresses emission.
120
+ For `value_option` / `inline_value` options, `false` is treated as a value
121
+ (stringified to `"false"`) unless a type constraint rejects it. `nil` suppresses
122
+ emission for all option types (including negatable options — `false` is absent,
123
+ not `--no-*`).
124
+ - **Output order matches definition order** — bound arguments are emitted in the
125
+ order entries appear in `arguments do`.
126
+ - **Name-to-flag mapping** — underscores become hyphens, single-char names map to
127
+ `-x`, multi-char names map to `--name`. **Case is preserved**: `:A` → `-A`, `:N` →
128
+ `-N`. Uppercase short flags do not require `as:`.
129
+ - **`as:` override** — emits a verbatim string instead of deriving the flag from the
130
+ symbol name. See [CHECKLIST.md § The `as:` escape
131
+ hatch](CHECKLIST.md#the-as-escape-hatch) for when use is justified.
132
+ - **Aliases** — first alias is canonical and determines the generated flag; remaining
133
+ aliases are accepted as caller-side synonyms. Long name first:
134
+ `%i[force f]`, not `%i[f force]`.
135
+ - **`negatable:`** — registers two entries: the positive key and a `no_` companion.
136
+ Both follow standard boolean semantics: `true` emits the flag, `false`/`nil` omits
137
+ it. Pass `no_edit: true` to emit `--no-edit`.
138
+ - `flag_option :edit, negatable: true` → `:edit` `[Boolean]` and `:no_edit`
139
+ `[Boolean]`
140
+ - `flag_or_value_option :track, negatable: true` → `:track` `[Boolean, String]`
141
+ (positive or value form) and `:no_track` `[Boolean]` (boolean only; the negated
142
+ form never takes a value)
143
+ - **`inline:`** — `value_option :format, inline: true` emits `--format=value` as one
144
+ token; without it, `--format value` as two tokens.
145
+ - **`max_times:`** — `flag_option :force, max_times: 2` with `force: 2` emits
146
+ `--force --force`.
147
+ - **`repeatable:`** — accepts an array; emits the flag once per value
148
+ (e.g., `--include a --include b`).
149
+ - **`as_operand:`** — `value_option :pathspec, as_operand: true` is passed as a
150
+ keyword but emitted in the operand position after `end_of_options`.
151
+ - **`literal`** — always emits its string unconditionally; the caller has no control.
152
+ - **`execution_option`** — never emits anything to argv; forwarded as Ruby kwargs to
153
+ the subprocess runner.
154
+ - **`skip_cli:` on operands** — `operand ..., skip_cli: true` binds and validates
155
+ like any other operand and remains accessible on `Bound`, but is excluded from argv
156
+ emission.
157
+ - **`end_of_options`** — signals end of options in the emitted argv; only operands
158
+ may follow (though operands may also appear before it). Emits `--` by default.
159
+ Override with `as:` when the command uses a different token. See [CHECKLIST.md §
160
+ Choosing the `as:` token](CHECKLIST.md#choosing-the-as-token) for the decision
161
+ rule.
162
+ - **Operand/option name collision** — if a positional operand and a keyword option
163
+ share the same name, the **option keeps its name** and the **operand is renamed**.
164
+ For repeatable operands, prefer the plural form (`:commit` → `:commits`). See
165
+ [CHECKLIST.md § Operand naming](CHECKLIST.md#operand-naming) for details.
166
+
167
+ ## Workflow
168
+
169
+ 1. **Determine scope and exclusions** — using the git documentation loaded during
170
+ [Input](#input), identify which options are in scope for the DSL. See
171
+ [CHECKLIST.md §1](CHECKLIST.md#1-determine-scope-and-exclusions).
172
+
173
+ 2. **Audit each DSL entry** — for each entry in `arguments do`, walk through
174
+ [CHECKLIST.md](CHECKLIST.md) §2–§5:
175
+ 1. Verify DSL method per option type
176
+ 2. Verify alias and `as:` usage
177
+ 3. Verify ordering
178
+ 4. Verify modifiers
179
+
180
+ For each entry, also trace the verification chain — confirm the full mapping:
181
+
182
+ `Ruby call → bound argument → expected git CLI`
183
+
184
+ Compare the expected CLI output against the git man-page documentation.
185
+
186
+ 3. **Check completeness** — verify the DSL as a whole against the git man page per
187
+ [CHECKLIST.md §6](CHECKLIST.md#6-check-completeness): YARD↔DSL parity, missing
188
+ options, repeatable flags, operand naming, and per-argument validation.
189
+
190
+ 4. **Check class-level declarations** — verify `allow_exit_status` and
191
+ `requires_git_version` per
192
+ [CHECKLIST.md §7](CHECKLIST.md#7-check-class-level-declarations).
193
+
194
+ 5. **Check the validation delegation policy** — verify that cross-argument
195
+ constraint methods (`conflicts`, `requires`, etc.) are used only when
196
+ justified. See the constraint policy in
197
+ [CHECKLIST.md §6 Per-argument validation completeness](CHECKLIST.md#per-argument-validation-completeness).
198
+
199
+ 6. **Collect issues** — record all findings for the [Output](#output).
200
+
201
+ ## Output
202
+
203
+ Produce:
204
+
205
+ 1. A per-entry table:
206
+
207
+ | # | DSL method | Definition | CLI output | Correct? | Issue |
208
+ | --- | --- | --- | --- | --- | --- |
209
+
210
+ 2. A list of missing options/modifier/order/conflict issues
211
+ 3. Any class-level declaration mismatches: `allow_exit_status` not present with
212
+ a `Range` and rationale comment when the command has non-zero successful
213
+ exits; `requires_git_version` not present only when the command was
214
+ introduced after `Git::MINIMUM_GIT_VERSION`
@@ -0,0 +1,275 @@
1
+ ---
2
+ name: review-backward-compatibility
3
+ description: "Audits Git::Lib methods for backward compatibility after commands are moved to Git::Commands::* classes. Use to verify that migrated commands maintain their existing public API."
4
+ ---
5
+
6
+ # Review Backward Compatibility
7
+
8
+ Review `Git::Lib` methods for backward compatibility after commands are moved to
9
+ `Git::Commands::*` classes. This skill guides the process of restoring backward
10
+ compatibility for a specific set of git commands while maintaining the benefits of
11
+ the new command infrastructure.
12
+
13
+ ## Contents
14
+
15
+ - [How to use this skill](#how-to-use-this-skill)
16
+ - [Related skills](#related-skills)
17
+ - [Objective](#objective)
18
+ - [Current Command Architecture Note](#current-command-architecture-note)
19
+ - [Instructions](#instructions)
20
+ - [Branch setup](#branch-setup)
21
+ - [Step 1: Identify Methods Added Since v4.3.0](#step-1-identify-methods-added-since-v430)
22
+ - [Step 2: Remove New Methods](#step-2-remove-new-methods)
23
+ - [Step 3: Restore Backward-Compatible Implementations](#step-3-restore-backward-compatible-implementations)
24
+ - [Step 4: Add Required Dependencies](#step-4-add-required-dependencies)
25
+ - [Step 5: Verify the Changes](#step-5-verify-the-changes)
26
+ - [Example: Stash Commands](#example-stash-commands)
27
+ - [Legacy Methods (v4.3.0)](#legacy-methods-v430)
28
+ - [New Methods (removed)](#new-methods-removed)
29
+ - [Implementation Pattern](#implementation-pattern)
30
+ - [Key Principles](#key-principles)
31
+ - [Validation Checklist](#validation-checklist)
32
+ - [Usage](#usage)
33
+
34
+ ## How to use this skill
35
+
36
+ Attach this file to your Copilot Chat context, then invoke it with the git
37
+ command name(s) to audit. Example:
38
+
39
+ ```text
40
+ Remove methods added to Git::Lib since v4.3.0 for the `branch` git command
41
+ and ensure the remaining methods are backward compatible.
42
+ ```
43
+
44
+ Replace `branch` with the specific git command(s) you want to audit (e.g.,
45
+ `worktree`, `tag`, `merge`, `reset`).
46
+
47
+ ## Related skills
48
+
49
+ - [Refactor Command to CommandLineResult](../refactor-command-to-commandlineresult/SKILL.md) — migrating command classes to Base;
50
+ the counterpart to this skill's `Git::Lib` facade focus
51
+ - [Command Implementation](../command-implementation/SKILL.md) — class structure, phased rollout gates, and
52
+ internal compatibility contracts
53
+
54
+ ## Objective
55
+
56
+ For the specified git command(s), remove methods added to `Git::Lib` since v4.3.0 and ensure that remaining methods (which existed in v4.3.0) are backward compatible.
57
+
58
+ ## Current Command Architecture Note
59
+
60
+ When auditing modern implementations, assume command classes follow `Git::Commands::Base`:
61
+
62
+ - classes use `class < Git::Commands::Base` with `arguments do ... end`
63
+ - command entrypoint is `call(*, **)` (inherited from `Base`)
64
+ - exit-status behavior is centralized via `allow_exit_status` declarations on the class
65
+
66
+ Because of this, backward-compatibility adaptation should happen in `Git::Lib`
67
+ methods (facade/adapter layer), not by reintroducing legacy execution logic inside
68
+ command classes.
69
+
70
+ ## Instructions
71
+
72
+ ### Branch setup
73
+
74
+ All work must be done on a feature branch. **Never commit or push directly to
75
+ `main`.**
76
+
77
+ Before starting, create a new branch:
78
+
79
+ ```bash
80
+ git checkout -b <feature-branch-name>
81
+ ```
82
+
83
+ All commits in this workflow go on the feature branch. When work is complete,
84
+ open a pull request — do not merge or push directly into `main`.
85
+
86
+ ### Step 1: Identify Methods Added Since v4.3.0
87
+
88
+ 1. Check out the v4.3.0 tag to examine the historical state:
89
+
90
+ **Warning:** `git checkout` modifies the working tree. Stash or commit any
91
+ uncommitted changes first (`git stash`).
92
+
93
+ ```bash
94
+ git checkout v4.3.0
95
+ ```
96
+
97
+ 2. Search `lib/git/lib.rb` for all methods related to the specified git command(s):
98
+ ```bash
99
+ grep -n "def <command_name>" lib/git/lib.rb
100
+ ```
101
+
102
+ 3. Document each method found, including:
103
+ - Method name and signature
104
+ - Return value type (String, Array, Hash, Boolean, etc.)
105
+ - Exact return value format (e.g., `Array<[Integer, String]>`, `String` with specific content)
106
+
107
+ 4. Return to your feature branch:
108
+ ```bash
109
+ git checkout -
110
+ ```
111
+
112
+ 5. Search for the same command methods in the current version:
113
+ ```bash
114
+ grep -n "def <command_name>" lib/git/lib.rb
115
+ ```
116
+
117
+ 6. Create two lists:
118
+ - **Legacy methods**: Methods that existed in v4.3.0 (must be preserved and made compatible)
119
+ - **New methods**: Methods that don't exist in v4.3.0 (should be removed)
120
+
121
+ ### Step 2: Remove New Methods
122
+
123
+ 1. Identify all new methods that were added after v4.3.0
124
+ 2. Remove these methods entirely from `lib/git/lib.rb`
125
+ 3. Remove any `require` statements that are only used by the removed methods
126
+
127
+ ### Step 3: Restore Backward-Compatible Implementations
128
+
129
+ For each legacy method that needs to be preserved:
130
+
131
+ 1. **Use modern command infrastructure internally:**
132
+ - Call the appropriate `Git::Commands::<Command>::*` class
133
+ - Ensure all necessary command classes are required at the top of the file
134
+
135
+ 2. **Convert return values to match v4.3.0 exactly:**
136
+ - Compare the return type from the modern command with the v4.3.0 return type
137
+ - If they differ, add conversion logic to transform the result
138
+ - Modern commands typically return `CommandLineResult` objects with `.stdout`, `.stderr`, and `.status`
139
+ - Legacy methods may have returned raw strings, arrays, or other types
140
+
141
+ 3. **Create helper methods if needed:**
142
+ - For complex conversions (e.g., parsing output into specific formats), create private helper methods
143
+ - Name helpers clearly (e.g., `<command>_info_to_legacy`)
144
+ - Place helpers near the bottom of the file in the private section
145
+
146
+ ### Step 4: Add Required Dependencies
147
+
148
+ 1. Ensure all necessary `require` statements are present:
149
+ ```ruby
150
+ require_relative 'git/commands/<command>/<action>'
151
+ require_relative 'git/parsers/<command>' # if using parsers
152
+ ```
153
+
154
+ 2. Only keep requires for:
155
+ - Command classes used by the legacy methods
156
+ - Parsers needed for conversion
157
+ - Remove requires for deleted commands
158
+
159
+ ### Step 5: Verify the Changes
160
+
161
+ 1. Check the diff to ensure:
162
+ ```bash
163
+ git diff lib/git/lib.rb
164
+ ```
165
+ - All new methods are removed
166
+ - All legacy methods are present with correct signatures
167
+ - Return value conversions are in place
168
+ - Correct require statements are present
169
+
170
+ 2. Verify that the implementation uses modern command classes:
171
+ ```bash
172
+ git diff lib/git/lib.rb | grep -E "^\+.*Git::Commands::<Command>"
173
+ ```
174
+
175
+ 3. Check the net line change (should be negative if removing methods):
176
+ ```bash
177
+ git diff --stat lib/git/lib.rb
178
+ ```
179
+
180
+ ## Example: Stash Commands
181
+
182
+ Here's how this process was applied to the `stash` commands:
183
+
184
+ ### Legacy Methods (v4.3.0)
185
+ - `stashes_all` → returned `Array<[Integer, String]>` (index and message pairs)
186
+ - `stash_save(message)` → returned regex match result (truthy/falsy)
187
+ - `stash_apply(id)` → returned `String` (stdout)
188
+ - `stash_clear` → returned `String` (stdout)
189
+ - `stash_list` → returned `String` (stdout)
190
+
191
+ ### New Methods (removed)
192
+ - `stash_branch`
193
+ - `stash_create`
194
+ - `stash_drop`
195
+ - `stash_pop`
196
+ - `stash_push`
197
+ - `stashes_list`
198
+ - `git_stash_show_*` methods
199
+
200
+ ### Implementation Pattern
201
+
202
+ ```ruby
203
+ # Requires at top of file
204
+ require_relative 'git/commands/stash/apply'
205
+ require_relative 'git/commands/stash/clear'
206
+ require_relative 'git/commands/stash/list'
207
+ require_relative 'git/commands/stash/push'
208
+ require_relative 'git/parsers/stash'
209
+
210
+ # Legacy method implementations
211
+ def stashes_all
212
+ result = Git::Commands::Stash::List.new(self).call
213
+ stashes = Git::Parsers::Stash.parse_list(result.stdout)
214
+ stashes.map { |info| stash_info_to_legacy(info) }
215
+ end
216
+
217
+ def stash_save(message)
218
+ result = Git::Commands::Stash::Push.new(self).call(message: message)
219
+ result.stdout =~ /HEAD is now at/
220
+ end
221
+
222
+ def stash_apply(id = nil)
223
+ result = Git::Commands::Stash::Apply.new(self).call(id)
224
+ result.stdout
225
+ end
226
+
227
+ def stash_clear
228
+ result = Git::Commands::Stash::Clear.new(self).call
229
+ result.stdout
230
+ end
231
+
232
+ def stash_list
233
+ result = Git::Commands::Stash::List.new(self).call
234
+ result.stdout
235
+ end
236
+
237
+ # Helper method (in private section)
238
+ private
239
+
240
+ def stash_info_to_legacy(stash_info)
241
+ [stash_info.index, stash_info.message]
242
+ end
243
+ ```
244
+
245
+ ## Key Principles
246
+
247
+ 1. **Maintain exact v4.3.0 return values**: Don't change return types even slightly
248
+ 2. **Use modern infrastructure internally**: Leverage `Git::Commands::*` classes for actual git operations
249
+ 3. **Remove all new methods**: Don't try to make new methods backward compatible - just remove them
250
+ 4. **Minimize changes**: Only modify what's necessary for backward compatibility
251
+ 5. **Document conversions**: Make helper methods clear and well-named
252
+ 6. **Apply policy at the facade**: `Git::Lib` methods pass policy options explicitly
253
+ (e.g. `no_edit: true`, `verbose: true`, `no_progress: true`) — command classes stay
254
+ neutral. See "Command-layer neutrality" in CONTRIBUTING.md.
255
+
256
+ ## Validation Checklist
257
+
258
+ - [ ] Working on a feature branch (not `main`)
259
+ - [ ] Identified all methods for the command in v4.3.0
260
+ - [ ] Documented v4.3.0 return values exactly
261
+ - [ ] Removed all methods not present in v4.3.0
262
+ - [ ] Implemented legacy methods using modern command classes
263
+ - [ ] Added conversion logic where return types differ
264
+ - [ ] Created helper methods for complex conversions
265
+ - [ ] Updated require statements correctly
266
+ - [ ] Verified changes with git diff
267
+ - [ ] Net line count decreased (removed more than added)
268
+
269
+ ## Usage
270
+
271
+ To apply this process, say:
272
+
273
+ > Remove methods added to Git::Lib since v4.3.0 for `<command_name>` git command(s) and ensure the remaining methods are backward compatible.
274
+
275
+ Replace `<command_name>` with the specific git command(s) you want to audit (e.g., `branch`, `merge`, `tag`, `reset`, etc.).
@@ -0,0 +1,139 @@
1
+ ---
2
+ name: review-cross-command-consistency
3
+ description: "Compares sibling command classes for consistent structure, documentation, testing, and exit-status conventions under the Base architecture. Use for cross-command audits."
4
+ ---
5
+
6
+ # Review Cross-Command Consistency
7
+
8
+ Review sibling command classes (same module/family) for consistent structure,
9
+ documentation, testing, and exit-status conventions under the `Base` architecture.
10
+
11
+ ## Contents
12
+
13
+ - [How to use this skill](#how-to-use-this-skill)
14
+ - [Prerequisites](#prerequisites)
15
+ - [Related skills](#related-skills)
16
+ - [Version-Aware Comparison Scope](#version-aware-comparison-scope)
17
+ - [What to Check](#what-to-check)
18
+ - [1. Class structure consistency](#1-class-structure-consistency)
19
+ - [2. Arguments DSL consistency](#2-arguments-dsl-consistency)
20
+ - [3. Exit-status consistency](#3-exit-status-consistency)
21
+ - [4. YARD consistency](#4-yard-consistency)
22
+ - [5. Unit spec consistency](#5-unit-spec-consistency)
23
+ - [6. Integration spec consistency](#6-integration-spec-consistency)
24
+ - [7. Migration process consistency](#7-migration-process-consistency)
25
+ - [Output](#output)
26
+
27
+ ## How to use this skill
28
+
29
+ Attach this file to your Copilot Chat context, then invoke it with the sibling
30
+ command files (same module/family) to compare. Examples:
31
+
32
+ ```text
33
+ Using the Review Cross-Command Consistency skill, review the
34
+ Git::Commands::Diff family: lib/git/commands/diff/patch.rb,
35
+ lib/git/commands/diff/numstat.rb, lib/git/commands/diff/raw.rb.
36
+ ```
37
+
38
+ ```text
39
+ Review Cross-Command Consistency: all files under lib/git/commands/stash/
40
+ ```
41
+
42
+ The invocation needs two or more sibling command files from the same family.
43
+
44
+ ## Prerequisites
45
+
46
+ Before starting, you **MUST** load the following skill(s) in their entirety:
47
+
48
+ - [YARD Documentation](../yard-documentation/SKILL.md) — authoritative
49
+ source for YARD formatting rules and writing standards;
50
+
51
+ ## Related skills
52
+
53
+ - [Command Implementation](../command-implementation/REFERENCE.md#phased-rollout-requirements) — canonical class-shape checklist, phased
54
+ rollout gates, and internal compatibility contracts
55
+ - [Review Arguments DSL](../review-arguments-dsl/SKILL.md) — verifying DSL entries match git CLI
56
+ - [Command Test Conventions](../command-test-conventions/SKILL.md) — unit/integration test conventions for command classes
57
+ - [Command YARD Documentation](../command-yard-documentation/SKILL.md) — documentation completeness for command classes
58
+
59
+ ## Version-Aware Comparison Scope
60
+
61
+ Before flagging siblings as inconsistent for option names, aliases, negated
62
+ forms, or documented values, determine the repository's minimum supported Git
63
+ version from project metadata. In this repository, `git.gemspec` declares
64
+ `git 2.28.0 or greater`.
65
+
66
+ Consistency judgments for CLI surface area must be based on the minimum
67
+ supported Git version, not only on the locally installed Git. Use
68
+ version-matched upstream documentation first, version-matched upstream source
69
+ when exact parser behavior is ambiguous, and local `git <command> -h` output
70
+ only as a supplemental check.
71
+
72
+ ## What to Check
73
+
74
+ ### 1. Class structure consistency
75
+
76
+ - [ ] all classes use `class < Git::Commands::Base`
77
+ - [ ] all require `git/commands/base`
78
+ - [ ] all use `arguments do ... end` (no legacy `ARGS =` constants)
79
+ - [ ] simple commands carry YARD directive `# @!method call(*, **)` with nested `@overload` blocks and have no explicit `def call` definition
80
+ - [ ] commands with legitimate `call` overrides (stdin protocol, input validation, non-trivial option routing) use explicit YARD docs instead and do **not** carry the `# @!method` directive
81
+ - [ ] commands with `call` overrides use `Base#with_stdin` for stdin feeding and delegate exit-status validation to `validate_exit_status!`
82
+
83
+ ### 2. Arguments DSL consistency
84
+
85
+ - [ ] shared options use same alias/modifier patterns
86
+ - [ ] shared entries appear in same relative order
87
+ - [ ] command-specific differences are intentional and documented
88
+ - [ ] no `literal` entries for policy/output-control flags (`--no-edit`, `--verbose`,
89
+ `--no-progress`, `--no-color`, etc.) — command classes are neutral, faithful
90
+ representations of the git CLI; all siblings use `flag_option` /
91
+ `value_option` for these, leaving policy decisions to the facade. See
92
+ "Command-layer neutrality" in CONTRIBUTING.md.
93
+
94
+ ### 3. Exit-status consistency
95
+
96
+ - [ ] siblings with same git exit semantics use same `allow_exit_status` range
97
+ - [ ] rationale comments are present and consistent in tone
98
+ - [ ] commands without non-zero successful exits do not declare custom ranges
99
+
100
+ ### 4. YARD consistency
101
+
102
+ - [ ] consistent class summaries and `@api private`
103
+ - [ ] `@overload` coverage consistent for equivalent call shapes
104
+ - [ ] `@return` and `@raise` wording consistent across siblings — `@raise [Git::FailedError]` uses the canonical generic form ("if git exits with a non-zero exit status" for default range; "if git exits outside the allowed range (exit code > N)" for non-default); never enumerates specific failure causes
105
+ - [ ] tag short descriptions do not end with punctuation
106
+ - [ ] multi-paragraph tag descriptions have a blank comment line between the short
107
+ description and each continuation paragraph
108
+
109
+ ### 5. Unit spec consistency
110
+
111
+ - [ ] expectations include `raise_on_failure: false` where command invocation is asserted
112
+ - [ ] similar option paths use similar context naming
113
+ - [ ] exit-status tests are parallel where ranges are shared
114
+
115
+ ### 6. Integration spec consistency
116
+
117
+ - [ ] success/failure grouping uses same structure
118
+ - [ ] no output-format assertions (smoke + error handling only)
119
+
120
+ ### 7. Migration process consistency
121
+
122
+ See **[Command Implementation § Phased rollout requirements](../command-implementation/REFERENCE.md#phased-rollout-requirements)** for
123
+ the canonical checklist. During a cross-command audit, verify that sibling commands
124
+ were migrated in the same slice and that the same quality gates were applied.
125
+
126
+ ## Output
127
+
128
+ 1. Summary table:
129
+
130
+ | Aspect | File A | File B | File C | Status |
131
+ | --- | --- | --- | --- | --- |
132
+
133
+ 2. Inconsistency list with canonical recommendation:
134
+
135
+ | Issue | Files | Recommended canonical form |
136
+ | --- | --- | --- |
137
+
138
+ > **Branch workflow:** Implement any fixes on a feature branch. Never commit or
139
+ > push directly to `main` — open a pull request when changes are ready to merge.