@mysten-incubation/sui-agent-pass 0.1.14 → 0.1.15
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/cli.js +24 -5
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -112,6 +112,18 @@ async function mergeJsonConfig(path, entry) {
|
|
|
112
112
|
console.log(`Wrote agent-pass into ${path}. Restart the client to load it.`);
|
|
113
113
|
}
|
|
114
114
|
/** Registers agent-pass with Claude Code, replacing an earlier entry in the same scope. */
|
|
115
|
+
/** Runs a client's own CLI; the client is not on this machine when the command cannot start. */
|
|
116
|
+
function cli(bin, args, quiet = false) {
|
|
117
|
+
return new Promise((resolve, reject) => {
|
|
118
|
+
const child = spawn(bin, args, { stdio: quiet ? 'ignore' : 'inherit' });
|
|
119
|
+
child.once('error', (e) => reject(e.code === 'ENOENT'
|
|
120
|
+
? new Error(`${bin} is not on PATH; install it or pick another client`)
|
|
121
|
+
: e));
|
|
122
|
+
child.once('exit', (code) => code === 0
|
|
123
|
+
? resolve()
|
|
124
|
+
: reject(new Error(`${bin} ${args.slice(0, 2).join(' ')} exited ${code}`)));
|
|
125
|
+
});
|
|
126
|
+
}
|
|
115
127
|
async function claudeMcpAdd(args) {
|
|
116
128
|
const scope = args[args.indexOf('--scope') + 1];
|
|
117
129
|
await new Promise((done) => {
|
|
@@ -174,11 +186,18 @@ async function registerClient(client, http) {
|
|
|
174
186
|
? ` url: "${http.url}"\n headers:\n Authorization: "${http.headers.Authorization}"`
|
|
175
187
|
: ` command: "${stdio.command}"\n args: ${JSON.stringify(stdio.args)}`}\n\nThen restart Hermes; the tools appear in "hermes tools list".`);
|
|
176
188
|
return;
|
|
177
|
-
case 'codex':
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
189
|
+
case 'codex': {
|
|
190
|
+
// `codex mcp add` writes ~/.codex/config.toml itself; an HTTP signer's bearer header has
|
|
191
|
+
// no flag there, so that form is printed to paste.
|
|
192
|
+
if (http) {
|
|
193
|
+
console.log(`Add to ~/.codex/config.toml:\n\n[mcp_servers.agent-pass]\nurl = "${http.url}"\nhttp_headers = { Authorization = "${http.headers.Authorization}" }\n`);
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
await cli('codex', ['mcp', 'remove', 'agent-pass'], true).catch(() => { });
|
|
197
|
+
await cli('codex', ['mcp', 'add', 'agent-pass', '--', stdio.command, ...stdio.args]);
|
|
198
|
+
console.log('Registered agent-pass with Codex (codex mcp add). Restart Codex to load it.');
|
|
181
199
|
return;
|
|
200
|
+
}
|
|
182
201
|
case 'json':
|
|
183
202
|
console.log(JSON.stringify({ mcpServers: { 'agent-pass': http ?? stdio } }, null, 2));
|
|
184
203
|
}
|
|
@@ -249,7 +268,7 @@ async function chooseClients() {
|
|
|
249
268
|
{ name: `Claude Desktop${desktop}`, value: 'claude-desktop' },
|
|
250
269
|
{ name: `Cursor${cursor}`, value: 'cursor' },
|
|
251
270
|
{ name: `Hermes${hermes} (prints the config to paste)`, value: 'hermes' },
|
|
252
|
-
{ name: `Codex${codex}
|
|
271
|
+
{ name: `Codex${codex}`, value: 'codex' },
|
|
253
272
|
{ name: 'Something else (prints a generic MCP entry)', value: 'json' },
|
|
254
273
|
], "That's all", false);
|
|
255
274
|
if (picked.length === 0) {
|