bitbucketdc-cli 1.0.11 → 1.0.13
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/index.js +23 -12
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -73,6 +73,15 @@ function output(data) {
|
|
|
73
73
|
process.stdout.write(`${JSON.stringify(stripResponse(data), null, prettyPrint ? 2 : void 0)}
|
|
74
74
|
`);
|
|
75
75
|
}
|
|
76
|
+
function outputPrResult(pr) {
|
|
77
|
+
const url = pr.links?.self?.[0]?.href;
|
|
78
|
+
process.stdout.write(`${JSON.stringify({ id: pr.id, ...url && { url } }, null, prettyPrint ? 2 : void 0)}
|
|
79
|
+
`);
|
|
80
|
+
}
|
|
81
|
+
function outputCommentResult(comment2) {
|
|
82
|
+
process.stdout.write(`${JSON.stringify({ id: comment2.id }, null, prettyPrint ? 2 : void 0)}
|
|
83
|
+
`);
|
|
84
|
+
}
|
|
76
85
|
function handleError(err) {
|
|
77
86
|
const message = err instanceof Error ? err.message : String(err);
|
|
78
87
|
const axiosStatus = err?.response?.status;
|
|
@@ -263,7 +272,7 @@ Examples:
|
|
|
263
272
|
|
|
264
273
|
// src/commands/file/list.ts
|
|
265
274
|
function list(parent) {
|
|
266
|
-
parent.command("list").description("List directory contents in a repository").requiredOption("--project <key>", "Bitbucket project key").requiredOption("--repo <slug>", "Repository slug").option("--path <path>", "Directory path (defaults to root)").option("--at <ref>", "Branch, tag, or commit hash").option("--limit <n>", "Number of items to return (default: 500)", parseInt).option("--start <n>", "Start index for pagination (default: 0)", parseInt).addHelpText(
|
|
275
|
+
parent.command("list").description("List directory contents in a repository").requiredOption("--project <key>", "Bitbucket project key").requiredOption("--repo <slug>", "Repository slug").option("--path <path>", "Directory path (defaults to root)").option("--at <ref>", "Branch, tag, or commit hash").option("--branch <ref>", "Alias for --at").option("--limit <n>", "Number of items to return (default: 500)", parseInt).option("--start <n>", "Start index for pagination (default: 0)", parseInt).addHelpText(
|
|
267
276
|
"after",
|
|
268
277
|
`
|
|
269
278
|
Examples:
|
|
@@ -273,11 +282,12 @@ Examples:
|
|
|
273
282
|
).action(
|
|
274
283
|
async (opts) => {
|
|
275
284
|
const client = getClient();
|
|
285
|
+
const ref = opts.at ?? opts.branch;
|
|
276
286
|
const result = await client.repositories.browse({
|
|
277
287
|
projectKey: opts.project,
|
|
278
288
|
repositorySlug: opts.repo,
|
|
279
289
|
path: opts.path,
|
|
280
|
-
at:
|
|
290
|
+
at: ref,
|
|
281
291
|
limit: opts.limit,
|
|
282
292
|
start: opts.start
|
|
283
293
|
});
|
|
@@ -288,7 +298,7 @@ Examples:
|
|
|
288
298
|
|
|
289
299
|
// src/commands/file/show.ts
|
|
290
300
|
function show(parent) {
|
|
291
|
-
parent.command("show").description("Show raw file content from a repository").requiredOption("--project <key>", "Bitbucket project key").requiredOption("--repo <slug>", "Repository slug").requiredOption("--path <path>", "File path").option("--at <ref>", "Branch, tag, or commit hash").addHelpText(
|
|
301
|
+
parent.command("show").description("Show raw file content from a repository").requiredOption("--project <key>", "Bitbucket project key").requiredOption("--repo <slug>", "Repository slug").requiredOption("--path <path>", "File path").option("--at <ref>", "Branch, tag, or commit hash").option("--branch <ref>", "Alias for --at").addHelpText(
|
|
292
302
|
"after",
|
|
293
303
|
`
|
|
294
304
|
Examples:
|
|
@@ -296,11 +306,12 @@ Examples:
|
|
|
296
306
|
bitbucketdc file show --project PROJ --repo my-app --path config/settings.yaml --at release/2.0`
|
|
297
307
|
).action(async (opts) => {
|
|
298
308
|
const client = getClient();
|
|
309
|
+
const ref = opts.at ?? opts.branch;
|
|
299
310
|
const result = await client.repositories.getRawContent({
|
|
300
311
|
projectKey: opts.project,
|
|
301
312
|
repositorySlug: opts.repo,
|
|
302
313
|
path: opts.path,
|
|
303
|
-
at:
|
|
314
|
+
at: ref
|
|
304
315
|
});
|
|
305
316
|
process.stdout.write(result);
|
|
306
317
|
});
|
|
@@ -401,7 +412,7 @@ Examples:
|
|
|
401
412
|
text: opts.text,
|
|
402
413
|
parentId: opts.parent ? parseInt(opts.parent) : void 0
|
|
403
414
|
});
|
|
404
|
-
|
|
415
|
+
outputCommentResult(result);
|
|
405
416
|
});
|
|
406
417
|
}
|
|
407
418
|
|
|
@@ -442,7 +453,7 @@ Examples:
|
|
|
442
453
|
reviewers,
|
|
443
454
|
draft: opts.draft
|
|
444
455
|
});
|
|
445
|
-
|
|
456
|
+
outputPrResult(result);
|
|
446
457
|
}
|
|
447
458
|
);
|
|
448
459
|
}
|
|
@@ -456,7 +467,7 @@ function decline(parent) {
|
|
|
456
467
|
repositorySlug: opts.repo,
|
|
457
468
|
pullRequestId: opts.id
|
|
458
469
|
});
|
|
459
|
-
|
|
470
|
+
outputPrResult(result);
|
|
460
471
|
});
|
|
461
472
|
}
|
|
462
473
|
|
|
@@ -552,7 +563,7 @@ function editComment(parent) {
|
|
|
552
563
|
text: opts.text,
|
|
553
564
|
version: comment2.version
|
|
554
565
|
});
|
|
555
|
-
|
|
566
|
+
outputCommentResult(result);
|
|
556
567
|
});
|
|
557
568
|
}
|
|
558
569
|
|
|
@@ -570,7 +581,7 @@ function fileComment(parent) {
|
|
|
570
581
|
text: opts.text,
|
|
571
582
|
path: opts.path
|
|
572
583
|
});
|
|
573
|
-
|
|
584
|
+
outputCommentResult(result);
|
|
574
585
|
});
|
|
575
586
|
}
|
|
576
587
|
|
|
@@ -646,7 +657,7 @@ Examples:
|
|
|
646
657
|
lineType: opts.lineType,
|
|
647
658
|
fileType: opts.fileType
|
|
648
659
|
});
|
|
649
|
-
|
|
660
|
+
outputCommentResult(result);
|
|
650
661
|
}
|
|
651
662
|
);
|
|
652
663
|
}
|
|
@@ -669,7 +680,7 @@ Examples:
|
|
|
669
680
|
strategyId: opts.strategy,
|
|
670
681
|
message: opts.message
|
|
671
682
|
});
|
|
672
|
-
|
|
683
|
+
outputPrResult(result);
|
|
673
684
|
});
|
|
674
685
|
}
|
|
675
686
|
|
|
@@ -767,7 +778,7 @@ Examples:
|
|
|
767
778
|
title: opts.title,
|
|
768
779
|
description: opts.description
|
|
769
780
|
});
|
|
770
|
-
|
|
781
|
+
outputPrResult(result);
|
|
771
782
|
});
|
|
772
783
|
}
|
|
773
784
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bitbucketdc-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"publish": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
],
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"commander": "^13.1.0",
|
|
15
|
-
"bitbucket-data-center-client": "1.4.
|
|
15
|
+
"bitbucket-data-center-client": "1.4.15"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@types/node": "24.10.4",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"tsx": "^4.19.2",
|
|
23
23
|
"typescript": "^5.7.2",
|
|
24
24
|
"vitest": "^4.0.16",
|
|
25
|
-
"config-
|
|
26
|
-
"config-
|
|
25
|
+
"config-typescript": "0.0.0",
|
|
26
|
+
"config-eslint": "0.0.0"
|
|
27
27
|
},
|
|
28
28
|
"engines": {
|
|
29
29
|
"node": ">=22.0.0"
|