mirror of
https://github.com/lemon07r/opencode-kimi-full.git
synced 2026-07-18 08:05:52 +02:00
0626597690
Plugin v1.0.0 exported a named PROVIDER_ID constant alongside the default export. opencode's plugin loader (getLegacyPlugins) iterates every export and requires each to be a function; the named string export caused it to throw 'Plugin export is not a function', which was only visible in the log file — the provider silently vanished from 'opencode auth login'. - Move PROVIDER_ID into src/constants.ts and import it in src/index.ts. - Add test/exports.test.ts as a regression guard (bun test). - Add bunfig.toml to scope bun test away from research/ and node_modules/. - Wire 'bun test' into the release workflow. - Document rule 9 in AGENTS.md (single default export in src/index.ts). - Also pick up the previous session's README fix (opencode auth login -p).
18 lines
810 B
TypeScript
18 lines
810 B
TypeScript
import { test, expect } from "bun:test"
|
|
import * as mod from "../src/index.ts"
|
|
|
|
// Regression guard for the 1.0.0 bug:
|
|
// opencode's plugin loader (packages/opencode/src/plugin/index.ts →
|
|
// getLegacyPlugins) iterates every export of the plugin module and throws
|
|
// "Plugin export is not a function" if any export is not callable. The
|
|
// published v1.0.0 re-exported PROVIDER_ID (a string), which broke loading
|
|
// silently — `opencode auth login` just did not list the provider.
|
|
//
|
|
// Keep this file cheap and dependency-free; do not import anything that
|
|
// makes network calls.
|
|
test("src/index.ts exports exactly one default export which is a function", () => {
|
|
const keys = Object.keys(mod)
|
|
expect(keys).toEqual(["default"])
|
|
expect(typeof (mod as { default: unknown }).default).toBe("function")
|
|
})
|