@mediaio/cli 0.2.0-ci.79 → 0.2.0-ci.81

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +131 -87
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,40 +1,45 @@
1
1
  # @mediaio/cli
2
2
 
3
- Media.io CLI npm 安装与启动层。该包本身不实现 Media.io API,而是在
4
- `postinstall` 阶段下载与当前操作系统、CPU 架构匹配的 `media-plugin-bin` Go
5
- binary,并通过 JavaScript launcher 透传参数、标准输入输出、signal 和退出码。
3
+ This repository provides the npm installation and launcher layer for the
4
+ Media.io CLI. It does not implement the Media.io API itself. Instead, during
5
+ `postinstall`, it downloads the `media-plugin-bin` Go binary that matches the
6
+ current operating system and CPU architecture, then invokes it through a
7
+ JavaScript launcher that forwards arguments, stdio, signals, and exit codes.
6
8
 
7
- 整体技术方案参考:[MCP、CLI Agent 插件技术方案 v2](../media-plugin-mcp/docs/architecture/MCP、CLI与Agent插件技术方案-v2.md)。
9
+ For the broader technical design, see
10
+ [MCP, CLI, and Agent Plugin Technical Plan v2](../media-plugin-mcp/docs/architecture/MCP、CLI与Agent插件技术方案-v2.md).
8
11
 
9
- ## 架构位置
12
+ ## Architecture
10
13
 
11
14
  ```text
12
15
  npm install -g @mediaio/cli
13
16
  ↓ postinstall
14
- install.js 下载 vendor/mediaio(Windows vendor/mediaio.exe
17
+ install.js downloads vendor/mediaio (or vendor/mediaio.exe on Windows)
15
18
 
16
- mediaio / mi 命令 → JavaScript launcher → Go binary
19
+ mediaio / mi command → JavaScript launcher → Go binary
17
20
 
18
- Media.io 公网 API
21
+ Media.io public API
19
22
  ```
20
23
 
21
- `media-plugin-main` 中的 Agent Skills 可以复用这套 CLI/binary 基座;本仓库不包含
22
- Skills、MCP 服务或 Media.io API client 实现。
24
+ The agent skills in `media-plugin-main` can reuse this CLI/binary foundation.
25
+ This repository does not include skills, an MCP server, or a Media.io API
26
+ client implementation.
23
27
 
24
- ## 环境要求
28
+ ## Requirements
25
29
 
26
- - Node.js 14 或更高版本。
27
- - npmpnpmYarn Bun;安装器会记录检测到的包管理器。
28
- - 系统提供 `tar` 命令。当前安装器使用 `tar` 解压 binary,Windows 环境也必须可用。
29
- - 能访问当前配置的 GitHub Release 下载地址。
30
+ - Node.js 14 or later.
31
+ - npm, pnpm, Yarn, or Bun. The installer records the detected package manager.
32
+ - A system `tar` command. The current installer uses `tar` to extract the
33
+ binary, including on Windows.
34
+ - Access to the configured GitHub Release download URL.
30
35
 
31
- ## 安装
36
+ ## Installation
32
37
 
33
38
  ```bash
34
39
  npm install -g @mediaio/cli
35
40
  ```
36
41
 
37
- 安装完成后:
42
+ After installation:
38
43
 
39
44
  ```bash
40
45
  mediaio --help
@@ -43,56 +48,84 @@ mediaio auth login
43
48
  mediaio generate list
44
49
  ```
45
50
 
46
- CLI 同时提供 `mediaio` `mi` 两个等价命令,二者调用同一 launcher、binary、配置和
47
- 凭据。`mediaio` 是正式命令:所有文档、自动化脚本与排障指引均使用它;`mi` 仅作为终端
48
- 输入的便捷别名。若用户机器已有同名 `mi` 命令发生 PATH 冲突,继续使用 `mediaio` 即可。
51
+ The CLI exposes both `mediaio` and `mi` as equivalent commands. They use the
52
+ same launcher, binary, configuration, and credentials. `mediaio` is the
53
+ canonical command: all documentation, automation, and troubleshooting guidance
54
+ should use it. `mi` is only a convenience alias for terminal input. If a user
55
+ machine already has another `mi` command in `PATH`, continue using `mediaio`.
49
56
 
50
- ## postinstall 做了什么
57
+ ## For Claude Code
51
58
 
