bitbucket-helper

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Bitbucket Helper

Bitbucket 助手

Auto-detects Bitbucket Cloud or Server from configured git remote.
The helper script lives at
scripts/bitbucket_server_pr.py
relative to this skill's directory (the harness resolves it). Run it from the user's repo with the script's absolute or skill-relative path:
bash
python3 <skill-dir>/scripts/bitbucket_server_pr.py
从已配置的 git remote 自动检测 Bitbucket Cloud 或 Server。
辅助脚本位于
scripts/bitbucket_server_pr.py
(相对于此 skill 的目录,由 harness 解析)。使用脚本的绝对路径或相对于 skill 的路径,在用户的 repo 中运行:
bash
python3 <skill-dir>/scripts/bitbucket_server_pr.py

Steps

步骤

  1. Run helper with no args to detect type and PR context. Done when source, target, project, repo known.
  2. PR body needed: use
    /pr-writing
    first. Done when body has Description, Test Plan, Test Result, Links.
  3. Before live create/update/approve: confirm unless user explicitly asked.
  4. For review: start with
    review-context
    , then targeted
    diff --path
    or
    file
    .
  5. For updates: read PR version first, send only mutable fields (title, description, version, fromRef, toRef, reviewers). Never send
    author
    .
Completion: operation scoped to detected repo and PR, mutations authorized.
  1. 无参数运行 helper,以检测类型和 PR context。完成条件:已知 source、target、project 和 repo。
  2. 需要 PR body 时:先使用
    /pr-writing
    。完成条件:body 包含 Description、Test Plan、Test Result 和 Links。
  3. 实际执行 create/update/approve 前:除非用户已明确要求,否则先确认。
  4. 进行 review 时:先运行
    review-context
    ,然后有针对性地运行
    diff --path
    或
    file
    。
  5. 进行 update 时:先读取 PR version,仅发送可变字段(title、description、version、fromRef、toRef、reviewers)。绝不发送
    author
    。
完成条件:操作范围限定于检测到的 repo 和 PR,且变更操作已获授权。

Commands

命令

bash
undefined
bash
undefined

Read

Read

list --repo-dir . [--state OPEN] [--limit 25] [--page-start 0] get <pr_id> --repo-dir . [--body] review-context <pr_id> --repo-dir . files <pr_id> --repo-dir . diff <pr_id> --repo-dir . --path <path> file <path> --repo-dir . --at refs/heads/main commits <pr_id> --repo-dir . commit <sha> --repo-dir .
list --repo-dir . [--state OPEN] [--limit 25] [--page-start 0] get <pr_id> --repo-dir . [--body] review-context <pr_id> --repo-dir . files <pr_id> --repo-dir . diff <pr_id> --repo-dir . --path <path> file <path> --repo-dir . --at refs/heads/main commits <pr_id> --repo-dir . commit <sha> --repo-dir .

Mutate

Mutate

approve <pr_id> --repo-dir . create --repo-dir . --target main --title "PROJ-123: title" [--draft] update <pr_id> --repo-dir . [--refresh-description | --ready]

Flags: `--full`, `--body`, `--format text`, `--cloud`, `--base-url`.
approve <pr_id> --repo-dir . create --repo-dir . --target main --title "PROJ-123: title" [--draft] update <pr_id> --repo-dir . [--refresh-description | --ready]

参数:`--full`、`--body`、`--format text`、`--cloud`、`--base-url`。

Auth

身份认证

BB_USER
/
BB_PASSWORD
or scoped:
BB_CLOUD_*
/
BB_SERVER_*
(scoped win). Cloud: App Password with Repositories and Pull Requests Read/Write.
SSH clone remotes are supported for repo detection. SSH keys authenticate Git transport only; REST API calls still need Bitbucket user/token credentials.
使用
BB_USER
/
BB_PASSWORD
,或使用限定范围的凭据:
BB_CLOUD_*
/
BB_SERVER_*
(限定范围的凭据优先)。Cloud:使用具有 Repositories 和 Pull Requests Read/Write 权限的 App Password。
检测 repo 时支持 SSH clone remote。SSH key 仅用于 Git transport 身份认证;REST API 调用仍需要 Bitbucket user/token 凭据。

Detection

检测

RemoteType
bitbucket.org
in URL
Cloud
host/scm/
or
host/projects/
Server
Override:
--cloud
or
--base-url
.
Remote类型
URL 中包含
bitbucket.org
Cloud
host/scm/
或
host/projects/
Server
覆盖方式:
--cloud
或
--base-url
。