bitbucketdc-cli 1.0.18 → 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 +84 -0
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1064,6 +1064,31 @@ Examples:
|
|
|
1064
1064
|
});
|
|
1065
1065
|
}
|
|
1066
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
|
+
|
|
1067
1092
|
// src/commands/repo/default-branch.ts
|
|
1068
1093
|
function defaultBranch(parent) {
|
|
1069
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(
|
|
@@ -1083,6 +1108,23 @@ Note: this command is read-only. Setting a default branch is not exposed by this
|
|
|
1083
1108
|
});
|
|
1084
1109
|
}
|
|
1085
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
|
+
|
|
1086
1128
|
// src/commands/repo/get.ts
|
|
1087
1129
|
function get3(parent) {
|
|
1088
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(
|
|
@@ -1131,6 +1173,42 @@ Examples:
|
|
|
1131
1173
|
);
|
|
1132
1174
|
}
|
|
1133
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
|
+
|
|
1134
1212
|
// src/commands/repo/index.ts
|
|
1135
1213
|
function registerRepoCommands(program2) {
|
|
1136
1214
|
const repo = program2.command("repo").description("Repository operations").addHelpText(
|
|
@@ -1139,12 +1217,18 @@ function registerRepoCommands(program2) {
|
|
|
1139
1217
|
Examples:
|
|
1140
1218
|
$ bitbucketdc repo list
|
|
1141
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
|
|
1142
1223
|
$ bitbucketdc repo clone --project AI --repo my-repo
|
|
1143
1224
|
$ bitbucketdc repo attachment download --project PROJ --repo my-repo --id abc123 --output ./file.png
|
|
1144
1225
|
`
|
|
1145
1226
|
);
|
|
1146
1227
|
list5(repo);
|
|
1147
1228
|
get3(repo);
|
|
1229
|
+
create2(repo);
|
|
1230
|
+
update2(repo);
|
|
1231
|
+
deleteRepo(repo);
|
|
1148
1232
|
defaultBranch(repo);
|
|
1149
1233
|
clone(repo);
|
|
1150
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"
|