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.
Files changed (3) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +96 -188
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @wmstudio/cli
2
2
 
3
+ ## 0.2.4
4
+
5
+ ### Patch Changes
6
+
7
+ - Cleaned up README
8
+
9
+ ## 0.2.3
10
+
11
+ ### Patch Changes
12
+
13
+ - Rename
14
+
3
15
  ## 0.2.2
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -1,231 +1,139 @@
1
- # @wmstudio/cli — `wm`
1
+ # wmstudio-cli
2
2
 
3
- > The official command-line client for the WM Studio creative platform.
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 @wmstudio/cli
5
+ ```bash
6
+ npm i -g wmstudio-cli
8
7
  wm login
9
- wm gen image "minimalist black ceramic mug, soft daylight" -o mug.png
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
- ## Status
11
+ ---
15
12
 
16
- 🚧 **0.1.0 — pre-publish scaffold.** This repo currently lives at
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
- ## Why a separate repo?
15
+ Requires Node.js **20.10+**.
22
16
 
23
- Same reason `mcp-director` and `director-cut` are their own repos:
24
- **one responsibility, one runtime, one release pipeline**.
17
+ ```bash
18
+ # global (recommended)
19
+ npm i -g wmstudio-cli
25
20
 
26
- | Repo | Runtime | What it does |
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
- See [`docs/CONVENTIONS.md`](./docs/CONVENTIONS.md) for the cross-repo contract
34
- (env vars, error codes, default models, REST endpoints, logging shape).
24
+ # one-off, no install
25
+ npx wmstudio-cli --help
26
+ ```
35
27
 
36
- ## Architecture
28
+ Verify:
37
29
 
38
- ```
39
- ┌──────────────┐ API key ┌──────────────────┐
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
- The CLI is a thin, dependency-light HTTP client. It does **not** speak the MCP
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
- ## Commands
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
- cd ~/wm/wm-cli # or wherever you moved it
115
- nvm use # honours .nvmrc Node 20
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
- To run the dev binary against a local `wmstudio`:
43
+ Credentials are stored in `~/.wm/config.json` (chmod `600`). To sign out:
125
44
 
126
45
  ```bash
127
- WMSTUDIO_API_URL=http://localhost:3000/api WM_API_KEY=dev-key node dist/index.js whoami
46
+ wm logout
128
47
  ```
129
48
 
130
- ## Project layout
49
+ You can also pass a key per-call without saving it:
131
50
 
132
- ```
133
- wm-cli/
134
- ├── src/
135
- │ ├── index.ts Entrypoint (shebang banner via tsup)
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
- ## Moving this repo
57
+ ## Commands
171
58
 
172
- ```bash
173
- mv ~/wm/wm-cli /path/to/new/parent/wm-cli
174
- cd /path/to/new/parent/wm-cli
175
- git init -b main
176
- git add .
177
- git commit -m "chore: import initial scaffold"
178
- git remote add origin git@github.com:PrincipeRosso/wm-cli.git
179
- git push -u origin main
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
- Nothing in this scaffold references its on-disk parent directory, so the move
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
- cd ~/wm/wm-cli
189
- nvm use && corepack enable
190
- pnpm install
191
- pnpm typecheck # ❶ resolves every "Cannot find module" lint
192
- pnpm lint # rules pass
193
- pnpm test # vitest: config + client (msw) unit tests go green
194
- pnpm build # single ESM bundle in dist/index.js
195
- node dist/index.js --help # ❺ commander prints the usage
196
- node dist/index.js --version
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
- cd ~/wm/wm-cli
204
- git commit -am "feat: <whatever>" # your code change
205
- pnpm changeset # pick patch/minor/major + summary
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
- ## Commands for testing on my machine the deployed
213
- ```bash
214
- # Install once, anywhere on macOS / Linux / Windows
215
- npm i -g @jessip2323/wm-cli
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
- # Confirm
218
- wm --version
129
+ ## Links
219
130
 
220
- # Get an API key from your dashboard
221
- open https://wmstudio.io/en/dashboard/api-keys
222
- # (or http://localhost:3000/en/dashboard/api-keys for local)
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
- # Log in
225
- wm login # paste the sk_live_... token
137
+ ## License
226
138
 
227
- # First call
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wmstudio-cli",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "Command-line client for the WM Studio creative platform. Generates images, videos, brand campaigns, and 3D assets from your terminal.",
5
5
  "type": "module",
6
6
  "bin": {