mergestorm-mcp 0.1.7 → 0.1.9

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 CHANGED
@@ -7,7 +7,7 @@ The stack tools expose reads plus one scoped policy write:
7
7
  - `stack_adopt({ owner, repo, pr_number, auto_land?, auto_review?, auto_patch? })` adopts an open PR chain with optional per-stack policy. Omitted policy does not force Cyclone off. `auto_review` and `auto_patch` accept `true`, `false`, or `null`; `null` clears the override. Read `stack_status` with the returned `result.stack.id` to verify policy and Cyclone ownership.
8
8
  - `stack_list` returns the current API key owner's registered stacks.
9
9
  - `stack_set({ stack_id, auto_land?, auto_review?, auto_patch? })` sets per-stack policy on one owned stack. `auto_land` flips Auto land. `auto_review` and `auto_patch` pin Vortex auto-review or Cyclone auto-patch for that stack in either direction (`true` or `false`); `null` clears the pin so the stack follows the account setting. Pass at least one key. Account settings are never changed here.
10
- - `stack_status({ stack_id })` returns one owned stack with enriched checks and agent state, or a structured `stack_not_found` error.
10
+ - `stack_status({ stack_id })` returns one owned stack with enriched checks and agent state, plus `attention`, `issues`, and `currentCandidate` from the same blocker rules as `stack_wait`, read against that stack's own merge queue. It returns a structured `stack_not_found` or `rate_limited` error.
11
11
  - `stack_wait({ stack_id, timeout_s?, enrolled_head_sha?, after_finished_at?, bounce_id? })` waits for a stack or queue state change and returns the latest snapshots. `timeout_s: 0` returns one snapshot; a positive timeout after a snapshot with no attention returns the current `waiting` or `in_progress` status with selectors to use for the next call. An unread deadline returns `failed`.
12
12
 
13
13
  Auth is `MERGESTORM_API_KEY`, then `~/.mergestorm/config.json` (same as `mg`).
