bdy 1.25.2-stage → 1.25.4-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 +20 -19
- package/distTs/src/agent/socket/tunnel.js +2 -0
- package/distTs/src/cliCommand.js +28 -0
- package/distTs/src/cliIndex.js +3 -1
- package/distTs/src/command/agent/proxy/status.js +9 -2
- package/distTs/src/command/agent/status.js +22 -6
- package/distTs/src/command/agent/tags/get.js +9 -2
- package/distTs/src/command/agent/target/status.js +9 -2
- package/distTs/src/command/agent/tunnel/http.js +4 -3
- package/distTs/src/command/agent/tunnel/list.js +7 -3
- package/distTs/src/command/agent/tunnel/remove.js +1 -2
- package/distTs/src/command/agent/tunnel/start.js +1 -2
- package/distTs/src/command/agent/tunnel/status.js +14 -3
- package/distTs/src/command/agent/tunnel/tcp.js +4 -3
- package/distTs/src/command/agent/tunnel/tls.js +4 -3
- package/distTs/src/command/agent/tunnel.js +11 -8
- package/distTs/src/command/agent/version.js +7 -2
- package/distTs/src/command/api/info.js +50 -2
- package/distTs/src/command/api/list.js +18 -2
- package/distTs/src/command/artifact/composer/publish.js +4 -2
- package/distTs/src/command/artifact/create.js +9 -2
- package/distTs/src/command/artifact/delete.js +4 -2
- package/distTs/src/command/artifact/docker.js +1 -1
- package/distTs/src/command/artifact/download.js +4 -2
- package/distTs/src/command/artifact/get.js +3 -1
- package/distTs/src/command/artifact/list.js +3 -1
- package/distTs/src/command/artifact/publish.js +24 -24
- package/distTs/src/command/artifact/version/create.js +9 -2
- package/distTs/src/command/artifact/version/delete.js +4 -2
- package/distTs/src/command/artifact/version/get.js +4 -2
- package/distTs/src/command/artifact/version/list.js +4 -2
- package/distTs/src/command/config/get/tunnel.js +8 -3
- package/distTs/src/command/config/get/tunnels.js +8 -3
- package/distTs/src/command/crawl/link.js +3 -2
- package/distTs/src/command/crawl/run.js +3 -2
- package/distTs/src/command/crawl.js +3 -4
- package/distTs/src/command/discover.js +34 -0
- package/distTs/src/command/distro/create.js +9 -2
- package/distTs/src/command/distro/delete.js +4 -2
- package/distTs/src/command/distro/get.js +4 -2
- package/distTs/src/command/distro/list.js +4 -2
- package/distTs/src/command/distro/route/create.js +9 -2
- package/distTs/src/command/distro/route/delete.js +4 -2
- package/distTs/src/command/distro/route/get.js +4 -2
- package/distTs/src/command/distro/route/list.js +4 -2
- package/distTs/src/command/distro/route/update.js +9 -2
- package/distTs/src/command/distro/route.js +9 -6
- package/distTs/src/command/distro/update.js +9 -2
- package/distTs/src/command/distro.js +14 -11
- package/distTs/src/command/domain/search.js +31 -10
- package/distTs/src/command/environment/create.js +6 -2
- package/distTs/src/command/environment/delete.js +1 -2
- package/distTs/src/command/environment/get.js +3 -2
- package/distTs/src/command/environment/list.js +1 -2
- package/distTs/src/command/environment/update.js +6 -2
- package/distTs/src/command/mcp.js +3 -2
- package/distTs/src/command/pipeline/create.js +4 -2
- package/distTs/src/command/pipeline/delete.js +4 -2
- package/distTs/src/command/pipeline/get.js +4 -2
- package/distTs/src/command/pipeline/list.js +4 -2
- package/distTs/src/command/pipeline/run/approve.js +5 -3
- package/distTs/src/command/pipeline/run/cancel.js +5 -3
- package/distTs/src/command/pipeline/run/list.js +4 -2
- package/distTs/src/command/pipeline/run/logs.js +5 -3
- package/distTs/src/command/pipeline/run/retry.js +5 -3
- package/distTs/src/command/pipeline/run/start.js +5 -3
- package/distTs/src/command/pipeline/run/status.js +5 -3
- package/distTs/src/command/pipeline/run.js +11 -9
- package/distTs/src/command/pipeline/update.js +4 -2
- package/distTs/src/command/pipeline/yaml.js +4 -2
- package/distTs/src/command/pipeline.js +17 -15
- package/distTs/src/command/pre.js +2 -1
- package/distTs/src/command/sandbox/app/add.js +10 -3
- package/distTs/src/command/sandbox/app/list.js +1 -2
- package/distTs/src/command/sandbox/app/logs.js +10 -6
- package/distTs/src/command/sandbox/app/remove.js +1 -2
- package/distTs/src/command/sandbox/app/start.js +1 -2
- package/distTs/src/command/sandbox/app/status.js +1 -2
- package/distTs/src/command/sandbox/app/stop.js +1 -2
- package/distTs/src/command/sandbox/app.js +11 -9
- package/distTs/src/command/sandbox/cp.js +3 -2
- package/distTs/src/command/sandbox/create.js +16 -7
- package/distTs/src/command/sandbox/endpoint/add.js +6 -2
- package/distTs/src/command/sandbox/endpoint/delete.js +1 -2
- package/distTs/src/command/sandbox/endpoint/get.js +1 -2
- package/distTs/src/command/sandbox/endpoint/list.js +1 -2
- package/distTs/src/command/sandbox/endpoint.js +8 -5
- package/distTs/src/command/sandbox/exec/command.js +15 -31
- package/distTs/src/command/sandbox/exec/kill.js +1 -2
- package/distTs/src/command/sandbox/exec/list.js +1 -2
- package/distTs/src/command/sandbox/exec/logs.js +4 -30
- package/distTs/src/command/sandbox/exec/status.js +1 -2
- package/distTs/src/command/sandbox/exec.js +9 -6
- package/distTs/src/command/sandbox/finishExec.js +33 -0
- package/distTs/src/command/sandbox/logs.js +14 -1
- package/distTs/src/command/sandbox/snapshot/create.js +10 -3
- package/distTs/src/command/sandbox/snapshot/delete.js +1 -2
- package/distTs/src/command/sandbox/snapshot/get.js +1 -2
- package/distTs/src/command/sandbox/snapshot/list.js +1 -2
- package/distTs/src/command/sandbox/snapshot.js +8 -5
- package/distTs/src/command/sandbox/ssh.js +3 -2
- package/distTs/src/command/target/create.js +8 -2
- package/distTs/src/command/target/delete.js +3 -2
- package/distTs/src/command/target/exec/command.js +1 -2
- package/distTs/src/command/target/exec/kill.js +1 -2
- package/distTs/src/command/target/exec/list.js +1 -2
- package/distTs/src/command/target/exec/logs.js +15 -3
- package/distTs/src/command/target/exec/status.js +1 -2
- package/distTs/src/command/target/exec.js +9 -6
- package/distTs/src/command/target/get.js +3 -2
- package/distTs/src/command/target/list.js +3 -2
- package/distTs/src/command/target/update.js +8 -2
- package/distTs/src/command/tests/capture.js +3 -2
- package/distTs/src/command/tests/unit/link.js +3 -2
- package/distTs/src/command/tests/unit/upload.js +3 -2
- package/distTs/src/command/tests/unit.js +3 -4
- package/distTs/src/command/tests/visual/link.js +3 -2
- package/distTs/src/command/tests/visual/session/close.js +3 -2
- package/distTs/src/command/tests/visual/session/create.js +3 -2
- package/distTs/src/command/tests/visual/session.js +6 -4
- package/distTs/src/command/tests/visual/setup.js +3 -2
- package/distTs/src/command/tests/visual/upload.js +3 -2
- package/distTs/src/command/tests/visual.js +9 -7
- package/distTs/src/command/tests.js +12 -10
- package/distTs/src/command/tunnel/http.js +3 -2
- package/distTs/src/command/tunnel/start.js +3 -2
- package/distTs/src/command/tunnel/tcp.js +1 -2
- package/distTs/src/command/tunnel/tls.js +1 -2
- package/distTs/src/command/tunnel.js +8 -5
- package/distTs/src/command/version.js +2 -1
- package/distTs/src/command/yaml/actions/info.js +1 -2
- package/distTs/src/command/yaml/actions/list.js +1 -2
- package/distTs/src/command/yaml/actions.js +3 -4
- package/distTs/src/command/yaml/pipeline.js +3 -2
- package/distTs/src/command/yaml/validate.js +114 -54
- package/distTs/src/command/yaml.js +8 -6
- package/distTs/src/discovery.js +119 -0
- package/distTs/src/openapi.js +8 -1
- package/distTs/src/output.js +39 -0
- package/distTs/src/texts.js +1570 -736
- package/distTs/src/utils.js +46 -17
- package/package.json +20 -19
|
@@ -12,7 +12,23 @@ const yaml_1 = __importDefault(require("./pipeline/yaml"));
|
|
|
12
12
|
const create_1 = __importDefault(require("./pipeline/create"));
|
|
13
13
|
const update_1 = __importDefault(require("./pipeline/update"));
|
|
14
14
|
const delete_1 = __importDefault(require("./pipeline/delete"));
|
|
15
|
-
const commandPipeline = (0, utils_1.newCommand)('pipeline', texts_1.DESC_COMMAND_PIPELINE
|
|
15
|
+
const commandPipeline = (0, utils_1.newCommand)('pipeline', texts_1.DESC_COMMAND_PIPELINE, {
|
|
16
|
+
examples: [
|
|
17
|
+
...texts_1.EXAMPLE_PIPELINE_RUN_START,
|
|
18
|
+
...texts_1.EXAMPLE_PIPELINE_RUN_STATUS,
|
|
19
|
+
...texts_1.EXAMPLE_PIPELINE_RUN_LOGS,
|
|
20
|
+
...texts_1.EXAMPLE_PIPELINE_RUN_CANCEL,
|
|
21
|
+
...texts_1.EXAMPLE_PIPELINE_RUN_RETRY,
|
|
22
|
+
...texts_1.EXAMPLE_PIPELINE_RUN_APPLY,
|
|
23
|
+
...texts_1.EXAMPLE_PIPELINE_RUN_LIST,
|
|
24
|
+
...texts_1.EXAMPLE_PIPELINE_LIST,
|
|
25
|
+
...texts_1.EXAMPLE_PIPELINE_GET,
|
|
26
|
+
...texts_1.EXAMPLE_PIPELINE_DELETE,
|
|
27
|
+
...texts_1.EXAMPLE_PIPELINE_YML,
|
|
28
|
+
...texts_1.EXAMPLE_PIPELINE_CREATE,
|
|
29
|
+
...texts_1.EXAMPLE_PIPELINE_UPDATE,
|
|
30
|
+
],
|
|
31
|
+
});
|
|
16
32
|
commandPipeline.alias('pip');
|
|
17
33
|
commandPipeline.addCommand(run_1.default);
|
|
18
34
|
commandPipeline.addCommand(list_1.default);
|
|
@@ -21,18 +37,4 @@ commandPipeline.addCommand(delete_1.default);
|
|
|
21
37
|
commandPipeline.addCommand(yaml_1.default);
|
|
22
38
|
commandPipeline.addCommand(create_1.default);
|
|
23
39
|
commandPipeline.addCommand(update_1.default);
|
|
24
|
-
commandPipeline.addHelpText('after', `
|
|
25
|
-
EXAMPLES:${texts_1.EXAMPLE_PIPELINE_RUN_START}
|
|
26
|
-
${texts_1.EXAMPLE_PIPELINE_RUN_STATUS}
|
|
27
|
-
${texts_1.EXAMPLE_PIPELINE_RUN_LOGS}
|
|
28
|
-
${texts_1.EXAMPLE_PIPELINE_RUN_CANCEL}
|
|
29
|
-
${texts_1.EXAMPLE_PIPELINE_RUN_RETRY}
|
|
30
|
-
${texts_1.EXAMPLE_PIPELINE_RUN_APPLY}
|
|
31
|
-
${texts_1.EXAMPLE_PIPELINE_RUN_LIST}
|
|
32
|
-
${texts_1.EXAMPLE_PIPELINE_LIST}
|
|
33
|
-
${texts_1.EXAMPLE_PIPELINE_GET}
|
|
34
|
-
${texts_1.EXAMPLE_PIPELINE_DELETE}
|
|
35
|
-
${texts_1.EXAMPLE_PIPELINE_YML}
|
|
36
|
-
${texts_1.EXAMPLE_PIPELINE_CREATE}
|
|
37
|
-
${texts_1.EXAMPLE_PIPELINE_UPDATE}`);
|
|
38
40
|
exports.default = commandPipeline;
|
|
@@ -5,10 +5,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const utils_1 = require("../utils");
|
|
7
7
|
const output_1 = __importDefault(require("../output"));
|
|
8
|
+
const cliCommand_1 = __importDefault(require("../cliCommand"));
|
|
8
9
|
const commandPre = async (_, command) => {
|
|
9
10
|
// commands whose stdout is machine-read (e.g. mcp) skip agent/version checks
|
|
10
11
|
// entirely - no banners and no startup latency from the version fetch
|
|
11
|
-
if (command.skipPre)
|
|
12
|
+
if (!(command instanceof cliCommand_1.default) || command.skipPre)
|
|
12
13
|
return;
|
|
13
14
|
const AgentManager = require('../agent/manager').default;
|
|
14
15
|
const ApiAgent = require('../tunnel/api/agent').default;
|
|
@@ -7,11 +7,14 @@ const utils_1 = require("../../../utils");
|
|
|
7
7
|
const texts_1 = require("../../../texts");
|
|
8
8
|
const input_1 = __importDefault(require("../../../input"));
|
|
9
9
|
const output_1 = __importDefault(require("../../../output"));
|
|
10
|
-
const commandSandboxAppAdd = (0, utils_1.newCommand)('add', texts_1.DESC_COMMAND_SANDBOX_APP_ADD
|
|
10
|
+
const commandSandboxAppAdd = (0, utils_1.newCommand)('add', texts_1.DESC_COMMAND_SANDBOX_APP_ADD, {
|
|
11
|
+
examples: texts_1.EXAMPLE_SANDBOX_APP_ADD,
|
|
12
|
+
helpText: texts_1.HELP_SANDBOX_APP_ADD_JSON,
|
|
13
|
+
});
|
|
11
14
|
(0, utils_1.sandboxScopeOptions)(commandSandboxAppAdd);
|
|
12
15
|
commandSandboxAppAdd.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
13
16
|
commandSandboxAppAdd.argument('<app-command>', texts_1.OPTION_SANDBOX_APP_COMMAND);
|
|
14
|
-
commandSandboxAppAdd.
|
|
17
|
+
commandSandboxAppAdd.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
15
18
|
commandSandboxAppAdd.action(async (identifier, app, options) => {
|
|
16
19
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
17
20
|
const client = input_1.default.restApiTokenClient();
|
|
@@ -19,9 +22,13 @@ commandSandboxAppAdd.action(async (identifier, app, options) => {
|
|
|
19
22
|
const sandbox = await client.getSandbox(workspace, sandboxId);
|
|
20
23
|
const apps = sandbox.apps || [];
|
|
21
24
|
apps.push(app);
|
|
22
|
-
await client.updateSandbox(workspace, sandboxId, {
|
|
25
|
+
const updated = await client.updateSandbox(workspace, sandboxId, {
|
|
23
26
|
apps,
|
|
24
27
|
});
|
|
28
|
+
if (options.format === 'json') {
|
|
29
|
+
output_1.default.json(updated);
|
|
30
|
+
output_1.default.exitNormal();
|
|
31
|
+
}
|
|
25
32
|
output_1.default.exitSuccess(texts_1.TXT_SANDBOX_APP_ADDED);
|
|
26
33
|
});
|
|
27
34
|
exports.default = commandSandboxAppAdd;
|
|
@@ -7,12 +7,11 @@ const utils_1 = require("../../../utils");
|
|
|
7
7
|
const texts_1 = require("../../../texts");
|
|
8
8
|
const input_1 = __importDefault(require("../../../input"));
|
|
9
9
|
const output_1 = __importDefault(require("../../../output"));
|
|
10
|
-
const commandSandboxAppList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_SANDBOX_APP_LIST);
|
|
10
|
+
const commandSandboxAppList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_SANDBOX_APP_LIST, { examples: texts_1.EXAMPLE_SANDBOX_APP_LIST });
|
|
11
11
|
commandSandboxAppList.alias('ls');
|
|
12
12
|
(0, utils_1.sandboxScopeOptions)(commandSandboxAppList);
|
|
13
13
|
commandSandboxAppList.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
14
14
|
commandSandboxAppList.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
15
|
-
commandSandboxAppList.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_SANDBOX_APP_LIST}`);
|
|
16
15
|
commandSandboxAppList.action(async (identifier, options) => {
|
|
17
16
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
18
17
|
const client = input_1.default.restApiTokenClient();
|
|
@@ -7,13 +7,12 @@ const utils_1 = require("../../../utils");
|
|
|
7
7
|
const texts_1 = require("../../../texts");
|
|
8
8
|
const input_1 = __importDefault(require("../../../input"));
|
|
9
9
|
const output_1 = __importDefault(require("../../../output"));
|
|
10
|
-
const commandSandboxAppLogs = (0, utils_1.newCommand)('logs', texts_1.DESC_COMMAND_SANDBOX_APP_LOGS);
|
|
10
|
+
const commandSandboxAppLogs = (0, utils_1.newCommand)('logs', texts_1.DESC_COMMAND_SANDBOX_APP_LOGS, { examples: texts_1.EXAMPLE_SANDBOX_APP_LOGS });
|
|
11
11
|
commandSandboxAppLogs.hideVersionUpdate = true;
|
|
12
12
|
(0, utils_1.sandboxScopeOptions)(commandSandboxAppLogs);
|
|
13
13
|
commandSandboxAppLogs.option('-l, --limit <lines>', texts_1.OPTION_SANDBOX_LOGS_LIMIT);
|
|
14
14
|
commandSandboxAppLogs.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
15
15
|
commandSandboxAppLogs.argument('<app-id>', texts_1.OPTION_SANDBOX_APP_ID);
|
|
16
|
-
commandSandboxAppLogs.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_SANDBOX_APP_LOGS}`);
|
|
17
16
|
const fetchLogsWithLimit = async (client, workspace, sandboxId, appId, limit) => {
|
|
18
17
|
let c = null;
|
|
19
18
|
let l = [];
|
|
@@ -21,18 +20,23 @@ const fetchLogsWithLimit = async (client, workspace, sandboxId, appId, limit) =>
|
|
|
21
20
|
const { cursor, logs } = await client.getSandboxAppLogs(workspace, sandboxId, appId, c);
|
|
22
21
|
l = l.concat(logs);
|
|
23
22
|
if (l.length > limit)
|
|
24
|
-
return l.slice(0, limit)
|
|
23
|
+
return l.slice(0, limit);
|
|
25
24
|
if (!cursor || !logs.length)
|
|
26
|
-
return l
|
|
25
|
+
return l;
|
|
27
26
|
c = cursor;
|
|
28
27
|
} while (c != null);
|
|
29
|
-
return l
|
|
28
|
+
return l;
|
|
30
29
|
};
|
|
30
|
+
commandSandboxAppLogs.option('--format <text|jsonl>', texts_1.OPTION_FORMAT_JSONL);
|
|
31
31
|
commandSandboxAppLogs.action(async (identifier, appId, options) => {
|
|
32
32
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
33
33
|
const client = input_1.default.restApiTokenClient();
|
|
34
34
|
const sandboxId = await input_1.default.sandboxId(client, workspace, options, identifier);
|
|
35
35
|
const logs = await fetchLogsWithLimit(client, workspace, sandboxId, appId, options.limit || 100);
|
|
36
|
-
|
|
36
|
+
if (options.format === 'jsonl') {
|
|
37
|
+
logs.forEach((data) => output_1.default.json({ type: 'log', data }));
|
|
38
|
+
output_1.default.exitNormal();
|
|
39
|
+
}
|
|
40
|
+
output_1.default.exitNormal(logs.join('\n'));
|
|
37
41
|
});
|
|
38
42
|
exports.default = commandSandboxAppLogs;
|
|
@@ -7,12 +7,11 @@ const utils_1 = require("../../../utils");
|
|
|
7
7
|
const texts_1 = require("../../../texts");
|
|
8
8
|
const input_1 = __importDefault(require("../../../input"));
|
|
9
9
|
const output_1 = __importDefault(require("../../../output"));
|
|
10
|
-
const commandSandboxAppRemove = (0, utils_1.newCommand)('remove', texts_1.DESC_COMMAND_SANDBOX_APP_REMOVE);
|
|
10
|
+
const commandSandboxAppRemove = (0, utils_1.newCommand)('remove', texts_1.DESC_COMMAND_SANDBOX_APP_REMOVE, { examples: texts_1.EXAMPLE_SANDBOX_APP_REMOVE });
|
|
11
11
|
commandSandboxAppRemove.alias('rm');
|
|
12
12
|
(0, utils_1.sandboxScopeOptions)(commandSandboxAppRemove);
|
|
13
13
|
commandSandboxAppRemove.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
14
14
|
commandSandboxAppRemove.argument('<app-id>', texts_1.OPTION_SANDBOX_APP_ID);
|
|
15
|
-
commandSandboxAppRemove.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_SANDBOX_APP_REMOVE}`);
|
|
16
15
|
commandSandboxAppRemove.action(async (identifier, appId, options) => {
|
|
17
16
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
18
17
|
const client = input_1.default.restApiTokenClient();
|
|
@@ -7,11 +7,10 @@ const utils_1 = require("../../../utils");
|
|
|
7
7
|
const texts_1 = require("../../../texts");
|
|
8
8
|
const input_1 = __importDefault(require("../../../input"));
|
|
9
9
|
const output_1 = __importDefault(require("../../../output"));
|
|
10
|
-
const commandSandboxAppStart = (0, utils_1.newCommand)('start', texts_1.DESC_COMMAND_SANDBOX_APP_START);
|
|
10
|
+
const commandSandboxAppStart = (0, utils_1.newCommand)('start', texts_1.DESC_COMMAND_SANDBOX_APP_START, { examples: texts_1.EXAMPLE_SANDBOX_APP_START });
|
|
11
11
|
(0, utils_1.sandboxScopeOptions)(commandSandboxAppStart);
|
|
12
12
|
commandSandboxAppStart.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
13
13
|
commandSandboxAppStart.argument('<app-id>', texts_1.OPTION_SANDBOX_APP_ID);
|
|
14
|
-
commandSandboxAppStart.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_SANDBOX_APP_START}`);
|
|
15
14
|
commandSandboxAppStart.action(async (identifier, appId, options) => {
|
|
16
15
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
17
16
|
const client = input_1.default.restApiTokenClient();
|
|
@@ -7,12 +7,11 @@ const utils_1 = require("../../../utils");
|
|
|
7
7
|
const texts_1 = require("../../../texts");
|
|
8
8
|
const input_1 = __importDefault(require("../../../input"));
|
|
9
9
|
const output_1 = __importDefault(require("../../../output"));
|
|
10
|
-
const commandSandboxAppStatus = (0, utils_1.newCommand)('status', texts_1.DESC_COMMAND_SANDBOX_APP_STATUS);
|
|
10
|
+
const commandSandboxAppStatus = (0, utils_1.newCommand)('status', texts_1.DESC_COMMAND_SANDBOX_APP_STATUS, { examples: texts_1.EXAMPLE_SANDBOX_APP_STATUS });
|
|
11
11
|
(0, utils_1.sandboxScopeOptions)(commandSandboxAppStatus);
|
|
12
12
|
commandSandboxAppStatus.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
13
13
|
commandSandboxAppStatus.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
14
14
|
commandSandboxAppStatus.argument('<app-id>', texts_1.OPTION_SANDBOX_APP_ID);
|
|
15
|
-
commandSandboxAppStatus.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_SANDBOX_APP_STATUS}`);
|
|
16
15
|
commandSandboxAppStatus.action(async (identifier, appId, options) => {
|
|
17
16
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
18
17
|
const client = input_1.default.restApiTokenClient();
|
|
@@ -7,11 +7,10 @@ const utils_1 = require("../../../utils");
|
|
|
7
7
|
const texts_1 = require("../../../texts");
|
|
8
8
|
const input_1 = __importDefault(require("../../../input"));
|
|
9
9
|
const output_1 = __importDefault(require("../../../output"));
|
|
10
|
-
const commandSandboxAppStop = (0, utils_1.newCommand)('stop', texts_1.DESC_COMMAND_SANDBOX_APP_STOP);
|
|
10
|
+
const commandSandboxAppStop = (0, utils_1.newCommand)('stop', texts_1.DESC_COMMAND_SANDBOX_APP_STOP, { examples: texts_1.EXAMPLE_SANDBOX_APP_STOP });
|
|
11
11
|
(0, utils_1.sandboxScopeOptions)(commandSandboxAppStop);
|
|
12
12
|
commandSandboxAppStop.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
13
13
|
commandSandboxAppStop.argument('<app-id>', texts_1.OPTION_SANDBOX_APP_ID);
|
|
14
|
-
commandSandboxAppStop.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_SANDBOX_APP_STOP}`);
|
|
15
14
|
commandSandboxAppStop.action(async (identifier, appId, options) => {
|
|
16
15
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
17
16
|
const client = input_1.default.restApiTokenClient();
|
|
@@ -12,7 +12,17 @@ const stop_1 = __importDefault(require("./app/stop"));
|
|
|
12
12
|
const start_1 = __importDefault(require("./app/start"));
|
|
13
13
|
const add_1 = __importDefault(require("./app/add"));
|
|
14
14
|
const remove_1 = __importDefault(require("./app/remove"));
|
|
15
|
-
const commandSandboxApp = (0, utils_1.newCommand)('app', texts_1.DESC_COMMAND_SANDBOX_APP
|
|
15
|
+
const commandSandboxApp = (0, utils_1.newCommand)('app', texts_1.DESC_COMMAND_SANDBOX_APP, {
|
|
16
|
+
examples: [
|
|
17
|
+
...texts_1.EXAMPLE_SANDBOX_APP_LIST,
|
|
18
|
+
...texts_1.EXAMPLE_SANDBOX_APP_ADD,
|
|
19
|
+
...texts_1.EXAMPLE_SANDBOX_APP_REMOVE,
|
|
20
|
+
...texts_1.EXAMPLE_SANDBOX_APP_LOGS,
|
|
21
|
+
...texts_1.EXAMPLE_SANDBOX_APP_STATUS,
|
|
22
|
+
...texts_1.EXAMPLE_SANDBOX_APP_STOP,
|
|
23
|
+
...texts_1.EXAMPLE_SANDBOX_APP_START,
|
|
24
|
+
],
|
|
25
|
+
});
|
|
16
26
|
commandSandboxApp.addCommand(list_1.default);
|
|
17
27
|
commandSandboxApp.addCommand(add_1.default);
|
|
18
28
|
commandSandboxApp.addCommand(remove_1.default);
|
|
@@ -20,12 +30,4 @@ commandSandboxApp.addCommand(logs_1.default);
|
|
|
20
30
|
commandSandboxApp.addCommand(status_1.default);
|
|
21
31
|
commandSandboxApp.addCommand(stop_1.default);
|
|
22
32
|
commandSandboxApp.addCommand(start_1.default);
|
|
23
|
-
commandSandboxApp.addHelpText('after', `
|
|
24
|
-
EXAMPLES:${texts_1.EXAMPLE_SANDBOX_APP_LIST}
|
|
25
|
-
${texts_1.EXAMPLE_SANDBOX_APP_ADD}
|
|
26
|
-
${texts_1.EXAMPLE_SANDBOX_APP_REMOVE}
|
|
27
|
-
${texts_1.EXAMPLE_SANDBOX_APP_LOGS}
|
|
28
|
-
${texts_1.EXAMPLE_SANDBOX_APP_STATUS}
|
|
29
|
-
${texts_1.EXAMPLE_SANDBOX_APP_STOP}
|
|
30
|
-
${texts_1.EXAMPLE_SANDBOX_APP_START}`);
|
|
31
33
|
exports.default = commandSandboxApp;
|
|
@@ -11,7 +11,9 @@ const path_1 = require("path");
|
|
|
11
11
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
12
12
|
const promises_1 = __importDefault(require("node:stream/promises"));
|
|
13
13
|
const picomatch_1 = __importDefault(require("picomatch"));
|
|
14
|
-
const commandSandboxCp = (0, utils_1.newCommand)('cp', texts_1.DESC_COMMAND_SANDBOX_CP
|
|
14
|
+
const commandSandboxCp = (0, utils_1.newCommand)('cp', texts_1.DESC_COMMAND_SANDBOX_CP, {
|
|
15
|
+
examples: texts_1.EXAMPLE_SANDBOX_CP,
|
|
16
|
+
});
|
|
15
17
|
(0, utils_1.sandboxScopeOptions)(commandSandboxCp);
|
|
16
18
|
commandSandboxCp.option('-m, --merge', texts_1.OPTION_SANDBOX_CP_DOWNLOAD_MERGE);
|
|
17
19
|
commandSandboxCp.option('-r, --replace', texts_1.OPTION_SANDBOX_CP_DOWNLOAD_REPLACE);
|
|
@@ -19,7 +21,6 @@ commandSandboxCp.option('-u, --user <user>', texts_1.OPTION_SANDBOX_CP_USER);
|
|
|
19
21
|
commandSandboxCp.option('--ignore <patterns...>', texts_1.OPTION_SANDBOX_CP_IGNORE);
|
|
20
22
|
commandSandboxCp.argument('<source>', texts_1.OPTION_SANDBOX_CP_SOURCE);
|
|
21
23
|
commandSandboxCp.argument('<destination>', texts_1.OPTION_SANDBOX_CP_DEST);
|
|
22
|
-
commandSandboxCp.addHelpText('after', texts_1.EXAMPLE_SANDBOX_CP);
|
|
23
24
|
const upload = async (client, workspace, options, source, destination, ignore, userName) => {
|
|
24
25
|
const { fdir } = require('fdir');
|
|
25
26
|
const { sourcePath, sourceStats } = input_1.default.restApiSandboxUploadSourcePath(source);
|
|
@@ -22,7 +22,9 @@ const VALID_RESOURCES = [
|
|
|
22
22
|
'11x22',
|
|
23
23
|
'12x24',
|
|
24
24
|
];
|
|
25
|
-
const commandSandboxCreate = (0, utils_1.newCommand)('create', texts_1.DESC_COMMAND_SANDBOX_CREATE
|
|
25
|
+
const commandSandboxCreate = (0, utils_1.newCommand)('create', texts_1.DESC_COMMAND_SANDBOX_CREATE, {
|
|
26
|
+
examples: [...texts_1.EXAMPLE_SANDBOX_CREATE, ...texts_1.EXAMPLE_SANDBOX_ENDPOINT_CREATE],
|
|
27
|
+
});
|
|
26
28
|
commandSandboxCreate.alias('add');
|
|
27
29
|
(0, utils_1.sandboxScopeOptions)(commandSandboxCreate);
|
|
28
30
|
commandSandboxCreate.option('-n, --name <name>', texts_1.OPTION_SANDBOX_NAME);
|
|
@@ -49,9 +51,10 @@ commandSandboxCreate.option('--yaml <content|@path>', texts_1.OPTION_SANDBOX_YAM
|
|
|
49
51
|
commandSandboxCreate.option('--wait-for-running [seconds]', texts_1.OPTION_SANDBOX_WAIT_RUNNING);
|
|
50
52
|
commandSandboxCreate.option('--wait-for-configured [seconds]', texts_1.OPTION_SANDBOX_WAIT_CONFIGURED);
|
|
51
53
|
commandSandboxCreate.option('--wait-for-apps [seconds]', texts_1.OPTION_SANDBOX_WAIT_APPS);
|
|
52
|
-
commandSandboxCreate.
|
|
54
|
+
commandSandboxCreate.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
53
55
|
commandSandboxCreate.action(async (options) => {
|
|
54
56
|
const humanId = require('human-id').default;
|
|
57
|
+
const say = output_1.default.progress(options.format === 'json');
|
|
55
58
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
56
59
|
const project = input_1.default.restApiProject(options.project, true);
|
|
57
60
|
const scope = input_1.default.scope(project, options.scope, options.environment, true);
|
|
@@ -77,7 +80,7 @@ commandSandboxCreate.action(async (options) => {
|
|
|
77
80
|
const body = {
|
|
78
81
|
yaml: Buffer.from(yaml, 'utf8').toString('base64'),
|
|
79
82
|
};
|
|
80
|
-
|
|
83
|
+
say((0, texts_1.TXT_SANDBOX_CREATING)());
|
|
81
84
|
result = await client.createSandboxByYaml(workspace, scope === distro_1.SCOPE.PROJECT ? project : null, body, environmentId);
|
|
82
85
|
}
|
|
83
86
|
else {
|
|
@@ -142,12 +145,12 @@ commandSandboxCreate.action(async (options) => {
|
|
|
142
145
|
if (options.appDir) {
|
|
143
146
|
body.app_dir = options.appDir;
|
|
144
147
|
}
|
|
145
|
-
|
|
148
|
+
say((0, texts_1.TXT_SANDBOX_CREATING)(body.name, body.identifier));
|
|
146
149
|
result = await client.createSandbox(workspace, scope === distro_1.SCOPE.PROJECT ? project : null, body);
|
|
147
150
|
}
|
|
148
151
|
const sandboxId = result.id;
|
|
149
152
|
if (options.waitForRunning) {
|
|
150
|
-
|
|
153
|
+
say(texts_1.TXT_SANDBOX_WAITING_RUNNING);
|
|
151
154
|
const timeout = parseInt(options.waitForRunning, 10) || 300;
|
|
152
155
|
try {
|
|
153
156
|
const status = await client.sandboxWaitForRunning(workspace, sandboxId, timeout);
|
|
@@ -160,7 +163,7 @@ commandSandboxCreate.action(async (options) => {
|
|
|
160
163
|
}
|
|
161
164
|
}
|
|
162
165
|
if (options.waitForConfigured) {
|
|
163
|
-
|
|
166
|
+
say(texts_1.TXT_SANDBOX_WAITING_SETUP);
|
|
164
167
|
const timeout = parseInt(options.waitForConfigured, 10) || 300;
|
|
165
168
|
try {
|
|
166
169
|
const status = await client.sandboxWaitForConfigured(workspace, sandboxId, timeout);
|
|
@@ -173,7 +176,7 @@ commandSandboxCreate.action(async (options) => {
|
|
|
173
176
|
}
|
|
174
177
|
}
|
|
175
178
|
if (options.waitForApps) {
|
|
176
|
-
|
|
179
|
+
say(texts_1.TXT_SANDBOX_WAITING_APPS);
|
|
177
180
|
const timeout = parseInt(options.waitForApps, 10) || 300;
|
|
178
181
|
try {
|
|
179
182
|
const status = await client.sandboxWaitForApps(workspace, sandboxId, timeout);
|
|
@@ -194,6 +197,12 @@ commandSandboxCreate.action(async (options) => {
|
|
|
194
197
|
output_1.default.exitError(texts_1.ERR_SANDBOX_RUNNING_TIMEOUT);
|
|
195
198
|
}
|
|
196
199
|
}
|
|
200
|
+
if (options.format === 'json') {
|
|
201
|
+
if (options.waitForRunning || options.waitForConfigured || options.waitForApps)
|
|
202
|
+
result = await client.getSandbox(workspace, sandboxId);
|
|
203
|
+
output_1.default.json(result);
|
|
204
|
+
output_1.default.exitNormal();
|
|
205
|
+
}
|
|
197
206
|
output_1.default.dim('Identifier: ', false);
|
|
198
207
|
output_1.default.cyan(result.identifier);
|
|
199
208
|
output_1.default.dim('SSH: ', false);
|
|
@@ -8,9 +8,9 @@ const texts_1 = require("../../../texts");
|
|
|
8
8
|
const output_1 = __importDefault(require("../../../output"));
|
|
9
9
|
const input_1 = __importDefault(require("../../../input"));
|
|
10
10
|
const tunnel_1 = require("../../../types/tunnel");
|
|
11
|
-
const commandSandboxEndpointAdd = (0, utils_1.getBasicCommandSandboxEndpoint)('add', texts_1.DESC_COMMAND_SANDBOX_ENDPOINT_ADD);
|
|
11
|
+
const commandSandboxEndpointAdd = (0, utils_1.getBasicCommandSandboxEndpoint)('add', texts_1.DESC_COMMAND_SANDBOX_ENDPOINT_ADD, { examples: texts_1.EXAMPLE_SANDBOX_ENDPOINT_CREATE });
|
|
12
12
|
commandSandboxEndpointAdd.alias('create');
|
|
13
|
-
commandSandboxEndpointAdd.
|
|
13
|
+
commandSandboxEndpointAdd.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
14
14
|
commandSandboxEndpointAdd.action(async (identifier, options) => {
|
|
15
15
|
const humanId = require('human-id').default;
|
|
16
16
|
let name = options.name;
|
|
@@ -33,6 +33,10 @@ commandSandboxEndpointAdd.action(async (identifier, options) => {
|
|
|
33
33
|
endpoints: updatedEndpoints,
|
|
34
34
|
});
|
|
35
35
|
const addedEndpoint = (updatedSandbox.endpoints || []).find((ep) => ep.name === name);
|
|
36
|
+
if (options.format === 'json') {
|
|
37
|
+
output_1.default.json(addedEndpoint);
|
|
38
|
+
output_1.default.exitNormal();
|
|
39
|
+
}
|
|
36
40
|
output_1.default.object({
|
|
37
41
|
Name: name,
|
|
38
42
|
Url: addedEndpoint.endpoint_url || '-',
|
|
@@ -7,13 +7,12 @@ const utils_1 = require("../../../utils");
|
|
|
7
7
|
const texts_1 = require("../../../texts");
|
|
8
8
|
const output_1 = __importDefault(require("../../../output"));
|
|
9
9
|
const input_1 = __importDefault(require("../../../input"));
|
|
10
|
-
const commandSandboxEndpointDelete = (0, utils_1.newCommand)('delete', texts_1.DESC_COMMAND_SANDBOX_ENDPOINT_DELETE);
|
|
10
|
+
const commandSandboxEndpointDelete = (0, utils_1.newCommand)('delete', texts_1.DESC_COMMAND_SANDBOX_ENDPOINT_DELETE, { examples: texts_1.EXAMPLE_SANDBOX_ENDPOINT_DELETE });
|
|
11
11
|
commandSandboxEndpointDelete.alias('rm');
|
|
12
12
|
(0, utils_1.sandboxScopeOptions)(commandSandboxEndpointDelete);
|
|
13
13
|
commandSandboxEndpointDelete.option('-f, --force', texts_1.OPTION_CONFIRM_FORCE);
|
|
14
14
|
commandSandboxEndpointDelete.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
15
15
|
commandSandboxEndpointDelete.argument('<endpoint-name>', texts_1.OPTION_SANDBOX_ENDPOINT_NAME_ARG);
|
|
16
|
-
commandSandboxEndpointDelete.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_SANDBOX_ENDPOINT_DELETE}`);
|
|
17
16
|
commandSandboxEndpointDelete.action(async (identifier, endpointName, options) => {
|
|
18
17
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
19
18
|
const client = input_1.default.restApiTokenClient();
|
|
@@ -7,12 +7,11 @@ const utils_1 = require("../../../utils");
|
|
|
7
7
|
const texts_1 = require("../../../texts");
|
|
8
8
|
const output_1 = __importDefault(require("../../../output"));
|
|
9
9
|
const input_1 = __importDefault(require("../../../input"));
|
|
10
|
-
const commandSandboxEndpointGet = (0, utils_1.newCommand)('get', texts_1.DESC_COMMAND_SANDBOX_ENDPOINT_GET);
|
|
10
|
+
const commandSandboxEndpointGet = (0, utils_1.newCommand)('get', texts_1.DESC_COMMAND_SANDBOX_ENDPOINT_GET, { examples: texts_1.EXAMPLE_SANDBOX_ENDPOINT_GET });
|
|
11
11
|
(0, utils_1.sandboxScopeOptions)(commandSandboxEndpointGet);
|
|
12
12
|
commandSandboxEndpointGet.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
13
13
|
commandSandboxEndpointGet.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
14
14
|
commandSandboxEndpointGet.argument('<endpoint-name>', texts_1.OPTION_SANDBOX_ENDPOINT_NAME_ARG);
|
|
15
|
-
commandSandboxEndpointGet.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_SANDBOX_ENDPOINT_GET}`);
|
|
16
15
|
commandSandboxEndpointGet.action(async (identifier, endpointName, options) => {
|
|
17
16
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
18
17
|
const client = input_1.default.restApiTokenClient();
|
|
@@ -7,12 +7,11 @@ const utils_1 = require("../../../utils");
|
|
|
7
7
|
const texts_1 = require("../../../texts");
|
|
8
8
|
const output_1 = __importDefault(require("../../../output"));
|
|
9
9
|
const input_1 = __importDefault(require("../../../input"));
|
|
10
|
-
const commandSandboxEndpointList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_SANDBOX_ENDPOINT_LIST);
|
|
10
|
+
const commandSandboxEndpointList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_SANDBOX_ENDPOINT_LIST, { examples: texts_1.EXAMPLE_SANDBOX_ENDPOINT_LIST });
|
|
11
11
|
commandSandboxEndpointList.alias('ls');
|
|
12
12
|
(0, utils_1.sandboxScopeOptions)(commandSandboxEndpointList);
|
|
13
13
|
commandSandboxEndpointList.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
14
14
|
commandSandboxEndpointList.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
15
|
-
commandSandboxEndpointList.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_SANDBOX_ENDPOINT_LIST}`);
|
|
16
15
|
commandSandboxEndpointList.action(async (identifier, options) => {
|
|
17
16
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
18
17
|
const client = input_1.default.restApiTokenClient();
|
|
@@ -9,14 +9,17 @@ const list_1 = __importDefault(require("./endpoint/list"));
|
|
|
9
9
|
const get_1 = __importDefault(require("./endpoint/get"));
|
|
10
10
|
const add_1 = __importDefault(require("./endpoint/add"));
|
|
11
11
|
const delete_1 = __importDefault(require("./endpoint/delete"));
|
|
12
|
-
const commandSandboxEndpoint = (0, utils_1.newCommand)('endpoint', texts_1.DESC_COMMAND_SANDBOX_ENDPOINT
|
|
12
|
+
const commandSandboxEndpoint = (0, utils_1.newCommand)('endpoint', texts_1.DESC_COMMAND_SANDBOX_ENDPOINT, {
|
|
13
|
+
examples: [
|
|
14
|
+
...texts_1.EXAMPLE_SANDBOX_ENDPOINT_CREATE,
|
|
15
|
+
...texts_1.EXAMPLE_SANDBOX_ENDPOINT_DELETE,
|
|
16
|
+
...texts_1.EXAMPLE_SANDBOX_ENDPOINT_GET,
|
|
17
|
+
...texts_1.EXAMPLE_SANDBOX_ENDPOINT_LIST,
|
|
18
|
+
],
|
|
19
|
+
});
|
|
13
20
|
commandSandboxEndpoint.alias('ep');
|
|
14
21
|
commandSandboxEndpoint.addCommand(list_1.default);
|
|
15
22
|
commandSandboxEndpoint.addCommand(get_1.default);
|
|
16
23
|
commandSandboxEndpoint.addCommand(add_1.default);
|
|
17
24
|
commandSandboxEndpoint.addCommand(delete_1.default);
|
|
18
|
-
commandSandboxEndpoint.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_SANDBOX_ENDPOINT_CREATE}
|
|
19
|
-
${texts_1.EXAMPLE_SANDBOX_ENDPOINT_DELETE}
|
|
20
|
-
${texts_1.EXAMPLE_SANDBOX_ENDPOINT_GET}
|
|
21
|
-
${texts_1.EXAMPLE_SANDBOX_ENDPOINT_LIST}`);
|
|
22
25
|
exports.default = commandSandboxEndpoint;
|
|
@@ -7,14 +7,18 @@ const texts_1 = require("../../../texts");
|
|
|
7
7
|
const utils_1 = require("../../../utils");
|
|
8
8
|
const output_1 = __importDefault(require("../../../output"));
|
|
9
9
|
const input_1 = __importDefault(require("../../../input"));
|
|
10
|
-
const
|
|
10
|
+
const finishExec_1 = require("../finishExec");
|
|
11
|
+
const commandSandboxExecCommand = (0, utils_1.newCommand)('command', texts_1.DESC_COMMAND_SANDBOX_EXEC_COMMAND, {
|
|
12
|
+
helpText: texts_1.HELP_SANDBOX_EXEC_COMMAND_JSONL,
|
|
13
|
+
examples: texts_1.EXAMPLE_SANDBOX_EXEC_COMMAND,
|
|
14
|
+
});
|
|
11
15
|
commandSandboxExecCommand.alias('cmd');
|
|
12
16
|
(0, utils_1.sandboxScopeOptions)(commandSandboxExecCommand);
|
|
13
17
|
commandSandboxExecCommand.option('--runtime <runtime>', texts_1.OPTION_SANDBOX_RUNTIME);
|
|
14
18
|
commandSandboxExecCommand.option('--wait', texts_1.OPTION_SANDBOX_WAIT);
|
|
15
19
|
commandSandboxExecCommand.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
16
20
|
commandSandboxExecCommand.argument('<command>');
|
|
17
|
-
commandSandboxExecCommand.
|
|
21
|
+
commandSandboxExecCommand.option('--format <text|jsonl>', texts_1.OPTION_FORMAT_JSONL);
|
|
18
22
|
commandSandboxExecCommand.action(async (identifier, command, options) => {
|
|
19
23
|
output_1.default.handleSignals();
|
|
20
24
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
@@ -25,39 +29,19 @@ commandSandboxExecCommand.action(async (identifier, command, options) => {
|
|
|
25
29
|
command,
|
|
26
30
|
runtime,
|
|
27
31
|
});
|
|
28
|
-
|
|
32
|
+
if (options.format === 'jsonl') {
|
|
33
|
+
output_1.default.json({ type: 'command', command: cmdResult });
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
output_1.default.gray((0, texts_1.TXT_SANDBOX_EXEC_ID)(cmdResult.id));
|
|
37
|
+
}
|
|
29
38
|
if (!options.wait) {
|
|
39
|
+
if (options.format === 'jsonl')
|
|
40
|
+
output_1.default.exitNormal();
|
|
30
41
|
output_1.default.exitSuccess((0, texts_1.TXT_SANDBOX_EXEC_BACKGROUND)(identifier, cmdResult.id));
|
|
31
42
|
}
|
|
32
43
|
else {
|
|
33
|
-
|
|
34
|
-
body.on('data', (data) => {
|
|
35
|
-
if (data) {
|
|
36
|
-
try {
|
|
37
|
-
const str = data.toString('utf8').split('\n');
|
|
38
|
-
str.forEach((s) => {
|
|
39
|
-
const json = JSON.parse(s);
|
|
40
|
-
if (json.data)
|
|
41
|
-
output_1.default.data(json.data);
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
catch {
|
|
45
|
-
// do nothing
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
body.on('close', async () => {
|
|
50
|
-
const cmdExit = await client.getSandboxCommand(workspace, sandboxId, cmdResult.id);
|
|
51
|
-
if (cmdExit.status === utils_1.SANDBOX_EXEC_STATUS.SUCCESSFUL) {
|
|
52
|
-
output_1.default.exitSuccess((0, texts_1.TXT_SANDBOX_EXEC_SUCCESS)(identifier, cmdResult.id));
|
|
53
|
-
}
|
|
54
|
-
else if (cmdExit.status === utils_1.SANDBOX_EXEC_STATUS.INPROGRESS) {
|
|
55
|
-
output_1.default.exitNormal((0, texts_1.TXT_SANDBOX_EXEC_INPROGRESS)(identifier, cmdResult.id));
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
output_1.default.exitError((0, texts_1.TXT_SANDBOX_EXEC_FAILED)(identifier, cmdResult.id));
|
|
59
|
-
}
|
|
60
|
-
});
|
|
44
|
+
await (0, finishExec_1.finishExec)(client, workspace, sandboxId, identifier, cmdResult.id, true, options.format === 'jsonl');
|
|
61
45
|
}
|
|
62
46
|
});
|
|
63
47
|
exports.default = commandSandboxExecCommand;
|
|
@@ -7,12 +7,11 @@ const utils_1 = require("../../../utils");
|
|
|
7
7
|
const texts_1 = require("../../../texts");
|
|
8
8
|
const input_1 = __importDefault(require("../../../input"));
|
|
9
9
|
const output_1 = __importDefault(require("../../../output"));
|
|
10
|
-
const commandSandboxExecKill = (0, utils_1.newCommand)('kill', texts_1.DESC_COMMAND_SANDBOX_EXEC_KILL);
|
|
10
|
+
const commandSandboxExecKill = (0, utils_1.newCommand)('kill', texts_1.DESC_COMMAND_SANDBOX_EXEC_KILL, { examples: texts_1.EXAMPLE_SANDBOX_EXEC_KILL });
|
|
11
11
|
(0, utils_1.sandboxScopeOptions)(commandSandboxExecKill);
|
|
12
12
|
commandSandboxExecKill.option('-f, --force', texts_1.OPTION_CONFIRM_FORCE);
|
|
13
13
|
commandSandboxExecKill.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
14
14
|
commandSandboxExecKill.argument('<command-id>', texts_1.OPTION_SANDBOX_COMMAND_ID);
|
|
15
|
-
commandSandboxExecKill.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_SANDBOX_EXEC_KILL}`);
|
|
16
15
|
commandSandboxExecKill.action(async (identifier, commandId, options) => {
|
|
17
16
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
18
17
|
const client = input_1.default.restApiTokenClient();
|
|
@@ -7,12 +7,11 @@ const utils_1 = require("../../../utils");
|
|
|
7
7
|
const texts_1 = require("../../../texts");
|
|
8
8
|
const input_1 = __importDefault(require("../../../input"));
|
|
9
9
|
const output_1 = __importDefault(require("../../../output"));
|
|
10
|
-
const commandSandboxExecList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_SANDBOX_EXEC_LIST);
|
|
10
|
+
const commandSandboxExecList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_SANDBOX_EXEC_LIST, { examples: texts_1.EXAMPLE_SANDBOX_EXEC_LIST });
|
|
11
11
|
commandSandboxExecList.alias('ls');
|
|
12
12
|
(0, utils_1.sandboxScopeOptions)(commandSandboxExecList);
|
|
13
13
|
commandSandboxExecList.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
14
14
|
commandSandboxExecList.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
15
|
-
commandSandboxExecList.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_SANDBOX_EXEC_LIST}`);
|
|
16
15
|
commandSandboxExecList.action(async (identifier, options) => {
|
|
17
16
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
18
17
|
const client = input_1.default.restApiTokenClient();
|
|
@@ -7,44 +7,18 @@ const utils_1 = require("../../../utils");
|
|
|
7
7
|
const texts_1 = require("../../../texts");
|
|
8
8
|
const output_1 = __importDefault(require("../../../output"));
|
|
9
9
|
const input_1 = __importDefault(require("../../../input"));
|
|
10
|
-
const
|
|
10
|
+
const finishExec_1 = require("../finishExec");
|
|
11
|
+
const commandSandboxExecLogs = (0, utils_1.newCommand)('logs', texts_1.DESC_COMMAND_SANDBOX_EXEC_LOGS, { helpText: texts_1.HELP_SANDBOX_EXEC_JSONL, examples: texts_1.EXAMPLE_SANDBOX_EXEC_LOGS });
|
|
11
12
|
(0, utils_1.sandboxScopeOptions)(commandSandboxExecLogs);
|
|
12
13
|
commandSandboxExecLogs.option('--wait', texts_1.OPTION_SANDBOX_WAIT);
|
|
13
14
|
commandSandboxExecLogs.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
14
15
|
commandSandboxExecLogs.argument('<command-id>', texts_1.OPTION_SANDBOX_COMMAND_ID);
|
|
15
|
-
commandSandboxExecLogs.
|
|
16
|
+
commandSandboxExecLogs.option('--format <text|jsonl>', texts_1.OPTION_FORMAT_JSONL);
|
|
16
17
|
commandSandboxExecLogs.action(async (identifier, commandId, options) => {
|
|
17
18
|
output_1.default.handleSignals();
|
|
18
19
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
19
20
|
const client = input_1.default.restApiTokenClient();
|
|
20
21
|
const sandboxId = await input_1.default.sandboxId(client, workspace, options, identifier);
|
|
21
|
-
|
|
22
|
-
body.on('data', (data) => {
|
|
23
|
-
if (data) {
|
|
24
|
-
try {
|
|
25
|
-
const str = data.toString('utf8').split('\n');
|
|
26
|
-
str.forEach((s) => {
|
|
27
|
-
const json = JSON.parse(s);
|
|
28
|
-
if (json.data)
|
|
29
|
-
output_1.default.data(json.data);
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
catch {
|
|
33
|
-
// do nothing
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
body.on('close', async () => {
|
|
38
|
-
const cmdExit = await client.getSandboxCommand(workspace, sandboxId, commandId);
|
|
39
|
-
if (cmdExit.status === utils_1.SANDBOX_EXEC_STATUS.SUCCESSFUL) {
|
|
40
|
-
output_1.default.exitSuccess((0, texts_1.TXT_SANDBOX_EXEC_SUCCESS)(identifier, commandId));
|
|
41
|
-
}
|
|
42
|
-
else if (cmdExit.status === utils_1.SANDBOX_EXEC_STATUS.INPROGRESS) {
|
|
43
|
-
output_1.default.exitNormal((0, texts_1.TXT_SANDBOX_EXEC_INPROGRESS)(identifier, commandId));
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
output_1.default.exitError((0, texts_1.TXT_SANDBOX_EXEC_FAILED)(identifier, commandId));
|
|
47
|
-
}
|
|
48
|
-
});
|
|
22
|
+
await (0, finishExec_1.finishExec)(client, workspace, sandboxId, identifier, commandId, !!options.wait, options.format === 'jsonl');
|
|
49
23
|
});
|
|
50
24
|
exports.default = commandSandboxExecLogs;
|
|
@@ -7,12 +7,11 @@ const utils_1 = require("../../../utils");
|
|
|
7
7
|
const texts_1 = require("../../../texts");
|
|
8
8
|
const input_1 = __importDefault(require("../../../input"));
|
|
9
9
|
const output_1 = __importDefault(require("../../../output"));
|
|
10
|
-
const commandSandboxExecStatus = (0, utils_1.newCommand)('status', texts_1.DESC_COMMAND_SANDBOX_EXEC_STATUS);
|
|
10
|
+
const commandSandboxExecStatus = (0, utils_1.newCommand)('status', texts_1.DESC_COMMAND_SANDBOX_EXEC_STATUS, { examples: texts_1.EXAMPLE_SANDBOX_EXEC_STATUS });
|
|
11
11
|
(0, utils_1.sandboxScopeOptions)(commandSandboxExecStatus);
|
|
12
12
|
commandSandboxExecStatus.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
13
13
|
commandSandboxExecStatus.argument('<identifier>', texts_1.OPTION_SANDBOX_IDENTIFIER);
|
|
14
14
|
commandSandboxExecStatus.argument('<command-id>', texts_1.OPTION_SANDBOX_COMMAND_ID);
|
|
15
|
-
commandSandboxExecStatus.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_SANDBOX_EXEC_STATUS}`);
|
|
16
15
|
commandSandboxExecStatus.action(async (identifier, commandId, options) => {
|
|
17
16
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
18
17
|
const client = input_1.default.restApiTokenClient();
|
|
@@ -10,15 +10,18 @@ const kill_1 = __importDefault(require("./exec/kill"));
|
|
|
10
10
|
const list_1 = __importDefault(require("./exec/list"));
|
|
11
11
|
const logs_1 = __importDefault(require("./exec/logs"));
|
|
12
12
|
const command_1 = __importDefault(require("./exec/command"));
|
|
13
|
-
const commandSandboxExec = (0, utils_1.newCommand)('exec', texts_1.DESC_COMMAND_SANDBOX_EXEC
|
|
13
|
+
const commandSandboxExec = (0, utils_1.newCommand)('exec', texts_1.DESC_COMMAND_SANDBOX_EXEC, {
|
|
14
|
+
examples: [
|
|
15
|
+
...texts_1.EXAMPLE_SANDBOX_EXEC_COMMAND,
|
|
16
|
+
...texts_1.EXAMPLE_SANDBOX_EXEC_KILL,
|
|
17
|
+
...texts_1.EXAMPLE_SANDBOX_EXEC_LIST,
|
|
18
|
+
...texts_1.EXAMPLE_SANDBOX_EXEC_LOGS,
|
|
19
|
+
...texts_1.EXAMPLE_SANDBOX_EXEC_STATUS,
|
|
20
|
+
],
|
|
21
|
+
});
|
|
14
22
|
commandSandboxExec.addCommand(command_1.default);
|
|
15
23
|
commandSandboxExec.addCommand(status_1.default);
|
|
16
24
|
commandSandboxExec.addCommand(kill_1.default);
|
|
17
25
|
commandSandboxExec.addCommand(list_1.default);
|
|
18
26
|
commandSandboxExec.addCommand(logs_1.default);
|
|
19
|
-
commandSandboxExec.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_SANDBOX_EXEC_COMMAND}
|
|
20
|
-
${texts_1.EXAMPLE_SANDBOX_EXEC_KILL}
|
|
21
|
-
${texts_1.EXAMPLE_SANDBOX_EXEC_LIST}
|
|
22
|
-
${texts_1.EXAMPLE_SANDBOX_EXEC_LOGS}
|
|
23
|
-
${texts_1.EXAMPLE_SANDBOX_EXEC_STATUS}`);
|
|
24
27
|
exports.default = commandSandboxExec;
|