@mnemonik/cli 7.131.0 → 7.132.0

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 (49) hide show
  1. package/dist/auth/claudeCodeSignIn.d.ts +54 -0
  2. package/dist/auth/claudeCodeSignIn.d.ts.map +1 -0
  3. package/dist/auth/claudeCodeSignIn.js +108 -0
  4. package/dist/auth/claudeCodeSignIn.js.map +1 -0
  5. package/dist/auth/codexAuthorization.d.ts +47 -0
  6. package/dist/auth/codexAuthorization.d.ts.map +1 -0
  7. package/dist/auth/codexAuthorization.js +882 -0
  8. package/dist/auth/codexAuthorization.js.map +1 -0
  9. package/dist/auth/cursorAuthorization.d.ts +47 -0
  10. package/dist/auth/cursorAuthorization.d.ts.map +1 -0
  11. package/dist/auth/cursorAuthorization.js +116 -0
  12. package/dist/auth/cursorAuthorization.js.map +1 -0
  13. package/dist/auth/status.d.ts +65 -11
  14. package/dist/auth/status.d.ts.map +1 -1
  15. package/dist/auth/status.js +41 -12
  16. package/dist/auth/status.js.map +1 -1
  17. package/dist/auth/storedAuthorization.d.ts +50 -0
  18. package/dist/auth/storedAuthorization.d.ts.map +1 -0
  19. package/dist/auth/storedAuthorization.js +24 -0
  20. package/dist/auth/storedAuthorization.js.map +1 -0
  21. package/dist/authorizationWords.d.ts +69 -0
  22. package/dist/authorizationWords.d.ts.map +1 -0
  23. package/dist/authorizationWords.js +5275 -0
  24. package/dist/authorizationWords.js.map +1 -0
  25. package/dist/digests.json +47 -27
  26. package/dist/humanReason.js +6 -6
  27. package/dist/humanReason.js.map +1 -1
  28. package/dist/install/hosts.d.ts.map +1 -1
  29. package/dist/install/hosts.js +2 -1
  30. package/dist/install/hosts.js.map +1 -1
  31. package/dist/installation.d.ts +2 -0
  32. package/dist/installation.d.ts.map +1 -1
  33. package/dist/installation.js +12 -0
  34. package/dist/installation.js.map +1 -1
  35. package/dist/output.d.ts +5 -2
  36. package/dist/output.d.ts.map +1 -1
  37. package/dist/output.js +7 -3
  38. package/dist/output.js.map +1 -1
  39. package/dist/router.d.ts +12 -7
  40. package/dist/router.d.ts.map +1 -1
  41. package/dist/router.js +145 -62
  42. package/dist/router.js.map +1 -1
  43. package/dist/sbom.json +21 -21
  44. package/dist/scanner-release.json +18 -18
  45. package/dist/status.d.ts +67 -30
  46. package/dist/status.d.ts.map +1 -1
  47. package/dist/status.js +140 -33
  48. package/dist/status.js.map +1 -1
  49. package/package.json +31 -31
package/dist/router.d.ts CHANGED
@@ -9,6 +9,9 @@ import { type PreflightDependencies } from './preflight.js';
9
9
  import { type InstallSessionTransport } from './installSession.js';
10
10
  import { type ProjectExecutor, type ProjectReadTransport } from './project.js';
11
11
  import { type ReadinessCondition, resolveProjectIdentity } from '@mnemonik/shared';
12
+ import { type ClaudeCodeStoreOptions } from './auth/claudeCodeSignIn.js';
13
+ import { type CodexStoreOptions } from './auth/codexAuthorization.js';
14
+ import { type CursorStoreOptions } from './auth/cursorAuthorization.js';
12
15
  import { type EditorLoginOverrides } from './auth/pkce.js';
13
16
  import { type ScannerPickerResult } from './scanner/picker.js';
14
17
  import { type InstallDependencies } from './install/transaction.js';
