@remixmate/cli 0.9.21 → 0.9.22

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 CHANGED
@@ -11,32 +11,32 @@ AI media generation skills for Claude Code / Codex.
11
11
  ## Install
12
12
 
13
13
  ```bash
14
- npm install -g @remixmate/cli
15
- remixmate --help
16
- remixmate --list
14
+ npm install -g @remixmate/cli && remixmate install
17
15
  ```
18
16
 
19
- ## Use in Claude Code
20
-
21
- Copy the bundled `skills/` into your project-level or global `.claude/skills/` directory and Claude Code will pick them up:
17
+ `npm install` gives you the `remixmate` binary. `remixmate install` is what makes an
18
+ agent *discover* the skills on its own: it copies the bundled `skills/` into every
19
+ agent home it finds Claude Code (`~/.claude/skills`) and Codex (`$CODEX_HOME/skills`,
20
+ default `~/.codex/skills`), which share the same `SKILL.md` format. Restart the agent
21
+ afterwards.
22
22
 
23
23
  ```bash
24
- # project-level
25
- mkdir -p .claude/skills
26
- cp -R "$(npm root -g)/@remixmate/cli/skills/." .claude/skills/
27
-
28
- # or global
29
- mkdir -p ~/.claude/skills
30
- cp -R "$(npm root -g)/@remixmate/cli/skills/." ~/.claude/skills/
24
+ remixmate install --host codex # only one host
25
+ remixmate install --project # ./.claude/skills (Claude Code only)
26
+ remixmate install --dir <path> # explicit target
27
+ remixmate uninstall # remove exactly what was installed
31
28
  ```
32
29
 
33
- ## Use in Codex
34
-
35
- Codex does not load `SKILL.md` natively. Tell Codex about the CLI in your system prompt and let it invoke `remixmate <skill> ...` when it needs media generation:
36
-
37
- > When you need AI media generation (image / video / voice / talking-head / Jianying export), prefer running `remixmate <skill-id> --help` first to discover the flags, then `remixmate <skill-id> --json-output ...` to execute. Available skills: `remixmate --list`.
30
+ The install is *managed*, not a `cp -R`: each skills directory gets a
31
+ `.remixmate-install.json` receipt recording the version and the skill list. That is
32
+ what lets a re-run upgrade in place, lets `uninstall` remove only our own directories,
33
+ and lets `remixmate doctor` warn when a global `npm update` has left the installed
34
+ copies behind. A same-named skill that this CLI did not install is never overwritten
35
+ without `--force`.
38
36
 
39
- See the full intro page (Claude Code / Codex setup, env vars, end-to-end workflow examples) at the project homepage.
37
+ Without installing, the CLI still works you just have to name it (`remixmate --list`,
38
+ or tell the agent to run `remixmate <skill> --help`). The agent will not reach for it
39
+ unprompted.
40
40
 
41
41
  ## Authentication
42
42
 
package/README.zh-CN.md CHANGED
@@ -11,32 +11,28 @@
11
11
  ## 安装
12
12
 
13
13
  ```bash
14
- npm install -g @remixmate/cli
15
- remixmate --help
16
- remixmate --list
14
+ npm install -g @remixmate/cli && remixmate install
17
15
  ```
18
16
 
19
- ## Claude Code 中使用
20
-
21
- 把内置的 `skills/` 拷贝到项目级或全局的 `.claude/skills/` 目录,Claude Code 会自动识别:
17
+ `npm install` 装的是 `remixmate` 这个命令;`remixmate install` 才让 agent **自己发现**
18
+ 这些 skill —— 它把内置的 `skills/` 铺进检测到的每个 agent 目录:Claude Code
19
+ (`~/.claude/skills`)与 Codex(`$CODEX_HOME/skills`,默认 `~/.codex/skills`),两者
20
+ 用的是同一套 `SKILL.md` 格式。装完重启 agent 生效。
22
21
 
23
22
  ```bash
24
- # 项目级
25
- mkdir -p .claude/skills
26
- cp -R "$(npm root -g)/@remixmate/cli/skills/." .claude/skills/
27
-
28
- # 或全局
29
- mkdir -p ~/.claude/skills
30
- cp -R "$(npm root -g)/@remixmate/cli/skills/." ~/.claude/skills/
23
+ remixmate install --host codex # 只装某一个宿主
24
+ remixmate install --project # 装到 ./.claude/skills(仅 Claude Code)
25
+ remixmate install --dir <path> # 指定目录
26
+ remixmate uninstall # 按装机记录精确卸载
31
27
  ```
