oh-my-opencode 0.1.21 → 0.1.22

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.
Files changed (2) hide show
  1. package/dist/index.js +8 -56
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -15258,9 +15258,7 @@ var lsp_code_action_resolve = tool({
15258
15258
  }
15259
15259
  });
15260
15260
  // src/tools/ast-grep/constants.ts
15261
- import { createRequire as createRequire4 } from "module";
15262
- import { dirname as dirname2, join as join5 } from "path";
15263
- import { existsSync as existsSync7 } from "fs";
15261
+ import { existsSync as existsSync7, statSync } from "fs";
15264
15262
 
15265
15263
  // src/tools/ast-grep/downloader.ts
15266
15264
  var {spawn: spawn4 } = globalThis.Bun;
@@ -15372,64 +15370,18 @@ async function ensureAstGrepBinary() {
15372
15370
  }
15373
15371
 
15374
15372
  // src/tools/ast-grep/constants.ts
15375
- function getPlatformPackageName2() {
15376
- const platform = process.platform;
15377
- const arch = process.arch;
15378
- const platformMap = {
15379
- "darwin-arm64": "@ast-grep/cli-darwin-arm64",
15380
- "darwin-x64": "@ast-grep/cli-darwin-x64",
15381
- "linux-arm64": "@ast-grep/cli-linux-arm64-gnu",
15382
- "linux-x64": "@ast-grep/cli-linux-x64-gnu",
15383
- "win32-x64": "@ast-grep/cli-win32-x64-msvc",
15384
- "win32-arm64": "@ast-grep/cli-win32-arm64-msvc",
15385
- "win32-ia32": "@ast-grep/cli-win32-ia32-msvc"
15386
- };
15387
- return platformMap[`${platform}-${arch}`] ?? null;
15388
- }
15389
15373
  function isValidBinary(filePath) {
15390
15374
  try {
15391
- const stats = __require("fs").statSync(filePath);
15392
- return stats.size > 1e4;
15375
+ return statSync(filePath).size > 1e4;
15393
15376
  } catch {
15394
15377
  return false;
15395
15378
  }
15396
15379
  }
15397
15380
  function findSgCliPathSync() {
15398
- const binaryName = process.platform === "win32" ? "sg.exe" : "sg";
15399
- if (process.platform === "darwin") {
15400
- const homebrewPaths = ["/opt/homebrew/bin/sg", "/usr/local/bin/sg"];
15401
- for (const path of homebrewPaths) {
15402
- if (existsSync7(path) && isValidBinary(path)) {
15403
- return path;
15404
- }
15405
- }
15406
- }
15407
15381
  const cachedPath = getCachedBinaryPath2();
15408
15382
  if (cachedPath && isValidBinary(cachedPath)) {
15409
15383
  return cachedPath;
15410
15384
  }
15411
- try {
15412
- const require2 = createRequire4(import.meta.url);
15413
- const cliPkgPath = require2.resolve("@ast-grep/cli/package.json");
15414
- const cliDir = dirname2(cliPkgPath);
15415
- const sgPath = join5(cliDir, binaryName);
15416
- if (existsSync7(sgPath) && isValidBinary(sgPath)) {
15417
- return sgPath;
15418
- }
15419
- } catch {}
15420
- const platformPkg = getPlatformPackageName2();
15421
- if (platformPkg) {
15422
- try {
15423
- const require2 = createRequire4(import.meta.url);
15424
- const pkgPath = require2.resolve(`${platformPkg}/package.json`);
15425
- const pkgDir = dirname2(pkgPath);
15426
- const astGrepName = process.platform === "win32" ? "ast-grep.exe" : "ast-grep";
15427
- const binaryPath = join5(pkgDir, astGrepName);
15428
- if (existsSync7(binaryPath) && isValidBinary(binaryPath)) {
15429
- return binaryPath;
15430
- }
15431
- } catch {}
15432
- }
15433
15385
  return null;
15434
15386
  }
15435
15387
  var resolvedCliPath2 = null;
@@ -15923,7 +15875,7 @@ var {spawn: spawn6 } = globalThis.Bun;
15923
15875
 
15924
15876
  // src/tools/safe-grep/constants.ts
15925
15877
  import { existsSync as existsSync9 } from "fs";
15926
- import { join as join6, dirname as dirname3 } from "path";
15878
+ import { join as join5, dirname as dirname2 } from "path";
15927
15879
  import { spawnSync } from "child_process";
15928
15880
  var cachedCli = null;
15929
15881
  function findExecutable(name) {
@@ -15940,14 +15892,14 @@ function findExecutable(name) {
15940
15892
  }
15941
15893
  function getOpenCodeBundledRg() {
15942
15894
  const execPath = process.execPath;
15943
- const execDir = dirname3(execPath);
15895
+ const execDir = dirname2(execPath);
15944
15896
  const isWindows = process.platform === "win32";
15945
15897
  const rgName = isWindows ? "rg.exe" : "rg";
15946
15898
  const candidates = [
15947
- join6(execDir, rgName),
15948
- join6(execDir, "bin", rgName),
15949
- join6(execDir, "..", "bin", rgName),
15950
- join6(execDir, "..", "libexec", rgName)
15899
+ join5(execDir, rgName),
15900
+ join5(execDir, "bin", rgName),
15901
+ join5(execDir, "..", "bin", rgName),
15902
+ join5(execDir, "..", "libexec", rgName)
15951
15903
  ];
15952
15904
  for (const candidate of candidates) {
15953
15905
  if (existsSync9(candidate)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oh-my-opencode",
3
- "version": "0.1.21",
3
+ "version": "0.1.22",
4
4
  "description": "OpenCode plugin - custom agents (oracle, librarian) and enhanced features",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",