@seavideo/cli 0.3.1 → 0.3.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.
Files changed (50) hide show
  1. package/README.md +18 -4
  2. package/README.publish.md +18 -4
  3. package/dist/skills/seavideo-canvas-tools/SKILL.md +323 -0
  4. package/dist/skills/seavideo-command/SKILL.md +213 -0
  5. package/dist/skills/seavideo-prompt-design/SKILL.md +734 -0
  6. package/dist/skills/seavideo-setup/SKILL.md +195 -0
  7. package/dist/skills/seavideo-setup/references/agents/claude-code.md +31 -0
  8. package/dist/skills/seavideo-setup/references/agents/codex.md +28 -0
  9. package/dist/skills/seavideo-setup/references/authentication.md +69 -0
  10. package/dist/skills/seavideo-setup/references/install-skills.md +68 -0
  11. package/dist/skills/seavideo-setup/references/install.md +92 -0
  12. package/dist/skills/seavideo-setup/references/platforms/linux.md +29 -0
  13. package/dist/skills/seavideo-setup/references/platforms/macos.md +31 -0
  14. package/dist/skills/seavideo-setup/references/platforms/windows.md +55 -0
  15. package/dist/skills/seavideo-setup/references/troubleshooting.md +69 -0
  16. package/dist/skills/seavideo-setup/scripts/install-cli.ps1 +109 -0
  17. package/dist/skills/seavideo-setup/scripts/install-cli.sh +89 -0
  18. package/dist/skills/seavideo-setup/scripts/install-skills.mjs +130 -0
  19. package/dist/skills/seavideo-setup/scripts/preflight.ps1 +60 -0
  20. package/dist/skills/seavideo-setup/scripts/preflight.sh +25 -0
  21. package/dist/skills/seavideo-setup/scripts/setup.ps1 +74 -0
  22. package/dist/skills/seavideo-setup/scripts/setup.sh +78 -0
  23. package/dist/skills/seavideo-workflow-draft/SKILL.md +202 -0
  24. package/dist/skills/seavideo-workflow-image/SKILL.md +282 -0
  25. package/dist/skills/seavideo-workflow-video/SKILL.md +351 -0
  26. package/dist/src/agent-skills/agents.js +62 -0
  27. package/dist/src/agent-skills/backup.js +17 -0
  28. package/dist/src/agent-skills/install.js +155 -0
  29. package/dist/src/agent-skills/manifest.js +68 -0
  30. package/dist/src/agent-skills/payload.js +46 -0
  31. package/dist/src/agent-skills/store.js +38 -0
  32. package/dist/src/canvas/browser.js +5 -0
  33. package/dist/src/canvas/launch.js +77 -42
  34. package/dist/src/canvas/lifecycle.js +21 -4
  35. package/dist/src/canvas/puppeteer.js +56 -6
  36. package/dist/src/cli/commands/agent-skills.js +249 -0
  37. package/dist/src/cli/commands/canvas/session.js +3 -1
  38. package/dist/src/cli/main.js +36 -6
  39. package/dist/src/cli/program.js +27 -2
  40. package/dist/src/cli/session.js +2 -0
  41. package/dist/src/config/envs/envs.enc.json +25 -0
  42. package/dist/src/config/envs/envs.json +13 -0
  43. package/dist/src/config/presets.js +47 -13
  44. package/dist/src/config/sops.js +48 -0
  45. package/dist/src/deps.js +8 -1
  46. package/dist/src/i18n.js +88 -4
  47. package/dist/src/update/check-cache.js +0 -1
  48. package/dist/src/update/notify.js +6 -4
  49. package/dist/src/update/passive.js +9 -17
  50. package/package.json +3 -2
@@ -1,8 +1,11 @@
1
1
  import { createPaths } from "../config/paths.js";
2
2
  import { createConfigStore } from "../config/store.js";
3
3
  import { applyDotEnv } from "../config/dotenv.js";
4
- import { buildProgram, presetNamesFor } from "./program.js";
5
- import { checkVersionBeforeCommand, refreshVersionAfterCommand } from "../update/passive.js";
4
+ import { buildProgram, presetNamesFor, VERSION } from "./program.js";
5
+ import { CliError } from "../errors.js";
6
+ import { t } from "../i18n.js";
7
+ import { detectNewerVersion, refreshVersionAfterCommand } from "../update/passive.js";
8
+ import { isBusinessCommand, printNotice, shouldConsiderPassive } from "../update/notify.js";
6
9
  export { buildProgram, VERSION } from "./program.js";
7
10
  export { handleError } from "./output-error.js";
8
11
  export function createContextFactory(deps, entry = 'seavideo') {
@@ -17,6 +20,10 @@ export function createContextFactory(deps, entry = 'seavideo') {
17
20
  };
18
21
  };
19
22
  }