52
- `npm install` 会执行:
59
+ The `Claude Code` plugin in `media-plugin-main` depends on an executable
60
+ `mediaio` command on the local machine. This npm package is one supported way to
61
+ install that local runtime.
62
+
63
+ Recommended verification flow:
64
+
65
+ ```bash
66
+ npm install -g @mediaio/cli
67
+ mediaio auth login
68
+ mediaio version
69
+ mediaio model list
70
+ ```
71
+
72
+ If these commands work, you can then install the `Claude Code` plugin from
73
+ `media-plugin-main`. The plugin itself does not silently install or repair the
74
+ `mediaio` CLI for you.
75
+
76
+ ## What `postinstall` Does
77
+
78
+ `npm install` runs:
53
79
 
54
80
  ```text
55
81
  node install.js
56
82
  ```
57
83
 
58
- 当前安装流程:
84
+ Current installation flow:
59
85
 
60
- 1. Node 平台映射为 binary 平台名:`darwin`、`linux`、`windows`。
61
- 2. 将 Node 架构映射为 Go 架构名:`x64 → amd64`、`arm64 → arm64`。
62
- 3. 读取 npm 包版本作为 binary 版本。
63
- 4. 下载对应的 `.tar.gz` Release asset。
64
- 5. 从压缩包根目录提取 `mediaio` `mediaio.exe` `vendor/`。
65
- 6. Unix 平台为 binary 增加可执行权限。
66
- 7. 写入 `vendor/install.json`,记录安装方式、包管理器、包名和版本。
86
+ 1. Map the Node platform to the binary platform name: `darwin`, `linux`,
87
+ `windows`.
88
+ 2. Map the Node architecture to the Go architecture name:
89
+ `x64 amd64`, `arm64 arm64`.
90
+ 3. Read the npm package version as the binary version.
91
+ 4. Download the matching `.tar.gz` release asset.
92
+ 5. Extract `mediaio` or `mediaio.exe` from the archive root into `vendor/`.
93
+ 6. Add executable permissions on Unix platforms.
94
+ 7. Write `vendor/install.json` with the install method, package manager,
95
+ package name, and version.
67
96
 
68
- 当前下载规则:
97
+ Current download rule:
69
98
 
70
99
  ```text
71
100
  https://github.com/media-io/cli/releases/download/v<version>/mediaio_<version>_<os>_<arch>.tar.gz
72
101
  ```
73
102
 
74
- 例如 npm 包版本为 `1.0.3`、运行环境为 Apple Silicon macOS 时,会下载:
103
+ For example, if the npm package version is `1.0.3` and the runtime environment
104
+ is Apple Silicon macOS, the installer downloads:
75
105
 
76
106
  ```text
77
107
  https://github.com/media-io/cli/releases/download/v1.0.3/mediaio_1.0.3_darwin_arm64.tar.gz
78
108
  ```
79
109
 
80
- archive 根目录必须直接包含 `mediaio`;Windows archive 必须直接包含 `mediaio.exe`。
110
+ The archive root must directly contain `mediaio`. On Windows, it must directly
111
+ contain `mediaio.exe`.
81
112
 
82
- ## launcher 行为
113
+ ## Launcher Behavior
83
114
 
84
- `bin/run.js` 启动 `vendor/mediaio` `vendor/mediaio.exe`,并执行以下透传:
115
+ `bin/run.js` starts `vendor/mediaio` or `vendor/mediaio.exe` and provides the
116
+ following pass-through behavior:
85
117
 
86
- - 原样传递 CLI 参数。
87
- - `stdin`、`stdout`、`stderr` 使用 `inherit`。
88
- - 子进程被 signal 终止时,将 signal 传递给当前 Node 进程。
89
- - 正常退出时返回 Go binary exit code
90
- - binary 注入 `mediaio_INSTALL_METHOD=npm`。
91
- - binary 注入 `mediaio_PACKAGE_MANAGER=<npm|pnpm|yarn|bun>`。
118
+ - Forward CLI arguments unchanged.
119
+ - Use `inherit` for `stdin`, `stdout`, and `stderr`.
120
+ - Forward termination signals from the child process back to the Node process.
121
+ - Return the Go binary exit code on normal exit.
122
+ - Inject `mediaio_INSTALL_METHOD=npm` into the binary environment.
123
+ - Inject `mediaio_PACKAGE_MANAGER=<npm|pnpm|yarn|bun>` into the binary
124
+ environment.
92
125
 
93
- ## 本地开发
126
+ ## Local Development
94
127
 
95
- 只检查 JavaScript 语法,不触发 binary 下载:
128
+ Validate JavaScript syntax only, without triggering a binary download:
96
129
 
