@bctrl/cli 0.1.8 → 0.1.9
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 +18 -94
- package/dist/api/client.d.ts +1 -0
- package/dist/api/client.js +1 -0
- package/dist/api/errors.js +2 -2
- package/dist/commands/{vault → account}/index.d.ts +1 -1
- package/dist/commands/account/index.js +21 -0
- package/dist/commands/ai/index.js +13 -8
- package/dist/commands/api-key/index.js +1 -1
- package/dist/commands/browser-extension/index.js +8 -8
- package/dist/commands/conversation/index.d.ts +3 -0
- package/dist/commands/conversation/index.js +51 -0
- package/dist/commands/file/index.js +8 -3
- package/dist/commands/run/index.js +23 -292
- package/dist/commands/runtime/index.js +32 -453
- package/dist/commands/shared/operation.d.ts +3 -0
- package/dist/commands/shared/operation.js +20 -7
- package/dist/commands/space/index.js +0 -25
- package/dist/commands/subaccount/index.js +2 -2
- package/dist/commands/tool/index.js +15 -5
- package/dist/commands/tool-call/index.js +22 -6
- package/dist/commands/toolset/index.js +1 -1
- package/dist/commands/view/index.d.ts +3 -0
- package/dist/commands/view/index.js +26 -0
- package/dist/commands/webhook/index.d.ts +3 -0
- package/dist/commands/webhook/index.js +64 -0
- package/dist/generated/help.d.ts +4896 -5977
- package/dist/generated/help.js +6208 -7532
- package/dist/generated/openapi-routes.d.ts +114 -142
- package/dist/generated/openapi-routes.js +37 -44
- package/dist/generated/openapi-types.d.ts +4451 -5302
- package/dist/root.js +8 -2
- package/package.json +1 -1
- package/dist/commands/vault/index.js +0 -171
package/dist/root.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import { createAiCommand } from './commands/ai/index.js';
|
|
3
|
+
import { createAccountCommand } from './commands/account/index.js';
|
|
3
4
|
import { createApiKeyCommand } from './commands/api-key/index.js';
|
|
4
5
|
import { createAuthCommand } from './commands/auth/index.js';
|
|
5
6
|
import { createBrowserExtensionCommand } from './commands/browser-extension/index.js';
|
|
7
|
+
import { createConversationCommand } from './commands/conversation/index.js';
|
|
6
8
|
import { createFileCommand } from './commands/file/index.js';
|
|
7
9
|
import { createHelpCommand } from './commands/help/index.js';
|
|
8
10
|
import { createNotificationRecipientCommand } from './commands/notification-recipient/index.js';
|
|
@@ -15,8 +17,9 @@ import { createToolCommand } from './commands/tool/index.js';
|
|
|
15
17
|
import { createToolCallCommand } from './commands/tool-call/index.js';
|
|
16
18
|
import { createToolsetCommand } from './commands/toolset/index.js';
|
|
17
19
|
import { createUsageCommand } from './commands/usage/index.js';
|
|
18
|
-
import {
|
|
20
|
+
import { createViewsCommand } from './commands/view/index.js';
|
|
19
21
|
import { createVersionCommand } from './commands/version/version.js';
|
|
22
|
+
import { createWebhookCommand } from './commands/webhook/index.js';
|
|
20
23
|
export function createRootCommand(factory) {
|
|
21
24
|
const command = new Command();
|
|
22
25
|
command
|
|
@@ -27,10 +30,12 @@ export function createRootCommand(factory) {
|
|
|
27
30
|
.showSuggestionAfterError()
|
|
28
31
|
.option('--no-color', 'Disable color output');
|
|
29
32
|
command.addCommand(createVersionCommand(factory));
|
|
33
|
+
command.addCommand(createAccountCommand(factory));
|
|
30
34
|
command.addCommand(createAuthCommand(factory));
|
|
31
35
|
command.addCommand(createAiCommand(factory));
|
|
32
36
|
command.addCommand(createApiKeyCommand(factory));
|
|
33
37
|
command.addCommand(createBrowserExtensionCommand(factory));
|
|
38
|
+
command.addCommand(createConversationCommand(factory));
|
|
34
39
|
command.addCommand(createFileCommand(factory));
|
|
35
40
|
command.addCommand(createHelpCommand(factory));
|
|
36
41
|
command.addCommand(createNotificationRecipientCommand(factory));
|
|
@@ -43,6 +48,7 @@ export function createRootCommand(factory) {
|
|
|
43
48
|
command.addCommand(createToolsetCommand(factory));
|
|
44
49
|
command.addCommand(createToolCallCommand(factory));
|
|
45
50
|
command.addCommand(createUsageCommand(factory));
|
|
46
|
-
command.addCommand(
|
|
51
|
+
command.addCommand(createViewsCommand(factory));
|
|
52
|
+
command.addCommand(createWebhookCommand(factory));
|
|
47
53
|
return command;
|
|
48
54
|
}
|
package/package.json
CHANGED
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import { CliError } from '../../runtime/errors.js';
|
|
3
|
-
import { readText } from '../shared/io.js';
|
|
4
|
-
import { parsePositiveInteger } from '../shared/options.js';
|
|
5
|
-
import { addOutputFlags } from '../shared/output.js';
|
|
6
|
-
import { buildOperationInput, createOperationDeleteCommand, createOperationJsonBodyCommand, createOperationListCommand, createOperationViewCommand, outputFlags, requestOperationAndPrint, } from '../shared/operation.js';
|
|
7
|
-
export function createVaultCommand(factory) {
|
|
8
|
-
const command = new Command('vault').description('Manage vault secrets and TOTP codes');
|
|
9
|
-
command.addCommand(createOperationListCommand(factory, {
|
|
10
|
-
operationId: 'vault.secrets.list',
|
|
11
|
-
description: 'List vault secret metadata',
|
|
12
|
-
configure: (cmd) => cmd
|
|
13
|
-
.option('--prefix <prefix>', 'Filter by secret key prefix')
|
|
14
|
-
.option('--origin <origin>', 'Filter by origin')
|
|
15
|
-
.option('--has-totp', 'Only show secrets with TOTP')
|
|
16
|
-
.option('-L, --limit <number>', 'Maximum number of results to return', parsePositiveInteger),
|
|
17
|
-
query: (options) => ({
|
|
18
|
-
prefix: typeof options.prefix === 'string' ? options.prefix : undefined,
|
|
19
|
-
origin: typeof options.origin === 'string' ? options.origin : undefined,
|
|
20
|
-
hasTotp: options.hasTotp === true ? true : undefined,
|
|
21
|
-
limit: typeof options.limit === 'number' ? options.limit : undefined,
|
|
22
|
-
}),
|
|
23
|
-
}));
|
|
24
|
-
command.addCommand(createOperationViewCommand(factory, {
|
|
25
|
-
operationId: 'vault.secrets.get',
|
|
26
|
-
name: 'get',
|
|
27
|
-
description: 'View vault secret metadata',
|
|
28
|
-
argName: 'key',
|
|
29
|
-
}));
|
|
30
|
-
command.addCommand(createVaultReadCommand(factory));
|
|
31
|
-
command.addCommand(createVaultSetCommand(factory));
|
|
32
|
-
command.addCommand(createVaultPatchCommand(factory));
|
|
33
|
-
command.addCommand(createOperationDeleteCommand(factory, {
|
|
34
|
-
operationId: 'vault.secrets.delete',
|
|
35
|
-
description: 'Delete a vault secret',
|
|
36
|
-
argNames: ['key'],
|
|
37
|
-
}));
|
|
38
|
-
command.addCommand(createVaultTotpCommand(factory));
|
|
39
|
-
return command;
|
|
40
|
-
}
|
|
41
|
-
function createVaultReadCommand(factory) {
|
|
42
|
-
return addOutputFlags(new Command('read')
|
|
43
|
-
.description('Read a vault secret value')
|
|
44
|
-
.argument('<key>')
|
|
45
|
-
.option('--reveal', 'Allow printing a secret to an interactive terminal')
|
|
46
|
-
.option('--params <json>', 'Path/query parameters as a JSON object (inline, @file, or - for stdin)')).action(async (key, options) => {
|
|
47
|
-
if (factory.io.isStdoutTTY() && options.reveal !== true) {
|
|
48
|
-
throw new CliError('Refusing to print a secret to a terminal without --reveal');
|
|
49
|
-
}
|
|
50
|
-
await requestOperationAndPrint(factory, 'vault.secrets.value', await buildOperationInput('vault.secrets.value', options, {
|
|
51
|
-
pathParams: { key },
|
|
52
|
-
output: outputFlags(options),
|
|
53
|
-
}));
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
function createVaultSetCommand(factory) {
|
|
57
|
-
return createOperationJsonBodyCommand(factory, {
|
|
58
|
-
operationId: 'vault.secrets.upsert',
|
|
59
|
-
name: 'set',
|
|
60
|
-
description: 'Create or replace a vault secret',
|
|
61
|
-
argNames: ['key'],
|
|
62
|
-
configure: (cmd) => cmd
|
|
63
|
-
.option('--type <type>', 'Secret type: login or value')
|
|
64
|
-
.option('--value <value>', 'Generic secret value')
|
|
65
|
-
.option('--value-from-file <path>', 'Read generic secret value from file, or - for stdin')
|
|
66
|
-
.option('--username <value>', 'Credential username')
|
|
67
|
-
.option('--password <value>', 'Credential password')
|
|
68
|
-
.option('--password-from-file <path>', 'Read password from file, or - for stdin')
|
|
69
|
-
.option('--totp-secret <secret>', 'TOTP seed')
|
|
70
|
-
.option('--label <label>', 'Display label')
|
|
71
|
-
.option('--origin <origin...>', 'Allowed origin')
|
|
72
|
-
.option('--origin-pattern <pattern...>', 'Allowed origin pattern'),
|
|
73
|
-
body: async (args, options) => {
|
|
74
|
-
const password = typeof options.passwordFromFile === 'string'
|
|
75
|
-
? (await readText(options.passwordFromFile)).trimEnd()
|
|
76
|
-
: options.password;
|
|
77
|
-
const value = typeof options.valueFromFile === 'string'
|
|
78
|
-
? (await readText(options.valueFromFile)).trimEnd()
|
|
79
|
-
: options.value;
|
|
80
|
-
const common = {
|
|
81
|
-
label: options.label,
|
|
82
|
-
origins: options.origin,
|
|
83
|
-
originPatterns: options.originPattern,
|
|
84
|
-
};
|
|
85
|
-
const type = options.type === 'value' || options.type === 'login'
|
|
86
|
-
? options.type
|
|
87
|
-
: typeof value === 'string'
|
|
88
|
-
? 'value'
|
|
89
|
-
: 'login';
|
|
90
|
-
if (typeof options.type === 'string' &&
|
|
91
|
-
options.type !== 'value' &&
|
|
92
|
-
options.type !== 'login') {
|
|
93
|
-
throw new CliError('Vault secret type must be "login" or "value"');
|
|
94
|
-
}
|
|
95
|
-
if (type === 'value') {
|
|
96
|
-
if (typeof value !== 'string') {
|
|
97
|
-
throw new CliError('Vault value secrets require --value, --value-from-file, or --body');
|
|
98
|
-
}
|
|
99
|
-
return {
|
|
100
|
-
...common,
|
|
101
|
-
type: 'value',
|
|
102
|
-
value,
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
if (typeof options.username !== 'string' || typeof password !== 'string') {
|
|
106
|
-
throw new CliError('Vault login secrets require --username and --password, --password-from-file, or --body');
|
|
107
|
-
}
|
|
108
|
-
return {
|
|
109
|
-
...common,
|
|
110
|
-
type: 'login',
|
|
111
|
-
username: options.username,
|
|
112
|
-
password,
|
|
113
|
-
totpSecret: options.totpSecret,
|
|
114
|
-
};
|
|
115
|
-
},
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
function createVaultPatchCommand(factory) {
|
|
119
|
-
return createOperationJsonBodyCommand(factory, {
|
|
120
|
-
operationId: 'vault.secrets.update',
|
|
121
|
-
name: 'patch',
|
|
122
|
-
description: 'Update a vault secret',
|
|
123
|
-
argNames: ['key'],
|
|
124
|
-
configure: (cmd) => cmd
|
|
125
|
-
.option('--value <value>', 'Generic secret value')
|
|
126
|
-
.option('--value-from-file <path>', 'Read generic secret value from file, or - for stdin')
|
|
127
|
-
.option('--username <value>', 'Credential username')
|
|
128
|
-
.option('--password <value>', 'Credential password')
|
|
129
|
-
.option('--password-from-file <path>', 'Read password from file, or - for stdin')
|
|
130
|
-
.option('--totp-secret <secret>', 'TOTP seed')
|
|
131
|
-
.option('--clear-totp', 'Remove the TOTP seed')
|
|
132
|
-
.option('--label <label>', 'Display label')
|
|
133
|
-
.option('--clear-label', 'Remove the display label')
|
|
134
|
-
.option('--origin <origin...>', 'Allowed origin')
|
|
135
|
-
.option('--clear-origins', 'Remove origins')
|
|
136
|
-
.option('--origin-pattern <pattern...>', 'Allowed origin pattern')
|
|
137
|
-
.option('--clear-origin-patterns', 'Remove origin patterns'),
|
|
138
|
-
body: async (_args, options) => {
|
|
139
|
-
const password = typeof options.passwordFromFile === 'string'
|
|
140
|
-
? (await readText(options.passwordFromFile)).trimEnd()
|
|
141
|
-
: options.password;
|
|
142
|
-
const value = typeof options.valueFromFile === 'string'
|
|
143
|
-
? (await readText(options.valueFromFile)).trimEnd()
|
|
144
|
-
: options.value;
|
|
145
|
-
const body = {
|
|
146
|
-
value,
|
|
147
|
-
username: options.username,
|
|
148
|
-
password,
|
|
149
|
-
totpSecret: options.clearTotp === true ? null : options.totpSecret,
|
|
150
|
-
label: options.clearLabel === true ? null : options.label,
|
|
151
|
-
origins: options.clearOrigins === true ? null : options.origin,
|
|
152
|
-
originPatterns: options.clearOriginPatterns === true ? null : options.originPattern,
|
|
153
|
-
};
|
|
154
|
-
if (!Object.values(body).some((value) => value !== undefined)) {
|
|
155
|
-
throw new CliError('Vault patch requires at least one field or --body');
|
|
156
|
-
}
|
|
157
|
-
return body;
|
|
158
|
-
},
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
function createVaultTotpCommand(factory) {
|
|
162
|
-
return addOutputFlags(new Command('totp')
|
|
163
|
-
.description('Generate the current TOTP code for a vault secret')
|
|
164
|
-
.argument('<key>')
|
|
165
|
-
.option('--params <json>', 'Path/query parameters as a JSON object (inline, @file, or - for stdin)')).action(async (key, options) => {
|
|
166
|
-
await requestOperationAndPrint(factory, 'vault.secrets.totp', await buildOperationInput('vault.secrets.totp', options, {
|
|
167
|
-
pathParams: { key },
|
|
168
|
-
output: outputFlags(options),
|
|
169
|
-
}));
|
|
170
|
-
});
|
|
171
|
-
}
|