bitbucket-agent 0.0.0-stage → 1.3.0

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/README.md CHANGED
@@ -1,3 +1,10 @@
1
- # Temporary Holding Version
1
+ # bitbucket-agent
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Bitbucket for AI coding agents. It runs `bitbucket mcp` from PATH, so install the `bitbucket` CLI first (https://github.com/ejklock/bitbucket-cli).
4
+
5
+ - OpenCode: gives the `bitbucket` MCP server and the `bitbucket` skill. Add `"plugin": ["bitbucket-agent"]` to `opencode.json`. An existing `mcp.bitbucket` entry of yours is kept as written.
6
+ - Pi: gives the `bitbucket` skill. Run `pi install npm:bitbucket-agent`.
7
+
8
+ The skill tells the agent to prefer the MCP tools `bitbucket_read` and `bitbucket_write`, and otherwise to run the CLI with `--output json`.
9
+
10
+ MIT license.
package/index.ts ADDED
@@ -0,0 +1,31 @@
1
+ import { fileURLToPath } from "node:url"
2
+
3
+ type McpEntry = { type: "local"; command: string[] } & Record<string, unknown>
4
+ type OpencodeConfig = {
5
+ mcp?: unknown
6
+ skills?: unknown
7
+ }
8
+
9
+ const skillsDir = fileURLToPath(new URL("./skills", import.meta.url))
10
+
11
+ const isRecord = (value: unknown): value is Record<string, unknown> =>
12
+ typeof value === "object" && value !== null && !Array.isArray(value)
13
+
14
+ const defaultEntry: McpEntry = { type: "local", command: ["bitbucket", "mcp"] }
15
+
16
+ // OpenCode can register an MCP server and a skills directory only by mutating
17
+ // the merged config in the `config` hook. A user's own `bitbucket` entry wins
18
+ // over the default, and the skills directory is listed once however often the
19
+ // hook runs. A value of the wrong type is the user's to fix: it is left as
20
+ // written rather than overwritten.
21
+ export const server = async () => ({
22
+ config: async (config: OpencodeConfig): Promise<void> => {
23
+ if (config.mcp === undefined) config.mcp = {}
24
+ if (isRecord(config.mcp) && !("bitbucket" in config.mcp)) config.mcp.bitbucket = { ...defaultEntry }
25
+
26
+ if (config.skills === undefined) config.skills = {}
27
+ if (!isRecord(config.skills)) return
28
+ if (config.skills.paths === undefined) config.skills.paths = []
29
+ if (Array.isArray(config.skills.paths) && !config.skills.paths.includes(skillsDir)) config.skills.paths.push(skillsDir)
30
+ },
31
+ })
package/package.json CHANGED
@@ -1,6 +1,21 @@
1
1
  {
2
2
  "name": "bitbucket-agent",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.3.0",
4
+ "description": "Bitbucket for AI coding agents: gives OpenCode the bitbucket MCP server and the bitbucket skill, and Pi the bitbucket skill",
5
+ "license": "MIT",
6
+ "author": "Evaldo Klock",
7
+ "repository": { "type": "git", "url": "git+https://github.com/ejklock/bitbucket-cli.git", "directory": "packages/bitbucket-agent" },
8
+ "homepage": "https://github.com/ejklock/bitbucket-cli",
9
+ "type": "module",
10
+ "main": "./index.ts",
11
+ "exports": {
12
+ ".": "./index.ts",
13
+ "./server": "./index.ts"
14
+ },
15
+ "keywords": ["pi-package", "opencode", "opencode-plugin", "bitbucket", "mcp", "model-context-protocol", "ai-agent", "skill", "pull-requests", "pipelines"],
16
+ "pi": { "skills": ["skills"] },
17
+ "scripts": {
18
+ "test": "node --test"
19
+ },
20
+ "files": ["index.ts", "skills", "README.md"]
21
+ }
@@ -0,0 +1,25 @@
1
+ ---
2
+ name: bitbucket
3
+ description: Work with Bitbucket Cloud pull requests, comments, pipelines and repositories through the bitbucket CLI. Load when the user asks to list, read, review, create, comment on, approve, merge or decline a Bitbucket pull request, or to inspect or trigger a pipeline.
4
+ ---
5
+
6
+ # Bitbucket
7
+
8
+ The binary is `bitbucket`. It must be on PATH and logged in (`bitbucket auth`).
9
+
10
+ ## Prefer the MCP tools
11
+
12
+ When the `bitbucket` MCP server is connected, use its tools instead of the shell. Both accept the optional arguments `profile` and `workspace`.
13
+
14
+ - `bitbucket_read`, operations: pr_list, pr_view, pr_diff, pr_diffstat, pr_commits, pr_statuses, pr_activity, pr_list_comments, pr_view_comment, pr_pipelines, pipeline_list, pipeline_view, repo_list, repo_view.
15
+ - `bitbucket_write`, operations: pr_create, pr_edit, pr_comment, pr_approve, pr_unapprove, pr_request_changes, pr_merge, pr_decline, pipeline_trigger, pipeline_stop, pipeline_rerun.
16
+
17
+ ## Otherwise use the CLI
18
+
19
+ Run the same commands in the shell with `--output json` so the result parses: `bitbucket pr list --output json`. Run `bitbucket --help` and `bitbucket <command> --help` for the exact arguments.
20
+
21
+ ## Conventions
22
+
23
+ - A repository is `workspace/repo-slug`.
24
+ - Pick an account with `--profile <name>` or the BITBUCKET_PROFILE environment variable.
25
+ - Read freely. Write operations (merge, decline, comment, approve, create, edit, pipeline trigger or stop) change the team's shared state: ask the user for a go-ahead before each one, unless they just asked for it explicitly.