Kanban Bitbucket¶
Worktrees and pull requests for the Kanban board, with issues provided by Jira, GitHub, or GitLab.
This plugin is hooks-only. It contributes no agent tools and does not fetch issues.
What it does¶
kanban.run.preparecreates a git worktree and apegg/<slug>branch for a card run.kanban.card.succeededopens a pull request from that branch into the card's base branch.
Bitbucket Cloud Issues was removed, and Bitbucket Data Center has no built-in issue tracker, so this plugin does not sync issues. Pair it with Kanban Jira, Kanban GitHub, or Kanban GitLab.
Install¶
Jira → Bitbucket flow¶
kanban-jiraimports issues into the board.- A card run starts.
kanban-bitbucketcreates.pegg-worktrees/<slug>on branchpegg/<slug>. - The agent commits to that branch.
kanban.card.succeededopens the pull request in Bitbucket.
The card's issue provider can be Jira, GitHub, or GitLab. The plugin does not require
card.issue.provider == "bitbucket".
Change-request routing¶
Kanban resolves a change_request_provider per card and passes it in the
kanban.run.prepare and kanban.card.succeeded payloads. This plugin handles both hooks
only when that value is bitbucket (or, for older Kanban versions that omit the field,
whenever a change request is requested).
This plugin contributes the default route {"jira": "bitbucket"} through the
kanban.change_request.routes filter, so Jira issues open Bitbucket pull requests out of
the box. The route is driven by the issue_providers setting (default ["jira"]). Set it
to [] to stop Bitbucket from handling Jira issues, or add other providers:
User config in the Kanban change_request_providers map always wins over this default, so
you can also route Jira to another host by setting {"jira": "gitlab"} there.
Hooks¶
| Hook | Kind | Priority | Purpose |
|---|---|---|---|
kanban.run.prepare |
filter | 10 | Create a worktree with a pegg/<slug> branch. |
kanban.card.succeeded |
action | 10 | Open a Bitbucket pull request. |
kanban.change_request.routes |
filter | 10 | Route issues from issue_providers to Bitbucket pull requests. |
Both hooks are no-ops when the plugin is disabled.
kanban.run.prepare reads the repository from repo, creates a worktree under
worktree_root (default .pegg-worktrees), and returns a context:
{
"kind": "worktree",
"path": "/repo/.pegg-worktrees/fix-login-abc12345",
"branch": "pegg/fix-login-abc12345",
"base": "main",
"label": "fix-login-abc12345"
}
kanban.card.succeeded reads the branch from context.branch and the destination from
context.base, then base_branch, then default_base, then the repository default
branch.
Configuration¶
Bitbucket Cloud¶
{
"plugins": {
"options": {
"kanban-bitbucket": {
"enabled": true,
"kind": "cloud",
"workspace": "acme",
"repo": "widgets",
"email": "[email protected]",
"api_token": "ATBB...",
"default_base": "main",
"worktree_root": ".pegg-worktrees",
"issue_providers": ["jira"],
"request_timeout_seconds": 30
}
}
}
}
Bitbucket Data Center¶
{
"plugins": {
"options": {
"kanban-bitbucket": {
"enabled": true,
"kind": "datacenter",
"base_url": "https://bitbucket.example.com",
"project": "PROJ",
"repo": "widgets",
"token": "http-access-token",
"default_base": "main"
}
}
}
}
kind also accepts server and dc. The option keys pegg-kanban-bitbucket,
bitbucket, and pegg-bitbucket are fallbacks.
Environment¶
| Variable | Purpose |
|---|---|
PEGG_BITBUCKET_ENABLED |
Set false to disable. |
PEGG_BITBUCKET_KIND |
cloud or datacenter. |
PEGG_BITBUCKET_URL |
API base URL. |
PEGG_BITBUCKET_WORKSPACE |
Cloud workspace. |
PEGG_BITBUCKET_PROJECT |
Data Center project key. |
PEGG_BITBUCKET_REPO |
Repository slug. |
PEGG_BITBUCKET_EMAIL |
Cloud email. |
PEGG_BITBUCKET_API_TOKEN |
Cloud API token. |
PEGG_BITBUCKET_ACCESS_TOKEN |
Cloud bearer token. |
PEGG_BITBUCKET_USERNAME / PEGG_BITBUCKET_PASSWORD |
Data Center basic auth. |
PEGG_BITBUCKET_TOKEN |
Data Center HTTP access token. |
PEGG_BITBUCKET_DEFAULT_BASE |
Default destination branch. |
PEGG_BITBUCKET_ISSUE_PROVIDERS |
JSON array or comma-separated issue providers routed to Bitbucket (default jira). |
PEGG_BITBUCKET_WORKTREE_ROOT |
Worktree directory. |
PEGG_BITBUCKET_TIMEOUT_SECONDS |
API timeout. |
Authentication¶
Bitbucket Cloud uses an API token with your Atlassian email, sent as HTTP Basic, or an
access_token sent as Bearer. App passwords are deprecated.
Bitbucket Data Center uses an HTTP access token (token, Bearer) or
username + password basic auth.
Missing credentials produce an actionable error naming the setting and environment variable. Tokens and passwords are redacted from hook errors.
Notes¶
- Worktrees are created by this plugin, not by Kanban core.
- Duplicate pull requests produce an error instead of a second PR.
- Bitbucket remotes in the document worktree are used to infer the workspace/project and repository when not configured.