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