From 222f554604890258f86e31c60d1992b0caef96ce Mon Sep 17 00:00:00 2001 From: "Stanislav (Stas) Katkov" Date: Mon, 12 Oct 2026 21:23:40 +0200 Subject: [PATCH] Release 1.0.0 for the OpenCode V2 migration --- .github/workflows/publish.yml | 52 +++++++++++++++++++++++++++++++++++ CHANGELOG.md | 28 +++++++++++++++++++ README.md | 37 +++++++++++++++++++++++-- package.json | 11 ++++++-- 4 files changed, 123 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/publish.yml create mode 100644 CHANGELOG.md diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..737e4ec --- /dev/null +++ b/.github/workflows/publish.yml @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..4c59086 --- /dev/null +++ b/CHANGELOG.md @@ -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. diff --git a/README.md b/README.md index 06536a2..b2f5b39 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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: @@ -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. diff --git a/package.json b/package.json index 5df3c7f..85f3fb1 100644 --- a/package.json +++ b/package.json @@ -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", @@ -24,6 +25,10 @@ ], "author": "Stanislav (Stas) Katkov ", "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/skatkov/opencode-lightpanda.git" + }, "dependencies": { "@opencode/plugin": "^2.0.18", "zod": "^4.1.8"