@302ai/media-studio-cli 0.1.0-beta.3 → 0.1.0-beta.5
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/README.md +123 -23
- package/dist/index.js +9911 -8861
- package/package.json +6 -4
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @302ai/media-studio-cli
|
|
2
2
|
|
|
3
|
-
CLI for
|
|
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-
|
|
21
|
-
> gated on the package *version* carrying a prerelease tag — not
|
|
22
|
-
> dist-tag — so
|
|
23
|
-
> `--region` whichever way you install.
|
|
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
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
-
`
|
|
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,9 +96,89 @@ msc chat "记住数字42"
|
|
|
77
96
|
msc chat "刚才的数字是几?" # answers 42
|
|
78
97
|
```
|
|
79
98
|
|
|
80
|
-
Point at a different server via `
|
|
81
|
-
|
|
82
|
-
|
|
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
|
|
113
|
+
|
|
114
|
+
### Skills
|
|
115
|
+
|
|
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
|
|
153
|
+
sandbox on demand:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
msc chat "/always-hello 不管我说什么" # leading slash command
|
|
157
|
+
msc chat "%%/always-hello%%不管我说什么" # web composer marker, paste-compatible
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Both spellings resolve to the same thing. The upstream installs a skill only
|
|
161
|
+
from the turn's `skill_urls` field, so the CLI looks the reference up in your
|
|
162
|
+
catalog (`GET /api/skills`) and sends the matching package URL — prompt text
|
|
163
|
+
alone triggers nothing.
|
|
164
|
+
|
|
165
|
+
- A **bare `/command` counts only at the start of the prompt**, so mid-sentence
|
|
166
|
+
slashes stay prose (`check /etc/hosts` is not a skill reference). The `%%…%%`
|
|
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.
|
|
173
|
+
- The catalog is fetched **only when the prompt references a skill**; skill-free
|
|
174
|
+
turns cost no extra request.
|
|
175
|
+
- Unknown skills fail the turn with a non-zero exit before any session is
|
|
176
|
+
provisioned. A **disabled** skill is auto-enabled first — the same ADR-0001
|
|
177
|
+
behavior as the web's "Use in Chat" — because the upstream treats `enabled`
|
|
178
|
+
as a hard precondition for invocation and would otherwise download the
|
|
179
|
+
package and silently never run it. The enable flips the skill's `enabled`
|
|
180
|
+
flag on your account (a persistent change), is reported as
|
|
181
|
+
`Auto-enabled for this turn: …`, and a failed enable aborts the turn.
|
|
83
182
|
|
|
84
183
|
### Staging server (expired TLS certificate)
|
|
85
184
|
|
|
@@ -88,12 +187,13 @@ CLI skips TLS certificate verification **only while pointed at the staging
|
|
|
88
187
|
host**; the server choice itself is the opt-in, and the default / CN hosts
|
|
89
188
|
always verify. The interactive `msc login` region list shows each server's
|
|
90
189
|
URL and marks Staging with the auto-off behavior; `msc login --region
|
|
91
|
-
staging`
|
|
92
|
-
same.
|
|
190
|
+
staging` opts in.
|
|
93
191
|
|
|
94
|
-
Stable (production) builds hide Staging from the `msc login` region
|
|
95
|
-
a persisted
|
|
96
|
-
|
|
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.
|
|
97
197
|
|
|
98
198
|
The whitelist is the only way the bypass turns on — no environment variable can
|
|
99
199
|
extend it to another server, so production can never skip verification. To
|
|
@@ -188,7 +288,7 @@ bun remove -g @302ai/media-studio-cli
|
|
|
188
288
|
bun run dev
|
|
189
289
|
|
|
190
290
|
# terminal 2:
|
|
191
|
-
msc login # browser
|
|
291
|
+
msc login # browser sign-in
|
|
192
292
|
msc whoami # verify auth state
|
|
193
293
|
msc chat "画一只猫" -r # real streaming turn
|
|
194
294
|
msc chat "hi" --json
|
|
@@ -204,8 +304,8 @@ msc sessions use <id> # switch default pointer locally
|
|
|
204
304
|
msc sessions rm <id> -y # delete session upstream (-y skips prompt)
|
|
205
305
|
```
|
|
206
306
|
|
|
207
|
-
Without the local server, point at production
|
|
208
|
-
`
|
|
307
|
+
Without the local server, point at production with
|
|
308
|
+
`msc login --region default`.
|
|
209
309
|
|
|
210
310
|
### Notes learned the hard way
|
|
211
311
|
|