@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.
- package/README.md +131 -87
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,40 +1,45 @@
|
|
|
1
1
|
# @mediaio/cli
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
binary
|
|
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
|
-
|
|
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
|
|
17
|
+
install.js downloads vendor/mediaio (or vendor/mediaio.exe on Windows)
|
|
15
18
|
↓
|
|
16
|
-
mediaio / mi
|
|
19
|
+
mediaio / mi command → JavaScript launcher → Go binary
|
|
17
20
|
↓
|
|
18
|
-
Media.io
|
|
21
|
+
Media.io public API
|
|
19
22
|
```
|
|
20
23
|
|
|
21
|
-
`media-plugin-main`
|
|
22
|
-
|
|
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
|
-
- npm
|
|
28
|
-
-
|
|
29
|
-
|
|
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
|
|
47
|
-
|
|
48
|
-
|
|
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
|
-
##
|
|
57
|
+
## For Claude Code
|
|
51
58
|
|
|
52
|
-
`
|
|
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.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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
|
-
|
|
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
|
|
110
|
+
The archive root must directly contain `mediaio`. On Windows, it must directly
|
|
111
|
+
contain `mediaio.exe`.
|
|
81
112
|
|
|
82
|
-
##
|
|
113
|
+
## Launcher Behavior
|
|
83
114
|
|
|
84
|
-
`bin/run.js`
|
|
115
|
+
`bin/run.js` starts `vendor/mediaio` or `vendor/mediaio.exe` and provides the
|
|
116
|
+
following pass-through behavior:
|
|
85
117
|
|
|
86
|
-
-
|
|
87
|
-
- `stdin
|
|
88
|
-
-
|
|
89
|
-
-
|
|
90
|
-
-
|
|
91
|
-
-
|
|
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
|
-
|
|
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
|
-
|
|
137
|
+
Use a locally built binary from the sibling `media-plugin-bin` repository for
|
|
138
|
+
integration testing:
|
|
105
139
|
|
|
106
140
|
```bash
|
|
107
|
-
#
|
|
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
|
-
#
|
|
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
|
|
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
|
|
168
|
+
The npm package and Go binary currently use the same version number and must be
|
|
169
|
+
released together.
|
|
135
170
|
|
|
136
|
-
1.
|
|
137
|
-
2.
|
|
138
|
-
3.
|
|
139
|
-
4.
|
|
140
|
-
5.
|
|
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
|
|
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
|
-
|
|
166
|
-
`windows/arm64`
|
|
167
|
-
|
|
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
|
-
###
|
|
210
|
+
### Binary Missing
|
|
172
211
|
|
|
173
|
-
|
|
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
|
-
|
|
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
|
-
###
|
|
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
|
|
189
|
-
- asset
|
|
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
|
-
|
|
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
|
-
|
|
246
|
+
Any other `process.platform` or `process.arch` reported by Node causes the
|
|
247
|
+
installation to fail immediately.
|
|
205
248
|
|
|
206
|
-
##
|
|
249
|
+
## Current Implementation vs. v2 Target
|
|
207
250
|
|
|
208
|
-
|
|
|
251
|
+
| Area | Current Implementation | v2 Target |
|
|
209
252
|
|---|---|---|
|
|
210
|
-
| npm
|
|
211
|
-
|
|
|
212
|
-
|
|
|
213
|
-
|
|
|
214
|
-
|
|
|
215
|
-
|
|
|
216
|
-
|
|
|
217
|
-
| metadata |
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
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.
|