@oiioii/cli 0.1.0 → 0.1.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/README.md +107 -28
  2. package/dist/cli.js +1155 -448
  3. package/package.json +17 -10
  4. package/dist/cli.js.map +0 -1
package/README.md CHANGED
@@ -13,7 +13,8 @@ human-readable output and a stable JSON envelope for AI agents and automation.
13
13
  | Command | Capability | Status |
14
14
  |---|---|---|
15
15
  | `auth login` | Persist API Key and backend configuration | Implemented |
16
- | `workspace create/set/current` | Create, configure, and inspect workspaces | Implemented |
16
+ | `workspace create/set/current/rename` | Create, configure, inspect, and rename workspaces | Implemented |
17
+ | `workspace assets list/download` | List workspace assets and download ready resources | Implemented |
17
18
  | `image text` | Text-to-image generation | Implemented |
18
19
  | `image edit` | Image-to-image editing | Implemented |
19
20
  | `video text` | Text-to-video generation | Implemented |
@@ -24,7 +25,7 @@ human-readable output and a stable JSON envelope for AI agents and automation.
24
25
  | `record get/open` | Query generation metadata and download resources | Implemented |
25
26
  | `inspect capabilities/models` | Inspect declared capabilities and live backend models | Implemented |
26
27
  | `preview latest/bundle` | Read local preview bundles created by generation commands | Implemented |
27
- | `task list/status/wait` | Inspect and wait for local generation tasks | Implemented |
28
+ | `task list/status/wait/retry` | Inspect, wait for, and safely retry local generation tasks | Implemented |
28
29
  | `logs list/export/path` | Inspect and export structured local logs | Implemented |
29
30
  | `points balance/quote/cost` | Inspect balance, estimate a request, and query actual charges | Implemented |
30
31
 
@@ -34,19 +35,21 @@ Important current limitations:
34
35
  - Generation submits `submit_async_media_generation` and returns immediately with the authoritative backend `task_id` plus a `local_task_id`.
35
36
  - The backend task ID, workspace, media type, asset ID, progress, and terminal outputs are cached in the owner-only local task store.
36
37
  - `task status/wait` query `query_async_media_generation` for non-terminal cached tasks and accept either the backend or local task ID.
38
+ - If submission times out or disconnects before the backend task ID is received, the task remains `submitting`; `task retry <local_task_id>` resends the saved request with the original idempotency key.
39
+ - REST metadata requests time out after 30 seconds; raw resource uploads/downloads use a 5-minute transfer timeout, and VOD transcode polling has a 10-minute overall deadline.
37
40
  - Image, video, and audio generation create local preview bundles after a queried task reaches a terminal state.
38
41
  - `inspect capabilities` is local metadata; `inspect models` requires authentication and queries the active backend.
39
- - Asset-library browsing/search/update/delete and style-library commands are not available.
42
+ - Asset search/update/delete and style-library commands are not available. Workspace-scoped asset listing and download are available.
40
43
 
41
44
  ## Requirements
42
45
 
43
- - Node.js 18 or newer when running from source or the npm package.
46
+ - Node.js 18.18 or newer when running from source or the npm package.
44
47
  - An existing Hogi MCP API Key.
45
48
  - A workspace ID for image/video/audio generation and resource upload. It can be
46
49
  created with `oiioii workspace create` or supplied from an existing project.
47
50
  - `npm` is the repository package manager.
48
51
 
49
- The hosted installer uses Node.js 18 or newer when available. If no compatible
52
+ The hosted installer uses Node.js 18.18 or newer when available. If no compatible
50
53
  Node.js/npm installation exists, it downloads an official Node.js runtime,
51
54
  verifies its SHA256, and keeps it under the oiioii installation directory.
52
55
 
@@ -83,21 +86,28 @@ write `install.json`, and create stable `oiioii` / `oiioii-cli` wrappers. CLI
83
86
  updates reuse the exact Node.js, npm, registry, package, and prefix recorded by
84
87
  the installer.
85
88
 
