fix(codex): close symlink escape on GET /file, pin project writes to server cwd
This commit is contained in:
@@ -199,6 +199,10 @@ async function mcpAdd({ name, url, bearerTokenEnvVar, command, args = [], env })
|
||||
if (!url && !command) {
|
||||
throw makeError("EBADARG", "mcpAdd requires either url or command");
|
||||
}
|
||||
if (!Array.isArray(args)) throw makeError("EBADARG", "args must be an array");
|
||||
if (env !== undefined && (typeof env !== "object" || env === null || Array.isArray(env))) {
|
||||
throw makeError("EBADARG", "env must be an object");
|
||||
}
|
||||
|
||||
if (url) {
|
||||
if (env) throw makeError("EBADARG", "env is not valid together with url (stdio-only)");
|
||||
@@ -256,8 +260,26 @@ async function marketplaceRemove(name) {
|
||||
return serialize(() => runCodex(["plugin", "marketplace", "remove", n]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Best-effort human message from a failed run. The CLI prints its errors with
|
||||
* a `✘` marker on either stream; fall back to the last non-empty line.
|
||||
* Unchanged copy of cc-plugin-cli.js's cliMessage — same CLI-output shape,
|
||||
* same heuristic.
|
||||
*/
|
||||
function cliMessage(res) {
|
||||
const text = `${res.stderr || ""}\n${res.stdout || ""}`;
|
||||
const lines = text
|
||||
.split("\n")
|
||||
.map((l) => l.trim())
|
||||
.filter(Boolean);
|
||||
const marked = lines.find((l) => l.includes("✘"));
|
||||
const picked = marked || lines[lines.length - 1] || "";
|
||||
return picked.replace(/^✘\s*/, "").slice(0, 1000);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
runCodex,
|
||||
cliMessage,
|
||||
mcpList,
|
||||
mcpAdd,
|
||||
mcpRemove,
|
||||
|
||||
Reference in New Issue
Block a user