Skip to content

Commit bdf920b

Browse files
sergicalcodex
andcommitted
feat(opencode): add V1 and V2 distributions
Co-Authored-By: OpenAI Codex <codex@openai.com>
1 parent 4c3279a commit bdf920b

17 files changed

Lines changed: 863 additions & 23 deletions

File tree

.github/workflows/deploy-plugins.yml

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,18 @@
99
# cursor -> getsentry/plugin-cursor
1010
# codex -> getsentry/plugin-codex
1111
# grok -> getsentry/plugin-grok
12+
# opencode -> getsentry/plugin-opencode
13+
# opencode2 -> getsentry/plugin-opencode2
1214
# pi -> getsentry/plugin-pi
1315
#
14-
# Marketplaces consume `getsentry/plugin-<agent>` by git ref. Each job builds its
15-
# agent's tree from this repo, then commits it onto the target repo's `main`,
16-
# replacing the previous contents. The five jobs target five different repos,
17-
# so they run in parallel without contention.
16+
# Marketplaces and installers consume `getsentry/plugin-<agent>` by git ref.
17+
# Each job builds its agent's tree from this repo, then commits it onto the
18+
# target repo's `main`, replacing the previous contents. The seven jobs target
19+
# seven different repos, so they run in parallel without contention.
1820
#
1921
# Cross-repo writes use a GitHub App token scoped per-job to a single plugin
2022
# repo; the default GITHUB_TOKEN cannot push to other repositories. The app must
21-
# be installed on the org with contents:write on the five plugin repos, its ID
23+
# be installed on the org with contents:write on the seven plugin repos, its ID
2224
# stored as the PLUGIN_DEPLOY_APP_ID variable and its private key as the
2325
# PLUGIN_DEPLOY_KEY secret. Each target repo must already exist with `main` as
2426
# its default branch.
@@ -50,7 +52,7 @@ jobs:
5052
strategy:
5153
fail-fast: false
5254
matrix:
53-
agent: [claude, cursor, codex, grok, pi]
55+
agent: [claude, cursor, codex, grok, opencode, opencode2, pi]
5456
concurrency:
5557
group: deploy-plugin-${{ matrix.agent }}
5658
cancel-in-progress: false
@@ -70,8 +72,8 @@ jobs:
7072
- name: Install uv
7173
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
7274

73-
- name: Set up Node for Pi validation
74-
if: matrix.agent == 'pi'
75+
- name: Set up Node for CLI validation
76+
if: matrix.agent == 'pi' || matrix.agent == 'opencode' || matrix.agent == 'opencode2'
7577
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
7678
with:
7779
node-version: 24
@@ -80,6 +82,14 @@ jobs:
8082
if: matrix.agent == 'pi'
8183
run: npm install -g --ignore-scripts @earendil-works/pi-coding-agent
8284

85+
- name: Install OpenCode V1 CLI
86+
if: matrix.agent == 'opencode'
87+
run: npm install -g opencode-ai@1.18.0
88+
89+
- name: Install OpenCode V2 CLI
90+
if: matrix.agent == 'opencode2'
91+
run: npm install -g @opencode-ai/cli@0.0.0-next-16420
92+
8393
- name: Build and deploy plugin-${{ matrix.agent }}
8494
env:
8595
AGENT: ${{ matrix.agent }}

.github/workflows/smoke-installer.yml

Lines changed: 94 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,18 @@
44
# (--no-interactive) so it installs the Sentry plugin for every detected agent
55
# without a prompt, and verifies each plugin actually landed.
66
#
7-
# Claude Code, Codex, Grok, and Pi ship cross-platform npm CLIs, so they get a
8-
# real install against their package sources. Cursor has no headless CLI to
7+
# Claude Code, Codex, Grok, OpenCode V1, and Pi ship cross-platform npm CLIs, so
8+
# they get real CLI installs. Cursor has no headless CLI to
99
# install in CI, but our Cursor install is only a `git clone` of the public
1010
# plugin repo into ~/.cursor/plugins/local/sentry — so we put a `cursor` stub on
1111
# PATH to satisfy detection and verify the real clone (this is what exercises
1212
# the per-OS path handling, including Windows).
13+
#
14+
# OpenCode V2 currently recommends WSL on Windows and cannot share V1's MCP
15+
# config shape, so it runs in a separate Linux smoke job. The OpenCode target
16+
# repositories are replaced with temporary local git repositories in both jobs;
17+
# this tests the real clone flow before those generated repositories are first
18+
# deployed.
1319

1420
name: Smoke installer
1521

@@ -57,8 +63,24 @@ jobs:
5763
- name: Build
5864
run: pnpm --filter @sentry/ai build
5965