89
+ The maintained production bootstrap sources are `scripts/install.sh` for
90
+ macOS/Linux and `scripts/install.ps1` for Windows. They always follow npm's
91
+ `latest` dist-tag. Set `OIIOII_CLI_VERSION` only when you need one exact stable
92
+ version.
93
+
86
94
  macOS (Apple Silicon and Intel are detected automatically):
87
95
 
88
96
  ```bash
89
- curl -fsSL https://<public-host>/install.sh | bash
97
+ curl -fsSL https://static-oiioii-sg.hogiai.cn/cli/install.sh | bash
90
98
  ```
91
99
 
92
100
  Windows x64, from PowerShell:
93
101
 
94
102
  ```powershell
95
- $script = Join-Path $env:TEMP "install.ps1"; curl.exe -fsSL https://<public-host>/install.ps1 -o $script; powershell.exe -NoProfile -ExecutionPolicy Bypass -File $script; Remove-Item $script
103
+ $script = Join-Path $env:TEMP "install.ps1"; curl.exe -fsSL https://static-oiioii-sg.hogiai.cn/cli/install.ps1 -o $script; powershell.exe -NoProfile -ExecutionPolicy Bypass -File $script; Remove-Item $script
96
104
  ```
97
105
 
98
- Production is the default and follows npm's `latest` dist-tag. For the HOE test
99
- build, set `OIIOII_ENV=test`; it follows the `test` dist-tag and accepts only
100
- prerelease versions. Set `OIIOII_CLI_VERSION` to install one exact version.
106
+ Test builds use `scripts/test/install.sh` and `scripts/test/install.ps1` as
107
+ maintained static-runtime installer templates. The build writes generated
108
+ installers with the runtime MD5 embedded under `scripts/test/dist/`; they verify
109
+ the runtime archive SHA-256 before installing it and do not share the production
110
+ npm installer/update metadata.
101
111
 
102
112
  After bootstrap installation:
103
113
 
@@ -117,11 +127,24 @@ The default backend URL is embedded into the generated bundle at build time.
117
127
 
118
128
  | Build command | Environment | Embedded default backend |
119
129
  |---|---|---|
120
- | `npm run build:production` | production | `https://api.oiioii.ai` |
121
- | `npm run build:test` | test (HOE) | `https://api-hoe.oiioii.tv` |
130
+ | `npm run build:production` | production | `OIIOII_PRODUCTION_BASE_URL` from `.env` |
131
+ | `npm run build:test` | test | `OIIOII_TEST_BASE_URL` from `.env` |
122
132
  | `npm run build:local` | local | `http://localhost:4000` |
123
133
 
124
- `npm run build` builds the test environment to preserve the existing default.
134
+ Copy the environment template once, then use the environment-specific build
135
+ entry points:
136
+
137
+ ```bash
138
+ cp .env.example .env
139
+ npm run build:production
140
+ npm run build:test
141
+ ```
142
+
143
+ `npm run build` is an alias for `build:production`. `build:test:runtime` is a
144
+ separate release path: it builds the test bundle, installs production-only
145
+ dependencies into an isolated staging directory, verifies the embedded URL,
146
+ and writes generated installers plus an MD5-addressed runtime archive and its
147
+ SHA-256 checksum under the ignored `scripts/test/dist/` directory.
125
148
 
126
149
  For a custom deployment, override the embedded URL during the build:
127
150
 
@@ -132,6 +155,11 @@ OIIOII_BUILD_BASE_URL=https://custom.example.com npm run build:production
132
155
  Supported build environment names are exactly `production`, `test`, and
133
156
  `local`. Unknown values fail the build instead of silently selecting a domain.
134
157
 
158
+ Publishing always rebuilds the package during npm's `prepublishOnly` lifecycle.
159
+ Publishing rejects the one-off `OIIOII_BUILD_BASE_URL` override and uses the
160
+ matching environment-specific variable, so an inherited custom URL cannot leak
161
+ into a published package.
162
+
135
163
  The embedded URL is a fallback. Existing runtime overrides remain available:
136
164
 
137
165
  - Root option: `--base-url <url>` for commands that consume the root override.
