@mindscraft/branch-video-agent-cli 0.1.1 → 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 +28 -4
- package/dist/commands/preset.d.ts +2 -0
- package/dist/commands/preset.js +22 -0
- package/dist/index.js +2 -0
- package/dist/lib/flags.js +2 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -4,16 +4,22 @@
|
|
|
4
4
|
|
|
5
5
|
## 安装与执行
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
推荐显式指定包和可执行名:
|
|
8
8
|
|
|
9
9
|
```powershell
|
|
10
|
-
|
|
10
|
+
npm exec --yes --package=@mindscraft/branch-video-agent-cli branch-video-agent -- --help
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
中国大陆用户如果希望更稳定、更快地安装,可以走 npm 的公开镜像:
|
|
14
14
|
|
|
15
15
|
```powershell
|
|
16
|
-
|
|
16
|
+
npm exec --yes --registry=https://registry.npmmirror.com --package=@mindscraft/branch-video-agent-cli branch-video-agent -- --help
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
如果你更喜欢简写,从 `0.1.2` 开始也支持:
|
|
20
|
+
|
|
21
|
+
```powershell
|
|
22
|
+
npx -y @mindscraft/branch-video-agent-cli --help
|
|
17
23
|
```
|
|
18
24
|
|
|
19
25
|
也可以全局安装:
|
|
@@ -37,7 +43,25 @@ branch-video-agent --help
|
|
|
37
43
|
"page": 1,
|
|
38
44
|
"limit": 20
|
|
39
45
|
}
|
|
40
|
-
'@ |
|
|
46
|
+
'@ | npm exec --yes --package=@mindscraft/branch-video-agent-cli branch-video-agent -- project list
|
|
47
|
+
```
|
|
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
|
|
41
65
|
```
|
|
42
66
|
|
|
43
67
|
## 在仓库内构建发布包
|
|
@@ -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,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mindscraft/branch-video-agent-cli",
|
|
3
|
-
"version": "0.
|
|
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": "
|
|
7
|
+
"branch-video-agent": "dist/bin.js",
|
|
8
|
+
"branch-video-agent-cli": "dist/bin.js"
|
|
8
9
|
},
|
|
9
10
|
"exports": {
|
|
10
11
|
".": "./dist/index.js"
|