bitbucketdc-cli 0.0.1
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/dist/commands/pr/activities.d.ts +3 -0
- package/dist/commands/pr/activities.d.ts.map +1 -0
- package/dist/commands/pr/activities.js +42 -0
- package/dist/commands/pr/activities.js.map +1 -0
- package/dist/commands/pr/changes.d.ts +3 -0
- package/dist/commands/pr/changes.d.ts.map +1 -0
- package/dist/commands/pr/changes.js +28 -0
- package/dist/commands/pr/changes.js.map +1 -0
- package/dist/commands/pr/comment.d.ts +3 -0
- package/dist/commands/pr/comment.d.ts.map +1 -0
- package/dist/commands/pr/comment.js +32 -0
- package/dist/commands/pr/comment.js.map +1 -0
- package/dist/commands/pr/create.d.ts +3 -0
- package/dist/commands/pr/create.d.ts.map +1 -0
- package/dist/commands/pr/create.js +55 -0
- package/dist/commands/pr/create.js.map +1 -0
- package/dist/commands/pr/delete-comment.d.ts +3 -0
- package/dist/commands/pr/delete-comment.d.ts.map +1 -0
- package/dist/commands/pr/delete-comment.js +30 -0
- package/dist/commands/pr/delete-comment.js.map +1 -0
- package/dist/commands/pr/diff.d.ts +3 -0
- package/dist/commands/pr/diff.d.ts.map +1 -0
- package/dist/commands/pr/diff.js +48 -0
- package/dist/commands/pr/diff.js.map +1 -0
- package/dist/commands/pr/file-comment.d.ts +3 -0
- package/dist/commands/pr/file-comment.d.ts.map +1 -0
- package/dist/commands/pr/file-comment.js +30 -0
- package/dist/commands/pr/file-comment.js.map +1 -0
- package/dist/commands/pr/file-diff.d.ts +3 -0
- package/dist/commands/pr/file-diff.d.ts.map +1 -0
- package/dist/commands/pr/file-diff.js +30 -0
- package/dist/commands/pr/file-diff.js.map +1 -0
- package/dist/commands/pr/get.d.ts +3 -0
- package/dist/commands/pr/get.d.ts.map +1 -0
- package/dist/commands/pr/get.js +26 -0
- package/dist/commands/pr/get.js.map +1 -0
- package/dist/commands/pr/inbox.d.ts +3 -0
- package/dist/commands/pr/inbox.d.ts.map +1 -0
- package/dist/commands/pr/inbox.js +24 -0
- package/dist/commands/pr/inbox.js.map +1 -0
- package/dist/commands/pr/index.d.ts +3 -0
- package/dist/commands/pr/index.d.ts.map +1 -0
- package/dist/commands/pr/index.js +42 -0
- package/dist/commands/pr/index.js.map +1 -0
- package/dist/commands/pr/line-comment.d.ts +3 -0
- package/dist/commands/pr/line-comment.d.ts.map +1 -0
- package/dist/commands/pr/line-comment.js +43 -0
- package/dist/commands/pr/line-comment.js.map +1 -0
- package/dist/commands/pr/reaction-add.d.ts +3 -0
- package/dist/commands/pr/reaction-add.d.ts.map +1 -0
- package/dist/commands/pr/reaction-add.js +35 -0
- package/dist/commands/pr/reaction-add.js.map +1 -0
- package/dist/commands/pr/reaction-remove.d.ts +3 -0
- package/dist/commands/pr/reaction-remove.d.ts.map +1 -0
- package/dist/commands/pr/reaction-remove.js +34 -0
- package/dist/commands/pr/reaction-remove.js.map +1 -0
- package/dist/commands/pr/review.d.ts +3 -0
- package/dist/commands/pr/review.d.ts.map +1 -0
- package/dist/commands/pr/review.js +34 -0
- package/dist/commands/pr/review.js.map +1 -0
- package/dist/commands/project/index.d.ts +3 -0
- package/dist/commands/project/index.d.ts.map +1 -0
- package/dist/commands/project/index.js +11 -0
- package/dist/commands/project/index.js.map +1 -0
- package/dist/commands/project/list.d.ts +3 -0
- package/dist/commands/project/list.d.ts.map +1 -0
- package/dist/commands/project/list.js +32 -0
- package/dist/commands/project/list.js.map +1 -0
- package/dist/commands/repo/index.d.ts +3 -0
- package/dist/commands/repo/index.d.ts.map +1 -0
- package/dist/commands/repo/index.js +10 -0
- package/dist/commands/repo/index.js.map +1 -0
- package/dist/commands/repo/list.d.ts +3 -0
- package/dist/commands/repo/list.d.ts.map +1 -0
- package/dist/commands/repo/list.js +19 -0
- package/dist/commands/repo/list.js.map +1 -0
- package/dist/commands/user/index.d.ts +3 -0
- package/dist/commands/user/index.d.ts.map +1 -0
- package/dist/commands/user/index.js +13 -0
- package/dist/commands/user/index.js.map +1 -0
- package/dist/commands/user/list.d.ts +3 -0
- package/dist/commands/user/list.d.ts.map +1 -0
- package/dist/commands/user/list.js +20 -0
- package/dist/commands/user/list.js.map +1 -0
- package/dist/commands/user/profile.d.ts +3 -0
- package/dist/commands/user/profile.d.ts.map +1 -0
- package/dist/commands/user/profile.js +19 -0
- package/dist/commands/user/profile.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +42 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/client.d.ts +3 -0
- package/dist/utils/client.d.ts.map +1 -0
- package/dist/utils/client.js +11 -0
- package/dist/utils/client.js.map +1 -0
- package/dist/utils/output.d.ts +3 -0
- package/dist/utils/output.d.ts.map +1 -0
- package/dist/utils/output.js +10 -0
- package/dist/utils/output.js.map +1 -0
- package/dist/utils/strip-response.d.ts +6 -0
- package/dist/utils/strip-response.d.ts.map +1 -0
- package/dist/utils/strip-response.js +30 -0
- package/dist/utils/strip-response.js.map +1 -0
- package/package.json +38 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activities.d.ts","sourceRoot":"","sources":["../../../src/commands/pr/activities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,UAAU,CAAC,MAAM,EAAE,OAAO,QAiDzC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { getClient } from '../../utils/client.js';
|
|
2
|
+
import { output, handleError } from '../../utils/output.js';
|
|
3
|
+
export function activities(parent) {
|
|
4
|
+
parent
|
|
5
|
+
.command('activities')
|
|
6
|
+
.description('Get activity on a pull request (comments, approvals, merges, etc.)')
|
|
7
|
+
.requiredOption('--project <key>', 'Bitbucket project key')
|
|
8
|
+
.requiredOption('--repo <slug>', 'Repository slug')
|
|
9
|
+
.requiredOption('--id <n>', 'Pull request ID')
|
|
10
|
+
.option('--types <types>', 'Comma-separated activity types (APPROVED, COMMENTED, DECLINED, MERGED, OPENED, REOPENED, RESCOPED, REVIEW_COMMENTED, REVIEW_DISCARDED, REVIEW_FINISHED, REVIEWED, UNAPPROVED, UPDATED)')
|
|
11
|
+
.option('--start <n>', 'Starting index for pagination (default: 0)', parseInt)
|
|
12
|
+
.option('--limit <n>', 'Maximum number of items to return (default: 25)', parseInt)
|
|
13
|
+
.addHelpText('after', `\nExamples:
|
|
14
|
+
bitbucketdc pr activities --project PROJ --repo my-repo --id 42
|
|
15
|
+
bitbucketdc pr activities --project PROJ --repo my-repo --id 42 --types COMMENTED,REVIEW_COMMENTED
|
|
16
|
+
bitbucketdc pr activities --project PROJ --repo my-repo --id 42 --types APPROVED,UNAPPROVED --limit 50`)
|
|
17
|
+
.action(async (opts) => {
|
|
18
|
+
try {
|
|
19
|
+
const client = getClient();
|
|
20
|
+
const result = await client.pullRequests.getActivities({
|
|
21
|
+
projectKey: opts.project,
|
|
22
|
+
repositorySlug: opts.repo,
|
|
23
|
+
pullRequestId: parseInt(opts.id),
|
|
24
|
+
start: opts.start,
|
|
25
|
+
limit: opts.limit,
|
|
26
|
+
});
|
|
27
|
+
// Client-side filtering by activity types
|
|
28
|
+
if (opts.types) {
|
|
29
|
+
const types = opts.types.split(',').map((t) => t.trim());
|
|
30
|
+
const filtered = result.values.filter((a) => types.includes(a.action));
|
|
31
|
+
output({ ...result, values: filtered, size: filtered.length });
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
output(result);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
catch (err) {
|
|
38
|
+
handleError(err);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=activities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activities.js","sourceRoot":"","sources":["../../../src/commands/pr/activities.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE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AC,CAAC,MAAM,CAAC,CAAC,CAAC;gBAC3F,MAAM,CAAC,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;YACjE,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,MAAM,CAAC,CAAC;YACjB,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,WAAW,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,CACF,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changes.d.ts","sourceRoot":"","sources":["../../../src/commands/pr/changes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,OAAO,CAAC,MAAM,EAAE,OAAO,QA0BtC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { getClient } from '../../utils/client.js';
|
|
2
|
+
import { output, handleError } from '../../utils/output.js';
|
|
3
|
+
export function changes(parent) {
|
|
4
|
+
parent
|
|
5
|
+
.command('changes')
|
|
6
|
+
.description('List changed files in a pull request')
|
|
7
|
+
.requiredOption('--project <key>', 'Bitbucket project key')
|
|
8
|
+
.requiredOption('--repo <slug>', 'Repository slug')
|
|
9
|
+
.requiredOption('--id <n>', 'Pull request ID')
|
|
10
|
+
.option('--limit <n>', 'Number of items to return (default: 25)', parseInt)
|
|
11
|
+
.addHelpText('after', '\nExamples:\n bitbucketdc pr changes --project PROJ --repo my-repo --id 42\n bitbucketdc pr changes --project PROJ --repo my-repo --id 42 --limit 100')
|
|
12
|
+
.action(async (opts) => {
|
|
13
|
+
try {
|
|
14
|
+
const client = getClient();
|
|
15
|
+
const result = await client.pullRequests.getChanges({
|
|
16
|
+
projectKey: opts.project,
|
|
17
|
+
repositorySlug: opts.repo,
|
|
18
|
+
pullRequestId: parseInt(opts.id),
|
|
19
|
+
limit: opts.limit,
|
|
20
|
+
});
|
|
21
|
+
output(result);
|
|
22
|
+
}
|
|
23
|
+
catch (err) {
|
|
24
|
+
handleError(err);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=changes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changes.js","sourceRoot":"","sources":["../../../src/commands/pr/changes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,UAAU,OAAO,CAAC,MAAe;IACrC,MAAM;SACH,OAAO,CAAC,SAAS,CAAC;SAClB,WAAW,CAAC,sCAAsC,CAAC;SACnD,cAAc,CAAC,iBAAiB,EAAE,uBAAuB,CAAC;SAC1D,cAAc,CAAC,eAAe,EAAE,iBAAiB,CAAC;SAClD,cAAc,CAAC,UAAU,EAAE,iBAAiB,CAAC;SAC7C,MAAM,CAAC,aAAa,EAAE,yCAAyC,EAAE,QAAQ,CAAC;SAC1E,WAAW,CACV,OAAO,EACP,yJAAyJ,CAC1J;SACA,MAAM,CAAC,KAAK,EAAE,IAAmE,EAAE,EAAE;QACpF,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;YAC3B,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,UAAU,CAAC;gBAClD,UAAU,EAAE,IAAI,CAAC,OAAO;gBACxB,cAAc,EAAE,IAAI,CAAC,IAAI;gBACzB,aAAa,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;gBAChC,KAAK,EAAE,IAAI,CAAC,KAAK;aAClB,CAAC,CAAC;YACH,MAAM,CAAC,MAAM,CAAC,CAAC;QACjB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,WAAW,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comment.d.ts","sourceRoot":"","sources":["../../../src/commands/pr/comment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,OAAO,CAAC,MAAM,EAAE,OAAO,QAgCtC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { getClient } from '../../utils/client.js';
|
|
2
|
+
import { output, handleError } from '../../utils/output.js';
|
|
3
|
+
export function comment(parent) {
|
|
4
|
+
parent
|
|
5
|
+
.command('comment')
|
|
6
|
+
.description('Add a general comment to a pull request')
|
|
7
|
+
.requiredOption('--project <key>', 'Bitbucket project key')
|
|
8
|
+
.requiredOption('--repo <slug>', 'Repository slug')
|
|
9
|
+
.requiredOption('--id <n>', 'Pull request ID')
|
|
10
|
+
.requiredOption('--text <text>', 'Comment text')
|
|
11
|
+
.option('--parent <n>', 'Parent comment ID to reply to')
|
|
12
|
+
.addHelpText('after', `\nExamples:
|
|
13
|
+
bitbucketdc pr comment --project PROJ --repo my-repo --id 42 --text "Looks good!"
|
|
14
|
+
bitbucketdc pr comment --project PROJ --repo my-repo --id 42 --text "I agree" --parent 123`)
|
|
15
|
+
.action(async (opts) => {
|
|
16
|
+
try {
|
|
17
|
+
const client = getClient();
|
|
18
|
+
const result = await client.pullRequests.addComment({
|
|
19
|
+
projectKey: opts.project,
|
|
20
|
+
repositorySlug: opts.repo,
|
|
21
|
+
pullRequestId: parseInt(opts.id),
|
|
22
|
+
text: opts.text,
|
|
23
|
+
parentId: opts.parent ? parseInt(opts.parent) : undefined,
|
|
24
|
+
});
|
|
25
|
+
output(result);
|
|
26
|
+
}
|
|
27
|
+
catch (err) {
|
|
28
|
+
handleError(err);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=comment.js.map
|
|
@@ -0,0 +1 @@
|
|
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|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/commands/pr/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,MAAM,CAAC,MAAM,EAAE,OAAO,QAmErC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { getClient } from '../../utils/client.js';
|
|
2
|
+
import { output, handleError } from '../../utils/output.js';
|
|
3
|
+
export function create(parent) {
|
|
4
|
+
parent
|
|
5
|
+
.command('create')
|
|
6
|
+
.description('Create a new pull request')
|
|
7
|
+
.requiredOption('--project <key>', 'Bitbucket project key')
|
|
8
|
+
.requiredOption('--repo <slug>', 'Repository slug')
|
|
9
|
+
.requiredOption('--from <branch>', 'Source branch name (e.g., feature-x)')
|
|
10
|
+
.requiredOption('--to <branch>', 'Target branch name (e.g., main)')
|
|
11
|
+
.requiredOption('--title <text>', 'Pull request title')
|
|
12
|
+
.option('--description <text>', 'Pull request description in markdown')
|
|
13
|
+
.option('--reviewers <usernames>', 'Comma-separated reviewer usernames')
|
|
14
|
+
.option('--draft', 'Create as draft pull request')
|
|
15
|
+
.addHelpText('after', `\nExamples:
|
|
16
|
+
bitbucketdc pr create --project PROJ --repo my-repo --from feature-x --to main --title "Add feature"
|
|
17
|
+
bitbucketdc pr create --project PROJ --repo my-repo --from fix/bug --to develop --title "Fix bug" --reviewers jsmith,jdoe
|
|
18
|
+
bitbucketdc pr create --project PROJ --repo my-repo --from wip --to main --title "WIP" --draft`)
|
|
19
|
+
.action(async (opts) => {
|
|
20
|
+
try {
|
|
21
|
+
const client = getClient();
|
|
22
|
+
let reviewers = opts.reviewers?.split(',').map((r) => r.trim());
|
|
23
|
+
// Auto-fetch default reviewers if none provided
|
|
24
|
+
if (!reviewers || reviewers.length === 0) {
|
|
25
|
+
const repo = await client.repositories.get({
|
|
26
|
+
projectKey: opts.project,
|
|
27
|
+
repositorySlug: opts.repo,
|
|
28
|
+
});
|
|
29
|
+
const defaultReviewers = await client.pullRequests.getRequiredReviewers({
|
|
30
|
+
projectKey: opts.project,
|
|
31
|
+
repositorySlug: opts.repo,
|
|
32
|
+
repositoryId: repo.id,
|
|
33
|
+
sourceBranch: opts.from,
|
|
34
|
+
targetBranch: opts.to,
|
|
35
|
+
});
|
|
36
|
+
reviewers = defaultReviewers.map((r) => r.name);
|
|
37
|
+
}
|
|
38
|
+
const result = await client.pullRequests.create({
|
|
39
|
+
projectKey: opts.project,
|
|
40
|
+
repositorySlug: opts.repo,
|
|
41
|
+
fromBranch: opts.from,
|
|
42
|
+
toBranch: opts.to,
|
|
43
|
+
title: opts.title,
|
|
44
|
+
description: opts.description,
|
|
45
|
+
reviewers,
|
|
46
|
+
draft: opts.draft,
|
|
47
|
+
});
|
|
48
|
+
output(result);
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
handleError(err);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/commands/pr/create.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,UAAU,MAAM,CAAC,MAAe;IACpC,MAAM;SACH,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,2BAA2B,CAAC;SACxC,cAAc,CAAC,iBAAiB,EAAE,uBAAuB,CAAC;SAC1D,cAAc,CAAC,eAAe,EAAE,iBAAiB,CAAC;SAClD,cAAc,CAAC,iBAAiB,EAAE,sCAAsC,CAAC;SACzE,cAAc,CAAC,eAAe,EAAE,iCAAiC,CAAC;SAClE,cAAc,CAAC,gBAAgB,EAAE,oBAAoB,CAAC;SACtD,MAAM,CAAC,sBAAsB,EAAE,sCAAsC,CA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AQ,EAAE,IAAI,CAAC,EAAE;gBACjB,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,SAAS;gBACT,KAAK,EAAE,IAAI,CAAC,KAAK;aAClB,CAAC,CAAC;YACH,MAAM,CAAC,MAAM,CAAC,CAAC;QACjB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,WAAW,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,CACF,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-comment.d.ts","sourceRoot":"","sources":["../../../src/commands/pr/delete-comment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,aAAa,CAAC,MAAM,EAAE,OAAO,QAoC5C"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { getClient } from '../../utils/client.js';
|
|
2
|
+
import { output, handleError } from '../../utils/output.js';
|
|
3
|
+
export function deleteComment(parent) {
|
|
4
|
+
parent
|
|
5
|
+
.command('delete-comment')
|
|
6
|
+
.description('Delete a pull request comment')
|
|
7
|
+
.requiredOption('--project <key>', 'Bitbucket project key')
|
|
8
|
+
.requiredOption('--repo <slug>', 'Repository slug')
|
|
9
|
+
.requiredOption('--id <n>', 'Pull request ID')
|
|
10
|
+
.requiredOption('--comment-id <n>', 'Comment ID to delete')
|
|
11
|
+
.requiredOption('--version <n>', 'Expected comment version (for optimistic locking)')
|
|
12
|
+
.addHelpText('after', '\nExamples:\n bitbucketdc pr delete-comment --project PROJ --repo my-repo --id 42 --comment-id 123 --version 0')
|
|
13
|
+
.action(async (opts) => {
|
|
14
|
+
try {
|
|
15
|
+
const client = getClient();
|
|
16
|
+
await client.pullRequests.deleteComment({
|
|
17
|
+
projectKey: opts.project,
|
|
18
|
+
repositorySlug: opts.repo,
|
|
19
|
+
pullRequestId: parseInt(opts.id),
|
|
20
|
+
commentId: parseInt(opts.commentId),
|
|
21
|
+
version: parseInt(opts.version),
|
|
22
|
+
});
|
|
23
|
+
output({ deleted: true, commentId: parseInt(opts.commentId) });
|
|
24
|
+
}
|
|
25
|
+
catch (err) {
|
|
26
|
+
handleError(err);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=delete-comment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-comment.js","sourceRoot":"","sources":["../../../src/commands/pr/delete-comment.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,UAAU,aAAa,CAAC,MAAe;IAC3C,MAAM;SACH,OAAO,CAAC,gBAAgB,CAAC;SACzB,WAAW,CAAC,+BAA+B,CAAC;SAC5C,cAAc,CAAC,iBAAiB,EAAE,uBAAuB,CAAC;SAC1D,cAAc,CAAC,eAAe,EAAE,iBAAiB,CAAC;SAClD,cAAc,CAAC,UAAU,EAAE,iBAAiB,CAAC;SAC7C,cAAc,CAAC,kBAAkB,EAAE,sBAAsB,CAAC;SAC1D,cAAc,CAAC,eAAe,EAAE,mDAAmD,CAAC;SACpF,WAAW,CACV,OAAO,EACP,iHAAiH,CAClH;SACA,MAAM,CACL,KAAK,EAAE,IAMN,EAAE,EAAE;QACH,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;YAC3B,MAAM,MAAM,CAAC,YAAY,CAAC,aAAa,CAAC;gBACtC,UAAU,EAAE,IAAI,CAAC,OAAO;gBACxB,cAAc,EAAE,IAAI,CAAC,IAAI;gBACzB,aAAa,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;gBAChC,SAAS,EAAE,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC;gBACnC,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC;aAChC,CAAC,CAAC;YACH,MAAM,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;QACjE,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,WAAW,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,CACF,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../../src/commands/pr/diff.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AAI5C,wBAAgB,IAAI,CAAC,MAAM,EAAE,OAAO,QAwDnC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Option } from 'commander';
|
|
2
|
+
import { getClient } from '../../utils/client.js';
|
|
3
|
+
import { output, handleError } from '../../utils/output.js';
|
|
4
|
+
export function diff(parent) {
|
|
5
|
+
parent
|
|
6
|
+
.command('diff')
|
|
7
|
+
.description('Get diff for a pull request')
|
|
8
|
+
.requiredOption('--project <key>', 'Bitbucket project key')
|
|
9
|
+
.requiredOption('--repo <slug>', 'Repository slug')
|
|
10
|
+
.requiredOption('--id <n>', 'Pull request ID')
|
|
11
|
+
.option('--path <path>', 'File path (omit for full PR diff)')
|
|
12
|
+
.option('--since <hash>', 'Since commit hash')
|
|
13
|
+
.option('--until <hash>', 'Until commit hash')
|
|
14
|
+
.option('--context <n>', 'Number of context lines around changes (default: 10)', parseInt)
|
|
15
|
+
.addOption(new Option('--whitespace <mode>', 'Whitespace handling (default: show)').choices(['show', 'ignore-all']))
|
|
16
|
+
.addOption(new Option('--format <fmt>', 'Response format (default: text)').choices(['text', 'json']))
|
|
17
|
+
.addHelpText('after', `\nExamples:
|
|
18
|
+
bitbucketdc pr diff --project PROJ --repo my-repo --id 42
|
|
19
|
+
bitbucketdc pr diff --project PROJ --repo my-repo --id 42 --path src/main.ts
|
|
20
|
+
bitbucketdc pr diff --project PROJ --repo my-repo --id 42 --format json
|
|
21
|
+
bitbucketdc pr diff --project PROJ --repo my-repo --id 42 --context 5 --whitespace ignore-all`)
|
|
22
|
+
.action(async (opts) => {
|
|
23
|
+
try {
|
|
24
|
+
const client = getClient();
|
|
25
|
+
const result = await client.pullRequests.getDiff({
|
|
26
|
+
projectKey: opts.project,
|
|
27
|
+
repositorySlug: opts.repo,
|
|
28
|
+
pullRequestId: parseInt(opts.id),
|
|
29
|
+
path: opts.path,
|
|
30
|
+
sinceId: opts.since,
|
|
31
|
+
untilId: opts.until,
|
|
32
|
+
contextLines: opts.context,
|
|
33
|
+
whitespace: opts.whitespace,
|
|
34
|
+
format: opts.format || 'text',
|
|
35
|
+
});
|
|
36
|
+
if (typeof result === 'string') {
|
|
37
|
+
process.stdout.write(result);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
output(result);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
catch (err) {
|
|
44
|
+
handleError(err);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=diff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff.js","sourceRoot":"","sources":["../../../src/commands/pr/diff.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,MAAM,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,UAAU,IAAI,CAAC,MAAe;IAClC,MAAM;SACH,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,6BAA6B,CAAC;SAC1C,cAAc,CAAC,iBAAiB,EAAE,uBAAuB,CAAC;SAC1D,cAAc,CAAC,eAAe,EAAE,iBAAiB,CAAC;SA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AAC;gBACN,MAAM,CAAC,MAAM,CAAC,CAAC;YACjB,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,WAAW,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,CACF,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-comment.d.ts","sourceRoot":"","sources":["../../../src/commands/pr/file-comment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,WAAW,CAAC,MAAM,EAAE,OAAO,QA8B1C"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { getClient } from '../../utils/client.js';
|
|
2
|
+
import { output, handleError } from '../../utils/output.js';
|
|
3
|
+
export function fileComment(parent) {
|
|
4
|
+
parent
|
|
5
|
+
.command('file-comment')
|
|
6
|
+
.description('Add a file-level comment to a pull request')
|
|
7
|
+
.requiredOption('--project <key>', 'Bitbucket project key')
|
|
8
|
+
.requiredOption('--repo <slug>', 'Repository slug')
|
|
9
|
+
.requiredOption('--id <n>', 'Pull request ID')
|
|
10
|
+
.requiredOption('--text <text>', 'Comment text')
|
|
11
|
+
.requiredOption('--path <path>', 'File path to attach comment to (e.g., src/main.ts)')
|
|
12
|
+
.addHelpText('after', '\nExamples:\n bitbucketdc pr file-comment --project PROJ --repo my-repo --id 42 --text "This file needs refactoring" --path src/main.ts')
|
|
13
|
+
.action(async (opts) => {
|
|
14
|
+
try {
|
|
15
|
+
const client = getClient();
|
|
16
|
+
const result = await client.pullRequests.addComment({
|
|
17
|
+
projectKey: opts.project,
|
|
18
|
+
repositorySlug: opts.repo,
|
|
19
|
+
pullRequestId: parseInt(opts.id),
|
|
20
|
+
text: opts.text,
|
|
21
|
+
path: opts.path,
|
|
22
|
+
});
|
|
23
|
+
output(result);
|
|
24
|
+
}
|
|
25
|
+
catch (err) {
|
|
26
|
+
handleError(err);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=file-comment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-comment.js","sourceRoot":"","sources":["../../../src/commands/pr/file-comment.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,UAAU,WAAW,CAAC,MAAe;IACzC,MAAM;SACH,OAAO,CAAC,cAAc,CAAC;SACvB,WAAW,CAAC,4CAA4C,CAAC;SACzD,cAAc,CAAC,iBAAiB,EAAE,uBAAuB,CAAC;SAC1D,cAAc,CAAC,eAAe,EAAE,iBAAiB,CAAC;SAClD,cAAc,CAAC,UAAU,EAAE,iBAAiB,CAAC;SAC7C,cAAc,CAAC,eAAe,EAAE,cAAc,CAAC;SAC/C,cAAc,CAAC,eAAe,EAAE,oDAAoD,CAAC;SACrF,WAAW,CACV,OAAO,EACP,0IAA0I,CAC3I;SACA,MAAM,CACL,KAAK,EAAE,IAA+E,EAAE,EAAE;QACxF,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;YAC3B,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,UAAU,CAAC;gBAClD,UAAU,EAAE,IAAI,CAAC,OAAO;gBACxB,cAAc,EAAE,IAAI,CAAC,IAAI;gBACzB,aAAa,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;gBAChC,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,IAAI,EAAE,IAAI,CAAC,IAAI;aAChB,CAAC,CAAC;YACH,MAAM,CAAC,MAAM,CAAC,CAAC;QACjB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,WAAW,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,CACF,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-diff.d.ts","sourceRoot":"","sources":["../../../src/commands/pr/file-diff.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,QAAQ,CAAC,MAAM,EAAE,OAAO,QA8BvC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { getClient } from '../../utils/client.js';
|
|
2
|
+
import { output, handleError } from '../../utils/output.js';
|
|
3
|
+
export function fileDiff(parent) {
|
|
4
|
+
parent
|
|
5
|
+
.command('file-diff')
|
|
6
|
+
.description('Get structured line-by-line diff for a specific file')
|
|
7
|
+
.requiredOption('--project <key>', 'Bitbucket project key')
|
|
8
|
+
.requiredOption('--repo <slug>', 'Repository slug')
|
|
9
|
+
.requiredOption('--id <n>', 'Pull request ID')
|
|
10
|
+
.requiredOption('--path <path>', 'File path (e.g., src/main.ts)')
|
|
11
|
+
.option('--context <n>', 'Number of context lines around changes (default: 10)', parseInt)
|
|
12
|
+
.addHelpText('after', '\nExamples:\n bitbucketdc pr file-diff --project PROJ --repo my-repo --id 42 --path src/main.ts\n bitbucketdc pr file-diff --project PROJ --repo my-repo --id 42 --path src/main.ts --context 5')
|
|
13
|
+
.action(async (opts) => {
|
|
14
|
+
try {
|
|
15
|
+
const client = getClient();
|
|
16
|
+
const result = await client.pullRequests.getFileDiff({
|
|
17
|
+
projectKey: opts.project,
|
|
18
|
+
repositorySlug: opts.repo,
|
|
19
|
+
pullRequestId: parseInt(opts.id),
|
|
20
|
+
path: opts.path,
|
|
21
|
+
contextLines: opts.context,
|
|
22
|
+
});
|
|
23
|
+
output(result);
|
|
24
|
+
}
|
|
25
|
+
catch (err) {
|
|
26
|
+
handleError(err);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=file-diff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-diff.js","sourceRoot":"","sources":["../../../src/commands/pr/file-diff.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,UAAU,QAAQ,CAAC,MAAe;IACtC,MAAM;SACH,OAAO,CAAC,WAAW,CAAC;SACpB,WAAW,CAAC,sDAAsD,CAAC;SACnE,cAAc,CAAC,iBAAiB,EAAE,uBAAuB,CAAC;SAC1D,cAAc,CAAC,eAAe,EAAE,iBAAiB,CAAC;SAClD,cAAc,CAAC,UAAU,EAAE,iBAAiB,CAAC;SAC7C,cAAc,CAAC,eAAe,EAAE,+BAA+B,CAAC;SAChE,MAAM,CAAC,eAAe,EAAE,sDAAsD,EAAE,QAAQ,CAAC;SACzF,WAAW,CACV,OAAO,EACP,mMAAmM,CACpM;SACA,MAAM,CACL,KAAK,EAAE,IAAmF,EAAE,EAAE;QAC5F,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;YAC3B,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,WAAW,CAAC;gBACnD,UAAU,EAAE,IAAI,CAAC,OAAO;gBACxB,cAAc,EAAE,IAAI,CAAC,IAAI;gBACzB,aAAa,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;gBAChC,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,YAAY,EAAE,IAAI,CAAC,OAAO;aAC3B,CAAC,CAAC;YACH,MAAM,CAAC,MAAM,CAAC,CAAC;QACjB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,WAAW,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,CACF,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../src/commands/pr/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,GAAG,CAAC,MAAM,EAAE,OAAO,QAwBlC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { getClient } from '../../utils/client.js';
|
|
2
|
+
import { output, handleError } from '../../utils/output.js';
|
|
3
|
+
export function get(parent) {
|
|
4
|
+
parent
|
|
5
|
+
.command('get')
|
|
6
|
+
.description('Get pull request details')
|
|
7
|
+
.requiredOption('--project <key>', 'Bitbucket project key')
|
|
8
|
+
.requiredOption('--repo <slug>', 'Repository slug')
|
|
9
|
+
.requiredOption('--id <n>', 'Pull request ID')
|
|
10
|
+
.addHelpText('after', '\nExamples:\n bitbucketdc pr get --project PROJ --repo my-repo --id 42')
|
|
11
|
+
.action(async (opts) => {
|
|
12
|
+
try {
|
|
13
|
+
const client = getClient();
|
|
14
|
+
const result = await client.pullRequests.get({
|
|
15
|
+
projectKey: opts.project,
|
|
16
|
+
repositorySlug: opts.repo,
|
|
17
|
+
pullRequestId: parseInt(opts.id),
|
|
18
|
+
});
|
|
19
|
+
output(result);
|
|
20
|
+
}
|
|
21
|
+
catch (err) {
|
|
22
|
+
handleError(err);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=get.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../../src/commands/pr/get.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,UAAU,GAAG,CAAC,MAAe;IACjC,MAAM;SACH,OAAO,CAAC,KAAK,CAAC;SACd,WAAW,CAAC,0BAA0B,CAAC;SACvC,cAAc,CAAC,iBAAiB,EAAE,uBAAuB,CAAC;SAC1D,cAAc,CAAC,eAAe,EAAE,iBAAiB,CAAC;SAClD,cAAc,CAAC,UAAU,EAAE,iBAAiB,CAAC;SAC7C,WAAW,CACV,OAAO,EACP,yEAAyE,CAC1E;SACA,MAAM,CAAC,KAAK,EAAE,IAAmD,EAAE,EAAE;QACpE,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;YAC3B,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC;gBAC3C,UAAU,EAAE,IAAI,CAAC,OAAO;gBACxB,cAAc,EAAE,IAAI,CAAC,IAAI;gBACzB,aAAa,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;aACjC,CAAC,CAAC;YACH,MAAM,CAAC,MAAM,CAAC,CAAC;QACjB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,WAAW,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inbox.d.ts","sourceRoot":"","sources":["../../../src/commands/pr/inbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,KAAK,CAAC,MAAM,EAAE,OAAO,QAsBpC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { getClient } from '../../utils/client.js';
|
|
2
|
+
import { output, handleError } from '../../utils/output.js';
|
|
3
|
+
export function inbox(parent) {
|
|
4
|
+
parent
|
|
5
|
+
.command('inbox')
|
|
6
|
+
.description('List pull requests in your reviewer inbox')
|
|
7
|
+
.option('--start <n>', 'Starting index for pagination (default: 0)', parseInt)
|
|
8
|
+
.option('--limit <n>', 'Maximum number of pull requests to return (default: 25)', parseInt)
|
|
9
|
+
.addHelpText('after', '\nExamples:\n bitbucketdc pr inbox\n bitbucketdc pr inbox --limit 10\n bitbucketdc pr inbox --start 25 --limit 25')
|
|
10
|
+
.action(async (opts) => {
|
|
11
|
+
try {
|
|
12
|
+
const client = getClient();
|
|
13
|
+
const result = await client.pullRequests.getInbox({
|
|
14
|
+
start: opts.start,
|
|
15
|
+
limit: opts.limit,
|
|
16
|
+
});
|
|
17
|
+
output(result);
|
|
18
|
+
}
|
|
19
|
+
catch (err) {
|
|
20
|
+
handleError(err);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=inbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inbox.js","sourceRoot":"","sources":["../../../src/commands/pr/inbox.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,UAAU,KAAK,CAAC,MAAe;IACnC,MAAM;SACH,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,2CAA2C,CAAC;SACxD,MAAM,CAAC,aAAa,EAAE,4CAA4C,EAAE,QAAQ,CAAC;SAC7E,MAAM,CAAC,aAAa,EAAE,yDAAyD,EAAE,QAAQ,CAAC;SAC1F,WAAW,CACV,OAAO,EACP,sHAAsH,CACvH;SACA,MAAM,CAAC,KAAK,EAAE,IAAwC,EAAE,EAAE;QACzD,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;YAC3B,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC;gBAChD,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,KAAK,EAAE,IAAI,CAAC,KAAK;aAClB,CAAC,CAAC;YACH,MAAM,CAAC,MAAM,CAAC,CAAC;QACjB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,WAAW,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/pr/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgBpC,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,QA0BlD"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { inbox } from './inbox.js';
|
|
2
|
+
import { get } from './get.js';
|
|
3
|
+
import { changes } from './changes.js';
|
|
4
|
+
import { diff } from './diff.js';
|
|
5
|
+
import { fileDiff } from './file-diff.js';
|
|
6
|
+
import { activities } from './activities.js';
|
|
7
|
+
import { create } from './create.js';
|
|
8
|
+
import { comment } from './comment.js';
|
|
9
|
+
import { fileComment } from './file-comment.js';
|
|
10
|
+
import { lineComment } from './line-comment.js';
|
|
11
|
+
import { deleteComment } from './delete-comment.js';
|
|
12
|
+
import { reactionAdd } from './reaction-add.js';
|
|
13
|
+
import { reactionRemove } from './reaction-remove.js';
|
|
14
|
+
import { review } from './review.js';
|
|
15
|
+
export function registerPrCommands(program) {
|
|
16
|
+
const pr = program.command('pr').description('Pull request operations')
|
|
17
|
+
.addHelpText('after', `
|
|
18
|
+
Examples:
|
|
19
|
+
$ bitbucketdc pr inbox
|
|
20
|
+
$ bitbucketdc pr get --project PROJ --repo my-repo --id 42
|
|
21
|
+
$ bitbucketdc pr changes --project PROJ --repo my-repo --id 42
|
|
22
|
+
$ bitbucketdc pr diff --project PROJ --repo my-repo --id 42
|
|
23
|
+
$ bitbucketdc pr create --project PROJ --repo my-repo --from feature-x --to main --title "Add feature"
|
|
24
|
+
$ bitbucketdc pr comment --project PROJ --repo my-repo --id 42 --text "Looks good!"
|
|
25
|
+
$ bitbucketdc pr review --project PROJ --repo my-repo --id 42 --status APPROVED
|
|
26
|
+
`);
|
|
27
|
+
inbox(pr);
|
|
28
|
+
get(pr);
|
|
29
|
+
changes(pr);
|
|
30
|
+
diff(pr);
|
|
31
|
+
fileDiff(pr);
|
|
32
|
+
activities(pr);
|
|
33
|
+
create(pr);
|
|
34
|
+
comment(pr);
|
|
35
|
+
fileComment(pr);
|
|
36
|
+
lineComment(pr);
|
|
37
|
+
deleteComment(pr);
|
|
38
|
+
reactionAdd(pr);
|
|
39
|
+
reactionRemove(pr);
|
|
40
|
+
review(pr);
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/pr/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,UAAU,kBAAkB,CAAC,OAAgB;IACjD,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,yBAAyB,CAAC;SACpE,WAAW,CAAC,OAAO,EAAE;;;;;;;;;CASzB,CAAC,CAAC;IACD,KAAK,CAAC,EAAE,CAAC,CAAC;IACV,GAAG,CAAC,EAAE,CAAC,CAAC;IACR,OAAO,CAAC,EAAE,CAAC,CAAC;IACZ,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,QAAQ,CAAC,EAAE,CAAC,CAAC;IACb,UAAU,CAAC,EAAE,CAAC,CAAC;IACf,MAAM,CAAC,EAAE,CAAC,CAAC;IACX,OAAO,CAAC,EAAE,CAAC,CAAC;IACZ,WAAW,CAAC,EAAE,CAAC,CAAC;IAChB,WAAW,CAAC,EAAE,CAAC,CAAC;IAChB,aAAa,CAAC,EAAE,CAAC,CAAC;IAClB,WAAW,CAAC,EAAE,CAAC,CAAC;IAChB,cAAc,CAAC,EAAE,CAAC,CAAC;IACnB,MAAM,CAAC,EAAE,CAAC,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"line-comment.d.ts","sourceRoot":"","sources":["../../../src/commands/pr/line-comment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AAI5C,wBAAgB,WAAW,CAAC,MAAM,EAAE,OAAO,QAuD1C"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Option } from 'commander';
|
|
2
|
+
import { getClient } from '../../utils/client.js';
|
|
3
|
+
import { output, handleError } from '../../utils/output.js';
|
|
4
|
+
export function lineComment(parent) {
|
|
5
|
+
parent
|
|
6
|
+
.command('line-comment')
|
|
7
|
+
.description('Add an inline comment to a specific line in a pull request')
|
|
8
|
+
.requiredOption('--project <key>', 'Bitbucket project key')
|
|
9
|
+
.requiredOption('--repo <slug>', 'Repository slug')
|
|
10
|
+
.requiredOption('--id <n>', 'Pull request ID')
|
|
11
|
+
.requiredOption('--text <text>', 'Comment text')
|
|
12
|
+
.requiredOption('--path <path>', 'File path (e.g., src/main.ts)')
|
|
13
|
+
.requiredOption('--line <n>', 'Line number to comment on')
|
|
14
|
+
.addOption(new Option('--line-type <type>', 'Type of line')
|
|
15
|
+
.choices(['ADDED', 'REMOVED', 'CONTEXT'])
|
|
16
|
+
.makeOptionMandatory())
|
|
17
|
+
.addOption(new Option('--file-type <type>', 'Side of diff: FROM (source/old) or TO (destination/new)')
|
|
18
|
+
.choices(['FROM', 'TO'])
|
|
19
|
+
.makeOptionMandatory())
|
|
20
|
+
.addHelpText('after', `\nExamples:
|
|
21
|
+
bitbucketdc pr line-comment --project PROJ --repo my-repo --id 42 --text "Use const here" --path src/main.ts --line 15 --line-type ADDED --file-type TO
|
|
22
|
+
bitbucketdc pr line-comment --project PROJ --repo my-repo --id 42 --text "Was this intentional?" --path src/old.ts --line 8 --line-type REMOVED --file-type FROM`)
|
|
23
|
+
.action(async (opts) => {
|
|
24
|
+
try {
|
|
25
|
+
const client = getClient();
|
|
26
|
+
const result = await client.pullRequests.addComment({
|
|
27
|
+
projectKey: opts.project,
|
|
28
|
+
repositorySlug: opts.repo,
|
|
29
|
+
pullRequestId: parseInt(opts.id),
|
|
30
|
+
text: opts.text,
|
|
31
|
+
path: opts.path,
|
|
32
|
+
line: parseInt(opts.line),
|
|
33
|
+
lineType: opts.lineType,
|
|
34
|
+
fileType: opts.fileType,
|
|
35
|
+
});
|
|
36
|
+
output(result);
|
|
37
|
+
}
|
|
38
|
+
catch (err) {
|
|
39
|
+
handleError(err);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=line-comment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"line-comment.js","sourceRoot":"","sources":["../../../src/commands/pr/line-comment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,MAAM,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,UAAU,WAAW,CAAC,MAAe;IACzC,MAAM;SACH,OAAO,CAAC,cAAc,CAAC;SACvB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