@mediaio/cli 0.5.0-ci.136 → 0.5.1

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 (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +21 -232
  3. package/package.json +4 -4
  4. package/bin/mi.js +0 -2
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Media.io
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,264 +1,53 @@
1
1
  # @mediaio/cli
2
2
 
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.
3
+ Media.io AI CLI generate images and videos from the terminal.
8
4
 
9
- For the broader technical design, see
10
- [MCP, CLI, and Agent Plugin Technical Plan v3](../media-plugin-api/docs/architecture/MCP、CLI与Agent插件技术方案-v3.md).
11
-
12
- ## Architecture
13
-
14
- ```text
15
- npm install -g @mediaio/cli
16
- ↓ postinstall
17
- install.js downloads vendor/mediaio (or vendor/mediaio.exe on Windows)
18
-
19
- mediaio / mi command → JavaScript launcher → Go binary
20
-
21
- Media.io public API
22
- ```
23
-
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.
27
-
28
- ## Requirements
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.
35
-
36
- ## Installation
5
+ ## Install
37
6
 
38
7
  ```bash
39
8
  npm install -g @mediaio/cli
40
9
  ```
41
10
 
42
- After installation:
43
-
44
- ```bash
45
- mediaio --help
46
- mi --help
47
- mediaio auth login
48
- mediaio generate list
49
- ```
50
-
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`.
11
+ Postinstall fetches the prebuilt `mediaio` binary for your platform from the
12
+ [GitHub release](https://github.com/media-io/cli/releases).
56
13
 
57
- ## For Claude Code
14
+ Supported platforms: macOS, Linux, Windows (x64, arm64). Requires Node.js 14+.
58
15
 
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:
16
+ ## Usage
64
17
 
65
18
  ```bash
66
- npm install -g @mediaio/cli
67
19
  mediaio auth login
68
- mediaio version
69
20
  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:
79
-
80
- ```text
81
- node install.js
82
- ```
83
-
84
- Current installation flow:
85
-
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.
96
-
97
- Current download rule:
98
-
99
- ```text
100
- https://github.com/media-io/cli/releases/download/v<version>/mediaio_<version>_<os>_<arch>.tar.gz
101
- ```
102
-
103
- For example, if the npm package version is `1.0.3` and the runtime environment
104
- is Apple Silicon macOS, the installer downloads:
105
-
106
- ```text
107
- https://github.com/media-io/cli/releases/download/v1.0.3/mediaio_1.0.3_darwin_arm64.tar.gz
108
- ```
109
-
110
- The archive root must directly contain `mediaio`. On Windows, it must directly
111
- contain `mediaio.exe`.
112
-
113
- ## Launcher Behavior
114
-
115
- `bin/run.js` starts `vendor/mediaio` or `vendor/mediaio.exe` and provides the
116
- following pass-through behavior:
117
-
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.
125
-
126
- ## Local Development
127
-
128
- Validate JavaScript syntax only, without triggering a binary download:
129
-
130
- ```bash
131
- node --check install.js
132
- node --check bin/mediaio.js
133
- node --check bin/run.js
134
- npm pack --dry-run
135
- ```
136
-
137
- Use a locally built binary from the sibling `media-plugin-bin` repository for
138
- integration testing:
139
-
140
- ```bash
141
- # Build first in ../media-plugin-bin
142
- cd ../media-plugin-bin
143
- mkdir -p dist
144
- go build -trimpath -o dist/mediaio .
145
-
146
- # Return to this repository, skip postinstall, and place the local binary
147
- cd ../media-plugin-cli
148
- npm install --ignore-scripts
149
- mkdir -p vendor
150
- cp ../media-plugin-bin/dist/mediaio vendor/mediaio
151
- chmod +x vendor/mediaio
152
-
153
- node bin/mediaio.js --help
154
- node bin/mi.js --help
155
- node bin/mediaio.js generate list
156
- ```
157
-
158
- On Windows, copy `mediaio.exe` instead:
159
-
160
- ```powershell
161
- New-Item -ItemType Directory -Force vendor
162
- Copy-Item ..\media-plugin-bin\dist\mediaio.exe vendor\mediaio.exe
163
- node bin\mediaio.js --help
164
- ```
165
-
166
- ## Release
167
-
168
- The npm package and Go binary currently use the same version number and must be
169
- released together.
170
-
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.
176
-
177
- ```bash
178
- npm pack --dry-run
179
- npm pack
180
- npm publish --access public
181
- ```
182
-
183
- After release, validate in a clean environment:
184
-
185
- ```bash
186
- npm install -g @mediaio/cli@<version>
21
+ mediaio generate create text2image_gpt_image_2 --prompt "a cat in a spaceship"
187
22
  mediaio --help
188
23
  ```
189
24
 
190
- The initial v2 binary matrix is:
25
+ The package registers a single command: `mediaio`.
191
26
 
192
- ```text
193
- darwin/amd64
194
- darwin/arm64
195
- linux/amd64
196
- linux/arm64
197
- windows/amd64
198
- ```
199
-
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:
27
+ ## Agent plugins
203
28
 
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.
29
+ The Codex and Claude Code plugins in
30
+ [media-io/plugin](https://github.com/media-io/plugin) drive this CLI. Install
31
+ and sign in to the CLI first; the plugin never installs or repairs it for you.
207
32
 
208
33
  ## Troubleshooting
209
34
 
210
- ### Binary Missing
211
-
212
- If you see `binary not found at .../vendor/mediaio`, `postinstall` did not run
213
- or failed.
35
+ `binary not found at .../vendor/mediaio` means postinstall did not run:
214
36
 
215
37
  ```bash
216
38
  npm uninstall -g @mediaio/cli
217
39
  npm install -g @mediaio/cli
218
40
  ```
219
41
 
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.
223
-
224
- ### Download Returns 404
225
-
226
- Check that all three of the following match exactly:
227
-
228
- - `package.json.version`
229
- - GitHub release tag `v<version>`
230
- - asset name `mediaio_<version>_<os>_<arch>.tar.gz`
231
-
232
- ### Extraction Fails
233
-
234
- Make sure the system provides `tar`, and make sure the archive root directly
235
- contains `mediaio` or `mediaio.exe`.
236
-
237
- ### Unsupported Platform
238
-
239
- The current installer recognizes only:
240
-
241
- ```text
242
- darwin | linux | windows
243
- amd64 | arm64
244
- ```
42
+ Note that `npm install --ignore-scripts` skips the binary download.
245
43
 
246
- Any other `process.platform` or `process.arch` reported by Node causes the
247
- installation to fail immediately.
44
+ ## Links
248
45
 
249
- ## Current Implementation vs. v2 Target
46
+ - Product: <https://www.media.io/ai/home>
47
+ - Releases: <https://github.com/media-io/cli/releases>
48
+ - Terms of Service: <https://www.media.io/terms-of-service.html>
49
+ - Privacy Policy: <https://www.media.io/privacy.html>
250
50
 
251
- | Area | Current Implementation | v2 Target |
252
- |---|---|---|
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 |
51
+ ## License
261
52
 
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.
53
+ MIT see [LICENSE](LICENSE).
package/package.json CHANGED
@@ -1,10 +1,9 @@
1
1
  {
2
2
  "name": "@mediaio/cli",
3
- "version": "0.5.0-ci.136",
3
+ "version": "0.5.1",
4
4
  "description": "Media.io AI CLI — generate images and videos from the terminal.",
5
5
  "bin": {
6
- "mediaio": "bin/mediaio.js",
7
- "mi": "bin/mi.js"
6
+ "mediaio": "bin/mediaio.js"
8
7
  },
9
8
  "scripts": {
10
9
  "postinstall": "node install.js"
@@ -12,13 +11,14 @@
12
11
  "files": [
13
12
  "bin/",
14
13
  "install.js",
14
+ "LICENSE",
15
15
  "README.md"
16
16
  ],
17
17
  "engines": {
18
18
  "node": ">=14"
19
19
  },
20
20
  "license": "MIT",
21
- "homepage": "https://media.io",
21
+ "homepage": "https://www.media.io",
22
22
  "repository": {
23
23
  "type": "git",
24
24
  "url": "git+https://github.com/media-io/cli.git"
package/bin/mi.js DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- require("./run.js")();