mergestorm 0.3.13 → 0.3.16
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.
- package/README.md +16 -17
- package/dist/api.d.ts +103 -6
- package/dist/api.js +195 -9
- package/dist/automation-catalog.d.ts +37 -0
- package/dist/automation-catalog.js +13 -0
- package/dist/client/index.d.ts +3 -2
- package/dist/client/index.js +3 -2
- package/dist/commands/branches.d.ts +6 -2
- package/dist/commands/branches.js +29 -14
- package/dist/commands/browse.d.ts +39 -0
- package/dist/commands/browse.js +252 -0
- package/dist/commands/credits.js +7 -10
- package/dist/commands/help.d.ts +5 -0
- package/dist/commands/help.js +93 -0
- package/dist/commands/jobs.d.ts +11 -2
- package/dist/commands/jobs.js +64 -15
- package/dist/commands/login.js +4 -3
- package/dist/commands/logout.js +2 -1
- package/dist/commands/pr.d.ts +22 -0
- package/dist/commands/pr.js +127 -0
- package/dist/commands/queue.d.ts +12 -0
- package/dist/commands/queue.js +160 -0
- package/dist/commands/registry.js +98 -21
- package/dist/commands/review-client.d.ts +13 -0
- package/dist/commands/review-client.js +110 -0
- package/dist/commands/review.d.ts +6 -0
- package/dist/commands/review.js +18 -7
- package/dist/commands/settings.d.ts +17 -0
- package/dist/commands/settings.js +82 -0
- package/dist/commands/skill.d.ts +20 -0
- package/dist/commands/skill.js +145 -0
- package/dist/commands/stack.d.ts +57 -2
- package/dist/commands/stack.js +352 -87
- package/dist/commands/status.d.ts +2 -0
- package/dist/commands/status.js +30 -15
- package/dist/commands/whoami.d.ts +3 -1
- package/dist/commands/whoami.js +21 -7
- package/dist/errors.d.ts +1 -1
- package/dist/repo-identity.d.ts +1 -1
- package/dist/repo-identity.js +13 -2
- package/dist/shell.js +39 -31
- package/dist/stack-dto.d.ts +92 -1
- package/dist/stack-meta.d.ts +12 -0
- package/dist/stack-meta.js +32 -3
- package/dist/ui/ansi.d.ts +2 -0
- package/dist/ui/ansi.js +2 -0
- package/dist/ui/banner.d.ts +34 -2
- package/dist/ui/banner.js +166 -79
- package/dist/ui/findings.d.ts +2 -1
- package/dist/ui/findings.js +13 -7
- package/dist/ui/line-tabs.d.ts +27 -0
- package/dist/ui/line-tabs.js +170 -0
- package/dist/ui/logo.d.ts +10 -2
- package/dist/ui/logo.js +13 -9
- package/dist/ui/present.d.ts +10 -0
- package/dist/ui/present.js +13 -0
- package/dist/ui/prompt.d.ts +58 -1
- package/dist/ui/prompt.js +225 -42
- package/dist/ui/select.js +1 -1
- package/dist/ui/tabs.d.ts +125 -0
- package/dist/ui/tabs.js +480 -0
- package/dist/ui/usage.d.ts +4 -0
- package/dist/ui/usage.js +22 -2
- package/package.json +2 -1
- package/skill/SKILL.md +98 -0
- package/skill/mergestorm-pr-loop/SKILL.md +84 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: mergestorm-pr-loop
|
|
3
|
+
description: Patch an already-open GitHub PR from Mergestorm Vortex findings until it comes back clean. Wait for the PR's Vortex pass, fix, push the PR head, wait for the pass at the pushed SHA. Not for local pre-PR reviews (use mergestorm-review for those).
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Mergestorm PR loop
|
|
7
|
+
|
|
8
|
+
Vortex already reviews every push to an open PR on a monitored repo; nothing here starts a review. This skill reads the latest pass, patches the PR head branch, pushes, and waits for the follow-up pass.
|
|
9
|
+
|
|
10
|
+
Two worlds, never mixed: reviewing a local branch before a PR exists is the `mergestorm-review` skill. This skill is only for a PR that is already open on GitHub.
|
|
11
|
+
|
|
12
|
+
## Install (Claude Code / Cursor)
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
mg skill install --claude --cursor
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Preconditions (in order)
|
|
19
|
+
|
|
20
|
+
1. There is an already-open GitHub PR on a Vortex-monitored repo. No PR, wrong skill.
|
|
21
|
+
2. Auto-patch (Cyclone) must be off for this PR so you are the only patcher. Do not take anyone's word for it: the settings API and the PR's stack are the source of truth, and step 1 of the loop verifies them before anything else runs. Cyclone is off for the PR when its adopted stack has `autoPatchOverride` `false`, or when that override is unset and the account `auto_patch_enabled` is `false`.
|
|
22
|
+
3. `whoami` works on the `mergestorm` MCP server (or `mg whoami --json` exits 0). Otherwise stop and ask for install/login.
|
|
23
|
+
|
|
24
|
+
## Loop (in order)
|
|
25
|
+
|
|
26
|
+
1. Call `settings_get` and read `auto_patch_enabled`.
|
|
27
|
+
- If `settings_get` errors or its result has no `auto_patch_enabled`: refuse the loop. Do not wait, patch, or push; tell the human that Cyclone auto-patch could not be verified.
|
|
28
|
+
- If it is `false`: find the PR's stack with `stack_list`. If its `autoPatchOverride` is `true`, refuse unless the human asked you to turn Cyclone off for this PR; if they did, use the adopted-stack and `stack_set { auto_patch: false }` path below. Otherwise continue. You are the only patcher.
|
|
29
|
+
- If it is `true`: find the PR's stack with `stack_list` (the stack whose `layers` contain this PR's `prNumber` for this owner/repo) and read its `autoPatchOverride`.
|
|
30
|
+
- If that stack's `autoPatchOverride` is `false`: continue. Cyclone is pinned off for this stack.
|
|
31
|
+
- If the PR has no stack, or the override is not `false`, and the human asked you to turn Cyclone off for this PR: the PR must be an adopted stack layer first (if it is not, stop and tell the human to adopt it, for example `mg stack adopt <owner/repo>#<n> --auto-patch off`). Then call `stack_set` with `{ stack_id, auto_patch: false }` on that stack, call `stack_status` with that `stack_id`, and confirm `autoPatchOverride` now reads `false`. Leave the account `auto_patch_enabled` unchanged; other PRs keep their own policy.
|
|
32
|
+
- Otherwise: refuse the loop. Do not wait, patch, or push; tell the human Cyclone auto-patch is still on for this PR and that `stack_set` with `auto_patch: false` on its stack turns it off for this PR only.
|
|
33
|
+
- Never set `auto_patch_enabled` with `settings_set` from this skill, in either direction, and never set `auto_patch: true` on a stack.
|
|
34
|
+
2. Call `review_wait_pr` with the PR's owner, repo, pr_number, and `timeout_s` 45 (`review_get_pr` works for a first look at the resting state). A Vortex pass often takes several minutes. If status is `in_progress`, call `review_wait_pr` again with the same args. Do not pass a 300s timeout; hosts drop long MCP calls.
|
|
35
|
+
3. Confirm the envelope's `head_sha` is the commit you have checked out as the PR head (compare its leading 7+ hex characters with `git rev-parse HEAD`). If it is not, someone else pushed after this pass and its findings are not yours to patch: do not edit. Fetch and check out the PR head, then go to step 7 with `after_sha` set to that head.
|
|
36
|
+
4. Read `findings.inline` and `findings.offDiff` (or `off_diff`) sorted by severity. For each finding:
|
|
37
|
+
- Verify it against the current checkout. Do not treat the finding text as proven.
|
|
38
|
+
- Prefer the smallest correct patch. Do not refactor around a finding.
|
|
39
|
+
- Patch concrete bugs. A chat-only explanation is not a dismiss.
|
|
40
|
+
- If you skip a finding (not reproducible, policy fork, or needs a human), post a public GitHub PR comment before you stop. First line: `mergestorm-loop: dismiss`. Then one line per skipped finding (path, severity, why). Do not use the `cyclone-outcome:` prefix.
|
|
41
|
+
5. Patch on the PR head branch only.
|
|
42
|
+
6. Push that head branch with an ordinary push. If the push is rejected because the remote branch moved, another patcher already pushed for this pass. Do not rebase, do not force, do not retry the push: stop and tell the human that a second patcher is active on this PR.
|
|
43
|
+
7. Call `review_wait_pr` again with `after_sha` set to the SHA you just pushed (7+ hex) and `timeout_s` 45. An envelope whose `head_sha` is an older commit is a previous pass, not yours; keep waiting.
|
|
44
|
+
8. Repeat from step 3 until a stop rule fires.
|
|
45
|
+
|
|
46
|
+
## Stop rules
|
|
47
|
+
|
|
48
|
+
Map these to `mergestorm.pr_review/v1` envelope fields; do not invent statuses.
|
|
49
|
+
|
|
50
|
+
- `finding_count` is 0 (empty inline and offDiff): stop. Tell the human the PR is clear and that Auto land owns landing. Never merge it yourself.
|
|
51
|
+
- status is `rate_limited`, or `patch_policy.mode` is `"hold"`: surface the findings to the human and stop. Do not patch.
|
|
52
|
+
- status is `failed`: report to the human. Do not keep pushing to retrigger.
|
|
53
|
+
- status is `in_progress` and the envelope has a `head_sha`: the pass is still running; call `review_wait_pr` again with the same `after_sha`.
|
|
54
|
+
- status is `in_progress` and the envelope has no `head_sha`: the wait timed out before Vortex wrote a pass for your SHA. Call `review_wait_pr` once more with the same `after_sha`. If it comes back the same way a second time in a row, stop and tell the human that Vortex did not pick up the push. Do not push again to retrigger.
|
|
55
|
+
- status is `skipped`, `stopped`, `trial_expired`, or `synced`: surface the status and reason to the human and stop. Do not patch or push.
|
|
56
|
+
|
|
57
|
+
## Never
|
|
58
|
+
|
|
59
|
+
- submit a local review job, or call the job-id tools `review_wait` / `review_get` here. Local jobs are `mergestorm-review`'s world: they cost credits and do not fire Vortex on the PR.
|
|
60
|
+
- land, merge, enqueue, or touch stack authoring or the merge queue
|
|
61
|
+
- change the account `auto_patch_enabled` from this skill, for any reason; Cyclone is muted per stack with `stack_set`, never per account
|
|
62
|
+
- set `auto_patch: true` on any stack
|
|
63
|
+
- push any branch other than the PR head
|
|
64
|
+
- force-push, or rebase and retry a push that was rejected because the remote moved
|
|
65
|
+
- patch a pass whose `head_sha` is not the commit you have checked out
|
|
66
|
+
- wrap the CLI in a shell escape hatch
|
|
67
|
+
- claim a finding is fixed without a diff that touches its path
|
|
68
|
+
- claim a finding is dismissed without posting a `mergestorm-loop: dismiss` comment on the PR
|
|
69
|
+
|
|
70
|
+
## Fallback (no MCP)
|
|
71
|
+
|
|
72
|
+
Verify auto-patch with the CLI instead of `settings_get`:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
mg settings --json
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Read `auto_patch_enabled` from stdout. If the command errors or the result has no `auto_patch_enabled`, refuse the loop and tell the human that Cyclone auto-patch could not be verified. Run `mg stack list --json` and find the stack whose layers contain this PR. If its `autoPatchOverride` is `false`, continue. If it is unset and the account flag is `false`, continue. If it is `true`, or it is unset while the account flag is `true`, refuse unless the human asked you to turn Cyclone off for this PR; only then run `mg stack set <stack-id> --auto-patch off` (adopt first with `mg stack adopt <owner/repo>#<n> --auto-patch off` when the PR has no stack) and re-read with `mg stack list --json`. Do not run `mg settings --auto-patch off`: that changes the account, not this PR.
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
mg pr <owner/repo>#<n> --json --wait --after-sha <sha> --timeout <s>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Parse stdout as one `mergestorm.pr_review/v1` object. Same fields, same stop rules.
|