97
130
  ```bash
98
131
  node --check install.js
@@ -101,15 +134,16 @@ node --check bin/run.js
101
134
  npm pack --dry-run
102
135
  ```
103
136
 
104
- 使用相邻的 `media-plugin-bin` 本地构建产物联调:
137
+ Use a locally built binary from the sibling `media-plugin-bin` repository for
138
+ integration testing:
105
139
 
106
140
  ```bash
107
- # 先在 ../media-plugin-bin 中构建
141
+ # Build first in ../media-plugin-bin
108
142
  cd ../media-plugin-bin
109
143
  mkdir -p dist
110
144
  go build -trimpath -o dist/mediaio .
111
145
 
112
- # 回到本仓库,跳过 postinstall 并放入本地 binary
146
+ # Return to this repository, skip postinstall, and place the local binary
113
147
  cd ../media-plugin-cli
114
148
  npm install --ignore-scripts
115
149
  mkdir -p vendor
@@ -121,7 +155,7 @@ node bin/mi.js --help
121
155
  node bin/mediaio.js generate list
122
156
  ```
123
157
 
124
- Windows 请复制 `mediaio.exe`:
158
+ On Windows, copy `mediaio.exe` instead:
125
159
 
126
160
  ```powershell
127
161
  New-Item -ItemType Directory -Force vendor
@@ -129,15 +163,16 @@ Copy-Item ..\media-plugin-bin\dist\mediaio.exe vendor\mediaio.exe
129
163
  node bin\mediaio.js --help
130
164
  ```
131
165
 
132
- ## 发布
166
+ ## Release
133
167
 
134
- npm 包与 Go binary 当前使用同一个版本号,必须成套发布。
168
+ The npm package and Go binary currently use the same version number and must be
169
+ released together.
135
170
 
136
- 1. `media-plugin-bin` 中完成测试和多平台构建。
137
- 2. 创建 `v<version>` Release,并上传对应的 binary archives
138
- 3. 确认每个 archive 的名称和根目录文件符合安装器约定。
139
- 4. 将本仓库 `package.json.version` 设置为相同版本。
140
- 5. 检查 npm 包内容并发布。
171
+ 1. Finish testing and multi-platform builds in `media-plugin-bin`.
172
+ 2. Create a `v<version>` release and upload the matching binary archives.
173
+ 3. Verify that each archive name and root file match the installer contract.
174
+ 4. Set this repository's `package.json.version` to the same version.
175
+ 5. Inspect the npm package contents and publish.
141
176
 
142
177
  ```bash
143
178
  npm pack --dry-run
@@ -145,14 +180,14 @@ npm pack
145
180
  npm publish --access public
146
181
  ```
147
182
 
148
- 发布后应在干净环境验证:
183
+ After release, validate in a clean environment:
149
184
 
150
185
  ```bash
151
186
  npm install -g @mediaio/cli@<version>
152
187
  mediaio --help
153
188
  ```
154
189
 
155
- v2 方案首期 binary matrix 为:
190
+ The initial v2 binary matrix is:
156
191
 
157
192
  ```text
158
193
  darwin/amd64
@@ -162,59 +197,68 @@ linux/arm64
162
197
  windows/amd64
163
198
  ```
164
199
 
165
- 注意:当前 `package.json` `os` `cpu` 字段、`install.js` 的映射逻辑也会允许
166
- `windows/arm64` 进入安装流程。正式发布前必须二选一:提供
167
- `mediaio_<version>_windows_arm64.tar.gz`,或收紧安装器/包元数据,避免用户安装后得到 404。
200
+ Note: the current `package.json` `os` and `cpu` fields, together with the
201
+ mapping logic in `install.js`, also allow `windows/arm64` to enter the install
202
+ flow. Before public release, you must do one of the following:
203
+
204
+ - provide `mediaio_<version>_windows_arm64.tar.gz`, or
205
+ - tighten the installer and package metadata so users do not hit a 404 after
206
+ installation.
168
207
 
169
- ## 排障
208
+ ## Troubleshooting
170
209
 
171
- ### binary 不存在
210
+ ### Binary Missing
172
211
 
173
- 如果看到 `binary not found at .../vendor/mediaio`,说明 `postinstall` 未执行或执行失败。
212
+ If you see `binary not found at .../vendor/mediaio`, `postinstall` did not run
213
+ or failed.
174
214
 
