ralph-hero-mcp-server 2.5.192 → 2.5.193

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.
@@ -131,4 +131,22 @@ export const WORKFLOW_STATE_TO_STATUS = {
131
131
  "Canceled": "Done",
132
132
  "Human Needed": "Todo",
133
133
  };
134
+ /**
135
+ * Reverse-inference map (GH-1471): when a save_issue call closes the GitHub
136
+ * issue but provides no explicit workflowState, infer the matching terminal
137
+ * board state. Keyed by `CLOSED:${stateReason ?? ""}` to mirror the lookup in
138
+ * issue-tools.ts. This is the symmetric inverse of the forward auto-close path.
139
+ *
140
+ * - CLOSED:COMPLETED → Done (issue closed as completed)
141
+ * - CLOSED:NOT_PLANNED → Canceled (issue closed as not planned)
142
+ * - CLOSED: → Done (close with no stateReason defaults to Done)
143
+ *
144
+ * An explicit workflowState always wins — the caller only consults this map
145
+ * when args.workflowState is undefined.
146
+ */
147
+ export const ISSUE_STATE_TO_TERMINAL_WORKFLOW = {
148
+ "CLOSED:COMPLETED": "Done",
149
+ "CLOSED:NOT_PLANNED": "Canceled",
150
+ "CLOSED:": "Done",
151
+ };
134
152
  //# sourceMappingURL=workflow-states.js.map
@@ -8,7 +8,7 @@ import { z } from "zod";
8
8
  import { paginateConnection } from "../lib/pagination.js";
9
9
  import { detectGroup } from "../lib/group-detection.js";
10
10
  import { detectPipelinePosition, OVERSIZED_ESTIMATES, } from "../lib/pipeline-detection.js";
11
- import { isValidState, isParentGateState, VALID_STATES, LOCK_STATES, TERMINAL_STATES, WORKFLOW_STATE_TO_STATUS, } from "../lib/workflow-states.js";
11
+ import { isValidState, isParentGateState, VALID_STATES, LOCK_STATES, TERMINAL_STATES, WORKFLOW_STATE_TO_STATUS, ISSUE_STATE_TO_TERMINAL_WORKFLOW, } from "../lib/workflow-states.js";
12
12
  import { buildBatchMutationQuery } from "./batch-tools.js";
13
13
  import { resolveState } from "../lib/state-resolution.js";
14
14
  import { parseDateMath } from "../lib/date-math.js";
@@ -808,6 +808,7 @@ export function registerIssueTools(server, client, fieldCache) {
808
808
  "and project field values (workflow state, estimate, priority, iteration) in a single call. " +
809
809
  "Supports semantic intents (__LOCK__, __COMPLETE__, etc.) for workflowState. " +
810
810
  "Auto-closes the GitHub issue when workflowState resolves to a terminal state (Done, Canceled) unless issueState is explicitly set. " +
811
+ "Reverse inference: when issueState closes the issue (CLOSED→Done, CLOSED_NOT_PLANNED→Canceled) and no workflowState is provided, the board is advanced to the matching terminal state automatically. Explicit workflowState always wins. " +
811
812
  "Set estimate, priority, or iteration to null to clear the field. Use @current/@next tokens for iteration. " +
812
813
  "Returns: number, url, changes.", {
813
814
  owner: z.string().optional().describe("GitHub owner. Defaults to GITHUB_OWNER env var"),
@@ -887,6 +888,20 @@ export function registerIssueTools(server, client, fieldCache) {
887
888
  stateReason = resolvedWorkflowState === "Canceled" ? "NOT_PLANNED" : "COMPLETED";
888
889
  changes.autoClose = true;
889
890
  }
891
+ // Reverse inference: if issueState closes the issue and no explicit workflowState,
892
+ // default the board to the matching terminal workflow state (Done or Canceled).
893
+ // This is the symmetric inverse of the forward auto-close path above.
894
+ // Explicit workflowState always wins — this only fires when args.workflowState is absent.
895
+ let inferredFromClose = false;
896
+ if (args.workflowState === undefined && targetState === "CLOSED") {
897
+ const key = `CLOSED:${stateReason ?? ""}`;
898
+ const inferred = ISSUE_STATE_TO_TERMINAL_WORKFLOW[key];
899
+ if (inferred) {
900
+ resolvedWorkflowState = inferred;
901
+ inferredFromClose = true;
902
+ changes.workflowStateInferred = inferred;
903
+ }
904
+ }
890
905
  // 3. Issue state mutations (close/reopen) - use dedicated mutations
891
906
  const hasMetadataFields = args.title !== undefined || args.body !== undefined ||
892
907
  args.labels !== undefined || args.assignees !== undefined;
@@ -982,7 +997,8 @@ export function registerIssueTools(server, client, fieldCache) {
982
997
  }
983
998
  }
984
999
  // 4. Project-field mutations (aliased batch for workflow state + status sync + estimate + priority)
985
- if (hasProjectFields) {
1000
+ // Also fires when workflowState was inferred from issueState (reverse-close inference).
1001
+ if (hasProjectFields || inferredFromClose) {
986
1002
  const { projectNumber, projectOwner } = resolveFullConfig(client, args);
987
1003
  await ensureFieldCache(client, fieldCache, projectOwner, projectNumber);
988
1004
  const projectItemId = await resolveProjectItemId(client, fieldCache, owner, repo, args.number, projectNumber);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ralph-hero-mcp-server",
3
- "version": "2.5.192",
3
+ "version": "2.5.193",
4
4
  "description": "MCP server for GitHub Projects V2 - Ralph workflow automation",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",