bitbucketdc-cli 1.0.9 → 1.0.10

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.
Files changed (2) hide show
  1. package/dist/index.js +54 -6
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -906,13 +906,58 @@ Examples:
906
906
  upload(attachment);
907
907
  }
908
908
 
909
+ // src/commands/repo/clone.ts
910
+ import { execFileSync } from "child_process";
911
+ function clone(parent) {
912
+ parent.command("clone").description("Clone a repository using Bitbucket token authentication").requiredOption("--project <key>", "Bitbucket project key").requiredOption("--repo <slug>", "Repository slug").option("--path <path>", "Local directory to clone into").addHelpText(
913
+ "after",
914
+ `
915
+ Examples:
916
+ bitbucketdc repo clone --project AI --repo my-service
917
+ bitbucketdc repo clone --project AI --repo my-service --path ./local-dir`
918
+ ).action((opts) => {
919
+ const baseUrl = process.env.BITBUCKET_URL;
920
+ const token = process.env.BITBUCKET_TOKEN;
921
+ if (!baseUrl || !token) {
922
+ const missing = [...!baseUrl ? ["BITBUCKET_URL"] : [], ...!token ? ["BITBUCKET_TOKEN"] : []];
923
+ process.stderr.write(
924
+ `${JSON.stringify({ error: `Missing required environment variables: ${missing.join(", ")}` })}
925
+ `
926
+ );
927
+ process.exit(1);
928
+ }
929
+ const cloneUrl = `${baseUrl}/scm/${opts.project}/${opts.repo}.git`;
930
+ const args = ["-c", `http.extraHeader=Authorization: Bearer ${token}`, "clone", cloneUrl];
931
+ if (opts.path) args.push(opts.path);
932
+ execFileSync("git", args, { stdio: "inherit" });
933
+ });
934
+ }
935
+
909
936
  // src/commands/repo/list.ts
910
937
  function list3(parent) {
911
- parent.command("list <projectKey>").description("List repositories in a project").addHelpText("after", "\nExamples:\n bitbucketdc repo list PROJ\n bitbucketdc repo list MYPROJ").action(async (projectKey) => {
912
- const client = getClient();
913
- const result = await client.repositories.list({ projectKey });
914
- output(result);
915
- });
938
+ parent.command("list").description("List repositories with optional filters").option("--name <name>", "Filter by repository name (case-insensitive)").option("--project-key <key>", "Filter by project key").option("--project-name <name>", "Filter by project name (case-insensitive)").option("--visibility <type>", "Filter by visibility (public or private)").option("--archived <status>", "Filter by archived status (ACTIVE, ARCHIVED, ALL)").option("--start <n>", "Starting index for pagination (default: 0)", parseInt).option("--limit <n>", "Maximum results to return (default: 25)", parseInt).addHelpText(
939
+ "after",
940
+ `
941
+ Examples:
942
+ bitbucketdc repo list
943
+ bitbucketdc repo list --name my-repo
944
+ bitbucketdc repo list --project-key AI
945
+ bitbucketdc repo list --project-key AI --name svc --limit 50`
946
+ ).action(
947
+ async (opts) => {
948
+ const client = getClient();
949
+ const result = await client.repositories.list({
950
+ name: opts.name,
951
+ projectkey: opts.projectKey,
952
+ projectname: opts.projectName,
953
+ visibility: opts.visibility,
954
+ archived: opts.archived,
955
+ start: opts.start,
956
+ limit: opts.limit
957
+ });
958
+ output(result);
959
+ }
960
+ );
916
961
  }
917
962
 
918
963
  // src/commands/repo/index.ts
@@ -921,11 +966,14 @@ function registerRepoCommands(program2) {
921
966
  "after",
922
967
  `
923
968
  Examples:
924
- $ bitbucketdc repo list PROJ
969
+ $ bitbucketdc repo list
970
+ $ bitbucketdc repo list --name my-repo --project-key AI
971
+ $ bitbucketdc repo clone --project AI --repo my-repo
925
972
  $ bitbucketdc repo attachment download --project PROJ --repo my-repo --id abc123 --output ./file.png
926
973
  `
927
974
  );
928
975
  list3(repo);
976
+ clone(repo);
929
977
  registerAttachmentCommands(repo);
930
978
  }
931
979
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bitbucketdc-cli",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
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.11"
15
+ "bitbucket-data-center-client": "1.4.12"
16
16
  },
17
17
  "devDependencies": {
18
18
  "@types/node": "24.10.4",