Commit 170d186
authored
* feat(git,github): close branch-list/push-delete/default-branch gaps
Three missing-capability issues addressed in one change.
Issue #171 — register git_branch_list as a lean MCP tool
- Extend existing _branch_ops.git_branch_list with schema requested
in the issue: branch_type (local|remote|all), pattern, contains,
merged. Return structured records (name/sha/is_current/upstream).
- Legacy remote=/all= bools kept as aliases for back-compat;
explicit conflict with branch_type surfaces as error text.
- Add GitBranchList pydantic model and register in lean/registry_git.
- 21 tests (test_git_branch_list.py rewritten).
Issue #172 — default_branch passthrough on github_update_repo_settings
- Add default_branch: str | None field to GitHubUpdateRepoSettings
and forward to the PATCH /repos/{owner}/{name} payload.
- Unblocks workflows that need to flip the repo's default branch
(e.g. main -> development for sub-package conventions).
- 1 new test verifies the payload entry.
Issue #173 — delete + raw refspec support on git_push
- Add delete: bool and refspec: str | None fields to GitPush.
- model_validator enforces five mutual-exclusion rules; same guards
mirrored in the handler in case lean dispatch skips pydantic.
- delete=True dispatches `git push <remote> --delete <branch>`;
refspec dispatches `git push <remote> <refspec>`.
- Closes the circular dead-end where shell-runner refused
`git push --delete` and the MCP tool didn't support it.
- 16 new tests in test_git_push_delete.py.
* feat(git): add sort to git_branch_list, dry_run to git_push
Bundled into PR #174 to avoid staggering MCP server restarts.
Issue #175 — git_branch_list sort
- Add sort: str | None field to GitBranchList (e.g. '-committerdate',
'refname', 'authordate'); mirrors `git for-each-ref --sort=<key>`.
- When set, branches are collected via for_each_ref with NUL-separated
format; existing pattern/contains/merged filters apply post-fetch.
- sort=None preserves the legacy collection path (no perf regression).
- 10 new tests in TestGitBranchListSort.
Issue #176 — git_push dry_run
- Add dry_run: bool = False to GitPush; orthogonal to all existing
mutual-exclusion rules (no validator changes).
- Appends --dry-run to all four push paths: normal, force, delete,
raw refspec. Return string carries a 'dry-run' marker.
- 11 new tests in TestGitPushDryRun.
1 parent 8ec9a2a commit 170d186
9 files changed
Lines changed: 1024 additions & 148 deletions
File tree
- src/mcp_server_git
- github
- git
- lean
- tests/unit
- github
- git
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
| 5 | + | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
| |||
116 | 118 | | |
117 | 119 | | |
118 | 120 | | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
119 | 278 | | |
120 | 279 | | |
121 | | - | |
122 | | - | |
| 280 | + | |
123 | 281 | | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
124 | 289 | | |
125 | | - | |
| 290 | + | |
126 | 291 | | |
127 | 292 | | |
128 | 293 | | |
129 | | - | |
130 | | - | |
131 | | - | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
132 | 301 | | |
133 | 302 | | |
134 | | - | |
| 303 | + | |
135 | 304 | | |
136 | 305 | | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
146 | 319 | | |
147 | | - | |
148 | | - | |
| 320 | + | |
149 | 321 | | |
150 | | - | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
151 | 326 | | |
152 | | - | |
153 | | - | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
154 | 331 | | |
155 | | - | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
156 | 336 | | |
157 | 337 | | |
158 | 338 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
70 | 73 | | |
71 | 74 | | |
72 | 75 | | |
| |||
81 | 84 | | |
82 | 85 | | |
83 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
84 | 97 | | |
85 | 98 | | |
86 | 99 | | |
| |||
92 | 105 | | |
93 | 106 | | |
94 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
95 | 138 | | |
96 | 139 | | |
97 | 140 | | |
| |||
121 | 164 | | |
122 | 165 | | |
123 | 166 | | |
| 167 | + | |
| 168 | + | |
124 | 169 | | |
125 | 170 | | |
126 | 171 | | |
| |||
176 | 221 | | |
177 | 222 | | |
178 | 223 | | |
| 224 | + | |
| 225 | + | |
179 | 226 | | |
180 | 227 | | |
181 | 228 | | |
| |||
217 | 264 | | |
218 | 265 | | |
219 | 266 | | |
| 267 | + | |
| 268 | + | |
220 | 269 | | |
221 | 270 | | |
222 | 271 | | |
| |||
258 | 307 | | |
259 | 308 | | |
260 | 309 | | |
| 310 | + | |
| 311 | + | |
261 | 312 | | |
262 | 313 | | |
263 | 314 | | |
| |||
0 commit comments