@@ -28,14 +31,10 @@ export declare const SCANNER_REMOVED_LINE = "Background indexing removed from th
28
31
  export declare const dataDeletePrompt: (projectId: string) => string;
29
32
  export declare const stillWatchedLine: (root: string) => string;
30
33
  export declare const identityFileKeptLine = "This folder's .mnemonik.json still points at the deleted project. Connecting the folder again creates a new project.";
31
- export declare const CODEX_SIGNED_IN_MESSAGE = "Codex is signed in to Mnemonik.";
32
- /** An editor signed in on another of the person's machines (L-182). */
33
- export declare const signedInElsewhereMessage: (editor: string) => string;
34
- /** A coding tool with a valid sign-in on this machine; `mnemonik connect` has nothing to do. */
35
- export declare const alreadySignedInMessage: (editor: string, lastUsedAt: string | null) => string;
34
+ export declare const CODEX_SIGNED_IN_MESSAGE = "Codex MCP: authorized.";
36
35
  /** For the agent running `connect --json`: what to do with the link it was given. */
37
- export declare const SIGN_IN_LINK_REASON = "Give this link to the person to approve the Codex sign-in. This command finishes when they do.";
38
- export declare const CONNECT_NOT_APPROVED_MESSAGE = "Sign-in timed out. Run mnemonik connect codex to try again.";
36
+ export declare const SIGN_IN_LINK_REASON = "Give this link to the person to authorize Codex MCP. This command finishes when they do.";
37
+ export declare const CONNECT_NOT_APPROVED_MESSAGE = "Codex MCP was not authorized in time. Run mnemonik connect codex to try again.";
39
38
  export declare function maintenanceExitCode(results: readonly Pick<HostResult, 'status'>[]): number;
40
39
  export declare const help: string;
