Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Publish to npm

on:
push:
tags:
- "v*"
workflow_dispatch:

permissions:
contents: read

concurrency:
group: npm-publish
cancel-in-progress: false

jobs:
publish:
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v5
- uses: oven-sh/setup-bun@v2
- uses: actions/setup-node@v6
with:
node-version: "24"
registry-url: "https://registry.npmjs.org"
package-manager-cache: false
- run: npm install --global npm@11.21.0
- run: bun install --frozen-lockfile
- name: Validate stable release
run: |
node --input-type=module <<'NODE'
import assert from "node:assert/strict"
import { readFileSync } from "node:fs"

const { version, dependencies } = JSON.parse(readFileSync("package.json", "utf8"))
assert.match(version, /^[1-9]\d*\.\d+\.\d+$/, "Only stable V2 plugin releases may be published as latest")
assert.ok(dependencies["@opencode/plugin"], "Release must use the OpenCode V2 plugin API")
if (process.env.GITHUB_REF_TYPE === "tag") {
assert.equal(process.env.GITHUB_REF_NAME, `v${version}`, "Git tag must match package version")
}
NODE
- name: Publish using trusted publishing
# prepublishOnly runs the type check and tests before publication.
run: npm publish --access public --tag latest --provenance
env:
# Avoid setup-node's placeholder token masking an OIDC exchange failure.
NODE_AUTH_TOKEN: ""
NPM_CONFIG_LOGLEVEL: verbose
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Changelog

## 1.0.0 — OpenCode V2 migration

This is the first published release for **OpenCode V2**. The major version marks a breaking plugin API migration, not a change to the Lightpanda tool's name or inputs.

### Breaking changes

- Requires OpenCode V2 **2.0.18 or newer**. OpenCode V1 is no longer supported by this release; V1 users must pin `opencode-lightpanda@0.2.2` rather than `latest`.
- Migrates from `@opencode-ai/plugin` to `@opencode/plugin`, using `Plugin.define`, V2 tool registration, JSON Schema inputs, and structured tool content.
- Permissions apply to the `lightpanda` tool as a whole. V1's per-URL approval requests are no longer available; configure a V2 `lightpanda` permission rule if approval is required.

### Improvements

- Reports concise TLS and DNS failures from Lightpanda's structured diagnostics, with a bounded stderr fallback.
- Suppresses Lightpanda startup notices while retaining fetch errors.
- Adds an opt-in end-to-end smoke test that loads and executes the plugin in OpenCode V2.
- Adds GitHub Actions trusted publishing with npm provenance, without an npm publishing token.

### Upgrade

Upgrade OpenCode to V2 first, then install the plugin and restart OpenCode:

```sh
opencode plugin add opencode-lightpanda@1.0.0
```

See [Migrating from 0.x](README.md#migrating-from-0x) for configuration and permission changes.
37 changes: 35 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# opencode-lightpanda
A Lightpanda browser plugin/tool for OpenCode. It is like WebFetch tool on steroids.
A Lightpanda browser plugin/tool for OpenCode V2. It is like WebFetch tool on steroids.

> **Breaking change in 1.0: OpenCode V2 migration.** Version 1.0.0 and newer require OpenCode V2 (2.0.18 or newer) and do not support OpenCode V1. If you are staying on V1, pin `opencode-lightpanda@0.2.2` instead of using `latest`.

| Plugin version | Supported OpenCode version |
| --- | --- |
| `1.x` | OpenCode V2, 2.0.18 or newer |
| `0.2.2` | OpenCode V1 |

See [Migrating from 0.x](#migrating-from-0x) and the [1.0.0 release notes](CHANGELOG.md).

## Features

Expand All @@ -20,7 +29,7 @@ A Lightpanda browser plugin/tool for OpenCode. It is like WebFetch tool on stero
Install Lightpanda, then add the plugin globally:

```sh
opencode plugin add opencode-lightpanda@latest
opencode plugin add opencode-lightpanda@1.0.0
```

To update an existing installation:
Expand All @@ -33,6 +42,30 @@ Quit and restart OpenCode.

If OpenCode cannot find Lightpanda, start it with `LIGHTPANDA_BIN` set to the executable's absolute path.

## Migrating from 0.x

1. Upgrade to [OpenCode V2](https://opencode.ai/v2/docs/migrate-v1) (2.0.18 or newer) before upgrading this plugin. The 1.x plugin uses the new `@opencode/plugin` API; it cannot run in OpenCode V1.
2. Install `opencode-lightpanda@1.0.0` with the command above. For a configuration-managed installation, replace any pinned 0.x package entry with the V2 package:

```json
{
"$schema": "https://opencode.ai/config.json",
"plugins": ["opencode-lightpanda@^1.0.0"]
}
```

3. Review your permissions. V2 controls the `lightpanda` tool as a whole, not each URL. To retain explicit approval, use `{ "action": "lightpanda", "resource": "*", "effect": "ask" }` in the `permissions` array; see [Config](#config).
4. Quit and restart OpenCode. The tool is still named `lightpanda`, with the same `url`, `format`, and `timeout` inputs.

If you need to remain on OpenCode V1, keep the old plugin pinned in your V1 configuration:

```json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-lightpanda@0.2.2"]
}
```

## Usage
Starts a fresh Lightpanda process for every call, so cookies and browser state are not retained.

Expand Down
11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"name": "opencode-lightpanda",
"version": "0.2.2",
"description": "Lightpanda-powered web fetching for OpenCode",
"version": "1.0.0",
"description": "Lightpanda-powered web fetching for OpenCode V2",
"type": "module",
"main": "lightpanda.ts",
"exports": "./lightpanda.ts",
"files": [
"index.ts",
"lightpanda.ts"
"lightpanda.ts",
"CHANGELOG.md"
],
"scripts": {
"check": "tsc",
Expand All @@ -24,6 +25,10 @@
],
"author": "Stanislav (Stas) Katkov <git@skatkov.com>",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/skatkov/opencode-lightpanda.git"
},
"dependencies": {
"@opencode/plugin": "^2.0.18",
"zod": "^4.1.8"
Expand Down
Loading