@khalilgharbaoui/opencode-claude-code-plugin 0.11.0 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -544,8 +544,8 @@ grep "plugin ready" ~/.local/share/opencode-claude-code/plugin.log
544
544
 
545
545
  ```json
546
546
  {
547
- "plugin": "0.10.0",
548
- "opencode": "unknown",
547
+ "plugin": "0.11.1",
548
+ "opencode": "1.18.5",
549
549
  "cwd": { "resolved": "/Users/you/code/app", "source": "process" },
550
550
  "providers": ["claude-code-default", "claude-code-work"],
551
551
  "accounts": ["default", "work"],
@@ -568,8 +568,9 @@ Reading it:
568
568
  flags like `--thinking-display`.
569
569
  - **`mcpServers`** is the on-disk merge, before opencode's runtime toggles
570
570
  are applied (those aren't settled yet at startup).
571
- - **`opencode`** reads `unknown` on current opencode: as of 1.17.18 it does
572
- not expose its own version to plugins.
571
+ - **`opencode`** is read from the running opencode binary (`--version`), since
572
+ opencode still does not hand its version to plugins. It reads `unknown` when
573
+ opencode is run from source rather than as the packaged binary.
573
574
 
574
575
  ### Default behavior (no config, no env)
575
576
 
package/dist/index.js CHANGED
@@ -5537,8 +5537,10 @@ function cleanupOne(cacheRoot, ourDir) {
5537
5537
  }
5538
5538
 
5539
5539
  // src/startup-diagnostics.ts
5540
+ import { execFile as execFile2 } from "child_process";
5540
5541
  import * as fs5 from "fs";
5541
5542
  import * as path6 from "path";
5543
+ import { promisify as promisify2 } from "util";
5542
5544
  import { fileURLToPath as fileURLToPath2 } from "url";
5543
5545
  var cachedPluginVersion;
5544
5546
  function pluginVersion() {
@@ -5564,6 +5566,29 @@ function pickOpencodeVersion(input) {
5564
5566
  if (typeof direct === "string" && direct.length > 0) return direct;
5565
5567
  return void 0;
5566
5568
  }
5569
+ var execFileAsync2 = promisify2(execFile2);
5570
+ var opencodeVersionProbe;
5571
+ function detectOpencodeVersion(execPath = process.execPath) {
5572
+ if (opencodeVersionProbe) return opencodeVersionProbe;
5573
+ opencodeVersionProbe = (async () => {
5574
+ if (!path6.basename(execPath).toLowerCase().includes("opencode")) {
5575
+ log.debug("skipping opencode version probe: execPath is not opencode", { execPath });
5576
+ return void 0;
5577
+ }
5578
+ try {
5579
+ const { stdout } = await execFileAsync2(execPath, ["--version"], { timeout: 5e3 });
5580
+ const match = /\d+\.\d+\.\d+\S*/.exec(stdout.trim());
5581
+ return match ? match[0] : void 0;
5582
+ } catch (err) {
5583
+ log.debug("opencode version probe failed", {
5584
+ execPath,
5585
+ error: err instanceof Error ? err.message : String(err)
5586
+ });
5587
+ return void 0;
5588
+ }
5589
+ })();
5590
+ return opencodeVersionProbe;
5591
+ }
5567
5592
  function describeSpawnCwd(configured, live = process.cwd(), captured = getOpencodeProjectDirectory()) {
5568
5593
  if (typeof configured === "string" && configured.length > 0) {
5569
5594
  return { resolved: configured, source: "configured" };
@@ -5619,10 +5644,8 @@ function logStartupDiagnostics(providers, opencodeVersion) {
5619
5644
  logged = true;
5620
5645
  void (async () => {
5621
5646
  try {
5622
- const { claudeCliPath, ...rest } = collectStartupDiagnostics(
5623
- providers,
5624
- opencodeVersion
5625
- );
5647
+ const version = opencodeVersion ?? process.env.OPENCODE_VERSION ?? await detectOpencodeVersion();
5648
+ const { claudeCliPath, ...rest } = collectStartupDiagnostics(providers, version);
5626
5649
  const cli = await detectCliVersion(claudeCliPath);
5627
5650
  const diagnostics = {
5628
5651
  ...rest,