@mcp-use/cli 3.5.3-canary.1 → 3.5.3-canary.10

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.
@@ -43,6 +43,31 @@ interface DeployOptions {
43
43
  */
44
44
  noGithub?: boolean;
45
45
  }
46
+ /** The GitHub App installation page for the given app slug. */
47
+ export declare function gitHubInstallUrl(appName: string): string;
48
+ /**
49
+ * How the GitHub App installation step should behave, given the `--yes` flag
50
+ * and whether stdin is an interactive TTY.
51
+ *
52
+ * - `auto`: caller passed `--yes`; open the browser and poll for completion.
53
+ * - `interactive`: a TTY is attached; ask the user before opening the browser.
54
+ * - `non-interactive`: no TTY and no `--yes` (an agent or CI). We can't block on
55
+ * a prompt that will never be answered, so the caller prints the install URL
56
+ * and bails cleanly instead of hanging.
57
+ */
58
+ type InstallFlowMode = "auto" | "interactive" | "non-interactive";
59
+ export declare function resolveInstallFlowMode(opts: {
60
+ yes: boolean;
61
+ isTTY: boolean;
62
+ }): InstallFlowMode;
63
+ export declare function promptGitHubInstallation(api: McpUseAPI, reason: "not_connected" | "no_access", repoName?: string, opts?: {
64
+ yes?: boolean;
65
+ installationId?: string;
66
+ reauth: () => Promise<McpUseAPI>;
67
+ }): Promise<{
68
+ ok: boolean;
69
+ api: McpUseAPI;
70
+ }>;
46
71
  export declare function deployCommand(options: DeployOptions): Promise<void>;
47
72
  export {};
48
73
  //# sourceMappingURL=deploy.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,cAAc,EAGf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAGL,SAAS,EACV,MAAM,iBAAiB,CAAC;AAgGzB;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,SAAS,EACd,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,M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AO,CAAC;CAChB,GAAG,eAAe,CAGlB;AAED,wBAAsB,wBAAwB,CAC5C,GAAG,EAAE,SAAS,EACd,MAAM,EAAE,eAAe,GAAG,WAAW,EACrC,QAAQ,CAAC,EAAE,MAAM,EACjB,IAAI,CAAC,EAAE;IACL,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,OAAO,CAAC,SAAS,CAAC,CAAC;CAClC,GACA,OAAO,CAAC;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,SAAS,CAAA;CAAE,CAAC,CA+I1C;AA6JD,wBAAsB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CA4xBzE"}
