@motir/cli 0.4.0 → 0.5.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 (3) hide show
  1. package/README.md +60 -0
  2. package/dist/index.js +54074 -41257
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -220,6 +220,66 @@ that has no direct edge, or when you want the review hop on the record. An
220
220
  illegal flip surfaces the server's own allowed-targets error verbatim. A merged
221
221
  **session** PR closes out in bulk with `motir done --session <branch>`.
222
222
 
223
+ ## The repair — `motir fix` (MOTIR-5465)
224
+
225
+ ```sh
226
+ motir fix <key> [--agent <cmd>] [--report-log]
227
+ ```
228
+
229
+ **When to use it.** A work item's pull requests are failing, or its merge did not
230
+ land for a reason the CODE could answer, and the run that opened them has ended.
231
+ That is a card at **Implemented** whose checks went red later or whose branch
232
+ conflicts, or a card back at **In Review** after the merge queue threw it out for a
233
+ failed or timed-out check (it waits there for a fresh approval, and `motir fix` is
234
+ the answer when the failure is real). A merge blocked by a repository SETTING, or a
235
+ pull request somebody took out of the queue by hand, is refused: no code change
236
+ fixes either. The item page's Development block offers this command, ready to copy.
237
+
238
+ **What it does:**
239
+
240
+ 1. **Claims the repair** (`POST /api/v1/work-items/{key}/repair`). Only one
241
+ repair runs on a card at a time. The claim is an open `fix` run, and it never
242
+ changes the card's status or assignee. A refusal is printed in words and
243
+ exits non-zero:
244
+ - somebody is already fixing it, and they are named;
245
+ - the card is not waiting on a repair (neither Implemented, nor In Review after
246
+ a merge-queue ejection);
247
+ - its merge did not land for a reason no code change fixes — a setting, or a
248
+ hand removal from the queue — and the refusal names what would help instead;
249
+ - the pull requests belong to the parent's run, and the key to fix instead is
250
+ named;
251
+ - the card has no pull requests;
252
+ - its checks are still running;
253
+ - nothing is failing.
254
+ 2. **Checks out each red pull request's own branch**, as a worktree beside that
255
+ repository's checkout (`<repo>-fix-<key>-<number>`). The worktree is on the
256
+ branch, not a detached HEAD, so a push updates the same pull request. A
257
+ repository with no local checkout is refused. A resumed repair reuses its
258
+ worktree.
259
+ 3. **Runs the same fix loop `motir run` ends with**, using the same prompt and
260
+ the same limit of five attempts. When the failing set spans several
261
+ repositories, the prompt lists every checkout.
262
+
263
+ **A pull request the merge queue ejected counts as failing**, even when its
264
+ own checks are green (the queue failed on its merge commit, not on the branch
265
+ alone). The prompt says why it left the queue and names the queue's failing
266
+ check. A conflict is told to merge the base and resolve it. If the agent
267
+ pushes nothing, because there was nothing to change, the repair stops after
268
+ that ONE attempt and tells you to press **Queue again** on the card.
269
+
270
+ 4. **Closes the run** on every exit path:
271
+ - green → completed, exit 0;
272
+ - the sixth red → halted, exit 1, naming each failing check, its repository
273
+ and the attempt count (the queue's check, for an ejected pull request);
274
+ - an ejected pull request the agent pushed nothing to → failed, exit 1,
275
+ pointing at _Queue again_;
276
+ - Ctrl-C → interrupted, exit 130.
277
+
278
+ The page shows a repair as in progress for as long as its run is open.
279
+
280
+ It opens no pull request and links nothing. The build moves the card to
281
+ **In Review** when the checks pass, exactly as it does after `motir run`.
282
+
223
283
  ## The loop — `motir auto` (7.9.4)
224
284
 
225
285
  ```sh