23
+ function topLevelNameOf(actionCommand) {
24
+ const parent = actionCommand.parent;
25
+ return parent.parent === null ? actionCommand.name() : parent.name();
26
+ }
20
27
  export async function main(argv, deps, entry = 'seavideo') {
21
28
  let ctxEnvFlag;
22
29
  const merged = { ...deps, env: await applyDotEnv(deps) };
@@ -33,12 +40,35 @@ export async function main(argv, deps, entry = 'seavideo') {
33
40
  const paths = createPaths(merged);
34
41
  const presetNames = await presetNamesFor(merged, paths);
35
42
  const program = buildProgram(merged, ctxFactory, entry, presetNames);
36
- program.hook('preAction', (thisCommand, actionCommand) => {
43
+ let skipUpdate = false;
44
+ program.hook('preAction', async (thisCommand, actionCommand) => {
37
45
  const globalOpts = thisCommand.opts();
38
- ctxEnvFlag = actionCommand.opts().env ?? globalOpts.env;
46
+ const actionOpts = actionCommand.opts();
47
+ ctxEnvFlag = actionOpts.env ?? globalOpts.env;
48
+ skipUpdate = actionOpts.skipUpdate === true || globalOpts.skipUpdate === true;
49
+ if (skipUpdate) {
50
+ }
51
+ else {
52
+ const newer = await detectNewerVersion(merged, paths);
53
+ if (newer !== null) {
54
+ if (isBusinessCommand(topLevelNameOf(actionCommand))) {
55
+ throw new CliError('unsupported', t('update.blocked', { current: VERSION, latest: newer }, merged.env), { detail: t('update.hint', {}, merged.env) });
56
+ }
57
+ else if (shouldConsiderPassive(merged.env, merged.stderrIsTTY)) {
58
+ printNotice(merged, VERSION, newer);
59
+ }
60
+ else {
61
+ }
62
+ }
63
+ else {
64
+ }
65
+ }
39
66
  });
40
- await checkVersionBeforeCommand(merged, paths);
41
67
  await program.parseAsync(['node', entry, ...argv]);
42
- await refreshVersionAfterCommand(merged, paths);
68
+ if (!skipUpdate) {
69
+ await refreshVersionAfterCommand(merged, paths);
70
+ }
71
+ else {
72
+ }
43
73
  return process.exitCode;
44
74
  }
@@ -15,20 +15,23 @@ import { engineInstallCommand, engineUninstallCommand } from "./commands/engine.
15
15
  import { updateCommand } from "./commands/update.js";
16
16
  import { walletCommand } from "./commands/wallet.js";
17
17
  import { skillListCommand, skillReadCommand } from "./commands/skill.js";
18
- export const VERSION = '0.3.1';
18
+ import { agentSkillsAddCommand, agentSkillsListCommand, agentSkillsRemoveCommand, } from "./commands/agent-skills.js";
19
+ export const VERSION = '0.3.5';
19
20
  export function buildProgram(deps, ctx, entry = 'seavideo', presetNames = []) {
20
21
  const program = new Command();
21
22
  program
22
23
  .name(entry)
23
24
  .description(t(`program.description.${entry}`))
24
25
  .version(VERSION)
25
- .option('--env <name>', t('program.envOption'));
26
+ .option('--env <name>', t('program.envOption'))
27
+ .option('--skip-update', t('program.skipUpdate'));
26
28
  registerIdentity(program, deps, ctx);
27
29
  registerEnv(program, deps, ctx, presetNames);
28
30
  registerConfig(program, deps, ctx);
29
31
  registerCanvas(program, deps, ctx);
30
32
  registerTool(program, deps, ctx);
31
33
  registerSkill(program, deps, ctx);
34
+ registerAgentSkills(program, deps, ctx);
32
35
  program
33
36
  .command('doctor')
34
37
  .description(t('cmd.doctor'))
@@ -237,6 +240,28 @@ function registerTool(program, deps, ctx) {
237
240
  process.exitCode = await runCommand(() => toolCallCommand(ctx(), name, options), deps);
238
241
  });
239
242
  }
243
+ function registerAgentSkills(program, deps, ctx) {
244
+ const agentSkills = program.command('agent-skills').description(t('cmd.agentSkills'));
245
+ const options = (command) => command
246
+ .option('-a, --agent <name...>', t('opt.agent'))
247
+ .option('-g, --global', t('opt.global'))
248
+ .option('--project <path>', t('opt.project'))
249
+ .option('--skills-dir <path>', t('opt.skillsDir'))
250
+ .option('-n, --dry-run', t('opt.dryRun'))
251
+ .option('-f, --force', t('opt.force'))
252
+ .option('-q, --quiet', t('opt.quiet'));
253
+ options(agentSkills.command('add').description(t('cmd.agentSkills.add'))).action(async (opts) => {
254
+ process.exitCode = await runCommand(() => agentSkillsAddCommand(ctx(), opts), deps);
255
+ });
256
+ options(agentSkills.command('remove').description(t('cmd.agentSkills.remove'))).action(async (opts) => {
257
+ process.exitCode = await runCommand(() => agentSkillsRemoveCommand(ctx(), opts), deps);
258
+ });
259
+ options(agentSkills.command('list').description(t('cmd.agentSkills.list')))
260
+ .option('--json', t('opt.json'))
261
+ .action(async (opts) => {
262
+ process.exitCode = await runCommand(() => agentSkillsListCommand(ctx(), opts), deps);
263
+ });
264
+ }
240
265
  function registerSkill(program, deps, ctx) {
241
266
  const skill = program.command('skill').description(t('cmd.skill'));
242
267
  skill
@@ -5,6 +5,7 @@ import { readSessionRecord, sessionFingerprint, touchSessionRecord, } from "../c
5
5
  import { sessionAlive } from "../canvas/daemon.js";
6
6
  import { resolveFlowCredential } from "./credential.js";
7
7
  import { daemonDepsOf } from "../canvas/lifecycle.js";
8
+ import { craftCanvasOf } from "../canvas/browser.js";
8
9
  import { style } from "./output.js";
9
10
  import { t } from "../i18n.js";
10
11
  export async function connectSession(ctx) {
@@ -47,6 +48,7 @@ export async function connectSession(ctx) {
47
48
  });
48
49
  }
49
50
  const browser = connectPuppeteerBrowser({
51
+ craftCanvas: craftCanvasOf(config, record.id),
50
52
  connect: puppeteerConnect,
51
53
  port: record.port,
52
54
  envMap: deps.env,
@@ -0,0 +1,25 @@
1
+ {
2
+ "envs": {
3
+ "cn-dev": {
4
+ "platform": "ENC[AES256_GCM,data:ddw=,iv:C16SedQouP2VAnyDElBDPKcaH/luLkFXKmXaKBf3szI=,tag:TDhZksETLfUfrkCz9Gxeqw==,type:str]",
5
+ "seavideoBaseUrl": "ENC[AES256_GCM,data:SC4Qh/2WG1Zg7rJC4FFsfb2Wgg3bTMQNja9OBpIaJiZZ6VPYBz6Z5uJC5Uqpc8DEpdM=,iv:Obb+44DnvFFjCs5Os5OMkxgLwoDhTufB03ztR6k/bUU=,tag:PfPJttD2y1TFi4mwsg/2fg==,type:str]",
6
+ "flowWebBaseUrl": "ENC[AES256_GCM,data:UWfzTjnksCn8QumishxMaaYnVvuJ+M4qtI3ZtQ==,iv:RmVUySfNqDRJ9tAupQGVo5PCt6q3X8po4N8kaRBLDV4=,tag:3wUjWez4OHOkcgMoJohGBQ==,type:str]",
7
+ "flowApiBaseUrl": "ENC[AES256_GCM,data:bBhLUaUqqRne6HC6Nv/Qgtuni5GB7wRYuUQYFk/22qdEiTsTHe3qE/PJq6NQ,iv:GAmw6ytpQiHw3k+GX4F6yfhM0w64RmM1b7mBfMPxy8Y=,tag:tvK7/owRoQ/VmLTJxL2H5w==,type:str]",
8
+ "aiVideoApiBaseUrl": "ENC[AES256_GCM,data:gSVfGS5iveh1lgDMMOYPmLmvJ8tVo+n6caT0QbdK8riRLFkxLuLBqeQLXQ0=,iv:PtdOi+XbLswND5Bg3WGWjUtOtk1QFiKrlEbbzdmRCPw=,tag:SbnyHQHQG1Llp6uZJqJLGw==,type:str]",
9
+ "authIssuer": "ENC[AES256_GCM,data:HpMKbV+BmSYc8xZyQ3tOGRA9Ae3TQ//9VdRUj7v8G3UyC0A4,iv:MhX/rLrfkvwuYwijknmLs8xuERC6QJ4F45kpznIEj3Y=,tag:6vRPH+i9ikVWYozB+w1+uA==,type:str]",
10
+ "authClientId": "ENC[AES256_GCM,data:EV5WXX/PVF1bTeUGnnJQWw==,iv:9Qn0y/VSrgTZ4tOwUDUZVSlnhXXoIwZMHZhLYcP88LA=,tag:b6oPm9w27aBSmcCGRq4Qag==,type:str]"
11
+ }
12
+ },
13
+ "sops": {
14
+ "age": [
15
+ {
16
+ "enc": "-----BEGIN AGE ENCRYPTED FILE-----\nYWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSB2MUY4OVB2eDVZM25Jd01w\nZXFtbUFyQXMra0JSUDg5Z05MVEZzVjYvK1MwCkpXT3hXdXRudmdnRU1aam94cG1s\nS1Zha055blZXWlNLZU5HbzllWDArbHcKLS0tIFNLU014dTNjY2o0L2lBS1lkUEZn\nQS81MEFwVVRQdkVmcVFrNnVMZU9BTjAK51r9s+kfxoKXy4Q9ZDcLnQNM2yB2PLEm\nClBgYsqLb/IDQbM3Y7BQRDKZZmFh9xrqZ6276FIhj+XwFUeE2rLMkQ==\n-----END AGE ENCRYPTED FILE-----\n",
17
+ "recipient": "age1489m0aw3cke0x5l4u5dyk3j4zvgq4wyksjatsssj4kzz0hevlf3qe9gsre"
18
+ }
19
+ ],
20
+ "lastmodified": "2026-12-04T02:01:42Z",
21
+ "mac": "ENC[AES256_GCM,data:W8k0WBDxas4YeUOuat3lcshU0Yk6pdpeqBK1d9JPBOapBS34vtYVWlLEreJUGgGIu4tnjieUw+JrPnp5d4yGjC9qbxV3y6V60PTiEYvaRoIlXIR2vdqMCrvTKoywop397veWizeR+W4iy4nj+OB3+XBA9YWhAG/FLiRYuBjxPnU=,iv:6XpR/QD5pjwtmOjbMbfKmGqDSgvi9kiyHh5Oj2X5ChI=,tag:b02oORq9CfkIw9vwxMFEjA==,type:str]",
22
+ "unencrypted_suffix": "_unencrypted",
23
+ "version": "3.13.3"
24
+ }
25
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "envs": {
3
+ "cn-release": {
4
+ "platform": "cn",
5
+ "seavideoBaseUrl": "https://www.seavideo.tv",
6
+ "flowWebBaseUrl": "https://flow.seavideo.tv",
7
+ "flowApiBaseUrl": "https://cn-flow-gateway.seavideo.ai",
8
+ "aiVideoApiBaseUrl": "https://seaflow-ai-video-api.seavideo.tv",
9
+ "authIssuer": "https://seaflow-auth.seavideo.tv",
10
+ "authClientId": "workbuddy-cn-cli"
11
+ }
12
+ }
13
+ }
@@ -1,4 +1,4 @@
1
- import { join } from 'node:path';
1
+ import { dirname, join, resolve } from 'node:path';
2
2
  import { CliError } from "../errors.js";
3
3
  import { t } from "../i18n.js";
4
4
  import { parsePreset, parsePresetsDocument } from "./preset-schema.js";
@@ -13,17 +13,15 @@ export const ENV_VAR_FIELDS = {
13
13
  };
14
14
  export const ENVS_FILE_NAME = 'envs.json';
15
15
  export const PRESET_ENV_NAME_VAR = 'SEAVIDEO_ENV';
16
- const BUILTIN_PRESETS = {
17
- 'cn-release': {
18
- platform: 'cn',
19
- seavideoBaseUrl: 'https://seacraft-cn-sea-craft-next.dev.seavideo.tv',
20
- flowWebBaseUrl: 'https://flow.dev.seavideo.tv',
21
- flowApiBaseUrl: 'https://aiart-cn-flow-gateway.dev.seavideo.tv',
22
- aiVideoApiBaseUrl: 'https://seaflow-ai-video-api.dev.seavideo.tv',
23
- authIssuer: 'https://seaflow-auth.dev.seavideo.tv',
24
- authClientId: 'workbuddy-cn-cli',
25
- },
26
- };
16
+ export const ENCRYPTED_ENVS_FILE_NAME = 'envs.enc.json';
17
+ export const SOPS_LOG_FILE_NAME = 'sops.log';
18
+ const PACKAGED_ENVS_RELATIVE = join('..', 'src', 'config', 'envs', ENVS_FILE_NAME);
19
+ function packagedEnvsPath(deps) {
20
+ return join(dirname(resolve(deps.scriptPath())), PACKAGED_ENVS_RELATIVE);
21
+ }
22
+ function encryptedEnvsPath(deps) {
23
+ return join(dirname(packagedEnvsPath(deps)), ENCRYPTED_ENVS_FILE_NAME);
24
+ }
27
25
  async function readEnvsFile(path, deps) {
28
26
  const text = await readTextOrNull(path, deps);
29
27
  let result;
@@ -35,6 +33,41 @@ async function readEnvsFile(path, deps) {
35
33
  }
36
34
  return result;
37
35
  }
36
+ async function readEncryptedEnvsFile(path, deps, paths) {
37
+ const outcome = await deps.decryptSopsFile(path);
38
+ await logSopsAttempt(paths, path, deps, outcome);
39
+ let result;
40
+ if (outcome.status === 'ok') {
41
+ result = parsePresetsDocument(path, parseJsonOrThrow(path, outcome.text, deps), deps.env);
42
+ }
43
+ else {
44
+ result = {};
45
+ }
46
+ return result;
47
+ }
48
+ async function logSopsAttempt(paths, path, deps, outcome) {
49
+ let outcomeText;
50
+ if (outcome.status === 'unavailable') {
51
+ outcomeText = null;
52
+ }
53
+ else if (outcome.status === 'ok') {
54
+ outcomeText = 'ok';
55
+ }
56
+ else {
57
+ outcomeText = `failed: ${outcome.reason}`;
58
+ }
59
+ if (outcomeText !== null) {
60
+ const line = `${deps.clock().toISOString()} ${path} ${outcomeText}\n`;
61
+ try {
62
+ await deps.fs.mkdir(paths.root, { recursive: true, mode: 0o700 });
63
+ await deps.fs.writeFile(join(paths.root, SOPS_LOG_FILE_NAME), line, { mode: 0o600 });
64
+ }
65
+ catch {
66
+ }
67
+ }
68
+ else {
69
+ }
70
+ }
38
71
  async function readTextOrNull(path, deps) {
39
72
  let result;
40
73
  try {
@@ -108,7 +141,8 @@ function defineEntry(target, name, value) {
108
141
  }
109
142
  export async function loadPresetRegistry(deps, paths) {
110
143
  const registry = { presets: {}, origins: {} };
111
- overlay(registry, BUILTIN_PRESETS, 'builtin');
144
+ overlay(registry, await readEnvsFile(packagedEnvsPath(deps), deps), 'builtin');
145
+ overlay(registry, await readEncryptedEnvsFile(encryptedEnvsPath(deps), deps, paths), 'builtin');
112
146
  overlay(registry, await readEnvsFile(join(paths.root, ENVS_FILE_NAME), deps), 'user-file');
113
147
  overlay(registry, await readEnvsFile(join(deps.cwd(), ENVS_FILE_NAME), deps), 'project-file');
114
148
  const fromEnvVars = readEnvVarPreset(deps);
@@ -0,0 +1,48 @@
1
+ import { spawn } from 'node:child_process';
2
+ export function makeSopsDecrypt(spawnFn = spawn) {
3
+ return async (path) => {
4
+ let child = null;
5
+ try {
6
+ child = spawnFn('sops', ['--decrypt', path], {
7
+ stdio: ['ignore', 'pipe', 'pipe'],
8
+ windowsHide: true,
9
+ });
10
+ }
11
+ catch {
12
+ child = null;
13
+ }
14
+ let result;
15
+ if (child === null) {
16
+ result = { status: 'unavailable' };
17
+ }
18
+ else {
19
+ result = await collect(child);
20
+ }
21
+ return result;
22
+ };
23
+ }
24
+ async function collect(child) {
25
+ const stdout = [];
26
+ const stderr = [];
27
+ child.stdout.on('data', (chunk) => stdout.push(chunk));
28
+ child.stderr.on('data', (chunk) => stderr.push(chunk));
29
+ const exit = await new Promise((resolve) => {
30
+ child.once('error', (error) => resolve({ code: null, error }));
31
+ child.once('close', (code) => resolve({ code, error: null }));
32
+ });
33
+ let result;
34
+ if (exit.error !== null) {
35
+ result = { status: 'unavailable' };
36
+ }
37
+ else if (exit.code !== 0) {
38
+ result = { status: 'failed', reason: diagnosticOf(stderr) };
39
+ }
40
+ else {
41
+ result = { status: 'ok', text: Buffer.concat(stdout).toString('utf8') };
42
+ }
43
+ return result;
44
+ }
45
+ function diagnosticOf(chunks) {
46
+ const text = Buffer.concat(chunks).toString('utf8').trim();
47
+ return text === '' ? '(no stderr)' : text;
48
+ }
package/dist/src/deps.js CHANGED
@@ -1,9 +1,10 @@
1
1
  import { spawn, spawnSync } from 'node:child_process';
2
2
  import { randomBytes } from 'node:crypto';
3
- import { chmod, mkdir, readFile, readdir, realpath, rename, rm, stat, unlink, writeFile, } from 'node:fs/promises';
3
+ import { chmod, cp, lstat, mkdir, readFile, readdir, realpath, rename, rm, stat, unlink, writeFile, } from 'node:fs/promises';
4
4
  import { homedir, platform as osPlatform } from 'node:os';
5
5
  import { makeEngineDownloader } from "./canvas/engine-install.js";
6
6
  import { makeNpmInstall, npmCommandOf, scriptPathOf } from "./update/npm-install.js";
7
+ import { makeSopsDecrypt } from "./config/sops.js";
7
8
  import { startLoopbackServer } from "./loopback.js";
8
9
  async function readStdin() {
9
10
  const chunks = [];
@@ -30,7 +31,12 @@ export function createDeps() {
30
31
  const s = await stat(path);
31
32
  return { mode: s.mode };
32
33
  },
34
+ lstat: async (path) => {
35
+ const s = await lstat(path);
36
+ return { mode: s.mode };
37
+ },
33
38
  unlink: (path) => unlink(path),
39
+ cp: (source, target, options) => cp(source, target, options),
34
40
  },
35
41
  clock: () => new Date(),
36
42
  sleep: (ms) => new Promise((resolve) => setTimeout(resolve, ms)),
@@ -81,6 +87,7 @@ export function createDeps() {
81
87
  downloadEngine: makeEngineDownloader(),
82
88
  runNpmInstall: makeNpmInstall(npmCommandOf(process.platform), undefined, process.platform === 'win32'),
83
89
  scriptPath: () => scriptPathOf(process.argv),
90
+ decryptSopsFile: makeSopsDecrypt(),
84
91
  readWindowsRegistry: readRegistryWith(runCapture),
85
92
  realpath: (path) => realpath(path),
86
93
  };
package/dist/src/i18n.js CHANGED
@@ -27,6 +27,7 @@ const en = {
27
27
  'program.description.seavideo': 'Seavideo local CLI',
28
28
  'program.description.seaflow': 'Seaflow local CLI (token-based canvas entry)',
29
29
  'program.envOption': 'Override the environment for this invocation',
30
+ 'program.skipUpdate': 'Skip the update check for this run',
30
31
  'cmd.login': 'Log in to the current environment',
31
32
  'cmd.whoami': 'Show login status (always calls the server)',
32
33
  'cmd.logout': 'Clear local credentials',
@@ -41,7 +42,8 @@ const en = {
41
42
  'cmd.update': 'Check for a newer CLI version',
42
43
  'opt.updateChannel': 'Release channel to check (default: latest)',
43
44
  'update.available': 'A newer version is available: {current} -> {latest}',
44
- 'update.hint': 'Upgrade with the npm command shown by: seavideo update',
45
+ 'update.blocked': 'This command requires a newer CLI: {current} -> {latest}',
46
+ 'update.hint': 'Upgrade now: seavideo update\nTo run this command without upgrading, add --skip-update',
45
47
  'update.channelLine': 'channel {channel} · registry {registry}',
46
48
  'update.upToDate': 'Already up to date: {version}',
47
49
  'update.ahead': 'Local version {current} is ahead of the channel ({latest})',
@@ -63,7 +65,7 @@ const en = {
63
65
  'update.notGlobalNoShim': 'No global launcher found next to this package; upgrade it the way it was installed',
64
66
  'update.notGlobalUnknown': 'Could not tell how this CLI was installed; refusing to replace it',
65
67
  'opt.updateDryRun': 'Show what would run without installing',
66
- 'opt.updateVersion': 'Install this version or tag, also for downgrades (e.g. --to 0.2.7-alpha.0)',
68
+ 'opt.updateVersion': 'Install this version or tag, also for downgrades (e.g. --to 0.3.3)',
67
69
  'opt.updateRegistry': 'npm registry to use for this run (overrides SEAVIDEO_REGISTRY)',
68
70
  'update.badRegistry': 'Not a valid registry URL: {value} (expected http:// or https://)',
69
71
  'doctor.versionNotChecked': 'not checked yet; run seavideo update',
@@ -103,6 +105,44 @@ const en = {
103
105
  'cmd.skill': 'Manage skills',
104
106
  'cmd.skill.list': 'List skills (search by keyword)',
105
107
  'cmd.skill.read': 'Read skill files (default SKILL.md)',
108
+ 'cmd.agentSkills': 'Install bundled skills into agent directories',
109
+ 'cmd.agentSkills.add': 'Install or sync bundled skills',
110
+ 'cmd.agentSkills.remove': 'Uninstall skills recorded in the manifest',
111
+ 'cmd.agentSkills.list': 'Show installed skills',
112
+ 'opt.agent': 'Target agent (repeatable); "all" for every known agent',
113
+ 'opt.global': 'Install to the user-level skill directory instead of the project',
114
+ 'opt.project': 'Project root (default: current directory)',
115
+ 'opt.skillsDir': 'Skill root directory of an agent, such as ~/.claude/skills',
116
+ 'opt.dryRun': 'Print the plan without writing anything',
117
+ 'opt.force': 'Back up and replace directories not created by this CLI',
118
+ 'opt.quiet': 'Suppress normal output',
119
+ 'agentSkills.addDone': 'Installed {count} skill(s) to {root}',
120
+ 'agentSkills.removed': 'Removed {count} skill(s) from {root}',
121
+ 'agentSkills.removedAll': 'Removed {count} skill(s)',
122
+ 'agentSkills.nothingToRemove': 'No skills recorded in the manifest',
123
+ 'agentSkills.plannedTarget': 'Target {root}',
124
+ 'agentSkills.plannedInstall': 'would install {skill}',
125
+ 'agentSkills.plannedRemove': 'would remove {skill}',
126
+ 'agentSkills.backedUp': 'Backed up {skill} to {backup}',
127
+ 'agentSkills.restored': 'Restored {skill} from backup',
128
+ 'agentSkills.failed': 'Failed to install {skill}: {reason}',
129
+ 'agentSkills.partialFailure': '{count} skill(s) failed; no old entries were removed',
130
+ 'agentSkills.noAgentDetected': 'No supported agent detected for {scope} scope',
131
+ 'agentSkills.noAgentDetectedDetail': 'Pass --agent <name>, --agent all, or --skills-dir <path>. Supported agents: {agents}',
132
+ 'agentSkills.unknownAgent': 'Unknown agent "{value}". Supported: {agents}',
133
+ 'agentSkills.conflict': '"{skill}" already exists at {path} and was not installed by this CLI',
134
+ 'agentSkills.conflictDetail': 'Re-run with --force to back it up and replace it',
135
+ 'agentSkills.hint': 'Hint: {hint}',
136
+ 'agentSkills.skillsDirConflict': '--skills-dir cannot be combined with --agent or --global',
137
+ 'agentSkills.globalWithProject': '--global cannot be combined with --project',
138
+ 'agentSkills.locked': 'Another seavideo install is running: {path}',
139
+ 'agentSkills.manifestMissing': 'Install manifest is missing; refusing to guess',
140
+ 'agentSkills.manifestCorrupt': 'Install manifest is unreadable: {path} ({reason})',
141
+ 'agentSkills.manifestMissingDetail': 'Remove the skill directories by hand, or reinstall with "agent-skills add"',
142
+ 'agentSkills.payloadMissing': 'Bundled skills are missing from this installation',
143
+ 'agentSkills.payloadMissingDetail': 'Expected them under {path}; missing: {missing}',
144
+ 'agentSkills.listEmpty': 'No skills installed',
145
+ 'agentSkills.listHeader': 'Agent Scope Skill Version',
106
146
  'cmd.tool': 'Work with the tools the current canvas exposes',
107
147
  'cmd.tool.list': 'List tool names and descriptions',
108
148
  'cmd.tool.spec': 'Show full definitions (one name, several names, or all)',
@@ -608,11 +648,14 @@ const en = {
608
648
  'canvas.shotSaved': 'Screenshot saved to: {path}',
609
649
  'canvas.shotWriteFailed': 'Could not write the screenshot',
610
650
  'canvas.notOpened': 'The browser session has no canvas page open; the session is unusable, so close it and run canvas use again',
651
+ 'canvas.craftLocationChanged': 'The Craft page navigated away from the canvas (login page or error page). Run canvas use again.',
652
+ 'canvas.previousClosing': 'The previous canvas browser is still closing. Please retry in a moment.',
611
653
  };
612
654
  const zh = {
613
655
  'program.description.seavideo': 'Seavideo 本地命令行工具',
614
656
  'program.description.seaflow': 'Seaflow 本地命令行工具(token 直连画布入口)',
615
657
  'program.envOption': '临时指定环境',
658
+ 'program.skipUpdate': '本次跳过更新检查',
616
659
  'cmd.login': '登录到当前环境',
617
660
  'cmd.whoami': '查询登录状态(每次真实调用服务端)',
618
661
  'cmd.logout': '清除本地凭据',
@@ -627,7 +670,8 @@ const zh = {
627
670
  'cmd.update': '检查 CLI 是否有新版本',
628
671
  'opt.updateChannel': '要检查的发布通道(默认 latest)',
629
672
  'update.available': '有新版本可用:{current} -> {latest}',
630
- 'update.hint': '用 seavideo update 给出的 npm 命令升级',
673
+ 'update.blocked': '该命令需要更新的 CLI 版本:{current} -> {latest}',
674
+ 'update.hint': '立即升级:seavideo update\n本次不升级:在命令后加 --skip-update',
631
675
  'update.channelLine': '通道 {channel} · registry {registry}',
632
676
  'update.upToDate': '已是最新版本:{version}',
633
677
  'update.ahead': '本地版本 {current} 领先于通道顶端({latest})',
@@ -649,7 +693,7 @@ const zh = {
649
693
  'update.notGlobalNoShim': '找不到与该包配套的全局启动器,请按原来的方式升级',
650
694
  'update.notGlobalUnknown': '无法判断这个 CLI 是怎么装的,拒绝覆盖安装',
651
695
  'opt.updateDryRun': '只显示将要执行的命令,不安装',
652
- 'opt.updateVersion': '安装指定版本或 tag(也可用于降级),如 --to 0.2.7-alpha.0',
696
+ 'opt.updateVersion': '安装指定版本或 tag(也可用于降级),如 --to 0.3.3',
653
697
  'opt.updateRegistry': '本次使用的 npm registry(覆盖 SEAVIDEO_REGISTRY)',
654
698
  'update.badRegistry': '不是合法的 registry 地址:{value}(需要 http:// 或 https://)',
655
699
  'doctor.versionNotChecked': '尚未检查;可运行 seavideo update',
@@ -689,6 +733,44 @@ const zh = {
689
733
  'cmd.skill': '技能管理',
690
734
  'cmd.skill.list': '列出技能(支持关键字检索)',
691
735
  'cmd.skill.read': '读取技能文件(默认 SKILL.md)',
736
+ 'cmd.agentSkills': '把随包技能安装到 agent 目录',
737
+ 'cmd.agentSkills.add': '安装或同步随包技能',
738
+ 'cmd.agentSkills.remove': '卸载清单里记录的技能',
739
+ 'cmd.agentSkills.list': '查看已安装的技能',
740
+ 'opt.agent': '目标 agent(可重复);all 表示全部已知 agent',
741
+ 'opt.global': '装到用户级技能目录,而不是当前项目',
742
+ 'opt.project': '项目根目录(默认当前目录)',
743
+ 'opt.skillsDir': 'agent 的技能根目录,如 ~/.claude/skills',
744
+ 'opt.dryRun': '只打印计划,不写任何文件',
745
+ 'opt.force': '备份并替换不是本 CLI 安装的同名目录',
746
+ 'opt.quiet': '抑制普通输出',
747
+ 'agentSkills.addDone': '已向 {root} 安装 {count} 个技能',
748
+ 'agentSkills.removed': '已从 {root} 移除 {count} 个技能',
749
+ 'agentSkills.removedAll': '已移除 {count} 个技能',
750
+ 'agentSkills.nothingToRemove': '清单中没有已安装的技能',
751
+ 'agentSkills.plannedTarget': '目标 {root}',
752
+ 'agentSkills.plannedInstall': '将安装 {skill}',
753
+ 'agentSkills.plannedRemove': '将移除 {skill}',
754
+ 'agentSkills.backedUp': '已备份 {skill} 到 {backup}',
755
+ 'agentSkills.restored': '已从备份恢复 {skill}',
756
+ 'agentSkills.failed': '安装 {skill} 失败:{reason}',
757
+ 'agentSkills.partialFailure': '有 {count} 个技能失败;未删除任何旧条目',
758
+ 'agentSkills.noAgentDetected': '未在 {scope} 作用域下检测到受支持的 agent',
759
+ 'agentSkills.noAgentDetectedDetail': '请使用 --agent <名字>、--agent all 或 --skills-dir <路径>。支持的 agent:{agents}',
760
+ 'agentSkills.unknownAgent': '未知 agent "{value}"。支持:{agents}',
761
+ 'agentSkills.conflict': '"{skill}" 已存在于 {path},且不是本 CLI 安装的',
762
+ 'agentSkills.conflictDetail': '确认要覆盖请加 --force,会先备份',
763
+ 'agentSkills.hint': '提示:{hint}',
764
+ 'agentSkills.skillsDirConflict': '--skills-dir 不能与 --agent 或 --global 同时使用',
765
+ 'agentSkills.globalWithProject': '--global 不能与 --project 同时使用',
766
+ 'agentSkills.locked': '另一个 seavideo 安装正在进行:{path}',
767
+ 'agentSkills.manifestMissing': '安装清单缺失,拒绝猜测删除',
768
+ 'agentSkills.manifestCorrupt': '安装清单无法解析:{path}({reason})',
769
+ 'agentSkills.manifestMissingDetail': '请手动删除技能目录,或重新执行 agent-skills add',
770
+ 'agentSkills.payloadMissing': '当前安装缺少随包技能',
771
+ 'agentSkills.payloadMissingDetail': '期望位于 {path};缺少:{missing}',
772
+ 'agentSkills.listEmpty': '尚未安装任何技能',
773
+ 'agentSkills.listHeader': 'Agent 作用域 技能 版本',
692
774
  'cmd.tool': '操作当前画布暴露的工具',
693
775
  'cmd.tool.list': '列出工具名与描述',
694
776
  'cmd.tool.spec': '查看完整定义(一个名字、多个名字或全部)',
@@ -1194,6 +1276,8 @@ const zh = {
1194
1276
  'canvas.shotSaved': '截图已保存到:{path}',
1195
1277
  'canvas.shotWriteFailed': '无法写入截图文件',
1196
1278
  'canvas.notOpened': '浏览器会话里没有打开的画布页。该会话已不可用,请 canvas close 后重新 canvas use',
1279
+ 'canvas.craftLocationChanged': 'Craft 页面已离开画布(跳到了登录页或错误页),请重新 canvas use',
1280
+ 'canvas.previousClosing': '上一个画布浏览器仍在退出,请稍后重试',
1197
1281
  };
1198
1282
  const TABLES = { en, zh };
1199
1283
  export function t(key, vars = {}, env = process.env) {
@@ -23,7 +23,6 @@ export async function readCheckCache(fs, path) {
23
23
  checkedAt,
24
24
  latest: stringOrNull(parsed['latest']),
25
25
  channel: stringOrNull(parsed['channel']),
26
- notified: stringOrNull(parsed['notified']),
27
26
  }
28
27
  : null;
29
28
  }
@@ -4,10 +4,12 @@ import { DISABLE_ENV } from "./check-cache.js";
4
4
  export function shouldConsiderPassive(env, stderrIsTTY) {
5
5
  return stderrIsTTY && env[DISABLE_ENV] !== '1';
6
6
  }
7
- export function decideNotice(current, latest, cache) {
8
- const newer = latest !== null && compareVersions(latest, current) === 1;
9
- const alreadyNotified = cache?.notified === latest;
10
- return newer && !alreadyNotified ? latest : null;
7
+ export function decideNotice(current, latest) {
8
+ return latest !== null && compareVersions(latest, current) === 1 ? latest : null;
9
+ }
10
+ const BUSINESS_COMMANDS = new Set(['canvas', 'tool', 'skill', 'wallet']);
11
+ export function isBusinessCommand(name) {
12
+ return BUSINESS_COMMANDS.has(name);
11
13
  }
12
14
  export function printNotice(deps, current, latest) {
13
15
  deps.stderr(`\n${t('update.available', { current, latest }, deps.env)}\n` +
@@ -1,23 +1,17 @@
1
1
  import { VERSION } from "../cli/program.js";
2
- import { cacheUsable, readCheckCache, successTtlOf, writeCheckCache, } from "./check-cache.js";
3
- import { decideNotice, printNotice, shouldConsiderPassive } from "./notify.js";
2
+ import { cacheUsable, checkDisabled, readCheckCache, successTtlOf, writeCheckCache, } from "./check-cache.js";
3
+ import { decideNotice, shouldConsiderPassive } from "./notify.js";
4
4
  import { DEFAULT_CHANNEL, fetchVersionInfo, PACKAGE_NAME } from "./registry.js";
5
- export async function checkVersionBeforeCommand(deps, paths) {
6
- if (shouldConsiderPassive(deps.env, deps.stderrIsTTY)) {
7
- const cache = await readCheckCache(deps.fs, paths.versionCheckFile);
8
- const latest = decideNotice(VERSION, cache?.latest ?? null, cache);
9
- if (latest !== null) {
10
- printNotice(deps, VERSION, latest);
11
- await writeCheckCache(deps, paths.versionCheckFile, {
12
- ...cache,
13
- notified: latest,
14
- });
15
- }
16
- else {
17
- }
5
+ export async function detectNewerVersion(deps, paths) {
6
+ let result;
7
+ if (checkDisabled(deps.env)) {
8
+ result = null;
18
9
  }
19
10
  else {
11
+ const cache = await readCheckCache(deps.fs, paths.versionCheckFile);
12
+ result = decideNotice(VERSION, cache?.latest ?? null);
20
13
  }
14
+ return result;
21
15
  }
22
16
  export async function refreshVersionAfterCommand(deps, paths) {
23
17
  if (shouldConsiderPassive(deps.env, deps.stderrIsTTY)) {
@@ -39,7 +33,6 @@ async function refreshCache(deps, paths, cache) {
39
33
  checkedAt: deps.clock().toISOString(),
40
34
  latest: info.latest,
41
35
  channel,
42
- notified: cache?.notified ?? null,
43
36
  });
44
37
  }
45
38
  catch {
@@ -47,7 +40,6 @@ async function refreshCache(deps, paths, cache) {
47
40
  checkedAt: deps.clock().toISOString(),
48
41
  latest: cache?.latest ?? null,
49
42
  channel,
50
- notified: cache?.notified ?? null,
51
43
  });
52
44
  }
53
45
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seavideo/cli",
3
- "version": "0.3.1",
3
+ "version": "0.3.5",
4
4
  "description": "CLI gateway for Seavideo canvas workflows: build, run and inspect image/video generation graphs.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -29,7 +29,7 @@
29
29
  "dist"
30
30
  ],
31
31
  "scripts": {
32
- "build": "tsc -p tsconfig.build.json && node scripts/postbuild.mjs",
32
+ "build": "tsc -p tsconfig.build.json && node scripts/postbuild.mjs && node scripts/copy-skills.mjs && node scripts/copy-envs.mjs",
33
33
  "typecheck": "tsc --noEmit",
34
34
  "dev": "node --experimental-strip-types bin/seavideo.ts",
35
35
  "test": "vitest run",
@@ -39,6 +39,7 @@
39
39
  "format": "prettier --write .",
40
40
  "format:check": "prettier --check .",
41
41
  "check:rules": "node --experimental-strip-types bin/check-code-rules.ts",
42
+ "package:skills": "node scripts/package-skills.mjs",
42
43
  "sync:version": "node scripts/sync-version.mjs",
43
44
  "version": "node scripts/sync-version.mjs",
44
45
  "prepublishOnly": "npm run build"