bdy 1.25.13-dev → 1.25.14-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/agent/manager.js +19 -6
- package/distTs/src/agent/system.js +9 -4
- package/distTs/src/api/client.js +20 -7
- package/distTs/src/cliCommand.js +17 -1
- package/distTs/src/cliIndex.js +12 -2
- package/distTs/src/command/agent/debug.js +4 -3
- package/distTs/src/command/agent/disable.js +4 -3
- package/distTs/src/command/agent/enable.js +4 -3
- package/distTs/src/command/agent/install.js +28 -12
- package/distTs/src/command/agent/proxy/disable.js +4 -3
- package/distTs/src/command/agent/proxy/enable.js +4 -3
- package/distTs/src/command/agent/proxy/status.js +1 -1
- package/distTs/src/command/agent/restart.js +13 -5
- package/distTs/src/command/agent/start.js +11 -4
- package/distTs/src/command/agent/status.js +1 -1
- package/distTs/src/command/agent/stop.js +5 -4
- package/distTs/src/command/agent/tags/get.js +1 -1
- package/distTs/src/command/agent/tags/set.js +4 -3
- package/distTs/src/command/agent/target/disable.js +4 -3
- package/distTs/src/command/agent/target/enable.js +4 -3
- package/distTs/src/command/agent/target/status.js +1 -1
- package/distTs/src/command/agent/tunnel/disable.js +4 -3
- package/distTs/src/command/agent/tunnel/enable.js +4 -3
- package/distTs/src/command/agent/tunnel/http.js +10 -2
- package/distTs/src/command/agent/tunnel/list.js +1 -1
- package/distTs/src/command/agent/tunnel/remove.js +4 -3
- package/distTs/src/command/agent/tunnel/start.js +9 -5
- package/distTs/src/command/agent/tunnel/status.js +1 -1
- package/distTs/src/command/agent/tunnel/tcp.js +10 -2
- package/distTs/src/command/agent/tunnel/tls.js +10 -2
- package/distTs/src/command/agent/uninstall.js +6 -4
- package/distTs/src/command/agent/update.js +13 -5
- package/distTs/src/command/agent/user.js +4 -3
- package/distTs/src/command/agent/version.js +1 -1
- package/distTs/src/command/api/info.js +5 -3
- package/distTs/src/command/api/list.js +1 -0
- package/distTs/src/command/artifact/composer/publish.js +21 -16
- package/distTs/src/command/artifact/delete.js +8 -5
- package/distTs/src/command/artifact/docker/login.js +22 -5
- package/distTs/src/command/artifact/download.js +16 -15
- package/distTs/src/command/artifact/get.js +3 -2
- package/distTs/src/command/artifact/open.js +3 -2
- package/distTs/src/command/artifact/publish.js +3 -2
- package/distTs/src/command/artifact/version/create.js +3 -2
- package/distTs/src/command/artifact/version/delete.js +9 -6
- package/distTs/src/command/artifact/version/get.js +4 -3
- package/distTs/src/command/artifact/version/list.js +3 -2
- package/distTs/src/command/artifact/version/open.js +7 -6
- package/distTs/src/command/config/add/http.js +3 -2
- package/distTs/src/command/config/add/tcp.js +3 -2
- package/distTs/src/command/config/add/tls.js +3 -2
- package/distTs/src/command/config/get/region.js +5 -2
- package/distTs/src/command/config/get/timeout.js +5 -2
- package/distTs/src/command/config/get/token.js +5 -2
- package/distTs/src/command/config/get/tunnel.js +3 -2
- package/distTs/src/command/config/get/tunnels.js +1 -1
- package/distTs/src/command/config/get/whitelist.js +5 -2
- package/distTs/src/command/config/remove/token.js +4 -3
- package/distTs/src/command/config/remove/tunnel.js +6 -4
- package/distTs/src/command/config/set/region.js +4 -3
- package/distTs/src/command/config/set/timeout.js +4 -3
- package/distTs/src/command/config/set/token.js +5 -3
- package/distTs/src/command/config/set/whitelist.js +4 -3
- package/distTs/src/command/crawl/link.js +10 -4
- package/distTs/src/command/crawl/run.js +30 -18
- package/distTs/src/command/distro/delete.js +8 -5
- package/distTs/src/command/distro/get.js +3 -2
- package/distTs/src/command/distro/open.js +3 -2
- package/distTs/src/command/distro/route/create.js +3 -2
- package/distTs/src/command/distro/route/delete.js +8 -5
- package/distTs/src/command/distro/route/get.js +3 -2
- package/distTs/src/command/distro/route/list.js +3 -2
- package/distTs/src/command/distro/route/open.js +3 -2
- package/distTs/src/command/distro/route/update.js +3 -2
- package/distTs/src/command/distro/update.js +3 -2
- package/distTs/src/command/domain/buy.js +36 -17
- package/distTs/src/command/domain/get.js +3 -2
- package/distTs/src/command/domain/list.js +1 -1
- package/distTs/src/command/domain/open.js +4 -2
- package/distTs/src/command/domain/search.js +1 -0
- package/distTs/src/command/environment/create.js +1 -1
- package/distTs/src/command/environment/delete.js +6 -4
- package/distTs/src/command/environment/get.js +1 -0
- package/distTs/src/command/environment/list.js +1 -1
- package/distTs/src/command/environment/open.js +3 -1
- package/distTs/src/command/environment/update.js +1 -1
- package/distTs/src/command/login.js +29 -17
- package/distTs/src/command/logout.js +4 -3
- package/distTs/src/command/pipeline/create.js +13 -3
- package/distTs/src/command/pipeline/delete.js +9 -6
- package/distTs/src/command/pipeline/get.js +4 -3
- package/distTs/src/command/pipeline/open.js +2 -1
- package/distTs/src/command/pipeline/run/execution.js +3 -3
- package/distTs/src/command/pipeline/run/list.js +4 -3
- package/distTs/src/command/pipeline/run/open.js +2 -1
- package/distTs/src/command/pipeline/update.js +4 -3
- package/distTs/src/command/pipeline/yaml.js +4 -3
- package/distTs/src/command/project/link.js +74 -36
- package/distTs/src/command/project/list.js +1 -0
- package/distTs/src/command/project/open.js +3 -1
- package/distTs/src/command/register.js +2 -1
- package/distTs/src/command/sandbox/app/add.js +1 -0
- package/distTs/src/command/sandbox/app/list.js +1 -1
- package/distTs/src/command/sandbox/app/logs.js +1 -1
- package/distTs/src/command/sandbox/app/remove.js +4 -3
- package/distTs/src/command/sandbox/app/start.js +4 -3
- package/distTs/src/command/sandbox/app/status.js +3 -2
- package/distTs/src/command/sandbox/app/stop.js +4 -3
- package/distTs/src/command/sandbox/cp.js +23 -23
- package/distTs/src/command/sandbox/create.js +3 -1
- package/distTs/src/command/sandbox/destroy.js +6 -4
- package/distTs/src/command/sandbox/endpoint/add.js +1 -1
- package/distTs/src/command/sandbox/endpoint/delete.js +9 -6
- package/distTs/src/command/sandbox/endpoint/get.js +3 -2
- package/distTs/src/command/sandbox/endpoint/list.js +1 -1
- package/distTs/src/command/sandbox/exec/command.js +1 -0
- package/distTs/src/command/sandbox/exec/kill.js +7 -5
- package/distTs/src/command/sandbox/exec/list.js +1 -1
- package/distTs/src/command/sandbox/exec/logs.js +1 -1
- package/distTs/src/command/sandbox/exec/status.js +1 -1
- package/distTs/src/command/sandbox/get.js +1 -1
- package/distTs/src/command/sandbox/list.js +1 -1
- package/distTs/src/command/sandbox/logs.js +1 -1
- package/distTs/src/command/sandbox/open.js +3 -1
- package/distTs/src/command/sandbox/restart.js +9 -4
- package/distTs/src/command/sandbox/snapshot/create.js +1 -1
- package/distTs/src/command/sandbox/snapshot/delete.js +8 -5
- package/distTs/src/command/sandbox/snapshot/get.js +3 -2
- package/distTs/src/command/sandbox/snapshot/list.js +1 -1
- package/distTs/src/command/sandbox/snapshot/open.js +4 -2
- package/distTs/src/command/sandbox/ssh.js +1 -0
- package/distTs/src/command/sandbox/start.js +9 -4
- package/distTs/src/command/sandbox/status.js +1 -1
- package/distTs/src/command/sandbox/stop.js +9 -4
- package/distTs/src/command/sandbox/update.js +12 -6
- package/distTs/src/command/sandbox/yaml.js +1 -1
- package/distTs/src/command/target/create.js +1 -0
- package/distTs/src/command/target/delete.js +6 -3
- package/distTs/src/command/target/exec/command.js +1 -1
- package/distTs/src/command/target/exec/kill.js +6 -4
- package/distTs/src/command/target/exec/list.js +1 -1
- package/distTs/src/command/target/exec/logs.js +1 -1
- package/distTs/src/command/target/exec/status.js +1 -1
- package/distTs/src/command/target/get.js +1 -0
- package/distTs/src/command/target/list.js +1 -0
- package/distTs/src/command/target/open.js +3 -1
- package/distTs/src/command/target/scope.js +4 -4
- package/distTs/src/command/target/update.js +1 -0
- package/distTs/src/command/tests/capture.js +10 -7
- package/distTs/src/command/tests/unit/link.js +10 -4
- package/distTs/src/command/tests/visual/link.js +10 -4
- package/distTs/src/command/tests/visual/session/close.js +8 -3
- package/distTs/src/command/tests/visual/setup.js +6 -3
- package/distTs/src/command/tests/visual/upload.js +11 -8
- package/distTs/src/command/tunnel/http.js +6 -2
- package/distTs/src/command/tunnel/start.js +8 -3
- package/distTs/src/command/tunnel/tcp.js +6 -3
- package/distTs/src/command/tunnel/tls.js +6 -3
- package/distTs/src/command/version.js +24 -2
- package/distTs/src/command/whoami.js +1 -1
- package/distTs/src/command/workspace/get.js +7 -2
- package/distTs/src/command/workspace/list.js +1 -1
- package/distTs/src/command/workspace/open.js +4 -2
- package/distTs/src/command/workspace/set.js +4 -3
- package/distTs/src/command/yaml/actions/info.js +1 -1
- package/distTs/src/command/yaml/actions/list.js +1 -1
- package/distTs/src/command/yaml/pipeline.js +1 -0
- package/distTs/src/command/yaml/validate.js +1 -0
- package/distTs/src/discovery.js +169 -50
- package/distTs/src/input.js +6 -6
- package/distTs/src/output.js +72 -33
- package/distTs/src/texts.js +103 -42
- package/distTs/src/tunnel/output/noninteractive/tunnelJsonl.js +62 -0
- package/distTs/src/utils.js +19 -0
- package/distTs/src/visualTest/browser.js +3 -2
- package/package.json +1 -1
|
@@ -31,7 +31,7 @@ const resolveTargetId = async (client, workspace, identifier, options, strictLin
|
|
|
31
31
|
resolved = await client.getTargetByIdentifier(workspace, identifier);
|
|
32
32
|
}
|
|
33
33
|
if (!resolved.target_id) {
|
|
34
|
-
throw new cliError_1.default('not_found', texts_1.ERR_TARGET_NOT_FOUND);
|
|
34
|
+
throw new cliError_1.default('not_found', texts_1.ERR_TARGET_NOT_FOUND, texts_1.HINT_TARGET_LIST);
|
|
35
35
|
}
|
|
36
36
|
if (strictLine) {
|
|
37
37
|
const requested = options.pipeline
|
|
@@ -50,7 +50,7 @@ const resolveTargetId = async (client, workspace, identifier, options, strictLin
|
|
|
50
50
|
: (0, exports.targetScopeOf)(target) === utils_1.TARGET_SCOPE.PROJECT &&
|
|
51
51
|
target.project?.name === resolved.project_identifier;
|
|
52
52
|
if (!matches) {
|
|
53
|
-
throw new cliError_1.default('not_found', texts_1.ERR_TARGET_NOT_FOUND);
|
|
53
|
+
throw new cliError_1.default('not_found', texts_1.ERR_TARGET_NOT_FOUND, texts_1.HINT_TARGET_LIST);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -123,7 +123,7 @@ const resolveTargetScope = async (client, workspace, project, scope, options) =>
|
|
|
123
123
|
if (scope === utils_1.TARGET_SCOPE.PIPELINE) {
|
|
124
124
|
const { pipeline_id } = await client.getPipelineByIdentifier(workspace, project, options.pipeline);
|
|
125
125
|
if (!pipeline_id)
|
|
126
|
-
output_1.default.exitError(texts_1.ERR_PIPELINE_NOT_FOUND);
|
|
126
|
+
output_1.default.exitError(new cliError_1.default('not_found', texts_1.ERR_PIPELINE_NOT_FOUND, texts_1.HINT_PIPELINE_LIST));
|
|
127
127
|
params.pipelineId = pipeline_id;
|
|
128
128
|
}
|
|
129
129
|
else if (scope === utils_1.TARGET_SCOPE.ENVIRONMENT) {
|
|
@@ -135,7 +135,7 @@ const resolveTargetScope = async (client, workspace, project, scope, options) =>
|
|
|
135
135
|
const resolved = await client.getResourceByIdentifier(workspace, query);
|
|
136
136
|
// a nonexistent project is rejected by getResourceByIdentifier itself
|
|
137
137
|
if (!resolved.environment_id) {
|
|
138
|
-
output_1.default.exitError(texts_1.ERR_TARGET_ENVIRONMENT_NOT_FOUND);
|
|
138
|
+
output_1.default.exitError(new cliError_1.default('not_found', texts_1.ERR_TARGET_ENVIRONMENT_NOT_FOUND, texts_1.HINT_ENVIRONMENT_LIST));
|
|
139
139
|
}
|
|
140
140
|
params.environmentId = resolved.environment_id;
|
|
141
141
|
}
|
|
@@ -9,6 +9,7 @@ const output_1 = __importDefault(require("../../output"));
|
|
|
9
9
|
const input_1 = __importDefault(require("../../input"));
|
|
10
10
|
const scope_1 = require("./scope");
|
|
11
11
|
const commandTargetUpdate = (0, utils_1.newCommand)('update', texts_1.DESC_COMMAND_TARGET_UPDATE, {
|
|
12
|
+
requiredScopes: [utils_1.REST_API_SCOPE.TARGET_WRITE],
|
|
12
13
|
examples: texts_1.EXAMPLE_TARGET_UPDATE,
|
|
13
14
|
});
|
|
14
15
|
commandTargetUpdate.alias('edit');
|
|
@@ -22,7 +22,10 @@ commandCapture.option('--cookie <cookies...>', texts_1.OPTION_COMPARE_COOKIE);
|
|
|
22
22
|
commandCapture.option('--header <headers...>', texts_1.OPTION_COMPARE_HEADER);
|
|
23
23
|
commandCapture.option('--delay <delays...>', texts_1.OPTION_COMPARE_DELAY);
|
|
24
24
|
commandCapture.option('--waitFor <waitFors...>', texts_1.OPTION_COMPARE_WAIT_FOR);
|
|
25
|
+
commandCapture.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
25
26
|
commandCapture.action(async (options) => {
|
|
27
|
+
const json = options.format === 'json';
|
|
28
|
+
const say = output_1.default.progress(json);
|
|
26
29
|
const { getCiAndGitInfo, formattedCiInfo } = require('@buddy-works/ci-info');
|
|
27
30
|
const { addProtocolIfMissing } = require('../../visualTest/linkUtils');
|
|
28
31
|
const { sendCompareLinks } = require('../../visualTest/requests');
|
|
@@ -54,21 +57,21 @@ commandCapture.action(async (options) => {
|
|
|
54
57
|
}
|
|
55
58
|
const { filteredUrls, duplicates } = filterDuplicates(urls);
|
|
56
59
|
if (duplicates.length > 0) {
|
|
57
|
-
|
|
58
|
-
|
|
60
|
+
say(`Detected ${duplicates.length} duplicated urls:`);
|
|
61
|
+
say(duplicates.join('\n'));
|
|
59
62
|
}
|
|
60
63
|
if (validatedOptions.dryRun) {
|
|
61
|
-
output_1.default.
|
|
64
|
+
output_1.default.exitResult(json, { urls: filteredUrls, duplicates }, `List of urls:\n${filteredUrls.join('\n')}`);
|
|
62
65
|
}
|
|
63
66
|
else if (filteredUrls.length > 1) {
|
|
64
|
-
|
|
67
|
+
say(`List of urls:\n${filteredUrls.join('\n')}`);
|
|
65
68
|
}
|
|
66
69
|
const ciAndGitInfo = await getCiAndGitInfo({});
|
|
67
|
-
|
|
70
|
+
say(formattedCiInfo(ciAndGitInfo));
|
|
68
71
|
applyCiAndCommitInfo(ctx, ciAndGitInfo);
|
|
69
72
|
try {
|
|
70
|
-
const
|
|
71
|
-
output_1.default.
|
|
73
|
+
const response = await sendCompareLinks(ctx, filteredUrls, validatedOptions, sitemapSource);
|
|
74
|
+
output_1.default.exitResult(json, response, response.message);
|
|
72
75
|
}
|
|
73
76
|
catch (error) {
|
|
74
77
|
output_1.default.exitError(`${error}`);
|
|
@@ -7,15 +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 commandUtLink = (0, utils_1.newCommand)('link', texts_1.DESC_COMMAND_UT_LINK, {
|
|
10
|
+
requiredScopes: [utils_1.REST_API_SCOPE.UNIT_TEST_WRITE],
|
|
10
11
|
examples: texts_1.EXAMPLE_TESTS_UNIT_LINK,
|
|
11
12
|
});
|
|
12
13
|
commandUtLink.option('-w, --workspace <workspace>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
13
14
|
commandUtLink.option('-p, --project <project>', texts_1.OPTION_REST_API_PROJECT);
|
|
14
15
|
commandUtLink.option('-s, --suite <suite>', texts_1.OPTION_SUITE_IDENTIFIER);
|
|
16
|
+
commandUtLink.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
15
17
|
commandUtLink.action(async (options) => {
|
|
16
18
|
const Input = require('../../../input').default;
|
|
17
19
|
const ProjectCfg = require('../../../project/cfg').default;
|
|
18
20
|
output_1.default.handleSignals();
|
|
21
|
+
const json = options.format === 'json';
|
|
19
22
|
const workspace = Input.restApiWorkspace(options.workspace);
|
|
20
23
|
const project = Input.restApiProject(options.project);
|
|
21
24
|
const client = Input.restApiTokenClient(false, options.api, options.region);
|
|
@@ -36,8 +39,10 @@ commandUtLink.action(async (options) => {
|
|
|
36
39
|
if (opt === 'new') {
|
|
37
40
|
const name = await output_1.default.inputString(texts_1.TXT_COMMAND_SUITE_NAME);
|
|
38
41
|
const response = await client.createUtSuite(workspace, project, { name, identifier: name });
|
|
39
|
-
|
|
40
|
-
|
|
42
|
+
if (!json) {
|
|
43
|
+
output_1.default.okSign();
|
|
44
|
+
output_1.default.normal(texts_1.TXT_COMMAND_SUITE_CREATED);
|
|
45
|
+
}
|
|
41
46
|
suiteIdentifier = response.identifier;
|
|
42
47
|
}
|
|
43
48
|
else {
|
|
@@ -57,7 +62,8 @@ commandUtLink.action(async (options) => {
|
|
|
57
62
|
}
|
|
58
63
|
}
|
|
59
64
|
ProjectCfg.setSuite((0, utils_1.getWorkingDir)(), 'ut', suiteIdentifier);
|
|
60
|
-
|
|
61
|
-
|
|
65
|
+
if (!json)
|
|
66
|
+
output_1.default.okSign();
|
|
67
|
+
output_1.default.exitResult(json, { suite: suiteIdentifier }, texts_1.TXT_COMMAND_UT_LINK_SUCCESS);
|
|
62
68
|
});
|
|
63
69
|
exports.default = commandUtLink;
|
|
@@ -7,15 +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 commandVisualLink = (0, utils_1.newCommand)('link', texts_1.DESC_COMMAND_VT_LINK, {
|
|
10
|
+
requiredScopes: [utils_1.REST_API_SCOPE.VISUAL_TEST_WRITE],
|
|
10
11
|
examples: texts_1.EXAMPLE_TESTS_VISUAL_LINK,
|
|
11
12
|
});
|
|
12
13
|
commandVisualLink.option('-w, --workspace <workspace>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
13
14
|
commandVisualLink.option('-p, --project <project>', texts_1.OPTION_REST_API_PROJECT);
|
|
14
15
|
commandVisualLink.option('-s, --suite <suite>', texts_1.OPTION_SUITE_IDENTIFIER);
|
|
16
|
+
commandVisualLink.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
15
17
|
commandVisualLink.action(async (options) => {
|
|
16
18
|
const Input = require('../../../input').default;
|
|
17
19
|
const ProjectCfg = require('../../../project/cfg').default;
|
|
18
20
|
output_1.default.handleSignals();
|
|
21
|
+
const json = options.format === 'json';
|
|
19
22
|
const workspace = Input.restApiWorkspace(options.workspace);
|
|
20
23
|
const project = Input.restApiProject(options.project);
|
|
21
24
|
const client = Input.restApiTokenClient(false, options.api, options.region);
|
|
@@ -36,8 +39,10 @@ commandVisualLink.action(async (options) => {
|
|
|
36
39
|
if (opt === 'new') {
|
|
37
40
|
const name = await output_1.default.inputString(texts_1.TXT_COMMAND_SUITE_NAME);
|
|
38
41
|
const response = await client.createVtSuite(workspace, project, { name, identifier: name });
|
|
39
|
-
|
|
40
|
-
|
|
42
|
+
if (!json) {
|
|
43
|
+
output_1.default.okSign();
|
|
44
|
+
output_1.default.normal(texts_1.TXT_COMMAND_SUITE_CREATED);
|
|
45
|
+
}
|
|
41
46
|
suiteIdentifier = response.identifier;
|
|
42
47
|
}
|
|
43
48
|
else {
|
|
@@ -57,7 +62,8 @@ commandVisualLink.action(async (options) => {
|
|
|
57
62
|
}
|
|
58
63
|
}
|
|
59
64
|
ProjectCfg.setSuite((0, utils_1.getWorkingDir)(), 'vt', suiteIdentifier);
|
|
60
|
-
|
|
61
|
-
|
|
65
|
+
if (!json)
|
|
66
|
+
output_1.default.okSign();
|
|
67
|
+
output_1.default.exitResult(json, { suite: suiteIdentifier }, texts_1.TXT_COMMAND_VT_LINK_SUCCESS);
|
|
62
68
|
});
|
|
63
69
|
exports.default = commandVisualLink;
|
|
@@ -9,7 +9,8 @@ const output_1 = __importDefault(require("../../../../output"));
|
|
|
9
9
|
const commandSessionClose = (0, utils_1.newCommand)('close', texts_1.DESC_COMMAND_SESSION_CLOSE, {
|
|
10
10
|
examples: texts_1.EXAMPLE_TESTS_VISUAL_SESSION_CLOSE,
|
|
11
11
|
});
|
|
12
|
-
commandSessionClose.
|
|
12
|
+
commandSessionClose.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
13
|
+
commandSessionClose.action(async (options) => {
|
|
13
14
|
const { checkBuildId } = require('../../../../visualTest/validation');
|
|
14
15
|
const { closeSession } = require('../../../../visualTest/requests');
|
|
15
16
|
const { createVtContext, applyToken } = require('../../../../visualTest/context');
|
|
@@ -24,8 +25,12 @@ commandSessionClose.action(async () => {
|
|
|
24
25
|
const ctx = createVtContext();
|
|
25
26
|
applyToken(ctx, token);
|
|
26
27
|
try {
|
|
27
|
-
const
|
|
28
|
-
|
|
28
|
+
const response = await closeSession(ctx);
|
|
29
|
+
if (options.format === 'json') {
|
|
30
|
+
output_1.default.json(response);
|
|
31
|
+
output_1.default.exitNormal();
|
|
32
|
+
}
|
|
33
|
+
output_1.default.exitNormal(response.message);
|
|
29
34
|
}
|
|
30
35
|
catch (error) {
|
|
31
36
|
output_1.default.exitError(`${error}`);
|
|
@@ -7,13 +7,16 @@ const utils_1 = require("../../../utils");
|
|
|
7
7
|
const texts_1 = require("../../../texts");
|
|
8
8
|
const output_1 = __importDefault(require("../../../output"));
|
|
9
9
|
const commandVisualSetup = (0, utils_1.newCommand)('setup', texts_1.DESC_COMMAND_VISUAL_SETUP, {
|
|
10
|
+
requiredScopes: [],
|
|
10
11
|
examples: texts_1.EXAMPLE_TESTS_VISUAL_SETUP,
|
|
11
12
|
});
|
|
12
|
-
commandVisualSetup.
|
|
13
|
+
commandVisualSetup.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
14
|
+
commandVisualSetup.action(async (options) => {
|
|
15
|
+
const json = options.format === 'json';
|
|
13
16
|
try {
|
|
14
17
|
const { installBrowser } = require('../../../visualTest/browser');
|
|
15
|
-
await installBrowser();
|
|
16
|
-
output_1.default.
|
|
18
|
+
const path = await installBrowser(json);
|
|
19
|
+
output_1.default.exitResult(json, { installed: true, path }, '');
|
|
17
20
|
}
|
|
18
21
|
catch (error) {
|
|
19
22
|
output_1.default.exitError(`${error}`);
|
|
@@ -13,7 +13,10 @@ const commandVisualUpload = (0, utils_1.newCommand)('upload', texts_1.DESC_COMMA
|
|
|
13
13
|
examples: texts_1.EXAMPLE_TESTS_VISUAL_UPLOAD,
|
|
14
14
|
});
|
|
15
15
|
commandVisualUpload.argument('[directory]', texts_1.OPTION_STORYBOOK_DIRECTORY);
|
|
16
|
-
commandVisualUpload.
|
|
16
|
+
commandVisualUpload.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
17
|
+
commandVisualUpload.action(async (directory, options) => {
|
|
18
|
+
const json = options.format === 'json';
|
|
19
|
+
const say = output_1.default.progress(json);
|
|
17
20
|
const { getCiAndGitInfo, formattedCiInfo } = require('@buddy-works/ci-info');
|
|
18
21
|
const { getDefaultSettings, sendStorybook } = require('../../../visualTest/requests');
|
|
19
22
|
const { setDefaultSettings } = require('../../../visualTest/snapshots');
|
|
@@ -36,19 +39,19 @@ commandVisualUpload.action(async (directory) => {
|
|
|
36
39
|
}
|
|
37
40
|
const storybookStoriesIndex = getStorybookStoriesIndex(storybookFiles);
|
|
38
41
|
const storiesList = getStoriesList(node_path_1.default.join(storybookDirectory, storybookStoriesIndex));
|
|
39
|
-
const storybookSnapshots = getStorybookSnapshots(storiesList);
|
|
42
|
+
const storybookSnapshots = getStorybookSnapshots(storiesList, say);
|
|
40
43
|
const defaultSettings = await getDefaultSettings(ctx);
|
|
41
44
|
setDefaultSettings(defaultSettings);
|
|
42
45
|
const ciAndGitInfo = await getCiAndGitInfo({
|
|
43
46
|
baseBranch: defaultSettings.baseBranch,
|
|
44
|
-
logger: output_1.default.warning,
|
|
47
|
+
logger: json ? output_1.default.noteWarning.bind(output_1.default) : output_1.default.warning,
|
|
45
48
|
});
|
|
46
49
|
applyCiAndCommitInfo(ctx, ciAndGitInfo);
|
|
47
|
-
|
|
50
|
+
say(formattedCiInfo(ciAndGitInfo));
|
|
48
51
|
try {
|
|
49
52
|
const compressedStorybookDirectory = await createCompressedStorybookDirectory(storybookFiles, storybookDirectory);
|
|
50
|
-
const
|
|
51
|
-
output_1.default.
|
|
53
|
+
const response = await sendStorybook(ctx, storybookSnapshots, compressedStorybookDirectory);
|
|
54
|
+
output_1.default.exitResult(json, response, response.message);
|
|
52
55
|
}
|
|
53
56
|
catch (error) {
|
|
54
57
|
output_1.default.exitError(`${error}`);
|
|
@@ -134,14 +137,14 @@ function getStoriesList(storybookStoriesIndex) {
|
|
|
134
137
|
output_1.default.exitError(texts_1.ERR_PARSING_STORIES);
|
|
135
138
|
}
|
|
136
139
|
}
|
|
137
|
-
function getStorybookSnapshots(storiesList) {
|
|
140
|
+
function getStorybookSnapshots(storiesList, say) {
|
|
138
141
|
const stories = Object.entries(storiesList.entries)
|
|
139
142
|
.filter(([, value]) => value.type === 'story')
|
|
140
143
|
.map(([key, value]) => ({
|
|
141
144
|
id: key,
|
|
142
145
|
name: `${value.title}/${value.name}`,
|
|
143
146
|
}));
|
|
144
|
-
|
|
147
|
+
say((0, texts_1.TXT_STORIES_AMOUNT)(stories.length));
|
|
145
148
|
return stories;
|
|
146
149
|
}
|
|
147
150
|
exports.default = commandVisualUpload;
|
|
@@ -8,11 +8,13 @@ const output_1 = __importDefault(require("../../output"));
|
|
|
8
8
|
const texts_1 = require("../../texts");
|
|
9
9
|
const tunnel_1 = require("../../types/tunnel");
|
|
10
10
|
const commandHttp = (0, utils_1.getBasicCommandHttp)({
|
|
11
|
+
requiredScopes: [],
|
|
11
12
|
examples: (0, texts_1.EXAMPLE_TUNNEL_HTTP)(false),
|
|
12
13
|
});
|
|
13
14
|
commandHttp.description(texts_1.DESC_COMMAND_HTTP);
|
|
14
15
|
commandHttp.option('-s, --serve <directory>', texts_1.OPTION_SERVE);
|
|
15
16
|
commandHttp.option('--token <token>', texts_1.OPTION_TOKEN);
|
|
17
|
+
commandHttp.option('--format <text|jsonl>', texts_1.OPTION_FORMAT_JSONL);
|
|
16
18
|
commandHttp.argument('[protocol://host:port]', texts_1.OPTION_TARGET);
|
|
17
19
|
commandHttp.action(async (target, options) => {
|
|
18
20
|
const ApiBuddy = require('../../tunnel/api/buddy').default;
|
|
@@ -20,7 +22,9 @@ commandHttp.action(async (target, options) => {
|
|
|
20
22
|
const Cfg = require('../../tunnel/cfg').default;
|
|
21
23
|
const { host, token } = await Input.tunnelToken(options.token);
|
|
22
24
|
const prepared = await Cfg.prepareTunnel(tunnel_1.TUNNEL_TYPE.HTTP, target, options, true);
|
|
23
|
-
|
|
25
|
+
const jsonl = options.format === 'jsonl';
|
|
26
|
+
if (!jsonl)
|
|
27
|
+
await output_1.default.spinner(texts_1.TXT_OPENING_TUNNEL);
|
|
24
28
|
const agent = await ApiBuddy.register(false, false, true, false, host, token, [], (0, utils_1.getCurrentUser)(), {}, (region) => {
|
|
25
29
|
Cfg.setRegionIfNotSet(region);
|
|
26
30
|
});
|
|
@@ -28,6 +32,6 @@ commandHttp.action(async (target, options) => {
|
|
|
28
32
|
agent.startRefreshingConfiguration();
|
|
29
33
|
const tunnel = await ApiBuddy.addTunnel(agent.id, agent.host, agent.token, prepared);
|
|
30
34
|
agent.addTunnel(tunnel);
|
|
31
|
-
output_1.default.tunnel(tunnel);
|
|
35
|
+
output_1.default.tunnel(tunnel, jsonl);
|
|
32
36
|
});
|
|
33
37
|
exports.default = commandHttp;
|
|
@@ -3,24 +3,29 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const cliError_1 = __importDefault(require("../../cliError"));
|
|
6
7
|
const output_1 = __importDefault(require("../../output"));
|
|
7
8
|
const texts_1 = require("../../texts");
|
|
8
9
|
const utils_1 = require("../../utils");
|
|
9
10
|
const commandStart = (0, utils_1.newCommand)('start', texts_1.DESC_COMMAND_START, {
|
|
11
|
+
requiredScopes: [],
|
|
10
12
|
examples: texts_1.EXAMPLE_TUNNEL_START,
|
|
11
13
|
});
|
|
12
14
|
commandStart.option('--token <token>', texts_1.OPTION_TOKEN);
|
|
15
|
+
commandStart.option('--format <text|jsonl>', texts_1.OPTION_FORMAT_JSONL);
|
|
13
16
|
commandStart.argument('<name>', texts_1.OPTION_NAME);
|
|
14
17
|
commandStart.action(async (name, options) => {
|
|
15
18
|
const ApiBuddy = require('../../tunnel/api/buddy').default;
|
|
16
19
|
const Input = require('../../input').default;
|
|
17
20
|
const Cfg = require('../../tunnel/cfg').default;
|
|
18
21
|
if (!Cfg.hasTunnel(name)) {
|
|
19
|
-
output_1.default.exitError((0, texts_1.ERR_TUNNEL_NOT_FOUND)(name));
|
|
22
|
+
output_1.default.exitError(new cliError_1.default('not_found', (0, texts_1.ERR_TUNNEL_NOT_FOUND)(name), texts_1.HINT_TUNNEL_CONFIG_LIST));
|
|
20
23
|
}
|
|
21
24
|
const { token, host } = await Input.tunnelToken(options.token);
|
|
22
25
|
const prepared = Cfg.getTunnel(name);
|
|
23
|
-
|
|
26
|
+
const jsonl = options.format === 'jsonl';
|
|
27
|
+
if (!jsonl)
|
|
28
|
+
await output_1.default.spinner(texts_1.TXT_OPENING_TUNNEL);
|
|
24
29
|
const agent = await ApiBuddy.register(false, false, true, false, host, token, [], (0, utils_1.getCurrentUser)(), {}, (region) => {
|
|
25
30
|
Cfg.setRegionIfNotSet(region);
|
|
26
31
|
});
|
|
@@ -28,6 +33,6 @@ commandStart.action(async (name, options) => {
|
|
|
28
33
|
agent.startRefreshingConfiguration();
|
|
29
34
|
const tunnel = await ApiBuddy.addTunnel(agent.id, agent.host, agent.token, prepared);
|
|
30
35
|
agent.addTunnel(tunnel);
|
|
31
|
-
output_1.default.tunnel(tunnel);
|
|
36
|
+
output_1.default.tunnel(tunnel, jsonl);
|
|
32
37
|
});
|
|
33
38
|
exports.default = commandStart;
|
|
@@ -7,9 +7,10 @@ const utils_1 = require("../../utils");
|
|
|
7
7
|
const output_1 = __importDefault(require("../../output"));
|
|
8
8
|
const texts_1 = require("../../texts");
|
|
9
9
|
const tunnel_1 = require("../../types/tunnel");
|
|
10
|
-
const commandTcp = (0, utils_1.getBasicCommandTcp)({ examples: (0, texts_1.EXAMPLE_TUNNEL_TCP)(false) });
|
|
10
|
+
const commandTcp = (0, utils_1.getBasicCommandTcp)({ requiredScopes: [], examples: (0, texts_1.EXAMPLE_TUNNEL_TCP)(false) });
|
|
11
11
|
commandTcp.description(texts_1.DESC_COMMAND_TCP);
|
|
12
12
|
commandTcp.option('--token <token>', texts_1.OPTION_TOKEN);
|
|
13
|
+
commandTcp.option('--format <text|jsonl>', texts_1.OPTION_FORMAT_JSONL);
|
|
13
14
|
commandTcp.argument('[host:port]', texts_1.OPTION_TARGET);
|
|
14
15
|
commandTcp.action(async (target, options) => {
|
|
15
16
|
const ApiBuddy = require('../../tunnel/api/buddy').default;
|
|
@@ -17,7 +18,9 @@ commandTcp.action(async (target, options) => {
|
|
|
17
18
|
const Cfg = require('../../tunnel/cfg').default;
|
|
18
19
|
const { host, token } = await Input.tunnelToken(options.token);
|
|
19
20
|
const prepared = await Cfg.prepareTunnel(tunnel_1.TUNNEL_TYPE.TCP, target, options, true);
|
|
20
|
-
|
|
21
|
+
const jsonl = options.format === 'jsonl';
|
|
22
|
+
if (!jsonl)
|
|
23
|
+
await output_1.default.spinner(texts_1.TXT_OPENING_TUNNEL);
|
|
21
24
|
const agent = await ApiBuddy.register(false, false, true, false, host, token, [], (0, utils_1.getCurrentUser)(), {}, (region) => {
|
|
22
25
|
Cfg.setRegionIfNotSet(region);
|
|
23
26
|
});
|
|
@@ -25,6 +28,6 @@ commandTcp.action(async (target, options) => {
|
|
|
25
28
|
agent.startRefreshingConfiguration();
|
|
26
29
|
const tunnel = await ApiBuddy.addTunnel(agent.id, agent.host, agent.token, prepared);
|
|
27
30
|
agent.addTunnel(tunnel);
|
|
28
|
-
output_1.default.tunnel(tunnel);
|
|
31
|
+
output_1.default.tunnel(tunnel, jsonl);
|
|
29
32
|
});
|
|
30
33
|
exports.default = commandTcp;
|
|
@@ -7,9 +7,10 @@ const utils_1 = require("../../utils");
|
|
|
7
7
|
const output_1 = __importDefault(require("../../output"));
|
|
8
8
|
const texts_1 = require("../../texts");
|
|
9
9
|
const tunnel_1 = require("../../types/tunnel");
|
|
10
|
-
const commandTls = (0, utils_1.getBasicCommandTls)({ examples: (0, texts_1.EXAMPLE_TUNNEL_TLS)(false) });
|
|
10
|
+
const commandTls = (0, utils_1.getBasicCommandTls)({ requiredScopes: [], examples: (0, texts_1.EXAMPLE_TUNNEL_TLS)(false) });
|
|
11
11
|
commandTls.description(texts_1.DESC_COMMAND_TLS);
|
|
12
12
|
commandTls.option('--token <token>', texts_1.OPTION_TOKEN);
|
|
13
|
+
commandTls.option('--format <text|jsonl>', texts_1.OPTION_FORMAT_JSONL);
|
|
13
14
|
commandTls.argument('[host:port]', texts_1.OPTION_TARGET);
|
|
14
15
|
commandTls.action(async (target, options) => {
|
|
15
16
|
const ApiBuddy = require('../../tunnel/api/buddy').default;
|
|
@@ -17,7 +18,9 @@ commandTls.action(async (target, options) => {
|
|
|
17
18
|
const Cfg = require('../../tunnel/cfg').default;
|
|
18
19
|
const { token, host } = await Input.tunnelToken(options.token);
|
|
19
20
|
const prepared = await Cfg.prepareTunnel(tunnel_1.TUNNEL_TYPE.TLS, target, options, true);
|
|
20
|
-
|
|
21
|
+
const jsonl = options.format === 'jsonl';
|
|
22
|
+
if (!jsonl)
|
|
23
|
+
await output_1.default.spinner(texts_1.TXT_OPENING_TUNNEL);
|
|
21
24
|
const agent = await ApiBuddy.register(false, false, true, false, host, token, [], (0, utils_1.getCurrentUser)(), {}, (region) => {
|
|
22
25
|
Cfg.setRegionIfNotSet(region);
|
|
23
26
|
});
|
|
@@ -25,6 +28,6 @@ commandTls.action(async (target, options) => {
|
|
|
25
28
|
agent.startRefreshingConfiguration();
|
|
26
29
|
const tunnel = await ApiBuddy.addTunnel(agent.id, agent.host, agent.token, prepared);
|
|
27
30
|
agent.addTunnel(tunnel);
|
|
28
|
-
output_1.default.tunnel(tunnel);
|
|
31
|
+
output_1.default.tunnel(tunnel, jsonl);
|
|
29
32
|
});
|
|
30
33
|
exports.default = commandTls;
|
|
@@ -7,7 +7,18 @@ const utils_1 = require("../utils");
|
|
|
7
7
|
const output_1 = __importDefault(require("../output"));
|
|
8
8
|
const utils_2 = require("../utils");
|
|
9
9
|
const texts_1 = require("../texts");
|
|
10
|
+
// set by the action; every install path below ends in updateMessage
|
|
11
|
+
let json = false;
|
|
10
12
|
const updateMessage = (currentVersion, latestVersion, instructions) => {
|
|
13
|
+
if (json) {
|
|
14
|
+
output_1.default.json({
|
|
15
|
+
current_version: currentVersion,
|
|
16
|
+
latest_version: latestVersion,
|
|
17
|
+
update_available: true,
|
|
18
|
+
instructions,
|
|
19
|
+
});
|
|
20
|
+
output_1.default.exitNormal();
|
|
21
|
+
}
|
|
11
22
|
output_1.default.normal('Current version: ', false);
|
|
12
23
|
output_1.default.gray(currentVersion);
|
|
13
24
|
output_1.default.normal('Latest version: ', false);
|
|
@@ -72,10 +83,12 @@ const updateByDownload = (platform, currentVersion, latestVersion, env) => {
|
|
|
72
83
|
}
|
|
73
84
|
updateMessage(currentVersion, latestVersion, instructions);
|
|
74
85
|
};
|
|
75
|
-
const commandVersion = (0, utils_2.newCommand)('update', texts_1.DESC_COMMAND_UPDATE);
|
|
86
|
+
const commandVersion = (0, utils_2.newCommand)('update', texts_1.DESC_COMMAND_UPDATE, { requiredScopes: [] });
|
|
76
87
|
commandVersion.alias('version');
|
|
77
88
|
commandVersion.hideVersionUpdate = true;
|
|
78
|
-
commandVersion.
|
|
89
|
+
commandVersion.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
90
|
+
commandVersion.action(async (options) => {
|
|
91
|
+
json = options.format === 'json';
|
|
79
92
|
const currVersion = commandVersion.currentVersion || '';
|
|
80
93
|
const lastVersion = commandVersion.latestVersion || '';
|
|
81
94
|
const env = commandVersion.env || '';
|
|
@@ -114,6 +127,15 @@ commandVersion.action(async () => {
|
|
|
114
127
|
return;
|
|
115
128
|
}
|
|
116
129
|
}
|
|
130
|
+
if (json) {
|
|
131
|
+
output_1.default.json({
|
|
132
|
+
current_version: currVersion,
|
|
133
|
+
latest_version: lastVersion || null,
|
|
134
|
+
update_available: false,
|
|
135
|
+
instructions: null,
|
|
136
|
+
});
|
|
137
|
+
output_1.default.exitNormal();
|
|
138
|
+
}
|
|
117
139
|
output_1.default.exitNormal(currVersion);
|
|
118
140
|
});
|
|
119
141
|
exports.default = commandVersion;
|
|
@@ -8,7 +8,7 @@ const texts_1 = require("../texts");
|
|
|
8
8
|
const output_1 = __importDefault(require("../output"));
|
|
9
9
|
const input_1 = __importDefault(require("../input"));
|
|
10
10
|
const cfg_1 = __importDefault(require("../project/cfg"));
|
|
11
|
-
const commandWhoami = (0, utils_1.newCommand)('whoami', texts_1.DESC_COMMAND_WHOAMI);
|
|
11
|
+
const commandWhoami = (0, utils_1.newCommand)('whoami', texts_1.DESC_COMMAND_WHOAMI, { requiredScopes: [utils_1.REST_API_SCOPE.USER_READ] });
|
|
12
12
|
commandWhoami.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
13
13
|
commandWhoami.action(async (options) => {
|
|
14
14
|
const { workspace, project, localWorkspace } = input_1.default.accountScope();
|
|
@@ -7,12 +7,17 @@ const input_1 = __importDefault(require("../../input"));
|
|
|
7
7
|
const output_1 = __importDefault(require("../../output"));
|
|
8
8
|
const texts_1 = require("../../texts");
|
|
9
9
|
const utils_1 = require("../../utils");
|
|
10
|
-
const commandWorkspaceGet = (0, utils_1.newCommand)('get', texts_1.DESC_COMMAND_WORKSPACE_GET);
|
|
11
|
-
commandWorkspaceGet.
|
|
10
|
+
const commandWorkspaceGet = (0, utils_1.newCommand)('get', texts_1.DESC_COMMAND_WORKSPACE_GET, { requiredScopes: [] });
|
|
11
|
+
commandWorkspaceGet.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
12
|
+
commandWorkspaceGet.action(async (options) => {
|
|
12
13
|
const { workspace } = input_1.default.accountScope();
|
|
13
14
|
if (!workspace) {
|
|
14
15
|
output_1.default.exitError(texts_1.TXT_WORKSPACE_NONE);
|
|
15
16
|
}
|
|
17
|
+
if (options.format === 'json') {
|
|
18
|
+
output_1.default.json({ workspace });
|
|
19
|
+
output_1.default.exitNormal();
|
|
20
|
+
}
|
|
16
21
|
output_1.default.exitNormal(workspace);
|
|
17
22
|
});
|
|
18
23
|
exports.default = commandWorkspaceGet;
|
|
@@ -7,7 +7,7 @@ const output_1 = __importDefault(require("../../output"));
|
|
|
7
7
|
const texts_1 = require("../../texts");
|
|
8
8
|
const utils_1 = require("../../utils");
|
|
9
9
|
const input_1 = __importDefault(require("../../input"));
|
|
10
|
-
const commandWorkspaceList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_WORKSPACE_LIST);
|
|
10
|
+
const commandWorkspaceList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_WORKSPACE_LIST, { requiredScopes: [utils_1.REST_API_SCOPE.WORKSPACE_READ] });
|
|
11
11
|
commandWorkspaceList.alias('ls');
|
|
12
12
|
commandWorkspaceList.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
13
13
|
commandWorkspaceList.action(async (options) => {
|
|
@@ -9,16 +9,18 @@ const input_1 = __importDefault(require("../../input"));
|
|
|
9
9
|
const output_1 = __importDefault(require("../../output"));
|
|
10
10
|
const cliError_1 = __importDefault(require("../../cliError"));
|
|
11
11
|
const commandWorkspaceOpen = (0, utils_1.newCommand)('open', texts_1.DESC_COMMAND_RESOURCE_OPEN, {
|
|
12
|
+
requiredScopes: [utils_1.REST_API_SCOPE.WORKSPACE_READ],
|
|
12
13
|
examples: [{ description: 'Open the current workspace in Buddy', command: 'bdy workspace open' }],
|
|
13
14
|
});
|
|
15
|
+
commandWorkspaceOpen.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
14
16
|
commandWorkspaceOpen.argument('[domain]', texts_1.OPTION_REST_API_WORKSPACE);
|
|
15
|
-
commandWorkspaceOpen.action(async (domain) => {
|
|
17
|
+
commandWorkspaceOpen.action(async (domain, options) => {
|
|
16
18
|
const workspace = input_1.default.restApiWorkspace(domain);
|
|
17
19
|
const client = input_1.default.restApiTokenClient();
|
|
18
20
|
const response = await client.getWorkspaces();
|
|
19
21
|
const found = response.workspaces.find((item) => item.domain === workspace);
|
|
20
22
|
if (!found)
|
|
21
23
|
throw new cliError_1.default('not_found', (0, texts_1.ERR_WORKSPACE_OPEN_NOT_FOUND)(workspace));
|
|
22
|
-
await output_1.default.openUrl(found.html_url);
|
|
24
|
+
await output_1.default.openUrl(found.html_url, options.format === 'json');
|
|
23
25
|
});
|
|
24
26
|
exports.default = commandWorkspaceOpen;
|
|
@@ -8,10 +8,11 @@ const output_1 = __importDefault(require("../../output"));
|
|
|
8
8
|
const texts_1 = require("../../texts");
|
|
9
9
|
const utils_1 = require("../../utils");
|
|
10
10
|
const input_1 = __importDefault(require("../../input"));
|
|
11
|
-
const commandWorkspaceSet = (0, utils_1.newCommand)('set', texts_1.DESC_COMMAND_WORKSPACE_SET);
|
|
11
|
+
const commandWorkspaceSet = (0, utils_1.newCommand)('set', texts_1.DESC_COMMAND_WORKSPACE_SET, { requiredScopes: [utils_1.REST_API_SCOPE.WORKSPACE_READ] });
|
|
12
12
|
commandWorkspaceSet.usesDefaultContext = true;
|
|
13
13
|
commandWorkspaceSet.argument('[workspace]', texts_1.ARG_COMMAND_WORKSPACE);
|
|
14
|
-
commandWorkspaceSet.
|
|
14
|
+
commandWorkspaceSet.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
15
|
+
commandWorkspaceSet.action(async (workspaceDomain, options) => {
|
|
15
16
|
output_1.default.handleSignals();
|
|
16
17
|
const client = input_1.default.restApiTokenClient();
|
|
17
18
|
const response = await client.getWorkspaces();
|
|
@@ -30,6 +31,6 @@ commandWorkspaceSet.action(async (workspaceDomain) => {
|
|
|
30
31
|
workspace = await output_1.default.selectWorkspace(response.workspaces);
|
|
31
32
|
}
|
|
32
33
|
cfg_1.default.setWorkspace(workspace);
|
|
33
|
-
output_1.default.
|
|
34
|
+
output_1.default.exitResult(options.format === 'json', { workspace }, (0, texts_1.TXT_WORKSPACE_SET_SUCCESS)(workspace));
|
|
34
35
|
});
|
|
35
36
|
exports.default = commandWorkspaceSet;
|
|
@@ -13,7 +13,7 @@ const render_1 = require("../render");
|
|
|
13
13
|
async function suggestionLine(query) {
|
|
14
14
|
return (await (0, schema_1.searchActions)(query, 5)).map((hit) => `${hit.type} (${hit.name})`);
|
|
15
15
|
}
|
|
16
|
-
const commandYamlActionsInfo = (0, utils_1.newCommand)('info', texts_1.DESC_COMMAND_YAML_ACTIONS_INFO, { examples: texts_1.EXAMPLE_YAML_ACTIONS_INFO });
|
|
16
|
+
const commandYamlActionsInfo = (0, utils_1.newCommand)('info', texts_1.DESC_COMMAND_YAML_ACTIONS_INFO, { requiredScopes: [], examples: texts_1.EXAMPLE_YAML_ACTIONS_INFO });
|
|
17
17
|
commandYamlActionsInfo.argument('<type>', texts_1.OPTION_ACTION_TYPE);
|
|
18
18
|
commandYamlActionsInfo.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
19
19
|
commandYamlActionsInfo.action(async (type, options) => {
|
|
@@ -26,7 +26,7 @@ function actionJson(actions, detectedTypes) {
|
|
|
26
26
|
suggested: detectedTypes.has(action.type),
|
|
27
27
|
}));
|
|
28
28
|
}
|
|
29
|
-
const commandYamlActionsList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_YAML_ACTIONS_LIST, { examples: texts_1.EXAMPLE_YAML_ACTIONS_LIST });
|
|
29
|
+
const commandYamlActionsList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_YAML_ACTIONS_LIST, { requiredScopes: [], examples: texts_1.EXAMPLE_YAML_ACTIONS_LIST });
|
|
30
30
|
commandYamlActionsList.alias('ls');
|
|
31
31
|
commandYamlActionsList.option('-s, --search <query>', texts_1.OPTION_ACTION_SEARCH);
|
|
32
32
|
commandYamlActionsList.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
@@ -9,6 +9,7 @@ const texts_1 = require("../../texts");
|
|
|
9
9
|
const schemaUtils_1 = require("./schemaUtils");
|
|
10
10
|
const render_1 = require("./render");
|
|
11
11
|
const commandYamlPipeline = (0, utils_1.newCommand)('pipeline', texts_1.DESC_COMMAND_YAML_PIPELINE, {
|
|
12
|
+
requiredScopes: [],
|
|
12
13
|
examples: texts_1.EXAMPLE_YAML_PIPELINE,
|
|
13
14
|
});
|
|
14
15
|
commandYamlPipeline.option('--format <text|json>', texts_1.OPTION_FORMAT);
|
|
@@ -353,6 +353,7 @@ function validatePipelineFile(file, unions, json) {
|
|
|
353
353
|
}
|
|
354
354
|
}
|
|
355
355
|
const commandYamlValidate = (0, utils_1.newCommand)('validate', texts_1.DESC_COMMAND_YAML_VALIDATE, {
|
|
356
|
+
requiredScopes: [],
|
|
356
357
|
helpText: texts_1.HELP_YAML_VALIDATE_JSON,
|
|
357
358
|
examples: texts_1.EXAMPLE_YAML_VALIDATE,
|
|
358
359
|
});
|