@mindscraft/branch-video-agent-cli 0.1.2 → 0.2.1

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
@@ -46,6 +46,39 @@ branch-video-agent --help
46
46
  '@ | npm exec --yes --package=@mindscraft/branch-video-agent-cli branch-video-agent -- project list
47
47
  ```
48
48
 
49
+ AIHub 导入公共库示例:
50
+
51
+ ```powershell
52
+ @'
53
+ {
54
+ "global_context_str": "{\"project_title\":\"AIHub 导入项目\"}",
55
+ "script_body_str": "{\"project_title\":\"AIHub 导入项目\"}",
56
+ "result_script_str": "[]",
57
+ "workflow_run_id": "00000000-0000-4000-8000-000000000000"
58
+ }
59
+ '@ | npm exec --yes --package=@mindscraft/branch-video-agent-cli branch-video-agent -- project import-aihub
60
+ ```
61
+
62
+ 该命令与其他 `project` / `version` / `production` 命令一样,统一使用 `AIHUB_AGENT_TOKEN` Bearer 鉴权;服务端会兼容旧的 `X-AIHub-Import-Token` 头,但 CLI 不再单独管理第二套 token。
63
+
64
+ 托管互动方案提交示例:
65
+
66
+ ```powershell
67
+ @'
68
+ {
69
+ "id": "judge-base",
70
+ "name": "判断题-增强版",
71
+ "defaultThemeId": "cat",
72
+ "urlsByTheme": {
73
+ "cat": "https://aic-view.sdp.101.com/view/judge-base-v2"
74
+ },
75
+ "configTemplate": {
76
+ "waitForPageReady": true
77
+ }
78
+ }
79
+ '@ | npm exec --yes --package=@mindscraft/branch-video-agent-cli branch-video-agent -- preset upsert
80
+ ```
81
+
49
82
  ## 在仓库内构建发布包
50
83
 
51
84
  从仓库根目录执行:
@@ -0,0 +1,2 @@
1
+ import type { CommandHandler } from '../lib/types.js';
2
+ export declare const presetCommands: Record<string, CommandHandler>;
@@ -0,0 +1,22 @@
1
+ import { CliCommandError } from '../lib/errors.js';
2
+ import { getOptionalString } from '../lib/payload.js';
3
+ export const presetCommands = {
4
+ list: async ({ client, payload }) => {
5
+ const presetId = getOptionalString(payload, 'presetId');
6
+ const result = await client.request('/api/branch-video/web-node-presets', {
7
+ method: 'GET',
8
+ query: presetId ? { presetId } : undefined,
9
+ });
10
+ return { data: result.data, requestId: result.requestId };
11
+ },
12
+ upsert: async ({ client, payload }) => {
13
+ if (Object.keys(payload).length === 0) {
14
+ throw new CliCommandError('Missing preset payload', 'VALIDATION_ERROR');
15
+ }
16
+ const result = await client.request('/api/branch-video/web-node-presets', {
17
+ method: 'POST',
18
+ body: payload,
19
+ });
20
+ return { data: result.data, requestId: result.requestId };
21
+ },
22
+ };
@@ -21,6 +21,13 @@ export const projectCommands = {
21
21
  });
22
22
  return { data: result.data, requestId: result.requestId };
23
23
  },
24
+ 'import-aihub': async ({ client, payload }) => {
25
+ const result = await client.request('/api/branch-video/import/aihub', {
26
+ method: 'POST',
27
+ body: payload,
28
+ });
29
+ return { data: result.data, requestId: result.requestId };
30
+ },
24
31
  update: async ({ client, payload }) => {
25
32
  const projectId = getRequiredString(payload, 'projectId');
26
33
  const result = await client.request(`/api/branch-video/${encodeURIComponent(projectId)}`, {
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { presetCommands } from './commands/preset.js';
1
2
  import { productionCommands } from './commands/production.js';
2
3
  import { projectCommands } from './commands/project.js';
3
4
  import { versionCommands } from './commands/version.js';
@@ -8,6 +9,7 @@ import { CliHttpClient } from './lib/http.js';
8
9
  import { ensureObject } from './lib/payload.js';
9
10
  import { createProcessRuntime } from './lib/runtime.js';
10
11
  const commandRegistry = {
12
+ preset: presetCommands,
11
13
  workflow: workflowCommands,
12
14
  project: projectCommands,
13
15
  version: versionCommands,
package/dist/lib/flags.js CHANGED
@@ -88,11 +88,12 @@ export function parseCliArgs(argv) {
88
88
  }
89
89
  export function getCliHelpText() {
90
90
  return [
91
- 'Usage: branch-video-agent <group> <action> [--wait] [--raw] [--timeout <ms>] [--base-url <url>] [--token <token>] [--token-file <path>]',
91
+ 'Usage: branch-video-agent <group> <action> [--wait] [--raw] [--timeout <ms>] [--poll-interval <ms>] [--base-url <url>] [--token <token>] [--token-file <path>]',
92
92
  '',
93
93
  'Groups:',
94
+ ' preset list | upsert',
94
95
  ' workflow run | status | outputs',
95
- ' project list | get | create | update | delete',
96
+ ' project list | get | create | import-aihub | update | delete',
96
97
  ' version list | get | publish',
97
98
  ' production schema | start | status | retry',
98
99
  '',
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@mindscraft/branch-video-agent-cli",
3
- "version": "0.1.2",
3
+ "version": "0.2.1",
4
4
  "description": "Published CLI for branch-video and AIHub agent APIs.",
5
5
  "type": "module",
6
6
  "bin": {
7
- "branch-video-agent": "./dist/bin.js",
8
- "branch-video-agent-cli": "./dist/bin.js"
7
+ "branch-video-agent": "dist/bin.js",
8
+ "branch-video-agent-cli": "dist/bin.js"
9
9
  },
10
10
  "exports": {
11
11
  ".": "./dist/index.js"