@302ai/media-studio-cli 0.1.0-beta.4 → 0.1.0-beta.6

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/README.md +97 -28
  2. package/dist/index.js +14150 -11652
  3. package/package.json +8 -4
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @302ai/media-studio-cli
2
2
 
3
- CLI for [AI Media Studio](https://302.ai) — drive media-studio chat from any
3
+ CLI for AI Media Studio — drive media-studio chat from any
4
4
  terminal or external agent.
5
5
 
6
6
  ## Install
@@ -17,11 +17,11 @@ npm install -g @302ai/media-studio-cli@beta
17
17
  ```
18
18
 
19
19
  > **No stable release exists yet.** `latest` points at a prerelease, so both
20
- > commands above currently install the same build. Staging-server visibility is
21
- > gated on the package *version* carrying a prerelease tag — not on the
22
- > dist-tag — so it is on for both: **Staging** appears in `msc login` and in
23
- > `--region` whichever way you install. A future stable release will hide it
24
- > from both channels.
20
+ > commands above currently install the same build. Staging- and Local-server
21
+ > visibility is gated on the package *version* carrying a prerelease tag — not
22
+ > on the dist-tag — so both are on for either install: **Staging** and
23
+ > **Local** appear in `msc login` and in `--region` whichever way you install.
24
+ > A future stable release will hide them from both channels.
25
25
 
26
26
  > If you installed via **bun** and get `command not found`: bun's global bin
27
27
  > dir is not on PATH by default. Run once:
@@ -33,14 +33,18 @@ npm install -g @302ai/media-studio-cli@beta
33
33
  ## Usage
34
34
 
35
35
  ```bash
36
- media-studio-cli login # authenticate against a media-studio server
37
- media-studio-cli whoami # show current auth status
38
- media-studio-cli chat "hi" # one-shot chat turn
39
- media-studio-cli sessions # list sessions from server
40
- media-studio-cli logout # clear stored credentials
36
+ msc login # authenticate in a browser
37
+ msc guide # the full agent-facing manual
38
+ msc whoami # show current auth status
39
+ msc chat "hi" # one chat turn (multi-turn by default)
40
+ msc sessions # list sessions from the server
41
+ msc skills # list the skill catalog you can reference
42
+ msc logout # clear stored credentials
41
43
  ```
42
44
 
43
- `msc` is the short alias for `media-studio-cli` (same program, both installed):
45
+ `media-studio-cli` is the long alias for `msc` — the same program, both
46
+ installed. The docs, the help output, and every error message use the short
47
+ name:
44
48
 
45
49
  ```bash
46
50
  msc chat "画一只猫" -r # -r/--show-reasoning = 展示模型推理过程
@@ -50,9 +54,24 @@ msc sessions # 列出所有会话(标记当前默认 `(curren
50
54
  msc sessions --json # 机器可读的原始 JSON 数组
51
55
  msc sessions use <id> # 纯本地切换默认会话(零请求、不校验)
52
56
  msc sessions rm <id> # 删除服务端会话(交互确认,或加 -y/--yes 跳过)
57
+ msc skills # 列出技能库(--plaza 浏览技能广场)
58
+ msc skills add <slug> # 从广场安装技能(如 brainstorming,见 --plaza --json 的 slug)
59
+ msc skills rm <command> # 从技能库移除(-y/--yes 跳过确认)
60
+ msc skills enable <command> # 启用 / disable 停用
53
61
  msc --help # all flags
54
62
  ```
55
63
 
64
+ `msc --help` carries an agent-oriented quickstart — the auth prerequisite, the
65
+ three canonical calls, and the `--json` contract. `msc guide` prints the full
66
+ manual: every command, both JSON schemas, the `nextStep` values, exit codes,
67
+ stream discipline, and skill semantics. Point an agent at those two instead of
68
+ duplicating them here.
69
+
70
+ Headless environments cannot complete browser sign-in, so `msc login` refuses
71
+ immediately instead of waiting out the callback deadline: CI (`CI` set), and
72
+ Linux with neither `DISPLAY` nor `WAYLAND_DISPLAY`. Sign in from a machine
73
+ whose browser can reach the loopback callback.
74
+
56
75
  ### Multi-turn conversation
57
76
 
58
77
  `chat` is multi-turn by default — no flag needed. The CLI keeps a single
@@ -77,13 +96,60 @@ msc chat "记住数字42"
77
96
  msc chat "刚才的数字是几?" # answers 42
78
97
  ```
79
98
 
80
- Point at a different server via `MEDIA_STUDIO_API_URL` env var, or
81
- `msc login --region local|cn|default` (the server you log into is saved and
82
- reused).
99
+ Point at a different server via `msc login --region default|cn|local` (the
100
+ server you log into is saved and reused; `local` — like `staging` — is a
101
+ prerelease-only region, see the note at the top).
102
+
103
+ ### Configuration and storage
104
+
105
+ The CLI stores credentials and local settings in:
106
+ - **Default**: `~/.config/media-studio-cli/`
107
+ - **XDG standard**: `$XDG_CONFIG_HOME/media-studio-cli/`
108
+ - **Override**: `MEDIA_STUDIO_CONFIG_DIR=/path/to/dir`
109
+
110
+ Key files:
111
+ - `auth.json`: stores active platform credentials and user session metadata (permissions `0600`)
112
+ - `config.json`: stores CLI client settings, including `lastSessionId` pointer
83
113
 
84
114
  ### Skills
85
115
 
86
- Reference a skill in the prompt and the CLI installs it into the session
116
+ Discover what your account can reference, then reference it — the reference
117
+ must name a skill that exists in your catalog:
118
+
119
+ ```bash
120
+ msc skills # list your library
121
+ msc skills --json # raw catalog array (see fields below)
122
+ msc skills --plaza # browse the Skill Plaza with your library
123
+ # state merged in (built-ins excluded)
124
+ msc skills --plaza --json
125
+
126
+ msc skills add <slug> # install a plaza entry by slug
127
+ msc skills rm <command> # remove a library skill by command
128
+ msc skills enable <command> # flip a library skill's enabled flag
129
+ msc skills disable <command>
130
+ ```
131
+
132
+ `add` takes the entry's plaza slug (`brainstorming`, shown in
133
+ `msc skills --plaza --json` as `slug`); the library mutations take the
134
+ command string (`brainstorming` and `/brainstorming` are the same entry) —
135
+ the same string the prompt uses to reference the skill.
136
+
137
+ `--json` is the intended output for agents: the catalog is the input to a
138
+ decision the calling program makes itself. Both `descriptionEn`/`descriptionZh`
139
+ are passed through untouched — upstream does not guarantee the `En` slot is
140
+ English, so the CLI picks nothing. The human rendering lists names only (the
141
+ command string is available in `--json`) with the full `descriptionEn` on a
142
+ second line, and marks `[on]` enabled / `[off]` disabled / `[-]` not installed
143
+ in the plaza view.
144
+
145
+ **Shared API endpoints**: mutations use the exact same endpoints as the web app
146
+ (`POST /api/skills` for installs, `DELETE /api/skills?skillId=` for removal,
147
+ `POST /api/skills/enabled` for enable/disable). The CLI resolves the slug/command
148
+ to the entry/id before calling the endpoint. `rm` requires `--yes` outside a
149
+ terminal. Built-in entries are rejected (422): they sync into your library from
150
+ the backend. Managing skills (upload, cover) stays in the Media Studio web app.
151
+
152
+ Then reference a skill in the prompt and the CLI installs it into the session
87
153
  sandbox on demand:
88
154
 
89
155
  ```bash
@@ -98,10 +164,12 @@ alone triggers nothing.
98
164
 
99
165
  - A **bare `/command` counts only at the start of the prompt**, so mid-sentence
100
166
  slashes stay prose (`check /etc/hosts` is not a skill reference). The `%%…%%`
101
- marker works anywhere. The leading token can be any bare slug, single-segment
102
- included — `/tmp what is this` resolves `/tmp` — and a reference that matches
103
- nothing fails the turn with the catalog listed, so a typo never silently
104
- degrades to a skill-less answer.
167
+ marker is also recognized anywhere — a web prompt pasted verbatim keeps its
168
+ token — but the skill **activates upstream only when the marker leads the
169
+ message**, so lead the prompt with it. The leading token can be any bare slug,
170
+ single-segment included — `/tmp what is this` resolves `/tmp` — and a
171
+ reference that matches nothing fails the turn with the catalog listed, so a
172
+ typo never silently degrades to a skill-less answer.
105
173
  - The catalog is fetched **only when the prompt references a skill**; skill-free
106
174
  turns cost no extra request.
107
175
  - Unknown skills fail the turn with a non-zero exit before any session is
@@ -119,12 +187,13 @@ CLI skips TLS certificate verification **only while pointed at the staging
119
187
  host**; the server choice itself is the opt-in, and the default / CN hosts
120
188
  always verify. The interactive `msc login` region list shows each server's
121
189
  URL and marks Staging with the auto-off behavior; `msc login --region
122
- staging` and `MEDIA_STUDIO_API_URL=https://media.tool302.com` behave the
123
- same.
190
+ staging` opts in.
124
191
 
125
- Stable (production) builds hide Staging from the `msc login` region menu, but
126
- a persisted staging `auth.json` still auto-bypasses TLS verification — this is
127
- intentional (the login persists across upgrades), not an oversight.
192
+ Stable (production) builds hide Staging and Local from the `msc login` region
193
+ menu and `--region`, but a persisted `auth.json` from a prerelease login keeps
194
+ pointing at that server — and a staging one still auto-bypasses TLS
195
+ verification. This is intentional (the login persists across upgrades), not an
196
+ oversight.
128
197
 
129
198
  The whitelist is the only way the bypass turns on — no environment variable can
130
199
  extend it to another server, so production can never skip verification. To
@@ -219,7 +288,7 @@ bun remove -g @302ai/media-studio-cli
219
288
  bun run dev
220
289
 
221
290
  # terminal 2:
222
- msc login # browser SSO, or: msc login <JWT>
291
+ msc login # browser sign-in
223
292
  msc whoami # verify auth state
224
293
  msc chat "画一只猫" -r # real streaming turn
225
294
  msc chat "hi" --json
@@ -235,8 +304,8 @@ msc sessions use <id> # switch default pointer locally
235
304
  msc sessions rm <id> -y # delete session upstream (-y skips prompt)
236
305
  ```
237
306
 
238
- Without the local server, point at production:
239
- `MEDIA_STUDIO_API_URL=https://media.302.ai`.
307
+ Without the local server, point at production with
308
+ `msc login --region default`.
240
309
 
241
310
  ### Notes learned the hard way
242
311