32
28
 
33
- ## Codex 中使用
34
-
35
- Codex 不会原生加载 `SKILL.md`。在系统提示里告诉 Codex 这个 CLI,让它在需要媒体生成时调用 `remixmate <skill> ...`:
36
-
37
- > 当你需要 AI 媒体生成(图片 / 视频 / 语音 / 数字人 / 剪映导出)时,先运行 `remixmate <skill-id> --help` 查看参数,再用 `remixmate <skill-id> --json-output ...` 执行。可用技能:`remixmate --list`。
29
+ 这里的安装是**受管**的,不是 `cp -R`:每个 skills 目录下会写一份
30
+ `.remixmate-install.json` 回执,记录版本与本次铺下去的 skill 名单。靠它,重跑即原地升级、
31
+ `uninstall` 只删自己装的目录、`remixmate doctor` 能在 `npm update -g` 之后提示铺出去的副本
32
+ 已经落后。同名但不是本 CLI 装的 skill,不加 `--force` 绝不覆盖。
38
33
 
39
- 完整介绍页(Claude Code / Codex 配置、环境变量、端到端工作流示例)见项目主页。
34
+ 不装也能用,只是得点名(`remixmate --list`,或让 agent 去跑 `remixmate <skill> --help`);
35
+ agent 不会主动想到它。
40
36
 
41
37
  ## 认证
42
38
 
package/dist/cli.js CHANGED
@@ -16,6 +16,7 @@ import { parseArgv } from './argv.js';
16
16
  import { runSkill } from './runner.js';
17
17
  import { runAuthCommand } from './auth/commands.js';
18
18
  import { HOST_VERB, PROJECT_VERB, runHostCommand, runProjectCommand } from './project/commands.js';
19
+ import { INSTALL_VERB, UNINSTALL_VERB, runInstall, runUninstall } from './install.js';
19
20
  import { runExec } from './exec.js';
20
21
  import { authStatusLine, runDoctor } from './doctor.js';
21
22
  import { padDisplay } from './text.js';
