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
|
@@ -8,32 +8,26 @@ export interface ApiResult {
|
|
|
8
8
|
data?: unknown;
|
|
9
9
|
error?: string;
|
|
10
10
|
}
|
|
11
|
-
/**
|
|
12
|
-
* Bitbucket API client options
|
|
13
|
-
*/
|
|
14
|
-
interface BitbucketClientAuth {
|
|
15
|
-
email: string;
|
|
16
|
-
apiToken: string;
|
|
17
|
-
}
|
|
18
11
|
/**
|
|
19
12
|
* Bitbucket API Utility Module
|
|
20
13
|
* Provides core Bitbucket API operations with formatting using basic auth
|
|
21
14
|
*/
|
|
22
15
|
export declare class BitbucketUtil {
|
|
23
16
|
private readonly config;
|
|
24
|
-
private readonly authPool;
|
|
25
17
|
constructor(config: Config);
|
|
26
18
|
/**
|
|
27
|
-
* Get authentication
|
|
19
|
+
* Get authentication credentials
|
|
28
20
|
*/
|
|
29
|
-
getAuth(
|
|
21
|
+
getAuth(): {
|
|
22
|
+
email: string;
|
|
23
|
+
apiToken: string;
|
|
24
|
+
};
|
|
30
25
|
/**
|
|
31
|
-
* Get the default workspace
|
|
32
|
-
* @
|
|
33
|
-
* @
|
|
34
|
-
* @throws Error if profile is not found or defaultWorkspace is not configured
|
|
26
|
+
* Get the default workspace
|
|
27
|
+
* @returns The default workspace string
|
|
28
|
+
* @throws Error if defaultWorkspace is not configured
|
|
35
29
|
*/
|
|
36
|
-
getDefaultWorkspace(
|
|
30
|
+
getDefaultWorkspace(): string;
|
|
37
31
|
/**
|
|
38
32
|
* Make authenticated request to Bitbucket API
|
|
39
33
|
*/
|
|
@@ -52,142 +46,128 @@ export declare class BitbucketUtil {
|
|
|
52
46
|
formatResult(data: unknown, format?: 'json' | 'toon'): string;
|
|
53
47
|
/**
|
|
54
48
|
* List all repositories in a workspace
|
|
55
|
-
* @param
|
|
56
|
-
* @param workspace - Workspace ID or slug (optional, uses profile default if not provided)
|
|
49
|
+
* @param workspace - Workspace ID or slug (optional, uses default if not provided)
|
|
57
50
|
* @param format - Output format (json, toon)
|
|
58
|
-
* @throws Error if neither workspace parameter nor
|
|
51
|
+
* @throws Error if neither workspace parameter nor default workspace is configured
|
|
59
52
|
*/
|
|
60
|
-
listRepositories(
|
|
53
|
+
listRepositories(workspace?: string, format?: 'json' | 'toon'): Promise<ApiResult>;
|
|
61
54
|
/**
|
|
62
55
|
* Get repository details
|
|
63
|
-
* @param
|
|
64
|
-
* @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)
|
|
65
57
|
* @param repoSlug - Repository slug identifier
|
|
66
58
|
* @param format - Output format (json, toon)
|
|
67
|
-
* @throws Error if neither workspace parameter nor
|
|
59
|
+
* @throws Error if neither workspace parameter nor default workspace is configured
|
|
68
60
|
*/
|
|
69
|
-
getRepository(
|
|
61
|
+
getRepository(workspace: string | undefined, repoSlug: string, format?: 'json' | 'toon'): Promise<ApiResult>;
|
|
70
62
|
/**
|
|
71
63
|
* List pull requests in a repository
|
|
72
|
-
* @param
|
|
73
|
-
* @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)
|
|
74
65
|
* @param repoSlug - Repository slug identifier
|
|
75
66
|
* @param state - Filter by state (OPEN, MERGED, DECLINED, SUPERSEDED)
|
|
76
67
|
* @param format - Output format (json, toon)
|
|
77
|
-
* @throws Error if neither workspace parameter nor
|
|
68
|
+
* @throws Error if neither workspace parameter nor default workspace is configured
|
|
78
69
|
*/
|
|
79
|
-
listPullRequests(
|
|
70
|
+
listPullRequests(workspace: string | undefined, repoSlug: string, state?: string, format?: 'json' | 'toon'): Promise<ApiResult>;
|
|
80
71
|
/**
|
|
81
72
|
* Get pull request details
|
|
82
|
-
* @param
|
|
83
|
-
* @param workspace - Workspace ID or slug (optional, uses profile default if not provided)
|
|
73
|
+
* @param workspace - Workspace ID or slug (optional, uses default if not provided)
|
|
84
74
|
* @param repoSlug - Repository slug identifier
|
|
85
75
|
* @param pullRequestId - Pull request ID
|
|
86
76
|
* @param format - Output format (json, toon)
|
|
87
|
-
* @throws Error if neither workspace parameter nor
|
|
77
|
+
* @throws Error if neither workspace parameter nor default workspace is configured
|
|
88
78
|
*/
|
|
89
|
-
getPullRequest(
|
|
79
|
+
getPullRequest(workspace: string | undefined, repoSlug: string, pullRequestId: number, format?: 'json' | 'toon'): Promise<ApiResult>;
|
|
90
80
|
/**
|
|
91
81
|
* Get default reviewers for a repository
|
|
92
|
-
* @param
|
|
93
|
-
* @param workspace - Workspace ID or slug (optional, uses profile default if not provided)
|
|
82
|
+
* @param workspace - Workspace ID or slug (optional, uses default if not provided)
|
|
94
83
|
* @param repoSlug - Repository slug identifier
|
|
95
84
|
* @returns Array of reviewer UUIDs
|
|
96
|
-
* @throws Error if neither workspace parameter nor
|
|
85
|
+
* @throws Error if neither workspace parameter nor default workspace is configured
|
|
97
86
|
*/
|
|
98
|
-
getDefaultReviewers(
|
|
87
|
+
getDefaultReviewers(workspace: string | undefined, repoSlug: string): Promise<Array<{
|
|
99
88
|
uuid: string;
|
|
100
89
|
}>>;
|
|
101
90
|
/**
|
|
102
91
|
* Create a new pull request
|
|
103
|
-
* @param
|
|
104
|
-
* @param workspace - Workspace ID or slug (optional, uses profile default if not provided)
|
|
92
|
+
* @param workspace - Workspace ID or slug (optional, uses default if not provided)
|
|
105
93
|
* @param repoSlug - Repository slug identifier
|
|
106
94
|
* @param title - Pull request title
|
|
107
95
|
* @param sourceBranch - Source branch name
|
|
108
96
|
* @param destinationBranch - Destination branch name
|
|
109
97
|
* @param description - Pull request description (optional)
|
|
110
98
|
* @param format - Output format (json, toon)
|
|
111
|
-
* @throws Error if neither workspace parameter nor
|
|
99
|
+
* @throws Error if neither workspace parameter nor default workspace is configured
|
|
112
100
|
*/
|
|
113
|
-
createPullRequest(
|
|
101
|
+
createPullRequest(workspace: string | undefined, repoSlug: string, title: string, sourceBranch: string, destinationBranch: string, description?: string, format?: 'json' | 'toon'): Promise<ApiResult>;
|
|
114
102
|
/**
|
|
115
103
|
* List branches in a repository
|
|
116
|
-
* @param
|
|
117
|
-
* @param workspace - Workspace ID or slug (optional, uses profile default if not provided)
|
|
104
|
+
* @param workspace - Workspace ID or slug (optional, uses default if not provided)
|
|
118
105
|
* @param repoSlug - Repository slug identifier
|
|
119
106
|
* @param q - Query filter for branch names (optional)
|
|
120
107
|
* @param sort - Sort order (optional)
|
|
121
108
|
* @param format - Output format (json, toon)
|
|
122
|
-
* @throws Error if neither workspace parameter nor
|
|
109
|
+
* @throws Error if neither workspace parameter nor default workspace is configured
|
|
123
110
|
*/
|
|
124
|
-
listBranches(
|
|
111
|
+
listBranches(workspace: string | undefined, repoSlug: string, q?: string, sort?: string, format?: 'json' | 'toon'): Promise<ApiResult>;
|
|
125
112
|
/**
|
|
126
113
|
* List commits in a repository
|
|
127
|
-
* @param
|
|
128
|
-
* @param workspace - Workspace ID or slug (optional, uses profile default if not provided)
|
|
114
|
+
* @param workspace - Workspace ID or slug (optional, uses default if not provided)
|
|
129
115
|
* @param repoSlug - Repository slug identifier
|
|
130
116
|
* @param branch - Branch name to limit commits to (optional)
|
|
131
117
|
* @param format - Output format (json, toon)
|
|
132
|
-
* @throws Error if neither workspace parameter nor
|
|
118
|
+
* @throws Error if neither workspace parameter nor default workspace is configured
|
|
133
119
|
*/
|
|
134
|
-
listCommits(
|
|
120
|
+
listCommits(workspace: string | undefined, repoSlug: string, branch?: string, format?: 'json' | 'toon'): Promise<ApiResult>;
|
|
135
121
|
/**
|
|
136
122
|
* List issues in a repository
|
|
137
|
-
* @param
|
|
138
|
-
* @param workspace - Workspace ID or slug (optional, uses profile default if not provided)
|
|
123
|
+
* @param workspace - Workspace ID or slug (optional, uses default if not provided)
|
|
139
124
|
* @param repoSlug - Repository slug identifier
|
|
140
125
|
* @param format - Output format (json, toon)
|
|
141
|
-
* @throws Error if neither workspace parameter nor
|
|
126
|
+
* @throws Error if neither workspace parameter nor default workspace is configured
|
|
142
127
|
*/
|
|
143
|
-
listIssues(
|
|
128
|
+
listIssues(workspace: string | undefined, repoSlug: string, format?: 'json' | 'toon'): Promise<ApiResult>;
|
|
144
129
|
/**
|
|
145
130
|
* Get issue details
|
|
146
|
-
* @param
|
|
147
|
-
* @param workspace - Workspace ID or slug (optional, uses profile default if not provided)
|
|
131
|
+
* @param workspace - Workspace ID or slug (optional, uses default if not provided)
|
|
148
132
|
* @param repoSlug - Repository slug identifier
|
|
149
133
|
* @param issueId - Issue ID
|
|
150
134
|
* @param format - Output format (json, toon)
|
|
151
|
-
* @throws Error if neither workspace parameter nor
|
|
135
|
+
* @throws Error if neither workspace parameter nor default workspace is configured
|
|
152
136
|
*/
|
|
153
|
-
getIssue(
|
|
137
|
+
getIssue(workspace: string | undefined, repoSlug: string, issueId: number, format?: 'json' | 'toon'): Promise<ApiResult>;
|
|
154
138
|
/**
|
|
155
139
|
* Create a new issue
|
|
156
|
-
* @param
|
|
157
|
-
* @param workspace - Workspace ID or slug (optional, uses profile default if not provided)
|
|
140
|
+
* @param workspace - Workspace ID or slug (optional, uses default if not provided)
|
|
158
141
|
* @param repoSlug - Repository slug identifier
|
|
159
142
|
* @param title - Issue title
|
|
160
143
|
* @param content - Issue content/description (optional)
|
|
161
144
|
* @param kind - Issue kind (bug, enhancement, proposal, task) (optional)
|
|
162
145
|
* @param priority - Issue priority (trivial, minor, major, critical, blocker) (optional)
|
|
163
146
|
* @param format - Output format (json, toon)
|
|
164
|
-
* @throws Error if neither workspace parameter nor
|
|
147
|
+
* @throws Error if neither workspace parameter nor default workspace is configured
|
|
165
148
|
*/
|
|
166
|
-
createIssue(
|
|
149
|
+
createIssue(workspace: string | undefined, repoSlug: string, title: string, content?: string, kind?: string, priority?: string, format?: 'json' | 'toon'): Promise<ApiResult>;
|
|
167
150
|
/**
|
|
168
151
|
* List pipelines in a repository
|
|
169
|
-
* @param
|
|
170
|
-
* @param workspace - Workspace ID or slug (optional, uses profile default if not provided)
|
|
152
|
+
* @param workspace - Workspace ID or slug (optional, uses default if not provided)
|
|
171
153
|
* @param repoSlug - Repository slug identifier
|
|
172
154
|
* @param format - Output format (json, toon)
|
|
173
|
-
* @throws Error if neither workspace parameter nor
|
|
155
|
+
* @throws Error if neither workspace parameter nor default workspace is configured
|
|
174
156
|
*/
|
|
175
|
-
listPipelines(
|
|
157
|
+
listPipelines(workspace: string | undefined, repoSlug: string, format?: 'json' | 'toon'): Promise<ApiResult>;
|
|
176
158
|
/**
|
|
177
159
|
* Get user information
|
|
178
|
-
* @param profileName - Bitbucket profile name
|
|
179
160
|
* @param userId - User UUID (optional, if not provided returns current authenticated user)
|
|
180
161
|
* @param format - Output format (json, toon)
|
|
181
162
|
*/
|
|
182
|
-
getUser(
|
|
163
|
+
getUser(userId?: string, format?: 'json' | 'toon'): Promise<ApiResult>;
|
|
183
164
|
/**
|
|
184
165
|
* Test Bitbucket API connection
|
|
185
166
|
*/
|
|
186
|
-
testConnection(
|
|
167
|
+
testConnection(): Promise<ApiResult>;
|
|
187
168
|
/**
|
|
188
|
-
* Clear all auth from the pool
|
|
169
|
+
* Clear all auth from the pool (no-op in single-profile mode)
|
|
189
170
|
*/
|
|
190
171
|
clearClients(): void;
|
|
191
172
|
}
|
|
192
|
-
export {};
|
|
193
173
|
//# sourceMappingURL=bitbucket-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bitbucket-utils.d.ts","sourceRoot":"","sources":["../../src/utils/bitbucket-utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"bitbucket-utils.d.ts","sourceRoot":"","sources":["../../src/utils/bitbucket-utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAIjD;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB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