bbk-cli 1.0.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/.claude/bitbucket-config.local.md.example +58 -0
- package/.eslintcache +1 -0
- package/.github/dependabot.yml +15 -0
- package/.github/workflows/convetional-commit.yml +24 -0
- package/.github/workflows/publish-on-tag.yml +47 -0
- package/.github/workflows/release-please.yml +21 -0
- package/.github/workflows/run-tests.yml +75 -0
- package/.nvmrc +1 -0
- package/.prettierignore +2 -0
- package/.prettierrc.cjs +17 -0
- package/.release-please-manifest.json +3 -0
- package/CHANGELOG.md +21 -0
- package/LICENSE +202 -0
- package/README.md +381 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +2 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/wrapper.d.ts +38 -0
- package/dist/cli/wrapper.d.ts.map +1 -0
- package/dist/cli/wrapper.js +326 -0
- package/dist/cli/wrapper.js.map +1 -0
- package/dist/commands/helpers.d.ts +11 -0
- package/dist/commands/helpers.d.ts.map +1 -0
- package/dist/commands/helpers.js +40 -0
- package/dist/commands/helpers.js.map +1 -0
- package/dist/commands/index.d.ts +3 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +3 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/runner.d.ts +7 -0
- package/dist/commands/runner.d.ts.map +1 -0
- package/dist/commands/runner.js +126 -0
- package/dist/commands/runner.js.map +1 -0
- package/dist/config/constants.d.ts +16 -0
- package/dist/config/constants.d.ts.map +1 -0
- package/dist/config/constants.js +171 -0
- package/dist/config/constants.js.map +1 -0
- package/dist/config/index.d.ts +2 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +2 -0
- package/dist/config/index.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/arg-parser.d.ts +7 -0
- package/dist/utils/arg-parser.d.ts.map +1 -0
- package/dist/utils/arg-parser.js +67 -0
- package/dist/utils/arg-parser.js.map +1 -0
- package/dist/utils/bitbucket-client.d.ts +122 -0
- package/dist/utils/bitbucket-client.d.ts.map +1 -0
- package/dist/utils/bitbucket-client.js +182 -0
- package/dist/utils/bitbucket-client.js.map +1 -0
- package/dist/utils/bitbucket-utils.d.ts +110 -0
- package/dist/utils/bitbucket-utils.d.ts.map +1 -0
- package/dist/utils/bitbucket-utils.js +491 -0
- package/dist/utils/bitbucket-utils.js.map +1 -0
- package/dist/utils/config-loader.d.ts +41 -0
- package/dist/utils/config-loader.d.ts.map +1 -0
- package/dist/utils/config-loader.js +76 -0
- package/dist/utils/config-loader.js.map +1 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +4 -0
- package/dist/utils/index.js.map +1 -0
- package/eslint.config.ts +15 -0
- package/package.json +62 -0
- package/release-please-config.json +33 -0
- package/tests/integration/cli-integration.test.ts +528 -0
- package/tests/unit/cli/wrapper.test.ts +727 -0
- package/tests/unit/commands/helpers.test.ts +268 -0
- package/tests/unit/commands/runner.test.ts +758 -0
- package/tests/unit/utils/arg-parser.test.ts +350 -0
- package/tests/unit/utils/config-loader.test.ts +158 -0
- package/vitest.config.ts +22 -0
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bitbucket CLI Commands Configuration
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Available Bitbucket commands
|
|
6
|
+
*/
|
|
7
|
+
export const COMMANDS = [
|
|
8
|
+
'list-repositories',
|
|
9
|
+
'get-repository',
|
|
10
|
+
'list-pullrequests',
|
|
11
|
+
'get-pullrequest',
|
|
12
|
+
'create-pullrequest',
|
|
13
|
+
'list-branches',
|
|
14
|
+
'list-commits',
|
|
15
|
+
'list-issues',
|
|
16
|
+
'get-issue',
|
|
17
|
+
'create-issue',
|
|
18
|
+
'list-pipelines',
|
|
19
|
+
'get-user',
|
|
20
|
+
'test-connection',
|
|
21
|
+
];
|
|
22
|
+
/**
|
|
23
|
+
* Brief descriptions for each command
|
|
24
|
+
*/
|
|
25
|
+
export const COMMANDS_INFO = [
|
|
26
|
+
'List all accessible repositories',
|
|
27
|
+
'Get details of a specific repository',
|
|
28
|
+
'List pull requests in a repository',
|
|
29
|
+
'Get details of a specific pull request',
|
|
30
|
+
'Create a new pull request',
|
|
31
|
+
'List branches in a repository',
|
|
32
|
+
'List commits in a repository',
|
|
33
|
+
'List issues in a repository',
|
|
34
|
+
'Get details of a specific issue',
|
|
35
|
+
'Create a new issue',
|
|
36
|
+
'List pipelines in a repository',
|
|
37
|
+
'Get user information',
|
|
38
|
+
'Test Bitbucket API connection',
|
|
39
|
+
];
|
|
40
|
+
/**
|
|
41
|
+
* Detailed parameter information for each command
|
|
42
|
+
*/
|
|
43
|
+
export const COMMANDS_DETAIL = [
|
|
44
|
+
`
|
|
45
|
+
Parameters:
|
|
46
|
+
- workspace (required): string - Workspace ID or slug
|
|
47
|
+
- profile (optional): string - Bitbucket profile name (default: configured default profile)
|
|
48
|
+
- format (optional): string - Output format: json or toon (default: json)
|
|
49
|
+
|
|
50
|
+
Example:
|
|
51
|
+
list-repositories '{"workspace":"myworkspace","profile":"cloud","format":"json"}'`,
|
|
52
|
+
`
|
|
53
|
+
Parameters:
|
|
54
|
+
- workspace (required): string - Workspace ID or slug
|
|
55
|
+
- repoSlug (required): string - Repository slug
|
|
56
|
+
- profile (optional): string - Bitbucket profile name (default: configured default profile)
|
|
57
|
+
- format (optional): string - Output format: json or toon (default: json)
|
|
58
|
+
|
|
59
|
+
Example:
|
|
60
|
+
get-repository '{"workspace":"myworkspace","repoSlug":"my-repo","profile":"cloud","format":"json"}'`,
|
|
61
|
+
`
|
|
62
|
+
Parameters:
|
|
63
|
+
- workspace (required): string - Workspace ID or slug
|
|
64
|
+
- repoSlug (required): string - Repository slug
|
|
65
|
+
- state (optional): string - Pull request state (OPEN, MERGED, DECLINED, SUPERSEDED)
|
|
66
|
+
- profile (optional): string - Bitbucket profile name (default: configured default profile)
|
|
67
|
+
- format (optional): string - Output format: json or toon (default: json)
|
|
68
|
+
|
|
69
|
+
Example:
|
|
70
|
+
list-pullrequests '{"workspace":"myworkspace","repoSlug":"my-repo","state":"OPEN","profile":"cloud","format":"json"}'`,
|
|
71
|
+
`
|
|
72
|
+
Parameters:
|
|
73
|
+
- workspace (required): string - Workspace ID or slug
|
|
74
|
+
- repoSlug (required): string - Repository slug
|
|
75
|
+
- pullRequestId (required): number - Pull request ID
|
|
76
|
+
- profile (optional): string - Bitbucket profile name (default: configured default profile)
|
|
77
|
+
- format (optional): string - Output format: json or toon (default: json)
|
|
78
|
+
|
|
79
|
+
Example:
|
|
80
|
+
get-pullrequest '{"workspace":"myworkspace","repoSlug":"my-repo","pullRequestId":123,"profile":"cloud","format":"json"}'`,
|
|
81
|
+
`
|
|
82
|
+
Parameters:
|
|
83
|
+
- workspace (required): string - Workspace ID or slug
|
|
84
|
+
- repoSlug (required): string - Repository slug
|
|
85
|
+
- title (required): string - Pull request title
|
|
86
|
+
- sourceBranch (required): string - Source branch name
|
|
87
|
+
- destinationBranch (required): string - Destination branch name (default: main or master)
|
|
88
|
+
- description (optional): string - Pull request description
|
|
89
|
+
- profile (optional): string - Bitbucket profile name (default: configured default profile)
|
|
90
|
+
- format (optional): string - Output format: json or toon (default: json)
|
|
91
|
+
|
|
92
|
+
Example:
|
|
93
|
+
create-pullrequest '{"workspace":"myworkspace","repoSlug":"my-repo","title":"Feature PR","sourceBranch":"feature/new","destinationBranch":"main","profile":"cloud","format":"json"}'`,
|
|
94
|
+
String.raw `
|
|
95
|
+
Parameters:
|
|
96
|
+
- workspace (required): string - Workspace ID or slug
|
|
97
|
+
- repoSlug (required): string - Repository slug
|
|
98
|
+
- q (optional): string - Query string to filter branches using comparison operators (=, !=, ~, !~, >, >=, <, <=, IN, NOT IN). Example: 'name~"feature"' for case-insensitive contains, or 'name="main"' for exact match
|
|
99
|
+
- sort (optional): string - Field to sort by. Prefix with '-' for descending order (e.g., '-target.date'). Only one sort field is supported per request
|
|
100
|
+
- profile (optional): string - Bitbucket profile name (default: configured default profile)
|
|
101
|
+
- format (optional): string - Output format: json or toon (default: json)
|
|
102
|
+
|
|
103
|
+
Example:
|
|
104
|
+
list-branches '{"workspace":"myworkspace","repoSlug":"my-repo","q":"name~\"feature\"","sort":"-target.date","profile":"cloud","format":"json"}'`,
|
|
105
|
+
`
|
|
106
|
+
Parameters:
|
|
107
|
+
- workspace (required): string - Workspace ID or slug
|
|
108
|
+
- repoSlug (required): string - Repository slug
|
|
109
|
+
- branch (optional): string - Branch name to filter commits
|
|
110
|
+
- profile (optional): string - Bitbucket profile name (default: configured default profile)
|
|
111
|
+
- format (optional): string - Output format: json or toon (default: json)
|
|
112
|
+
|
|
113
|
+
Example:
|
|
114
|
+
list-commits '{"workspace":"myworkspace","repoSlug":"my-repo","branch":"main","profile":"cloud","format":"json"}'`,
|
|
115
|
+
`
|
|
116
|
+
Parameters:
|
|
117
|
+
- workspace (required): string - Workspace ID or slug
|
|
118
|
+
- repoSlug (required): string - Repository slug
|
|
119
|
+
- profile (optional): string - Bitbucket profile name (default: configured default profile)
|
|
120
|
+
- format (optional): string - Output format: json or toon (default: json)
|
|
121
|
+
|
|
122
|
+
Example:
|
|
123
|
+
list-issues '{"workspace":"myworkspace","repoSlug":"my-repo","profile":"cloud","format":"json"}'`,
|
|
124
|
+
`
|
|
125
|
+
Parameters:
|
|
126
|
+
- workspace (required): string - Workspace ID or slug
|
|
127
|
+
- repoSlug (required): string - Repository slug
|
|
128
|
+
- issueId (required): number - Issue ID
|
|
129
|
+
- profile (optional): string - Bitbucket profile name (default: configured default profile)
|
|
130
|
+
- format (optional): string - Output format: json or toon (default: json)
|
|
131
|
+
|
|
132
|
+
Example:
|
|
133
|
+
get-issue '{"workspace":"myworkspace","repoSlug":"my-repo","issueId":123,"profile":"cloud","format":"json"}'`,
|
|
134
|
+
`
|
|
135
|
+
Parameters:
|
|
136
|
+
- workspace (required): string - Workspace ID or slug
|
|
137
|
+
- repoSlug (required): string - Repository slug
|
|
138
|
+
- title (required): string - Issue title
|
|
139
|
+
- content (optional): string - Issue content/description
|
|
140
|
+
- kind (optional): string - Issue type (bug, enhancement, proposal, task)
|
|
141
|
+
- priority (optional): string - Issue priority (trivial, minor, major, critical, blocker)
|
|
142
|
+
- profile (optional): string - Bitbucket profile name (default: configured default profile)
|
|
143
|
+
- format (optional): string - Output format: json or toon (default: json)
|
|
144
|
+
|
|
145
|
+
Example:
|
|
146
|
+
create-issue '{"workspace":"myworkspace","repoSlug":"my-repo","title":"Bug found","content":"Description here","kind":"bug","profile":"cloud","format":"json"}'`,
|
|
147
|
+
`
|
|
148
|
+
Parameters:
|
|
149
|
+
- workspace (required): string - Workspace ID or slug
|
|
150
|
+
- repoSlug (required): string - Repository slug
|
|
151
|
+
- profile (optional): string - Bitbucket profile name (default: configured default profile)
|
|
152
|
+
- format (optional): string - Output format: json or toon (default: json)
|
|
153
|
+
|
|
154
|
+
Example:
|
|
155
|
+
list-pipelines '{"workspace":"myworkspace","repoSlug":"my-repo","profile":"cloud","format":"json"}'`,
|
|
156
|
+
`
|
|
157
|
+
Parameters:
|
|
158
|
+
- username (optional): string - Username to search for
|
|
159
|
+
- profile (optional): string - Bitbucket profile name (default: configured default profile)
|
|
160
|
+
- format (optional): string - Output format: json or toon (default: json)
|
|
161
|
+
|
|
162
|
+
Example:
|
|
163
|
+
get-user '{"username":"myusername","profile":"cloud","format":"json"}'`,
|
|
164
|
+
`
|
|
165
|
+
Parameters:
|
|
166
|
+
- profile (optional): string - Bitbucket profile name (default: configured default profile)
|
|
167
|
+
|
|
168
|
+
Example:
|
|
169
|
+
test-connection '{"profile":"cloud"}'`,
|
|
170
|
+
];
|
|
171
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/config/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAa;IAChC,mBAAmB;IACnB,gBAAgB;IAChB,mBAAmB;IACnB,iBAAiB;IACjB,oBAAoB;IACpB,eAAe;IACf,cAAc;IACd,aAAa;IACb,WAAW;IACX,cAAc;IACd,gBAAgB;IAChB,UAAU;IACV,iBAAiB;CAClB,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAa;IACrC,kCAAkC;IAClC,sCAAsC;IACtC,oCAAoC;IACpC,wCAAwC;IACxC,2BAA2B;IAC3B,+BAA+B;IAC/B,8BAA8B;IAC9B,6BAA6B;IAC7B,iCAAiC;IACjC,oBAAoB;IACpB,gCAAgC;IAChC,sBAAsB;IACtB,+BAA+B;CAChC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAa;IACvC;;;;;;;kFAOgF;IAChF;;;;;;;;oGAQkG;IAClG;;;;;;;;;sHASoH;IACpH;;;;;;;;;yHASuH;IACvH;;;;;;;;;;;;qLAYmL;IACnL,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;gJAUoI;IAC9I;;;;;;;;;kHASgH;IAChH;;;;;;;;iGAQ+F;IAC/F;;;;;;;;;6GAS2G;IAC3G;;;;;;;;;;;;gKAY8J;IAC9J;;;;;;;;oGAQkG;IAClG;;;;;;;uEAOqE;IACrE;;;;;sCAKoC;CACrC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { wrapper } from './cli/index.js';
|
|
3
|
+
import { parseArguments } from './utils/index.js';
|
|
4
|
+
/**
|
|
5
|
+
* Main entry point for the Bitbucket CLI
|
|
6
|
+
*/
|
|
7
|
+
async function main() {
|
|
8
|
+
// Parse command line arguments
|
|
9
|
+
const args = process.argv.slice(2);
|
|
10
|
+
const shouldContinue = await parseArguments(args);
|
|
11
|
+
if (shouldContinue) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
// Start interactive CLI mode
|
|
15
|
+
const cli = new wrapper();
|
|
16
|
+
await cli.connect();
|
|
17
|
+
await cli.start();
|
|
18
|
+
}
|
|
19
|
+
// Run the CLI
|
|
20
|
+
main().catch(error => {
|
|
21
|
+
console.error('Fatal error:', error);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
});
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;GAEG;AACH,KAAK,UAAU,IAAI;IACjB,+BAA+B;IAC/B,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACnC,MAAM,cAAc,GAAG,MAAM,cAAc,CAAC,IAAI,CAAC,CAAC;IAElD,IAAI,cAAc,EAAE,CAAC;QACnB,OAAO;IACT,CAAC;IAED,6BAA6B;IAC7B,MAAM,GAAG,GAAG,IAAI,OAAO,EAAE,CAAC;IAC1B,MAAM,GAAG,CAAC,OAAO,EAAE,CAAC;IACpB,MAAM,GAAG,CAAC,KAAK,EAAE,CAAC;AACpB,CAAC;AAED,cAAc;AACd,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parses and handles command line arguments
|
|
3
|
+
* @param args - Command line arguments (process.argv.slice(2))
|
|
4
|
+
* @returns true if arguments were handled and should exit, false to continue to interactive mode
|
|
5
|
+
*/
|
|
6
|
+
export declare const parseArguments: (args: string[]) => Promise<boolean>;
|
|
7
|
+
//# sourceMappingURL=arg-parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arg-parser.d.ts","sourceRoot":"","sources":["../../src/utils/arg-parser.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAU,MAAM,MAAM,EAAE,KAAG,OAAO,CAAC,OAAO,CAsCpE,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { getCurrentVersion, printAvailableCommands, printCommandDetail, runCommand } from '../commands/index.js';
|
|
2
|
+
import { COMMANDS } from '../config/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Parses and handles command line arguments
|
|
5
|
+
* @param args - Command line arguments (process.argv.slice(2))
|
|
6
|
+
* @returns true if arguments were handled and should exit, false to continue to interactive mode
|
|
7
|
+
*/
|
|
8
|
+
export const parseArguments = async (args) => {
|
|
9
|
+
for (let i = 0; i < args.length; i++) {
|
|
10
|
+
// Version flag
|
|
11
|
+
if (args[i] === '--version' || args[i] === '-v') {
|
|
12
|
+
console.log(getCurrentVersion());
|
|
13
|
+
process.exit(0);
|
|
14
|
+
}
|
|
15
|
+
// List commands flag
|
|
16
|
+
if (args[i] === '--commands') {
|
|
17
|
+
printAvailableCommands();
|
|
18
|
+
process.exit(0);
|
|
19
|
+
}
|
|
20
|
+
// Command-specific help
|
|
21
|
+
if (i === 0 && args.length >= 2 && args[1] === '-h') {
|
|
22
|
+
printCommandDetail(args[0]);
|
|
23
|
+
process.exit(0);
|
|
24
|
+
}
|
|
25
|
+
// General help flag
|
|
26
|
+
if (args[i] === '--help' || args[i] === '-h') {
|
|
27
|
+
printGeneralHelp();
|
|
28
|
+
process.exit(0);
|
|
29
|
+
}
|
|
30
|
+
// Execute command in headless mode
|
|
31
|
+
if (i === 0 && args.length >= 1 && args[1] !== '-h' && COMMANDS.includes(args[0])) {
|
|
32
|
+
const rest = args.slice(1);
|
|
33
|
+
const params = (rest.find(a => !a.startsWith('-')) ?? null);
|
|
34
|
+
const flag = (rest.find(a => a.startsWith('-')) ?? null);
|
|
35
|
+
await runCommand(args[0], params, flag);
|
|
36
|
+
process.exit(0);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return false;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Prints general help message for the CLI
|
|
43
|
+
*/
|
|
44
|
+
const printGeneralHelp = () => {
|
|
45
|
+
console.log(`
|
|
46
|
+
Bitbucket CLI
|
|
47
|
+
|
|
48
|
+
Usage:
|
|
49
|
+
|
|
50
|
+
npx bbk-cli start interactive CLI
|
|
51
|
+
npx bbk-cli --commands list all available commands
|
|
52
|
+
npx bbk-cli <command> -h quick help on <command>
|
|
53
|
+
npx bbk-cli <command> <arg> run command in headless mode
|
|
54
|
+
|
|
55
|
+
All commands:
|
|
56
|
+
|
|
57
|
+
${COMMANDS.join(', ')}
|
|
58
|
+
|
|
59
|
+
Examples:
|
|
60
|
+
npx bbk-cli list-repositories '{"workspace":"myworkspace"}'
|
|
61
|
+
npx bbk-cli get-repository '{"workspace":"myworkspace","repoSlug":"my-repo"}'
|
|
62
|
+
npx bbk-cli list-pullrequests '{"workspace":"myworkspace","repoSlug":"my-repo","state":"OPEN"}'
|
|
63
|
+
npx bbk-cli test-connection
|
|
64
|
+
|
|
65
|
+
`);
|
|
66
|
+
};
|
|
67
|
+
//# sourceMappingURL=arg-parser.js.map
|
|
@@ -0,0 +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;AAE9C;;;;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,eAAe;QACf,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,WAAW,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;YAChD,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAC,CAAC;YACjC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,qBAAqB;QACrB,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,YAAY,EAAE,CAAC;YAC7B,sBAAsB,EAAE,CAAC;YACzB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,wBAAwB;QACxB,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;YACpD,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;Y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|
|
|
1
|
+
/**
|
|
2
|
+
* Bitbucket API client wrapper functions
|
|
3
|
+
*/
|
|
4
|
+
import type { ApiResult } from './bitbucket-utils.js';
|
|
5
|
+
/**
|
|
6
|
+
* List all repositories in a workspace
|
|
7
|
+
* @param profile - Bitbucket profile name
|
|
8
|
+
* @param workspace - Workspace ID or slug
|
|
9
|
+
* @param format - Output format (json, toon)
|
|
10
|
+
*/
|
|
11
|
+
export declare function listRepositories(profile: string, workspace: string, format?: 'json' | 'toon'): Promise<ApiResult>;
|
|
12
|
+
/**
|
|
13
|
+
* Get repository details
|
|
14
|
+
* @param profile - Bitbucket profile name
|
|
15
|
+
* @param workspace - Workspace ID or slug
|
|
16
|
+
* @param repoSlug - Repository slug
|
|
17
|
+
* @param format - Output format (json, toon)
|
|
18
|
+
*/
|
|
19
|
+
export declare function getRepository(profile: string, workspace: string, repoSlug: string, format?: 'json' | 'toon'): Promise<ApiResult>;
|
|
20
|
+
/**
|
|
21
|
+
* List pull requests in a repository
|
|
22
|
+
* @param profile - Bitbucket profile name
|
|
23
|
+
* @param workspace - Workspace ID or slug
|
|
24
|
+
* @param repoSlug - Repository slug
|
|
25
|
+
* @param state - Pull request state (optional)
|
|
26
|
+
* @param format - Output format (json, toon)
|
|
27
|
+
*/
|
|
28
|
+
export declare function listPullRequests(profile: string, workspace: string, repoSlug: string, state?: string, format?: 'json' | 'toon'): Promise<ApiResult>;
|
|
29
|
+
/**
|
|
30
|
+
* Get pull request details
|
|
31
|
+
* @param profile - Bitbucket profile name
|
|
32
|
+
* @param workspace - Workspace ID or slug
|
|
33
|
+
* @param repoSlug - Repository slug
|
|
34
|
+
* @param pullRequestId - Pull request ID
|
|
35
|
+
* @param format - Output format (json, toon)
|
|
36
|
+
*/
|
|
37
|
+
export declare function getPullRequest(profile: string, workspace: string, repoSlug: string, pullRequestId: number, format?: 'json' | 'toon'): Promise<ApiResult>;
|
|
38
|
+
/**
|
|
39
|
+
* Create a new pull request
|
|
40
|
+
* @param profile - Bitbucket profile name
|
|
41
|
+
* @param workspace - Workspace ID or slug
|
|
42
|
+
* @param repoSlug - Repository slug
|
|
43
|
+
* @param title - Pull request title
|
|
44
|
+
* @param sourceBranch - Source branch name
|
|
45
|
+
* @param destinationBranch - Destination branch name
|
|
46
|
+
* @param description - Pull request description (optional)
|
|
47
|
+
* @param format - Output format (json, toon)
|
|
48
|
+
*/
|
|
49
|
+
export declare function createPullRequest(profile: string, workspace: string, repoSlug: string, title: string, sourceBranch: string, destinationBranch: string, description?: string, format?: 'json' | 'toon'): Promise<ApiResult>;
|
|
50
|
+
/**
|
|
51
|
+
* List branches in a repository
|
|
52
|
+
* @param profile - Bitbucket profile name
|
|
53
|
+
* @param workspace - Workspace ID or slug
|
|
54
|
+
* @param repoSlug - Repository slug
|
|
55
|
+
* @param q - Query string to filter branches
|
|
56
|
+
* @param sort - Sort field
|
|
57
|
+
* @param format - Output format (json, toon)
|
|
58
|
+
*/
|
|
59
|
+
export declare function listBranches(profile: string, workspace: string, repoSlug: string, q?: string, sort?: string, format?: 'json' | 'toon'): Promise<ApiResult>;
|
|
60
|
+
/**
|
|
61
|
+
* List commits in a repository
|
|
62
|
+
* @param profile - Bitbucket profile name
|
|
63
|
+
* @param workspace - Workspace ID or slug
|
|
64
|
+
* @param repoSlug - Repository slug
|
|
65
|
+
* @param branch - Branch name (optional)
|
|
66
|
+
* @param format - Output format (json, toon)
|
|
67
|
+
*/
|
|
68
|
+
export declare function listCommits(profile: string, workspace: string, repoSlug: string, branch?: string, format?: 'json' | 'toon'): Promise<ApiResult>;
|
|
69
|
+
/**
|
|
70
|
+
* List issues in a repository
|
|
71
|
+
* @param profile - Bitbucket profile name
|
|
72
|
+
* @param workspace - Workspace ID or slug
|
|
73
|
+
* @param repoSlug - Repository slug
|
|
74
|
+
* @param format - Output format (json, toon)
|
|
75
|
+
*/
|
|
76
|
+
export declare function listIssues(profile: string, workspace: string, repoSlug: string, format?: 'json' | 'toon'): Promise<ApiResult>;
|
|
77
|
+
/**
|
|
78
|
+
* Get issue details
|
|
79
|
+
* @param profile - Bitbucket profile name
|
|
80
|
+
* @param workspace - Workspace ID or slug
|
|
81
|
+
* @param repoSlug - Repository slug
|
|
82
|
+
* @param issueId - Issue ID
|
|
83
|
+
* @param format - Output format (json, toon)
|
|
84
|
+
*/
|
|
85
|
+
export declare function getIssue(profile: string, workspace: string, repoSlug: string, issueId: number, format?: 'json' | 'toon'): Promise<ApiResult>;
|
|
86
|
+
/**
|
|
87
|
+
* Create a new issue
|
|
88
|
+
* @param profile - Bitbucket profile name
|
|
89
|
+
* @param workspace - Workspace ID or slug
|
|
90
|
+
* @param repoSlug - Repository slug
|
|
91
|
+
* @param title - Issue title
|
|
92
|
+
* @param content - Issue content/description (optional)
|
|
93
|
+
* @param kind - Issue type (bug, enhancement, proposal, task)
|
|
94
|
+
* @param priority - Issue priority (trivial, minor, major, critical, blocker)
|
|
95
|
+
* @param format - Output format (json, toon)
|
|
96
|
+
*/
|
|
97
|
+
export declare function createIssue(profile: string, workspace: string, repoSlug: string, title: string, content?: string, kind?: string, priority?: string, format?: 'json' | 'toon'): Promise<ApiResult>;
|
|
98
|
+
/**
|
|
99
|
+
* List pipelines in a repository
|
|
100
|
+
* @param profile - Bitbucket profile name
|
|
101
|
+
* @param workspace - Workspace ID or slug
|
|
102
|
+
* @param repoSlug - Repository slug
|
|
103
|
+
* @param format - Output format (json, toon)
|
|
104
|
+
*/
|
|
105
|
+
export declare function listPipelines(profile: string, workspace: string, repoSlug: string, format?: 'json' | 'toon'): Promise<ApiResult>;
|
|
106
|
+
/**
|
|
107
|
+
* Get user information
|
|
108
|
+
* @param profile - Bitbucket profile name
|
|
109
|
+
* @param username - Username (optional)
|
|
110
|
+
* @param format - Output format (json, toon)
|
|
111
|
+
*/
|
|
112
|
+
export declare function getUser(profile: string, username?: string, format?: 'json' | 'toon'): Promise<ApiResult>;
|
|
113
|
+
/**
|
|
114
|
+
* Test Bitbucket API connection
|
|
115
|
+
* @param profile - Bitbucket profile name
|
|
116
|
+
*/
|
|
117
|
+
export declare function testConnection(profile: string): Promise<ApiResult>;
|
|
118
|
+
/**
|
|
119
|
+
* Clear Bitbucket client pool (for cleanup)
|
|
120
|
+
*/
|
|
121
|
+
export declare function clearClients(): void;
|
|
122
|
+
//# sourceMappingURL=bitbucket-client.d.ts.map
|
|
@@ -0,0 +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;AAwBtD;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,MAAM,GAAE,MAAM,GAAG,MAAe,GAC/B,OAAO,CAAC,SAAS,CAAC,CAGpB;AAED;;;;;;GAMG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,MAAM,GAAE,MAAM,GAAG,MAAe,GAC/B,OAAO,CAAC,SAAS,CAAC,CAGpB;AAED;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,MAAM,EACd,MAAM,GAAE,MAAM,GAAG,MAAe,GAC/B,OAAO,CAAC,SAAS,CAAC,CAGpB;AAED;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EACrB,MAAM,GAAE,MAAM,GAAG,MAAe,GAC/B,OAAO,CAAC,SAAS,CAAC,CAGpB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,MAAM,EACf,SAA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AM,EAChB,IAAI,CAAC,EAAE,MAAM,EACb,QAAQ,CAAC,EAAE,MAAM,EACjB,MAAM,GAAE,MAAM,GAAG,MAAe,GAC/B,OAAO,CAAC,SAAS,CAAC,CAGpB;AAED;;;;;;GAMG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,MAAM,GAAE,MAAM,GAAG,MAAe,GAC/B,OAAO,CAAC,SAAS,CAAC,CAGpB;AAED;;;;;GAKG;AACH,wBAAsB,OAAO,CAC3B,OAAO,EAAE,MAAM,EACf,QAAQ,CAAC,EAAE,MAAM,EACjB,MAAM,GAAE,MAAM,GAAG,MAAe,GAC/B,OAAO,CAAC,SAAS,CAAC,CAGpB;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAGxE;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,IAAI,CAKnC"}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { BitbucketUtil } from './bitbucket-utils.js';
|
|
2
|
+
import { loadConfig } from './config-loader.js';
|
|
3
|
+
const projectRoot = process.env.CLAUDE_PROJECT_ROOT || process.cwd();
|
|
4
|
+
let bitbucketUtil = null;
|
|
5
|
+
/**
|
|
6
|
+
* Initialize Bitbucket utility
|
|
7
|
+
*/
|
|
8
|
+
async function initBitbucket() {
|
|
9
|
+
if (bitbucketUtil)
|
|
10
|
+
return bitbucketUtil;
|
|
11
|
+
try {
|
|
12
|
+
const config = loadConfig(projectRoot);
|
|
13
|
+
bitbucketUtil = new BitbucketUtil(config);
|
|
14
|
+
return bitbucketUtil;
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
18
|
+
throw new Error(`Failed to initialize Bitbucket client: ${errorMessage}`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* List all repositories in a workspace
|
|
23
|
+
* @param profile - Bitbucket profile name
|
|
24
|
+
* @param workspace - Workspace ID or slug
|
|
25
|
+
* @param format - Output format (json, toon)
|
|
26
|
+
*/
|
|
27
|
+
export async function listRepositories(profile, workspace, format = 'json') {
|
|
28
|
+
const bitbucket = await initBitbucket();
|
|
29
|
+
return await bitbucket.listRepositories(profile, workspace, format);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Get repository details
|
|
33
|
+
* @param profile - Bitbucket profile name
|
|
34
|
+
* @param workspace - Workspace ID or slug
|
|
35
|
+
* @param repoSlug - Repository slug
|
|
36
|
+
* @param format - Output format (json, toon)
|
|
37
|
+
*/
|
|
38
|
+
export async function getRepository(profile, workspace, repoSlug, format = 'json') {
|
|
39
|
+
const bitbucket = await initBitbucket();
|
|
40
|
+
return await bitbucket.getRepository(profile, workspace, repoSlug, format);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* List pull requests in a repository
|
|
44
|
+
* @param profile - Bitbucket profile name
|
|
45
|
+
* @param workspace - Workspace ID or slug
|
|
46
|
+
* @param repoSlug - Repository slug
|
|
47
|
+
* @param state - Pull request state (optional)
|
|
48
|
+
* @param format - Output format (json, toon)
|
|
49
|
+
*/
|
|
50
|
+
export async function listPullRequests(profile, workspace, repoSlug, state, format = 'json') {
|
|
51
|
+
const bitbucket = await initBitbucket();
|
|
52
|
+
return await bitbucket.listPullRequests(profile, workspace, repoSlug, state, format);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Get pull request details
|
|
56
|
+
* @param profile - Bitbucket profile name
|
|
57
|
+
* @param workspace - Workspace ID or slug
|
|
58
|
+
* @param repoSlug - Repository slug
|
|
59
|
+
* @param pullRequestId - Pull request ID
|
|
60
|
+
* @param format - Output format (json, toon)
|
|
61
|
+
*/
|
|
62
|
+
export async function getPullRequest(profile, workspace, repoSlug, pullRequestId, format = 'json') {
|
|
63
|
+
const bitbucket = await initBitbucket();
|
|
64
|
+
return await bitbucket.getPullRequest(profile, workspace, repoSlug, pullRequestId, format);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Create a new pull request
|
|
68
|
+
* @param profile - Bitbucket profile name
|
|
69
|
+
* @param workspace - Workspace ID or slug
|
|
70
|
+
* @param repoSlug - Repository slug
|
|
71
|
+
* @param title - Pull request title
|
|
72
|
+
* @param sourceBranch - Source branch name
|
|
73
|
+
* @param destinationBranch - Destination branch name
|
|
74
|
+
* @param description - Pull request description (optional)
|
|
75
|
+
* @param format - Output format (json, toon)
|
|
76
|
+
*/
|
|
77
|
+
export async function createPullRequest(profile, workspace, repoSlug, title, sourceBranch, destinationBranch, description, format = 'json') {
|
|
78
|
+
const bitbucket = await initBitbucket();
|
|
79
|
+
return await bitbucket.createPullRequest(profile, workspace, repoSlug, title, sourceBranch, destinationBranch, description, format);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* List branches in a repository
|
|
83
|
+
* @param profile - Bitbucket profile name
|
|
84
|
+
* @param workspace - Workspace ID or slug
|
|
85
|
+
* @param repoSlug - Repository slug
|
|
86
|
+
* @param q - Query string to filter branches
|
|
87
|
+
* @param sort - Sort field
|
|
88
|
+
* @param format - Output format (json, toon)
|
|
89
|
+
*/
|
|
90
|
+
export async function listBranches(profile, workspace, repoSlug, q, sort, format = 'json') {
|
|
91
|
+
const bitbucket = await initBitbucket();
|
|
92
|
+
return await bitbucket.listBranches(profile, workspace, repoSlug, q, sort, format);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* List commits in a repository
|
|
96
|
+
* @param profile - Bitbucket profile name
|
|
97
|
+
* @param workspace - Workspace ID or slug
|
|
98
|
+
* @param repoSlug - Repository slug
|
|
99
|
+
* @param branch - Branch name (optional)
|
|
100
|
+
* @param format - Output format (json, toon)
|
|
101
|
+
*/
|
|
102
|
+
export async function listCommits(profile, workspace, repoSlug, branch, format = 'json') {
|
|
103
|
+
const bitbucket = await initBitbucket();
|
|
104
|
+
return await bitbucket.listCommits(profile, workspace, repoSlug, branch, format);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* List issues in a repository
|
|
108
|
+
* @param profile - Bitbucket profile name
|
|
109
|
+
* @param workspace - Workspace ID or slug
|
|
110
|
+
* @param repoSlug - Repository slug
|
|
111
|
+
* @param format - Output format (json, toon)
|
|
112
|
+
*/
|
|
113
|
+
export async function listIssues(profile, workspace, repoSlug, format = 'json') {
|
|
114
|
+
const bitbucket = await initBitbucket();
|
|
115
|
+
return await bitbucket.listIssues(profile, workspace, repoSlug, format);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Get issue details
|
|
119
|
+
* @param profile - Bitbucket profile name
|
|
120
|
+
* @param workspace - Workspace ID or slug
|
|
121
|
+
* @param repoSlug - Repository slug
|
|
122
|
+
* @param issueId - Issue ID
|
|
123
|
+
* @param format - Output format (json, toon)
|
|
124
|
+
*/
|
|
125
|
+
export async function getIssue(profile, workspace, repoSlug, issueId, format = 'json') {
|
|
126
|
+
const bitbucket = await initBitbucket();
|
|
127
|
+
return await bitbucket.getIssue(profile, workspace, repoSlug, issueId, format);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Create a new issue
|
|
131
|
+
* @param profile - Bitbucket profile name
|
|
132
|
+
* @param workspace - Workspace ID or slug
|
|
133
|
+
* @param repoSlug - Repository slug
|
|
134
|
+
* @param title - Issue title
|
|
135
|
+
* @param content - Issue content/description (optional)
|
|
136
|
+
* @param kind - Issue type (bug, enhancement, proposal, task)
|
|
137
|
+
* @param priority - Issue priority (trivial, minor, major, critical, blocker)
|
|
138
|
+
* @param format - Output format (json, toon)
|
|
139
|
+
*/
|
|
140
|
+
export async function createIssue(profile, workspace, repoSlug, title, content, kind, priority, format = 'json') {
|
|
141
|
+
const bitbucket = await initBitbucket();
|
|
142
|
+
return await bitbucket.createIssue(profile, workspace, repoSlug, title, content, kind, priority, format);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* List pipelines in a repository
|
|
146
|
+
* @param profile - Bitbucket profile name
|
|
147
|
+
* @param workspace - Workspace ID or slug
|
|
148
|
+
* @param repoSlug - Repository slug
|
|
149
|
+
* @param format - Output format (json, toon)
|
|
150
|
+
*/
|
|
151
|
+
export async function listPipelines(profile, workspace, repoSlug, format = 'json') {
|
|
152
|
+
const bitbucket = await initBitbucket();
|
|
153
|
+
return await bitbucket.listPipelines(profile, workspace, repoSlug, format);
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Get user information
|
|
157
|
+
* @param profile - Bitbucket profile name
|
|
158
|
+
* @param username - Username (optional)
|
|
159
|
+
* @param format - Output format (json, toon)
|
|
160
|
+
*/
|
|
161
|
+
export async function getUser(profile, username, format = 'json') {
|
|
162
|
+
const bitbucket = await initBitbucket();
|
|
163
|
+
return await bitbucket.getUser(profile, username, format);
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Test Bitbucket API connection
|
|
167
|
+
* @param profile - Bitbucket profile name
|
|
168
|
+
*/
|
|
169
|
+
export async function testConnection(profile) {
|
|
170
|
+
const bitbucket = await initBitbucket();
|
|
171
|
+
return await bitbucket.testConnection(profile);
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Clear Bitbucket client pool (for cleanup)
|
|
175
|
+
*/
|
|
176
|
+
export function clearClients() {
|
|
177
|
+
if (bitbucketUtil) {
|
|
178
|
+
bitbucketUtil.clearClients();
|
|
179
|
+
bitbucketUtil = null;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
//# sourceMappingURL=bitbucket-client.js.map
|
|
@@ -0,0 +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;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