41
40
  export interface CliDependencies {
@@ -84,6 +83,12 @@ export interface CliDependencies {
84
83
  statusDetails?: StatusDocumentInput['details'];
85
84
  codexTrustConditions?: () => Promise<readonly ReadinessCondition[]>;
86
85
  diagnostics?: DiagnosticsDependencies;
86
+ /** Where Claude Code's own stored authorization is read: this platform, environment and Keychain by default. */
87
+ claudeCodeStore?: Omit<ClaudeCodeStoreOptions, 'home'>;
88
+ /** Where Codex's own stored authorization is read: this platform and environment by default. */
89
+ codexStore?: Omit<CodexStoreOptions, 'home'>;
90
+ /** Where Cursor's own stored authorization is read: this platform, environment and node:sqlite by default. */
91
+ cursorStore?: Omit<CursorStoreOptions, 'home'>;
87
92
  }
88
93
  export declare function runCli(args: string[], deps?: CliDependencies): Promise<number>;
89
94
  //# sourceMappingURL=router.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAqC,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAU5F,OAAO,EAIL,KAAK,qBAAqB,EAC3B,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAML,KAAK,gBAAgB,EAErB,KAAK,UAAU,EAEhB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAiD,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAGpG,OAAO,EAA+B,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAKrF,OAAO,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,CAAC;IACvC,aAAa,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IACvC,6GAA6G;IAC7G,wBAAwB,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC7D,aAAa,CAAC,EAAE,MAAM,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACnD,sBAAsB,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAC;IACvD,qBAAqB,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAC;IACtD,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,aAAa,CAAC,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;IAC/C,oBAAoB,CAAC,EAAE,MAAM,OAAO,CAAC,SAAS,kBAAkB,EAAE,CAAC,CAAC;IACpE,WAAW,CAAC,EAAE,uBAAuB,CAAC;IACtC,gHAAgH;IAChH,eAAe,CAAC,EAAE,IAAI,CAAC,sBAAsB,EAAE,MAAM,CAAC,CAAC;IACvD,gGAAgG;IAChG,UAAU,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;IAC7C,8GAA8G;IAC9G,WAAW,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;CAChD;AA6tCD,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,GAAE,eAAoB,GAAG,OAAO,CAAC,MAAM,CAAC,CAwqCxF"}
package/dist/router.js CHANGED
@@ -7715,13 +7715,20 @@ import {
7715
7715
  import { evaluateRoot } from "./project/eligibility.js";
7716
7716
  import { accountActions } from "./transport/server.js";
7717
7717
  import {
7718
- codingToolSignIn,
7719
7718
  grantTransport,
7720
7719
  grantHost,
7721
7720
  grantSummaryLines,
7722
- relativeTime,
7721
+ mcpAuthorization,
7722
+ serverAuthorization,
7723
7723
  validGrant
7724
7724
  } from "./auth/status.js";
7725
+ import {
7726
+ claudeCodeStoredAuthorization
7727
+ } from "./auth/claudeCodeSignIn.js";
7728
+ import { codexStoredAuthorization } from "./auth/codexAuthorization.js";
7729
+ import { cursorStoredAuthorization } from "./auth/cursorAuthorization.js";
7730
+ import { authorizeStep, mcpLine, storeNote } from "./authorizationWords.js";
7731
+ import { installationEmail } from "./installation.js";
7725
7732
  import { createCliAuth } from "./auth/index.js";
7726
7733
  import { OAuthProtocolError, runEditorLogin } from "./auth/pkce.js";
7727
7734
  import { currentInstallSession, ensureInstallSession } from "./auth/installSession.js";
@@ -7735,9 +7742,10 @@ import {
7735
7742
  import { chooseHostProfile, simulatedInstall, terminalInstallUI } from "./install/ui.js";
7736
7743
  import {
7737
7744
  CODEX_TRUST_MESSAGE,
7738
- codingToolLines,
7745
+ authorizationEntries,
7739
7746
  codingToolStatuses,
7740
7747
  collectStatusDocument,
7748
+ hookAuthorizations,
7741
7749
  installedCodingTools,
7742
7750
  localEditorStatus,
7743
7751
  localInstallationConditions,
@@ -7746,6 +7754,7 @@ import {
7746
7754
  renderRefusals,
7747
7755
  REPORT_NOT_SENT,
7748
7756
  renderScannerFailure,
7757
+ scannerAuthorization,
7749
7758
  statusExitCode,
7750
7759
  withCodingTools
7751
7760
  } from "./status.js";
@@ -7811,11 +7820,9 @@ async function uninstallScannerOptOut(deps, output, service, json) {
7811
7820
  var dataDeletePrompt = (projectId) => `This deletes everything background indexing has sent for ${projectId} from your account. Type yes to continue.`;
7812
7821
  var stillWatchedLine = (root) => `The folder is still being indexed. Run mnemonik remove ${root} to stop that.`;
7813
7822
  var identityFileKeptLine = "This folder's .mnemonik.json still points at the deleted project. Connecting the folder again creates a new project.";
7814
- var CODEX_SIGNED_IN_MESSAGE = "Codex is signed in to Mnemonik.";
7815
- var signedInElsewhereMessage = (editor) => `${editor} is already signed in to Mnemonik from another of your machines.`;
7816
- var alreadySignedInMessage = (editor, lastUsedAt) => `${editor} is already signed in to Mnemonik on this computer${lastUsedAt ? `, last used ${relativeTime(Date.parse(lastUsedAt), Date.now())}` : ""}.`;
7817
- var SIGN_IN_LINK_REASON = "Give this link to the person to approve the Codex sign-in. This command finishes when they do.";
7818
- var CONNECT_NOT_APPROVED_MESSAGE = "Sign-in timed out. Run mnemonik connect codex to try again.";
7823
+ var CODEX_SIGNED_IN_MESSAGE = "Codex MCP: authorized.";
7824
+ var SIGN_IN_LINK_REASON = "Give this link to the person to authorize Codex MCP. This command finishes when they do.";
7825
+ var CONNECT_NOT_APPROVED_MESSAGE = "Codex MCP was not authorized in time. Run mnemonik connect codex to try again.";
7819
7826
  function maintenanceExitCode(results) {
7820
7827
  if (results.some((result) => result.status === "FAILED")) return 1;
7821
7828
  return results.every((result) => result.status === "READY") ? 0 : 3;
@@ -8690,23 +8697,68 @@ async function installCommand(parsed, deps, output) {
8690
8697
  function refusalStateDir(deps) {
8691
8698
  return deps.projectStateDir ?? deps.installStateDir ?? stateDirectory(process.platform, process.env, deps.home);
8692
8699
  }
8693
- async function codingToolSignIns(deps, output, hosts) {
8694
- if (!hosts.length) return /* @__PURE__ */ new Map();
8695
- const bearer = await auth(deps, output, false).getCliBearer().catch(() => void 0);
8696
- if (typeof bearer !== "string") return void 0;
8700
+ async function storedAuthorizations(deps, hosts) {
8701
+ const home = deps.home ?? homedir4();
8702
+ const readers = {
8703
+ "claude-code": () => claudeCodeStoredAuthorization({ home, ...deps.claudeCodeStore }),
8704
+ codex: () => codexStoredAuthorization({ home, ...deps.codexStore }),
8705
+ cursor: () => cursorStoredAuthorization({ home, ...deps.cursorStore })
8706
+ };
8707
+ return new Map(
8708
+ await Promise.all(
8709
+ hosts.map(async (host) => [host, await readers[host]().catch(() => void 0)])
8710
+ )
8711
+ );
8712
+ }
8713
+ async function authorizationEvidence(deps, output, hosts) {
8714
+ const [server, stored] = await Promise.all([
8715
+ serverAuthorizations(deps, output, hosts),
8716
+ storedAuthorizations(deps, hosts)
8717
+ ]);
8718
+ const problem = server.cli.state === "locked" ? "cli_locked" : server.cli.state === "not_signed_in" || server.cli.state === "signed_out" ? "cli_not_signed_in" : "unreachable";
8719
+ return {
8720
+ cli: server.cli,
8721
+ mcp: new Map(
8722
+ hosts.map((host) => [
8723
+ host,
8724
+ mcpAuthorization(server.tools?.get(host), stored.get(host), problem)
8725
+ ])
8726
+ )
8727
+ };
8728
+ }
8729
+ async function serverAuthorizations(deps, output, hosts) {
8730
+ const bearer = await auth(deps, output, false).getCliBearer().catch(
8731
+ (error) => isCredentialSessionUnavailableError(error) ? "locked" : void 0
8732
+ );
8733
+ if (bearer === "locked") return { cli: { state: "locked" } };
8734
+ if (typeof bearer !== "string")
8735
+ return {
8736
+ cli: {
8737
+ state: bearer?.reason === "family_missing" ? "not_signed_in" : bearer?.status === "ACTION_REQUIRED" ? "signed_out" : "unconfirmed"
8738
+ }
8739
+ };
8740
+ if (!hosts.length)
8741
+ return {
8742
+ cli: {
8743
+ state: "signed_in",
8744
+ email: await installationEmail(
8745
+ deps.installStateDir ?? stateDirectory(process.platform, process.env, deps.home)
8746
+ )
8747
+ }
8748
+ };
8697
8749
  const send = deps.grantFetch ?? globalThis.fetch;
8698
8750
  const grants = grantTransport(
8699
8751
  async () => bearer,
8700
8752
  (url, options) => send(url, { ...options, signal: AbortSignal.timeout(2500) })
8701
8753
  );
8702
8754
  const here = await grants.list({ here: true }).catch(() => void 0);
8703
- if (!here) return void 0;
8704
- const result = new Map(hosts.map((host) => [host, codingToolSignIn(host, here)]));
8705
- if ([...result].some(([host, signIn]) => host === "cursor" && signIn.state !== "signed_in")) {
8755
+ if (!here) return { cli: { state: "unconfirmed" } };
8756
+ const tools = new Map(hosts.map((host) => [host, serverAuthorization(host, here)]));
8757
+ if ([...tools].some(([host, found]) => host === "cursor" && found.state !== "authorized")) {
8706
8758
  const everywhere = await grants.list().catch(() => void 0);
8707
- if (everywhere) result.set("cursor", codingToolSignIn("cursor", here, everywhere));
8759
+ if (everywhere) tools.set("cursor", serverAuthorization("cursor", here, everywhere));
8708
8760
  }
8709
- return result;
8761
+ return { cli: { state: "signed_in", email: here.email ?? null }, tools };
8710
8762
  }
8711
8763
  async function doctorCommand(parsed, deps, output) {
8712
8764
  const invalid = allowed(parsed, []);
@@ -9332,42 +9384,59 @@ Preview: ${preview.path}
9332
9384
  output,
9333
9385
  parsed.flags.has("json") ? void 0 : (line) => output.line(line)
9334
9386
  );
9335
- const editors = await installedCodingTools(
9336
- deps.home ?? homedir4(),
9337
- deps.hostManagement?.stateDir ?? deps.installStateDir ?? stateDirectory(process.platform, process.env, deps.home)
9338
- );
9339
- const shown = withCodingTools(
9340
- document,
9341
- codingToolStatuses(
9342
- editors,
9343
- document.conditions ?? [],
9344
- await codingToolSignIns(
9345
- deps,
9346
- output,
9347
- editors.map((editor) => editor.host).filter(
9348
- (host) => hostOrder.includes(host)
9349
- )
9350
- )
9387
+ const stateDir = deps.hostManagement?.stateDir ?? deps.installStateDir ?? stateDirectory(process.platform, process.env, deps.home);
9388
+ const editors = await installedCodingTools(deps.home ?? homedir4(), stateDir);
9389
+ const evidence = await authorizationEvidence(
9390
+ deps,
9391
+ output,
9392
+ editors.map((editor) => editor.host).filter(
9393
+ (host) => hostOrder.includes(host)
9351
9394
  )
9352
9395
  );
9396
+ const tools = codingToolStatuses(
9397
+ editors,
9398
+ document.conditions ?? [],
9399
+ evidence.mcp,
9400
+ await hookAuthorizations(stateDir, editors)
9401
+ );
9402
+ const scanner = await scannerAuthorization(
9403
+ deps.projectStateDir ?? deps.installStateDir ?? stateDirectory(process.platform, process.env, deps.home)
9404
+ );
9405
+ const shown = withCodingTools(document, tools, evidence.mcp, scanner);
9406
+ const authorizations = authorizationEntries({
9407
+ tools,
9408
+ mcp: evidence.mcp,
9409
+ conditions: shown.conditions ?? [],
9410
+ scanner,
9411
+ cli: evidence.cli
9412
+ });
9353
9413
  const version = await packageVersion();
9354
9414
  const store = new RuntimeStore(
9355
9415
  deps.installStateDir ?? stateDirectory(process.platform, process.env, deps.home)
9356
9416
  );
9357
9417
  if (!parsed.flags.has("json")) {
9358
9418
  renderStatusSummaries(shown, output, { agent: !personPresent(parsed, deps) });
9359
- for (const line of codingToolLines(shown.codingTools)) output.line(line);
9419
+ for (const entry of authorizations)
9420
+ if (entry.component === "cli" && entry.state === "signed_in")
9421
+ output.cliSignedIn(entry.email);
9422
+ else output.line(entry.line);
9360
9423
  await renderRefusals(refusalStateDir(deps), output);
9361
9424
  }
9362
9425
  const hint = await cliUpdateHint(store, version);
9363
9426
  if (parsed.flags.has("json"))
9364
- output.json({ ...shown, cli: { version, ...hint ? { updateAvailable: hint } : {} } });
9427
+ output.json({
9428
+ ...shown,
9429
+ // The account is shown to the person only; JSON stays free of it.
9430
+ authorizations: authorizations.map(
9431
+ (entry) => entry.component === "cli" && entry.state === "signed_in" ? { component: "cli", state: "signed_in", line: "CLI: signed in." } : entry
9432
+ ),
9433
+ cli: { version, ...hint ? { updateAvailable: hint } : {} }
9434
+ });
9365
9435
  else if (hint) output.line(hint);
9366
9436
  const reported = await reportCurrentInstallation(deps, output, document);
9367
- if (reported === "signed_out" && !parsed.flags.has("json")) {
9437
+ if (reported === "signed_out" && !parsed.flags.has("json"))
9368
9438
  output.line(REPORT_NOT_SENT.sentence);
9369
- output.line(REPORT_NOT_SENT.nextStep);
9370
- } else if (typeof reported === "object" && !parsed.flags.has("json"))
9439
+ else if (typeof reported === "object" && !parsed.flags.has("json"))
9371
9440
  output.line(humanReason(reported.refused));
9372
9441
  return statusExitCode(shown);
9373
9442
  }
@@ -9380,23 +9449,17 @@ Preview: ${preview.path}
9380
9449
  const editor = (await localEditorStatus(deps.home ?? homedir4())).find(
9381
9450
  (candidate) => candidate.host === host
9382
9451
  );
9383
- const signIn = editor?.mcp === "ready" ? await codingToolSignIns(deps, output, [host]) : void 0;
9384
- const current = signIn?.get(host);
9385
- if (current?.state === "signed_in" || current?.state === "signed_in_elsewhere") {
9386
- const message = current.state === "signed_in_elsewhere" ? signedInElsewhereMessage(launchHostLabels[host]) : alreadySignedInMessage(launchHostLabels[host], current.lastUsedAt);
9387
- if (parsed.flags.has("json"))
9388
- output.json(
9389
- current.state === "signed_in" ? {
9390
- status: "READY",
9391
- signIn: current.state,
9392
- lastUsedAt: current.lastUsedAt,
9393
- reason: message
9394
- } : { status: "READY", reason: message }
9395
- );
9396
- else output.line(message);
9452
+ const tool = launchHostLabels[host];
9453
+ const mcp = editor?.mcp === "ready" ? (await authorizationEvidence(deps, output, [host])).mcp.get(host) : void 0;
9454
+ const json = parsed.flags.has("json");
9455
+ if (mcp && ["authorized", "authorized_elsewhere", "store_unchecked", "server_unchecked"].includes(
9456
+ mcp.state
9457
+ )) {
9458
+ const line = mcpLine(tool, host, mcp);
9459
+ if (json) output.json({ status: "READY", reason: line, mcp });
9460
+ else output.line(line);
9397
9461
  return 0;
9398
9462
  }
9399
- const json = parsed.flags.has("json");
9400
9463
  if (host === "codex" && editor?.mcp === "ready") {
9401
9464
  const bearer = await auth(deps, output, false).getCliBearer().catch(() => void 0);
9402
9465
  if (typeof bearer === "string") {
@@ -9430,11 +9493,11 @@ Preview: ${preview.path}
9430
9493
  }
9431
9494
  }
9432
9495
  }
9433
- const reason = editor?.mcp === "disabled" ? `${editor.name} connection is turned off.` : editor?.mcp === "ready" ? "Finish signing in to Mnemonik in the coding tool." : `${launchHostLabels[host]} connection is missing.`;
9496
+ const reason = editor?.mcp === "disabled" ? `${tool} MCP: turned off.` : editor?.mcp === "ready" && mcp ? mcpLine(tool, host, mcp, false) : `${tool} MCP: not set up on this computer.`;
9434
9497
  const actions = editor?.mcp === "ready" ? editorAuthorizationRows([host]) : [
9435
9498
  editor?.mcp === "disabled" ? mcpTurnOnAction[host] : "Run mnemonik install to set it up again."
9436
9499
  ];
9437
- if (parsed.flags.has("json")) output.json({ status: "ACTION_REQUIRED", reason, actions });
9500
+ if (json) output.json({ status: "ACTION_REQUIRED", reason, actions, ...mcp ? { mcp } : {} });
9438
9501
  else {
9439
9502
  output.line(reason);
9440
9503
  for (const action of actions) output.line(action);
@@ -9804,16 +9867,38 @@ Preview: ${preview.path}
9804
9867
  return (!grantHostName || hostOrder.includes(grantHostName)) && (!host || grantHostName === host);
9805
9868
  }).map((g) => ({ ...g, host: grantHost(g) ?? g.clientName ?? g.clientId }));
9806
9869
  const signedIn = grants.filter(validGrant);
9807
- if (parsed.flags.has("json")) output.json({ account: status.account, grants });
9870
+ const tools = hostOrder.filter((tool) => !host || tool === host);
9871
+ const stored = await storedAuthorizations(deps, tools);
9872
+ const storedJson = Object.fromEntries(
9873
+ [...stored].filter((entry) => !!entry[1])
9874
+ );
9875
+ if (parsed.flags.has("json"))
9876
+ output.json({
9877
+ account: status.account,
9878
+ grants,
9879
+ ...Object.keys(storedJson).length ? { stored: storedJson } : {}
9880
+ });
9808
9881
  else if (!signedIn.length)
9809
9882
  output.line(
9810
- host ? `${launchHostLabels[host]} is not signed in.` : humanReason("not_signed_in")
9883
+ host ? `${launchHostLabels[host]} MCP: not authorized on any of your computers.` : humanReason("not_signed_in")
9811
9884
  );
9812
9885
  else {
9813
- output.signedInAs(status.email);
9814
- for (const line of grantSummaryLines(signedIn, launchHostLabels)) output.line(line);
9886
+ output.cliSignedIn(status.email);
9887
+ const onThisComputer = (tool) => (summary2) => {
9888
+ const here = stored.get(tool);
9889
+ const note = storeNote(launchHostLabels[tool], here);
9890
+ if (!note) return summary2;
9891
+ return `${summary2}. ${note}${here?.state === "missing" ? ` ${authorizeStep(tool)}` : ""}`;
9892
+ };
9893
+ for (const line of grantSummaryLines(
9894
+ signedIn,
9895
+ launchHostLabels,
9896
+ Date.now(),
9897
+ Object.fromEntries(tools.map((tool) => [tool, onThisComputer(tool)]))
9898
+ ))
9899
+ output.line(line);
9815
9900
  output.line(
9816
- "Older sign-ins stay valid until `mnemonik auth logout`. `mnemonik auth status --json` lists every one."
9901
+ "These are your account's authorizations on all your computers. Older ones stay valid until `mnemonik auth logout`, and `mnemonik auth status --json` lists every one."
9817
9902
  );
9818
9903
  }
9819
9904
  return 0;
@@ -9859,7 +9944,6 @@ export {
9859
9944
  SCANNER_UNINSTALL_PROMPT,
9860
9945
  SIGN_IN_LINK_REASON,
9861
9946
  alreadyConnectedFolderLine,
9862
- alreadySignedInMessage,
9863
9947
  connectFolderPrompt,
9864
9948
  connectedFolderLine,
9865
9949
  dataDeletePrompt,
@@ -9871,6 +9955,5 @@ export {
9871
9955
  removeFolderPrompt,
9872
9956
  removedFolderLine,
9873
9957
  runCli,
9874
- signedInElsewhereMessage,
9875
9958
  stillWatchedLine
9876
9959
  };