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

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,24 @@ 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
+ 托管互动方案提交示例:
50
+
51
+ ```powershell
52
+ @'
53
+ {
54
+ "id": "judge-base",
55
+ "name": "判断题-增强版",
56
+ "defaultThemeId": "cat",
57
+ "urlsByTheme": {
58
+ "cat": "https://aic-view.sdp.101.com/view/judge-base-v2"
59
+ },
60
+ "configTemplate": {
61
+ "waitForPageReady": true
62
+ }
63
+ }
64
+ '@ | npm exec --yes --package=@mindscraft/branch-video-agent-cli branch-video-agent -- preset upsert
65
+ ```
66
+
49
67
  ## 在仓库内构建发布包
50
68
 
51
69
  从仓库根目录执行:
@@ -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
+ };
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,9 +88,10 @@ 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
96
  ' project list | get | create | update | delete',
96
97
  ' version list | get | publish',
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.0",
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"