Initial public release
This commit is contained in:
commit
05283b2604
88 changed files with 14882 additions and 0 deletions
38
scripts/remove-codex-mcp.ts
Normal file
38
scripts/remove-codex-mcp.ts
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
import { spawn } from "node:child_process";
|
||||
import { resolve } from "node:path";
|
||||
|
||||
import { config as loadDotenv } from "dotenv";
|
||||
|
||||
import { loadConfig } from "../packages/config/src";
|
||||
import { VOID_MCP_SERVER_NAME } from "../packages/core/src/codex-mcp";
|
||||
|
||||
void main().catch((error) => {
|
||||
console.error(error);
|
||||
process.exitCode = 1;
|
||||
});
|
||||
|
||||
async function main(): Promise<void> {
|
||||
loadDotenv({ path: resolve(process.cwd(), ".env") });
|
||||
const config = loadConfig();
|
||||
await runCodex(config.codexExecutable, config.codexExecArgs, ["mcp", "remove", VOID_MCP_SERVER_NAME]);
|
||||
}
|
||||
|
||||
function runCodex(executable: string, executableArgs: string[], args: string[]): Promise<void> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const child = spawn(executable, [...executableArgs, ...args], {
|
||||
cwd: process.cwd(),
|
||||
env: process.env,
|
||||
stdio: "inherit",
|
||||
});
|
||||
|
||||
child.on("error", reject);
|
||||
child.on("close", (code) => {
|
||||
if (code === 0) {
|
||||
resolve();
|
||||
return;
|
||||
}
|
||||
|
||||
reject(new Error(`codex ${args.join(" ")} exited with code ${code ?? "unknown"}`));
|
||||
});
|
||||
});
|
||||
}
|
||||
Loading…
Reference in a new issue