package/dist/index.js CHANGED
@@ -830,7 +830,8 @@ async function stackWait(input, cfg, deps = {}) {
830
830
  import {
831
831
  getEnrichedStack,
832
832
  listMergeQueueEntries as listMergeQueueEntries2,
833
- isCommandErrorCode as isCommandErrorCode5
833
+ isCommandErrorCode as isCommandErrorCode5,
834
+ stackBlockers as stackBlockers2
834
835
  } from "mergestorm/client";
835
836
  async function stackStatus(stackId, cfg) {
836
837
  try {
@@ -849,10 +850,11 @@ async function stackStatus(stackId, cfg) {
849
850
  isError: true
850
851
  };
851
852
  }
852
- const entries = await listMergeQueueEntries2(cfg);
853
+ const entries = await listMergeQueueEntries2(cfg, { stackId: stack.id });
854
+ const { attention, issues, currentCandidate } = stackBlockers2(stack, entries);
853
855
  return {
854
856
  summary: stackSummary(stack, entries),
855
- data: { stack }
857
+ data: { stack, attention, issues, currentCandidate }
856
858
  };
857
859
  } catch (err) {
858
860
  if (isCommandErrorCode5(err, "rate_limited")) {
@@ -921,6 +923,13 @@ var MCP_PR_LOOP_INSTRUCTIONS = [
921
923
  `- If you skip a finding (not reproducible, policy fork, or needs a human), post a public GitHub PR comment before you stop. First line must be: ${MCP_FINDING_DISMISS_MARKER}. Then one line per skipped finding (path, severity, why).`,
922
924
  "- Do not prefix that comment with cyclone-outcome: (reserved)."
923
925
  ].join("\n");
926
+ var MCP_STACK_BASE_INSTRUCTIONS = [
927
+ "Stack PR bases (Mergestorm sets these; leave them):",
928
+ "- Stack of 2+ PRs: after adopt (stack_adopt, mg stack adopt, or mg stack submit) the bottom PR's GitHub base is the owned trunk mg-stack-<n>, not main. That is correct. Layer 2 is based on layer 1; layer 3+ on the mg-park-* freeze; the git parent of layer 2+ is still the layer below. A 1-PR stack stays on main and gets no mg-stack-<n>.",
929
+ "- Never retarget a stack PR's GitHub base (gh pr edit --base, a REST base change, or the UI). Moving the bottom to main makes Mergestorm abandon the stack's review unit; setting mg-stack-<n> again does not restore it. If a base was already moved, stop and tell the human; do not run stack land or re-adopt to repair it.",
930
+ "- mg-stack-<n> is the bottom PR's live parent: merging it into the bottom branch is that PR's conflict repair (bounce-watch rules). Never push to mg-stack-<n>, and never rebase or merge layer 2+ onto it or onto main. mg-park-* is never a merge or rebase target.",
931
+ "- mg stack submit prints the base each PR opened with; the bottom moves to mg-stack-<n> right after. stack_status trunkBranch is the current trunk."
932
+ ].join("\n");
924
933
  var MCP_STACK_WATCH_INSTRUCTIONS = [
925
934
  "Stack-watch facts (mergestorm.stack_watch/v1):",
926
935
  "- waiting with nonempty issues[] is not idle; in_progress can also carry issues[].",
@@ -934,7 +943,7 @@ var MCP_STACK_WATCH_INSTRUCTIONS = [
934
943
 
935
944
  // src/server.ts
936
945
  var MCP_SERVER_NAME = "mergestorm";
937
- var MCP_SERVER_VERSION = "0.1.7";
946
+ var MCP_SERVER_VERSION = "0.1.9";
938
947
  function stripNulls(value) {
939
948
  if (Array.isArray(value)) {
940
949
  return value.map((item) => stripNulls(item));
@@ -970,6 +979,8 @@ function createMergestormMcpServer() {
970
979
  },
971
980
  { instructions: `${MCP_PR_LOOP_INSTRUCTIONS}
972
981
 
982
+ ${MCP_STACK_BASE_INSTRUCTIONS}
983
+
973
984
  ${MCP_STACK_WATCH_INSTRUCTIONS}` }
974
985
  );
975
986
  const addTool = server2.registerTool.bind(server2);
@@ -1146,7 +1157,7 @@ ${MCP_STACK_WATCH_INSTRUCTIONS}` }
1146
1157
  "stack_adopt",
1147
1158
  {
1148
1159
  title: "Adopt PR stack",
1149
- description: "Adopt an open GitHub PR chain into a Mergestorm stack. auto_land is boolean; auto_review and auto_patch accept true, false, or null, where null clears the override. Omitted auto_land seeds from auto_land_default; omitted auto_review and auto_patch overrides are not seeded. Never changes account settings. Adoption requires a Cyclone GitHub App install; without it the API returns cyclone_not_connected \u2014 do not retry, tell the human. Read stack_status with result.stack.id afterward to verify policy and Cyclone ownership.",
1160
+ description: "Adopt an open GitHub PR chain into a Mergestorm stack. auto_land is boolean; auto_review and auto_patch accept true, false, or null, where null clears the override. Omitted auto_land seeds from auto_land_default; omitted auto_review and auto_patch overrides are not seeded. Never changes account settings. Adoption requires a Cyclone GitHub App install; without it the API returns cyclone_not_connected \u2014 do not retry, tell the human. Read stack_status with result.stack.id afterward to verify policy and Cyclone ownership. With 2+ PRs, adopt moves the bottom PR's GitHub base to mg-stack-<n> and parks PR3+ on an mg-park-* freeze; a 1-PR stack stays on main. Leave those bases. Never retarget the bottom back to main.",
1150
1161
  inputSchema: stackAdoptSchema
1151
1162
  },
1152
1163
  async (args) => {
@@ -1201,7 +1212,7 @@ ${MCP_STACK_WATCH_INSTRUCTIONS}` }
1201
1212
  "stack_status",
1202
1213
  {
1203
1214
  title: "Get stack status",
1204
- description: "Fetch one owned Mergestorm stack with enriched checks and agent state. This tool is read-only.",
1215
+ description: "Fetch one owned Mergestorm stack with enriched checks and agent state, plus attention, issues, and currentCandidate from the same blocker rules as stack_wait, read against that stack's own merge queue. This tool is read-only. trunkBranch is mg-stack-<n> for an adopted 2+ PR stack and matches the bottom open PR's GitHub base; an mg-park-* parentBranch is a freeze. Neither is drift to fix.",
1205
1216
  inputSchema: {
1206
1217
  stack_id: z3.string().min(1)
1207
1218
  }
@@ -1218,7 +1229,7 @@ ${MCP_STACK_WATCH_INSTRUCTIONS}` }
1218
1229
  "stack_wait",
1219
1230
  {
1220
1231
  title: "Wait for stack attention",
1221
- description: "Wait for a stack to need attention. Returns a mergestorm.stack_watch/v1 envelope; timeout_s: 0 returns one snapshot and timeout_s: 1-45 waits up to that many seconds, returning the current status (waiting or in_progress) if a snapshot was read and no attention is found. A timeout with either of those statuses is not a failure. A timeout of failed means no assessment was produced. This tool is read-only.",
1232
+ description: "Wait for a stack to need attention. Returns a mergestorm.stack_watch/v1 envelope; timeout_s: 0 returns one snapshot and timeout_s: 1-45 waits up to that many seconds, returning the current status (waiting or in_progress) if a snapshot was read and no attention is found. A timeout with either of those statuses is not a failure. A timeout of failed means no assessment was produced. This tool is read-only. Attention never calls for changing a PR's GitHub base.",
1222
1233
  inputSchema: stackWaitSchema
1223
1234
  },
1224
1235
  async (args, extra) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mergestorm-mcp",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "Mergestorm MCP server — identity, review, and read-only stack tools over stdio",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -29,7 +29,7 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@modelcontextprotocol/sdk": "^1.30.0",
32
- "mergestorm": "0.3.20",
32
+ "mergestorm": "0.3.23",
33
33
  "zod": "^3.24.2"
34
34
  },
35
35
  "devDependencies": {