175
215
  ```bash
176
216
  npm uninstall -g @mediaio/cli
177
217
  npm install -g @mediaio/cli
178
218
  ```
179
219
 
180
- 使用 `npm install --ignore-scripts` 安装时不会下载 binary;当前版本尚未提供独立的
181
- `mediaio install` 修复命令。
220
+ If you install with `npm install --ignore-scripts`, the binary will not be
221
+ downloaded. The current version does not yet provide a separate `mediaio install`
222
+ repair command.
182
223
 
183
- ### 下载返回 404
224
+ ### Download Returns 404
184
225
 
185
- 检查以下三项是否完全一致:
226
+ Check that all three of the following match exactly:
186
227
 
187
- - `package.json.version`;
188
- - GitHub Release tag `v<version>`;
189
- - asset 名称 `mediaio_<version>_<os>_<arch>.tar.gz`。
228
+ - `package.json.version`
229
+ - GitHub release tag `v<version>`
230
+ - asset name `mediaio_<version>_<os>_<arch>.tar.gz`
190
231
 
191
- ### 解压失败
232
+ ### Extraction Fails
192
233
 
193
- 确认系统存在 `tar`,并确认 archive 根目录直接包含 `mediaio` `mediaio.exe`。
234
+ Make sure the system provides `tar`, and make sure the archive root directly
235
+ contains `mediaio` or `mediaio.exe`.
194
236
 
195
- ### 平台不支持
237
+ ### Unsupported Platform
196
238
 
197
- 当前安装器只识别:
239
+ The current installer recognizes only:
198
240
 
199
241
  ```text
200
242
  darwin | linux | windows
201
243
  amd64 | arm64
202
244
  ```
203
245
 
204
- Node 报告的其他 `process.platform` `process.arch` 会直接终止安装。
246
+ Any other `process.platform` or `process.arch` reported by Node causes the
247
+ installation to fail immediately.
205
248
 
206
- ## 当前实现与 v2 目标的差异
249
+ ## Current Implementation vs. v2 Target
207
250
 
208
- | 领域 | 当前实现 | v2 目标 |
251
+ | Area | Current Implementation | v2 Target |
209
252
  |---|---|---|
210
- | npm 包名 | `@mediaio/cli` | `@mediaio/cli` |
211
- | 命令入口 | `mediaio` | `mediaio`,不提供缩写别名 |
212
- | 版本锁定 | npm version 直接拼接下载 URL | 独立 binary manifest 固定精确版本 |
213
- | 完整性校验 | 尚无 checksum/signature 校验 | SHA-256、签名和 binary version 校验 |
214
- | 下载安全 | 直接写目标 tarball,未配置 timeout | 随机临时文件、timeout、原子安装和统一清理 |
215
- | 平台识别 | OS/CPU;未识别 libc | Linux 明确 glibc/musl 策略 |
216
- | 安装修复 | 重新安装 npm | 显式 install/repair/upgrade/offline 入口 |
217
- | metadata | 写入 `install.json`,launcher 损坏时降级 | metadata binary 原子安装,损坏时明确失败 |
218
-
219
- 这些目标完成前,README 和发布说明应明确当前能力边界,不能声称安装器已经验证
220
- checksum、签名或 binary version。
253
+ | npm package name | `@mediaio/cli` | `@mediaio/cli` |
254
+ | command entry | `mediaio` only | `mediaio` only, with no shorthand alias |
255
+ | version locking | npm version is interpolated directly into the download URL | dedicated binary manifest pins the exact version |
256
+ | integrity validation | no checksum or signature validation yet | SHA-256, signature, and binary version validation |
257
+ | download safety | writes directly to the target tarball, no explicit timeout | random temp file, timeout, atomic install, and unified cleanup |
258
+ | platform detection | OS and CPU only; no libc detection | explicit Linux glibc vs musl strategy |
259
+ | install repair | reinstall the npm package | explicit install / repair / upgrade / offline entry points |
260
+ | metadata | writes `install.json`, degrades if launcher metadata is damaged | metadata and binary installed atomically, with explicit failure on corruption |
261
+
262
+ Until these targets are implemented, the README and release instructions must
263
+ state the current capability boundaries clearly and must not claim that the
264
+ installer already validates checksums, signatures, or binary versions.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mediaio/cli",
3
- "version": "0.2.0-ci.79",
3
+ "version": "0.2.0-ci.81",
4
4
  "description": "Media.io AI CLI — generate images and videos from the terminal.",
5
5
  "bin": {
6
6
  "mediaio": "bin/mediaio.js",