bdy 1.25.32-dev → 1.25.34-dev
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/distTs/package.json +1 -1
- package/distTs/src/api/client.js +111 -0
- package/distTs/src/cliIndex.js +2 -0
- package/distTs/src/command/integration/exec/call.js +89 -0
- package/distTs/src/command/integration/exec/kill.js +35 -0
- package/distTs/src/command/integration/exec/list.js +50 -0
- package/distTs/src/command/integration/exec/logs.js +39 -0
- package/distTs/src/command/integration/exec/status.js +40 -0
- package/distTs/src/command/integration/exec/tool.js +47 -0
- package/distTs/src/command/integration/exec/tools.js +39 -0
- package/distTs/src/command/integration/exec.js +30 -0
- package/distTs/src/command/integration/mcp.js +221 -0
- package/distTs/src/command/integration.js +2 -0
- package/distTs/src/command/variable/create.js +55 -0
- package/distTs/src/command/variable/delete.js +37 -0
- package/distTs/src/command/variable/get.js +51 -0
- package/distTs/src/command/variable/list.js +56 -0
- package/distTs/src/command/variable/scope.js +161 -0
- package/distTs/src/command/variable/update.js +92 -0
- package/distTs/src/command/variable.js +20 -0
- package/distTs/src/input.js +65 -0
- package/distTs/src/texts.js +272 -28
- package/distTs/src/utils.js +15 -3
- package/package.json +1 -1
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const utils_1 = require("../../utils");
|
|
7
|
+
const texts_1 = require("../../texts");
|
|
8
|
+
const output_1 = __importDefault(require("../../output"));
|
|
9
|
+
const input_1 = __importDefault(require("../../input"));
|
|
10
|
+
const cliError_1 = __importDefault(require("../../cliError"));
|
|
11
|
+
const scope_1 = require("./scope");
|
|
12
|
+
const commandVariableUpdate = (0, utils_1.newCommand)('update', texts_1.DESC_COMMAND_VARIABLE_UPDATE, {
|
|
13
|
+
requiredScopes: [utils_1.REST_API_SCOPE.VARIABLE_WRITE],
|
|
14
|
+
examples: texts_1.EXAMPLE_VARIABLE_UPDATE,
|
|
15
|
+
});
|
|
16
|
+
commandVariableUpdate.alias('edit');
|
|
17
|
+
commandVariableUpdate.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
18
|
+
commandVariableUpdate.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
19
|
+
commandVariableUpdate.option('--pipeline <identifier>', texts_1.OPTION_VARIABLE_PIPELINE);
|
|
20
|
+
commandVariableUpdate.option('--environment <identifier>', texts_1.OPTION_VARIABLE_ENVIRONMENT);
|
|
21
|
+
commandVariableUpdate.option('--sandbox <identifier>', texts_1.OPTION_VARIABLE_SANDBOX);
|
|
22
|
+
commandVariableUpdate.option('--scope <scope>', texts_1.OPT_COMMAND_VARIABLE_SCOPE);
|
|
23
|
+
commandVariableUpdate.option('--file <path>', texts_1.OPTION_VARIABLE_FILE);
|
|
24
|
+
commandVariableUpdate.option('--key <key>', texts_1.OPTION_VARIABLE_RENAME);
|
|
25
|
+
commandVariableUpdate.option('--encrypted', texts_1.OPTION_VARIABLE_ENCRYPTED);
|
|
26
|
+
commandVariableUpdate.option('--no-encrypted', texts_1.OPTION_VARIABLE_NO_ENCRYPTED);
|
|
27
|
+
commandVariableUpdate.option('--settable', texts_1.OPTION_VARIABLE_SETTABLE);
|
|
28
|
+
commandVariableUpdate.option('--no-settable', texts_1.OPTION_VARIABLE_NO_SETTABLE);
|
|
29
|
+
commandVariableUpdate.option('--enable', texts_1.OPTION_VARIABLE_ENABLE);
|
|
30
|
+
commandVariableUpdate.option('--disable', texts_1.OPTION_VARIABLE_DISABLE);
|
|
31
|
+
commandVariableUpdate.option('--note <note>', texts_1.OPT_COMMAND_NOTE);
|
|
32
|
+
commandVariableUpdate.option('--agent-note <note>', texts_1.OPT_COMMAND_AGENT_NOTE);
|
|
33
|
+
commandVariableUpdate.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
34
|
+
commandVariableUpdate.argument('<key>', texts_1.OPTION_VARIABLE_KEY);
|
|
35
|
+
commandVariableUpdate.argument('[value]', texts_1.OPTION_VARIABLE_VALUE);
|
|
36
|
+
// Only what was passed changes; the rest of the stored variable is re-sent
|
|
37
|
+
// (variableUpdateBody), as the PATCH resets fields left out. A value left out
|
|
38
|
+
// stays as stored.
|
|
39
|
+
commandVariableUpdate.action(async (key, value, options) => {
|
|
40
|
+
if (options.enable && options.disable) {
|
|
41
|
+
output_1.default.exitError(texts_1.ERR_VARIABLE_ENABLE_DISABLE);
|
|
42
|
+
}
|
|
43
|
+
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
44
|
+
const newValue = input_1.default.variableValue(value, options.file);
|
|
45
|
+
// The API answers turning encryption off without a value by clearing it
|
|
46
|
+
if (options.encrypted === false && newValue === undefined) {
|
|
47
|
+
output_1.default.exitError(new cliError_1.default('usage_error', texts_1.ERR_VARIABLE_DECRYPT_NO_VALUE));
|
|
48
|
+
}
|
|
49
|
+
const changes = {};
|
|
50
|
+
let changed = false;
|
|
51
|
+
if (options.key && options.key !== key) {
|
|
52
|
+
changes.key = options.key;
|
|
53
|
+
changed = true;
|
|
54
|
+
}
|
|
55
|
+
if (newValue !== undefined) {
|
|
56
|
+
changes.value = newValue;
|
|
57
|
+
changed = true;
|
|
58
|
+
}
|
|
59
|
+
if (options.encrypted !== undefined) {
|
|
60
|
+
changes.encrypted = options.encrypted;
|
|
61
|
+
changed = true;
|
|
62
|
+
}
|
|
63
|
+
if (options.settable !== undefined) {
|
|
64
|
+
changes.settable = options.settable;
|
|
65
|
+
changed = true;
|
|
66
|
+
}
|
|
67
|
+
if (options.enable || options.disable) {
|
|
68
|
+
changes.disabled = !!options.disable;
|
|
69
|
+
changed = true;
|
|
70
|
+
}
|
|
71
|
+
if (options.note !== undefined) {
|
|
72
|
+
changes.note = options.note;
|
|
73
|
+
changed = true;
|
|
74
|
+
}
|
|
75
|
+
if (options.agentNote !== undefined) {
|
|
76
|
+
changes.agent_note = options.agentNote;
|
|
77
|
+
changed = true;
|
|
78
|
+
}
|
|
79
|
+
if (!changed) {
|
|
80
|
+
output_1.default.exitError(texts_1.ERR_COMMAND_NO_UPDATE);
|
|
81
|
+
}
|
|
82
|
+
const client = input_1.default.restApiTokenClient();
|
|
83
|
+
const { variable, scope } = await (0, scope_1.resolveVariable)(client, workspace, key, options,
|
|
84
|
+
/* strictScope */ true);
|
|
85
|
+
const result = await client.updateVariable(workspace, variable.id, (0, scope_1.variableUpdateBody)(variable, changes));
|
|
86
|
+
if (options.format === 'json') {
|
|
87
|
+
output_1.default.json(result);
|
|
88
|
+
output_1.default.exitNormal();
|
|
89
|
+
}
|
|
90
|
+
output_1.default.exitSuccess((0, texts_1.TXT_VARIABLE_UPDATED)(result.key, scope));
|
|
91
|
+
});
|
|
92
|
+
exports.default = commandVariableUpdate;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const utils_1 = require("../utils");
|
|
7
|
+
const texts_1 = require("../texts");
|
|
8
|
+
const list_1 = __importDefault(require("./variable/list"));
|
|
9
|
+
const get_1 = __importDefault(require("./variable/get"));
|
|
10
|
+
const create_1 = __importDefault(require("./variable/create"));
|
|
11
|
+
const update_1 = __importDefault(require("./variable/update"));
|
|
12
|
+
const delete_1 = __importDefault(require("./variable/delete"));
|
|
13
|
+
const commandVariable = (0, utils_1.newCommand)('variable', texts_1.DESC_COMMAND_VARIABLE);
|
|
14
|
+
commandVariable.alias('var');
|
|
15
|
+
commandVariable.addCommand(list_1.default);
|
|
16
|
+
commandVariable.addCommand(get_1.default);
|
|
17
|
+
commandVariable.addCommand(create_1.default);
|
|
18
|
+
commandVariable.addCommand(update_1.default);
|
|
19
|
+
commandVariable.addCommand(delete_1.default);
|
|
20
|
+
exports.default = commandVariable;
|
package/distTs/src/input.js
CHANGED
|
@@ -1470,6 +1470,71 @@ class Input {
|
|
|
1470
1470
|
environment,
|
|
1471
1471
|
};
|
|
1472
1472
|
}
|
|
1473
|
+
// Variables live on one of the target lines or on a sandbox, which is its
|
|
1474
|
+
// own line: a sandbox belongs to a project (narrowing the lookup) or the
|
|
1475
|
+
// workspace, never to a pipeline or an environment line.
|
|
1476
|
+
static variableScope(project, pipeline, environment, sandbox, scope) {
|
|
1477
|
+
if (sandbox && (pipeline || environment)) {
|
|
1478
|
+
output_1.default.exitError(texts_1.ERR_VARIABLE_LINE_CONFLICT);
|
|
1479
|
+
}
|
|
1480
|
+
Input.targetLine(project, pipeline, environment);
|
|
1481
|
+
if (scope) {
|
|
1482
|
+
scope = scope.toUpperCase();
|
|
1483
|
+
if (scope === utils_1.VARIABLE_SCOPE.WORKSPACE) {
|
|
1484
|
+
return scope;
|
|
1485
|
+
}
|
|
1486
|
+
if (scope === utils_1.VARIABLE_SCOPE.PROJECT) {
|
|
1487
|
+
if (!project)
|
|
1488
|
+
output_1.default.exitError(texts_1.ERR_COMMAND_SCOPE_NO_PROJECT);
|
|
1489
|
+
return scope;
|
|
1490
|
+
}
|
|
1491
|
+
if (scope === utils_1.VARIABLE_SCOPE.PIPELINE) {
|
|
1492
|
+
if (!pipeline)
|
|
1493
|
+
output_1.default.exitError(texts_1.ERR_TARGET_SCOPE_NO_PIPELINE);
|
|
1494
|
+
return scope;
|
|
1495
|
+
}
|
|
1496
|
+
if (scope === utils_1.VARIABLE_SCOPE.ENVIRONMENT) {
|
|
1497
|
+
if (!environment)
|
|
1498
|
+
output_1.default.exitError(texts_1.ERR_TARGET_SCOPE_NO_ENVIRONMENT);
|
|
1499
|
+
return scope;
|
|
1500
|
+
}
|
|
1501
|
+
if (scope === utils_1.VARIABLE_SCOPE.SANDBOX) {
|
|
1502
|
+
if (!sandbox)
|
|
1503
|
+
output_1.default.exitError(texts_1.ERR_VARIABLE_SCOPE_NO_SANDBOX);
|
|
1504
|
+
return scope;
|
|
1505
|
+
}
|
|
1506
|
+
return output_1.default.exitError(texts_1.ERR_VARIABLE_SCOPE);
|
|
1507
|
+
}
|
|
1508
|
+
if (pipeline)
|
|
1509
|
+
return utils_1.VARIABLE_SCOPE.PIPELINE;
|
|
1510
|
+
if (environment)
|
|
1511
|
+
return utils_1.VARIABLE_SCOPE.ENVIRONMENT;
|
|
1512
|
+
if (sandbox)
|
|
1513
|
+
return utils_1.VARIABLE_SCOPE.SANDBOX;
|
|
1514
|
+
if (project)
|
|
1515
|
+
return utils_1.VARIABLE_SCOPE.PROJECT;
|
|
1516
|
+
return utils_1.VARIABLE_SCOPE.WORKSPACE;
|
|
1517
|
+
}
|
|
1518
|
+
// Value from the argument or from a file (`-` = stdin, which keeps a secret
|
|
1519
|
+
// out of the shell history and the process list). Undefined when neither is
|
|
1520
|
+
// given: create stores an empty value, update leaves the stored one intact.
|
|
1521
|
+
// stdin drops the one line ending `echo` adds - an encrypted value is never
|
|
1522
|
+
// shown again, so a token with a stray newline would go unnoticed. A file is
|
|
1523
|
+
// taken byte for byte: keys and JSON may need their exact content.
|
|
1524
|
+
static variableValue(value, file) {
|
|
1525
|
+
if (value !== undefined && file) {
|
|
1526
|
+
output_1.default.exitError(new cliError_1.default('usage_error', texts_1.ERR_VARIABLE_VALUE_CONFLICT));
|
|
1527
|
+
}
|
|
1528
|
+
if (!file)
|
|
1529
|
+
return value;
|
|
1530
|
+
if (file === '-')
|
|
1531
|
+
return node_fs_1.default.readFileSync(0, 'utf8').replace(/\r?\n$/, '');
|
|
1532
|
+
const p = (0, node_path_1.resolve)(file);
|
|
1533
|
+
if (!node_fs_1.default.existsSync(p)) {
|
|
1534
|
+
output_1.default.exitError(new cliError_1.default('file_not_found', (0, texts_1.ERR_VARIABLE_FILE_NOT_FOUND)(file)));
|
|
1535
|
+
}
|
|
1536
|
+
return node_fs_1.default.readFileSync(p, 'utf8');
|
|
1537
|
+
}
|
|
1473
1538
|
/**
|
|
1474
1539
|
* Resolve `--project` / `--scope` / `--environment` into the filter the sandbox
|
|
1475
1540
|
* endpoints take. Only one of the two is ever set: a sandbox belongs to a
|