@mutmutco/cli 4.6.35 → 4.6.36

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 (2) hide show
  1. package/dist/main.cjs +73 -19
  2. package/package.json +1 -1
package/dist/main.cjs CHANGED
@@ -15366,13 +15366,6 @@ async function fetchHubBoardSnapshot(request, deps) {
15366
15366
  // src/board-read.ts
15367
15367
  init_github_quota();
15368
15368
 
15369
- // src/claim-marker-client.ts
15370
- init_github_client();
15371
- init_github_quota();
15372
-
15373
- // src/pr-checks-rest.ts
15374
- init_cli_shared();
15375
-
15376
15369
  // ../shared/github-quota-scope.ts
15377
15370
  var import_node_crypto4 = require("node:crypto");
15378
15371
  function appQuotaScope(appId, installationId, origin = "https://api.github.com", resource = "graphql") {
@@ -15737,6 +15730,13 @@ async function activateAppActor(commandPath4, env, mint, note = (line) => proces
15737
15730
  return "app";
15738
15731
  }
15739
15732
 
15733
+ // src/claim-marker-client.ts
15734
+ init_github_client();
15735
+ init_github_quota();
15736
+
15737
+ // src/pr-checks-rest.ts
15738
+ init_cli_shared();
15739
+
15740
15740
  // src/merge-ci-policy.ts
15741
15741
  function resolveMergeCiPolicy(input) {
15742
15742
  if (input.registryCi === "none") {
@@ -17174,9 +17174,11 @@ async function fetchRestCorePool(gh2 = defaultGhApi, nowMs = Date.now()) {
17174
17174
  // src/claim-marker-client.ts
17175
17175
  var claimWriteTokenProvider;
17176
17176
  var claimWriteTokenOnce;
17177
+ var notedPersonalClaimWrite = false;
17177
17178
  function setClaimWriteTokenProvider(provider) {
17178
17179
  claimWriteTokenProvider = provider;
17179
17180
  claimWriteTokenOnce = void 0;
17181
+ notedPersonalClaimWrite = false;
17180
17182
  }
17181
17183
  async function selectClaimWriteClient(client, appClient) {
17182
17184
  if (appClient) return appClient;
@@ -17187,15 +17189,26 @@ async function selectClaimWriteClient(client, appClient) {
17187
17189
  token = await claimWriteTokenOnce;
17188
17190
  } catch (e) {
17189
17191
  claimWriteTokenOnce = void 0;
17192
+ if (e instanceof AppActorError && e.code === "vault-denied" && process.env.MMI_ACTOR?.trim() !== "app") return personalClaimWrite(client);
17190
17193
  const detail = e instanceof Error ? e.message : String(e);
17191
17194
  throw new Error(`${detail} \u2014 refusing personal-token fallback for claim write (#9511)`);
17192
17195
  }
17193
17196
  if (!token) {
17194
17197
  claimWriteTokenOnce = void 0;
17195
- throw new Error("app actor: claim write token unavailable \u2014 refusing personal-token fallback for claim write (#9511)");
17198
+ if (process.env.MMI_ACTOR?.trim() === "app") {
17199
+ throw new Error("app actor: claim write token unavailable \u2014 refusing personal-token fallback for claim write (#9511)");
17200
+ }
17201
+ return personalClaimWrite(client);
17196
17202
  }
17197
17203
  return createGitHubClient({ token: async () => token });
17198
17204
  }
17205
+ function personalClaimWrite(client) {
17206
+ if (!notedPersonalClaimWrite) {
17207
+ notedPersonalClaimWrite = true;
17208
+ process.stderr.write("note: no App route on this host (no MMI-Hub vault access) \u2014 claim writes go as your own GitHub login\n");
17209
+ }
17210
+ return client;
17211
+ }
17199
17212
  async function selectLivenessClient(client, appClient) {
17200
17213
  if (appClient) return appClient;
17201
17214
  let token;
@@ -22745,6 +22758,7 @@ mutation($projectId: ID!, $itemId: ID!) {
22745
22758
  item { id }
22746
22759
  }
22747
22760
  }`;
22761
+ var BOARD_WRITE_REFUSAL_TYPES = /* @__PURE__ */ new Set(["INSUFFICIENT_SCOPES", "FORBIDDEN", "NOT_FOUND"]);
22748
22762
  async function updateItemSingleSelect(client, projectId, itemId, fieldId, optionId) {
22749
22763
  if (process.env.MMI_ACTOR?.trim() === "app") {
22750
22764
  const { writeHubBoardField: writeHubBoardField2 } = await Promise.resolve().then(() => (init_board_write(), board_write_exports));
@@ -22771,10 +22785,14 @@ async function updateItemSingleSelect(client, projectId, itemId, fieldId, option
22771
22785
  return { credential: "user" };
22772
22786
  } catch (error) {
22773
22787
  const errors = error.graphqlErrors;
22774
- if (errors?.length && errors.every((entry) => entry.type === "INSUFFICIENT_SCOPES")) {
22788
+ if (errors?.length && errors.every((entry) => entry.type !== void 0 && BOARD_WRITE_REFUSAL_TYPES.has(entry.type))) {
22775
22789
  const { writeHubBoardField: writeHubBoardField2 } = await Promise.resolve().then(() => (init_board_write(), board_write_exports));
22776
- await writeHubBoardField2({ projectId, itemId, fieldId, optionId });
22777
- return { credential: "app_installation" };
22790
+ try {
22791
+ await writeHubBoardField2({ projectId, itemId, fieldId, optionId });
22792
+ return { credential: "app_installation" };
22793
+ } catch {
22794
+ throw error;
22795
+ }
22778
22796
  }
22779
22797
  if (isGitHubRateLimitError(error)) {
22780
22798
  const { writeHubBoardField: writeHubBoardField2 } = await Promise.resolve().then(() => (init_board_write(), board_write_exports));
@@ -28367,10 +28385,10 @@ var rollout_plan_default = {
28367
28385
  note: "The v4.0.0 stamp happens at cut time (D6e #4463); until then the candidate is the origin/development head artifacts (built cli/dist + npm pack), identity proven by dist content hash (D6a)."
28368
28386
  },
28369
28387
  baseline: {
28370
- version: "4.6.35",
28371
- tag: "v4.6.35",
28372
- commit: "2a54cf011975",
28373
- npm: "@mutmutco/cli@4.6.35"
28388
+ version: "4.6.36",
28389
+ tag: "v4.6.36",
28390
+ commit: "d1c15e58d6e5",
28391
+ npm: "@mutmutco/cli@4.6.36"
28374
28392
  },
28375
28393
  exitCriterion: "fleet-n-of-n",
28376
28394
  hubOnlyShortcut: "forbidden",
@@ -28387,14 +28405,14 @@ var rollout_plan_default = {
28387
28405
  repo: "mutmutco/mmi-hub",
28388
28406
  role: "canary",
28389
28407
  schedule: "train",
28390
- v3Target: "v4.6.35"
28408
+ v3Target: "v4.6.36"
28391
28409
  }
28392
28410
  ],
28393
28411
  rollbackTrigger: "Any red inside the post-contract soak window: `devops train gate` FAIL attributable to the v4 doors, Hub endpoint health probe failure, a pre-v4 client admitted instead of receiving actionable HTTP 426, or npm consumer install/doctor failure on the v4-only dist.",
28394
28412
  rollback: {
28395
28413
  independent: true,
28396
- mechanism: "npm dist-tag latest -> 4.6.35 and redeploy the Hub Lambda from tag v4.6.35 (2a54cf011975); installed clients repair via `mmi-cli doctor`. No other cohort is touched.",
28397
- v3Target: "v4.6.35 (@mutmutco/cli@4.6.35, tag commit 2a54cf011975 \u2014 last known-good release carrying the repo-index v4-only contract)"
28414
+ mechanism: "npm dist-tag latest -> 4.6.36 and redeploy the Hub Lambda from tag v4.6.36 (d1c15e58d6e5); installed clients repair via `mmi-cli doctor`. No other cohort is touched.",
28415
+ v3Target: "v4.6.36 (@mutmutco/cli@4.6.36, tag commit d1c15e58d6e5 \u2014 last known-good release carrying the repo-index v4-only contract)"
28398
28416
  }
28399
28417
  },
28400
28418
  {
@@ -46149,6 +46167,15 @@ async function attachOnIntegrationRefusal(detail, cfg, contentNodeId, attach = a
46149
46167
  return { warning: `board attach refused: the gh login is an App installation token without Projects access (${detail}) and the Hub App leg failed (${e.message}). If the Hub reports the same refusal, ${PROJECTS_PERMISSION_HINT}` };
46150
46168
  }
46151
46169
  }
46170
+ var ATTACH_AUTHORITY_REFUSAL = /FORBIDDEN|NOT_FOUND|Resource not accessible|missing required scopes|insufficient (?:permissions?|scope)|Could not resolve to a node|does not have (?:access|permission)/i;
46171
+ async function attachOnAuthorityRefusal(detail, cfg, contentNodeId, attach = attachViaHubApp) {
46172
+ if (!ATTACH_AUTHORITY_REFUSAL.test(detail)) return void 0;
46173
+ try {
46174
+ return { projectItemId: await attach(cfg, contentNodeId) };
46175
+ } catch (e) {
46176
+ return { warning: `${detail}; the Hub attach also refused (${e.message}) \u2014 attach needs org-owner, repo-admin or repository write authority on the board's repository` };
46177
+ }
46178
+ }
46152
46179
  async function issueNodeIdForAttach(repo, number, ghView, client) {
46153
46180
  try {
46154
46181
  return (await ghView()).trim();
@@ -63338,6 +63365,24 @@ async function attachToProject(issueNumber, repo, priority) {
63338
63365
  }
63339
63366
  return boardAttachRateLimitedReceipt(resetEpochSeconds);
63340
63367
  }
63368
+ const authority = contentId ? await attachOnAuthorityRefusal(detail, cfg, contentId) : void 0;
63369
+ if (authority && "projectItemId" in authority) {
63370
+ if (priority) {
63371
+ try {
63372
+ await setBoardItemPriority(defaultGitHubClient(), cfg, authority.projectItemId, priority);
63373
+ } catch (pe) {
63374
+ const perr = pe;
63375
+ process.stderr.write(`warning: issue #${issueNumber} board Priority not set: ${(perr.stderr || perr.message || String(pe)).trim()}
63376
+ `);
63377
+ }
63378
+ }
63379
+ return { projectItemId: authority.projectItemId, onBoard: true, credential: "app_installation" };
63380
+ }
63381
+ if (authority) {
63382
+ process.stderr.write(`warning: issue #${issueNumber} created but NOT added to the project board: ${authority.warning}
63383
+ `);
63384
+ return { onBoard: false };
63385
+ }
63341
63386
  process.stderr.write(`warning: issue #${issueNumber} created but NOT added to the project board: ${detail}
63342
63387
  `);
63343
63388
  return { onBoard: false };
@@ -73948,7 +73993,16 @@ setGhWriteTokenProvider(() => {
73948
73993
  throw e;
73949
73994
  });
73950
73995
  });
73951
- setClaimWriteTokenProvider(() => mintFilingWriteToken(appActorDeps()).then((t) => t.token));
73996
+ var claimWriteToken;
73997
+ setClaimWriteTokenProvider(() => {
73998
+ if (process.env.MMI_ACTOR?.trim() === "app") {
73999
+ return mintFilingWriteToken(appActorDeps()).then((t) => t.token);
74000
+ }
74001
+ return claimWriteToken ??= mintFilingWriteToken(appActorDeps()).then((t) => t.token, (e) => {
74002
+ if (e instanceof AppActorError && e.code === "vault-denied") return void 0;
74003
+ throw e;
74004
+ });
74005
+ });
73952
74006
  setStatusWriteTokenProvider(() => mintStatusWriteToken(appActorDeps()));
73953
74007
  var registerPreAction = Reflect.get(program2, ["h", "ook"].join(""));
73954
74008
  registerPreAction.call(program2, "preAction", async (_thisCommand, actionCommand) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mutmutco/cli",
3
- "version": "4.6.35",
3
+ "version": "4.6.36",
4
4
  "description": "MMI Future CLI — the org dev toolbox and shared cross-IDE engine for every registry-declared MMI coding surface.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",