@keyban/cli 0.4.0 → 0.4.1
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/index.mjs +48 -1
- package/dist/index.mjs.map +4 -4
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -155974,8 +155974,54 @@ async function serveMcp(wallet, session, version5, { http: http2 }, missions) {
|
|
|
155974
155974
|
}
|
|
155975
155975
|
}
|
|
155976
155976
|
|
|
155977
|
+
// src/setup.ts
|
|
155978
|
+
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
155979
|
+
var SERVER = "npx -y @keyban/cli@latest mcp";
|
|
155980
|
+
async function loggedIn(api) {
|
|
155981
|
+
const origin = new URL(api).origin;
|
|
155982
|
+
try {
|
|
155983
|
+
return `Logged in to ${origin} as ${describe3(await whoami(api))}`;
|
|
155984
|
+
} catch {
|
|
155985
|
+
await login(
|
|
155986
|
+
api,
|
|
155987
|
+
(url2) => process.stderr.write(`Opening the browser to log in. If it does not open, visit:
|
|
155988
|
+
${url2}
|
|
155989
|
+
`)
|
|
155990
|
+
);
|
|
155991
|
+
return `Logged in to ${origin} as ${describe3(await whoami(api))}`;
|
|
155992
|
+
}
|
|
155993
|
+
}
|
|
155994
|
+
function register(client) {
|
|
155995
|
+
const args = ["-y", "--package=install-mcp", "install-mcp", SERVER, "--name", "agent-wallet", "--client", client, "--yes"];
|
|
155996
|
+
const run = spawnSync2("npx", args, {
|
|
155997
|
+
stdio: ["ignore", 2, 2]
|
|
155998
|
+
});
|
|
155999
|
+
if (run.status !== 0) throw new Error(`install-mcp exited ${run.status ?? run.signal}: the MCP server is not registered.`);
|
|
156000
|
+
}
|
|
156001
|
+
function setupCommand() {
|
|
156002
|
+
return new Command("setup").description(
|
|
156003
|
+
"Install a wallet for an agent: log in, keep the wallet as `keyban wallet import --wallet-id` does, and register `keyban mcp` as the agent-wallet MCP server of the agent, with install-mcp"
|
|
156004
|
+
).requiredOption("--wallet-id <id>", "the wallet to install, as the dashboard names it").requiredOption("--client <client>", "the agent, as install-mcp names it: codex, claude-code, cursor\u2026").option("--api <env|url>", "the Keyban API the wallet lives on", defaultApi()).option("--force", "overwrite the wallet file there, losing its client share").action(async (options) => {
|
|
156005
|
+
try {
|
|
156006
|
+
const api = resolveURL(options.api);
|
|
156007
|
+
process.stdout.write(`${await loggedIn(api)}
|
|
156008
|
+
`);
|
|
156009
|
+
process.stdout.write(`Using ${await importWalletSigner(api, options.walletId, process.env, options.force)}
|
|
156010
|
+
`);
|
|
156011
|
+
register(options.client);
|
|
156012
|
+
process.stdout.write(`Registered agent-wallet for ${options.client}: open a new conversation to use it.
|
|
156013
|
+
`);
|
|
156014
|
+
} catch (error2) {
|
|
156015
|
+
reportCommandFailed("setup", error2);
|
|
156016
|
+
process.stderr.write(`Error: ${error2 instanceof Error ? error2.message : String(error2)}
|
|
156017
|
+
`);
|
|
156018
|
+
await exitAfterFlush(1);
|
|
156019
|
+
}
|
|
156020
|
+
});
|
|
156021
|
+
}
|
|
156022
|
+
|
|
155977
156023
|
// src/index.ts
|
|
155978
|
-
var VERSION5 = true ? "0.4.
|
|
156024
|
+
var VERSION5 = true ? "0.4.1" : "0.0.0";
|
|
155979
156025
|
if (process.argv[2] !== "mcp" && !process.env.MCP_LOG_LEVEL) logger.setMinLevel("error");
|
|
155980
156026
|
function typedArgv(argv) {
|
|
155981
156027
|
if (argv[2] !== "__complete") return argv;
|
|
@@ -156002,6 +156048,7 @@ async function main() {
|
|
|
156002
156048
|
});
|
|
156003
156049
|
program2.addCommand(walletCommand(wallet, missions));
|
|
156004
156050
|
program2.addCommand(await adminCommand(typed, process.argv[2] === "__complete"));
|
|
156051
|
+
program2.addCommand(setupCommand());
|
|
156005
156052
|
addCompletion(program2);
|
|
156006
156053
|
await parseCommandLine(program2);
|
|
156007
156054
|
if (process.argv[2] !== "mcp" && process.exitCode) await flushTelemetry();
|