@@ -1 +1 @@
1
- {"version":3,"file":"deployments.d.ts","sourceRoot":"","sources":["../../src/commands/deployments.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAklBpC,wBAAgB,wBAAwB,IAAI,OAAO,CAgElD"}
1
+ {"version":3,"file":"deployments.d.ts","sourceRoot":"","sources":["../../src/commands/deployments.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA6kBpC,wBAAgB,wBAAwB,IAAI,OAAO,CAgElD"}
package/dist/index.cjs CHANGED
@@ -5282,55 +5282,93 @@ async function getGitHubConnectionStatusWith401Retry(api, options, orgIdToRestor
5282
5282
  async function checkRepoAccess(api, owner, repo) {
5283
5283
  return api.checkGitHubRepoAccess(owner, repo);
5284
5284
  }
5285
+ function gitHubInstallUrl(appName) {
5286
+ return `https://github.com/apps/${appName}/installations/new`;
5287
+ }
5288
+ function resolveInstallFlowMode(opts) {
5289
+ if (opts.yes) return "auto";
5290
+ return opts.isTTY ? "interactive" : "non-interactive";
5291
+ }
5285
5292
  async function promptGitHubInstallation(api, reason, repoName, opts) {
5286
5293
  const yes = !!opts?.yes;
5287
5294
  const reauth = opts?.reauth;
5295
+ const noAccess = reason === "no_access";
5296
+ let client = api;
5297
+ let appName;
5298
+ for (; ; ) {
5299
+ try {
5300
+ appName = await client.getGitHubAppName();
5301
+ break;
5302
+ } catch (e) {
5303
+ if (e instanceof ApiUnauthorizedError && reauth) {
5304
+ client = await reauth();
5305
+ await client.testAuth();
5306
+ continue;
5307
+ }
5308
+ throw e;
5309
+ }
5310
+ }
5311
+ const installUrl = gitHubInstallUrl(appName);
5288
5312
  console.log();
5289
- if (reason === "not_connected") {
5290
- console.log(source_default.yellow("\u26A0\uFE0F GitHub account not connected"));
5291
- console.log(
5292
- source_default.white("Deployments require a connected GitHub account.\n")
5293
- );
5294
- } else {
5313
+ if (noAccess) {
5295
5314
  console.log(
5296
5315
  source_default.yellow("\u26A0\uFE0F GitHub App doesn't have access to this repository")
5297
5316
  );
5298
5317
  console.log(
5299
5318
  source_default.white(
5300
- `The GitHub App needs permission to access ${source_default.cyan(repoName || "this repository")}.
5301
- `
5319
+ `The GitHub App needs permission to access ${source_default.cyan(repoName || "this repository")}.`
5302
5320
  )
5303
5321
  );
5322
+ } else {
5323
+ console.log(source_default.yellow("\u26A0\uFE0F GitHub account not connected"));
5324
+ console.log(source_default.white("Deployments require a connected GitHub account."));
5304
5325
  }
5305
- const shouldInstall = yes ? true : await prompt(
5326
+ console.log(
5306
5327
  source_default.white(
5307
- `Would you like to ${reason === "not_connected" ? "connect" : "configure"} GitHub now? (Y/n): `
5308
- ),
5309
- "y"
5328
+ `
5329
+ Install${noAccess ? " / configure" : ""} the GitHub App to continue:`
5330
+ )
5310
5331
  );
5311
- if (!shouldInstall) return { ok: false, api };
5312
- let client = api;
5313
- try {
5314
- let appName;
5315
- for (; ; ) {
5316
- try {
5317
- appName = await client.getGitHubAppName();
5318
- break;
5319
- } catch (e) {
5320
- if (e instanceof ApiUnauthorizedError && reauth) {
5321
- client = await reauth();
5322
- await client.testAuth();
5323
- continue;
5324
- }
5325
- throw e;
5326
- }
5332
+ console.log(source_default.cyan.bold(` ${installUrl}`));
5333
+ if (noAccess) {
5334
+ console.log(
5335
+ source_default.gray(
5336
+ ` Grant access to ${repoName || "your repository"} on the app's settings page.`
5337
+ )
5338
+ );
5339
+ }
5340
+ const mode = resolveInstallFlowMode({ yes, isTTY: !!process.stdin.isTTY });
5341
+ if (mode === "non-interactive") {
5342
+ console.log(
5343
+ source_default.white(
5344
+ `
5345
+ Open the URL above to install the GitHub App, then re-run ${source_default.cyan("mcp-use deploy")}.`
5346
+ )
5347
+ );
5348
+ return { ok: false, api: client };
5349
+ }
5350
+ if (mode === "interactive") {
5351
+ const shouldInstall = await prompt(
5352
+ source_default.white(
5353
+ `
5354
+ Would you like to ${noAccess ? "configure" : "connect"} GitHub now? (Y/n): `
5355
+ ),
5356
+ "y"
5357
+ );
5358
+ if (!shouldInstall) {
5359
+ console.log(
5360
+ source_default.gray(
5361
+ `
5362
+ Open the URL above when ready, then re-run ${source_default.cyan("mcp-use deploy")}.`
5363
+ )
5364
+ );
5365
+ return { ok: false, api: client };
5327
5366
  }
5328
- const installUrl = `https://github.com/apps/${appName}/installations/new`;
5367
+ }
5368
+ try {
5329
5369
  console.log(source_default.cyan(`
5330
5370
  Opening browser...`));
5331
- console.log(source_default.gray(`URL: ${installUrl}
5332
- `));
5333
- if (reason === "no_access") {
5371
+ if (noAccess) {
5334
5372
  console.log(
5335
5373
  source_default.white("Please add ") + source_default.cyan.bold(repoName || "your repository") + source_default.white(" to the app's repository access, then return here.\n")
5336
5374
  );
@@ -5340,7 +5378,7 @@ Opening browser...`));
5340
5378
  );
5341
5379
  }
5342
5380
  await open_default(installUrl);
5343
- if (!yes) {
5381
+ if (mode === "interactive") {
5344
5382
  await prompt(source_default.white("Press Enter when done..."), "y");
5345
5383
  } else {
5346
5384
  console.log(source_default.gray("Waiting for GitHub configuration (polling)..."));
@@ -5373,7 +5411,7 @@ Opening browser...`));
5373
5411
  }
5374
5412
  console.log(source_default.yellow("\n\u26A0\uFE0F Unable to open browser automatically"));
5375
5413
  console.log(
5376
- source_default.white("Please visit: ") + source_default.cyan("https://manufact.com/cloud/settings")
5414
+ source_default.white("Please open the URL above: ") + source_default.cyan(installUrl)
5377
5415
  );
5378
5416
  return { ok: false, api: client };
5379
5417
  }
@@ -5959,12 +5997,8 @@ async function deployCommand(options) {
5959
5997
  \u2717 Repository ${source_default.cyan(repoFullName)} is still not accessible.`
5960
5998
  )
5961
5999
  );
5962
- console.log(
5963
- source_default.cyan(
5964
- ` https://github.com/apps/${appName}/installations/new
5965
- `
5966
- )
5967
- );
6000
+ console.log(source_default.cyan(` ${gitHubInstallUrl(appName)}
6001
+ `));
5968
6002
  process.exit(1);
5969
6003
  }
5970
6004
  }
@@ -6303,10 +6337,7 @@ async function listDeploymentsCommand(options) {
6303
6337
  serverOrgMap.set(uniqueServerIds[i], orgName);
6304
6338
  }
6305
6339
  }
6306
- const sortedDeployments = [...deployments].sort(
6307
- (a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()
6308
- );
6309
- if (sortedDeployments.length === 0) {
6340
+ if (deployments.length === 0) {
6310
6341
  if (page.total === 0) {
6311
6342
  console.log(source_default.yellow("No deployments found."));
6312
6343
  console.log(
@@ -6327,7 +6358,7 @@ async function listDeploymentsCommand(options) {
6327
6358
  `
6328
6359
  \u{1F4E6} ${formatPageHeader(
6329
6360
  "Deployments",
6330
- sortedDeployments.length,
6361
+ deployments.length,
6331
6362
  page.total
6332
6363
  )}
6333
6364
  `
@@ -6339,7 +6370,7 @@ async function listDeploymentsCommand(options) {
6339
6370
  )
6340
6371
  );
6341
6372
  console.log(source_default.gray("\u2500".repeat(155)));
6342
- for (const deployment of sortedDeployments) {
6373
+ for (const deployment of deployments) {
6343
6374
  const id = formatId(deployment.id).padEnd(40);
6344
6375
  const name = deployment.name.substring(0, 24).padEnd(25);
6345
6376
  const orgName = deployment.serverId ? serverOrgMap.get(deployment.serverId) ?? "-" : "-";