@mutagent/cli 0.1.401 → 0.1.403

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/bin/cli.js +33 -15
  2. package/package.json +1 -1
package/dist/bin/cli.js CHANGED
@@ -31192,6 +31192,14 @@ function printStatusHuman(status) {
31192
31192
  const linked = status.linkedRepositories.map((repo) => repo.name).join(", ");
31193
31193
  console.log(` ${linked === "" ? chalk42.yellow("·") : chalk42.green("✓")} repos ${linked === "" ? "(none linked)" : linked}`);
31194
31194
  }
31195
+ var CONNECT_GITHUB = "mutagent gateway connect github --wait";
31196
+ var GRANT_MORE = "mutagent gateway repos grant-more";
31197
+ async function countReachable(github) {
31198
+ const scoped = github?.scope?.items.length ?? 0;
31199
+ if (scoped > 0)
31200
+ return scoped;
31201
+ return (await listRepositories()).items.length;
31202
+ }
31195
31203
  function registerGatewayStatusCommands(gateway) {
31196
31204
  gateway.action(async () => {
31197
31205
  const isJson = gatewayIsJson(gateway);
@@ -31228,37 +31236,47 @@ Examples:
31228
31236
  ${chalk42.dim("$")} mutagent gateway doctor
31229
31237
  ${chalk42.dim("$")} mutagent gateway doctor --json
31230
31238
 
31231
- Checks: GitHub/Slack connection state, a repository is linked, and — the one thing
31232
- 'status' does not check — that every linked repository is still reachable through the
31233
- GitHub installation (access can be revoked after it was linked).
31239
+ Checks:
31240
+ github_connected GitHub is connected to the workspace
31241
+ repositories_reachable the GitHub App reaches at least one repository
31242
+ linked_repositories_reachable every linked repository is still reachable (only when
31243
+ something is linked; access can be revoked after linking)
31244
+
31245
+ Linking is not a setup step: any repository the GitHub App reaches is usable and links
31246
+ itself on first use. To reach more repositories, widen the App's access with
31247
+ 'mutagent gateway repos grant-more'.
31234
31248
 
31235
31249
  AI Agent Directive:
31236
31250
  --json returns { success, ok, data: { ...status, checks: [{ name, pass, detail }] } }.
31237
31251
  When any check fails it is a GATEWAY_CHECKS_FAILED failure (exit 1) that still carries
31238
31252
  data.checks; _agentGuidance.fix lists each failing check's fix command, in order.
31253
+ An empty linkedRepositories with every check passing is healthy: do not link anything.
31239
31254
  `).action(async () => {
31240
31255
  const isJson = gatewayIsJson(gateway);
31241
31256
  await runGatewayAction(isJson, undefined, async () => {
31242
31257
  const status = await computeGatewayStatus();
31258
+ const githubConnected = status.connections.github?.state === "connected";
31243
31259
  const checks = [
31244
31260
  {
31245
31261
  name: "github_connected",
31246
- pass: status.connections.github?.state === "connected",
31247
- detail: status.connections.github?.state === "connected" ? "connected" : "mutagent gateway connect github --wait"
31248
- },
31249
- {
31250
- name: "repository_linked",
31251
- pass: status.linkedRepositories.length > 0,
31252
- detail: status.linkedRepositories.length > 0 ? status.linkedRepositories.map((repo) => repo.name).join(", ") : "mutagent gateway repos link <owner/name>"
31262
+ pass: githubConnected,
31263
+ detail: githubConnected ? "connected" : CONNECT_GITHUB
31253
31264
  }
31254
31265
  ];
31255
- if (status.linkedRepositories.length > 0 && status.connections.github?.state === "connected") {
31256
- const reachable = new Set((await listAllRepositories()).map((repo) => repo.id));
31266
+ const allReachable = githubConnected && status.linkedRepositories.length > 0 ? await listAllRepositories() : undefined;
31267
+ const reachableCount = githubConnected ? allReachable?.length ?? await countReachable(status.connections.github) : 0;
31268
+ checks.push({
31269
+ name: "repositories_reachable",
31270
+ pass: reachableCount > 0,
31271
+ detail: !githubConnected ? CONNECT_GITHUB : reachableCount > 0 ? "reachable" : GRANT_MORE
31272
+ });
31273
+ if (allReachable !== undefined) {
31274
+ const reachable = new Set(allReachable.map((repo) => repo.id));
31257
31275
  const lost = status.linkedRepositories.filter((repo) => !reachable.has(repo.repositoryId));
31258
31276
  checks.push({
31259
31277
  name: "linked_repositories_reachable",
31260
31278
  pass: lost.length === 0,
31261
- detail: lost.length === 0 ? "reachable" : "mutagent gateway repos grant-more"
31279
+ detail: lost.length === 0 ? "reachable" : GRANT_MORE
31262
31280
  });
31263
31281
  }
31264
31282
  const data = { ...status, checks };
@@ -31276,7 +31294,7 @@ AI Agent Directive:
31276
31294
  return;
31277
31295
  }
31278
31296
  const failure = new GatewayCliError("GATEWAY_CHECKS_FAILED", `${String(failing.length)} gateway check(s) failed: ${failing.map((c) => c.name).join(", ")}.`, {
31279
- fix: failing.map((c) => c.detail),
31297
+ fix: [...new Set(failing.map((c) => c.detail))],
31280
31298
  notes: ["Run the fixes in order, then run mutagent gateway doctor again."]
31281
31299
  });
31282
31300
  return printGatewayFailureWithData(isJson, failure, data, printChecks);
@@ -37203,4 +37221,4 @@ if (process.env.CLI_VERSION) {
37203
37221
  }
37204
37222
  runCli(process.argv.slice(2), cliVersion);
37205
37223
 
37206
- //# debugId=D8F738AA79625F7864756E2164756E21
37224
+ //# debugId=4DDFC9D9B03329D764756E2164756E21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mutagent/cli",
3
- "version": "0.1.401",
3
+ "version": "0.1.403",
4
4
  "description": "Bun-native CLI for the MutagenT AI platform - auth, provider config, and lifecycle-tool installer for AI-native workflows",
5
5
  "type": "module",
6
6
  "bin": {