@@ -51,6 +52,8 @@ function printUsage() {
51
52
  const skills = loadSkills(resolveBaseDir());
52
53
  process.stdout.write('Usage:\n');
53
54
  process.stdout.write(' remixmate --list List all skills\n');
55
+ process.stdout.write(' remixmate install [--host <h>] Install the skills into Claude Code / Codex\n');
56
+ process.stdout.write(' remixmate uninstall Remove skills installed by this CLI\n');
54
57
  process.stdout.write(' remixmate doctor Diagnose environment, credentials, backend\n');
55
58
  process.stdout.write(' remixmate login Authorize this CLI via the browser\n');
56
59
  process.stdout.write(' remixmate login --start | --wait Non-blocking authorization (for agent hosts)\n');
@@ -128,6 +131,14 @@ async function main() {
128
131
  await printAuthFooter();
129
132
  process.exit(EXIT.OK);
130
133
  }
134
+ // Host-install verbs, like the auth verbs, resolve before skill dispatch so a
135
+ // future skill named `install` could never shadow them.
136
+ if (argv[0] === INSTALL_VERB) {
137
+ process.exit(runInstall(argv.slice(1)));
138
+ }
139
+ if (argv[0] === UNINSTALL_VERB) {
140
+ process.exit(runUninstall(argv.slice(1)));
141
+ }
131
142
  if (argv[0] === 'doctor') {
132
143
  const code = await runDoctor({ skipNetwork: argv.includes('--offline') });
133
144
  process.exit(code);
package/dist/doctor.js CHANGED
@@ -20,6 +20,7 @@ import { listCredentials } from './auth/credential-store.js';
20
20
  import { resolveTakeKey } from './project/host.js';
21
21
  import { readBinding } from './project/store.js';
22
22
  import { canAutoAuth, isHeadless } from './auth/environment.js';
23
+ import { installStates } from './install.js';
23
24
  import { padDisplay } from './text.js';
24
25
  /**
25
26
  * Short auth status suitable for a footer. Never performs network I/O — a
@@ -100,6 +101,22 @@ export async function runDoctor(opts = {}) {
100
101
  detail: playwright ?? '当前解释器下未安装 —— 仅 web-screenshot / web-record 需要,首次运行会自动装',
101
102
  });
102
103
  checks.push({ name: '后端地址', status: 'ok', detail: apiBaseUrl });
104
+ // 宿主安装状态。这套方案唯一的静默失败模式是漂移:`npm update -g` 只动包,不动
105
+ // 已经铺进 ~/.claude/skills、~/.codex/skills 的副本,用户会拿着旧 SKILL.md 打新
106
+ // 后端,而且第一个症状往往是某个参数「莫名其妙不认」。
107
+ for (const s of installStates()) {
108
+ checks.push({
109
+ // 只取宿主名的第一段(Claude Code → Claude)——检查名要留在 padDisplay 的
110
+ // 对齐宽度内,宿主目录已经写在 detail 里,不会有歧义。
111
+ name: `${s.label.split(' ')[0]} skill`,
112
+ status: s.installedVersion == null ? 'warn' : s.drifted ? 'warn' : 'ok',
113
+ detail: s.installedVersion == null
114
+ ? `未安装 —— 该 agent 不会自动发现这些 skill(remixmate install 可安装到 ${s.skillsDir})`
115
+ : s.drifted
116
+ ? `已装 ${s.installedVersion},当前包 ${s.currentVersion} → 运行 remixmate install 覆盖`
117
+ : `${s.installedVersion}(${s.skillsDir})`,
118
+ });
119
+ }
103
120
  // Where will this machine's renders land, and will repeated renders group?
104
121
  // Both were previously invisible — the first sign of trouble was a finished
105
122
  // video that appeared nowhere in the web app.
@@ -0,0 +1,57 @@
1
+ /**
2
+ * `remixmate install` / `remixmate uninstall` — 把包内 skills/ 铺进 agent 宿主。
3
+ *
4
+ * 为什么需要一条命令,而不是让站点给出 `cp -R "$(npm root -g)/…/skills/." ~/.claude/skills/`:
5
+ *
6
+ * 1. 目标已经不止一个。Claude Code 与 Codex 现在用同一套 SKILL.md 格式
7
+ * (Codex 装到 $CODEX_HOME/skills/<name>),手工 cp 的心智成本直接翻倍。
8
+ * 2. 拷贝出去的副本没有主人。`npm update -g` 之后包升了级、副本停在旧版;
9
+ * `npm uninstall -g` 之后副本原地变成孤儿。两种都是静默的 —— 本项目作者机器上
10
+ * 就留着一批 5 月建的、指向早已不存在路径的 skill 目录,没有任何东西负责清理。
11
+ *
12
+ * 所以这里的安装是**受管**的:每个宿主的 skills 目录下写一份装机回执
13
+ * (.remixmate-install.json),记下版本、来源与这次铺下去的 skill 名单。升级照名单
14
+ * 覆盖、卸载照名单删除、doctor 照名单比对版本 —— 三件事都不靠猜目录里哪些是我们的。
15
+ *
16
+ * 刻意不做的两件事:
17
+ * - 不挂 npm postinstall。`npm i -g` 时往 ~/.claude、~/.codex 写东西太越界,
18
+ * 且 `--ignore-scripts` 下会静默失效。安装必须是用户显式发起的动作。
19
+ * - 不用软链。指向 $(npm root -g) 看着优雅,但 node 版本管理器一切换路径就变,
20
+ * 全部断掉且极难排查。拷贝 + 回执 + doctor 漂移检查更稳。
21
+ */
22
+ export declare const INSTALL_VERB = "install";
23
+ export declare const UNINSTALL_VERB = "uninstall";
24
+ export type HostId = 'claude' | 'codex';
25
+ interface Host {
26
+ id: HostId | 'custom';
27
+ label: string;
28
+ /** skill 的父目录 —— 安装写到 <skillsDir>/<skill-name>/。 */
29
+ skillsDir: string;
30
+ }
31
+ /**
32
+ * 检测「这台机器上用了哪些 agent」。判据是配置根目录存在,而不是 skills/ 存在 ——
33
+ * 从没装过 skill 的用户 skills/ 本来就没有,那恰恰是最需要装的人。
34
+ */
35
+ export declare function detectHosts(): Host[];
36
+ export declare function installUsage(): void;
37
+ export declare function uninstallUsage(): void;
38
+ export declare function runInstall(argv: string[]): number;
39
+ export declare function runUninstall(argv: string[]): number;
40
+ export interface InstallState {
41
+ label: string;
42
+ skillsDir: string;
43
+ /** 回执里的版本;null = 该宿主下没有本 CLI 的安装。 */
44
+ installedVersion: string | null;
45
+ /** 当前包的版本,供报告直接引用。 */
46
+ currentVersion: string;
47
+ /** 回执版本与当前包版本不一致。 */
48
+ drifted: boolean;
49
+ }
50
+ /**
51
+ * 供 doctor 使用:每个宿主的安装状态。
52
+ *
53
+ * 漂移是这套方案唯一的静默失败模式 —— `npm update -g` 只动包,不动铺出去的副本,
54
+ * 用户会拿着旧 SKILL.md 打新后端。doctor 是「为什么跑不起来」的统一入口,检查放这里。
55
+ */
56
+ export declare function installStates(): InstallState[];
57
+ export {};
@@ -0,0 +1,292 @@
1
+ /**
2
+ * `remixmate install` / `remixmate uninstall` — 把包内 skills/ 铺进 agent 宿主。
3
+ *
4
+ * 为什么需要一条命令,而不是让站点给出 `cp -R "$(npm root -g)/…/skills/." ~/.claude/skills/`:
5
+ *
6
+ * 1. 目标已经不止一个。Claude Code 与 Codex 现在用同一套 SKILL.md 格式
7
+ * (Codex 装到 $CODEX_HOME/skills/<name>),手工 cp 的心智成本直接翻倍。
8
+ * 2. 拷贝出去的副本没有主人。`npm update -g` 之后包升了级、副本停在旧版;
9
+ * `npm uninstall -g` 之后副本原地变成孤儿。两种都是静默的 —— 本项目作者机器上
10
+ * 就留着一批 5 月建的、指向早已不存在路径的 skill 目录,没有任何东西负责清理。
11
+ *
12
+ * 所以这里的安装是**受管**的:每个宿主的 skills 目录下写一份装机回执
13
+ * (.remixmate-install.json),记下版本、来源与这次铺下去的 skill 名单。升级照名单
14
+ * 覆盖、卸载照名单删除、doctor 照名单比对版本 —— 三件事都不靠猜目录里哪些是我们的。
15
+ *
16
+ * 刻意不做的两件事:
17
+ * - 不挂 npm postinstall。`npm i -g` 时往 ~/.claude、~/.codex 写东西太越界,
18
+ * 且 `--ignore-scripts` 下会静默失效。安装必须是用户显式发起的动作。
19
+ * - 不用软链。指向 $(npm root -g) 看着优雅,但 node 版本管理器一切换路径就变,
20
+ * 全部断掉且极难排查。拷贝 + 回执 + doctor 漂移检查更稳。
21
+ */
22
+ import { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
23
+ import os from 'node:os';
24
+ import path from 'node:path';
25
+ import { fileURLToPath } from 'node:url';
26
+ import { SKILLS_DIR } from './registry.js';
27
+ import { EXIT } from './errors.js';
28
+ import { padDisplay } from './text.js';
29
+ export const INSTALL_VERB = 'install';
30
+ export const UNINSTALL_VERB = 'uninstall';
31
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
32
+ const PKG_ROOT = path.resolve(__dirname, '..');
33
+ /** 装机回执。升级 / 卸载 / 漂移检查都只认它。 */
34
+ const RECEIPT = '.remixmate-install.json';
35
+ const PACKAGE_NAME = '@remixmate/cli';
36
+ /**
37
+ * 宿主的配置根目录。两个 agent 都允许用环境变量改位置,检测必须跟着走 ——
38
+ * 否则把 CODEX_HOME 指到别处的用户会看到「未检测到 Codex」。
39
+ */
40
+ function hostHome(id) {
41
+ return id === 'claude'
42
+ ? process.env.CLAUDE_CONFIG_DIR || path.join(os.homedir(), '.claude')
43
+ : process.env.CODEX_HOME || path.join(os.homedir(), '.codex');
44
+ }
45
+ const HOST_LABEL = {
46
+ claude: 'Claude Code',
47
+ codex: 'Codex',
48
+ };
49
+ function hostOf(id) {
50
+ return { id, label: HOST_LABEL[id], skillsDir: path.join(hostHome(id), 'skills') };
51
+ }
52
+ /**
53
+ * 检测「这台机器上用了哪些 agent」。判据是配置根目录存在,而不是 skills/ 存在 ——
54
+ * 从没装过 skill 的用户 skills/ 本来就没有,那恰恰是最需要装的人。
55
+ */
56
+ export function detectHosts() {
57
+ return ['claude', 'codex'].filter((id) => existsSync(hostHome(id))).map(hostOf);
58
+ }
59
+ function packageVersion() {
60
+ try {
61
+ const raw = readFileSync(path.join(PKG_ROOT, 'package.json'), 'utf-8');
62
+ return JSON.parse(raw).version ?? 'unknown';
63
+ }
64
+ catch {
65
+ return 'unknown';
66
+ }
67
+ }
68
+ /**
69
+ * 包内可安装的 skill 名单。
70
+ *
71
+ * 用 SKILLS_DIR 而不是 resolveBaseDir():install 铺的永远是**本包自带**的那份,
72
+ * SKILL_BASE_DIR 是给 ab-agent 之类宿主在运行期改 skill 树用的,不该改变安装来源。
73
+ */
74
+ function bundledSkills() {
75
+ if (!existsSync(SKILLS_DIR))
76
+ return [];
77
+ return readdirSync(SKILLS_DIR, { withFileTypes: true })
78
+ .filter((e) => e.isDirectory() && existsSync(path.join(SKILLS_DIR, e.name, 'SKILL.md')))
79
+ .map((e) => e.name)
80
+ .sort();
81
+ }
82
+ function readReceipt(skillsDir) {
83
+ const file = path.join(skillsDir, RECEIPT);
84
+ if (!existsSync(file))
85
+ return null;
86
+ try {
87
+ return JSON.parse(readFileSync(file, 'utf-8'));
88
+ }
89
+ catch {
90
+ // 回执损坏时按「没装过」处理:那样只会退化成需要 --force,而不是把用户的目录删错。
91
+ return null;
92
+ }
93
+ }
94
+ function parseArgs(argv, verb) {
95
+ const out = { hosts: [], force: false, help: false };
96
+ const picked = [];
97
+ let dir = '';
98
+ let project = false;
99
+ for (let i = 0; i < argv.length; i++) {
100
+ const a = argv[i];
101
+ const eq = a.indexOf('=');
102
+ const key = eq > 0 ? a.slice(0, eq) : a;
103
+ const inline = eq > 0 ? a.slice(eq + 1) : null;
104
+ const next = () => inline ?? argv[++i] ?? '';
105
+ switch (key) {
106
+ case '--host': {
107
+ const v = next();
108
+ if (v === 'all')
109
+ picked.push('claude', 'codex');
110
+ else if (v === 'claude' || v === 'codex')
111
+ picked.push(v);
112
+ else {
113
+ out.unknown = `--host ${v}`;
114
+ return out;
115
+ }
116
+ break;
117
+ }
118
+ case '--dir':
119
+ dir = next();
120
+ break;
121
+ case '--project':
122
+ project = true;
123
+ break;
124
+ case '--force':
125
+ out.force = true;
126
+ break;
127
+ case '-h':
128
+ case '--help':
129
+ out.help = true;
130
+ return out;
131
+ default:
132
+ out.unknown = a;
133
+ return out;
134
+ }
135
+ }
136
+ if (dir) {
137
+ out.hosts = [{ id: 'custom', label: '自定义目录', skillsDir: path.resolve(dir) }];
138
+ }
139
+ else if (project) {
140
+ // 只有 Claude Code 有项目级 skill 目录。Codex 的官方安装位置只有
141
+ // $CODEX_HOME/skills(见其内置 skill-installer),没有项目级约定,不臆造一个。
142
+ out.hosts = [{ id: 'claude', label: 'Claude Code(项目级)', skillsDir: path.join(process.cwd(), '.claude', 'skills') }];
143
+ }
144
+ else if (picked.length > 0) {
145
+ out.hosts = [...new Set(picked)].map(hostOf);
146
+ }
147
+ else {
148
+ out.hosts = verb === UNINSTALL_VERB ? ['claude', 'codex'].map(hostOf) : detectHosts();
149
+ }
150
+ return out;
151
+ }
152
+ export function installUsage() {
153
+ process.stdout.write('Usage: remixmate install [options]\n' +
154
+ '\n' +
155
+ '把本包自带的 skill 装进已检测到的 agent 宿主,让它们能自动发现这些能力\n' +
156
+ '(Claude Code: ~/.claude/skills,Codex: ~/.codex/skills)。重复运行即升级。\n' +
157
+ '\n' +
158
+ 'Options:\n' +
159
+ ' --host <claude|codex|all> 只装指定宿主(默认:装到所有检测到的宿主)\n' +
160
+ ' --project 装到当前目录 ./.claude/skills(仅 Claude Code)\n' +
161
+ ' --dir <path> 自定义 skills 父目录(覆盖上面两者)\n' +
162
+ ' --force 覆盖同名的、非本 CLI 安装的 skill 目录\n');
163
+ }
164
+ export function uninstallUsage() {
165
+ process.stdout.write('Usage: remixmate uninstall [options]\n' +
166
+ '\n' +
167
+ '按装机回执删除本 CLI 装过的 skill —— 只删回执里列出的目录,不碰其它 skill。\n' +
168
+ '\n' +
169
+ 'Options:\n' +
170
+ ' --host <claude|codex|all> 只卸载指定宿主(默认:两个宿主都查)\n' +
171
+ ' --project 卸载当前目录 ./.claude/skills 下的安装\n' +
172
+ ' --dir <path> 自定义 skills 父目录\n');
173
+ }
174
+ function installInto(host, names, version, force) {
175
+ const prev = readReceipt(host.skillsDir);
176
+ const owned = new Set(prev?.skills ?? []);
177
+ // 目录已存在、又不在上一次的回执里 —— 那是别人的 skill(同名很容易撞:gen-image
178
+ // 这种名字一点也不独特)。默认拒绝而不是覆盖,让用户显式 --force。
179
+ const conflicts = names.filter((n) => existsSync(path.join(host.skillsDir, n)) && !owned.has(n));
180
+ if (conflicts.length > 0 && !force) {
181
+ return (`${host.skillsDir} 下已存在同名目录,且不是本 CLI 装的:${conflicts.join('、')}\n` +
182
+ ' 确认可以覆盖后加 --force 重跑。');
183
+ }
184
+ mkdirSync(host.skillsDir, { recursive: true });
185
+ // 上一版装过、这一版没有了的 skill(上游改名或下线)要一并清掉,否则宿主会一直
186
+ // 加载一个已经没有后端支撑的 SKILL.md。
187
+ for (const stale of owned) {
188
+ if (!names.includes(stale))
189
+ rmSync(path.join(host.skillsDir, stale), { recursive: true, force: true });
190
+ }
191
+ for (const name of names) {
192
+ const dest = path.join(host.skillsDir, name);
193
+ // 先删再拷:直接覆盖会把上一版多出来的文件留在原地,攒出一个既非旧版也非新版的目录。
194
+ rmSync(dest, { recursive: true, force: true });
195
+ cpSync(path.join(SKILLS_DIR, name), dest, { recursive: true });
196
+ }
197
+ const receipt = {
198
+ package: PACKAGE_NAME,
199
+ version,
200
+ installedAt: new Date().toISOString(),
201
+ source: SKILLS_DIR,
202
+ skills: names,
203
+ };
204
+ writeFileSync(path.join(host.skillsDir, RECEIPT), JSON.stringify(receipt, null, 2) + '\n', 'utf-8');
205
+ return null;
206
+ }
207
+ export function runInstall(argv) {
208
+ const opts = parseArgs(argv, INSTALL_VERB);
209
+ if (opts.help) {
210
+ installUsage();
211
+ return EXIT.OK;
212
+ }
213
+ if (opts.unknown) {
214
+ process.stderr.write(`❌ 未知参数: ${opts.unknown}\n`);
215
+ installUsage();
216
+ return EXIT.USAGE;
217
+ }
218
+ const names = bundledSkills();
219
+ if (names.length === 0) {
220
+ process.stderr.write(`❌ 包内没有可安装的 skill(${SKILLS_DIR})\n`);
221
+ return EXIT.ERROR;
222
+ }
223
+ if (opts.hosts.length === 0) {
224
+ process.stderr.write('❌ 没有检测到任何 agent 宿主。找过这两个位置:\n' +
225
+ ` Claude Code ${hostHome('claude')}\n` +
226
+ ` Codex ${hostHome('codex')}\n` +
227
+ ' 先把 agent 装好再重跑,或用 --dir <path> 指定目录。\n');
228
+ return EXIT.USAGE;
229
+ }
230
+ const version = packageVersion();
231
+ let failures = 0;
232
+ for (const host of opts.hosts) {
233
+ const err = installInto(host, names, version, opts.force);
234
+ if (err) {
235
+ failures += 1;
236
+ process.stderr.write(`❌ ${padDisplay(host.label, 16)}${err}\n`);
237
+ continue;
238
+ }
239
+ process.stdout.write(`✅ ${padDisplay(host.label, 16)}${host.skillsDir}(${names.length} 个 skill,${version})\n`);
240
+ }
241
+ if (failures > 0)
242
+ return EXIT.ERROR;
243
+ process.stdout.write('\n重启 agent 后即可生效。升级后重跑 remixmate install 覆盖即可。\n');
244
+ return EXIT.OK;
245
+ }
246
+ export function runUninstall(argv) {
247
+ const opts = parseArgs(argv, UNINSTALL_VERB);
248
+ if (opts.help) {
249
+ uninstallUsage();
250
+ return EXIT.OK;
251
+ }
252
+ if (opts.unknown) {
253
+ process.stderr.write(`❌ 未知参数: ${opts.unknown}\n`);
254
+ uninstallUsage();
255
+ return EXIT.USAGE;
256
+ }
257
+ let removed = 0;
258
+ for (const host of opts.hosts) {
259
+ const receipt = readReceipt(host.skillsDir);
260
+ if (!receipt)
261
+ continue;
262
+ for (const name of receipt.skills) {
263
+ rmSync(path.join(host.skillsDir, name), { recursive: true, force: true });
264
+ }
265
+ rmSync(path.join(host.skillsDir, RECEIPT), { force: true });
266
+ removed += 1;
267
+ process.stdout.write(`✅ ${padDisplay(host.label, 16)}已移除 ${receipt.skills.length} 个 skill(${host.skillsDir})\n`);
268
+ }
269
+ if (removed === 0) {
270
+ process.stdout.write('没有找到本 CLI 的装机记录,无需卸载。\n');
271
+ }
272
+ return EXIT.OK;
273
+ }
274
+ /**
275
+ * 供 doctor 使用:每个宿主的安装状态。
276
+ *
277
+ * 漂移是这套方案唯一的静默失败模式 —— `npm update -g` 只动包,不动铺出去的副本,
278
+ * 用户会拿着旧 SKILL.md 打新后端。doctor 是「为什么跑不起来」的统一入口,检查放这里。
279
+ */
280
+ export function installStates() {
281
+ const current = packageVersion();
282
+ return detectHosts().map((h) => {
283
+ const receipt = readReceipt(h.skillsDir);
284
+ return {
285
+ label: h.label,
286
+ skillsDir: h.skillsDir,
287
+ installedVersion: receipt?.version ?? null,
288
+ currentVersion: current,
289
+ drifted: receipt != null && receipt.version !== current,
290
+ };
291
+ });
292
+ }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "version": "0.9.21",
4
- "generatedAt": "2026-09-05T08:18:35.420Z",
3
+ "version": "0.9.22",
4
+ "generatedAt": "2026-09-06T10:24:59.463Z",
5
5
  "skills": [
6
6
  {
7
7
  "id": "export-jianying",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remixmate/cli",
3
- "version": "0.9.21",
3
+ "version": "0.9.22",
4
4
  "description": "AI media generation skills for Claude Code / Codex — 12 skills covering image, video, voice, digital human, web screenshot, web recording, script, template registry, rendering, Jianying export, and video deconstruction.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",