@mysten-incubation/sui-agent-pass 0.1.14 → 0.1.16
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 +44 -10
- 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) => {
|
|
@@ -169,16 +181,38 @@ async function registerClient(client, http) {
|
|
|
169
181
|
}
|
|
170
182
|
case 'cursor':
|
|
171
183
|
return mergeJsonConfig(join(home, '.cursor/mcp.json'), http ?? stdio);
|
|
172
|
-
case 'hermes':
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
184
|
+
case 'hermes': {
|
|
185
|
+
// `hermes mcp add` writes ~/.hermes/config.yaml itself; an HTTP signer's bearer header
|
|
186
|
+
// has no plain flag there, so that form is printed to paste.
|
|
187
|
+
if (http) {
|
|
188
|
+
console.log(`Add to ~/.hermes/config.yaml under mcp_servers:\n\n agent-pass:\n url: "${http.url}"\n headers:\n Authorization: "${http.headers.Authorization}"\n\nThen restart Hermes; the tools appear in "hermes tools list".`);
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
await cli('hermes', ['mcp', 'remove', 'agent-pass'], true).catch(() => { });
|
|
192
|
+
await cli('hermes', [
|
|
193
|
+
'mcp',
|
|
194
|
+
'add',
|
|
195
|
+
'agent-pass',
|
|
196
|
+
'--command',
|
|
197
|
+
stdio.command,
|
|
198
|
+
'--args',
|
|
199
|
+
...stdio.args,
|
|
200
|
+
]);
|
|
201
|
+
console.log('Registered agent-pass with Hermes (hermes mcp add). Restart Hermes to load it.');
|
|
176
202
|
return;
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
203
|
+
}
|
|
204
|
+
case 'codex': {
|
|
205
|
+
// `codex mcp add` writes ~/.codex/config.toml itself; an HTTP signer's bearer header has
|
|
206
|
+
// no flag there, so that form is printed to paste.
|
|
207
|
+
if (http) {
|
|
208
|
+
console.log(`Add to ~/.codex/config.toml:\n\n[mcp_servers.agent-pass]\nurl = "${http.url}"\nhttp_headers = { Authorization = "${http.headers.Authorization}" }\n`);
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
await cli('codex', ['mcp', 'remove', 'agent-pass'], true).catch(() => { });
|
|
212
|
+
await cli('codex', ['mcp', 'add', 'agent-pass', '--', stdio.command, ...stdio.args]);
|
|
213
|
+
console.log('Registered agent-pass with Codex (codex mcp add). Restart Codex to load it.');
|
|
181
214
|
return;
|
|
215
|
+
}
|
|
182
216
|
case 'json':
|
|
183
217
|
console.log(JSON.stringify({ mcpServers: { 'agent-pass': http ?? stdio } }, null, 2));
|
|
184
218
|
}
|
|
@@ -248,8 +282,8 @@ async function chooseClients() {
|
|
|
248
282
|
{ name: `Claude Code${claude}`, value: 'claude-code' },
|
|
249
283
|
{ name: `Claude Desktop${desktop}`, value: 'claude-desktop' },
|
|
250
284
|
{ name: `Cursor${cursor}`, value: 'cursor' },
|
|
251
|
-
{ name: `Hermes${hermes}
|
|
252
|
-
{ name: `Codex${codex}
|
|
285
|
+
{ name: `Hermes${hermes}`, value: 'hermes' },
|
|
286
|
+
{ name: `Codex${codex}`, value: 'codex' },
|
|
253
287
|
{ name: 'Something else (prints a generic MCP entry)', value: 'json' },
|
|
254
288
|
], "That's all", false);
|
|
255
289
|
if (picked.length === 0) {
|