60-
- name: Install Claude Code, Codex, Grok, and Pi CLIs
61-
run: npm install -g @anthropic-ai/claude-code @openai/codex @xai-official/grok @earendil-works/pi-coding-agent
66+
- name: Install Claude Code, Codex, Grok, OpenCode V1, and Pi CLIs
67+
run: npm install -g @anthropic-ai/claude-code @openai/codex @xai-official/grok opencode-ai@1.18.0 @earendil-works/pi-coding-agent
68+
69+
- name: Prepare local OpenCode V1 distribution
70+
run: |
71+
set -euo pipefail
72+
repo="$RUNNER_TEMP/plugin-opencode"
73+
mkdir -p "$repo/skills/sentry-installer-smoke"
74+
printf '1\n' > "$repo/.sentry-opencode-v1"
75+
printf '%s\n' '---' 'name: sentry-installer-smoke' 'description: Verify the Sentry OpenCode installer' '---' '' '# Sentry installer smoke' > "$repo/skills/sentry-installer-smoke/SKILL.md"
76+
git -C "$repo" init -q
77+
git -C "$repo" config user.name smoke-test
78+
git -C "$repo" config user.email smoke@example.com
79+
git -C "$repo" add .
80+
git -C "$repo" commit -qm 'test: seed OpenCode bundle'
81+
repo_url="$(node -e 'console.log(require("node:url").pathToFileURL(process.argv[1]).href)' "$repo")"
82+
git config --global protocol.file.allow always
83+
git config --global "url.${repo_url}.insteadOf" https://github.com/getsentry/plugin-opencode.git
6284
6385
- name: Put a Cursor stub on PATH
6486
run: |
@@ -100,4 +122,72 @@ jobs:
100122
pi list --no-approve
101123
pi list --no-approve | grep -iq 'getsentry/plugin-pi' || { echo "pi: sentry package missing"; exit 1; }
102124
125+
echo "== opencode =="
126+
opencode debug skill > "$RUNNER_TEMP/opencode-skills.json"
127+
grep -q 'sentry-installer-smoke' "$RUNNER_TEMP/opencode-skills.json" || { echo "opencode: sentry skill missing"; exit 1; }
128+
node - <<'NODE'
129+
const fs = require("node:fs");
130+
const path = require("node:path");
131+
const os = require("node:os");
132+
const root = path.join(os.homedir(), ".config", "opencode");
133+
const file = ["opencode.json", "opencode.jsonc"].map((name) => path.join(root, name)).find(fs.existsSync);
134+
if (!file) throw new Error("opencode: global config missing");
135+
const config = JSON.parse(fs.readFileSync(file, "utf8"));
136+
if (!config.mcp?.sentry?.url?.includes("mcp.sentry.dev")) throw new Error("opencode: Sentry MCP missing");
137+
NODE
138+
103139
echo "All agents have the Sentry plugin."
140+
141+
smoke-opencode2:
142+
name: OpenCode V2 beta
143+
runs-on: ubuntu-latest
144+
env:
145+
SENTRY_DSN: ""
146+
steps:
147+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
148+
149+
- uses: pnpm/action-setup@a15d269cd4658e1107c09f1fabf4cbd7bd1f308a # v4.4.0
150+
151+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
152+
with:
153+
node-version: 24
154+
cache: pnpm
155+
156+
- run: pnpm install --frozen-lockfile
157+
- run: pnpm --filter @sentry/ai build
158+
- run: npm install -g @opencode-ai/cli@0.0.0-next-16420
159+
160+
- name: Prepare local OpenCode V2 distribution
161+
run: |
162+
set -euo pipefail
163+
repo="$RUNNER_TEMP/plugin-opencode2"
164+
mkdir -p "$repo/skills/sentry-installer-smoke"
165+
printf '2\n' > "$repo/.sentry-opencode-v2"
166+
printf '%s\n' '---' 'name: sentry-installer-smoke' 'description: Verify the Sentry OpenCode V2 installer' 'metadata:' ' opencode/autoinvoke: "false"' '---' '' '# Sentry installer smoke' > "$repo/skills/sentry-installer-smoke/SKILL.md"
167+
git -C "$repo" init -q
168+
git -C "$repo" config user.name smoke-test
169+
git -C "$repo" config user.email smoke@example.com
170+
git -C "$repo" add .
171+
git -C "$repo" commit -qm 'test: seed OpenCode V2 bundle'
172+
repo_url="$(node -e 'console.log(require("node:url").pathToFileURL(process.argv[1]).href)' "$repo")"
173+
git config --global protocol.file.allow always
174+
git config --global "url.${repo_url}.insteadOf" https://github.com/getsentry/plugin-opencode2.git
175+
176+
- name: Run installer (non-interactive)
177+
run: node packages/installer/dist/index.js install --no-interactive
178+
179+
- name: Verify OpenCode V2 installation
180+
run: |
181+
set -euo pipefail
182+
node - <<'NODE'
183+
const fs = require("node:fs");
184+
const path = require("node:path");
185+
const os = require("node:os");
186+
const bundle = path.join(os.homedir(), ".config", "opencode", "skills", "sentry", "skills", "sentry-installer-smoke", "SKILL.md");
187+
if (!fs.existsSync(bundle)) throw new Error(`opencode2: Sentry skill missing at ${bundle}`);
188+
const root = path.join(os.homedir(), ".config", "opencode");
189+
const file = ["opencode.json", "opencode.jsonc"].map((name) => path.join(root, name)).find(fs.existsSync);
190+
if (!file) throw new Error("opencode2: global config missing");
191+
const config = JSON.parse(fs.readFileSync(file, "utf8"));
192+
if (!config.mcp?.servers?.sentry?.url?.includes("mcp.sentry.dev")) throw new Error("opencode2: Sentry MCP missing");
193+
NODE

