bdy 1.25.39-dev-pr → 1.25.39-stage
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 -2
- package/distTs/src/api/client.js +1 -191
- package/distTs/src/cliError.js +0 -5
- package/distTs/src/cliIndex.js +0 -3
- package/distTs/src/command/login.js +1 -1
- package/distTs/src/output/pipeline.js +56 -54
- package/distTs/src/output.js +22 -85
- package/distTs/src/texts.js +1 -509
- package/distTs/src/tunnel/output/interactive/tunnel.js +10 -14
- package/distTs/src/tunnel/output/noninteractive/tunnel.js +1 -3
- package/distTs/src/utils.js +6 -142
- package/package.json +1 -2
- package/distTs/src/autocomplete.js +0 -90
- package/distTs/src/command/artifact/downloadDir.js +0 -110
- package/distTs/src/command/autocomplete/install.js +0 -16
- package/distTs/src/command/autocomplete/uninstall.js +0 -16
- package/distTs/src/command/autocomplete.js +0 -14
- package/distTs/src/command/environment/resolve.js +0 -39
- package/distTs/src/command/package/create.js +0 -64
- package/distTs/src/command/package/delete.js +0 -38
- package/distTs/src/command/package/docker/login.js +0 -26
- package/distTs/src/command/package/docker.js +0 -11
- package/distTs/src/command/package/download.js +0 -138
- package/distTs/src/command/package/get.js +0 -36
- package/distTs/src/command/package/list.js +0 -31
- package/distTs/src/command/package/publish.js +0 -241
- package/distTs/src/command/package/version/delete.js +0 -39
- package/distTs/src/command/package/version/get.js +0 -45
- package/distTs/src/command/package/version/list.js +0 -47
- package/distTs/src/command/package/version.js +0 -16
- package/distTs/src/command/package.js +0 -26
- package/distTs/src/command/pipeline/run/apply.js +0 -62
- package/distTs/src/command/pr/comment/add.js +0 -66
- package/distTs/src/command/pr/comment/list.js +0 -167
- package/distTs/src/command/pr/comment/status.js +0 -50
- package/distTs/src/command/pr/comment.js +0 -19
- package/distTs/src/command/pr/create.js +0 -44
- package/distTs/src/command/pr/diff.js +0 -337
- package/distTs/src/command/pr/file/list.js +0 -139
- package/distTs/src/command/pr/file/mark.js +0 -45
- package/distTs/src/command/pr/file.js +0 -16
- package/distTs/src/command/pr/get.js +0 -29
- package/distTs/src/command/pr/list.js +0 -79
- package/distTs/src/command/pr/merge.js +0 -67
- package/distTs/src/command/pr/review/request.js +0 -30
- package/distTs/src/command/pr/review/start.js +0 -29
- package/distTs/src/command/pr/review/verdict.js +0 -81
- package/distTs/src/command/pr/review.js +0 -18
- package/distTs/src/command/pr/shared.js +0 -704
- package/distTs/src/command/pr/state.js +0 -38
- package/distTs/src/command/pr/summary.js +0 -341
- package/distTs/src/command/pr/update.js +0 -56
- package/distTs/src/command/pr/updateBranch.js +0 -22
- package/distTs/src/command/pr/versions.js +0 -42
- package/distTs/src/command/pr.js +0 -39
- package/distTs/src/command/scrape/validation.js +0 -154
- package/distTs/src/command/scrape.js +0 -144
- package/distTs/src/command/suiteLink.js +0 -14
- package/distTs/src/command/tests/visual/result/download.js +0 -31
- package/distTs/src/command/tests/visual/result/get.js +0 -68
- package/distTs/src/command/tests/visual/result/list.js +0 -49
- package/distTs/src/command/tests/visual/result.js +0 -23
- package/distTs/src/command/tests/visual/session/get.js +0 -70
- package/distTs/src/command/tests/visual/session/list.js +0 -69
- package/distTs/src/command/tests/visual/session/open.js +0 -22
- package/distTs/src/command/tests/visual/session/reviewUrl.js +0 -37
- package/distTs/src/command/tests/visual/session/update.js +0 -26
- package/distTs/src/command/tests/visual/shared/context.js +0 -144
- package/distTs/src/command/tests/visual/shared/diffRegions.js +0 -172
- package/distTs/src/command/tests/visual/shared/format.js +0 -21
- package/distTs/src/command/tests/visual/shared/lookup.js +0 -107
- package/distTs/src/command/tests/visual/shared/options.js +0 -90
- package/distTs/src/command/tests/visual/shared/review.js +0 -146
- package/distTs/src/command/tests/visual/shared/reviewUrl.js +0 -62
- package/distTs/src/command/tests/visual/shared/session.js +0 -217
- package/distTs/src/command/tests/visual/snapshot/get.js +0 -46
- package/distTs/src/command/tests/visual/snapshot/list.js +0 -68
- package/distTs/src/command/tests/visual/snapshot/open.js +0 -26
- package/distTs/src/command/tests/visual/snapshot/reviewUrl.js +0 -48
- package/distTs/src/command/tests/visual/snapshot.js +0 -28
- package/distTs/src/command/tests/visual/suite/create.js +0 -38
- package/distTs/src/command/tests/visual/suite/delete.js +0 -29
- package/distTs/src/command/tests/visual/suite/get.js +0 -43
- package/distTs/src/command/tests/visual/suite/list.js +0 -35
- package/distTs/src/command/tests/visual/suite/open.js +0 -20
- package/distTs/src/command/tests/visual/suite/update.js +0 -47
- package/distTs/src/command/tests/visual/suite.js +0 -30
- package/distTs/src/command/ut/upload.js +0 -86
- package/distTs/src/command/ut.js +0 -12
- package/distTs/src/command/vt/close.js +0 -27
- package/distTs/src/command/vt/compare/validation.js +0 -46
- package/distTs/src/command/vt/compare.js +0 -100
- package/distTs/src/command/vt/exec.js +0 -82
- package/distTs/src/command/vt/installBrowser.js +0 -20
- package/distTs/src/command/vt/shared/validation.js +0 -145
- package/distTs/src/command/vt/storybook.js +0 -138
- package/distTs/src/command/vt.js +0 -20
- package/distTs/src/command/yaml/agents.js +0 -88
- package/distTs/src/command/yaml/init.js +0 -110
- package/distTs/src/main.js +0 -190
- package/distTs/src/types/options.js +0 -2
- package/distTs/src/types/scrape.js +0 -2
- package/distTs/src/types/visualTests.js +0 -2
|
@@ -1,62 +0,0 @@
|
|
|
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 input_1 = __importDefault(require("../../../input"));
|
|
9
|
-
const output_1 = __importDefault(require("../../../output"));
|
|
10
|
-
const pipeline_1 = require("../../../types/pipeline");
|
|
11
|
-
const commandPipelineRunApply = (0, utils_1.newCommand)('apply', texts_1.DESC_COMMAND_PIPELINE_RUN_APPLY);
|
|
12
|
-
commandPipelineRunApply.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
13
|
-
commandPipelineRunApply.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
14
|
-
commandPipelineRunApply.option('-n, --no-wait', texts_1.OPTION_PIPELINE_RUN_NO_WAIT);
|
|
15
|
-
commandPipelineRunApply.argument('<identifier>', texts_1.OPTION_PIPELINE_RUN_ARGUMENT);
|
|
16
|
-
commandPipelineRunApply.argument('<run-id>', texts_1.OPTION_PIPELINE_RUN_ID);
|
|
17
|
-
commandPipelineRunApply.argument('<run-action-id>', texts_1.OPTION_PIPELINE_RUN_ACTION_ID);
|
|
18
|
-
commandPipelineRunApply.option('-v,--variable <variables...>', texts_1.OPTION_PIPELINE_RUN_VAR);
|
|
19
|
-
commandPipelineRunApply.addHelpText('after', texts_1.EXAMPLE_PIPELINE_RUN_APPLY);
|
|
20
|
-
commandPipelineRunApply.action(async (identifier, runId, runActionId, options) => {
|
|
21
|
-
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
22
|
-
const project = input_1.default.restApiProject(options.project);
|
|
23
|
-
const rid = input_1.default.pipelineRunId(runId);
|
|
24
|
-
const variables = input_1.default.pipelineRunVariable(options.variable || [], false);
|
|
25
|
-
const client = input_1.default.restApiTokenClient();
|
|
26
|
-
const data = await client.getPipelineByIdentifier(workspace, project, identifier);
|
|
27
|
-
if (!data || !data.domain) {
|
|
28
|
-
output_1.default.exitError(texts_1.ERR_WORKSPACE_NOT_FOUND);
|
|
29
|
-
}
|
|
30
|
-
if (!data.project_identifier) {
|
|
31
|
-
output_1.default.exitError(texts_1.ERR_PROJECT_NOT_FOUND);
|
|
32
|
-
}
|
|
33
|
-
if (!data.pipeline_id) {
|
|
34
|
-
output_1.default.exitError(texts_1.ERR_PIPELINE_NOT_FOUND);
|
|
35
|
-
}
|
|
36
|
-
const a = await client.getPipelineRunActionExecution(workspace, project, data.pipeline_id, rid, runActionId);
|
|
37
|
-
let type;
|
|
38
|
-
if (a.status === pipeline_1.PIPELINE_RUN_STATUS.WAITING_FOR_APPLY) {
|
|
39
|
-
type = 'APPLY';
|
|
40
|
-
}
|
|
41
|
-
else if (a.status === pipeline_1.PIPELINE_RUN_STATUS.WAITING_FOR_VT_SESSION) {
|
|
42
|
-
type = 'APPROVE_VT';
|
|
43
|
-
}
|
|
44
|
-
else if (a.status === pipeline_1.PIPELINE_RUN_STATUS.WAITING_FOR_VARIABLES) {
|
|
45
|
-
type = 'APPLY_VARIABLES';
|
|
46
|
-
}
|
|
47
|
-
else if (a.status === pipeline_1.PIPELINE_RUN_STATUS.WAITING_FOR_SETTABLE_VARIABLES) {
|
|
48
|
-
type = 'SET_VARIABLES';
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
output_1.default.exitError(texts_1.ERR_CANT_APPLY_ACTION_EXECUTION);
|
|
52
|
-
}
|
|
53
|
-
const body = {
|
|
54
|
-
operation: type,
|
|
55
|
-
approve_action_id: runActionId,
|
|
56
|
-
variables,
|
|
57
|
-
};
|
|
58
|
-
await client.pipelineRunApply(workspace, project, data.pipeline_id, rid, body);
|
|
59
|
-
const OutputPipeline = require('../../../output/pipeline').default;
|
|
60
|
-
await OutputPipeline.runStatus(client, workspace, project, data.pipeline_id, rid, !options.wait);
|
|
61
|
-
});
|
|
62
|
-
exports.default = commandPipelineRunApply;
|
|
@@ -1,66 +0,0 @@
|
|
|
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 cliError_1 = __importDefault(require("../../../cliError"));
|
|
10
|
-
const shared_1 = require("../shared");
|
|
11
|
-
const commandPrCommentAdd = (0, utils_1.newCommand)('add', texts_1.DESC_COMMAND_PR_COMMENT_ADD, {
|
|
12
|
-
requiredScopes: [utils_1.REST_API_SCOPE.REPOSITORY_WRITE],
|
|
13
|
-
examples: texts_1.EXAMPLE_PR_COMMENT_ADD,
|
|
14
|
-
});
|
|
15
|
-
(0, shared_1.addPrOptions)(commandPrCommentAdd, true);
|
|
16
|
-
commandPrCommentAdd.option('-m, --message <text|->', texts_1.OPTION_PR_MESSAGE);
|
|
17
|
-
commandPrCommentAdd.option('-F, --message-file <path|->', texts_1.OPTION_PR_MESSAGE_FILE);
|
|
18
|
-
commandPrCommentAdd.option('--path <path>', texts_1.OPTION_PR_COMMENT_PATH);
|
|
19
|
-
commandPrCommentAdd.option('--new-line <n>', texts_1.OPTION_PR_NEW_LINE);
|
|
20
|
-
commandPrCommentAdd.option('--old-line <n>', texts_1.OPTION_PR_OLD_LINE);
|
|
21
|
-
commandPrCommentAdd.option('--thread <id>', texts_1.OPTION_PR_COMMENT_THREAD);
|
|
22
|
-
commandPrCommentAdd.argument('[N]', texts_1.OPTION_PR_NUMBER);
|
|
23
|
-
commandPrCommentAdd.action(async (n, options) => {
|
|
24
|
-
const hasLine = options.newLine !== undefined || options.oldLine !== undefined;
|
|
25
|
-
if (options.path && options.thread)
|
|
26
|
-
throw new cliError_1.default('usage_error', texts_1.ERR_PR_COMMENT_MODES);
|
|
27
|
-
if (!options.path && hasLine)
|
|
28
|
-
throw new cliError_1.default('usage_error', texts_1.ERR_PR_COMMENT_LINE_WITHOUT_PATH);
|
|
29
|
-
if (options.path && (options.newLine === undefined) === (options.oldLine === undefined)) {
|
|
30
|
-
throw new cliError_1.default('usage_error', texts_1.ERR_PR_COMMENT_LINE);
|
|
31
|
-
}
|
|
32
|
-
const newLine = (0, shared_1.parseLine)(options.newLine, '--new-line');
|
|
33
|
-
const oldLine = (0, shared_1.parseLine)(options.oldLine, '--old-line');
|
|
34
|
-
// validated always; it picks the version only for a new thread, a comment or a reply does not depend on one
|
|
35
|
-
const version = (0, shared_1.parseRev)(options.rev);
|
|
36
|
-
const comment = (0, shared_1.readText)(options);
|
|
37
|
-
const json = options.format === 'json';
|
|
38
|
-
const scope = (0, shared_1.prScope)(options);
|
|
39
|
-
const number = await (0, shared_1.resolveNumber)(scope, n);
|
|
40
|
-
const { client, workspace, project } = scope;
|
|
41
|
-
if (options.thread) {
|
|
42
|
-
const thread = await client.addPullRequestThreadComment(workspace, project, number, options.thread, comment);
|
|
43
|
-
output_1.default.exitResult(json, thread, (0, texts_1.TXT_PR_THREAD_REPLIED)(options.thread));
|
|
44
|
-
}
|
|
45
|
-
if (options.path) {
|
|
46
|
-
const thread = await client.addPullRequestThread(workspace, project, number, {
|
|
47
|
-
path: options.path,
|
|
48
|
-
new_line: newLine.line,
|
|
49
|
-
old_line: oldLine.line,
|
|
50
|
-
start_line: newLine.start ?? oldLine.start,
|
|
51
|
-
comment,
|
|
52
|
-
version,
|
|
53
|
-
});
|
|
54
|
-
if (json)
|
|
55
|
-
output_1.default.exitResult(true, thread);
|
|
56
|
-
const opened = thread.created_version ?? thread.position?.version ?? version;
|
|
57
|
-
if (version) {
|
|
58
|
-
const pr = await client.getPullRequest(workspace, project, number);
|
|
59
|
-
(0, shared_1.noteVersionBehind)(pr?.version, version);
|
|
60
|
-
}
|
|
61
|
-
output_1.default.exitSuccess((0, texts_1.TXT_PR_THREAD_ADDED)(thread.id, (0, shared_1.positionText)(thread.position), opened));
|
|
62
|
-
}
|
|
63
|
-
const result = await client.addPullRequestComment(workspace, project, number, comment);
|
|
64
|
-
output_1.default.exitResult(json, result, texts_1.TXT_PR_COMMENT_ADDED);
|
|
65
|
-
});
|
|
66
|
-
exports.default = commandPrCommentAdd;
|
|
@@ -1,167 +0,0 @@
|
|
|
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 cliError_1 = __importDefault(require("../../../cliError"));
|
|
10
|
-
const shared_1 = require("../shared");
|
|
11
|
-
const summary_1 = require("../summary");
|
|
12
|
-
const commandPrCommentList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_PR_COMMENT_LIST, {
|
|
13
|
-
requiredScopes: [utils_1.REST_API_SCOPE.REPOSITORY_READ],
|
|
14
|
-
examples: texts_1.EXAMPLE_PR_COMMENT_LIST,
|
|
15
|
-
});
|
|
16
|
-
commandPrCommentList.alias('ls');
|
|
17
|
-
(0, shared_1.addPrOptions)(commandPrCommentList, true);
|
|
18
|
-
commandPrCommentList.option('--since-review', texts_1.OPTION_PR_COMMENT_SINCE_REVIEW);
|
|
19
|
-
commandPrCommentList.option('--threads', texts_1.OPTION_PR_COMMENT_THREADS);
|
|
20
|
-
commandPrCommentList.option('--thread <id>', texts_1.OPTION_PR_COMMENT_THREAD);
|
|
21
|
-
commandPrCommentList.option('--status <status>', texts_1.OPTION_PR_THREAD_STATUS);
|
|
22
|
-
commandPrCommentList.option('--path <path>', texts_1.OPTION_PR_THREAD_PATH);
|
|
23
|
-
commandPrCommentList.argument('[N]', texts_1.OPTION_PR_NUMBER);
|
|
24
|
-
const printMessage = (who, date, text, indent) => {
|
|
25
|
-
const lines = (text || '').split('\n');
|
|
26
|
-
output_1.default.normal(`${indent}${(0, shared_1.memberName)(who)} (${(0, shared_1.formatDate)(date)}): ${lines[0]}`);
|
|
27
|
-
lines.slice(1).forEach((line) => output_1.default.normal(`${indent} ${line}`));
|
|
28
|
-
};
|
|
29
|
-
/** The full diff of every path the threads sit on, parsed, for the code around a thread. */
|
|
30
|
-
const patchesOf = async (scope, number, version, threads) => {
|
|
31
|
-
const paths = [...new Set(threads.map((t) => t.position?.path).filter(Boolean))];
|
|
32
|
-
const result = new Map();
|
|
33
|
-
await Promise.all(paths.map(async (path) => {
|
|
34
|
-
try {
|
|
35
|
-
const diff = await scope.client.getPullRequestDiff(scope.workspace, scope.project, number, {
|
|
36
|
-
path,
|
|
37
|
-
version,
|
|
38
|
-
full: true,
|
|
39
|
-
});
|
|
40
|
-
result.set(path, (0, shared_1.parsePatch)(diff?.patch));
|
|
41
|
-
}
|
|
42
|
-
catch {
|
|
43
|
-
result.set(path, []);
|
|
44
|
-
}
|
|
45
|
-
}));
|
|
46
|
-
return result;
|
|
47
|
-
};
|
|
48
|
-
const listActivity = async (scope, number, options) => {
|
|
49
|
-
const since = options.sinceReview
|
|
50
|
-
? (await (0, shared_1.requireMyReview)(scope, number)).last_update_date
|
|
51
|
-
: undefined;
|
|
52
|
-
const result = await scope.client.getPullRequestActivity(scope.workspace, scope.project, number, since);
|
|
53
|
-
const activities = result?.activities || [];
|
|
54
|
-
if (options.format === 'json') {
|
|
55
|
-
output_1.default.json(activities);
|
|
56
|
-
output_1.default.exitNormal();
|
|
57
|
-
}
|
|
58
|
-
if (activities.length === 0)
|
|
59
|
-
output_1.default.exitNormal(texts_1.TXT_PR_ACTIVITY_NOT_FOUND);
|
|
60
|
-
for (const entry of activities) {
|
|
61
|
-
// the line says what happened; a comment then follows in full
|
|
62
|
-
output_1.default.normal((0, summary_1.activityLine)(entry));
|
|
63
|
-
if (entry.type === utils_1.PR_ACTIVITY_TYPE.COMMENT) {
|
|
64
|
-
(entry.comment || '').split('\n').slice(1).forEach((line) => output_1.default.normal(` ${line}`));
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
output_1.default.exitNormal();
|
|
68
|
-
};
|
|
69
|
-
const listThreads = async (scope, number, version, options) => {
|
|
70
|
-
let status;
|
|
71
|
-
if (options.status) {
|
|
72
|
-
status = String(options.status).toUpperCase();
|
|
73
|
-
if (!Object.values(utils_1.PR_THREAD_STATUS).includes(status)) {
|
|
74
|
-
throw new cliError_1.default('usage_error', texts_1.ERR_PR_THREAD_STATUS);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
const result = await (0, shared_1.fetchAllThreads)(scope, number, {
|
|
78
|
-
version,
|
|
79
|
-
status,
|
|
80
|
-
path: options.path,
|
|
81
|
-
});
|
|
82
|
-
const threads = result.threads || [];
|
|
83
|
-
if (options.format === 'json') {
|
|
84
|
-
output_1.default.json(threads);
|
|
85
|
-
output_1.default.exitNormal();
|
|
86
|
-
}
|
|
87
|
-
const shown = result.version ?? version;
|
|
88
|
-
if (version) {
|
|
89
|
-
const pr = await scope.client.getPullRequest(scope.workspace, scope.project, number);
|
|
90
|
-
(0, shared_1.noteVersionBehind)(pr?.version, shown);
|
|
91
|
-
}
|
|
92
|
-
if (threads.length === 0)
|
|
93
|
-
output_1.default.exitNormal(texts_1.TXT_PR_THREADS_NOT_FOUND);
|
|
94
|
-
const [patches, origins] = await Promise.all([
|
|
95
|
-
patchesOf(scope, number, shown, threads),
|
|
96
|
-
Promise.all(threads.map((t) => (0, shared_1.threadOrigin)(scope, number, t))),
|
|
97
|
-
]);
|
|
98
|
-
threads.forEach((thread, index) => {
|
|
99
|
-
output_1.default.normal((0, shared_1.threadHeader)(thread));
|
|
100
|
-
const origin = origins[index];
|
|
101
|
-
if (origin)
|
|
102
|
-
output_1.default.muted(` ${(0, texts_1.TXT_PR_MOVED_FROM)((0, shared_1.positionText)(origin))}`);
|
|
103
|
-
output_1.default.muted(` opened in v${thread.created_version}`);
|
|
104
|
-
printMessage(thread.author, thread.create_date, thread.comment, ' ');
|
|
105
|
-
const replies = thread.comments || [];
|
|
106
|
-
if (replies.length > 0) {
|
|
107
|
-
const last = replies[replies.length - 1];
|
|
108
|
-
printMessage(last.user, last.create_date, last.comment, ' ');
|
|
109
|
-
if (replies.length > 1)
|
|
110
|
-
output_1.default.muted(` … ${replies.length} replies: ${scope.cmd(`comment ls ${number} --thread ${thread.id} --rev v${shown}`)}`);
|
|
111
|
-
}
|
|
112
|
-
const code = (0, shared_1.codeAround)(patches.get(thread.position?.path) || [], thread.position);
|
|
113
|
-
code.forEach((line) => output_1.default.normal(` ${line.type === 'meta' ? line.text : (0, shared_1.formatPatchLine)(line)}`));
|
|
114
|
-
const duplicates = thread.duplicates || [];
|
|
115
|
-
if (duplicates.length > 0) {
|
|
116
|
-
output_1.default.muted(` ${(0, texts_1.TXT_PR_SAME_CHANGE)(duplicates.map((d) => `${d.path}:${d.new_start}`).join(', '))}`);
|
|
117
|
-
}
|
|
118
|
-
output_1.default.newline();
|
|
119
|
-
});
|
|
120
|
-
output_1.default.exitNormal();
|
|
121
|
-
};
|
|
122
|
-
const showThread = async (scope, number, id, version, options) => {
|
|
123
|
-
const thread = await scope.client.getPullRequestThread(scope.workspace, scope.project, number, id, version);
|
|
124
|
-
if (options.format === 'json') {
|
|
125
|
-
output_1.default.json(thread);
|
|
126
|
-
output_1.default.exitNormal();
|
|
127
|
-
}
|
|
128
|
-
output_1.default.normal((0, shared_1.threadHeader)(thread));
|
|
129
|
-
const origin = await (0, shared_1.threadOrigin)(scope, number, thread);
|
|
130
|
-
if (origin)
|
|
131
|
-
output_1.default.muted(` ${(0, texts_1.TXT_PR_MOVED_FROM)((0, shared_1.positionText)(origin))}`);
|
|
132
|
-
output_1.default.muted(` opened in v${thread.created_version}, position in v${thread.position?.version ?? version ?? '-'}`);
|
|
133
|
-
printMessage(thread.author, thread.create_date, thread.comment, ' ');
|
|
134
|
-
for (const reply of thread.comments || []) {
|
|
135
|
-
printMessage(reply.user, reply.create_date, reply.comment, ' ');
|
|
136
|
-
}
|
|
137
|
-
const events = thread.events || [];
|
|
138
|
-
if (events.length > 0) {
|
|
139
|
-
output_1.default.newline();
|
|
140
|
-
output_1.default.label('Status history');
|
|
141
|
-
for (const event of events) {
|
|
142
|
-
output_1.default.normal(` ${(0, shared_1.formatDate)(event.create_date)} ${(0, shared_1.memberName)(event.user)}: ${(0, shared_1.threadStatusText)(event.from)} → ${(0, shared_1.threadStatusWithResolution)(event.to, event.resolution)}`);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
output_1.default.exitNormal();
|
|
146
|
-
};
|
|
147
|
-
commandPrCommentList.action(async (n, options) => {
|
|
148
|
-
if (options.threads && options.thread)
|
|
149
|
-
throw new cliError_1.default('usage_error', texts_1.ERR_PR_LIST_MODES);
|
|
150
|
-
if (!options.threads && (options.status || options.path)) {
|
|
151
|
-
throw new cliError_1.default('usage_error', texts_1.ERR_PR_LIST_THREAD_OPTIONS);
|
|
152
|
-
}
|
|
153
|
-
if (options.sinceReview && (options.threads || options.thread)) {
|
|
154
|
-
throw new cliError_1.default('usage_error', texts_1.ERR_PR_LIST_SINCE_REVIEW_THREADS);
|
|
155
|
-
}
|
|
156
|
-
// the conversation does not depend on a version: --rev is accepted there and ignored
|
|
157
|
-
const version = (0, shared_1.parseRev)(options.rev);
|
|
158
|
-
const scope = (0, shared_1.prScope)(options);
|
|
159
|
-
const number = await (0, shared_1.resolveNumber)(scope, n);
|
|
160
|
-
if (options.thread)
|
|
161
|
-
await showThread(scope, number, options.thread, version, options);
|
|
162
|
-
else if (options.threads)
|
|
163
|
-
await listThreads(scope, number, version, options);
|
|
164
|
-
else
|
|
165
|
-
await listActivity(scope, number, options);
|
|
166
|
-
});
|
|
167
|
-
exports.default = commandPrCommentList;
|
|
@@ -1,50 +0,0 @@
|
|
|
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
|
-
exports.commandPrCommentReopen = exports.commandPrCommentClose = exports.commandPrCommentResolve = void 0;
|
|
7
|
-
const utils_1 = require("../../../utils");
|
|
8
|
-
const texts_1 = require("../../../texts");
|
|
9
|
-
const output_1 = __importDefault(require("../../../output"));
|
|
10
|
-
const cliError_1 = __importDefault(require("../../../cliError"));
|
|
11
|
-
const shared_1 = require("../shared");
|
|
12
|
-
/** fixed | by_design | wontfix (any case, `-` for `_`) -> FIXED | BY_DESIGN | WONTFIX */
|
|
13
|
-
const parseReason = (value) => {
|
|
14
|
-
if (value === undefined)
|
|
15
|
-
return undefined;
|
|
16
|
-
const reason = value.trim().toUpperCase().replace(/-/g, '_');
|
|
17
|
-
if (!Object.values(utils_1.PR_THREAD_RESOLUTION).includes(reason)) {
|
|
18
|
-
throw new cliError_1.default('usage_error', texts_1.ERR_PR_REASON);
|
|
19
|
-
}
|
|
20
|
-
return reason;
|
|
21
|
-
};
|
|
22
|
-
const statusCommand = (name, description, examples, status, withReason) => {
|
|
23
|
-
const command = (0, utils_1.newCommand)(name, description, {
|
|
24
|
-
requiredScopes: [utils_1.REST_API_SCOPE.REPOSITORY_WRITE],
|
|
25
|
-
examples,
|
|
26
|
-
});
|
|
27
|
-
// a status change does not depend on a version
|
|
28
|
-
(0, shared_1.addPrOptions)(command, 'ignored');
|
|
29
|
-
command.option('--thread <id>', texts_1.OPTION_PR_COMMENT_THREAD);
|
|
30
|
-
if (withReason)
|
|
31
|
-
command.option('--reason <reason>', texts_1.OPTION_PR_REASON);
|
|
32
|
-
command.option('-m, --message <text|->', texts_1.OPTION_PR_MESSAGE);
|
|
33
|
-
command.option('-F, --message-file <path|->', texts_1.OPTION_PR_MESSAGE_FILE);
|
|
34
|
-
command.argument('[N]', texts_1.OPTION_PR_NUMBER);
|
|
35
|
-
command.action(async (n, options) => {
|
|
36
|
-
if (!options.thread)
|
|
37
|
-
throw new cliError_1.default('usage_error', texts_1.ERR_PR_THREAD_REQUIRED);
|
|
38
|
-
const resolution = withReason ? parseReason(options.reason) : undefined;
|
|
39
|
-
const comment = (0, shared_1.readText)(options, false);
|
|
40
|
-
const scope = (0, shared_1.prScope)(options);
|
|
41
|
-
const number = await (0, shared_1.resolveNumber)(scope, n);
|
|
42
|
-
const thread = await scope.client.updatePullRequestThread(scope.workspace, scope.project, number, options.thread, { status, resolution, comment });
|
|
43
|
-
const state = thread?.resolution ? `${thread.status} (${thread.resolution})` : (thread?.status ?? status);
|
|
44
|
-
output_1.default.exitResult(options.format === 'json', thread, (0, texts_1.TXT_PR_THREAD_STATUS)(options.thread, state));
|
|
45
|
-
});
|
|
46
|
-
return command;
|
|
47
|
-
};
|
|
48
|
-
exports.commandPrCommentResolve = statusCommand('resolve', texts_1.DESC_COMMAND_PR_COMMENT_RESOLVE, texts_1.EXAMPLE_PR_COMMENT_RESOLVE, utils_1.PR_THREAD_STATUS.RESOLVED, true);
|
|
49
|
-
exports.commandPrCommentClose = statusCommand('close', texts_1.DESC_COMMAND_PR_COMMENT_CLOSE, texts_1.EXAMPLE_PR_COMMENT_CLOSE, utils_1.PR_THREAD_STATUS.CLOSED, true);
|
|
50
|
-
exports.commandPrCommentReopen = statusCommand('reopen', texts_1.DESC_COMMAND_PR_COMMENT_REOPEN, texts_1.EXAMPLE_PR_COMMENT_REOPEN, utils_1.PR_THREAD_STATUS.OPEN, false);
|
|
@@ -1,19 +0,0 @@
|
|
|
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("./comment/list"));
|
|
9
|
-
const add_1 = __importDefault(require("./comment/add"));
|
|
10
|
-
const status_1 = require("./comment/status");
|
|
11
|
-
const commandPrComment = (0, utils_1.newCommand)('comment', texts_1.DESC_COMMAND_PR_COMMENT, {
|
|
12
|
-
examples: texts_1.EXAMPLE_PR_COMMENT,
|
|
13
|
-
});
|
|
14
|
-
commandPrComment.addCommand(list_1.default);
|
|
15
|
-
commandPrComment.addCommand(add_1.default);
|
|
16
|
-
commandPrComment.addCommand(status_1.commandPrCommentResolve);
|
|
17
|
-
commandPrComment.addCommand(status_1.commandPrCommentClose);
|
|
18
|
-
commandPrComment.addCommand(status_1.commandPrCommentReopen);
|
|
19
|
-
exports.default = commandPrComment;
|
|
@@ -1,44 +0,0 @@
|
|
|
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 cliError_1 = __importDefault(require("../../cliError"));
|
|
10
|
-
const shared_1 = require("./shared");
|
|
11
|
-
const commandPrCreate = (0, utils_1.newCommand)('create', texts_1.DESC_COMMAND_PR_CREATE, {
|
|
12
|
-
requiredScopes: [utils_1.REST_API_SCOPE.REPOSITORY_WRITE],
|
|
13
|
-
examples: texts_1.EXAMPLE_PR_CREATE,
|
|
14
|
-
});
|
|
15
|
-
commandPrCreate.alias('add');
|
|
16
|
-
(0, shared_1.addPrOptions)(commandPrCreate);
|
|
17
|
-
commandPrCreate.requiredOption('-B, --base <branch>', texts_1.OPTION_PR_CREATE_BASE);
|
|
18
|
-
commandPrCreate.option('-H, --head <branch>', texts_1.OPTION_PR_CREATE_HEAD);
|
|
19
|
-
commandPrCreate.requiredOption('-t, --title <title>', texts_1.OPTION_PR_TITLE);
|
|
20
|
-
commandPrCreate.option('-m, --message <text|->', texts_1.OPTION_PR_DESCRIPTION);
|
|
21
|
-
commandPrCreate.option('-F, --message-file <path|->', texts_1.OPTION_PR_DESCRIPTION_FILE);
|
|
22
|
-
commandPrCreate.option('--draft', texts_1.OPTION_PR_DRAFT);
|
|
23
|
-
commandPrCreate.option('--label <labels...>', texts_1.OPTION_PR_LABEL);
|
|
24
|
-
commandPrCreate.option('--reviewer <logins...>', texts_1.OPTION_PR_CREATE_REVIEWER);
|
|
25
|
-
commandPrCreate.option('--assignee <logins...>', texts_1.OPTION_PR_ASSIGNEE);
|
|
26
|
-
commandPrCreate.action(async (options) => {
|
|
27
|
-
const head = options.head || (0, shared_1.currentGitBranch)();
|
|
28
|
-
if (!head)
|
|
29
|
-
throw new cliError_1.default('usage_error', texts_1.ERR_PR_NO_HEAD);
|
|
30
|
-
const description = (0, shared_1.readText)(options, false);
|
|
31
|
-
const scope = (0, shared_1.prScope)(options);
|
|
32
|
-
const pr = await scope.client.createPullRequest(scope.workspace, scope.project, {
|
|
33
|
-
base: options.base,
|
|
34
|
-
head,
|
|
35
|
-
title: options.title,
|
|
36
|
-
description,
|
|
37
|
-
draft: options.draft ? true : undefined,
|
|
38
|
-
labels: options.label,
|
|
39
|
-
reviewers: options.reviewer,
|
|
40
|
-
assignees: options.assignee,
|
|
41
|
-
});
|
|
42
|
-
output_1.default.exitResult(options.format === 'json', pr, (0, texts_1.TXT_PR_CREATED)(pr.number, pr.version ?? 1));
|
|
43
|
-
});
|
|
44
|
-
exports.default = commandPrCreate;
|