@bctrl/cli 0.1.2 → 0.1.4
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 +95 -97
- package/dist/api/auth.d.ts +5 -6
- package/dist/api/auth.js +4 -5
- package/dist/api/client.d.ts +1 -0
- package/dist/api/client.js +3 -0
- package/dist/api/errors.js +2 -2
- package/dist/commands/ai/index.js +59 -102
- package/dist/commands/{browser → api-key}/index.d.ts +1 -1
- package/dist/commands/api-key/index.js +47 -0
- package/dist/commands/auth/login.js +2 -1
- package/dist/commands/auth/status.js +5 -0
- package/dist/commands/browser-extension/index.d.ts +3 -0
- package/dist/commands/browser-extension/index.js +86 -0
- package/dist/commands/file/index.js +9 -3
- package/dist/commands/{invocation → help}/index.d.ts +1 -1
- package/dist/commands/help/index.js +17 -0
- package/dist/commands/proxy/index.d.ts +3 -0
- package/dist/commands/proxy/index.js +66 -0
- package/dist/commands/run/index.js +205 -155
- package/dist/commands/runtime/index.js +265 -116
- package/dist/commands/shared/help.js +1 -1
- package/dist/commands/shared/rest.d.ts +1 -0
- package/dist/commands/shared/rest.js +14 -6
- package/dist/commands/space/index.js +17 -32
- package/dist/commands/space/list.d.ts +1 -11
- package/dist/commands/space/list.js +14 -23
- package/dist/commands/subaccount/index.js +29 -80
- package/dist/commands/tool/index.js +15 -7
- package/dist/commands/tool-call/index.js +6 -1
- package/dist/commands/toolset/index.js +6 -3
- package/dist/commands/usage/index.d.ts +3 -0
- package/dist/commands/usage/index.js +13 -0
- package/dist/commands/vault/index.js +104 -25
- package/dist/config/auth-store.d.ts +10 -12
- package/dist/config/auth-store.js +4 -5
- package/dist/factory.js +1 -1
- package/dist/generated/help.d.ts +125 -110
- package/dist/generated/help.js +175 -141
- package/dist/root.js +10 -4
- package/package.json +47 -47
- package/dist/commands/browser/index.js +0 -53
- package/dist/commands/invocation/index.js +0 -36
package/dist/generated/help.js
CHANGED
|
@@ -1,47 +1,20 @@
|
|
|
1
1
|
// Generated by scripts/generate/cli-help.mjs. Do not edit by hand.
|
|
2
2
|
export const CLI_HELP_COMMANDS = {
|
|
3
|
-
"
|
|
4
|
-
"kind": "
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
{
|
|
10
|
-
"name": "--space",
|
|
11
|
-
"value": "<id>",
|
|
12
|
-
"description": "Owning space id.",
|
|
13
|
-
"mapsTo": "input.spaceId"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"name": "--name",
|
|
17
|
-
"value": "<name>",
|
|
18
|
-
"description": "Runtime name.",
|
|
19
|
-
"mapsTo": "input.name"
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
"name": "--config-file",
|
|
23
|
-
"value": "<path>",
|
|
24
|
-
"description": "Read runtime config JSON from a file.",
|
|
25
|
-
"mapsTo": "input.config"
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
"name": "--metadata-file",
|
|
29
|
-
"value": "<path>",
|
|
30
|
-
"description": "Read runtime metadata JSON from a file.",
|
|
31
|
-
"mapsTo": "input.metadata"
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
"name": "--input",
|
|
35
|
-
"value": "<path>",
|
|
36
|
-
"description": "Read the full JSON request body from a file, or - for stdin."
|
|
37
|
-
}
|
|
3
|
+
"runtimes.create": {
|
|
4
|
+
"kind": "topic",
|
|
5
|
+
"topic": "runtimes.create",
|
|
6
|
+
"aliases": [
|
|
7
|
+
"runtime.create",
|
|
8
|
+
"bctrl runtime create"
|
|
38
9
|
],
|
|
10
|
+
"title": "Create a runtime",
|
|
11
|
+
"summary": "Create a browser runtime definition. This does not start the browser.",
|
|
39
12
|
"input": {
|
|
40
13
|
"fields": [
|
|
41
14
|
{
|
|
42
15
|
"name": "spaceId",
|
|
43
|
-
"type": "uuid",
|
|
44
|
-
"required":
|
|
16
|
+
"type": "uuid | \"default\"",
|
|
17
|
+
"required": false
|
|
45
18
|
},
|
|
46
19
|
{
|
|
47
20
|
"name": "type",
|
|
@@ -49,7 +22,7 @@ export const CLI_HELP_COMMANDS = {
|
|
|
49
22
|
"values": [
|
|
50
23
|
"\"browser\""
|
|
51
24
|
],
|
|
52
|
-
"required":
|
|
25
|
+
"required": false
|
|
53
26
|
},
|
|
54
27
|
{
|
|
55
28
|
"name": "name",
|
|
@@ -75,6 +48,11 @@ export const CLI_HELP_COMMANDS = {
|
|
|
75
48
|
"type": "uuid",
|
|
76
49
|
"required": true
|
|
77
50
|
},
|
|
51
|
+
{
|
|
52
|
+
"name": "spaceId",
|
|
53
|
+
"type": "uuid",
|
|
54
|
+
"required": true
|
|
55
|
+
},
|
|
78
56
|
{
|
|
79
57
|
"name": "name",
|
|
80
58
|
"type": "string",
|
|
@@ -82,11 +60,9 @@ export const CLI_HELP_COMMANDS = {
|
|
|
82
60
|
},
|
|
83
61
|
{
|
|
84
62
|
"name": "type",
|
|
85
|
-
"type": "\"browser\"
|
|
63
|
+
"type": "\"browser\"",
|
|
86
64
|
"values": [
|
|
87
|
-
"\"browser\""
|
|
88
|
-
"\"desktop\"",
|
|
89
|
-
"\"spreadsheet\""
|
|
65
|
+
"\"browser\""
|
|
90
66
|
],
|
|
91
67
|
"required": true
|
|
92
68
|
},
|
|
@@ -105,14 +81,19 @@ export const CLI_HELP_COMMANDS = {
|
|
|
105
81
|
"type": "uuid | null",
|
|
106
82
|
"required": true
|
|
107
83
|
},
|
|
84
|
+
{
|
|
85
|
+
"name": "lastActivityAt",
|
|
86
|
+
"type": "datetime",
|
|
87
|
+
"required": false
|
|
88
|
+
},
|
|
108
89
|
{
|
|
109
90
|
"name": "createdAt",
|
|
110
|
-
"type": "
|
|
91
|
+
"type": "datetime",
|
|
111
92
|
"required": true
|
|
112
93
|
},
|
|
113
94
|
{
|
|
114
95
|
"name": "updatedAt",
|
|
115
|
-
"type": "
|
|
96
|
+
"type": "datetime",
|
|
116
97
|
"required": true
|
|
117
98
|
},
|
|
118
99
|
{
|
|
@@ -127,155 +108,208 @@ export const CLI_HELP_COMMANDS = {
|
|
|
127
108
|
}
|
|
128
109
|
]
|
|
129
110
|
},
|
|
130
|
-
"
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
111
|
+
"api": {
|
|
112
|
+
"method": "POST",
|
|
113
|
+
"path": "/v1/runtimes",
|
|
114
|
+
"operationId": "runtimes.create",
|
|
115
|
+
"requestFields": [
|
|
116
|
+
"spaceId",
|
|
117
|
+
"type",
|
|
118
|
+
"name",
|
|
119
|
+
"config",
|
|
120
|
+
"metadata"
|
|
121
|
+
],
|
|
122
|
+
"responseFields": [
|
|
123
|
+
"id",
|
|
124
|
+
"spaceId",
|
|
125
|
+
"name",
|
|
126
|
+
"type",
|
|
127
|
+
"status",
|
|
128
|
+
"activeRunId",
|
|
129
|
+
"lastActivityAt",
|
|
130
|
+
"createdAt",
|
|
131
|
+
"updatedAt",
|
|
132
|
+
"config",
|
|
133
|
+
"metadata"
|
|
134
|
+
]
|
|
135
|
+
},
|
|
136
|
+
"sdk": [
|
|
134
137
|
{
|
|
135
|
-
"
|
|
138
|
+
"language": "typescript",
|
|
139
|
+
"package": "@bctrl/sdk",
|
|
140
|
+
"method": "client.runtimes.create"
|
|
136
141
|
}
|
|
137
142
|
],
|
|
138
|
-
"
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
]
|
|
143
|
-
},
|
|
144
|
-
"runtime.start": {
|
|
145
|
-
"kind": "command",
|
|
146
|
-
"command": "runtime.start",
|
|
147
|
-
"summary": "Start a runtime and open its active run.",
|
|
148
|
-
"usage": "bctrl runtime start <runtimeId>",
|
|
149
|
-
"output": {
|
|
150
|
-
"fields": [
|
|
143
|
+
"cli": {
|
|
144
|
+
"command": "bctrl runtime create",
|
|
145
|
+
"usage": "bctrl runtime create [flags]",
|
|
146
|
+
"flags": [
|
|
151
147
|
{
|
|
152
|
-
"name": "
|
|
153
|
-
"
|
|
154
|
-
"
|
|
148
|
+
"name": "--space",
|
|
149
|
+
"value": "<id>",
|
|
150
|
+
"description": "Owning space id."
|
|
155
151
|
},
|
|
156
152
|
{
|
|
157
|
-
"name": "
|
|
158
|
-
"
|
|
159
|
-
"
|
|
153
|
+
"name": "--name",
|
|
154
|
+
"value": "<name>",
|
|
155
|
+
"description": "Runtime name."
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"name": "--profile",
|
|
159
|
+
"description": "Persist browser state across runtime starts."
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"name": "--proxy",
|
|
163
|
+
"value": "<id-or-url>",
|
|
164
|
+
"description": "Saved proxy id or inline custom proxy URL."
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"name": "--device",
|
|
168
|
+
"value": "<desktop|mobile>",
|
|
169
|
+
"description": "Fingerprint device filter."
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"name": "--os",
|
|
173
|
+
"value": "<windows|macos|android|ios>",
|
|
174
|
+
"description": "Fingerprint OS filter."
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"name": "--browser",
|
|
178
|
+
"value": "<chrome|edge|safari>",
|
|
179
|
+
"description": "Fingerprint browser filter."
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"name": "--browser-version",
|
|
183
|
+
"value": "<version>",
|
|
184
|
+
"description": "Fingerprint browser version filter."
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"name": "--locale",
|
|
188
|
+
"value": "<locale>",
|
|
189
|
+
"description": "Fingerprint locale/language filter; repeat to set an ordered language stack."
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"name": "--config-file",
|
|
193
|
+
"value": "<path>",
|
|
194
|
+
"description": "Read runtime config JSON from a file."
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
"name": "--metadata-file",
|
|
198
|
+
"value": "<path>",
|
|
199
|
+
"description": "Read runtime metadata JSON from a file."
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
"name": "--input",
|
|
203
|
+
"value": "<path>",
|
|
204
|
+
"description": "Read the full JSON request body from a file, or - for stdin."
|
|
160
205
|
}
|
|
161
206
|
]
|
|
162
207
|
},
|
|
163
208
|
"examples": [
|
|
164
209
|
{
|
|
165
|
-
"
|
|
210
|
+
"audience": "cli",
|
|
211
|
+
"command": "bctrl runtime create --space sp_123 --name checkout-test"
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
"audience": "cli",
|
|
215
|
+
"command": "bctrl runtime create --name mobile-de --proxy pxy_123 --device mobile --os ios --browser safari --locale de-DE --locale de"
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
"audience": "cli",
|
|
219
|
+
"command": "bctrl runtime create --input runtime.json"
|
|
166
220
|
}
|
|
167
221
|
],
|
|
168
222
|
"next": [
|
|
169
223
|
{
|
|
170
|
-
"
|
|
224
|
+
"topic": "runtimes.start",
|
|
225
|
+
"command": "bctrl runtime start <runtimeId>"
|
|
171
226
|
}
|
|
172
227
|
]
|
|
173
228
|
},
|
|
174
|
-
"
|
|
175
|
-
"kind": "
|
|
176
|
-
"
|
|
177
|
-
"
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
{
|
|
181
|
-
"name": "--protocol",
|
|
182
|
-
"value": "<protocol>",
|
|
183
|
-
"description": "Connection protocol. Defaults to cdp.",
|
|
184
|
-
"mapsTo": "input.protocol"
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
"name": "--input",
|
|
188
|
-
"value": "<path>",
|
|
189
|
-
"description": "Read the full JSON request body from a file, or - for stdin."
|
|
190
|
-
}
|
|
229
|
+
"runtimes.start": {
|
|
230
|
+
"kind": "topic",
|
|
231
|
+
"topic": "runtimes.start",
|
|
232
|
+
"aliases": [
|
|
233
|
+
"runtime.start",
|
|
234
|
+
"bctrl runtime start"
|
|
191
235
|
],
|
|
192
|
-
"
|
|
193
|
-
|
|
194
|
-
{
|
|
195
|
-
"name": "protocol",
|
|
196
|
-
"type": "\"cdp\"",
|
|
197
|
-
"values": [
|
|
198
|
-
"\"cdp\""
|
|
199
|
-
],
|
|
200
|
-
"required": true
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
"name": "options",
|
|
204
|
-
"type": "object",
|
|
205
|
-
"required": false
|
|
206
|
-
}
|
|
207
|
-
]
|
|
208
|
-
},
|
|
236
|
+
"title": "Start a runtime",
|
|
237
|
+
"summary": "Start a runtime and open its active run.",
|
|
209
238
|
"output": {
|
|
210
239
|
"fields": [
|
|
211
240
|
{
|
|
212
|
-
"name": "
|
|
241
|
+
"name": "runtimeId",
|
|
213
242
|
"type": "uuid",
|
|
214
243
|
"required": true
|
|
215
244
|
},
|
|
216
245
|
{
|
|
217
|
-
"name": "
|
|
218
|
-
"type": "
|
|
219
|
-
"values": [
|
|
220
|
-
"\"cdp\"",
|
|
221
|
-
"\"cua\"",
|
|
222
|
-
"\"rdp\"",
|
|
223
|
-
"\"vnc\"",
|
|
224
|
-
"\"mcp\"",
|
|
225
|
-
"\"http\""
|
|
226
|
-
],
|
|
246
|
+
"name": "runId",
|
|
247
|
+
"type": "uuid",
|
|
227
248
|
"required": true
|
|
228
249
|
},
|
|
229
250
|
{
|
|
230
251
|
"name": "status",
|
|
231
|
-
"type": "\"active\" | \"
|
|
252
|
+
"type": "\"active\" | \"stopped\" | \"failed\"",
|
|
232
253
|
"values": [
|
|
233
254
|
"\"active\"",
|
|
234
|
-
"\"
|
|
235
|
-
"\"
|
|
236
|
-
"\"closed\""
|
|
255
|
+
"\"stopped\"",
|
|
256
|
+
"\"failed\""
|
|
237
257
|
],
|
|
238
258
|
"required": true
|
|
239
259
|
},
|
|
240
260
|
{
|
|
241
|
-
"name": "
|
|
242
|
-
"type": "
|
|
243
|
-
"required": true
|
|
244
|
-
},
|
|
245
|
-
{
|
|
246
|
-
"name": "createdAt",
|
|
247
|
-
"type": "datetime",
|
|
261
|
+
"name": "connectUrl",
|
|
262
|
+
"type": "string",
|
|
248
263
|
"required": true
|
|
249
264
|
},
|
|
250
265
|
{
|
|
251
|
-
"name": "
|
|
252
|
-
"type": "
|
|
266
|
+
"name": "protocol",
|
|
267
|
+
"type": "\"cdp\"",
|
|
268
|
+
"values": [
|
|
269
|
+
"\"cdp\""
|
|
270
|
+
],
|
|
253
271
|
"required": true
|
|
254
272
|
},
|
|
255
273
|
{
|
|
256
|
-
"name": "
|
|
257
|
-
"type": "
|
|
258
|
-
"required": false
|
|
259
|
-
},
|
|
260
|
-
{
|
|
261
|
-
"name": "revokedAt",
|
|
262
|
-
"type": "datetime | null",
|
|
263
|
-
"required": false
|
|
264
|
-
},
|
|
265
|
-
{
|
|
266
|
-
"name": "endpoint",
|
|
267
|
-
"type": "object",
|
|
274
|
+
"name": "started",
|
|
275
|
+
"type": "boolean",
|
|
268
276
|
"required": true
|
|
269
277
|
}
|
|
270
278
|
]
|
|
271
279
|
},
|
|
280
|
+
"api": {
|
|
281
|
+
"method": "POST",
|
|
282
|
+
"path": "/v1/runtimes/{runtimeId}/start",
|
|
283
|
+
"operationId": "runtimes.start",
|
|
284
|
+
"responseFields": [
|
|
285
|
+
"runtimeId",
|
|
286
|
+
"runId",
|
|
287
|
+
"status",
|
|
288
|
+
"connectUrl",
|
|
289
|
+
"protocol",
|
|
290
|
+
"started"
|
|
291
|
+
]
|
|
292
|
+
},
|
|
293
|
+
"sdk": [
|
|
294
|
+
{
|
|
295
|
+
"language": "typescript",
|
|
296
|
+
"package": "@bctrl/sdk",
|
|
297
|
+
"method": "client.runtimes.start"
|
|
298
|
+
}
|
|
299
|
+
],
|
|
300
|
+
"cli": {
|
|
301
|
+
"command": "bctrl runtime start",
|
|
302
|
+
"usage": "bctrl runtime start <runtimeId>"
|
|
303
|
+
},
|
|
272
304
|
"examples": [
|
|
273
305
|
{
|
|
274
|
-
"
|
|
306
|
+
"audience": "cli",
|
|
307
|
+
"command": "bctrl runtime start rt_123"
|
|
275
308
|
}
|
|
276
309
|
],
|
|
277
310
|
"next": [
|
|
278
311
|
{
|
|
312
|
+
"topic": "runs.activity.list",
|
|
279
313
|
"command": "bctrl run events <runId>"
|
|
280
314
|
}
|
|
281
315
|
]
|
package/dist/root.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import { createAiCommand } from './commands/ai/index.js';
|
|
3
|
+
import { createApiKeyCommand } from './commands/api-key/index.js';
|
|
3
4
|
import { createAuthCommand } from './commands/auth/index.js';
|
|
4
|
-
import {
|
|
5
|
+
import { createBrowserExtensionCommand } from './commands/browser-extension/index.js';
|
|
5
6
|
import { createFileCommand } from './commands/file/index.js';
|
|
6
|
-
import {
|
|
7
|
+
import { createHelpCommand } from './commands/help/index.js';
|
|
8
|
+
import { createProxyCommand } from './commands/proxy/index.js';
|
|
7
9
|
import { createRunCommand } from './commands/run/index.js';
|
|
8
10
|
import { createRuntimeCommand } from './commands/runtime/index.js';
|
|
9
11
|
import { createSpaceCommand } from './commands/space/index.js';
|
|
@@ -11,6 +13,7 @@ import { createSubaccountCommand } from './commands/subaccount/index.js';
|
|
|
11
13
|
import { createToolCommand } from './commands/tool/index.js';
|
|
12
14
|
import { createToolCallCommand } from './commands/tool-call/index.js';
|
|
13
15
|
import { createToolsetCommand } from './commands/toolset/index.js';
|
|
16
|
+
import { createUsageCommand } from './commands/usage/index.js';
|
|
14
17
|
import { createVaultCommand } from './commands/vault/index.js';
|
|
15
18
|
import { createVersionCommand } from './commands/version/version.js';
|
|
16
19
|
export function createRootCommand(factory) {
|
|
@@ -25,16 +28,19 @@ export function createRootCommand(factory) {
|
|
|
25
28
|
command.addCommand(createVersionCommand(factory));
|
|
26
29
|
command.addCommand(createAuthCommand(factory));
|
|
27
30
|
command.addCommand(createAiCommand(factory));
|
|
28
|
-
command.addCommand(
|
|
31
|
+
command.addCommand(createApiKeyCommand(factory));
|
|
32
|
+
command.addCommand(createBrowserExtensionCommand(factory));
|
|
29
33
|
command.addCommand(createFileCommand(factory));
|
|
30
|
-
command.addCommand(
|
|
34
|
+
command.addCommand(createHelpCommand(factory));
|
|
31
35
|
command.addCommand(createRunCommand(factory));
|
|
32
36
|
command.addCommand(createRuntimeCommand(factory));
|
|
37
|
+
command.addCommand(createProxyCommand(factory));
|
|
33
38
|
command.addCommand(createSpaceCommand(factory));
|
|
34
39
|
command.addCommand(createSubaccountCommand(factory));
|
|
35
40
|
command.addCommand(createToolCommand(factory));
|
|
36
41
|
command.addCommand(createToolsetCommand(factory));
|
|
37
42
|
command.addCommand(createToolCallCommand(factory));
|
|
43
|
+
command.addCommand(createUsageCommand(factory));
|
|
38
44
|
command.addCommand(createVaultCommand(factory));
|
|
39
45
|
return command;
|
|
40
46
|
}
|
package/package.json
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@bctrl/cli",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "BCTRL command-line interface",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"bin": {
|
|
7
|
-
"bctrl": "./dist/bin/bctrl.js"
|
|
8
|
-
},
|
|
9
|
-
"exports": {
|
|
10
|
-
".": {
|
|
11
|
-
"types": "./dist/index.d.ts",
|
|
12
|
-
"import": "./dist/index.js"
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
"files": [
|
|
16
|
-
"dist"
|
|
17
|
-
],
|
|
18
|
-
"scripts": {
|
|
19
|
-
"clean": "
|
|
20
|
-
"build": "pnpm run clean && tsc -p tsconfig.json",
|
|
21
|
-
"dev": "tsx src/bin/bctrl.ts",
|
|
22
|
-
"prepack": "pnpm run build",
|
|
23
|
-
"test": "tsx --test \"tests/**/*.test.ts\"",
|
|
24
|
-
"typecheck": "tsc --noEmit",
|
|
25
|
-
"typecheck:tests": "tsc --noEmit -p tests/tsconfig.json"
|
|
26
|
-
},
|
|
27
|
-
"keywords": [
|
|
28
|
-
"bctrl",
|
|
29
|
-
"cli",
|
|
30
|
-
"browser-automation",
|
|
31
|
-
"agents"
|
|
32
|
-
],
|
|
33
|
-
"author": "",
|
|
34
|
-
"license": "ISC",
|
|
35
|
-
"packageManager": "pnpm@10.12.4",
|
|
36
|
-
"dependencies": {
|
|
37
|
-
"commander": "^14.0.3",
|
|
38
|
-
"handlebars": "^4.7.9",
|
|
39
|
-
"jq-web": "^0.6.2",
|
|
40
|
-
"zod": "^4.4.3"
|
|
41
|
-
},
|
|
42
|
-
"devDependencies": {
|
|
43
|
-
"@types/node": "^25.7.0",
|
|
44
|
-
"tsx": "^4.21.0",
|
|
45
|
-
"typescript": "^6.0.3"
|
|
46
|
-
}
|
|
47
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@bctrl/cli",
|
|
3
|
+
"version": "0.1.4",
|
|
4
|
+
"description": "BCTRL command-line interface",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"bctrl": "./dist/bin/bctrl.js"
|
|
8
|
+
},
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
|
|
20
|
+
"build": "pnpm run clean && tsc -p tsconfig.json",
|
|
21
|
+
"dev": "tsx src/bin/bctrl.ts",
|
|
22
|
+
"prepack": "pnpm run build",
|
|
23
|
+
"test": "tsx --test \"tests/**/*.test.ts\"",
|
|
24
|
+
"typecheck": "tsc --noEmit",
|
|
25
|
+
"typecheck:tests": "tsc --noEmit -p tests/tsconfig.json"
|
|
26
|
+
},
|
|
27
|
+
"keywords": [
|
|
28
|
+
"bctrl",
|
|
29
|
+
"cli",
|
|
30
|
+
"browser-automation",
|
|
31
|
+
"agents"
|
|
32
|
+
],
|
|
33
|
+
"author": "",
|
|
34
|
+
"license": "ISC",
|
|
35
|
+
"packageManager": "pnpm@10.12.4",
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"commander": "^14.0.3",
|
|
38
|
+
"handlebars": "^4.7.9",
|
|
39
|
+
"jq-web": "^0.6.2",
|
|
40
|
+
"zod": "^4.4.3"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@types/node": "^25.7.0",
|
|
44
|
+
"tsx": "^4.21.0",
|
|
45
|
+
"typescript": "^6.0.3"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import { readBlob, readJsonFile } from '../shared/io.js';
|
|
3
|
-
import { addOutputFlags, outputData } from '../shared/output.js';
|
|
4
|
-
import { createDeleteCommand, createJsonBodyCommand, createListCommand, createViewCommand, } from '../shared/rest.js';
|
|
5
|
-
export function createBrowserCommand(factory) {
|
|
6
|
-
const command = new Command('browser').description('Manage browser resources');
|
|
7
|
-
command.addCommand(createBrowserExtensionCommand(factory));
|
|
8
|
-
return command;
|
|
9
|
-
}
|
|
10
|
-
function createBrowserExtensionCommand(factory) {
|
|
11
|
-
const command = new Command('extension').description('Manage browser extensions');
|
|
12
|
-
command.addCommand(createListCommand(factory, {
|
|
13
|
-
description: 'List browser extensions',
|
|
14
|
-
path: '/browser-extensions',
|
|
15
|
-
configure: (cmd) => cmd,
|
|
16
|
-
}));
|
|
17
|
-
command.addCommand(createViewCommand(factory, {
|
|
18
|
-
description: 'View a browser extension',
|
|
19
|
-
path: '/browser-extensions/{id}',
|
|
20
|
-
}));
|
|
21
|
-
command.addCommand(addOutputFlags(new Command('upload')
|
|
22
|
-
.description('Upload a browser extension package')
|
|
23
|
-
.argument('<path>'))
|
|
24
|
-
.action(async (path, options) => {
|
|
25
|
-
const client = await factory.apiClient();
|
|
26
|
-
const file = await readBlob(path);
|
|
27
|
-
const result = await client.uploadFile('/browser-extensions/upload', {
|
|
28
|
-
file: file.blob,
|
|
29
|
-
fileName: file.fileName,
|
|
30
|
-
});
|
|
31
|
-
await outputData(factory.io, result, options);
|
|
32
|
-
}));
|
|
33
|
-
command.addCommand(createJsonBodyCommand(factory, {
|
|
34
|
-
name: 'import',
|
|
35
|
-
description: 'Import a browser extension from a URL',
|
|
36
|
-
method: 'post',
|
|
37
|
-
path: '/browser-extensions/import',
|
|
38
|
-
configure: (cmd) => cmd
|
|
39
|
-
.option('--url <url>', 'Extension URL')
|
|
40
|
-
.option('--input <path>', 'Read full JSON request body from file, or - for stdin'),
|
|
41
|
-
body: async (_args, options) => {
|
|
42
|
-
if (typeof options.input === 'string') {
|
|
43
|
-
return readJsonFile(options.input);
|
|
44
|
-
}
|
|
45
|
-
return { source: { type: 'url', url: options.url } };
|
|
46
|
-
},
|
|
47
|
-
}));
|
|
48
|
-
command.addCommand(createDeleteCommand(factory, {
|
|
49
|
-
description: 'Delete a browser extension',
|
|
50
|
-
path: '/browser-extensions/{id}',
|
|
51
|
-
}));
|
|
52
|
-
return command;
|
|
53
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import { readJsonFile } from '../shared/io.js';
|
|
3
|
-
import { addOutputFlags } from '../shared/output.js';
|
|
4
|
-
import { createJsonBodyCommand, createViewCommand, requestAndPrint } from '../shared/rest.js';
|
|
5
|
-
export function createInvocationCommand(factory) {
|
|
6
|
-
const command = new Command('invocation')
|
|
7
|
-
.description('Inspect and control BCTRL invocations');
|
|
8
|
-
command.addCommand(createViewCommand(factory, {
|
|
9
|
-
description: 'View an invocation',
|
|
10
|
-
path: '/invocations/{id}',
|
|
11
|
-
}));
|
|
12
|
-
command.addCommand(createJsonBodyCommand(factory, {
|
|
13
|
-
name: 'wait',
|
|
14
|
-
description: 'Wait for an invocation',
|
|
15
|
-
method: 'post',
|
|
16
|
-
path: '/invocations/{id}/wait',
|
|
17
|
-
argNames: ['id'],
|
|
18
|
-
configure: (cmd) => cmd
|
|
19
|
-
.option('--timeout-ms <ms>', 'Timeout in milliseconds')
|
|
20
|
-
.option('--input <path>', 'Read JSON request body from file, or - for stdin'),
|
|
21
|
-
body: async (_args, options) => {
|
|
22
|
-
if (typeof options.input === 'string')
|
|
23
|
-
return readJsonFile(options.input);
|
|
24
|
-
return { timeoutMs: options.timeoutMs ? Number(options.timeoutMs) : undefined };
|
|
25
|
-
},
|
|
26
|
-
}));
|
|
27
|
-
command.addCommand(addOutputFlags(new Command('cancel')
|
|
28
|
-
.description('Cancel an invocation')
|
|
29
|
-
.argument('<id>'))
|
|
30
|
-
.action(async (id, options) => {
|
|
31
|
-
await requestAndPrint(factory, 'post', `/invocations/${encodeURIComponent(id)}/cancel`, {
|
|
32
|
-
output: options,
|
|
33
|
-
});
|
|
34
|
-
}));
|
|
35
|
-
return command;
|
|
36
|
-
}
|