@mnemonik/cli 7.131.1 → 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.
- package/dist/auth/claudeCodeSignIn.d.ts +16 -25
- package/dist/auth/claudeCodeSignIn.d.ts.map +1 -1
- package/dist/auth/claudeCodeSignIn.js +31 -29
- package/dist/auth/claudeCodeSignIn.js.map +1 -1
- package/dist/auth/codexAuthorization.d.ts +47 -0
- package/dist/auth/codexAuthorization.d.ts.map +1 -0
- package/dist/auth/codexAuthorization.js +882 -0
- package/dist/auth/codexAuthorization.js.map +1 -0
- package/dist/auth/cursorAuthorization.d.ts +47 -0
- package/dist/auth/cursorAuthorization.d.ts.map +1 -0
- package/dist/auth/cursorAuthorization.js +116 -0
- package/dist/auth/cursorAuthorization.js.map +1 -0
- package/dist/auth/status.d.ts +62 -26
- package/dist/auth/status.d.ts.map +1 -1
- package/dist/auth/status.js +37 -23
- package/dist/auth/status.js.map +1 -1
- package/dist/auth/storedAuthorization.d.ts +50 -0
- package/dist/auth/storedAuthorization.d.ts.map +1 -0
- package/dist/auth/storedAuthorization.js +24 -0
- package/dist/auth/storedAuthorization.js.map +1 -0
- package/dist/authorizationWords.d.ts +69 -0
- package/dist/authorizationWords.d.ts.map +1 -0
- package/dist/authorizationWords.js +5275 -0
- package/dist/authorizationWords.js.map +1 -0
- package/dist/digests.json +47 -31
- package/dist/humanReason.js +6 -6
- package/dist/humanReason.js.map +1 -1
- package/dist/install/hosts.d.ts.map +1 -1
- package/dist/install/hosts.js +2 -1
- package/dist/install/hosts.js.map +1 -1
- package/dist/installation.d.ts +2 -0
- package/dist/installation.d.ts.map +1 -1
- package/dist/installation.js +12 -0
- package/dist/installation.js.map +1 -1
- package/dist/output.d.ts +5 -2
- package/dist/output.d.ts.map +1 -1
- package/dist/output.js +7 -3
- package/dist/output.js.map +1 -1
- package/dist/router.d.ts +10 -10
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +137 -109
- package/dist/router.js.map +1 -1
- package/dist/sbom.json +21 -21
- package/dist/scanner-release.json +18 -18
- package/dist/status.d.ts +67 -35
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +140 -39
- package/dist/status.js.map +1 -1
- package/package.json +31 -31
package/dist/router.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ 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
12
|
import { type ClaudeCodeStoreOptions } from './auth/claudeCodeSignIn.js';
|
|
13
|
+
import { type CodexStoreOptions } from './auth/codexAuthorization.js';
|
|
14
|
+
import { type CursorStoreOptions } from './auth/cursorAuthorization.js';
|
|
13
15
|
import { type EditorLoginOverrides } from './auth/pkce.js';
|
|
14
16
|
import { type ScannerPickerResult } from './scanner/picker.js';
|
|
15
17
|
import { type InstallDependencies } from './install/transaction.js';
|
|
@@ -29,16 +31,10 @@ export declare const SCANNER_REMOVED_LINE = "Background indexing removed from th
|
|
|
29
31
|
export declare const dataDeletePrompt: (projectId: string) => string;
|
|
30
32
|
export declare const stillWatchedLine: (root: string) => string;
|
|
31
33
|
export declare const identityFileKeptLine = "This folder's .mnemonik.json still points at the deleted project. Connecting the folder again creates a new project.";
|
|
32
|
-
export declare const CODEX_SIGNED_IN_MESSAGE = "Codex
|
|
33
|
-
/** An editor signed in on another of the person's machines (L-182). */
|
|
34
|
-
export declare const signedInElsewhereMessage: (editor: string) => string;
|
|
35
|
-
/** A coding tool with a valid sign-in on this machine; `mnemonik connect` has nothing to do. */
|
|
36
|
-
export declare const alreadySignedInMessage: (editor: string, lastUsedAt: string | null, refreshable?: boolean) => string;
|
|
37
|
-
/** The coding tool itself holds no Mnemonik sign-in it can use on this machine. */
|
|
38
|
-
export declare const notSignedInHereMessage: (editor: string) => string;
|
|
34
|
+
export declare const CODEX_SIGNED_IN_MESSAGE = "Codex MCP: authorized.";
|
|
39
35
|
/** For the agent running `connect --json`: what to do with the link it was given. */
|
|
40
|
-
export declare const SIGN_IN_LINK_REASON = "Give this link to the person to
|
|
41
|
-
export declare const CONNECT_NOT_APPROVED_MESSAGE = "
|
|
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.";
|
|
42
38
|
export declare function maintenanceExitCode(results: readonly Pick<HostResult, 'status'>[]): number;
|
|
43
39
|
export declare const help: string;
|
|
44
40
|
export interface CliDependencies {
|
|
@@ -87,8 +83,12 @@ export interface CliDependencies {
|
|
|
87
83
|
statusDetails?: StatusDocumentInput['details'];
|
|
88
84
|
codexTrustConditions?: () => Promise<readonly ReadinessCondition[]>;
|
|
89
85
|
diagnostics?: DiagnosticsDependencies;
|
|
90
|
-
/** Where Claude Code's own stored
|
|
86
|
+
/** Where Claude Code's own stored authorization is read: this platform, environment and Keychain by default. */
|
|
91
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'>;
|
|
92
92
|
}
|
|
93
93
|
export declare function runCli(args: string[], deps?: CliDependencies): Promise<number>;
|
|
94
94
|
//# sourceMappingURL=router.d.ts.map
|
package/dist/router.d.ts.map
CHANGED
|
@@ -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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A6tCD,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,GAAE,eAAoB,GAAG,OAAO,CAAC,MAAM,CAAC,CAwqCxF"}
|
package/dist/router.js
CHANGED
|
@@ -7359,19 +7359,6 @@ function apiOrigin(env = process.env) {
|
|
|
7359
7359
|
return new URL(env.MNEMONIK_API_RESOURCE || "https://api.mnemonik.dev").origin;
|
|
7360
7360
|
}
|
|
7361
7361
|
|
|
7362
|
-
// packages/shared/dist/grantHost.js
|
|
7363
|
-
var CODING_TOOL_SIGN_IN = {
|
|
7364
|
-
"claude-code": {
|
|
7365
|
-
kind: "in_tool",
|
|
7366
|
-
step: "In Claude Code, type /mcp, choose mnemonik, then Authenticate."
|
|
7367
|
-
},
|
|
7368
|
-
codex: { kind: "connect" },
|
|
7369
|
-
cursor: {
|
|
7370
|
-
kind: "in_tool",
|
|
7371
|
-
step: "In Cursor, open Cursor Settings, Customize, MCPs, then Authenticate."
|
|
7372
|
-
}
|
|
7373
|
-
};
|
|
7374
|
-
|
|
7375
7362
|
// packages/local-setup/dist/storage.js
|
|
7376
7363
|
init_hookRuntime();
|
|
7377
7364
|
init_hookRuntime();
|
|
@@ -7728,15 +7715,20 @@ import {
|
|
|
7728
7715
|
import { evaluateRoot } from "./project/eligibility.js";
|
|
7729
7716
|
import { accountActions } from "./transport/server.js";
|
|
7730
7717
|
import {
|
|
7731
|
-
codingToolSignIn,
|
|
7732
7718
|
grantTransport,
|
|
7733
7719
|
grantHost,
|
|
7734
7720
|
grantSummaryLines,
|
|
7735
|
-
|
|
7736
|
-
|
|
7737
|
-
|
|
7721
|
+
mcpAuthorization,
|
|
7722
|
+
serverAuthorization,
|
|
7723
|
+
validGrant
|
|
7738
7724
|
} from "./auth/status.js";
|
|
7739
|
-
import {
|
|
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";
|
|
7740
7732
|
import { createCliAuth } from "./auth/index.js";
|
|
7741
7733
|
import { OAuthProtocolError, runEditorLogin } from "./auth/pkce.js";
|
|
7742
7734
|
import { currentInstallSession, ensureInstallSession } from "./auth/installSession.js";
|
|
@@ -7750,18 +7742,19 @@ import {
|
|
|
7750
7742
|
import { chooseHostProfile, simulatedInstall, terminalInstallUI } from "./install/ui.js";
|
|
7751
7743
|
import {
|
|
7752
7744
|
CODEX_TRUST_MESSAGE,
|
|
7753
|
-
|
|
7745
|
+
authorizationEntries,
|
|
7754
7746
|
codingToolStatuses,
|
|
7755
7747
|
collectStatusDocument,
|
|
7748
|
+
hookAuthorizations,
|
|
7756
7749
|
installedCodingTools,
|
|
7757
7750
|
localEditorStatus,
|
|
7758
7751
|
localInstallationConditions,
|
|
7759
7752
|
mcpTurnOnAction,
|
|
7760
7753
|
renderStatusSummaries,
|
|
7761
7754
|
renderRefusals,
|
|
7762
|
-
renewsMessage,
|
|
7763
7755
|
REPORT_NOT_SENT,
|
|
7764
7756
|
renderScannerFailure,
|
|
7757
|
+
scannerAuthorization,
|
|
7765
7758
|
statusExitCode,
|
|
7766
7759
|
withCodingTools
|
|
7767
7760
|
} from "./status.js";
|
|
@@ -7827,12 +7820,9 @@ async function uninstallScannerOptOut(deps, output, service, json) {
|
|
|
7827
7820
|
var dataDeletePrompt = (projectId) => `This deletes everything background indexing has sent for ${projectId} from your account. Type yes to continue.`;
|
|
7828
7821
|
var stillWatchedLine = (root) => `The folder is still being indexed. Run mnemonik remove ${root} to stop that.`;
|
|
7829
7822
|
var identityFileKeptLine = "This folder's .mnemonik.json still points at the deleted project. Connecting the folder again creates a new project.";
|
|
7830
|
-
var CODEX_SIGNED_IN_MESSAGE = "Codex
|
|
7831
|
-
var
|
|
7832
|
-
var
|
|
7833
|
-
var notSignedInHereMessage = (editor) => `${editor} is not signed in to Mnemonik on this computer.`;
|
|
7834
|
-
var SIGN_IN_LINK_REASON = "Give this link to the person to approve the Codex sign-in. This command finishes when they do.";
|
|
7835
|
-
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.";
|
|
7836
7826
|
function maintenanceExitCode(results) {
|
|
7837
7827
|
if (results.some((result) => result.status === "FAILED")) return 1;
|
|
7838
7828
|
return results.every((result) => result.status === "READY") ? 0 : 3;
|
|
@@ -8707,38 +8697,68 @@ async function installCommand(parsed, deps, output) {
|
|
|
8707
8697
|
function refusalStateDir(deps) {
|
|
8708
8698
|
return deps.projectStateDir ?? deps.installStateDir ?? stateDirectory(process.platform, process.env, deps.home);
|
|
8709
8699
|
}
|
|
8710
|
-
|
|
8711
|
-
|
|
8712
|
-
|
|
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) {
|
|
8713
8714
|
const [server, stored] = await Promise.all([
|
|
8714
|
-
|
|
8715
|
-
|
|
8715
|
+
serverAuthorizations(deps, output, hosts),
|
|
8716
|
+
storedAuthorizations(deps, hosts)
|
|
8716
8717
|
]);
|
|
8717
|
-
|
|
8718
|
-
|
|
8719
|
-
|
|
8720
|
-
|
|
8721
|
-
|
|
8722
|
-
|
|
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
|
+
};
|
|
8723
8728
|
}
|
|
8724
|
-
async function
|
|
8725
|
-
const bearer = await auth(deps, output, false).getCliBearer().catch(
|
|
8726
|
-
|
|
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
|
+
};
|
|
8727
8749
|
const send = deps.grantFetch ?? globalThis.fetch;
|
|
8728
8750
|
const grants = grantTransport(
|
|
8729
8751
|
async () => bearer,
|
|
8730
8752
|
(url, options) => send(url, { ...options, signal: AbortSignal.timeout(2500) })
|
|
8731
8753
|
);
|
|
8732
8754
|
const here = await grants.list({ here: true }).catch(() => void 0);
|
|
8733
|
-
if (!here) return
|
|
8734
|
-
const
|
|
8735
|
-
|
|
8736
|
-
);
|
|
8737
|
-
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")) {
|
|
8738
8758
|
const everywhere = await grants.list().catch(() => void 0);
|
|
8739
|
-
if (everywhere)
|
|
8759
|
+
if (everywhere) tools.set("cursor", serverAuthorization("cursor", here, everywhere));
|
|
8740
8760
|
}
|
|
8741
|
-
return
|
|
8761
|
+
return { cli: { state: "signed_in", email: here.email ?? null }, tools };
|
|
8742
8762
|
}
|
|
8743
8763
|
async function doctorCommand(parsed, deps, output) {
|
|
8744
8764
|
const invalid = allowed(parsed, []);
|
|
@@ -9364,42 +9384,59 @@ Preview: ${preview.path}
|
|
|
9364
9384
|
output,
|
|
9365
9385
|
parsed.flags.has("json") ? void 0 : (line) => output.line(line)
|
|
9366
9386
|
);
|
|
9367
|
-
const
|
|
9368
|
-
|
|
9369
|
-
|
|
9370
|
-
|
|
9371
|
-
|
|
9372
|
-
|
|
9373
|
-
|
|
9374
|
-
editors,
|
|
9375
|
-
document.conditions ?? [],
|
|
9376
|
-
await codingToolSignIns(
|
|
9377
|
-
deps,
|
|
9378
|
-
output,
|
|
9379
|
-
editors.map((editor) => editor.host).filter(
|
|
9380
|
-
(host) => hostOrder.includes(host)
|
|
9381
|
-
)
|
|
9382
|
-
)
|
|
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)
|
|
9383
9394
|
)
|
|
9384
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
|
+
});
|
|
9385
9413
|
const version = await packageVersion();
|
|
9386
9414
|
const store = new RuntimeStore(
|
|
9387
9415
|
deps.installStateDir ?? stateDirectory(process.platform, process.env, deps.home)
|
|
9388
9416
|
);
|
|
9389
9417
|
if (!parsed.flags.has("json")) {
|
|
9390
9418
|
renderStatusSummaries(shown, output, { agent: !personPresent(parsed, deps) });
|
|
9391
|
-
for (const
|
|
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);
|
|
9392
9423
|
await renderRefusals(refusalStateDir(deps), output);
|
|
9393
9424
|
}
|
|
9394
9425
|
const hint = await cliUpdateHint(store, version);
|
|
9395
9426
|
if (parsed.flags.has("json"))
|
|
9396
|
-
output.json({
|
|
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
|
+
});
|
|
9397
9435
|
else if (hint) output.line(hint);
|
|
9398
9436
|
const reported = await reportCurrentInstallation(deps, output, document);
|
|
9399
|
-
if (reported === "signed_out" && !parsed.flags.has("json"))
|
|
9437
|
+
if (reported === "signed_out" && !parsed.flags.has("json"))
|
|
9400
9438
|
output.line(REPORT_NOT_SENT.sentence);
|
|
9401
|
-
|
|
9402
|
-
} else if (typeof reported === "object" && !parsed.flags.has("json"))
|
|
9439
|
+
else if (typeof reported === "object" && !parsed.flags.has("json"))
|
|
9403
9440
|
output.line(humanReason(reported.refused));
|
|
9404
9441
|
return statusExitCode(shown);
|
|
9405
9442
|
}
|
|
@@ -9412,28 +9449,17 @@ Preview: ${preview.path}
|
|
|
9412
9449
|
const editor = (await localEditorStatus(deps.home ?? homedir4())).find(
|
|
9413
9450
|
(candidate) => candidate.host === host
|
|
9414
9451
|
);
|
|
9415
|
-
const
|
|
9416
|
-
const
|
|
9417
|
-
|
|
9418
|
-
|
|
9419
|
-
|
|
9420
|
-
|
|
9421
|
-
|
|
9422
|
-
);
|
|
9423
|
-
|
|
9424
|
-
output.json(
|
|
9425
|
-
current.state === "signed_in" ? {
|
|
9426
|
-
status: "READY",
|
|
9427
|
-
signIn: current.state,
|
|
9428
|
-
lastUsedAt: current.lastUsedAt,
|
|
9429
|
-
...current.stored ? { stored: current.stored } : {},
|
|
9430
|
-
reason: message
|
|
9431
|
-
} : { status: "READY", reason: message }
|
|
9432
|
-
);
|
|
9433
|
-
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);
|
|
9434
9461
|
return 0;
|
|
9435
9462
|
}
|
|
9436
|
-
const json = parsed.flags.has("json");
|
|
9437
9463
|
if (host === "codex" && editor?.mcp === "ready") {
|
|
9438
9464
|
const bearer = await auth(deps, output, false).getCliBearer().catch(() => void 0);
|
|
9439
9465
|
if (typeof bearer === "string") {
|
|
@@ -9467,17 +9493,11 @@ Preview: ${preview.path}
|
|
|
9467
9493
|
}
|
|
9468
9494
|
}
|
|
9469
9495
|
}
|
|
9470
|
-
const reason = editor?.mcp === "disabled" ? `${
|
|
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.`;
|
|
9471
9497
|
const actions = editor?.mcp === "ready" ? editorAuthorizationRows([host]) : [
|
|
9472
9498
|
editor?.mcp === "disabled" ? mcpTurnOnAction[host] : "Run mnemonik install to set it up again."
|
|
9473
9499
|
];
|
|
9474
|
-
if (
|
|
9475
|
-
output.json({
|
|
9476
|
-
status: "ACTION_REQUIRED",
|
|
9477
|
-
reason,
|
|
9478
|
-
actions,
|
|
9479
|
-
...current?.stored ? { stored: current.stored } : {}
|
|
9480
|
-
});
|
|
9500
|
+
if (json) output.json({ status: "ACTION_REQUIRED", reason, actions, ...mcp ? { mcp } : {} });
|
|
9481
9501
|
else {
|
|
9482
9502
|
output.line(reason);
|
|
9483
9503
|
for (const action of actions) output.line(action);
|
|
@@ -9847,27 +9867,38 @@ Preview: ${preview.path}
|
|
|
9847
9867
|
return (!grantHostName || hostOrder.includes(grantHostName)) && (!host || grantHostName === host);
|
|
9848
9868
|
}).map((g) => ({ ...g, host: grantHost(g) ?? g.clientName ?? g.clientId }));
|
|
9849
9869
|
const signedIn = grants.filter(validGrant);
|
|
9850
|
-
const
|
|
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
|
+
);
|
|
9851
9875
|
if (parsed.flags.has("json"))
|
|
9852
9876
|
output.json({
|
|
9853
9877
|
account: status.account,
|
|
9854
9878
|
grants,
|
|
9855
|
-
...
|
|
9879
|
+
...Object.keys(storedJson).length ? { stored: storedJson } : {}
|
|
9856
9880
|
});
|
|
9857
9881
|
else if (!signedIn.length)
|
|
9858
9882
|
output.line(
|
|
9859
|
-
host ? `${launchHostLabels[host]}
|
|
9883
|
+
host ? `${launchHostLabels[host]} MCP: not authorized on any of your computers.` : humanReason("not_signed_in")
|
|
9860
9884
|
);
|
|
9861
9885
|
else {
|
|
9862
|
-
output.
|
|
9863
|
-
const
|
|
9864
|
-
|
|
9865
|
-
|
|
9866
|
-
|
|
9867
|
-
|
|
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
|
+
))
|
|
9868
9899
|
output.line(line);
|
|
9869
9900
|
output.line(
|
|
9870
|
-
"Older
|
|
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."
|
|
9871
9902
|
);
|
|
9872
9903
|
}
|
|
9873
9904
|
return 0;
|
|
@@ -9913,19 +9944,16 @@ export {
|
|
|
9913
9944
|
SCANNER_UNINSTALL_PROMPT,
|
|
9914
9945
|
SIGN_IN_LINK_REASON,
|
|
9915
9946
|
alreadyConnectedFolderLine,
|
|
9916
|
-
alreadySignedInMessage,
|
|
9917
9947
|
connectFolderPrompt,
|
|
9918
9948
|
connectedFolderLine,
|
|
9919
9949
|
dataDeletePrompt,
|
|
9920
9950
|
help,
|
|
9921
9951
|
identityFileKeptLine,
|
|
9922
9952
|
maintenanceExitCode,
|
|
9923
|
-
notSignedInHereMessage,
|
|
9924
9953
|
projectDeletedLine,
|
|
9925
9954
|
projectDeletionWarning,
|
|
9926
9955
|
removeFolderPrompt,
|
|
9927
9956
|
removedFolderLine,
|
|
9928
9957
|
runCli,
|
|
9929
|
-
signedInElsewhereMessage,
|
|
9930
9958
|
stillWatchedLine
|
|
9931
9959
|
};
|