feat(plugin): extract opencode-webhooks as a publishable package - #10
Merged
Conversation
Moves the github-webhooks plugin from `plugins/github-webhooks{,.ts}` to
`packages/opencode-webhooks/` so it can be published to npm and consumed
by other OpenCode users via the standard `plugin: ["opencode-webhooks"]`
config pattern (matching how lore is consumed today).
Internal consumption (this image) is unchanged in behavior:
- `opencode-config-package.json` declares the package as a `file:` dep,
- Dockerfile copies `packages/` and `bun install` resolves it into
`~/.config/opencode/node_modules/opencode-webhooks/`,
- `opencode-user-config.json` references the resolved path.
Decoupling: only the default DB path changed. Was hardcoded to
`~/dev/.opencode/github-webhooks.sqlite` (assumes the image's symlinked
volume); now defaults to `${XDG_DATA_HOME:-~/.local/share}/opencode-webhooks/deliveries.sqlite`.
The image's existing `webhooks.json` is updated with an explicit
`db_path` override to preserve the existing dedup history.
Other behavior is bit-identical:
- HMAC verification, identity gating, payload filters, prompt templating,
bot identity resolution via `gh api user` — all unchanged.
- The plugin's log prefix changed `[github-webhooks]` → `[opencode-webhooks]`
to match the package name.
- Health check response field changed from `{plugin: "github-webhooks"}`
to `{plugin: "opencode-webhooks"}` (public API surface, callout in PR).
Out of scope and tracked as follow-ups in the plan doc:
- npm publishing workflow (will simplify the image's wiring once shipped),
- decoupling the `gh` CLI dependency,
- session reuse + event buffering.
See `.opencode/plans/extract-webhooks-plugin-package.md` for the full
design rationale, including a fact-check against OpenCode's plugin docs.
Plans, scratch notes, and OpenCode session data are local-only. The two plan docs that landed in #9 and earlier in this PR are removed from tracking but remain on disk; past commits still carry their content for anyone reading history.
MathurAditya724
marked this pull request as ready for review
May 1, 2026 18:40
Two minor review-followup items on PR #10: 1. peerDependencies floor was `@opencode-ai/plugin: >=1.1.0` but version 1.1.0 was never published to npm. The first existing version at-or-above the stated floor is 1.1.1. Range was still semver-valid so nothing broke, just an arbitrary floor — bump to >=1.1.1 so the stated floor is also resolvable. 2. Source-only TS distribution requires Bun at runtime (uses Bun.serve, Bun.spawn, Bun.file, bun:sqlite). README documents this and engines.bun is declared, but engines is advisory and a Node-on-Bun- fork consumer would have hit a cryptic ReferenceError on first dispatch. Add an explicit guard at the top of the plugin function that throws a useful message pointing at bun.sh.
MathurAditya724
added a commit
that referenced
this pull request
Aug 7, 2026
…op (#138) The Agent runs table followed the API's `updatedAt desc` order, so the list reshuffled on every refresh and working runs could sit anywhere. Sort the rendered rows client-side: working/busy runs float to the top, everything else falls back to a natural, name-based order (numeric so #2 precedes #10), giving a stable table where the runs you care about are always up front. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Extracts the github-webhooks plugin from this image-specific repo into a standalone, publishable npm package at
packages/opencode-webhooks/. Other OpenCode users can now consume it the same way they consume@loreai/opencode—bun add+ add to theplugin: [...]array.This image's behavior is unchanged. Internal consumption uses a
file:dep inopencode-config-package.jsonsobun installresolves the package into~/.config/opencode/node_modules/opencode-webhooks/at build time.What changed
packages/opencode-webhooks/with its ownpackage.json(MIT, peer dep on@opencode-ai/plugin),tsconfig.json,README.md(full config schema + install instructions),LICENSE, andsrc/(11 files moved fromplugins/github-webhooks/).index.ts: import paths flattened (./github-webhooks/X→./X), default DB path changed from~/dev/.opencode/github-webhooks.sqliteto${XDG_DATA_HOME:-~/.local/share}/opencode-webhooks/deliveries.sqlite, type re-exports added so consumers can author config-generators with type safety.[github-webhooks]→[opencode-webhooks].handler.ts:/healthzresponse field{plugin: "github-webhooks"}→{plugin: "opencode-webhooks"}. Public API surface change — anyone scripting health checks against this string needs to update.opencode-config-package.jsondeclares"opencode-webhooks": "file:./packages/opencode-webhooks".bun.lockregenerated.opencode-user-config.jsonreferences the resolved absolute path in itspluginarray (matches the existing@loreai/opencodeentry).Dockerfile:COPY plugins/→COPY packages/, comments updated.webhooks.json: explicitdb_path: "/home/developer/dev/.opencode/github-webhooks.sqlite"added to preserve the existing dedup history (~1000 entries) on the cutover. Without this, the new XDG default would orphan the existing DB.plugins/github-webhooks.ts+plugins/github-webhooks/*.ts(all 11 files) — no shim file, package is the single source of truth..opencode/plans/extract-webhooks-plugin-package.mddocuments the design, including a fact-check against OpenCode's plugin docs. Repo README,.env.exampleupdated to point at the new location and explain the new layout.Testing
tsc --noEmitclean against the newtsconfig.json(with@opencode-ai/pluginand@types/bunas devDeps).bun installclean against the updatedopencode-config-package.json(verified by mocking the install in/tmp/; lock file updated).jqvalid onwebhooks.json,opencode-config-package.json,opencode-user-config.json, package.json.bun installfails to resolve thefile:dep at image-build time, the build will fail loudly. Worth a smoke test once this lands.Out of scope (tracked in plan doc)
ghCLI dependency.webhooks.json(would be a behavior change).After publish to npm
The plan doc captures a follow-up to simplify the image's wiring: drop the
file:dep fromopencode-config-package.json, replace the absolutefile://URL inopencode-user-config.jsonwith the bare name"opencode-webhooks", drop theCOPY packages/Dockerfile step. OpenCode auto-installs npm-named plugins into~/.cache/opencode/node_modules/at startup.