bitbucketdc-cli 1.0.7 → 1.0.9
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 +33 -7
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -6,6 +6,28 @@ import { Command as Command8 } from "commander";
|
|
|
6
6
|
|
|
7
7
|
// src/utils/client.ts
|
|
8
8
|
import { BitbucketClient } from "bitbucket-data-center-client";
|
|
9
|
+
|
|
10
|
+
// src/utils/credentials.ts
|
|
11
|
+
function getCredentialInfo() {
|
|
12
|
+
const baseUrl = process.env.BITBUCKET_URL;
|
|
13
|
+
const token = process.env.BITBUCKET_TOKEN;
|
|
14
|
+
return {
|
|
15
|
+
environment: {
|
|
16
|
+
BITBUCKET_URL: {
|
|
17
|
+
value: baseUrl ?? null,
|
|
18
|
+
description: "Your Bitbucket Server base URL (e.g., https://bitbucket.example.com)"
|
|
19
|
+
},
|
|
20
|
+
BITBUCKET_TOKEN: {
|
|
21
|
+
value: token ? "<set>" : null,
|
|
22
|
+
description: "Personal Access Token"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
tokenUrl: `${baseUrl ?? "https://bitbucket.example.com"}/plugins/servlet/access-tokens/users/<username>/manage`,
|
|
26
|
+
hint: "Export environment variables in your shell profile (e.g., ~/.zshrc)."
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// src/utils/client.ts
|
|
9
31
|
function getClient() {
|
|
10
32
|
const baseUrl = process.env.BITBUCKET_URL;
|
|
11
33
|
const token = process.env.BITBUCKET_TOKEN;
|
|
@@ -14,11 +36,7 @@ function getClient() {
|
|
|
14
36
|
process.stderr.write(
|
|
15
37
|
`${JSON.stringify({
|
|
16
38
|
error: `Missing required environment variables: ${missing.join(", ")}`,
|
|
17
|
-
|
|
18
|
-
BITBUCKET_URL: "Your Bitbucket Server base URL (e.g., https://bitbucket.example.com)",
|
|
19
|
-
BITBUCKET_TOKEN: "Personal Access Token \u2014 generate in Bitbucket > Profile > Personal Access Tokens"
|
|
20
|
-
},
|
|
21
|
-
hint: "Export these in your shell profile (e.g., ~/.zshrc)."
|
|
39
|
+
...getCredentialInfo()
|
|
22
40
|
})}
|
|
23
41
|
`
|
|
24
42
|
);
|
|
@@ -47,8 +65,12 @@ function stripResponse(obj) {
|
|
|
47
65
|
}
|
|
48
66
|
|
|
49
67
|
// src/utils/output.ts
|
|
68
|
+
var prettyPrint = false;
|
|
69
|
+
function setPretty(value) {
|
|
70
|
+
prettyPrint = value;
|
|
71
|
+
}
|
|
50
72
|
function output(data) {
|
|
51
|
-
process.stdout.write(`${JSON.stringify(stripResponse(data), null, 2)}
|
|
73
|
+
process.stdout.write(`${JSON.stringify(stripResponse(data), null, prettyPrint ? 2 : void 0)}
|
|
52
74
|
`);
|
|
53
75
|
}
|
|
54
76
|
function handleError(err) {
|
|
@@ -69,7 +91,7 @@ function handleError(err) {
|
|
|
69
91
|
process.stderr.write(
|
|
70
92
|
`${JSON.stringify({
|
|
71
93
|
error: "Authentication failed (HTTP 401)",
|
|
72
|
-
|
|
94
|
+
...getCredentialInfo()
|
|
73
95
|
})}
|
|
74
96
|
`
|
|
75
97
|
);
|
|
@@ -967,6 +989,10 @@ ${styleText("bold", "Examples:")}
|
|
|
967
989
|
${DIM}$${RESET} bitbucketdc pr get --project PROJ --repo my-repo --pr 42
|
|
968
990
|
`
|
|
969
991
|
);
|
|
992
|
+
program.option("--pretty", "Pretty-print JSON output");
|
|
993
|
+
program.hook("preAction", (thisCommand) => {
|
|
994
|
+
if (thisCommand.optsWithGlobals().pretty) setPretty(true);
|
|
995
|
+
});
|
|
970
996
|
registerUserCommands(program);
|
|
971
997
|
registerProjectCommands(program);
|
|
972
998
|
registerRepoCommands(program);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bitbucketdc-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"publish": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -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-eslint": "0.0.0",
|
|
26
|
+
"config-typescript": "0.0.0"
|
|
27
27
|
},
|
|
28
28
|
"engines": {
|
|
29
29
|
"node": ">=22.0.0"
|