Skip to content

👾 Open Computer Use – Open-Source Alternative to Codex Computer Use

Remove Python runtime dependency from installers

Leo25efac8757fe
diff --git a/docs/histories/2026-04/20260420-1806-remove-python-from-installers.md b/docs/histories/2026-04/20260420-1806-remove-python-from-installers.md
new file mode 100644
index 0000000..713910e
--- /dev/null
+++ b/docs/histories/2026-04/20260420-1806-remove-python-from-installers.md
@@ -0,0 +1,34 @@
+## [2026-04-20 18:06] | Task: 去掉 install-* 对 Python 的运行时依赖
+
+### 🤖 Execution Context
+* **Agent ID**: `codex`
+* **Base Model**: `GPT-5`
+* **Runtime**: `Codex CLI`
+
+### 📥 User Query
+> `open-computer-use install-codex-mcp` 现在报 `python3 with tomllib is required`,理论上 install 命令不应该依赖 Python;可以考虑 Swift 之类的来做,把所有 `install-*` 都检查处理一下。
+
+### 🛠 Changes Overview
+**Scope:** `scripts/`, `scripts/npm/`, `docs/histories/`
+
+**Key Actions:**
+- **抽出共享安装配置 helper**:新增 `scripts/install-config-helper.mjs`,集中处理 Claude JSON、Codex TOML 和 plugin manifest 的读写逻辑。
+- **去掉 install-* 的 Python 依赖**:`install-claude-mcp.sh`、`install-codex-mcp.sh`、`install-codex-plugin.sh` 全部改为调用 Node helper,不再要求本机有 `python3` / `tomllib`。
+- **同步 npm 分发内容**:更新 `scripts/npm/build-packages.mjs`,把新的 helper 一并打进 npm 包,避免全局安装包缺文件。
+
+### 🧠 Design Intent (Why)
+这几个安装命令本质上是 npm CLI 的一部分,运行时再额外要求 Python 既不符合用户预期,也会让最简单的安装路径被系统 Python 版本绊住。相比运行时 `swift` 脚本,Node 已经是 npm 包成立的前提,直接把配置改写逻辑收口到一个随包分发的 helper 里,依赖更少、行为也更一致。
+
+### ✅ Verification
+- `node --check scripts/install-config-helper.mjs`
+- 用临时 `CODEX_HOME` 执行 `./scripts/install-codex-mcp.sh`,验证旧别名迁移和重复执行 no-op
+- 用临时 `CLAUDE_CONFIG_PATH` 执行 `./scripts/install-claude-mcp.sh`,验证 JSON 幂等写入
+- 用临时 `CODEX_HOME` 执行 `./scripts/install-codex-plugin.sh --configuration release`,验证 plugin cache 与 `config.toml` 更新
+- `node ./scripts/npm/build-packages.mjs --skip-build --package open-computer-use --out-dir dist/tmp/npm-stage-check`
+
+### 📁 Files Modified
+- `scripts/install-config-helper.mjs`
+- `scripts/install-claude-mcp.sh`
+- `scripts/install-codex-mcp.sh`
+- `scripts/install-codex-plugin.sh`
+- `scripts/npm/build-packages.mjs`
diff --git a/scripts/install-claude-mcp.sh b/scripts/install-claude-mcp.sh
index b9403b5..5d7f92c 100755
--- a/scripts/install-claude-mcp.sh
+++ b/scripts/install-claude-mcp.sh
@@ -2,6 +2,8 @@
set -euo pipefail
+script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+config_helper="${script_dir}/install-config-helper.mjs"
claude_config_path="${CLAUDE_CONFIG_PATH:-${HOME}/.claude.json}"
project_root="$(pwd -P)"
server_name="open-computer-use"
@@ -30,71 +32,4 @@ while [[ $# -gt 0 ]]; do
esac
done
-python3 - "${claude_config_path}" "${project_root}" "${server_name}" "${command_name}" <<'PY'
-import json
-import sys
-from pathlib import Path
-
-config_path = Path(sys.argv[1])
-project_root = sys.argv[2]
-server_name = sys.argv[3]
-command_name = sys.argv[4]
-desired_entry = {
- "type": "stdio",
- "command": command_name,
- "args": ["mcp"],
-}
-legacy_server_name = "open-codex-computer-use"
-
-if config_path.exists():
- try:
- raw = config_path.read_text()
- data = json.loads(raw) if raw.strip() else {}
- except json.JSONDecodeError as exc:
- print(f"Existing Claude config is not valid JSON: {exc}", file=sys.stderr)
- sys.exit(1)
-else:
- data = {}
-
-if not isinstance(data, dict):
- print("Existing Claude config root is not a JSON object; refusing to modify it.", file=sys.stderr)
- sys.exit(1)
-
-projects = data.setdefault("projects", {})
-if not isinstance(projects, dict):
- print('Existing Claude config has non-object "projects"; refusing to modify it.', file=sys.stderr)
- sys.exit(1)
-
-project_entry = projects.setdefault(project_root, {})
-if not isinstance(project_entry, dict):
- print(f'Existing Claude project entry for {project_root} is not an object; refusing to modify it.', file=sys.stderr)
- sys.exit(1)
-
-mcp_servers = project_entry.setdefault("mcpServers", {})
-if not isinstance(mcp_servers, dict):
- print(f'Existing Claude project MCP config for {project_root} is not an object; refusing to modify it.', file=sys.stderr)
- sys.exit(1)
-
-target = mcp_servers.get(server_name)
-legacy = mcp_servers.get(legacy_server_name)
-
-target_matches = target == desired_entry
-legacy_matches = legacy == desired_entry
-
-if target_matches and not legacy_matches:
- print(f'Claude MCP server "{server_name}" is already installed for {project_root} in {config_path}.')
- sys.exit(0)
-
-mcp_servers[server_name] = desired_entry
-
-if legacy_matches:
- del mcp_servers[legacy_server_name]
-
-config_path.parent.mkdir(parents=True, exist_ok=True)
-config_path.write_text(json.dumps(data, ensure_ascii=False, indent=2) + "\n")
-
-if target_matches and legacy_matches:
- print(f'Claude MCP server "{server_name}" was already installed for {project_root}; removed legacy alias "{legacy_server_name}" from {config_path}.')
-else:
- print(f'Installed Claude MCP server "{server_name}" for {project_root} into {config_path}.')
-PY
+node "${config_helper}" claude-mcp "${claude_config_path}" "${project_root}" "${server_name}" "${command_name}"
diff --git a/scripts/install-codex-mcp.sh b/scripts/install-codex-mcp.sh
index 1ca8bcf..e166520 100755
--- a/scripts/install-codex-mcp.sh
+++ b/scripts/install-codex-mcp.sh
@@ -2,6 +2,8 @@
set -euo pipefail
+script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+config_helper="${script_dir}/install-config-helper.mjs"
codex_home="${CODEX_HOME:-${HOME}/.codex}"
config_path="${codex_home}/config.toml"
server_name="open-computer-use"
@@ -32,88 +34,4 @@ done
mkdir -p "${codex_home}"
-python3 - "${config_path}" "${server_name}" "${command_name}" <<'PY'
-import json
-import re
-import sys
-from pathlib import Path
-
-try:
- import tomllib
-except ModuleNotFoundError as exc:
- print(f"python3 with tomllib is required: {exc}", file=sys.stderr)
- sys.exit(1)
-
-
-def section_pattern(header: str) -> re.Pattern[str]:
- return re.compile(rf'(?ms)^\[{re.escape(header)}\]\n.*?(?=^\[|\Z)')
-
-
-def remove_section(text: str, header: str) -> str:
- return section_pattern(header).sub("", text)
-
-
-def upsert_section(text: str, header: str, body: str) -> str:
- section = f'[{header}]\n{body.rstrip()}\n'
- pattern = section_pattern(header)
- if pattern.search(text):
- return pattern.sub(section, text, count=1)
-
- if text and not text.endswith("\n"):
- text += "\n"
- if text and not text.endswith("\n\n"):
- text += "\n"
- return text + section
-
-
-config_path = Path(sys.argv[1])
-server_name = sys.argv[2]
-command_name = sys.argv[3]
-desired_args = ["mcp"]
-legacy_server_name = "open-codex-computer-use"
-
-text = config_path.read_text() if config_path.exists() else ""
-
-try:
- parsed = tomllib.loads(text) if text.strip() else {}
-except tomllib.TOMLDecodeError as exc:
- print(f"Existing Codex config is not valid TOML: {exc}", file=sys.stderr)
- sys.exit(1)
-
-mcp_servers = parsed.get("mcp_servers")
-if mcp_servers is not None and not isinstance(mcp_servers, dict):
- print('Existing Codex config has non-table "mcp_servers"; refusing to modify it.', file=sys.stderr)
- sys.exit(1)
-
-target = (mcp_servers or {}).get(server_name)
-legacy = (mcp_servers or {}).get(legacy_server_name)
-
-target_matches = (
- isinstance(target, dict)
- and target.get("command") == command_name
- and target.get("args") == desired_args
-)
-legacy_matches = (
- isinstance(legacy, dict)
- and legacy.get("command") == command_name
- and legacy.get("args") == desired_args
-)
-
-if target_matches and not legacy_matches:
- print(f'Codex MCP server "{server_name}" is already installed in {config_path}.')
- sys.exit(0)
-
-body = f'command = {json.dumps(command_name)}\nargs = {json.dumps(desired_args)}'
-text = upsert_section(text, f'mcp_servers."{server_name}"', body)
-
-if legacy_matches:
- text = remove_section(text, f'mcp_servers."{legacy_server_name}"')
-
-text = re.sub(r"\n{3,}", "\n\n", text).rstrip() + "\n"
-config_path.write_text(text)
-
-if target_matches and legacy_matches:
- print(f'Codex MCP server "{server_name}" was already installed; removed legacy alias "{legacy_server_name}" from {config_path}.')
-else:
- print(f'Installed Codex MCP server "{server_name}" into {config_path}.')
-PY
+node "${config_helper}" codex-mcp "${config_path}" "${server_name}" "${command_name}"
diff --git a/scripts/install-codex-plugin.sh b/scripts/install-codex-plugin.sh
index 613964c..25733d3 100755
--- a/scripts/install-codex-plugin.sh
+++ b/scripts/install-codex-plugin.sh
@@ -3,6 +3,7 @@
set -euo pipefail
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
+config_helper="${repo_root}/scripts/install-config-helper.mjs"
codex_home="${CODEX_HOME:-${HOME}/.codex}"
config_path="${codex_home}/config.toml"
marketplace_name="open-computer-use-local"
@@ -84,17 +85,7 @@ if [[ -z "${app_bundle}" || ! -x "${app_binary}" ]]; then
exit 1
fi
-plugin_version="$(
- python3 - "${plugin_manifest}" <<'PY'
-import json
-import sys
-
-with open(sys.argv[1], "r", encoding="utf-8") as fh:
- manifest = json.load(fh)
-
-print(manifest["version"])
-PY
-)"
+plugin_version="$(node "${config_helper}" codex-plugin-version "${plugin_manifest}")"
if [[ -z "${plugin_version}" ]]; then
echo "Failed to read plugin version from ${plugin_manifest}" >&2
@@ -111,61 +102,7 @@ mkdir -p "${plugin_install_root}"
rsync -a "${plugin_source_root}/" "${plugin_install_root}/"
rsync -a "${app_bundle}" "${plugin_install_root}/"
-python3 - "${config_path}" "${repo_root}" "${marketplace_name}" "${plugin_name}" <<'PY'
-import json
-import re
-import sys
-from pathlib import Path
-
-
-def section_pattern(header: str) -> re.Pattern[str]:
- return re.compile(rf'(?ms)^\[{re.escape(header)}\]\n.*?(?=^\[|\Z)')
-
-
-def remove_section(text: str, header: str) -> str:
- return section_pattern(header).sub("", text)
-
-
-def upsert_section(text: str, header: str, body: str) -> str:
- section = f'[{header}]\n{body.rstrip()}\n'
- pattern = section_pattern(header)
- if pattern.search(text):
- return pattern.sub(section, text, count=1)
-
- if text and not text.endswith("\n"):
- text += "\n"
- if text and not text.endswith("\n\n"):
- text += "\n"
- return text + section
-
-
-config_path = Path(sys.argv[1])
-repo_root = Path(sys.argv[2]).resolve()
-marketplace_name = sys.argv[3]
-plugin_name = sys.argv[4]
-
-text = config_path.read_text() if config_path.exists() else ""
-
-for header in (
- 'mcp_servers."open-codex-computer-use"',
- 'mcp_servers."open-computer-use"',
-):
- text = remove_section(text, header)
-
-text = upsert_section(
- text,
- f"marketplaces.{marketplace_name}",
- f'source_type = "local"\nsource = {json.dumps(str(repo_root))}',
-)
-text = upsert_section(
- text,
- f'plugins."{plugin_name}@{marketplace_name}"',
- "enabled = true",
-)
-
-text = re.sub(r"\n{3,}", "\n\n", text).rstrip() + "\n"
-config_path.write_text(text)
-PY
+node "${config_helper}" codex-plugin-config "${config_path}" "${repo_root}" "${marketplace_name}" "${plugin_name}"
echo "Installed ${plugin_name}@${marketplace_name}"
echo "Marketplace source: ${repo_root}"
diff --git a/scripts/install-config-helper.mjs b/scripts/install-config-helper.mjs
new file mode 100644
index 0000000..8b12334
--- /dev/null
+++ b/scripts/install-config-helper.mjs
@@ -0,0 +1,351 @@
+#!/usr/bin/env node
+
+import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
+import path from "node:path";
+
+function fail(message) {
+ process.stderr.write(`${message}\n`);
+ process.exit(1);
+}
+
+function usage() {
+ process.stdout.write(`Usage:
+ node ./scripts/install-config-helper.mjs claude-mcp <config-path> <project-root> <server-name> <command-name>
+ node ./scripts/install-config-helper.mjs codex-mcp <config-path> <server-name> <command-name>
+ node ./scripts/install-config-helper.mjs codex-plugin-version <plugin-manifest-path>
+ node ./scripts/install-config-helper.mjs codex-plugin-config <config-path> <repo-root> <marketplace-name> <plugin-name>
+`);
+}
+
+function readTextIfExists(filePath) {
+ if (!existsSync(filePath)) {
+ return "";
+ }
+ return readFileSync(filePath, "utf8");
+}
+
+function ensureParentDir(filePath) {
+ mkdirSync(path.dirname(filePath), { recursive: true });
+}
+
+function normalizeNewlines(text) {
+ return text.replace(/\r\n/g, "\n");
+}
+
+function trimTrailingBlankLines(lines) {
+ let end = lines.length;
+ while (end > 0 && lines[end - 1].trim() === "") {
+ end -= 1;
+ }
+ return lines.slice(0, end);
+}
+
+function canonicalSectionBody(bodyLines) {
+ const lines = [...bodyLines];
+ while (lines.length > 0 && lines[0].trim() === "") {
+ lines.shift();
+ }
+ while (lines.length > 0 && lines[lines.length - 1].trim() === "") {
+ lines.pop();
+ }
+ return lines.join("\n");
+}
+
+function splitTomlSections(text) {
+ const normalized = normalizeNewlines(text);
+ if (normalized.length === 0) {
+ return { preambleLines: [], sections: [] };
+ }
+
+ const lines = normalized.split("\n");
+ const preambleLines = [];
+ const sections = [];
+ let currentHeader = null;
+ let currentBodyLines = [];
+
+ for (const line of lines) {
+ const headerMatch = line.match(/^\[([^\]]+)\]\s*$/);
+ if (headerMatch) {
+ if (currentHeader === null) {
+ preambleLines.push(...currentBodyLines);
+ } else {
+ sections.push({ header: currentHeader, bodyLines: currentBodyLines });
+ }
+ currentHeader = headerMatch[1];
+ currentBodyLines = [];
+ continue;
+ }
+ currentBodyLines.push(line);
+ }
+
+ if (currentHeader === null) {
+ preambleLines.push(...currentBodyLines);
+ } else {
+ sections.push({ header: currentHeader, bodyLines: currentBodyLines });
+ }
+
+ return { preambleLines, sections };
+}
+
+function renderTomlDocument(document) {
+ const chunks = [];
+ const preamble = trimTrailingBlankLines(document.preambleLines);
+ if (preamble.length > 0) {
+ chunks.push(preamble.join("\n"));
+ }
+
+ for (const section of document.sections) {
+ const bodyLines = trimTrailingBlankLines(section.bodyLines);
+ if (bodyLines.length > 0) {
+ chunks.push(`[${section.header}]\n${bodyLines.join("\n")}`);
+ } else {
+ chunks.push(`[${section.header}]`);
+ }
+ }
+
+ return chunks.length > 0 ? `${chunks.join("\n\n")}\n` : "";
+}
+
+function ensureUniqueManagedHeaders(document, headers, configPath) {
+ for (const header of headers) {
+ const count = document.sections.filter((section) => section.header === header).length;
+ if (count > 1) {
+ fail(`Existing Codex config has duplicate section [${header}] in ${configPath}; refusing to modify it.`);
+ }
+ }
+}
+
+function applyTomlSectionUpdates(text, updates, configPath) {
+ const document = splitTomlSections(text);
+ const managedHeaders = [
+ ...updates.removeHeaders,
+ ...updates.upserts.map((entry) => entry.header),
+ ];
+ ensureUniqueManagedHeaders(document, managedHeaders, configPath);
+
+ const upsertMap = new Map(
+ updates.upserts.map((entry) => [
+ entry.header,
+ {
+ header: entry.header,
+ bodyLines: normalizeNewlines(entry.body).split("\n"),
+ },
+ ]),
+ );
+ const removeSet = new Set(updates.removeHeaders);
+ const nextSections = [];
+ const insertedHeaders = new Set();
+
+ for (const section of document.sections) {
+ if (removeSet.has(section.header)) {
+ continue;
+ }
+ if (upsertMap.has(section.header)) {
+ nextSections.push(upsertMap.get(section.header));
+ insertedHeaders.add(section.header);
+ continue;
+ }
+ nextSections.push(section);
+ }
+
+ for (const entry of updates.upserts) {
+ if (!insertedHeaders.has(entry.header)) {
+ nextSections.push(upsertMap.get(entry.header));
+ }
+ }
+
+ return renderTomlDocument({
+ preambleLines: document.preambleLines,
+ sections: nextSections,
+ });
+}
+
+function installClaudeMcp(configPath, projectRoot, serverName, commandName) {
+ const desiredEntry = {
+ type: "stdio",
+ command: commandName,
+ args: ["mcp"],
+ };
+ const legacyServerName = "open-codex-computer-use";
+
+ const raw = readTextIfExists(configPath);
+ let data;
+
+ if (raw.trim().length === 0) {
+ data = {};
+ } else {
+ try {
+ data = JSON.parse(raw);
+ } catch (error) {
+ fail(`Existing Claude config is not valid JSON: ${error.message}`);
+ }
+ }
+
+ if (data === null || Array.isArray(data) || typeof data !== "object") {
+ fail("Existing Claude config root is not a JSON object; refusing to modify it.");
+ }
+
+ const projects = data.projects ?? {};
+ if (projects === null || Array.isArray(projects) || typeof projects !== "object") {
+ fail('Existing Claude config has non-object "projects"; refusing to modify it.');
+ }
+ data.projects = projects;
+
+ const projectEntry = projects[projectRoot] ?? {};
+ if (projectEntry === null || Array.isArray(projectEntry) || typeof projectEntry !== "object") {
+ fail(`Existing Claude project entry for ${projectRoot} is not an object; refusing to modify it.`);
+ }
+ projects[projectRoot] = projectEntry;
+
+ const mcpServers = projectEntry.mcpServers ?? {};
+ if (mcpServers === null || Array.isArray(mcpServers) || typeof mcpServers !== "object") {
+ fail(`Existing Claude project MCP config for ${projectRoot} is not an object; refusing to modify it.`);
+ }
+ projectEntry.mcpServers = mcpServers;
+
+ const target = mcpServers[serverName];
+ const legacy = mcpServers[legacyServerName];
+ const targetMatches = JSON.stringify(target) === JSON.stringify(desiredEntry);
+ const legacyMatches = JSON.stringify(legacy) === JSON.stringify(desiredEntry);
+
+ if (targetMatches && !legacyMatches) {
+ process.stdout.write(`Claude MCP server "${serverName}" is already installed for ${projectRoot} in ${configPath}.\n`);
+ return;
+ }
+
+ mcpServers[serverName] = desiredEntry;
+ if (legacyMatches) {
+ delete mcpServers[legacyServerName];
+ }
+
+ ensureParentDir(configPath);
+ writeFileSync(configPath, `${JSON.stringify(data, null, 2)}\n`, "utf8");
+
+ if (targetMatches && legacyMatches) {
+ process.stdout.write(`Claude MCP server "${serverName}" was already installed for ${projectRoot}; removed legacy alias "${legacyServerName}" from ${configPath}.\n`);
+ } else {
+ process.stdout.write(`Installed Claude MCP server "${serverName}" for ${projectRoot} into ${configPath}.\n`);
+ }
+}
+
+function installCodexMcp(configPath, serverName, commandName) {
+ const desiredBody = `command = ${JSON.stringify(commandName)}\nargs = ["mcp"]`;
+ const targetHeader = `mcp_servers."${serverName}"`;
+ const legacyServerName = "open-codex-computer-use";
+ const legacyHeader = `mcp_servers."${legacyServerName}"`;
+ const text = readTextIfExists(configPath);
+ const document = splitTomlSections(text);
+
+ ensureUniqueManagedHeaders(document, [targetHeader, legacyHeader], configPath);
+
+ const targetSection = document.sections.find((section) => section.header === targetHeader);
+ const legacySection = document.sections.find((section) => section.header === legacyHeader);
+ const desiredCanonical = canonicalSectionBody(desiredBody.split("\n"));
+ const targetMatches = targetSection ? canonicalSectionBody(targetSection.bodyLines) === desiredCanonical : false;
+ const legacyMatches = legacySection ? canonicalSectionBody(legacySection.bodyLines) === desiredCanonical : false;
+
+ if (targetMatches && !legacyMatches) {
+ process.stdout.write(`Codex MCP server "${serverName}" is already installed in ${configPath}.\n`);
+ return;
+ }
+
+ const nextText = applyTomlSectionUpdates(
+ text,
+ {
+ removeHeaders: [legacyHeader],
+ upserts: [{ header: targetHeader, body: desiredBody }],
+ },
+ configPath,
+ );
+
+ ensureParentDir(configPath);
+ writeFileSync(configPath, nextText, "utf8");
+
+ if (targetMatches && legacyMatches) {
+ process.stdout.write(`Codex MCP server "${serverName}" was already installed; removed legacy alias "${legacyServerName}" from ${configPath}.\n`);
+ } else {
+ process.stdout.write(`Installed Codex MCP server "${serverName}" into ${configPath}.\n`);
+ }
+}
+
+function printCodexPluginVersion(pluginManifestPath) {
+ let manifest;
+ try {
+ manifest = JSON.parse(readFileSync(pluginManifestPath, "utf8"));
+ } catch (error) {
+ fail(`Failed to read plugin manifest ${pluginManifestPath}: ${error.message}`);
+ }
+
+ if (!manifest || typeof manifest.version !== "string" || manifest.version.length === 0) {
+ fail(`Plugin manifest ${pluginManifestPath} does not contain a valid string "version".`);
+ }
+
+ process.stdout.write(`${manifest.version}\n`);
+}
+
+function installCodexPluginConfig(configPath, repoRoot, marketplaceName, pluginName) {
+ const text = readTextIfExists(configPath);
+ const repoRootPath = path.resolve(repoRoot);
+ const nextText = applyTomlSectionUpdates(
+ text,
+ {
+ removeHeaders: [
+ 'mcp_servers."open-codex-computer-use"',
+ 'mcp_servers."open-computer-use"',
+ ],
+ upserts: [
+ {
+ header: `marketplaces.${marketplaceName}`,
+ body: `source_type = "local"\nsource = ${JSON.stringify(repoRootPath)}`,
+ },
+ {
+ header: `plugins."${pluginName}@${marketplaceName}"`,
+ body: "enabled = true",
+ },
+ ],
+ },
+ configPath,
+ );
+
+ ensureParentDir(configPath);
+ writeFileSync(configPath, nextText, "utf8");
+}
+
+function main(argv) {
+ const [command, ...args] = argv;
+ switch (command) {
+ case "claude-mcp":
+ if (args.length !== 4) {
+ usage();
+ process.exit(1);
+ }
+ installClaudeMcp(...args);
+ return;
+ case "codex-mcp":
+ if (args.length !== 3) {
+ usage();
+ process.exit(1);
+ }
+ installCodexMcp(...args);
+ return;
+ case "codex-plugin-version":
+ if (args.length !== 1) {
+ usage();
+ process.exit(1);
+ }
+ printCodexPluginVersion(args[0]);
+ return;
+ case "codex-plugin-config":
+ if (args.length !== 4) {
+ usage();
+ process.exit(1);
+ }
+ installCodexPluginConfig(...args);
+ return;
+ default:
+ usage();
+ process.exit(1);
+ }
+}
+
+main(process.argv.slice(2));
diff --git a/scripts/npm/build-packages.mjs b/scripts/npm/build-packages.mjs
index 667e95e..3edbd18 100644
--- a/scripts/npm/build-packages.mjs
+++ b/scripts/npm/build-packages.mjs
@@ -399,6 +399,7 @@ function renderPackageJson(packageName, version) {
"plugins/open-computer-use/assets/",
"plugins/open-computer-use/scripts/",
"scripts/install-claude-mcp.sh",
+ "scripts/install-config-helper.mjs",
"scripts/install-codex-mcp.sh",
"scripts/install-codex-plugin.sh",
"scripts/postinstall.mjs",
@@ -426,6 +427,7 @@ function stagePackage(packageName, version, outDir) {
recursive: true,
});
cpSync(path.join(repoRoot, "scripts", "install-claude-mcp.sh"), path.join(packageRoot, "scripts", "install-claude-mcp.sh"));
+ cpSync(path.join(repoRoot, "scripts", "install-config-helper.mjs"), path.join(packageRoot, "scripts", "install-config-helper.mjs"));
cpSync(path.join(repoRoot, "scripts", "install-codex-mcp.sh"), path.join(packageRoot, "scripts", "install-codex-mcp.sh"));
cpSync(path.join(repoRoot, "scripts", "install-codex-plugin.sh"), path.join(packageRoot, "scripts", "install-codex-plugin.sh"));
cpSync(path.join(repoRoot, "LICENSE"), path.join(packageRoot, "LICENSE"));