mirror of
https://github.com/zyycn/codex-proxy-rs.git
synced 2026-12-06 08:01:57 +00:00
Clarify provider ownership and compatibility decisions in the development workflow. Document the active API, SDK, deployment and migration contracts, and keep version history in release notes. Co-authored-by: Codex <noreply@openai.com>
45 lines
2.8 KiB
Markdown
45 lines
2.8 KiB
Markdown
# Codex Proxy Plugin CLI
|
|
|
|
`cpr-plugin package` 将已构建的插件二进制和声明资源打成安装包,同时生成 SHA-256 校验文件。作者清单须省略 `package`,CLI 会写入协议版本、目标平台和文件摘要。清单格式见 [SDK 清单](../../crates/gateway-plugin/sdk/docs/manifest.md)。
|
|
|
|
## 安装
|
|
|
|
从仓库根目录安装到本地工具目录:
|
|
|
|
```bash
|
|
cargo +1.99.1 install --locked --path backend/apps/plugin-cli --root /path/to/local-tools
|
|
```
|
|
|
|
将 `/path/to/local-tools/bin` 加入 `PATH`,或使用可执行文件的完整路径
|
|
|
|
## 打包
|
|
|
|
先构建目标平台的二进制。有管理页面时,还需构建其静态资源。支持的目标为 `x86_64-unknown-linux-gnu`、`aarch64-unknown-linux-gnu` 和 `aarch64-apple-darwin`。全部参数见 `cpr-plugin package --help`。
|
|
|
|
```bash
|
|
cpr-plugin package \
|
|
--manifest /path/to/plugin/plugin.json \
|
|
--binary /path/to/plugin/target/x86_64-unknown-linux-gnu/release/plugin \
|
|
--target x86_64-unknown-linux-gnu \
|
|
--resource-map web=web/dist \
|
|
--output-dir /path/to/output
|
|
```
|
|
|
|
`--binary` 指定的文件会写入清单的 `main` 路径。`resources` 中每项默认从清单所在目录按包内路径读取。清单、二进制和各资源均须是普通文件,不能以符号链接作输入文件。
|
|
|
|
例如,清单声明 `web/index.html` 时,`--resource-map web=web/dist` 改从 `<清单目录>/web/dist/index.html` 读取,包内仍为 `web/index.html`。映射只匹配资源路径的第一段,可为不同前缀重复传参。源目录须为项目相对路径,资源解析后须在清单目录内。重复前缀、未匹配任何资源或映射前缀本身被用作资源文件时,打包失败。包内命名规则见[包内路径](../../crates/gateway-plugin/sdk/docs/manifest.md#包内路径)。
|
|
|
|
输出为 `<插件 ID>-<版本>-<目标 triple>.tar.gz` 及对应的 `.tar.gz.sha256`。归档根目录包含 `plugin.json`、可执行文件和声明资源。
|
|
输入清单及生成后的清单均不得超过 64 KiB,压缩包上限为 32 MiB,展开归档上限为 128 MiB
|
|
|
|
图标与其他资源一样按原文件打包,图像内容由宿主在安装时校验。打包后在目标宿主验证启动和插件功能。参见[图标要求](../../crates/gateway-plugin/sdk/docs/manifest.md#插件图标)、[安装步骤](../../../docs/plugins.md#安装)及插件[子模块](../../../docs/development.md#源码联调)的 `examples/workbench`。
|
|
|
|
## 开发
|
|
|
|
Rust 包名为 `codex-proxy-plugin-cli`,位于宿主的 `backend` workspace,共享工具链、锁文件和检查规则;内部仅依赖 `gateway-plugin-sdk`
|
|
|
|
```bash
|
|
cargo +1.99.1 run --manifest-path backend/Cargo.toml -p codex-proxy-plugin-cli --locked -- package --help
|
|
RUST_MIN_STACK=16777216 cargo +1.99.1 test --manifest-path backend/Cargo.toml -p codex-proxy-plugin-cli --locked
|
|
```
|