wmstudio-cli 0.2.2 → 0.2.4
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/CHANGELOG.md +12 -0
- package/README.md +96 -188
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -1,231 +1,139 @@
|
|
|
1
|
-
#
|
|
1
|
+
# wmstudio-cli
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
> Generate images, videos, brand campaigns, and 3D assets from your terminal.
|
|
3
|
+
Command-line client for [WM Studio](https://wmstudio.io). Generate images, videos, brand campaigns, and 3D assets — and inspect your jobs and credits — straight from your terminal.
|
|
5
4
|
|
|
6
|
-
```
|
|
7
|
-
npm i -g
|
|
5
|
+
```bash
|
|
6
|
+
npm i -g wmstudio-cli
|
|
8
7
|
wm login
|
|
9
|
-
wm gen image "
|
|
10
|
-
wm gen video "slow dolly-in on the mug, golden hour" -i ./mug.png -o ad.mp4
|
|
11
|
-
wm campaign "premium oat milk launch, Scandinavian minimal" --variations 3
|
|
8
|
+
wm gen image "studio portrait of a husky, cinematic lighting"
|
|
12
9
|
```
|
|
13
10
|
|
|
14
|
-
|
|
11
|
+
---
|
|
15
12
|
|
|
16
|
-
|
|
17
|
-
`~/wm/wm-cli/` and will be moved to its own GitHub repo (`PrincipeRosso/wm-cli`)
|
|
18
|
-
before the first npm release. No `pnpm install` has been run yet — that's the
|
|
19
|
-
first action a maintainer takes when they pick this up.
|
|
13
|
+
## Install
|
|
20
14
|
|
|
21
|
-
|
|
15
|
+
Requires Node.js **20.10+**.
|
|
22
16
|
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
```bash
|
|
18
|
+
# global (recommended)
|
|
19
|
+
npm i -g wmstudio-cli
|
|
25
20
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
| `wmstudio` | TS/Next | Web app + REST API |
|
|
29
|
-
| `director-cut` | Python | Desktop backend + embedded MCP |
|
|
30
|
-
| `mcp-director` | Python | Hosted Streamable HTTP MCP |
|
|
31
|
-
| **`wm-cli`** | **TS** | **`wm` CLI on npm** |
|
|
21
|
+
# or per-project
|
|
22
|
+
npm i -D wmstudio-cli
|
|
32
23
|
|
|
33
|
-
|
|
34
|
-
|
|
24
|
+
# one-off, no install
|
|
25
|
+
npx wmstudio-cli --help
|
|
26
|
+
```
|
|
35
27
|
|
|
36
|
-
|
|
28
|
+
Verify:
|
|
37
29
|
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
│ wm (CLI) │ ───────────────────────▶ │ wmstudio REST API │
|
|
41
|
-
└──────────────┘ over HTTPS / undici └──────────────────┘
|
|
42
|
-
▲
|
|
43
|
-
│ same endpoints
|
|
44
|
-
│
|
|
45
|
-
┌──────────────────┐
|
|
46
|
-
│ mcp-director │
|
|
47
|
-
└──────────────────┘
|
|
30
|
+
```bash
|
|
31
|
+
wm --version
|
|
48
32
|
```
|
|
49
33
|
|
|
50
|
-
|
|
51
|
-
protocol — there's no reason for a short-lived terminal process to negotiate
|
|
52
|
-
Streamable HTTP + OAuth PKCE when an API key works fine.
|
|
53
|
-
|
|
54
|
-
## Tech stack
|
|
55
|
-
|
|
56
|
-
| Concern | Pick | Why |
|
|
57
|
-
| -------------- | --------------------------------- | -------------------------------------------------- |
|
|
58
|
-
| Language | TypeScript 5.6, strict, ESM | Reuse `wmstudio` types later via a published pkg |
|
|
59
|
-
| CLI framework | `commander` | Small, fast cold start, mature |
|
|
60
|
-
| Prompts | `@inquirer/prompts` | Modular, tree-shakeable, async/await native |
|
|
61
|
-
| HTTP | `undici` | Built-in to Node 20+, fastest, AbortController |
|
|
62
|
-
| Schema | `zod` | Same lib `wmstudio` already uses |
|
|
63
|
-
| Bundler | `tsup` | Single ESM bundle, fast, zero config drift |
|
|
64
|
-
| Lint | ESLint v9 flat + `typescript-eslint` | Type-aware rules |
|
|
65
|
-
| Format | Prettier | Matches `wmstudio` house style |
|
|
66
|
-
| Tests | Vitest + `msw` | Same runner as `wmstudio`; MSW for HTTP fixtures |
|
|
67
|
-
| Release | Changesets + GitHub Actions | One source of truth for versions + npm publish |
|
|
68
|
-
| Node target | 20 LTS | `.nvmrc` pinned |
|
|
34
|
+
## Authenticate
|
|
69
35
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
| Command | What it does |
|
|
73
|
-
| ---------------------- | -------------------------------------------------------------- |
|
|
74
|
-
| `wm login` | Save your API key to `~/.wm/config.json` (chmod 0600) |
|
|
75
|
-
| `wm whoami` | Show account + remaining credits |
|
|
76
|
-
| `wm gen image <prompt>`| Text-to-image / image-to-image. `-o` to download. |
|
|
77
|
-
| `wm gen video <prompt>`| Text-to-video / image-to-video. Polls until done. |
|
|
78
|
-
| `wm upscale <url>` | Topaz upscale 1–4× |
|
|
79
|
-
| `wm campaign <brief>` | Full director_* pipeline. `--variations N` for parallel runs. |
|
|
80
|
-
| `wm jobs list` | Recent generation jobs |
|
|
81
|
-
| `wm jobs get <id>` | Single job status |
|
|
82
|
-
|
|
83
|
-
Global flags: `--api-url`, `--api-key`, `--json`, `-v / --version`, `--help`.
|
|
84
|
-
|
|
85
|
-
## Auth precedence
|
|
86
|
-
|
|
87
|
-
1. `--api-key` flag
|
|
88
|
-
2. `WM_API_KEY` env var
|
|
89
|
-
3. `~/.wm/config.json` (written by `wm login`)
|
|
90
|
-
4. _(none → exits with `auth_required`, code 10)_
|
|
91
|
-
|
|
92
|
-
## Exit codes
|
|
93
|
-
|
|
94
|
-
Stable contract, mirrored across `wm-cli` and `mcp-director`. See
|
|
95
|
-
[`docs/CONVENTIONS.md`](./docs/CONVENTIONS.md) §3.
|
|
96
|
-
|
|
97
|
-
| Code | Meaning |
|
|
98
|
-
| ---- | ------------------- |
|
|
99
|
-
| 0 | OK |
|
|
100
|
-
| 2 | Usage error |
|
|
101
|
-
| 10 | Not logged in |
|
|
102
|
-
| 11 | Invalid API key |
|
|
103
|
-
| 20 | Asset URL required |
|
|
104
|
-
| 30 | Upgrade required |
|
|
105
|
-
| 31 | Rate limited |
|
|
106
|
-
| 40 | Network error |
|
|
107
|
-
| 50 | Server error |
|
|
108
|
-
| 51 | Timeout |
|
|
109
|
-
| 99 | Unexpected crash |
|
|
110
|
-
|
|
111
|
-
## First-time setup (when you pick this up)
|
|
36
|
+
Create an API key in your dashboard at <https://wmstudio.io/dashboard/api-keys>, then:
|
|
112
37
|
|
|
113
38
|
```bash
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
corepack enable # ensures pnpm 9 is available
|
|
117
|
-
pnpm install # this is what resolves all the "Cannot find module" lints
|
|
118
|
-
pnpm typecheck
|
|
119
|
-
pnpm test
|
|
120
|
-
pnpm build
|
|
121
|
-
node dist/index.js --help
|
|
39
|
+
wm login # interactive — paste the key when prompted
|
|
40
|
+
wm whoami # prints account email + credit balance
|
|
122
41
|
```
|
|
123
42
|
|
|
124
|
-
|
|
43
|
+
Credentials are stored in `~/.wm/config.json` (chmod `600`). To sign out:
|
|
125
44
|
|
|
126
45
|
```bash
|
|
127
|
-
|
|
46
|
+
wm logout
|
|
128
47
|
```
|
|
129
48
|
|
|
130
|
-
|
|
49
|
+
You can also pass a key per-call without saving it:
|
|
131
50
|
|
|
132
|
-
```
|
|
133
|
-
wm-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
│ ├── cli.ts commander root, registers subcommands
|
|
137
|
-
│ ├── client.ts WmApiClient — thin undici-based HTTP layer
|
|
138
|
-
│ ├── config.ts ~/.wm/config.json + env merge
|
|
139
|
-
│ ├── constants.ts Defaults, env var names, model ids
|
|
140
|
-
│ ├── errors.ts WmCliError + exit code map
|
|
141
|
-
│ ├── logger.ts Pretty + JSON structured logger
|
|
142
|
-
│ ├── util/
|
|
143
|
-
│ │ ├── download.ts Stream URL → file
|
|
144
|
-
│ │ └── poll.ts Generic async-job poller
|
|
145
|
-
│ └── commands/
|
|
146
|
-
│ ├── _shared.ts Ctx, requireAuth, renderResult
|
|
147
|
-
│ ├── login.ts
|
|
148
|
-
│ ├── whoami.ts
|
|
149
|
-
│ ├── gen.ts image + video subcommands
|
|
150
|
-
│ ├── upscale.ts
|
|
151
|
-
│ ├── campaign.ts director_* pipeline
|
|
152
|
-
│ └── jobs.ts
|
|
153
|
-
├── test/ Vitest + MSW
|
|
154
|
-
├── docs/
|
|
155
|
-
│ └── CONVENTIONS.md ← cross-repo contract (sync to other repos)
|
|
156
|
-
├── .changeset/ Changesets config + per-PR notes
|
|
157
|
-
├── .github/workflows/ CI + release pipelines
|
|
158
|
-
├── tsup.config.ts
|
|
159
|
-
├── vitest.config.ts
|
|
160
|
-
├── eslint.config.js
|
|
161
|
-
├── tsconfig.json
|
|
162
|
-
├── package.json
|
|
163
|
-
├── .env.example
|
|
164
|
-
├── .editorconfig ← shared across all wm-* repos
|
|
165
|
-
├── .nvmrc 20.18.0
|
|
166
|
-
├── LICENSE MIT
|
|
167
|
-
└── CHANGELOG.md
|
|
51
|
+
```bash
|
|
52
|
+
wm --api-key wm_live_xxx whoami
|
|
53
|
+
# or
|
|
54
|
+
WM_API_KEY=wm_live_xxx wm whoami
|
|
168
55
|
```
|
|
169
56
|
|
|
170
|
-
##
|
|
57
|
+
## Commands
|
|
171
58
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
59
|
+
| Command | What it does |
|
|
60
|
+
|---|---|
|
|
61
|
+
| `wm login` | Save an API key for this machine |
|
|
62
|
+
| `wm logout` | Remove saved credentials |
|
|
63
|
+
| `wm whoami` | Show account email + credits remaining |
|
|
64
|
+
| `wm gen image <prompt>` | Generate an image |
|
|
65
|
+
| `wm gen video <prompt>` | Generate a video |
|
|
66
|
+
| `wm upscale <image>` | Upscale an image (URL or local file) |
|
|
67
|
+
| `wm campaign <brief>` | Run a multi-asset brand campaign |
|
|
68
|
+
| `wm jobs list` | List your recent generation jobs |
|
|
69
|
+
| `wm jobs get <id>` | Show details for a single job |
|
|
181
70
|
|
|
182
|
-
|
|
183
|
-
is purely a `mv` + `git init`.
|
|
71
|
+
Run `wm <command> --help` for full flags.
|
|
184
72
|
|
|
73
|
+
## Examples
|
|
185
74
|
|
|
186
|
-
## Commands
|
|
187
75
|
```bash
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
76
|
+
# Image — pick a model and aspect ratio, save the result locally
|
|
77
|
+
wm gen image "neon cyberpunk alley, rain, dramatic lighting" \
|
|
78
|
+
--model flux-pro --aspect 16:9 --out ./out/
|
|
79
|
+
|
|
80
|
+
# Video — 5 second clip from a text prompt
|
|
81
|
+
wm gen video "drone shot flying over snowy mountain peaks at sunrise" \
|
|
82
|
+
--duration 5 --out ./videos/
|
|
83
|
+
|
|
84
|
+
# Upscale a local file 4x
|
|
85
|
+
wm upscale ./photo.jpg --scale 4 --out ./upscaled/
|
|
86
|
+
|
|
87
|
+
# Brand campaign from a single brief
|
|
88
|
+
wm campaign "Launch teaser for an artisanal coffee brand called Brava" \
|
|
89
|
+
--out ./campaigns/brava/
|
|
90
|
+
|
|
91
|
+
# Inspect jobs
|
|
92
|
+
wm jobs list --limit 10
|
|
93
|
+
wm jobs get gen_01HZX...
|
|
94
|
+
|
|
95
|
+
# Machine-readable output for scripting
|
|
96
|
+
wm --json jobs list --limit 5 | jq '.[] | .id'
|
|
197
97
|
```
|
|
198
98
|
|
|
99
|
+
## Global flags
|
|
100
|
+
|
|
101
|
+
| Flag | Env var | Notes |
|
|
102
|
+
|---|---|---|
|
|
103
|
+
| `--api-key <key>` | `WM_API_KEY` | Overrides saved credentials |
|
|
104
|
+
| `--api-url <url>` | `WMSTUDIO_API_URL` | Point at a different deployment (default `https://wmstudio.io/api`) |
|
|
105
|
+
| `--json` | — | Emit JSON instead of formatted text |
|
|
106
|
+
| `-v, --version` | — | Print CLI version |
|
|
107
|
+
|
|
108
|
+
## Where things live
|
|
199
109
|
|
|
110
|
+
- **Config:** `~/.wm/config.json` — API key + base URL. Per-OS-user, never shared.
|
|
111
|
+
- **Outputs:** wherever you point `--out`, default is the current directory.
|
|
112
|
+
- **Logs:** stderr. Use `--json` for parseable stdout in scripts.
|
|
113
|
+
|
|
114
|
+
To test as a fresh user without touching your real session:
|
|
200
115
|
|
|
201
|
-
## Commands to run for pushing. anew version
|
|
202
116
|
```bash
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
pnpm changeset version # bumps version + CHANGELOG
|
|
207
|
-
git commit -am "chore: release"
|
|
208
|
-
pnpm publish --access public
|
|
117
|
+
HOME=/tmp/wm-fresh wm login
|
|
118
|
+
HOME=/tmp/wm-fresh wm whoami
|
|
119
|
+
rm -rf /tmp/wm-fresh
|
|
209
120
|
```
|
|
210
121
|
|
|
122
|
+
## Troubleshooting
|
|
211
123
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
npm
|
|
124
|
+
- **`401 Unauthorized`** — key is missing, revoked, or expired. Run `wm login` again.
|
|
125
|
+
- **`402 Insufficient credits`** — top up at <https://wmstudio.io/dashboard/billing>.
|
|
126
|
+
- **Job stuck in `queued`** — the CLI polls automatically; if it times out, fetch later with `wm jobs get <id>`.
|
|
127
|
+
- **`command not found: wm`** — your global `node_modules/.bin` isn't in `$PATH`. Run `npm prefix -g` and add `<prefix>/bin` to `$PATH`.
|
|
216
128
|
|
|
217
|
-
|
|
218
|
-
wm --version
|
|
129
|
+
## Links
|
|
219
130
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
131
|
+
- Website: <https://wmstudio.io>
|
|
132
|
+
- Docs: <https://wmstudio.io/docs/cli>
|
|
133
|
+
- Dashboard: <https://wmstudio.io/dashboard>
|
|
134
|
+
- API keys: <https://wmstudio.io/dashboard/api-keys>
|
|
135
|
+
- Issues: <https://github.com/PrincipeRosso/wm-cli/issues>
|
|
223
136
|
|
|
224
|
-
|
|
225
|
-
wm login # paste the sk_live_... token
|
|
137
|
+
## License
|
|
226
138
|
|
|
227
|
-
|
|
228
|
-
wm whoami
|
|
229
|
-
wm gen image "a single red apple" -o apple.png
|
|
230
|
-
file apple.png # → PNG image data
|
|
231
|
-
```
|
|
139
|
+
MIT © WM Studio
|
package/package.json
CHANGED