bbk-cli 1.1.2 → 1.2.0
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/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +14 -0
- package/README.md +113 -132
- package/dist/cli/wrapper.d.ts +0 -1
- package/dist/cli/wrapper.d.ts.map +1 -1
- package/dist/cli/wrapper.js +19 -54
- package/dist/cli/wrapper.js.map +1 -1
- package/dist/commands/helpers.js +1 -1
- package/dist/commands/runner.d.ts.map +1 -1
- package/dist/commands/runner.js +22 -18
- package/dist/commands/runner.js.map +1 -1
- package/dist/config/constants.d.ts.map +1 -1
- package/dist/config/constants.js +37 -52
- package/dist/config/constants.js.map +1 -1
- package/dist/utils/arg-parser.d.ts.map +1 -1
- package/dist/utils/arg-parser.js +23 -8
- package/dist/utils/arg-parser.js.map +1 -1
- package/dist/utils/bitbucket-client.d.ts +24 -37
- package/dist/utils/bitbucket-client.d.ts.map +1 -1
- package/dist/utils/bitbucket-client.js +38 -52
- package/dist/utils/bitbucket-client.js.map +1 -1
- package/dist/utils/bitbucket-utils.d.ts +48 -68
- package/dist/utils/bitbucket-utils.d.ts.map +1 -1
- package/dist/utils/bitbucket-utils.js +100 -125
- package/dist/utils/bitbucket-utils.js.map +1 -1
- package/dist/utils/config-loader.d.ts +10 -29
- package/dist/utils/config-loader.d.ts.map +1 -1
- package/dist/utils/config-loader.js +277 -51
- package/dist/utils/config-loader.js.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -3
- package/tests/integration/cli-integration.test.ts +96 -217
- package/tests/unit/cli/wrapper.test.ts +28 -137
- package/tests/unit/commands/runner.test.ts +69 -197
- package/tests/unit/utils/arg-parser.test.ts +53 -4
- package/tests/unit/utils/config-loader.test.ts +441 -106
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arg-parser.d.ts","sourceRoot":"","sources":["../../src/utils/arg-parser.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"arg-parser.d.ts","sourceRoot":"","sources":["../../src/utils/arg-parser.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAU,MAAM,MAAM,EAAE,KAAG,OAAO,CAAC,OAAO,CAkDpE,CAAC"}
|
package/dist/utils/arg-parser.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getCurrentVersion, printAvailableCommands, printCommandDetail, runCommand } from '../commands/index.js';
|
|
2
2
|
import { COMMANDS } from '../config/index.js';
|
|
3
|
+
import { setupConfig } from './config-loader.js';
|
|
3
4
|
/**
|
|
4
5
|
* Parses and handles command line arguments
|
|
5
6
|
* @param args - Command line arguments (process.argv.slice(2))
|
|
@@ -7,6 +8,18 @@ import { COMMANDS } from '../config/index.js';
|
|
|
7
8
|
*/
|
|
8
9
|
export const parseArguments = async (args) => {
|
|
9
10
|
for (let i = 0; i < args.length; i++) {
|
|
11
|
+
// Config setup/update command
|
|
12
|
+
if (args[i] === 'config') {
|
|
13
|
+
try {
|
|
14
|
+
await setupConfig();
|
|
15
|
+
process.exit(0);
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
19
|
+
console.error(`Configuration setup failed: ${errorMessage}`);
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
10
23
|
// Version flag
|
|
11
24
|
if (args[i] === '--version' || args[i] === '-v') {
|
|
12
25
|
console.log(getCurrentVersion());
|
|
@@ -47,20 +60,22 @@ Bitbucket CLI
|
|
|
47
60
|
|
|
48
61
|
Usage:
|
|
49
62
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
63
|
+
bbk-cli start interactive CLI
|
|
64
|
+
bbk-cli config setup or update configuration
|
|
65
|
+
bbk-cli --commands list all available commands
|
|
66
|
+
bbk-cli <command> -h quick help on <command>
|
|
67
|
+
bbk-cli <command> <arg> run command in headless mode
|
|
54
68
|
|
|
55
69
|
All commands:
|
|
56
70
|
|
|
57
71
|
${COMMANDS.join(', ')}
|
|
58
72
|
|
|
59
73
|
Examples:
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
74
|
+
bbk-cli config
|
|
75
|
+
bbk-cli list-repositories
|
|
76
|
+
bbk-cli get-repository '{"repoSlug":"my-repo"}'
|
|
77
|
+
bbk-cli list-pullrequests '{"repoSlug":"my-repo","state":"OPEN"}'
|
|
78
|
+
bbk-cli test-connection
|
|
64
79
|
|
|
65
80
|
`);
|
|
66
81
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arg-parser.js","sourceRoot":"","sources":["../../src/utils/arg-parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACjH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"arg-parser.js","sourceRoot":"","sources":["../../src/utils/arg-parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACjH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EAAE,IAAc,EAAoB,EAAE;IACvE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,8BAA8B;QAC9B,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ,EA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AAC,CAAC,CAAC;QAClB,CAAC;QAED,mCAAmC;QACnC,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAClF,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC3B,MAAM,MAAM,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,CAAkB,CAAC;YAC7E,MAAM,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,CAAkB,CAAC;YAE1E,MAAM,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;YACxC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,gBAAgB,GAAG,GAAS,EAAE;IAClC,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;;;;EAaZ,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;;;;;;;;;CASpB,CAAC,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -4,41 +4,36 @@
|
|
|
4
4
|
import type { ApiResult } from './bitbucket-utils.js';
|
|
5
5
|
/**
|
|
6
6
|
* List all repositories in a workspace
|
|
7
|
-
* @param
|
|
8
|
-
* @param workspace - Workspace ID or slug (optional, uses profile default if not provided)
|
|
7
|
+
* @param workspace - Workspace ID or slug (optional, uses default if not provided)
|
|
9
8
|
* @param format - Output format (json, toon)
|
|
10
9
|
*/
|
|
11
|
-
export declare function listRepositories(
|
|
10
|
+
export declare function listRepositories(workspace?: string, format?: 'json' | 'toon'): Promise<ApiResult>;
|
|
12
11
|
/**
|
|
13
12
|
* Get repository details
|
|
14
|
-
* @param
|
|
15
|
-
* @param workspace - Workspace ID or slug (optional, uses profile default if not provided)
|
|
13
|
+
* @param workspace - Workspace ID or slug (optional, uses default if not provided)
|
|
16
14
|
* @param repoSlug - Repository slug
|
|
17
15
|
* @param format - Output format (json, toon)
|
|
18
16
|
*/
|
|
19
|
-
export declare function getRepository(
|
|
17
|
+
export declare function getRepository(workspace: string | undefined, repoSlug: string, format?: 'json' | 'toon'): Promise<ApiResult>;
|
|
20
18
|
/**
|
|
21
19
|
* List pull requests in a repository
|
|
22
|
-
* @param
|
|
23
|
-
* @param workspace - Workspace ID or slug (optional, uses profile default if not provided)
|
|
20
|
+
* @param workspace - Workspace ID or slug (optional, uses default if not provided)
|
|
24
21
|
* @param repoSlug - Repository slug
|
|
25
22
|
* @param state - Pull request state (optional)
|
|
26
23
|
* @param format - Output format (json, toon)
|
|
27
24
|
*/
|
|
28
|
-
export declare function listPullRequests(
|
|
25
|
+
export declare function listPullRequests(workspace: string | undefined, repoSlug: string, state?: string, format?: 'json' | 'toon'): Promise<ApiResult>;
|
|
29
26
|
/**
|
|
30
27
|
* Get pull request details
|
|
31
|
-
* @param
|
|
32
|
-
* @param workspace - Workspace ID or slug (optional, uses profile default if not provided)
|
|
28
|
+
* @param workspace - Workspace ID or slug (optional, uses default if not provided)
|
|
33
29
|
* @param repoSlug - Repository slug
|
|
34
30
|
* @param pullRequestId - Pull request ID
|
|
35
31
|
* @param format - Output format (json, toon)
|
|
36
32
|
*/
|
|
37
|
-
export declare function getPullRequest(
|
|
33
|
+
export declare function getPullRequest(workspace: string | undefined, repoSlug: string, pullRequestId: number, format?: 'json' | 'toon'): Promise<ApiResult>;
|
|
38
34
|
/**
|
|
39
35
|
* Create a new pull request
|
|
40
|
-
* @param
|
|
41
|
-
* @param workspace - Workspace ID or slug (optional, uses profile default if not provided)
|
|
36
|
+
* @param workspace - Workspace ID or slug (optional, uses default if not provided)
|
|
42
37
|
* @param repoSlug - Repository slug
|
|
43
38
|
* @param title - Pull request title
|
|
44
39
|
* @param sourceBranch - Source branch name
|
|
@@ -46,47 +41,42 @@ export declare function getPullRequest(profile: string, workspace: string | unde
|
|
|
46
41
|
* @param description - Pull request description (optional)
|
|
47
42
|
* @param format - Output format (json, toon)
|
|
48
43
|
*/
|
|
49
|
-
export declare function createPullRequest(
|
|
44
|
+
export declare function createPullRequest(workspace: string | undefined, repoSlug: string, title: string, sourceBranch: string, destinationBranch: string, description?: string, format?: 'json' | 'toon'): Promise<ApiResult>;
|
|
50
45
|
/**
|
|
51
46
|
* List branches in a repository
|
|
52
|
-
* @param
|
|
53
|
-
* @param workspace - Workspace ID or slug (optional, uses profile default if not provided)
|
|
47
|
+
* @param workspace - Workspace ID or slug (optional, uses default if not provided)
|
|
54
48
|
* @param repoSlug - Repository slug
|
|
55
49
|
* @param q - Query string to filter branches
|
|
56
50
|
* @param sort - Sort field
|
|
57
51
|
* @param format - Output format (json, toon)
|
|
58
52
|
*/
|
|
59
|
-
export declare function listBranches(
|
|
53
|
+
export declare function listBranches(workspace: string | undefined, repoSlug: string, q?: string, sort?: string, format?: 'json' | 'toon'): Promise<ApiResult>;
|
|
60
54
|
/**
|
|
61
55
|
* List commits in a repository
|
|
62
|
-
* @param
|
|
63
|
-
* @param workspace - Workspace ID or slug (optional, uses profile default if not provided)
|
|
56
|
+
* @param workspace - Workspace ID or slug (optional, uses default if not provided)
|
|
64
57
|
* @param repoSlug - Repository slug
|
|
65
58
|
* @param branch - Branch name (optional)
|
|
66
59
|
* @param format - Output format (json, toon)
|
|
67
60
|
*/
|
|
68
|
-
export declare function listCommits(
|
|
61
|
+
export declare function listCommits(workspace: string | undefined, repoSlug: string, branch?: string, format?: 'json' | 'toon'): Promise<ApiResult>;
|
|
69
62
|
/**
|
|
70
63
|
* List issues in a repository
|
|
71
|
-
* @param
|
|
72
|
-
* @param workspace - Workspace ID or slug (optional, uses profile default if not provided)
|
|
64
|
+
* @param workspace - Workspace ID or slug (optional, uses default if not provided)
|
|
73
65
|
* @param repoSlug - Repository slug
|
|
74
66
|
* @param format - Output format (json, toon)
|
|
75
67
|
*/
|
|
76
|
-
export declare function listIssues(
|
|
68
|
+
export declare function listIssues(workspace: string | undefined, repoSlug: string, format?: 'json' | 'toon'): Promise<ApiResult>;
|
|
77
69
|
/**
|
|
78
70
|
* Get issue details
|
|
79
|
-
* @param
|
|
80
|
-
* @param workspace - Workspace ID or slug (optional, uses profile default if not provided)
|
|
71
|
+
* @param workspace - Workspace ID or slug (optional, uses default if not provided)
|
|
81
72
|
* @param repoSlug - Repository slug
|
|
82
73
|
* @param issueId - Issue ID
|
|
83
74
|
* @param format - Output format (json, toon)
|
|
84
75
|
*/
|
|
85
|
-
export declare function getIssue(
|
|
76
|
+
export declare function getIssue(workspace: string | undefined, repoSlug: string, issueId: number, format?: 'json' | 'toon'): Promise<ApiResult>;
|
|
86
77
|
/**
|
|
87
78
|
* Create a new issue
|
|
88
|
-
* @param
|
|
89
|
-
* @param workspace - Workspace ID or slug (optional, uses profile default if not provided)
|
|
79
|
+
* @param workspace - Workspace ID or slug (optional, uses default if not provided)
|
|
90
80
|
* @param repoSlug - Repository slug
|
|
91
81
|
* @param title - Issue title
|
|
92
82
|
* @param content - Issue content/description (optional)
|
|
@@ -94,27 +84,24 @@ export declare function getIssue(profile: string, workspace: string | undefined,
|
|
|
94
84
|
* @param priority - Issue priority (trivial, minor, major, critical, blocker)
|
|
95
85
|
* @param format - Output format (json, toon)
|
|
96
86
|
*/
|
|
97
|
-
export declare function createIssue(
|
|
87
|
+
export declare function createIssue(workspace: string | undefined, repoSlug: string, title: string, content?: string, kind?: string, priority?: string, format?: 'json' | 'toon'): Promise<ApiResult>;
|
|
98
88
|
/**
|
|
99
89
|
* List pipelines in a repository
|
|
100
|
-
* @param
|
|
101
|
-
* @param workspace - Workspace ID or slug (optional, uses profile default if not provided)
|
|
90
|
+
* @param workspace - Workspace ID or slug (optional, uses default if not provided)
|
|
102
91
|
* @param repoSlug - Repository slug
|
|
103
92
|
* @param format - Output format (json, toon)
|
|
104
93
|
*/
|
|
105
|
-
export declare function listPipelines(
|
|
94
|
+
export declare function listPipelines(workspace: string | undefined, repoSlug: string, format?: 'json' | 'toon'): Promise<ApiResult>;
|
|
106
95
|
/**
|
|
107
96
|
* Get user information
|
|
108
|
-
* @param profile - Bitbucket profile name
|
|
109
97
|
* @param userId - User UUID or account_id (optional, if not provided returns current authenticated user)
|
|
110
98
|
* @param format - Output format (json, toon)
|
|
111
99
|
*/
|
|
112
|
-
export declare function getUser(
|
|
100
|
+
export declare function getUser(userId?: string, format?: 'json' | 'toon'): Promise<ApiResult>;
|
|
113
101
|
/**
|
|
114
102
|
* Test Bitbucket API connection
|
|
115
|
-
* @param profile - Bitbucket profile name
|
|
116
103
|
*/
|
|
117
|
-
export declare function testConnection(
|
|
104
|
+
export declare function testConnection(): Promise<ApiResult>;
|
|
118
105
|
/**
|
|
119
106
|
* Clear Bitbucket client pool (for cleanup)
|
|
120
107
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bitbucket-client.d.ts","sourceRoot":"","sources":["../../src/utils/bitbucket-client.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"bitbucket-client.d.ts","sourceRoot":"","sources":["../../src/utils/bitbucket-client.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAsBtD;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,GAAG,MAAe,GAAG,OAAO,CAAC,SAAS,CAAC,CAG/G;AAED;;;;;GA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config-loader.js';
|
|
3
|
-
const projectRoot = process.env.CLAUDE_PROJECT_ROOT || process.cwd();
|
|
4
3
|
let bitbucketUtil = null;
|
|
5
4
|
/**
|
|
6
5
|
* Initialize Bitbucket utility
|
|
@@ -9,7 +8,7 @@ async function initBitbucket() {
|
|
|
9
8
|
if (bitbucketUtil)
|
|
10
9
|
return bitbucketUtil;
|
|
11
10
|
try {
|
|
12
|
-
const config = loadConfig(
|
|
11
|
+
const config = loadConfig();
|
|
13
12
|
bitbucketUtil = new BitbucketUtil(config);
|
|
14
13
|
return bitbucketUtil;
|
|
15
14
|
}
|
|
@@ -20,53 +19,48 @@ async function initBitbucket() {
|
|
|
20
19
|
}
|
|
21
20
|
/**
|
|
22
21
|
* List all repositories in a workspace
|
|
23
|
-
* @param
|
|
24
|
-
* @param workspace - Workspace ID or slug (optional, uses profile default if not provided)
|
|
22
|
+
* @param workspace - Workspace ID or slug (optional, uses default if not provided)
|
|
25
23
|
* @param format - Output format (json, toon)
|
|
26
24
|
*/
|
|
27
|
-
export async function listRepositories(
|
|
25
|
+
export async function listRepositories(workspace, format = 'json') {
|
|
28
26
|
const bitbucket = await initBitbucket();
|
|
29
|
-
return await bitbucket.listRepositories(
|
|
27
|
+
return await bitbucket.listRepositories(workspace, format);
|
|
30
28
|
}
|
|
31
29
|
/**
|
|
32
30
|
* Get repository details
|
|
33
|
-
* @param
|
|
34
|
-
* @param workspace - Workspace ID or slug (optional, uses profile default if not provided)
|
|
31
|
+
* @param workspace - Workspace ID or slug (optional, uses default if not provided)
|
|
35
32
|
* @param repoSlug - Repository slug
|
|
36
33
|
* @param format - Output format (json, toon)
|
|
37
34
|
*/
|
|
38
|
-
export async function getRepository(
|
|
35
|
+
export async function getRepository(workspace, repoSlug, format = 'json') {
|
|
39
36
|
const bitbucket = await initBitbucket();
|
|
40
|
-
return await bitbucket.getRepository(
|
|
37
|
+
return await bitbucket.getRepository(workspace, repoSlug, format);
|
|
41
38
|
}
|
|
42
39
|
/**
|
|
43
40
|
* List pull requests in a repository
|
|
44
|
-
* @param
|
|
45
|
-
* @param workspace - Workspace ID or slug (optional, uses profile default if not provided)
|
|
41
|
+
* @param workspace - Workspace ID or slug (optional, uses default if not provided)
|
|
46
42
|
* @param repoSlug - Repository slug
|
|
47
43
|
* @param state - Pull request state (optional)
|
|
48
44
|
* @param format - Output format (json, toon)
|
|
49
45
|
*/
|
|
50
|
-
export async function listPullRequests(
|
|
46
|
+
export async function listPullRequests(workspace, repoSlug, state, format = 'json') {
|
|
51
47
|
const bitbucket = await initBitbucket();
|
|
52
|
-
return await bitbucket.listPullRequests(
|
|
48
|
+
return await bitbucket.listPullRequests(workspace, repoSlug, state, format);
|
|
53
49
|
}
|
|
54
50
|
/**
|
|
55
51
|
* Get pull request details
|
|
56
|
-
* @param
|
|
57
|
-
* @param workspace - Workspace ID or slug (optional, uses profile default if not provided)
|
|
52
|
+
* @param workspace - Workspace ID or slug (optional, uses default if not provided)
|
|
58
53
|
* @param repoSlug - Repository slug
|
|
59
54
|
* @param pullRequestId - Pull request ID
|
|
60
55
|
* @param format - Output format (json, toon)
|
|
61
56
|
*/
|
|
62
|
-
export async function getPullRequest(
|
|
57
|
+
export async function getPullRequest(workspace, repoSlug, pullRequestId, format = 'json') {
|
|
63
58
|
const bitbucket = await initBitbucket();
|
|
64
|
-
return await bitbucket.getPullRequest(
|
|
59
|
+
return await bitbucket.getPullRequest(workspace, repoSlug, pullRequestId, format);
|
|
65
60
|
}
|
|
66
61
|
/**
|
|
67
62
|
* Create a new pull request
|
|
68
|
-
* @param
|
|
69
|
-
* @param workspace - Workspace ID or slug (optional, uses profile default if not provided)
|
|
63
|
+
* @param workspace - Workspace ID or slug (optional, uses default if not provided)
|
|
70
64
|
* @param repoSlug - Repository slug
|
|
71
65
|
* @param title - Pull request title
|
|
72
66
|
* @param sourceBranch - Source branch name
|
|
@@ -74,62 +68,57 @@ export async function getPullRequest(profile, workspace, repoSlug, pullRequestId
|
|
|
74
68
|
* @param description - Pull request description (optional)
|
|
75
69
|
* @param format - Output format (json, toon)
|
|
76
70
|
*/
|
|
77
|
-
export async function createPullRequest(
|
|
71
|
+
export async function createPullRequest(workspace, repoSlug, title, sourceBranch, destinationBranch, description, format = 'json') {
|
|
78
72
|
const bitbucket = await initBitbucket();
|
|
79
|
-
return await bitbucket.createPullRequest(
|
|
73
|
+
return await bitbucket.createPullRequest(workspace, repoSlug, title, sourceBranch, destinationBranch, description, format);
|
|
80
74
|
}
|
|
81
75
|
/**
|
|
82
76
|
* List branches in a repository
|
|
83
|
-
* @param
|
|
84
|
-
* @param workspace - Workspace ID or slug (optional, uses profile default if not provided)
|
|
77
|
+
* @param workspace - Workspace ID or slug (optional, uses default if not provided)
|
|
85
78
|
* @param repoSlug - Repository slug
|
|
86
79
|
* @param q - Query string to filter branches
|
|
87
80
|
* @param sort - Sort field
|
|
88
81
|
* @param format - Output format (json, toon)
|
|
89
82
|
*/
|
|
90
|
-
export async function listBranches(
|
|
83
|
+
export async function listBranches(workspace, repoSlug, q, sort, format = 'json') {
|
|
91
84
|
const bitbucket = await initBitbucket();
|
|
92
|
-
return await bitbucket.listBranches(
|
|
85
|
+
return await bitbucket.listBranches(workspace, repoSlug, q, sort, format);
|
|
93
86
|
}
|
|
94
87
|
/**
|
|
95
88
|
* List commits in a repository
|
|
96
|
-
* @param
|
|
97
|
-
* @param workspace - Workspace ID or slug (optional, uses profile default if not provided)
|
|
89
|
+
* @param workspace - Workspace ID or slug (optional, uses default if not provided)
|
|
98
90
|
* @param repoSlug - Repository slug
|
|
99
91
|
* @param branch - Branch name (optional)
|
|
100
92
|
* @param format - Output format (json, toon)
|
|
101
93
|
*/
|
|
102
|
-
export async function listCommits(
|
|
94
|
+
export async function listCommits(workspace, repoSlug, branch, format = 'json') {
|
|
103
95
|
const bitbucket = await initBitbucket();
|
|
104
|
-
return await bitbucket.listCommits(
|
|
96
|
+
return await bitbucket.listCommits(workspace, repoSlug, branch, format);
|
|
105
97
|
}
|
|
106
98
|
/**
|
|
107
99
|
* List issues in a repository
|
|
108
|
-
* @param
|
|
109
|
-
* @param workspace - Workspace ID or slug (optional, uses profile default if not provided)
|
|
100
|
+
* @param workspace - Workspace ID or slug (optional, uses default if not provided)
|
|
110
101
|
* @param repoSlug - Repository slug
|
|
111
102
|
* @param format - Output format (json, toon)
|
|
112
103
|
*/
|
|
113
|
-
export async function listIssues(
|
|
104
|
+
export async function listIssues(workspace, repoSlug, format = 'json') {
|
|
114
105
|
const bitbucket = await initBitbucket();
|
|
115
|
-
return await bitbucket.listIssues(
|
|
106
|
+
return await bitbucket.listIssues(workspace, repoSlug, format);
|
|
116
107
|
}
|
|
117
108
|
/**
|
|
118
109
|
* Get issue details
|
|
119
|
-
* @param
|
|
120
|
-
* @param workspace - Workspace ID or slug (optional, uses profile default if not provided)
|
|
110
|
+
* @param workspace - Workspace ID or slug (optional, uses default if not provided)
|
|
121
111
|
* @param repoSlug - Repository slug
|
|
122
112
|
* @param issueId - Issue ID
|
|
123
113
|
* @param format - Output format (json, toon)
|
|
124
114
|
*/
|
|
125
|
-
export async function getIssue(
|
|
115
|
+
export async function getIssue(workspace, repoSlug, issueId, format = 'json') {
|
|
126
116
|
const bitbucket = await initBitbucket();
|
|
127
|
-
return await bitbucket.getIssue(
|
|
117
|
+
return await bitbucket.getIssue(workspace, repoSlug, issueId, format);
|
|
128
118
|
}
|
|
129
119
|
/**
|
|
130
120
|
* Create a new issue
|
|
131
|
-
* @param
|
|
132
|
-
* @param workspace - Workspace ID or slug (optional, uses profile default if not provided)
|
|
121
|
+
* @param workspace - Workspace ID or slug (optional, uses default if not provided)
|
|
133
122
|
* @param repoSlug - Repository slug
|
|
134
123
|
* @param title - Issue title
|
|
135
124
|
* @param content - Issue content/description (optional)
|
|
@@ -137,38 +126,35 @@ export async function getIssue(profile, workspace, repoSlug, issueId, format = '
|
|
|
137
126
|
* @param priority - Issue priority (trivial, minor, major, critical, blocker)
|
|
138
127
|
* @param format - Output format (json, toon)
|
|
139
128
|
*/
|
|
140
|
-
export async function createIssue(
|
|
129
|
+
export async function createIssue(workspace, repoSlug, title, content, kind, priority, format = 'json') {
|
|
141
130
|
const bitbucket = await initBitbucket();
|
|
142
|
-
return await bitbucket.createIssue(
|
|
131
|
+
return await bitbucket.createIssue(workspace, repoSlug, title, content, kind, priority, format);
|
|
143
132
|
}
|
|
144
133
|
/**
|
|
145
134
|
* List pipelines in a repository
|
|
146
|
-
* @param
|
|
147
|
-
* @param workspace - Workspace ID or slug (optional, uses profile default if not provided)
|
|
135
|
+
* @param workspace - Workspace ID or slug (optional, uses default if not provided)
|
|
148
136
|
* @param repoSlug - Repository slug
|
|
149
137
|
* @param format - Output format (json, toon)
|
|
150
138
|
*/
|
|
151
|
-
export async function listPipelines(
|
|
139
|
+
export async function listPipelines(workspace, repoSlug, format = 'json') {
|
|
152
140
|
const bitbucket = await initBitbucket();
|
|
153
|
-
return await bitbucket.listPipelines(
|
|
141
|
+
return await bitbucket.listPipelines(workspace, repoSlug, format);
|
|
154
142
|
}
|
|
155
143
|
/**
|
|
156
144
|
* Get user information
|
|
157
|
-
* @param profile - Bitbucket profile name
|
|
158
145
|
* @param userId - User UUID or account_id (optional, if not provided returns current authenticated user)
|
|
159
146
|
* @param format - Output format (json, toon)
|
|
160
147
|
*/
|
|
161
|
-
export async function getUser(
|
|
148
|
+
export async function getUser(userId, format = 'json') {
|
|
162
149
|
const bitbucket = await initBitbucket();
|
|
163
|
-
return await bitbucket.getUser(
|
|
150
|
+
return await bitbucket.getUser(userId, format);
|
|
164
151
|
}
|
|
165
152
|
/**
|
|
166
153
|
* Test Bitbucket API connection
|
|
167
|
-
* @param profile - Bitbucket profile name
|
|
168
154
|
*/
|
|
169
|
-
export async function testConnection(
|
|
155
|
+
export async function testConnection() {
|
|
170
156
|
const bitbucket = await initBitbucket();
|
|
171
|
-
return await bitbucket.testConnection(
|
|
157
|
+
return await bitbucket.testConnection();
|
|
172
158
|
}
|
|
173
159
|
/**
|
|
174
160
|
* Clear Bitbucket client pool (for cleanup)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bitbucket-client.js","sourceRoot":"","sources":["../../src/utils/bitbucket-client.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,
|
|
1
|
+
{"version":3,"file":"bitbucket-client.js","sourceRoot":"","sources":["../../src/utils/bitbucket-client.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,IAAI,aAAa,GAAyB,IAAI,CAAC;AAE/C;;GAEG;AACH,KAAK,UAAU,aAAa;IAC1B,IAAI,aAAa;QAAE,OAAO,aAAa,CAAC;IAExC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;QAC5B,aAAa,GAAG,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC;QAC1C,OAAO,aAAa,CAAC;IACvB,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC5E,MAAM,IAAI,KAAK,CAAC,0CAA0C,YAAY,EAAE,CAAC,CAAC;IAC5E,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,SAAkB,EAAE,SAA0B,MAAM;IACzF,MAAM,SAAS,GAAG,MAAM,aAAa,EAAE,CAAC;IACxC,OAAO,MAAM,SAAS,CAAC,gBAAgB,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;AAC7D,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,SAA6B,EAC7B,QAAgB,E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