AGENTS.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Agent Instructions
22

33
## Project Overview
4-
Sentry plugin for AI coding assistants (Claude Code, Cursor, Codex, Grok, and Pi). Provides MCP server integration and skills.
4+
Sentry plugin for AI coding assistants (Claude Code, Cursor, Codex, Grok, OpenCode V1/V2, and Pi). Provides MCP server integration and skills.
55

66
## Commit Attribution
77
AI commits MUST include:
@@ -80,6 +80,8 @@ Skills use YAML frontmatter with `allowed-tools` — this is required by Cursor
8080
## MCP Server
8181
Sentry MCP server configured at `https://mcp.sentry.dev/mcp`. The source of truth is `mcp.json`: Cursor consumes it as-is at the plugin root, while the Codex and Grok builds emit it as `.mcp.json` (Codex's validator requires the dotted name; Grok auto-discovers it). Claude declares the server inline in its `plugin.json` (`mcpServers`), so the Claude build ships no MCP file. Pi declares the same server in `src/plugins/pi/extensions/sentry-mcp.ts`, which adapts it into native Pi tools. The root `.mcp.json` is a backwards-compat copy (identical to `mcp.json`) retained for existing installs that consumed the plugin from this repo's root; keep the two in sync until the root compat surface is removed.
8282

83+
OpenCode V1 and V2 generate native `opencode.json` files from `mcp.json`. V1 places `sentry` directly under `mcp`; V2 places it under `mcp.servers`. Their installer harnesses use the corresponding CLI command to merge that entry into the user's global config.
84+
8385
## Key Conventions
8486
- All setup skills must **detect platform/SDK before suggesting configuration** — never assume
8587
- Sentry code review skill only processes comments from `sentry[bot]`, ignores other bots

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
> [Claude Code](https://github.com/getsentry/plugin-claude),
77
> [Cursor](https://github.com/getsentry/plugin-cursor),
88
> [Codex](https://github.com/getsentry/plugin-codex),
9-
> [Grok](https://github.com/getsentry/plugin-grok), and
9+
> [Grok](https://github.com/getsentry/plugin-grok),
10+
> [OpenCode V1](https://github.com/getsentry/plugin-opencode),
11+
> [OpenCode V2](https://github.com/getsentry/plugin-opencode2), and
1012
> [Pi](https://github.com/getsentry/plugin-pi) — install one of those, not this
1113
> repo. They're also served over HTTP at
1214
> [skills.sentry.dev](https://skills.sentry.dev) for agents to fetch directly.
@@ -17,7 +19,7 @@ Your AI coding assistant already knows how to write code. This plugin teaches it
1719

1820
Whether you're adding Sentry to a new project, debugging a spike in errors, or configuring alerts, just ask. The plugin gives your assistant the context it needs to do it right.
1921

20-
Supports [**Claude Code**](https://github.com/getsentry/plugin-claude), [**Cursor**](https://github.com/getsentry/plugin-cursor), [**Codex**](https://github.com/getsentry/plugin-codex), [**Grok**](https://github.com/getsentry/plugin-grok), and [**Pi**](https://github.com/getsentry/plugin-pi).
22+
Supports [**Claude Code**](https://github.com/getsentry/plugin-claude), [**Cursor**](https://github.com/getsentry/plugin-cursor), [**Codex**](https://github.com/getsentry/plugin-codex), [**Grok**](https://github.com/getsentry/plugin-grok), [**Pi**](https://github.com/getsentry/plugin-pi), [**OpenCode V1**](https://github.com/getsentry/plugin-opencode), and [**OpenCode V2**](https://github.com/getsentry/plugin-opencode2).
2123

2224
## What You Can Do
2325

@@ -67,6 +69,8 @@ exactly that agent's plugin:
6769
| Codex | [`getsentry/plugin-codex`](https://github.com/getsentry/plugin-codex) |
6870
| Grok | [`getsentry/plugin-grok`](https://github.com/getsentry/plugin-grok) |
6971
| Pi | [`getsentry/plugin-pi`](https://github.com/getsentry/plugin-pi) |
72+
| OpenCode V1 | [`getsentry/plugin-opencode`](https://github.com/getsentry/plugin-opencode) |
73+
| OpenCode V2 | [`getsentry/plugin-opencode2`](https://github.com/getsentry/plugin-opencode2) |
7074

7175
These repositories are generated; do not edit them. Each one's README has the
7276
install instructions for that agent.
@@ -85,11 +89,11 @@ and swaps the skill tree's `disable-model-invocation` flags for Codex's
8589
```bash
8690
git clone https://github.com/getsentry/sentry-for-ai.git
8791
cd sentry-for-ai
88-
src/plugins/codex/build.sh /tmp/sentry-codex # or src/plugins/{claude,cursor,grok,pi}
92+
src/plugins/codex/build.sh /tmp/sentry-codex # or src/plugins/{claude,cursor,grok,opencode,opencode2,pi}
8993
```
9094

9195
To build any target locally, run `src/plugins/<agent>/build.sh <output-dir>`
92-
(`claude`, `cursor`, `codex`, `grok`, or `pi`).
96+
(`claude`, `cursor`, `codex`, `grok`, `opencode`, `opencode2`, or `pi`).
9397

9498
## Skills
9599

packages/installer/README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Install the [Sentry plugin](https://github.com/getsentry/sentry-for-ai) into you
44

55
The plugin teaches your assistant Sentry — how to set it up in any project, how to find and fix production issues, and how to configure alerts, AI monitoring, and more. This package detects which assistants you have installed and wires the plugin into each one for you.
66

7-
Supports **Claude Code**, **Codex**, **Cursor**, **Grok**, and **Pi**.
7+
Supports **Claude Code**, **Codex**, **Cursor**, **Grok**, **OpenCode V1**, **OpenCode V2**, and **Pi**.
88

99
```bash
1010
npx @sentry/ai install
@@ -30,14 +30,16 @@ The non-interactive mode is intended for CI and unattended runs.
3030

3131
## What it installs
3232

33-
For each detected assistant, the installer runs that tool's native plugin command:
33+
For each detected assistant, the installer uses its native package command or installs the generated skill bundle:
3434

3535
| Assistant | How it's installed |
3636
| ----------- | ----------------------------------------------------------------------------- |
3737
| Claude Code | `claude plugin install sentry` from the official plugin marketplace |
3838
| Codex | `codex plugin add sentry` from the Sentry plugin marketplace |
3939
| Cursor | Clones [`getsentry/plugin-cursor`](https://github.com/getsentry/plugin-cursor) into `~/.cursor/plugins/local/sentry` |
4040
| Grok | `grok plugin install getsentry/plugin-grok` |
41+
| OpenCode V1 | Clones [`getsentry/plugin-opencode`](https://github.com/getsentry/plugin-opencode) into OpenCode's global skills and adds the V1 Sentry MCP entry |
42+
| OpenCode V2 | Clones [`getsentry/plugin-opencode2`](https://github.com/getsentry/plugin-opencode2) into OpenCode's global skills and adds the V2 Sentry MCP entry |
4143
| Pi | `pi install git:github.com/getsentry/plugin-pi` |
4244

4345
Each per-agent plugin is built and published from the [`sentry-for-ai`](https://github.com/getsentry/sentry-for-ai) repository, which is the source of truth for all skills.
@@ -49,13 +51,15 @@ npx @sentry/ai remove # interactive — pick which agents to re
4951
npx @sentry/ai remove --no-interactive # remove from every agent that has it
5052
```
5153

52-
`uninstall` is an alias for `remove`. This only offers agents that currently have the plugin, and removes the Sentry plugin itself — each tool's plugin marketplace is left registered. Restart your AI tools afterward to drop the plugin.
54+
`uninstall` is an alias for `remove`. This only offers agents that currently have the plugin, and removes the Sentry plugin itself — each tool's plugin marketplace is left registered. OpenCode's CLIs do not provide an MCP remove command, so the installer identifies the config entry to delete manually. Restart your AI tools afterward to drop the plugin.
5355

5456
## Requirements
5557

5658
- Node.js 18 or newer
5759
- The assistant CLI you want to set up must already be installed and on your `PATH`
58-
- `git` is required for the Cursor install
60+
- `git` is required for the Cursor and OpenCode installs
61+
62+
OpenCode V1 and the OpenCode V2 beta use the same global config path but incompatible MCP shapes. When both `opencode` and `opencode2` are installed, the installer configures V2 only.
5963

6064
## License
6165

0 commit comments

Comments
 (0)