@bctrl/cli 0.1.4 → 0.1.6
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/dist/commands/ai/index.js +29 -21
- package/dist/commands/api-key/index.js +10 -10
- package/dist/commands/browser-extension/index.js +18 -19
- package/dist/commands/file/index.js +17 -18
- package/dist/commands/help/index.js +3 -3
- package/dist/commands/proxy/index.js +26 -20
- package/dist/commands/run/index.js +44 -27
- package/dist/commands/runtime/index.js +159 -130
- package/dist/commands/shared/help.d.ts +1 -0
- package/dist/commands/shared/help.js +9 -5
- package/dist/commands/shared/operation.d.ts +83 -0
- package/dist/commands/shared/{rest.js → operation.js} +87 -46
- package/dist/commands/space/index.js +61 -52
- package/dist/commands/space/list.js +14 -13
- package/dist/commands/subaccount/index.js +35 -53
- package/dist/commands/tool/index.js +18 -20
- package/dist/commands/tool-call/index.js +5 -5
- package/dist/commands/toolset/index.js +11 -13
- package/dist/commands/usage/index.js +3 -3
- package/dist/commands/vault/index.js +23 -21
- package/dist/generated/help.d.ts +5990 -128
- package/dist/generated/help.js +7905 -221
- package/dist/generated/openapi-routes.d.ts +391 -0
- package/dist/generated/openapi-routes.js +100 -0
- package/dist/generated/openapi-types.d.ts +13830 -0
- package/dist/generated/openapi-types.js +5 -0
- package/dist/openapi.d.ts +20 -0
- package/dist/openapi.js +1 -0
- package/package.json +1 -1
- package/dist/commands/shared/rest.d.ts +0 -55
|
@@ -1,36 +1,34 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
|
-
import {
|
|
2
|
+
import { createOperationDeleteCommand, createOperationJsonBodyCommand, createOperationListCommand, createOperationViewCommand, } from '../shared/operation.js';
|
|
3
3
|
export function createToolsetCommand(factory) {
|
|
4
4
|
const command = new Command('toolset').description('Manage BCTRL toolsets');
|
|
5
|
-
command.addCommand(
|
|
5
|
+
command.addCommand(createOperationListCommand(factory, {
|
|
6
|
+
operationId: 'toolsets.list',
|
|
6
7
|
description: 'List toolsets',
|
|
7
|
-
path: '/toolsets',
|
|
8
8
|
configure: (cmd) => cmd.option('--space <id>', 'Filter by space id'),
|
|
9
9
|
query: (options) => ({
|
|
10
10
|
spaceId: typeof options.space === 'string' ? options.space : undefined,
|
|
11
11
|
}),
|
|
12
12
|
}));
|
|
13
|
-
command.addCommand(
|
|
13
|
+
command.addCommand(createOperationViewCommand(factory, {
|
|
14
|
+
operationId: 'toolsets.get',
|
|
14
15
|
name: 'get',
|
|
15
16
|
description: 'View a toolset',
|
|
16
|
-
path: '/toolsets/{id}',
|
|
17
17
|
}));
|
|
18
|
-
command.addCommand(
|
|
18
|
+
command.addCommand(createOperationJsonBodyCommand(factory, {
|
|
19
|
+
operationId: 'toolsets.create',
|
|
19
20
|
name: 'create',
|
|
20
21
|
description: 'Create a toolset',
|
|
21
|
-
method: 'post',
|
|
22
|
-
path: '/toolsets',
|
|
23
22
|
}));
|
|
24
|
-
command.addCommand(
|
|
23
|
+
command.addCommand(createOperationJsonBodyCommand(factory, {
|
|
24
|
+
operationId: 'toolsets.update',
|
|
25
25
|
name: 'patch',
|
|
26
26
|
description: 'Edit a toolset',
|
|
27
|
-
method: 'patch',
|
|
28
|
-
path: '/toolsets/{id}',
|
|
29
27
|
argNames: ['id'],
|
|
30
28
|
}));
|
|
31
|
-
command.addCommand(
|
|
29
|
+
command.addCommand(createOperationDeleteCommand(factory, {
|
|
30
|
+
operationId: 'toolsets.delete',
|
|
32
31
|
description: 'Delete a toolset',
|
|
33
|
-
path: '/toolsets/{id}',
|
|
34
32
|
}));
|
|
35
33
|
return command;
|
|
36
34
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import { addOutputFlags } from '../shared/output.js';
|
|
3
|
-
import {
|
|
3
|
+
import { outputFlags, requestOperationAndPrint } from '../shared/operation.js';
|
|
4
4
|
export function createUsageCommand(factory) {
|
|
5
5
|
const command = addOutputFlags(new Command('usage').description('Get organization usage'));
|
|
6
6
|
command.action(async (options) => {
|
|
7
|
-
await
|
|
7
|
+
await requestOperationAndPrint(factory, 'usage.get', { output: outputFlags(options) });
|
|
8
8
|
});
|
|
9
9
|
command.addCommand(addOutputFlags(new Command('get').description('Get organization usage')).action(async (options) => {
|
|
10
|
-
await
|
|
10
|
+
await requestOperationAndPrint(factory, 'usage.get', { output: outputFlags(options) });
|
|
11
11
|
}));
|
|
12
12
|
return command;
|
|
13
13
|
}
|
|
@@ -3,12 +3,12 @@ import { CliError } from '../../runtime/errors.js';
|
|
|
3
3
|
import { readJsonFile, readText } from '../shared/io.js';
|
|
4
4
|
import { parsePositiveInteger } from '../shared/options.js';
|
|
5
5
|
import { addOutputFlags } from '../shared/output.js';
|
|
6
|
-
import {
|
|
6
|
+
import { createOperationDeleteCommand, createOperationJsonBodyCommand, createOperationListCommand, createOperationViewCommand, outputFlags, requestOperationAndPrint, } from '../shared/operation.js';
|
|
7
7
|
export function createVaultCommand(factory) {
|
|
8
8
|
const command = new Command('vault').description('Manage vault secrets and TOTP codes');
|
|
9
|
-
command.addCommand(
|
|
9
|
+
command.addCommand(createOperationListCommand(factory, {
|
|
10
|
+
operationId: 'vault.secrets.list',
|
|
10
11
|
description: 'List vault secret metadata',
|
|
11
|
-
path: '/vault/secrets',
|
|
12
12
|
configure: (cmd) => cmd
|
|
13
13
|
.option('--prefix <prefix>', 'Filter by secret key prefix')
|
|
14
14
|
.option('--origin <origin>', 'Filter by origin')
|
|
@@ -21,18 +21,18 @@ export function createVaultCommand(factory) {
|
|
|
21
21
|
limit: typeof options.limit === 'number' ? options.limit : undefined,
|
|
22
22
|
}),
|
|
23
23
|
}));
|
|
24
|
-
command.addCommand(
|
|
24
|
+
command.addCommand(createOperationViewCommand(factory, {
|
|
25
|
+
operationId: 'vault.secrets.get',
|
|
25
26
|
name: 'get',
|
|
26
27
|
description: 'View vault secret metadata',
|
|
27
|
-
path: '/vault/secrets/{key}',
|
|
28
28
|
argName: 'key',
|
|
29
29
|
}));
|
|
30
30
|
command.addCommand(createVaultReadCommand(factory));
|
|
31
31
|
command.addCommand(createVaultSetCommand(factory));
|
|
32
32
|
command.addCommand(createVaultPatchCommand(factory));
|
|
33
|
-
command.addCommand(
|
|
33
|
+
command.addCommand(createOperationDeleteCommand(factory, {
|
|
34
|
+
operationId: 'vault.secrets.delete',
|
|
34
35
|
description: 'Delete a vault secret',
|
|
35
|
-
path: '/vault/secrets/{key}',
|
|
36
36
|
argNames: ['key'],
|
|
37
37
|
}));
|
|
38
38
|
command.addCommand(createVaultTotpCommand(factory));
|
|
@@ -46,17 +46,17 @@ function createVaultReadCommand(factory) {
|
|
|
46
46
|
if (factory.io.isStdoutTTY() && options.reveal !== true) {
|
|
47
47
|
throw new CliError('Refusing to print a secret to a terminal without --reveal');
|
|
48
48
|
}
|
|
49
|
-
await
|
|
50
|
-
|
|
49
|
+
await requestOperationAndPrint(factory, 'vault.secrets.value', {
|
|
50
|
+
pathParams: { key },
|
|
51
|
+
output: outputFlags(options),
|
|
51
52
|
});
|
|
52
53
|
});
|
|
53
54
|
}
|
|
54
55
|
function createVaultSetCommand(factory) {
|
|
55
|
-
return
|
|
56
|
+
return createOperationJsonBodyCommand(factory, {
|
|
57
|
+
operationId: 'vault.secrets.upsert',
|
|
56
58
|
name: 'set',
|
|
57
59
|
description: 'Create or replace a vault secret',
|
|
58
|
-
method: 'put',
|
|
59
|
-
path: '/vault/secrets/{key}',
|
|
60
60
|
argNames: ['key'],
|
|
61
61
|
configure: (cmd) => cmd
|
|
62
62
|
.option('--type <type>', 'Secret type: login or value')
|
|
@@ -71,8 +71,9 @@ function createVaultSetCommand(factory) {
|
|
|
71
71
|
.option('--origin-pattern <pattern...>', 'Allowed origin pattern')
|
|
72
72
|
.option('--input <path>', 'Read full JSON request body from file, or - for stdin'),
|
|
73
73
|
body: async (args, options) => {
|
|
74
|
-
if (typeof options.input === 'string')
|
|
75
|
-
return readJsonFile(options.input);
|
|
74
|
+
if (typeof options.input === 'string') {
|
|
75
|
+
return (await readJsonFile(options.input));
|
|
76
|
+
}
|
|
76
77
|
const password = typeof options.passwordFromFile === 'string'
|
|
77
78
|
? (await readText(options.passwordFromFile)).trimEnd()
|
|
78
79
|
: options.password;
|
|
@@ -118,11 +119,10 @@ function createVaultSetCommand(factory) {
|
|
|
118
119
|
});
|
|
119
120
|
}
|
|
120
121
|
function createVaultPatchCommand(factory) {
|
|
121
|
-
return
|
|
122
|
+
return createOperationJsonBodyCommand(factory, {
|
|
123
|
+
operationId: 'vault.secrets.update',
|
|
122
124
|
name: 'patch',
|
|
123
125
|
description: 'Update a vault secret',
|
|
124
|
-
method: 'patch',
|
|
125
|
-
path: '/vault/secrets/{key}',
|
|
126
126
|
argNames: ['key'],
|
|
127
127
|
configure: (cmd) => cmd
|
|
128
128
|
.option('--value <value>', 'Generic secret value')
|
|
@@ -140,8 +140,9 @@ function createVaultPatchCommand(factory) {
|
|
|
140
140
|
.option('--clear-origin-patterns', 'Remove origin patterns')
|
|
141
141
|
.option('--input <path>', 'Read full JSON request body from file, or - for stdin'),
|
|
142
142
|
body: async (_args, options) => {
|
|
143
|
-
if (typeof options.input === 'string')
|
|
144
|
-
return readJsonFile(options.input);
|
|
143
|
+
if (typeof options.input === 'string') {
|
|
144
|
+
return (await readJsonFile(options.input));
|
|
145
|
+
}
|
|
145
146
|
const password = typeof options.passwordFromFile === 'string'
|
|
146
147
|
? (await readText(options.passwordFromFile)).trimEnd()
|
|
147
148
|
: options.password;
|
|
@@ -168,8 +169,9 @@ function createVaultTotpCommand(factory) {
|
|
|
168
169
|
return addOutputFlags(new Command('totp')
|
|
169
170
|
.description('Generate the current TOTP code for a vault secret')
|
|
170
171
|
.argument('<key>')).action(async (key, options) => {
|
|
171
|
-
await
|
|
172
|
-
|
|
172
|
+
await requestOperationAndPrint(factory, 'vault.secrets.totp', {
|
|
173
|
+
pathParams: { key },
|
|
174
|
+
output: outputFlags(options),
|
|
173
175
|
});
|
|
174
176
|
});
|
|
175
177
|
}
|