Skip to content

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

Remove rsync dependency from plugin installer

Leo2d87ff78a9b3
diff --git a/docs/histories/2026-04/20260420-1834-remove-rsync-from-plugin-installer.md b/docs/histories/2026-04/20260420-1834-remove-rsync-from-plugin-installer.md
new file mode 100644
index 0000000..3d97f65
--- /dev/null
+++ b/docs/histories/2026-04/20260420-1834-remove-rsync-from-plugin-installer.md
@@ -0,0 +1,32 @@
+## [2026-04-20 18:34] | Task: 去掉 plugin installer 对 rsync 的依赖
+
+### 🤖 Execution Context
+* **Agent ID**: `codex`
+* **Base Model**: `GPT-5`
+* **Runtime**: `Codex CLI`
+
+### 📥 User Query
+> 为什么有 `rsync`?干什么的
+>
+> 换掉吧,node `cpSync` 是可以的。
+
+### 🛠 Changes Overview
+**Scope:** `scripts/`
+
+**Key Actions:**
+- **移除 `rsync` 依赖**:`scripts/install-codex-plugin.sh` 不再调用外部 `rsync` 复制 plugin 目录和 `.app` bundle。
+- **扩展共享 helper**:在 `scripts/install-config-helper.mjs` 里增加 `copy-into-dir` 子命令,用 Node `cpSync` 递归复制多个源路径到目标目录。
+- **保持安装行为不变**:插件缓存目录结构和后续 `config.toml` 写入逻辑保持原样,只收口宿主命令前提。
+
+### 🧠 Design Intent (Why)
+`rsync` 在这里并不是业务必需能力,只是“递归复制目录”的实现手段。既然 `open-computer-use` 的 npm 分发路径已经接受 Node 作为天然前提,就没必要再让 `install-codex-plugin` 多背一个额外系统命令依赖。改成 `cpSync` 后,安装器的运行时前提更一致,也更符合前面去掉 Python 依赖的方向。
+
+### ✅ Verification
+- `node --check scripts/install-config-helper.mjs`
+- 临时 `CODEX_HOME` 下执行 `./scripts/install-codex-plugin.sh --configuration release`
+- `node ./scripts/npm/build-packages.mjs --skip-build --package open-computer-use --out-dir dist/tmp/npm-stage-check`
+- `rg -n "rsync" dist/tmp/npm-stage-check/open-computer-use -S`
+
+### 📁 Files Modified
+- `scripts/install-codex-plugin.sh`
+- `scripts/install-config-helper.mjs`
diff --git a/scripts/install-codex-plugin.sh b/scripts/install-codex-plugin.sh
index 25733d3..8bb0d4e 100755
--- a/scripts/install-codex-plugin.sh
+++ b/scripts/install-codex-plugin.sh
@@ -99,8 +99,7 @@ mkdir -p "${codex_home}" "${plugin_cache_root}"
rm -rf "${plugin_install_root}"
mkdir -p "${plugin_install_root}"
-rsync -a "${plugin_source_root}/" "${plugin_install_root}/"
-rsync -a "${app_bundle}" "${plugin_install_root}/"
+node "${config_helper}" copy-into-dir "${plugin_install_root}" "${plugin_source_root}" "${app_bundle}"
node "${config_helper}" codex-plugin-config "${config_path}" "${repo_root}" "${marketplace_name}" "${plugin_name}"
diff --git a/scripts/install-config-helper.mjs b/scripts/install-config-helper.mjs
index 8b12334..a6abfe0 100644
--- a/scripts/install-config-helper.mjs
+++ b/scripts/install-config-helper.mjs
@@ -1,6 +1,6 @@
#!/usr/bin/env node
-import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
+import { cpSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
import path from "node:path";
function fail(message) {
@@ -14,6 +14,7 @@ function usage() {
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>
+ node ./scripts/install-config-helper.mjs copy-into-dir <target-dir> <source-path> [<source-path> ...]
`);
}
@@ -311,6 +312,24 @@ function installCodexPluginConfig(configPath, repoRoot, marketplaceName, pluginN
writeFileSync(configPath, nextText, "utf8");
}
+function copyIntoDir(targetDir, sourcePaths) {
+ if (sourcePaths.length === 0) {
+ fail("copy-into-dir requires at least one source path.");
+ }
+
+ mkdirSync(targetDir, { recursive: true });
+
+ for (const sourcePath of sourcePaths) {
+ if (!existsSync(sourcePath)) {
+ fail(`Source path does not exist: ${sourcePath}`);
+ }
+
+ const destinationPath = path.join(targetDir, path.basename(sourcePath));
+ rmSync(destinationPath, { recursive: true, force: true });
+ cpSync(sourcePath, destinationPath, { recursive: true });
+ }
+}
+
function main(argv) {
const [command, ...args] = argv;
switch (command) {
@@ -342,6 +361,13 @@ function main(argv) {
}
installCodexPluginConfig(...args);
return;
+ case "copy-into-dir":
+ if (args.length < 2) {
+ usage();
+ process.exit(1);
+ }
+ copyIntoDir(args[0], args.slice(1));
+ return;
default:
usage();
process.exit(1);