@@ -140,17 +168,24 @@ The embedded URL is a fallback. Existing runtime overrides remain available:
140
168
 
141
169
  ## Authentication and Workspace
142
170
 
143
- Persist an existing MCP API Key and the backend URL:
171
+ Persist an existing MCP API Key. The CLI keeps the backend URL embedded for its
172
+ build environment unless you explicitly override it:
144
173
 
145
174
  ```bash
146
- oiioii auth login \
147
- --api-key "oii_sk_..." \
148
- --base-url "https://api-hoe.oiioii.tv"
175
+ oiioii auth login --api-key "oii_sk_..."
149
176
  ```
150
177
 
151
- The CLI writes the API Key and Base URL to `~/.oiioii/config.json` with file
152
- permissions `0600`. `OIIOII_API_KEY` remains available as a temporary process
153
- override. A legacy `~/.oiioii/credentials.json` file, if present, is ignored.
178
+ The CLI writes the API Key to `~/.oiioii/config.json` with file permissions
179
+ `0600`. Pass `--base-url` only for an intentional backend override.
180
+ `OIIOII_API_KEY` remains available as a temporary process override. A legacy
181
+ `~/.oiioii/credentials.json` file, if present, is ignored.
182
+
183
+ Remove an existing backend override and return to the default embedded in the
184
+ current CLI build:
185
+
186
+ ```bash
187
+ oiioii auth login --api-key "oii_sk_..." --reset-base-url
188
+ ```
154
189
 
155
190
  Create a workspace using the injected API Key:
156
191
 
@@ -173,6 +208,26 @@ oiioii workspace set <workspace_id> --json
173
208
  oiioii workspace current --json
174
209
  ```
175
210
 
211
+ Rename the active workspace, or pass an explicit workspace ID:
212
+
213
+ ```bash
214
+ oiioii workspace rename --name "Renamed project" --json
215
+ oiioii workspace rename <workspace_id> --name "Renamed project" --json
216
+ ```
217
+
218
+ List assets in the active workspace and download a ready asset by its workspace
219
+ asset ID:
220
+
221
+ ```bash
222
+ oiioii workspace assets list --json
223
+ oiioii workspace assets download <asset_id> --output ./downloads --json
224
+ ```
225
+
226
+ `workspace assets download` accepts either the plain `assetId` or the
227
+ `hogi://asset/<assetId>` identity returned by the list command. It resolves that
228
+ identity to the asset's downloadable `uri`; loading, uploading, empty, failed,
229
+ or URI-less assets fail before the download request.
230
+
176
231
  Workspace resolution order is:
177
232
 
178
233
  1. Root `--workspace <id>` option.
@@ -308,7 +363,7 @@ oiioii audio generate --prompt "为画面生成氛围音" --image hogi://image/<
308
363
  ```
309
364
 
310
365
  Suno supports description mode, custom lyrics/style mode, and instrumental
311
- music. The supported variants are `chirp-v4-5` and `chirp-v5`:
366
+ music. The supported variants are `chirp-v4-5`, `chirp-v5`, and `chirp-v5-5`:
312
367
 
313
368
  ```bash
314
369
  oiioii audio generate --prompt "cinematic orchestral background music" --model suno --instrumental --json
@@ -546,12 +601,25 @@ The public commands accept the cached backend ID or local ID:
546
601
  oiioii task list
547
602
  oiioii task status <task_id>
548
603
  oiioii task wait <task_id> --timeout 300
604
+ oiioii task retry <local_task_id>
549
605
  ```
550
606
 
551
607
  For non-terminal tasks, `status` makes one authenticated backend query and
552
608
  `wait` polls the backend until a terminal state or `TASK_TIMEOUT`. Every query
553
609
  uses the workspace cached with the original submission.
554
610
 
611
+ A network error or timeout before the CLI receives a backend task ID has an
612
+ unknown submission outcome, so the local task remains `submitting` instead of
613
+ being marked `failed`. Run the `retry` command shown in the JSON error. It
614
+ reuses the original local task ID and saved submission request as the
615
+ idempotency key, allowing the backend to return the already-accepted task
616
+ without creating a duplicate generation.
617
+ The task stores only a one-way fingerprint of the submitting API Key; retry is
618
+ refused if the active credential has changed because backend idempotency is
619
+ scoped to the authenticated principal.
620
+ `task wait` fails immediately with `TASK_RETRY_REQUIRED` for this state instead
621
+ of waiting for a backend ID that only an explicit retry can recover.
622
+
555
623
  Existing preview bundles can be read with:
556
624
 
557
625
  ```bash
