spacecode 2.12.5 → 2.12.6
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.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/repl.mjs +24 -3
- package/package.json +1 -1
package/dist/repl.mjs
CHANGED
|
@@ -8465,15 +8465,26 @@ var init_mcp_manager = __esm({
|
|
|
8465
8465
|
});
|
|
8466
8466
|
|
|
8467
8467
|
// src/mcp/approve-mcp.ts
|
|
8468
|
+
function unsetVars(d, env3) {
|
|
8469
|
+
const texts = d.transport === "http" ? [d.url, ...Object.values(d.env)] : [d.command, ...d.args, ...Object.values(d.env)];
|
|
8470
|
+
return [...new Set(texts.flatMap((t) => expandRefs(t, env3).missing))].sort();
|
|
8471
|
+
}
|
|
8468
8472
|
async function runApproveMcp(deps) {
|
|
8469
8473
|
const { defs, statusLines } = await loadMcpDefs(deps);
|
|
8470
8474
|
if (!deps.quiet) for (const l of statusLines) deps.log(l);
|
|
8471
8475
|
const stdio = defs;
|
|
8472
|
-
|
|
8476
|
+
let todo = [];
|
|
8473
8477
|
for (const d of stdio) {
|
|
8474
8478
|
const key = approvalKey(d);
|
|
8475
8479
|
if (await deps.trust.stdioStatus(key) === "unapproved") todo.push(d);
|
|
8476
8480
|
}
|
|
8481
|
+
if (deps.quiet && deps.procEnv && todo.length > 0) {
|
|
8482
|
+
const env3 = deps.procEnv;
|
|
8483
|
+
const ready = todo.filter((d) => unsetVars(d, env3).length === 0);
|
|
8484
|
+
const waiting = todo.length - ready.length;
|
|
8485
|
+
if (waiting > 0) deps.log(`${waiting} imported MCP server(s) wait for environment variables (see \`spacecode approve-mcp\`); they are not asked about until those are set.`);
|
|
8486
|
+
todo = ready;
|
|
8487
|
+
}
|
|
8477
8488
|
if (todo.length === 0) {
|
|
8478
8489
|
if (!deps.quiet) deps.log(stdio.length === 0 ? "No stdio MCP servers to approve." : "Every stdio MCP server is already approved on this machine.");
|
|
8479
8490
|
return 0;
|
|
@@ -8482,6 +8493,13 @@ async function runApproveMcp(deps) {
|
|
|
8482
8493
|
deps.log(`${todo.length} MCP server(s) need approval, but this is not an interactive terminal: nothing was approved.`);
|
|
8483
8494
|
return 1;
|
|
8484
8495
|
}
|
|
8496
|
+
if (deps.quiet && todo.length > STARTUP_PROMPT_LIMIT) {
|
|
8497
|
+
const answer = (await deps.ask(`${todo.length} imported MCP servers can be approved now. Review them one by one? [y/N] `) ?? "").trim().toLowerCase();
|
|
8498
|
+
if (answer !== "y" && answer !== "yes") {
|
|
8499
|
+
deps.log("Skipped. Run `spacecode approve-mcp` when you want to review them; nothing spawns until then.");
|
|
8500
|
+
return 0;
|
|
8501
|
+
}
|
|
8502
|
+
}
|
|
8485
8503
|
if (deps.quiet) deps.log(`
|
|
8486
8504
|
${todo.length} imported MCP server(s) want to run a command on this machine. Nothing spawns until you approve it (you can also run \`spacecode approve-mcp\` later).`);
|
|
8487
8505
|
let approved = 0;
|
|
@@ -8506,12 +8524,14 @@ MCP server ${show(d.name)} (${d.origin} definition) wants to run on this machine
|
|
|
8506
8524
|
${approved} of ${todo.length} approved.`);
|
|
8507
8525
|
return 0;
|
|
8508
8526
|
}
|
|
8509
|
-
var show;
|
|
8527
|
+
var STARTUP_PROMPT_LIMIT, show;
|
|
8510
8528
|
var init_approve_mcp = __esm({
|
|
8511
8529
|
"src/mcp/approve-mcp.ts"() {
|
|
8512
8530
|
"use strict";
|
|
8531
|
+
init_src();
|
|
8513
8532
|
init_mcp_loader();
|
|
8514
8533
|
init_mcp_manager();
|
|
8534
|
+
STARTUP_PROMPT_LIMIT = 3;
|
|
8515
8535
|
show = (s) => JSON.stringify(s);
|
|
8516
8536
|
}
|
|
8517
8537
|
});
|
|
@@ -8545,7 +8565,8 @@ async function runApproveMcpOnNode(opts) {
|
|
|
8545
8565
|
}
|
|
8546
8566
|
} } : {},
|
|
8547
8567
|
log: (line) => console.log(line),
|
|
8548
|
-
quiet: opts.quiet
|
|
8568
|
+
quiet: opts.quiet,
|
|
8569
|
+
procEnv: process.env
|
|
8549
8570
|
});
|
|
8550
8571
|
} finally {
|
|
8551
8572
|
rl?.close();
|