From e7a6632377418d1ac58ec2a06db2bdf9f61228bc Mon Sep 17 00:00:00 2001 From: Trevor Walker Date: Thu, 24 Sep 2026 02:27:04 -0600 Subject: [PATCH] fix: report OpenCode scrub package version --- src/__tests__/plugin.test.ts | 8 ++++++++ src/index.ts | 3 ++- tsconfig.json | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/__tests__/plugin.test.ts b/src/__tests__/plugin.test.ts index 2f11eae..d170697 100644 --- a/src/__tests__/plugin.test.ts +++ b/src/__tests__/plugin.test.ts @@ -1,7 +1,11 @@ import { describe, expect, it } from "bun:test" +import { readFileSync } from "node:fs" +import { join } from "node:path" import plugin from "../index.js" import type { RequestContext } from "../types.js" +const packageVersion = JSON.parse(readFileSync(join(import.meta.dir, "..", "..", "package.json"), "utf8")).version + const opencodePrompt = `You are powered by the model named claude-haiku-4-5. The exact model ID is anthropic/claude-haiku-4-5 Here is some useful information about the environment you are running in: @@ -10,6 +14,10 @@ Here is some useful information about the environment you are running in: ` describe("opencode-scrub adapter boundary", () => { + it("reports the shipped package version", () => { + expect(plugin.version).toBe(packageVersion) + }) + it("includes LiteLLM's passthrough classification and scrubs OpenCode content", () => { expect(plugin.adapters).toContain("passthrough") const ctx: RequestContext = { adapter: "passthrough", systemContext: opencodePrompt, metadata: {} } diff --git a/src/index.ts b/src/index.ts index db9eab0..b4d5623 100644 --- a/src/index.ts +++ b/src/index.ts @@ -7,6 +7,7 @@ */ import type { Transform, RequestContext } from "./types.js" +import packageMetadata from "../package.json" with { type: "json" } import { scrubOpencodeFingerprints } from "./scrub.js" export type { Transform, RequestContext } from "./types.js" @@ -19,7 +20,7 @@ const PASSTHROUGH_OPENCODE_MARKER = const plugin: Transform = { name: "opencode-scrub", - version: "0.1.0", + version: packageMetadata.version, description: "Strip opencode-identifying fingerprints from the system prompt before it reaches Claude", adapters: ["opencode", "passthrough"], diff --git a/tsconfig.json b/tsconfig.json index 4b45066..aec6124 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "target": "ES2022", - "module": "ES2022", + "module": "ESNext", "moduleResolution": "bundler", "lib": [ "ES2022"