### Initial Bitbucket CLI Setup Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/00_START_HERE.md Create your first profile, authorize it with Bitbucket, and test your setup by listing workspaces. ```bash # Create your first profile bb profile create \ --name myprofile \ --default-workspace myworkspace \ --client-id YOUR_CLIENT_ID \ --client-secret YOUR_CLIENT_SECRET \ --callback-port 8080 \ --default # Authorize with Bitbucket bb profile authorize myprofile # Test your setup bb workspace list ``` -------------------------------- ### Install bb with Go (latest) Source: https://github.com/gildas/bitbucket-cli/blob/dev/README.md Install the latest version of the Bitbucket CLI using Go. This method requires Go to be installed and configured. ```bash go install github.com/gildas/bitbucket-cli@latest mv $GOPATH/bin/bitbucket-cli $GOPATH/bin/bb ``` -------------------------------- ### Install Bitbucket CLI Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/00_START_HERE.md Install the Bitbucket CLI using Homebrew, Scoop for Windows, or directly from source using Go. ```bash # Homebrew brew install gildas/tap/bitbucket-cli # Windows (Scoop) scoop install bitbucket-cli # From source go install github.com/gildas/bitbucket-cli@latest ``` -------------------------------- ### Install bb with Scoop Source: https://github.com/gildas/bitbucket-cli/blob/dev/README.md Install the Bitbucket CLI using Scoop on Windows. This involves adding the repository and then installing the CLI. ```bash scoop bucket add gildas https://github.com/gildas/scoop-bucket scoop install bitbucket-cli ``` -------------------------------- ### Install bb with Chocolatey Source: https://github.com/gildas/bitbucket-cli/blob/dev/README.md Install the Bitbucket CLI using Chocolatey on Windows. Ensure Chocolatey is installed. ```bash choco install bitbucket-cli ``` -------------------------------- ### Install bb with Homebrew Source: https://github.com/gildas/bitbucket-cli/blob/dev/README.md Install the Bitbucket CLI using Homebrew on Linux or macOS. Ensure you have Homebrew installed. ```bash brew install gildas/tap/bitbucket-cli ``` -------------------------------- ### Install bb with Snap Source: https://github.com/gildas/bitbucket-cli/blob/dev/README.md Install the Bitbucket CLI using Snap on Linux. This command also aliases the executable to 'bb'. ```bash sudo snap install bitbucket-cli sudo snap alias bitbucket-cli bb ``` -------------------------------- ### Install bb with Go (dev branch) Source: https://github.com/gildas/bitbucket-cli/blob/dev/README.md Install the development branch version of the Bitbucket CLI using Go. This is useful for testing the latest features. ```bash go install github.com/gildas/bitbucket-cli@dev mv $GOPATH/bin/bitbucket-cli $GOPATH/bin/bb ``` -------------------------------- ### Example Bitbucket CLI Configuration File Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/profile-commands.md This is an example of a YAML configuration file for the Bitbucket CLI, demonstrating how to define profiles with specific settings like default workspace, user email, output format, and clone protocol. ```yaml profiles: - name: myprofile default: true defaultWorkspace: myworkspace user: me@example.com outputFormat: json cloneProtocol: ssh ``` -------------------------------- ### Set Up Project with Default Reviewers Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/workspace-project-commands.md Use these commands to create a new project, add default reviewers, and verify the setup. ```bash # Create project bb project create --name "Core Services" --key CORE --workspace myworkspace # Add default reviewers bb project reviewer add user1-uuid --project CORE bb project reviewer add user2-uuid --project CORE # Verify setup bb project reviewer list --project CORE ``` -------------------------------- ### Dry-Run Preview and Execution Example Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/errors.md Demonstrates how to use the `--dry-run` flag to preview a command and then execute it. ```bash # Preview deletion bb repo delete myrepo --dry-run # Execute deletion bb repo delete myrepo ``` -------------------------------- ### List Pull Requests Source: https://github.com/gildas/bitbucket-cli/blob/dev/README.md Use this command to list all pull requests. No setup is required. ```bash bb pullrequest list ``` -------------------------------- ### Get Project Details Source: https://github.com/gildas/bitbucket-cli/blob/dev/README.md Retrieve detailed information about a specific project by its name. ```bash bb project get myproject ``` -------------------------------- ### Parallel Operations with xargs Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/README.md Execute commands in parallel for faster processing of multiple items. This example uses `xargs` to run `bb repo get` on multiple repositories concurrently. ```bash # Use xargs for parallel execution echo "repo1 repo2 repo3" | xargs -P 3 -I {} bb repo get {} ``` -------------------------------- ### Get Repository Details Source: https://github.com/gildas/bitbucket-cli/blob/dev/README.md Retrieves the details of a specific repository. ```bash bb repo get myrepository ``` -------------------------------- ### CI/CD Pipeline: Create and Merge PR Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/README.md Integrate Bitbucket CLI commands into CI/CD workflows for automated pull request creation and merging. This example creates a PR, waits for checks, and then merges it. ```bash #!/bin/bash set -e # Create PR from feature branch PR_ID=$(bb pr create \ --title "Automated PR" \ --source feature-branch \ --destination main \ --reviewer default \ --output json | jq -r '.id') echo "Created PR #$PR_ID" # Wait for checks (example) sleep 30 # Merge PR bb pr merge $PR_ID --close-source-branch ``` -------------------------------- ### Get Profile Details Source: https://github.com/gildas/bitbucket-cli/blob/dev/README.md Retrieve details for a specific profile or the current active profile. ```bash bb profile get myprofile ``` ```bash bb profile get --current ``` ```bash bb profile which ``` -------------------------------- ### Format Command Output as JSON Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/workspace-project-commands.md Example of piping the output of a workspace list command to `jq` for JSON processing. ```bash bb workspace list --output json | jq '.[] | .slug' ``` -------------------------------- ### Get Project Details Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/workspace-project-commands.md Retrieves detailed information for a specific project using its key or name. Can filter displayed columns and output format. ```bash bb project get MYKEY --workspace myworkspace ``` ```bash bb project show MYKEY ``` -------------------------------- ### Get Tag Details Source: https://github.com/gildas/bitbucket-cli/blob/dev/README.md Retrieves detailed information about a specific tag. Replace 'v1.0.0' with the actual tag name. ```bash bb tag get v1.0.0 ``` -------------------------------- ### Enable Debug Logging for Authentication Issues Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/README.md Enable debug logging to get more detailed information when troubleshooting authentication failures. ```bash bb --debug workspace list ``` -------------------------------- ### Get Repository Details Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/repository-commands.md Displays detailed information about a specific repository. Can optionally include a list of its forks. Supports specifying output columns. ```bash bb repo get myrepository ``` ```bash bb repo show myrepository --workspace myworkspace --forks ``` -------------------------------- ### Setting Output Format for Profile Commands Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/profile-commands.md These examples show how to specify the output format for Bitbucket CLI profile commands. Use the `--output` flag followed by the desired format like 'json' or 'yaml'. ```bash bb profile list --output json ``` ```bash bb profile get myprofile --output yaml ``` -------------------------------- ### Example Argument Error Messages Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/errors.md These messages indicate issues with command-line arguments or parameters, such as missing required arguments or invalid profile configurations. ```text Failed to execute command: profile: profile "myprofile" not found Failed to execute command: argument missing: name ``` -------------------------------- ### Set BITBUCKET_CLI_CACHE_DURATION Environment Variable Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/README.md Configure the cache Time-To-Live (TTL) using BITBUCKET_CLI_CACHE_DURATION. Example: '10m' for 10 minutes. ```bash export BITBUCKET_CLI_CACHE_DURATION=10m ``` -------------------------------- ### Get Workspace Details Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/workspace-project-commands.md Displays detailed information about a specific workspace. Can also list all members or details for a specific member. ```bash bb workspace get myworkspace ``` ```bash bb workspace get myworkspace --members ``` ```bash bb workspace get myworkspace --member username ``` -------------------------------- ### Get Tag Details (Show) Source: https://github.com/gildas/bitbucket-cli/blob/dev/README.md An alternative command to retrieve detailed information about a specific tag. Replace 'v1.0.0' with the actual tag name. ```bash bb tag show v1.0.0 ``` -------------------------------- ### Get Profile Information Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/profile-commands.md Display detailed information about a specific profile or the current active profile. Use --output to specify the desired format. ```bash bb profile get myprofile ``` ```bash bb profile get --current ``` ```bash bb profile show myprofile --output json ``` -------------------------------- ### project get / project show Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/workspace-project-commands.md Displays detailed information about a specific project. Allows selection of specific columns and output format. ```APIDOC ## project get / project show ### Description Display detailed information about a project. Allows selection of specific columns and output format. ### Method `bb project get ` or `bb project show ` ### Parameters #### Path Parameters * **project** (string) - Required - Project key or name #### Query Parameters * **--workspace** (string) - Optional - Workspace slug * **--columns** ([]string) - Optional - Columns to display * **--output, -o** (string) - Optional - Output format ### Request Example ```bash bb project get MYKEY --workspace myworkspace bb project show MYKEY ``` ### Response #### Success Response Detailed information for the specified project, with fields determined by the `--columns` parameter. #### Response Example (Output format dependent, e.g., JSON or table) ``` -------------------------------- ### Create New Project Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/workspace-project-commands.md Creates a new project with a specified name and key. Optionally set workspace, description, and privacy. Use --dry-run to preview. ```bash bb project create --name "My Project" --key MYKEY --workspace myworkspace ``` ```bash bb project create --name Private --key PRV --is-private true ``` -------------------------------- ### Get Commit Details (Show) Source: https://github.com/gildas/bitbucket-cli/blob/dev/README.md An alternative command to retrieve detailed information about a specific commit. Replace '123456' with the actual commit hash. ```bash bb commit show 123456 ``` -------------------------------- ### Clone Repository with SSH Protocol (Details) Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/repository-commands.md Clone a repository using the SSH protocol. This is recommended for automated workflows as it uses SSH keys for authentication and avoids password prompts after initial setup. ```bash bb repo clone myrepo --protocol ssh --ssh-key-file ~/.ssh/id_rsa ``` -------------------------------- ### Example API Error Messages Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/errors.md These messages are returned by the Bitbucket API and indicate issues such as malformed requests, insufficient permissions, or resource not found. ```text 400 Bad Request: Branch "master" not found 403 Forbidden: You do not have access to this repository 404 Not Found: Repository "myrepo" not found ``` -------------------------------- ### Get Pull Request Patch Source: https://github.com/gildas/bitbucket-cli/blob/dev/README.md Retrieve the patch file for a specific pull request by its ID. If no ID is provided, it gets the patch for the current branch's pull request. ```bash bb pullrequest patch 1 ``` -------------------------------- ### Create a New Project Source: https://github.com/gildas/bitbucket-cli/blob/dev/README.md Create a new project with a specified name and key. The key is typically an uppercase abbreviation. ```bash bb project create \ --name myproject \ --key MYPROJECT ``` -------------------------------- ### List Projects Source: https://github.com/gildas/bitbucket-cli/blob/dev/README.md Use this command to list all available projects. ```bash bb project list ``` -------------------------------- ### Set JSON output format for Bitbucket CLI Source: https://github.com/gildas/bitbucket-cli/blob/dev/README.md Use the --output flag or BB_OUTPUT_FORMAT environment variable to change the output format. This example sets it to JSON. ```bash bb --output json workspace list ``` ```bash bb workspace list --output json ``` ```bash export BB_OUTPUT_FORMAT=json bb workspace list ``` -------------------------------- ### Get Issue Comment Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/additional-commands.md Retrieves the details of a specific issue comment. ```APIDOC ## issue comment get / issue comment show ### Description Get comment details. ### Signature: ```bash bb issue comment get --issue [--repository ] [--workspace ] ``` ``` -------------------------------- ### Get Issue Comment Details Source: https://github.com/gildas/bitbucket-cli/blob/dev/README.md Retrieve the details of a specific comment on an issue. ```bash bb issue comment get --issue 1 7643545 ``` -------------------------------- ### Enable Zsh Completion Source: https://github.com/gildas/bitbucket-cli/blob/dev/README.md Source the completion script for the current Zsh session. To make it persistent, save the output to a file in your fpath directory or a specific location for macOS Homebrew installations. ```bash source <(bb completion zsh) ``` ```bash bb completion zsh > "~/${fpath[1]}/_bb" ``` ```bash bb completion zsh > "$(brew --prefix)/share/zsh/site-functions/_bb" ``` -------------------------------- ### Create Multiple Projects Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/workspace-project-commands.md Create several projects within a workspace and then list all projects to confirm. ```bash # Create backend project bb project create --name "Backend" --key BACK --workspace myworkspace # Create frontend project bb project create --name "Frontend" --key FRONT --workspace myworkspace # Create DevOps project bb project create --name "DevOps" --key DEVOPS --workspace myworkspace # List all projects bb project list --workspace myworkspace ``` -------------------------------- ### Bulk Repository Deletion Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/README.md Perform bulk operations like deleting multiple repositories efficiently. Use the `--warn-on-error` flag to get warnings instead of failing on individual errors. ```bash # Delete multiple repositories with warnings bb repo delete repo1 repo2 repo3 --warn-on-error ``` -------------------------------- ### General and Command Help Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/00_START_HERE.md Use these commands to access general help or specific command documentation within the Bitbucket CLI. This is useful for understanding available commands and their parameters. ```bash bb --help # General help ``` ```bash bb --help # Command help ``` ```bash bb --help # Subcommand help ``` -------------------------------- ### Get Current Profile Name Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/profile-commands.md Display the name of the current active profile. ```APIDOC ## GET / PROFILE / WHICH ### Description Display the name of the current active profile. ### Method GET ### Endpoint `bb profile which` ### Response #### Success Response (200) - **profile_name** (string) - The name of the profile currently in use ``` -------------------------------- ### List Repositories Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/00_START_HERE.md List all repositories within a specified workspace. ```bash # List repositories bb repo list --workspace myworkspace ``` -------------------------------- ### List Commits Source: https://github.com/gildas/bitbucket-cli/blob/dev/README.md Lists all commits in the repository. Use this to get an overview of the commit history. ```bash bb commit list ``` -------------------------------- ### Preview Repository Creation with Dry-Run Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/README.md Use the `--dry-run` flag to preview the changes that would occur when creating a new repository without actually creating it. ```bash # Preview repository creation bb repo create newrepo --dry-run ``` -------------------------------- ### Get Default Reviewer Details Source: https://github.com/gildas/bitbucket-cli/blob/dev/README.md Retrieve details for a specific default reviewer of a project. ```bash bb project reviewer get --project myproject userUUID ``` -------------------------------- ### Create Access Token Profile Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/README.md Use for repository, project, or workspace-scoped tokens. Configure with the access token directly. ```bash bb profile create --name repo-access \ --access-token YOUR_ACCESS_TOKEN ``` -------------------------------- ### Create a Bitbucket CLI profile with OAuth 2.0 Source: https://github.com/gildas/bitbucket-cli/blob/dev/README.md Use the 'bb profile create' command to set up a new profile, including default workspace, client ID, client secret, and callback port for OAuth 2.0. ```bash bb profile create \ --name myprofile \ --default-workspace myworkspace \ --client-id \ --client-secret \ --callback-port 8080 ``` -------------------------------- ### Get Pipeline Details Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/additional-commands.md Retrieves detailed information for a specific pipeline using its ID. ```bash bb pipeline get [--repository ] [--workspace ] [--columns ] [--output ] ``` -------------------------------- ### Create Profile with Access Token Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/profile-commands.md Use this command to create a profile with a repository, project, or workspace-scoped access token. This is useful for granting specific permissions. ```bash bb profile create \ --name token-profile \ --access-token ``` -------------------------------- ### Create Repository Source: https://github.com/gildas/bitbucket-cli/blob/dev/README.md Creates a new repository with a specified slug, name, project, and workspace. If the project is not specified, the default project of the profile is used. ```bash bb repo create myrepository_slug \ --name myrepository \ --project myproject \ --workspace myworkspace ``` -------------------------------- ### issue get / issue show Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/additional-commands.md Displays the details of a specific issue identified by its ID. ```APIDOC ## issue get / issue show ### Description Display issue details. ### Method Not applicable (CLI command) ### Endpoint Not applicable (CLI command) ### Parameters #### CLI Arguments - **issue-id** (string) - Required - The ID of the issue to retrieve - **--repository** (string) - Optional - Repository slug - **--workspace** (string) - Optional - Workspace slug - **--columns** ([]string) - Optional - Columns to display - **--output, -o** (string) - Optional - Output format ### Request Example ```bash bb issue get 123 ``` ### Response #### Success Response Detailed information about the specified issue. #### Response Example (Output varies based on parameters) ``` -------------------------------- ### Watch Issue Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/additional-commands.md Starts watching a specific issue using its ID to receive notifications. ```bash bb issue watch ``` -------------------------------- ### Create Repository Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/repository-commands.md Creates a new repository within a specified workspace and project. Allows configuration of name, description, privacy, issue tracking, wiki, and main branch. Includes a dry-run option for previewing. ```bash bb repo create myrepo --name "My Repository" --workspace myworkspace --is-private true ``` ```bash bb repo create myrepo --project MYKEY --description "My project repo" ``` ```bash bb repo create myrepo --main-branch main --has-issues true ``` -------------------------------- ### Create and Authorize Bitbucket CLI Profile Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/README.md Set up a new authentication profile for the Bitbucket CLI, providing your client ID, secret, and default workspace. Then, authorize the profile. ```bash # Create authentication profile bb profile create \ --name myprofile \ --client-id YOUR_CLIENT_ID \ --client-secret YOUR_CLIENT_SECRET \ --callback-port 8080 \ --default-workspace myworkspace \ --default # Authorize with Bitbucket bb profile authorize myprofile # Verify setup bb workspace list ``` -------------------------------- ### Get Pull Request Comment Details Source: https://github.com/gildas/bitbucket-cli/blob/dev/README.md Retrieve the details of a specific comment on a pull request. ```bash bb pullrequest comment get --pullrequest 1 452466 ``` -------------------------------- ### Create API Token Profile Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/README.md Recommended for personal scripts and automated deployments. Set up a profile using your email and an API token. ```bash bb profile create --name automation \ --user your-email@example.com \ --password YOUR_API_TOKEN ``` -------------------------------- ### Get Pull Request Details Source: https://github.com/gildas/bitbucket-cli/blob/dev/README.md Retrieve detailed information for a specific pull request by its ID. ```bash bb pullrequest get 1 ``` -------------------------------- ### Get User Details Source: https://github.com/gildas/bitbucket-cli/blob/dev/README.md Retrieve information about the currently authenticated user or a specific user by their UUID. ```bash bb user me ``` ```bash bb user get {UUID} ``` ```bash bb user get UUID ``` -------------------------------- ### Get Pipeline Step Logs Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/additional-commands.md Fetches the execution logs for a specific step within a pipeline. ```bash bb pipeline step log --pipeline [--repository ] [--workspace ] ``` -------------------------------- ### project create Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/workspace-project-commands.md Creates a new project within a workspace. Requires a name and key, with options for description, privacy, and dry-run preview. ```APIDOC ## project create ### Description Create a new project in a workspace. Requires a name and key, with options for description, privacy, and dry-run preview. ### Method `bb project create` ### Parameters #### Path Parameters None #### Query Parameters * **--name** (string) - Required - Project display name * **--key** (string) - Required - Project unique key (2-10 chars, uppercase) * **--workspace** (string) - Optional - Workspace slug * **--description** (string) - Optional - Project description * **--is-private** (bool) - Optional - Make project private * **--dry-run** (bool) - Optional - Preview without creating * **--output, -o** (string) - Optional - Output format ### Request Example ```bash bb project create --name "My Project" --key MYKEY --workspace myworkspace bb project create --name Private --key PRV --is-private true ``` ### Response #### Success Response Information about the newly created project. #### Response Example (Output format dependent, e.g., JSON or table) ``` -------------------------------- ### List Repositories to CSV File Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/README.md Retrieve a list of repositories and redirect the output to a CSV file for easy import into spreadsheets. ```bash bb repo list --output csv > repos.csv ``` -------------------------------- ### Get Commit as Patch Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/additional-commands.md Fetches a commit's changes as a patch file, which can be redirected to a file. ```bash bb commit patch abc1234 > patch.diff ``` -------------------------------- ### pr get / pr show Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/pullrequest-commands.md Displays detailed information about a specific pull request by its ID. ```APIDOC ## pr get / pr show ### Description Display detailed information about a specific pull request. ### Method GET ### Endpoint /pullrequests/{pr-id} ### Parameters #### Path Parameters - **pr-id** (int) - Required - Pull request ID #### Query Parameters - **repository** (string) - Optional - Repository slug - **workspace** (string) - Optional - Workspace slug - **columns** ([]string) - Optional - Columns to display - **output** (string) - Optional - Output format ### Request Example ```bash bb pr get 42 bb pr show 42 --repository myrepo ``` ``` -------------------------------- ### Bulk Delete Repositories Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/repository-commands.md Demonstrates bulk deletion of repositories. First, list repository slugs and save them to a file. Then, use the file content to delete multiple repositories. Alternatively, use batch processing with error handling for a list of repositories. ```bash # List repositories as input bb repo list --workspace myworkspace --output json | jq -r '.[].slug' > repos.txt # Delete multiple repositories bb repo delete $(cat repos.txt | tr '\n' ' ') # Or use batch processing with error handling bb repo delete repo1 repo2 repo3 --warn-on-error ``` -------------------------------- ### Get Profile Information Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/profile-commands.md Display detailed information about a specific profile or the current active profile. ```APIDOC ## GET / PROFILE / SHOW ### Description Display detailed information about a specific profile. ### Method GET ### Endpoint `bb profile get ` or `bb profile show ` `bb profile get --current` ### Parameters #### Path Parameters - **profile-name** (string) - Optional - Name of profile to retrieve #### Query Parameters - **--current** (boolean) - Optional - Show current active profile instead - **--columns** (list of strings) - Optional - Comma-separated column names to display - **--output, -o** (string) - Optional - Output format (json, yaml, table, csv, tsv) ### Request Example ```bash bb profile get myprofile bb profile get --current bb profile show myprofile --output json ``` ### Response #### Success Response (200) - **profile details** (object) - Detailed information about the profile ``` -------------------------------- ### Dry-Run Repository Creation Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/repository-commands.md Preview the creation of a new repository without actually creating it by using the --dry-run flag. ```bash bb repo create newrepo --dry-run # Shows what would be created ``` -------------------------------- ### commit get / commit show Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/additional-commands.md Retrieves detailed information about a specific commit. Requires a commit hash. ```APIDOC ## commit get / commit show ### Description Gets commit details. ### Method CLI Command ### Endpoint N/A (CLI Command) ### Parameters #### Path Parameters - **commit-hash** (string) - Required - The hash of the commit to retrieve. Can be the full hash or the first 7+ characters. #### Query Parameters - **--repository** (repo) - Optional - The repository containing the commit. - **--workspace** (workspace) - Optional - The workspace containing the repository. - **--columns** (list) - Optional - Specify which columns to display. - **--output** (format) - Optional - The output format. ``` -------------------------------- ### workspace permission get Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/workspace-project-commands.md Retrieves the current user's permission level within a specified workspace. ```APIDOC ## workspace permission get ### Description Retrieves the current user's permission level within a specified workspace. ### Method ```bash bb workspace permission get ``` ### Parameters #### Path Parameters - **workspace** (string) - Required - Workspace slug #### Query Parameters - **--output, -o** (string) - Optional - Output format ### Returns - admin - collaborator - member ### Request Example ```bash bb workspace permission get myworkspace ``` ``` -------------------------------- ### List Configured Bitbucket Profiles Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/profile-commands.md List all configured authentication profiles. You can customize the output by specifying columns to display, sorting criteria, and the output format (e.g., json, table). ```bash bb profile list --columns name,user,default ``` ```bash bb profile list --output json ``` ```bash bb profile list --sort name --columns all ``` -------------------------------- ### Get Workspace Permission Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/workspace-project-commands.md Retrieves the current user's permission level within a specified workspace. ```bash bb workspace permission get myworkspace ``` -------------------------------- ### List Workspaces Source: https://github.com/gildas/bitbucket-cli/blob/dev/README.md Display a list of available workspaces, optionally including membership details. ```bash bb workspace list ``` ```bash bb workspace list --membership ``` -------------------------------- ### Create Private Repository Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/repository-commands.md Create a new private repository with issues enabled. Specify the workspace, project key, and a descriptive name. ```bash bb repo create newrepo \ --workspace myworkspace \ --project MYKEY \ --name "Private Project Repo" \ --is-private true \ --has-issues true ``` -------------------------------- ### List Repositories in JSON Format Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/repository-commands.md Output repository list in JSON format for scripting purposes, piping the output to jq for further processing. ```bash bb repo list --output json | jq '.[] | .slug' ``` -------------------------------- ### Get Specific Pull Request Comment Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/pullrequest-commands.md Retrieves details of a specific comment on a pull request using its ID. ```APIDOC ## pr comment get / pr comment show ### Description Get a specific comment. ### Method `bb pr comment get --pullrequest [--repository ] [--workspace ] [--output ]` ### Parameters #### Path Parameters - **--pullrequest** (int) - Required - Pull request ID - **comment-id** (int) - Required - The ID of the comment to retrieve #### Query Parameters - **--repository** (string) - Optional - Repository slug - **--workspace** (string) - Optional - Workspace slug - **--output** (format) - Optional - Output format (e.g., json, tsv) ### Request Example ```bash bb pr comment get --pullrequest 42 452466 ``` ``` -------------------------------- ### Get Specific Pull Request Comment Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/pullrequest-commands.md Fetches details of a single comment on a pull request using its ID. ```bash bb pr comment get --pullrequest 42 452466 ``` -------------------------------- ### List Repository Forks Source: https://github.com/gildas/bitbucket-cli/blob/dev/README.md Lists all forks of a given repository. ```bash bb repo get myrepository --forks ``` -------------------------------- ### Get Pull Request Patch Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/pullrequest-commands.md Retrieves the patch file for a specified pull request. The output can be directed to a file. ```bash bb pr patch 42 ``` ```bash bb pr patch 42 --output-file pr-42.patch ``` -------------------------------- ### List Available Bitbucket CLI Profiles Source: https://github.com/gildas/bitbucket-cli/blob/dev/README.md Retrieves a list of all configured Bitbucket CLI profiles. ```bash bb profile list ``` -------------------------------- ### List Artifacts Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/additional-commands.md Lists build artifacts in a repository. Specify columns and sorting for customized output. ```bash bb artifact list [--repository ] [--workspace ] [--columns ] [--sort ] [--output ] ``` -------------------------------- ### Enable Logging with --log flag Source: https://github.com/gildas/bitbucket-cli/blob/dev/README.md Instruct the Bitbucket CLI to log its activity to a specified file using the --log flag. This is useful for debugging issues. ```bash bb --log tmp/bb.log workspace list ``` -------------------------------- ### Example Pull Request Error Messages Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/errors.md Illustrates common error messages related to pull request operations. ```text Pull request #42 is already merged Cannot approve your own pull request ``` -------------------------------- ### Configure Logging via .env file Source: https://github.com/gildas/bitbucket-cli/blob/dev/README.md Set logging destination and level by creating a .env file in the current directory. The Bitbucket CLI will automatically load these environment variables. ```bash LOG_DESTINATION=tmp/bb.log LOG_LEVEL=DEBUG ``` -------------------------------- ### Fork Repository and Rename Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/repository-commands.md Fork an existing repository to your workspace and provide a new name and description for the fork. ```bash bb repo fork upstream-repo \ --target-workspace myworkspace \ --name upstream-my-fork \ --description "My fork of upstream repository" ``` -------------------------------- ### Get Commit Diffstat Source: https://github.com/gildas/bitbucket-cli/blob/dev/README.md Displays the diffstat (summary of changes) for a given commit. Replace '123456' with the actual commit hash. ```bash bb commit diff --stat 123456 ``` -------------------------------- ### Get Difference Between Commit and Parent Source: https://github.com/gildas/bitbucket-cli/blob/dev/README.md Shows the differences between a specified commit and its parent. Replace '123456' with the actual commit hash. ```bash bb commit diff 123456 ``` -------------------------------- ### List Repositories Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/repository-commands.md Lists repositories accessible to the current user. Supports filtering by workspace, role, project, privacy settings, and more. Can specify output columns and sorting. ```bash bb repo list --workspace myworkspace ``` ```bash bb repo list --role owner --is-private false ``` ```bash bb repo list --project MYKEY --output json ``` ```bash bb repo list --query 'has_public_links=true' ``` -------------------------------- ### List Artifacts Source: https://github.com/gildas/bitbucket-cli/blob/dev/README.md Lists artifacts for the current repository. Use the --repository flag to specify a different repository. ```bash bb artifact list ``` -------------------------------- ### Get Current User Profile Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/additional-commands.md Retrieves the profile information for the currently authenticated user. Supports JSON output format. ```bash bb user me ``` ```bash bb user me --output json ``` -------------------------------- ### Create Profile with API Token Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/profile-commands.md Recommended for personal use and deployments, this command creates a profile using your email and an API token. Ensure the API token is kept secure. ```bash bb profile create \ --name api-profile \ --user your-email@example.com \ --password ``` -------------------------------- ### Bitbucket CLI Project File Structure Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/INDEX.md This snippet outlines the directory and file structure of the Bitbucket CLI project. It helps in understanding the organization of documentation and code. ```bash output/ ├── README.md # Main overview & quick start ├── INDEX.md # This file ├── configuration.md # Configuration reference ├── errors.md # Error reference └── api-reference/ ├── types.md # Type definitions ├── profile-commands.md # Profile management ├── repository-commands.md # Repository operations ├── pullrequest-commands.md # Pull request management ├── workspace-project-commands.md # Workspace & project ops └── additional-commands.md # Issues, branches, commits, etc. ``` -------------------------------- ### Example Authentication Error Messages Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/errors.md These messages highlight problems with authentication, including expired or revoked tokens, and invalid credentials. ```text 401 Unauthorized: Invalid API token or password Invalid credentials for user 'myuser' ``` -------------------------------- ### Trigger Pipeline Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/additional-commands.md Starts a new pipeline build. Can be triggered by branch, tag, commit, or pattern, and supports environment variables. ```bash bb pipeline trigger [--repository ] [--workspace ] [--branch ] [--tag ] [--commit ] [--pattern ] [--variable ] [--output ] ``` ```bash bb pipeline trigger --branch main --variable DEBUG=true ``` -------------------------------- ### Override Clone Protocol via Command Line Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/configuration.md Demonstrates how to override the default clone protocol and SSH key file using command-line arguments. ```bash bb repo clone myrepo --protocol https --user myusername bb repo clone myrepo --protocol ssh --ssh-key-file ~/.ssh/custom_key ``` -------------------------------- ### Create a New Bitbucket Profile Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/profile-commands.md Use this command to create a new authentication profile. It supports OAuth2 or API token authentication and allows setting various parameters like name, workspace, and client credentials. The `--default` flag makes it the active profile. ```bash bb profile create \ --name myprofile \ --default-workspace myworkspace \ --client-id xxxxxxxx \ --client-secret xxxxxxxx \ --callback-port 8080 \ --default ``` -------------------------------- ### Get Difference Between Two Commits Source: https://github.com/gildas/bitbucket-cli/blob/dev/README.md Shows the differences between two specified commits. Replace '123456' and '654321' with actual commit hashes. ```bash bb commit diff 123456 654321 ``` -------------------------------- ### Get Pipeline Step Details Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/additional-commands.md Retrieves detailed information for a specific step within a pipeline, using both pipeline and step IDs. ```bash bb pipeline step get --pipeline [--repository ] [--workspace ] [--columns ] [--output ] ``` -------------------------------- ### List Repositories in TSV Format Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/README.md Retrieve a list of repositories and format the output as TSV (tab-separated values) for text processing. ```bash bb repo list --output tsv ``` -------------------------------- ### Get GPG Key Details Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/additional-commands.md Retrieves the details of a specific GPG key using its fingerprint. The user context can also be specified. ```bash bb gpg-key get [--user ] [--columns ] [--output ] ``` -------------------------------- ### Get SSH Key Details Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/additional-commands.md Retrieves the details of a specific SSH key using its fingerprint. The user context can also be specified. ```bash bb ssh-key get [--user ] [--columns ] [--output ] ``` -------------------------------- ### Fork Repository Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/repository-commands.md Create a fork of an existing repository. Specify target workspace, name, project, and privacy settings. Use --dry-run to preview. ```bash bb repo fork upstream-repo ``` ```bash bb repo fork upstream-repo --target-workspace myworkspace --name my-fork ``` ```bash bb repo fork upstream-repo --workspace upstream-ws --target-workspace myworkspace ``` -------------------------------- ### Get Commit Details Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/additional-commands.md Retrieves detailed information for a specific commit using its hash. The hash can be full or a minimum of 7 characters. ```bash bb commit get [--repository ] [--workspace ] [--columns ] [--output ] ``` -------------------------------- ### List Branches Source: https://github.com/gildas/bitbucket-cli/blob/dev/README.md Lists all branches for the current repository. ```bash bb branch list ``` -------------------------------- ### Get Pull Request Patch Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/pullrequest-commands.md Retrieves the patch file for a specific pull request. Allows specifying an output file path. ```APIDOC ## pr patch ### Description Get patch file of a pull request. ### Method `bb pr patch [] [--repository ] [--workspace ] [--output-file ]` ### Parameters #### Path Parameters - **pr-id** (int) - Optional - Pull request ID #### Query Parameters - **--output-file** (string) - Optional - Path to save the patch file - **--repository** (string) - Optional - Repository slug - **--workspace** (string) - Optional - Workspace slug ### Request Example ```bash bb pr patch 42 bb pr patch 42 --output-file pr-42.patch ``` ``` -------------------------------- ### List Public Repositories Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/repository-commands.md Use this command to list all public repositories within a specified workspace. Ensure the --is-private flag is set to false. ```bash bb repo list --workspace myworkspace --is-private false ``` -------------------------------- ### Enable Logging with LOG_DESTINATION Source: https://github.com/gildas/bitbucket-cli/blob/dev/README.md Configure logging for the Bitbucket CLI by setting the LOG_DESTINATION environment variable. This directs logs to the specified file path. ```bash LOG_DESTINATION=tmp/bb.log bb workspace list ``` -------------------------------- ### Verbose Output Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/errors.md Use the --verbose flag to get more detailed output from commands, which can be helpful for understanding command execution flow. ```bash bb --verbose workspace list ``` -------------------------------- ### Delete Repositories with Warn on Error Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/README.md Delete multiple repositories, printing a warning for each error encountered but continuing the operation. ```bash # Delete multiple repos, warn on errors bb repo delete repo1 repo2 repo3 --warn-on-error ``` -------------------------------- ### List Pipelines Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/additional-commands.md Lists pipeline builds in a repository. Supports filtering by limit, columns, and sorting. ```bash bb pipeline list [--repository ] [--workspace ] [--limit ] [--columns ] [--sort ] [--output ] ``` -------------------------------- ### Specify Workspace and Repository with Bitbucket CLI Source: https://github.com/gildas/bitbucket-cli/blob/dev/README.md Commands can target specific workspaces and repositories using the `--workspace` and `--repository` flags. The repository can also be specified in the format `workspace/repository`. ```bash bb repo list --workspace myworkspace ``` ```bash bb pullrequest list --repository myrepository ``` ```bash bb pullrequest list --workspace myworkspace --repository myrepository ``` ```bash bb pullrequest list --repository myworkspace/myrepository ``` -------------------------------- ### tag get / tag show Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/additional-commands.md Retrieves details for a specific tag in a repository. Allows filtering by repository, workspace, columns, and output format. ```APIDOC ## tag get / tag show ### Description Retrieves details for a specific tag in a repository. Allows filtering by repository, workspace, columns, and output format. ### Signature ```bash bb tag get [--repository ] [--workspace ] [--columns ] [--output ] ``` ### Parameters #### Path Parameters - **tag-name** (string) - Required - The name of the tag to retrieve #### Query Parameters - **--repository** (string) - Optional - Repository slug - **--workspace** (string) - Optional - Workspace slug - **--columns** ([]string) - Optional - Columns to display - **--output** (string) - Optional - Output format ``` -------------------------------- ### Get Issue Details Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/README.md Retrieve detailed information about a specific issue by its ID. This provides a comprehensive view of the issue's status and history. ```bash # Get issue details bb issue get 1 ``` -------------------------------- ### Preview Repository Deletion with Bitbucket CLI Source: https://github.com/gildas/bitbucket-cli/blob/dev/README.md Use the `--dry-run` flag to preview changes before applying them. This is useful for destructive commands like delete. ```bash bb repo delete myrepository3 --dry-run ``` -------------------------------- ### Get Project Reviewer Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/workspace-project-commands.md Retrieves details for a specific default reviewer of a project. You can specify the user by their ID (UUID or username) and customize output. ```APIDOC ## project reviewer get / project reviewer show ### Description Get details of a default reviewer. ### Method `bb project reviewer get []` or `bb project reviewer show []` ### Parameters #### Path Parameters - **user-id** (string) - Required - User UUID or username #### Query Parameters - **--workspace** (string) - Optional - Workspace slug - **--project** (string) - Optional - Project key - **--columns** ([]string) - Optional - Columns to display - **--output, -o** (string) - Optional - Output format ### Request Example ```bash bb project reviewer get {user-uuid} bb project reviewer show myusername ``` ### Response #### Success Response Details of the specified default reviewer. #### Response Example (Example depends on output format and columns specified) ``` -------------------------------- ### List GPG Keys Source: https://github.com/gildas/bitbucket-cli/blob/dev/README.md Lists GPG keys for the current user. Use the --user flag to specify a different user. ```bash bb gpg-key list ``` -------------------------------- ### Create Issue Source: https://github.com/gildas/bitbucket-cli/blob/dev/README.md Create a new issue with a title and content. ```bash bb issue create \ --title "My issue" \ --content "My issue content" ``` -------------------------------- ### List Projects in Workspace Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/workspace-project-commands.md Lists projects within a specified workspace. Supports custom columns and output formats. ```bash bb project list --workspace myworkspace ``` ```bash bb project list --output json ``` -------------------------------- ### Create Profile with OAuth2 Client Credentials Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/profile-commands.md This command is for creating profiles for CI/CD or server-to-server authentication where no user interaction is needed. It uses client ID and secret for authentication. ```bash bb profile create \ --name ci-profile \ --client-id \ --client-secret ``` -------------------------------- ### Get Patch Between Two Commits Source: https://github.com/gildas/bitbucket-cli/blob/dev/README.md Generates the patch (diff in patch format) between two specified commits. Replace '123456' and '654321' with actual commit hashes. ```bash bb commit patch 123456 654321 ``` -------------------------------- ### Get/Show Repository Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/repository-commands.md Displays detailed information about a specific repository, optionally including its forks. ```APIDOC ## repo get / repo show ### Description Display detailed information about a specific repository. ### Signature ```bash bb repo get [--workspace ] [--columns ] [--forks] [--output ] bb repo show [--workspace ] [--columns ] [--forks] [--output ] ``` ### Parameters #### Path Parameters - **repository** (string) - Required - Repository name or slug #### Query Parameters - **--workspace** (string) - Optional - Workspace slug - **--columns** ([]string) - Optional - Columns to display - **--forks** (bool) - Optional - Show list of forks of this repository - **--output** (string) - Optional - Output format ### Example ```bash bb repo get myrepository bb repo show myrepository --workspace myworkspace --forks ``` ``` -------------------------------- ### Get Specific User Details Source: https://github.com/gildas/bitbucket-cli/blob/dev/_autodocs/api-reference/additional-commands.md Fetches detailed information about a specific user identified by their UUID or username. Supports custom column selection and output formatting. ```bash bb user get ```