- 品牌替换:OpenCode/opencode → AirCoding/aircoding(16+ 文件) - Logo ASCII art:修复 left/right 行数不匹配导致的启动崩溃 - 启动诊断:添加 OPENCODE_PRINT_TIMING 计时探针 - dev 模式默认 --pure 跳过外部插件加载 - AGENTS.md 模板:追加 AirCoding 多 Agent 专项段落 - architect prompt + plugin:强化 AGENTS.md 产出验证
32 lines
1.4 KiB
Diff
32 lines
1.4 KiB
Diff
diff --git a/src/download.ts b/src/download.ts
|
|
index 3454256..6dca25a 100644
|
|
--- a/src/download.ts
|
|
+++ b/src/download.ts
|
|
@@ -7,7 +7,7 @@
|
|
*/
|
|
|
|
+declare const FFF_LIBC: "gnu" | "musl";
|
|
import { existsSync } from "node:fs";
|
|
-import { createRequire } from "node:module";
|
|
import { dirname, join } from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
import { getLibFilename, getNpmPackageName } from "./platform";
|
|
@@ -54,14 +54,10 @@ export function binaryExists(): boolean {
|
|
* in the same directory.
|
|
*/
|
|
function resolveFromNpmPackage(): string | null {
|
|
- const packageName = getNpmPackageName();
|
|
-
|
|
try {
|
|
- // Use createRequire to resolve the platform package's location
|
|
- const require = createRequire(join(getPackageDir(), "package.json"));
|
|
- const packageJsonPath = require.resolve(`${packageName}/package.json`);
|
|
- const packageDir = dirname(packageJsonPath);
|
|
- const binaryPath = join(packageDir, getLibFilename());
|
|
+ const binaryPath = require(
|
|
+ `@ff-labs/fff-bin-${process.platform === "linux" ? `linux-${process.arch}-${typeof FFF_LIBC === "string" ? FFF_LIBC : getNpmPackageName().endsWith("musl") ? "musl" : "gnu"}` : `${process.platform}-${process.arch}`}/${process.platform === "win32" ? "fff_c.dll" : process.platform === "darwin" ? "libfff_c.dylib" : "libfff_c.so"}`,
|
|
+ );
|
|
|
|
if (existsSync(binaryPath)) {
|
|
return binaryPath;
|