@@ -623,6 +691,7 @@ Stable error codes include:
623
691
  | `GENERATION_TIMEOUT` | Long-running request timed out |
624
692
  | `RECORD_NOT_FOUND` | Record/resource/bundle not found |
625
693
  | `TASK_NOT_FOUND` | Local task ID not found |
694
+ | `TASK_RETRY_REQUIRED` | Submission outcome is unknown; retry the saved task with its original idempotency key |
626
695
  | `TASK_TIMEOUT` | Local task did not become terminal before the wait deadline |
627
696
  | `QUOTA_EXCEEDED` | Insufficient points, subgroup quota, or backend rate limit exceeded |
628
697
  | `PAYLOAD_TOO_LARGE` | Upload exceeds the backend limit |
@@ -769,7 +838,9 @@ Environment variables:
769
838
  | `OIIOII_BASE_URL` | Override the backend URL at runtime |
770
839
  | `OIIOII_WORKSPACE_ID` | Override the active workspace |
771
840
  | `OIIOII_BUILD_ENV` | Select `production`, `test`, or `local` while building |
772
- | `OIIOII_BUILD_BASE_URL` | Override the URL embedded in a build |
841
+ | `OIIOII_PRODUCTION_BASE_URL` | URL embedded by the production build |
842
+ | `OIIOII_TEST_BASE_URL` | URL embedded by the test build |
843
+ | `OIIOII_BUILD_BASE_URL` | One-off URL override for a local/custom build; rejected by publish preparation |
773
844
  | `OIIOII_API_KEY` | Temporarily override the persisted API Key for the current process |
774
845
  | `OIIOII_E2E` | Explicit opt-in marker for credit-consuming E2E workflows |
775
846
  | `OIIOII_LOG_DISABLED` | Set to `1` to disable local logging, primarily for isolated tests |
@@ -793,13 +864,11 @@ files at present; running the normal test command does not consume GenAI credits
793
864
 
794
865
  Most recent local verification for this README update:
795
866
 
796
- - 45 test files passed.
797
- - 333 tests passed.
867
+ - 54 test files passed.
868
+ - 454 tests passed; 2 Windows-only installer tests were skipped on macOS.
798
869
  - `npm run typecheck` passed.
799
870
  - `npm run lint` passed.
800
- - Production, HOE test, and local builds passed; their embedded backend
801
- URLs were verified as `api.oiioii.ai`, `api-hoe.oiioii.tv`, and
802
- `localhost:4000` respectively.
871
+ - Production, injected test, and local build configuration passed.
803
872
 
804
873
  ## Project Structure
805
874
 
@@ -825,7 +894,17 @@ oiioii-cli/
825
894
  tests/
826
895
  unit/ Unit tests
827
896
  cli/ CLI subprocess integration tests
828
- .plan/release/ Standalone installer workflow/assets
897
+ scripts/
898
+ build-environment.mjs Loads environment-specific build configuration
899
+ build-test-runtime.mjs Creates the independent test static runtime
900
+ install.sh Production macOS/Linux npm installer
901
+ install.ps1 Production Windows npm installer
902
+ test/
903
+ install.sh Test macOS/Linux installer template
904
+ install.ps1 Test Windows installer template
905
+ dist/ Ignored generated installers and MD5 runtime
906
+ prepare-publish.mjs Environment-aware npm publish preparation
907
+ verify-release-version.mjs Release channel/version validation
829
908
  tsup.config.ts Environment-aware ESM bundling
830
909
  package.json
831
910
  ```