bitbucketdc-cli 1.0.17 → 1.0.19
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 +86 -8
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -891,9 +891,7 @@ Examples:
|
|
|
891
891
|
bitbucketdc pr update --project PROJ --repo my-repo --id 42 --title "New" --description "Both"`
|
|
892
892
|
).action(async (opts) => {
|
|
893
893
|
if (!opts.title && !opts.description) {
|
|
894
|
-
|
|
895
|
-
`);
|
|
896
|
-
process.exit(1);
|
|
894
|
+
throw new Error("At least one of --title or --description is required");
|
|
897
895
|
}
|
|
898
896
|
const client = getClient();
|
|
899
897
|
const result = await client.pullRequests.update({
|
|
@@ -1057,11 +1055,7 @@ Examples:
|
|
|
1057
1055
|
const token = process.env.BITBUCKET_TOKEN;
|
|
1058
1056
|
if (!baseUrl || !token) {
|
|
1059
1057
|
const missing = [...!baseUrl ? ["BITBUCKET_URL"] : [], ...!token ? ["BITBUCKET_TOKEN"] : []];
|
|
1060
|
-
|
|
1061
|
-
`${JSON.stringify({ error: `Missing required environment variables: ${missing.join(", ")}` })}
|
|
1062
|
-
`
|
|
1063
|
-
);
|
|
1064
|
-
process.exit(1);
|
|
1058
|
+
throw new Error(`Missing required environment variables: ${missing.join(", ")}`);
|
|
1065
1059
|
}
|
|
1066
1060
|
const cloneUrl = `${baseUrl}/scm/${opts.project}/${opts.repo}.git`;
|
|
1067
1061
|
const args = ["-c", `http.extraHeader=Authorization: Bearer ${token}`, "clone", cloneUrl];
|
|
@@ -1070,6 +1064,31 @@ Examples:
|
|
|
1070
1064
|
});
|
|
1071
1065
|
}
|
|
1072
1066
|
|
|
1067
|
+
// src/commands/repo/create.ts
|
|
1068
|
+
function create2(parent) {
|
|
1069
|
+
parent.command("create").description("Create a new repository in a project").requiredOption("--project <key>", "Bitbucket project key").requiredOption("--name <name>", "Repository name (slug is derived by Bitbucket)").option("--description <text>", "Repository description").option("--default-branch <ref>", 'Default branch (e.g. "main" or "refs/heads/main")').option("--no-forkable", "Disable forking (default: forkable)").option("--public", "Make repository public (default: private)").addHelpText(
|
|
1070
|
+
"after",
|
|
1071
|
+
`
|
|
1072
|
+
Examples:
|
|
1073
|
+
bitbucketdc repo create --project AI --name my-service
|
|
1074
|
+
bitbucketdc repo create --project AI --name my-service --description "Service code" --default-branch main
|
|
1075
|
+
bitbucketdc repo create --project AI --name internal-tool --no-forkable`
|
|
1076
|
+
).action(
|
|
1077
|
+
async (opts) => {
|
|
1078
|
+
const client = getClient();
|
|
1079
|
+
const result = await client.repositories.create({
|
|
1080
|
+
projectKey: opts.project,
|
|
1081
|
+
name: opts.name,
|
|
1082
|
+
description: opts.description,
|
|
1083
|
+
defaultBranch: opts.defaultBranch,
|
|
1084
|
+
forkable: opts.forkable,
|
|
1085
|
+
public: opts.public
|
|
1086
|
+
});
|
|
1087
|
+
output(result);
|
|
1088
|
+
}
|
|
1089
|
+
);
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1073
1092
|
// src/commands/repo/default-branch.ts
|
|
1074
1093
|
function defaultBranch(parent) {
|
|
1075
1094
|
parent.command("default-branch").description("Read the default branch configured for a repository (read-only)").requiredOption("--project <key>", "Bitbucket project key").requiredOption("--repo <slug>", "Repository slug").addHelpText(
|
|
@@ -1089,6 +1108,23 @@ Note: this command is read-only. Setting a default branch is not exposed by this
|
|
|
1089
1108
|
});
|
|
1090
1109
|
}
|
|
1091
1110
|
|
|
1111
|
+
// src/commands/repo/delete.ts
|
|
1112
|
+
function deleteRepo(parent) {
|
|
1113
|
+
parent.command("delete").description("Delete a repository (Bitbucket removes it asynchronously)").requiredOption("--project <key>", "Bitbucket project key").requiredOption("--repo <slug>", "Repository slug").addHelpText(
|
|
1114
|
+
"after",
|
|
1115
|
+
`
|
|
1116
|
+
Examples:
|
|
1117
|
+
bitbucketdc repo delete --project AI --repo old-service`
|
|
1118
|
+
).action(async (opts) => {
|
|
1119
|
+
const client = getClient();
|
|
1120
|
+
await client.repositories.delete({
|
|
1121
|
+
projectKey: opts.project,
|
|
1122
|
+
repositorySlug: opts.repo
|
|
1123
|
+
});
|
|
1124
|
+
output({ deleted: true, projectKey: opts.project, repositorySlug: opts.repo });
|
|
1125
|
+
});
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1092
1128
|
// src/commands/repo/get.ts
|
|
1093
1129
|
function get3(parent) {
|
|
1094
1130
|
parent.command("get").description("Get full metadata for a repository (includes defaultBranch, project, links)").requiredOption("--project <key>", "Bitbucket project key").requiredOption("--repo <slug>", "Repository slug").addHelpText(
|
|
@@ -1137,6 +1173,42 @@ Examples:
|
|
|
1137
1173
|
);
|
|
1138
1174
|
}
|
|
1139
1175
|
|
|
1176
|
+
// src/commands/repo/update.ts
|
|
1177
|
+
function update2(parent) {
|
|
1178
|
+
parent.command("update").description("Update repository settings (only provided fields are changed)").requiredOption("--project <key>", "Bitbucket project key").requiredOption("--repo <slug>", "Repository slug").option("--name <name>", "New repository name (slug is regenerated server-side)").option("--description <text>", "New description").option("--default-branch <ref>", 'New default branch (e.g. "main" or "refs/heads/main")').option("--public", "Make repository public").option("--private", "Make repository private").option("--forkable", "Allow forking").option("--no-forkable", "Disable forking").addHelpText(
|
|
1179
|
+
"after",
|
|
1180
|
+
`
|
|
1181
|
+
Examples:
|
|
1182
|
+
bitbucketdc repo update --project AI --repo my-svc --name "my-service" --description "Service code"
|
|
1183
|
+
bitbucketdc repo update --project AI --repo my-svc --default-branch main
|
|
1184
|
+
bitbucketdc repo update --project AI --repo open-source --public --no-forkable`
|
|
1185
|
+
).action(
|
|
1186
|
+
async (opts) => {
|
|
1187
|
+
if (opts.public && opts.private) {
|
|
1188
|
+
throw new Error("Pass only one of --public or --private");
|
|
1189
|
+
}
|
|
1190
|
+
const isPublic = opts.public ? true : opts.private ? false : void 0;
|
|
1191
|
+
const forkable = opts.forkable === false ? false : opts.forkable === true ? true : void 0;
|
|
1192
|
+
if (opts.name === void 0 && opts.description === void 0 && opts.defaultBranch === void 0 && isPublic === void 0 && forkable === void 0) {
|
|
1193
|
+
throw new Error(
|
|
1194
|
+
"Provide at least one of --name, --description, --default-branch, --public/--private, --forkable/--no-forkable"
|
|
1195
|
+
);
|
|
1196
|
+
}
|
|
1197
|
+
const client = getClient();
|
|
1198
|
+
const result = await client.repositories.update({
|
|
1199
|
+
projectKey: opts.project,
|
|
1200
|
+
repositorySlug: opts.repo,
|
|
1201
|
+
name: opts.name,
|
|
1202
|
+
description: opts.description,
|
|
1203
|
+
defaultBranch: opts.defaultBranch,
|
|
1204
|
+
forkable,
|
|
1205
|
+
public: isPublic
|
|
1206
|
+
});
|
|
1207
|
+
output(result);
|
|
1208
|
+
}
|
|
1209
|
+
);
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1140
1212
|
// src/commands/repo/index.ts
|
|
1141
1213
|
function registerRepoCommands(program2) {
|
|
1142
1214
|
const repo = program2.command("repo").description("Repository operations").addHelpText(
|
|
@@ -1145,12 +1217,18 @@ function registerRepoCommands(program2) {
|
|
|
1145
1217
|
Examples:
|
|
1146
1218
|
$ bitbucketdc repo list
|
|
1147
1219
|
$ bitbucketdc repo list --name my-repo --project AI
|
|
1220
|
+
$ bitbucketdc repo create --project AI --name my-service
|
|
1221
|
+
$ bitbucketdc repo update --project AI --repo my-service --description "..."
|
|
1222
|
+
$ bitbucketdc repo delete --project AI --repo old-service
|
|
1148
1223
|
$ bitbucketdc repo clone --project AI --repo my-repo
|
|
1149
1224
|
$ bitbucketdc repo attachment download --project PROJ --repo my-repo --id abc123 --output ./file.png
|
|
1150
1225
|
`
|
|
1151
1226
|
);
|
|
1152
1227
|
list5(repo);
|
|
1153
1228
|
get3(repo);
|
|
1229
|
+
create2(repo);
|
|
1230
|
+
update2(repo);
|
|
1231
|
+
deleteRepo(repo);
|
|
1154
1232
|
defaultBranch(repo);
|
|
1155
1233
|
clone(repo);
|
|
1156
1234
|
registerAttachmentCommands(repo);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bitbucketdc-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.19",
|
|
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.19"
|
|
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"
|