Remove Homebrew integration and tap promotion
This commit is contained in:
1 parent
fc9e148764
commit
4bee160086
15 files changed
+95
-424
No files matched your search
@@ -1,45 +0,0 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { existsSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { handleUpdateCommand, homebrewFormulaPrefix, installHomebrewSkill } from "./update.js";
|
||||
|
||||
describe("Homebrew skill refresh", () => {
|
||||
test("a copied source package cannot update its parent application's Git repository", async () => {
|
||||
const dir = mkdtempSync(join(tmpdir(), "seal-source-update-test-"));
|
||||
try {
|
||||
await expect(handleUpdateCommand({ appRoot: dir, entryFile: join(dir, "src", "cli.ts") }))
|
||||
.rejects.toMatchObject({ exitCode: 13 });
|
||||
expect(existsSync(join(dir, "bun.lock"))).toBe(false);
|
||||
} finally { rmSync(dir, { recursive: true, force: true }); }
|
||||
});
|
||||
|
||||
test("uses the upgraded formula executable even when PATH contains an older standalone CLI", () => {
|
||||
const dir = mkdtempSync(join(tmpdir(), "seal-brew-skill-test-"));
|
||||
const originalPath = process.env.PATH;
|
||||
try {
|
||||
const prefix = join(dir, "formula");
|
||||
const bin = join(prefix, "bin");
|
||||
const skill = join(dir, "skill");
|
||||
mkdirSync(bin, { recursive: true });
|
||||
mkdirSync(skill);
|
||||
writeFileSync(join(skill, "SKILL.md"), "---\nmetadata:\n version: 1.2.3\n---\n");
|
||||
// Shell fixtures touch only this temp directory; no real brew upgrade or global skill installation.
|
||||
writeFileSync(join(dir, "brew"), `#!/bin/sh\nprintf '%s\\n' '${prefix}'\n`, { mode: 0o755 });
|
||||
writeFileSync(join(dir, "seal-use"), `#!/bin/sh\ntouch '${join(dir, "wrong-cli")}'\nexit 1\n`, { mode: 0o755 });
|
||||
writeFileSync(join(bin, "seal-use"), `#!/bin/sh\ntouch '${join(dir, "right-cli")}'\nprintf '%s\\n' '{"targetDir":"${skill}"}'\n`, { mode: 0o755 });
|
||||
process.env.PATH = `${dir}:${originalPath ?? ""}`;
|
||||
// Fail before any install call if child-process PATH isolation is ever broken.
|
||||
expect(homebrewFormulaPrefix()).toBe(prefix);
|
||||
expect(installHomebrewSkill("1.2.3")).toEqual({ targetDir: skill, version: "1.2.3" });
|
||||
expect(existsSync(join(dir, "right-cli"))).toBe(true);
|
||||
expect(existsSync(join(dir, "wrong-cli"))).toBe(false);
|
||||
writeFileSync(join(skill, "SKILL.md"), "---\nmetadata:\n version: 1.2.2\n---\n");
|
||||
expect(() => installHomebrewSkill("1.2.3")).toThrow("1.2.2");
|
||||
try { installHomebrewSkill("1.2.3"); } catch (error) { expect(error).toMatchObject({ exitCode: 13 }); }
|
||||
} finally {
|
||||
if (originalPath === undefined) delete process.env.PATH; else process.env.PATH = originalPath;
|
||||
rmSync(dir, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -1,8 +1,8 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { mkdirSync, mkdtempSync, readFileSync, rmSync, statSync, symlinkSync, utimesSync, writeFileSync } from "node:fs";
|
||||
import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, statSync, utimesSync, writeFileSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { compareSemVer, getMirrorMode, isHomebrewInstall, isNewerVersion, matchAssetForPlatform, pruneUpdateLeftovers } from "./update.js";
|
||||
import { compareSemVer, getMirrorMode, handleUpdateCommand, isNewerVersion, matchAssetForPlatform, pruneUpdateLeftovers } from "./update.js";
|
||||
|
||||
type Asset = { name: string; downloadUrl: string; size: number };
|
||||
|
||||
@@ -241,33 +241,58 @@ describe("update command bgSave and cache integration", () => {
|
||||
rmSync(tempDir, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe("isHomebrewInstall", () => {
|
||||
test("requires the executable to resolve inside Homebrew's registered formula prefix", () => {
|
||||
const root = mkdtempSync(join(tmpdir(), "seal-use-homebrew-detect-"));
|
||||
try {
|
||||
const formulaPrefix = join(root, "opt", "seal-use");
|
||||
const cellarBin = join(root, "Cellar", "seal-use", "0.10.33", "bin");
|
||||
const nativeBin = join(root, "bin");
|
||||
const formulaExecutable = join(cellarBin, "seal-use");
|
||||
const nativeExecutable = join(nativeBin, "seal-use");
|
||||
describe("update installation modes", () => {
|
||||
test("a copied source package cannot update its parent application's Git repository", async () => {
|
||||
const dir = mkdtempSync(join(tmpdir(), "seal-source-update-test-"));
|
||||
try {
|
||||
await expect(handleUpdateCommand({ appRoot: dir, entryFile: join(dir, "src", "cli.ts") }))
|
||||
.rejects.toMatchObject({ exitCode: 13 });
|
||||
expect(existsSync(join(dir, "bun.lock"))).toBe(false);
|
||||
} finally {
|
||||
rmSync(dir, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
mkdirSync(cellarBin, { recursive: true });
|
||||
mkdirSync(nativeBin, { recursive: true });
|
||||
mkdirSync(join(root, "opt"), { recursive: true });
|
||||
writeFileSync(formulaExecutable, "homebrew binary");
|
||||
writeFileSync(nativeExecutable, "native binary");
|
||||
symlinkSync(join(root, "Cellar", "seal-use", "0.10.33"), formulaPrefix);
|
||||
|
||||
expect(isHomebrewInstall(formulaExecutable, formulaPrefix)).toBe(true);
|
||||
expect(isHomebrewInstall(nativeExecutable, formulaPrefix)).toBe(false);
|
||||
} finally {
|
||||
rmSync(root, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
test("does not infer Homebrew from a matching directory name alone", () => {
|
||||
expect(isHomebrewInstall("/opt/homebrew/bin/seal-use", "/tmp/not-installed-seal-use")).toBe(false);
|
||||
});
|
||||
test("native updates ignore package managers and allow selecting a release", async () => {
|
||||
const dir = mkdtempSync(join(tmpdir(), "seal-native-update-test-"));
|
||||
const originalExecPath = process.execPath;
|
||||
const originalEnv = { ...process.env };
|
||||
const originalFetch = globalThis.fetch;
|
||||
const originalLog = console.log;
|
||||
try {
|
||||
// Every executable, cache and response is a temp fixture; never update the running test engine.
|
||||
const binary = join(dir, "seal-use");
|
||||
const invoked = join(dir, "package-manager-invoked");
|
||||
writeFileSync(binary, "native fixture");
|
||||
writeFileSync(join(dir, "brew"), `#!/bin/sh\ntouch '${invoked}'\nprintf '%s\\n' '${dir}'\n`, { mode: 0o755 });
|
||||
process.execPath = binary;
|
||||
process.env.PATH = `${dir}:${originalEnv.PATH ?? ""}`;
|
||||
process.env.SEAL_USE_UPDATE_CACHE_FILE = join(dir, "update-cache.json");
|
||||
process.env.SEAL_USE_MIRROR = "github";
|
||||
globalThis.fetch = Object.assign(async () => new Response(JSON.stringify([
|
||||
{ tag_name: "v100.0.0", assets: [] },
|
||||
{ tag_name: "v99.0.0", assets: [] }
|
||||
]), { headers: { "Content-Type": "application/json" } }), { preconnect: originalFetch.preconnect });
|
||||
let stdout = "";
|
||||
console.log = (message: string) => { stdout += message; };
|
||||
const runtime = { appRoot: dir, entryFile: join(dir, "src", "cli.ts") };
|
||||
await handleUpdateCommand(runtime, { checkOnly: true, targetVersion: "99.0.0" });
|
||||
expect(JSON.parse(stdout)).toMatchObject({ mode: "binary", latestVersion: "99.0.0", updateAvailable: true });
|
||||
stdout = "";
|
||||
// Reaching asset selection proves explicit versions are not blocked by a removed installation mode.
|
||||
await expect(handleUpdateCommand(runtime, { targetVersion: "v99.0.0" }))
|
||||
.rejects.toThrow("in release v99.0.0");
|
||||
expect(stdout).toBe("");
|
||||
expect(existsSync(invoked)).toBe(false);
|
||||
expect(readFileSync(binary, "utf8")).toBe("native fixture");
|
||||
} finally {
|
||||
process.execPath = originalExecPath;
|
||||
process.env = originalEnv;
|
||||
globalThis.fetch = originalFetch;
|
||||
console.log = originalLog;
|
||||
rmSync(dir, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
});
|
||||
+5
-287
@@ -1,13 +1,13 @@
|
||||
import { chmodSync, existsSync, mkdirSync, readdirSync, realpathSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync } from "node:fs";
|
||||
import { basename, dirname, isAbsolute, join, relative } from "node:path";
|
||||
import { spawn, spawnSync } from "node:child_process";
|
||||
import { chmodSync, existsSync, mkdirSync, readdirSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync } from "node:fs";
|
||||
import { basename, dirname, join } from "node:path";
|
||||
import { spawnSync } from "node:child_process";
|
||||
import { isCompiledBinary } from "../../core/runtime.js";
|
||||
import { normalizeBeijingIso } from "../../core/config/timestamps.js";
|
||||
import { readInstalledSkillVersion } from "../../core/embedded-skill.js";
|
||||
import { saveUpdateCache } from "../../core/update-cache.js";
|
||||
import { VERSION, IS_RELEASE } from "../../version.js";
|
||||
import { printJson } from "../printer.js";
|
||||
import { CliError, validationError } from "../../core/errors.js";
|
||||
import { validationError } from "../../core/errors.js";
|
||||
import type { CliRuntime } from "../types.js";
|
||||
|
||||
const DEFAULT_GITHUB_REPO = "yunyingk/seal-use";
|
||||
@@ -150,20 +150,7 @@ export async function handleUpdateCommand(runtime: CliRuntime, options: UpdateOp
|
||||
return;
|
||||
}
|
||||
|
||||
// 3. Homebrew managed mode
|
||||
if (isHomebrewInstall()) {
|
||||
try {
|
||||
await handleHomebrewUpdate(options, repo, targetVersion);
|
||||
return;
|
||||
} catch (err) {
|
||||
if (err instanceof CliError) throw err;
|
||||
console.error(
|
||||
`⚠️ Homebrew 自动更新失败,回退至原生二进制更新: ${err instanceof Error ? err.message : String(err)}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// 4. Standalone binary mode: check GitHub Releases
|
||||
// 3. Standalone binary mode: check GitHub Releases
|
||||
const platform = detectPlatform();
|
||||
const arch = detectArch();
|
||||
|
||||
@@ -207,18 +194,6 @@ export async function handleUpdateCommand(runtime: CliRuntime, options: UpdateOp
|
||||
return;
|
||||
}
|
||||
|
||||
if (targetVersion && !options.checkOnly) {
|
||||
printJson({
|
||||
updated: false,
|
||||
currentVersion: VERSION,
|
||||
targetVersion,
|
||||
latestVersion,
|
||||
mode: "homebrew",
|
||||
message: "Homebrew-managed installations follow the formula version and do not support selecting a historical release. Use Homebrew directly for version pinning."
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (options.checkOnly) {
|
||||
printJson({
|
||||
updated: false,
|
||||
@@ -436,18 +411,6 @@ function installSkillFromInstalledBinary(
|
||||
return { targetDir, version };
|
||||
}
|
||||
|
||||
/** Homebrew may change the formula prefix; PATH can still contain an older standalone command. */
|
||||
export function installHomebrewSkill(targetVersion: string): { targetDir?: string; version?: string } {
|
||||
const prefix = homebrewFormulaPrefix();
|
||||
if (!prefix) throw validationError("Cannot resolve the updated Homebrew seal-use formula prefix.");
|
||||
try {
|
||||
return installSkillFromInstalledBinary(join(prefix, "bin", "seal-use"), targetVersion);
|
||||
} catch (error) {
|
||||
// The formula was already upgraded. Do not fall back to replacing the old running Cellar image.
|
||||
throw validationError(error instanceof Error ? error.message : String(error));
|
||||
}
|
||||
}
|
||||
|
||||
function detectPlatform(): "darwin" | "linux" | "windows" {
|
||||
if (process.platform === "darwin") return "darwin";
|
||||
if (process.platform === "win32") return "windows";
|
||||
@@ -458,251 +421,6 @@ function detectArch(): "arm64" | "x64" {
|
||||
return process.arch === "arm64" ? "arm64" : "x64";
|
||||
}
|
||||
|
||||
export function homebrewFormulaPrefix(): string | undefined {
|
||||
try {
|
||||
const result = spawnSync("brew", ["--prefix", "seal-use"], {
|
||||
stdio: ["ignore", "pipe", "ignore"],
|
||||
encoding: "utf-8",
|
||||
env: { ...process.env }
|
||||
});
|
||||
if (result.status !== 0 || typeof result.stdout !== "string") return undefined;
|
||||
const prefix = result.stdout.trim();
|
||||
return prefix || undefined;
|
||||
} catch {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
function homebrewInstalledVersion(): string | undefined {
|
||||
try {
|
||||
const result = spawnSync("brew", ["list", "--versions", "seal-use"], {
|
||||
stdio: ["ignore", "pipe", "ignore"],
|
||||
encoding: "utf-8"
|
||||
});
|
||||
if (result.status !== 0 || typeof result.stdout !== "string") return undefined;
|
||||
const parts = result.stdout.trim().split(/\s+/);
|
||||
return parts.length >= 2 ? parts[parts.length - 1] : undefined;
|
||||
} catch {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
export function isHomebrewInstall(
|
||||
execPath = process.execPath,
|
||||
formulaPrefix = homebrewFormulaPrefix()
|
||||
): boolean {
|
||||
if (!formulaPrefix) return false;
|
||||
|
||||
try {
|
||||
const resolvedExec = realpathSync(execPath);
|
||||
const resolvedPrefix = realpathSync(formulaPrefix);
|
||||
const fromFormula = relative(resolvedPrefix, resolvedExec);
|
||||
const parentPrefix = `..${process.platform === "win32" ? "\\" : "/"}`;
|
||||
return Boolean(fromFormula && fromFormula !== ".." && !fromFormula.startsWith(parentPrefix) && !isAbsolute(fromFormula));
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async function handleHomebrewUpdate(
|
||||
options: UpdateOptions,
|
||||
repo: string,
|
||||
targetVersion?: string
|
||||
): Promise<void> {
|
||||
const releases = await fetchGitHubReleases(repo, 30);
|
||||
const release = targetVersion
|
||||
? (releases.find((r) => r.version === targetVersion || r.tagName === targetVersion || r.tagName === `v${targetVersion}`) ??
|
||||
await fetchGitHubRelease(repo, targetVersion))
|
||||
: (releases[0] ?? await fetchGitHubRelease(repo));
|
||||
|
||||
const latestVersion = release?.version ?? VERSION;
|
||||
const isUpgrade = isNewerVersion(latestVersion, VERSION);
|
||||
const shouldUpdate = isUpgrade || Boolean(options.force);
|
||||
|
||||
if (release?.version) {
|
||||
saveUpdateCache({
|
||||
latestVersion: release.version,
|
||||
publishedAt: release.publishedAt,
|
||||
releaseUrl: release.htmlUrl
|
||||
});
|
||||
}
|
||||
|
||||
if (options.bgSave) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (options.checkOnly) {
|
||||
const currentRelease = releases.find((r) => r.version === VERSION);
|
||||
const pendingReleases = releases.filter((r) => isNewerVersion(r.version, VERSION));
|
||||
printJson({
|
||||
updated: false,
|
||||
updateAvailable: isUpgrade,
|
||||
currentVersion: VERSION,
|
||||
currentVersionPublishedAt: currentRelease?.publishedAt,
|
||||
latestVersion,
|
||||
latestVersionPublishedAt: release?.publishedAt,
|
||||
behindCount: pendingReleases.length,
|
||||
pendingReleases: pendingReleases.map((r) => ({
|
||||
version: r.version,
|
||||
tagName: r.tagName,
|
||||
publishedAt: r.publishedAt,
|
||||
author: r.author,
|
||||
releaseNotes: r.notes,
|
||||
releaseUrl: r.htmlUrl
|
||||
})),
|
||||
releaseNotes: release?.notes ?? "",
|
||||
releaseUrl: release?.htmlUrl ?? "",
|
||||
mode: "homebrew"
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (!shouldUpdate) {
|
||||
printJson({
|
||||
updated: false,
|
||||
currentVersion: VERSION,
|
||||
latestVersion,
|
||||
mode: "homebrew",
|
||||
message: `seal-use is already up to date (v${VERSION})`
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
console.error("ℹ️ 检测到当前 seal-use 由 Homebrew 管理。");
|
||||
console.error("📦 正在通过 Homebrew 极速更新: brew update && brew upgrade seal-use ...");
|
||||
|
||||
const installedBefore = homebrewInstalledVersion();
|
||||
const alreadyLatestBeforeUpdate = installedBefore
|
||||
? !isNewerVersion(latestVersion, installedBefore)
|
||||
: false;
|
||||
let alreadyLatest = alreadyLatestBeforeUpdate;
|
||||
// `brew update` refreshes all configured taps. Passing a tap name here is
|
||||
// parsed as a formula upgrade by newer Homebrew versions (and fails with
|
||||
// "No available formula ... tap").
|
||||
const tapUpdate = await runHomebrewCommand(
|
||||
["update"],
|
||||
"🔄 [1/2] 正在刷新 Homebrew 软件源(可能需要几分钟)..."
|
||||
);
|
||||
|
||||
if (tapUpdate.status !== 0) {
|
||||
const msg = tapUpdate.stderr?.trim() || tapUpdate.stdout?.trim();
|
||||
throw new Error(`brew update failed (exit ${tapUpdate.status}): ${msg || "unknown error"}`);
|
||||
}
|
||||
|
||||
// 2. Upgrade the formula
|
||||
const upgradeRes = await runHomebrewCommand(
|
||||
["upgrade", "seal-use"],
|
||||
"⬆️ [2/2] 正在升级 seal-use..."
|
||||
);
|
||||
|
||||
const outCombined = `${upgradeRes.stdout || ""} ${upgradeRes.stderr || ""}`;
|
||||
const brewReportsAlreadyLatest =
|
||||
outCombined.includes("already installed") || outCombined.includes("latest version already installed");
|
||||
|
||||
if (upgradeRes.status !== 0 && !brewReportsAlreadyLatest) {
|
||||
throw new Error(
|
||||
`brew upgrade seal-use failed (exit ${upgradeRes.status}): ${upgradeRes.stderr.trim() || upgradeRes.stdout.trim()}`
|
||||
);
|
||||
}
|
||||
|
||||
const installedVersion = homebrewInstalledVersion();
|
||||
if (installedVersion && isNewerVersion(latestVersion, installedVersion)) {
|
||||
throw new Error(
|
||||
`Homebrew still has seal-use v${installedVersion}; expected v${latestVersion}. ` +
|
||||
"Refresh the tap and run `brew upgrade seal-use` again."
|
||||
);
|
||||
}
|
||||
alreadyLatest = alreadyLatestBeforeUpdate;
|
||||
|
||||
// Refresh installed skill through new binary
|
||||
installHomebrewSkill(latestVersion);
|
||||
|
||||
console.error(
|
||||
alreadyLatest
|
||||
? "ℹ️ seal-use 已是 Homebrew 中的最新版本。"
|
||||
: "✅ seal-use 已通过 Homebrew 成功更新!"
|
||||
);
|
||||
|
||||
printJson({
|
||||
updated: !alreadyLatest,
|
||||
previousVersion: VERSION,
|
||||
latestVersion,
|
||||
mode: "homebrew",
|
||||
message: alreadyLatest
|
||||
? `seal-use is already at the latest version v${latestVersion} in Homebrew`
|
||||
: `Successfully upgraded seal-use to v${latestVersion} via Homebrew`
|
||||
});
|
||||
}
|
||||
|
||||
type HomebrewCommandResult = {
|
||||
status: number | null;
|
||||
signal: NodeJS.Signals | null;
|
||||
stdout: string;
|
||||
stderr: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Runs Homebrew without buffering its output until completion. Homebrew can spend several minutes
|
||||
* refreshing taps or downloading a formula, so its output belongs on stderr as live diagnostics;
|
||||
* stdout must remain reserved for the command's final machine-readable JSON payload.
|
||||
*/
|
||||
function runHomebrewCommand(args: string[], startMessage: string): Promise<HomebrewCommandResult> {
|
||||
console.error(startMessage);
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
let child;
|
||||
try {
|
||||
child = spawn("brew", args, {
|
||||
stdio: ["ignore", "pipe", "pipe"],
|
||||
env: { ...process.env, NONINTERACTIVE: "1" }
|
||||
});
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
return;
|
||||
}
|
||||
|
||||
let stdout = "";
|
||||
let stderr = "";
|
||||
let lastOutputAt = Date.now();
|
||||
let settled = false;
|
||||
|
||||
const forward = (chunk: Buffer, stream: "stdout" | "stderr") => {
|
||||
const text = chunk.toString();
|
||||
if (stream === "stdout") stdout += text;
|
||||
else stderr += text;
|
||||
lastOutputAt = Date.now();
|
||||
try {
|
||||
process.stderr.write(text);
|
||||
} catch {
|
||||
// Ignore a closed diagnostic stream; the child process still needs to complete normally.
|
||||
}
|
||||
};
|
||||
|
||||
child.stdout?.on("data", (chunk: Buffer) => forward(chunk, "stdout"));
|
||||
child.stderr?.on("data", (chunk: Buffer) => forward(chunk, "stderr"));
|
||||
|
||||
const heartbeat = setInterval(() => {
|
||||
if (Date.now() - lastOutputAt >= 15000) {
|
||||
console.error("⏳ Homebrew 仍在运行,当前没有新的输出,请稍候...");
|
||||
lastOutputAt = Date.now();
|
||||
}
|
||||
}, 15000);
|
||||
heartbeat.unref?.();
|
||||
|
||||
const finish = (callback: () => void) => {
|
||||
if (settled) return;
|
||||
settled = true;
|
||||
clearInterval(heartbeat);
|
||||
callback();
|
||||
};
|
||||
|
||||
child.once("error", (error) => finish(() => reject(error)));
|
||||
child.once("close", (status, signal) =>
|
||||
finish(() => resolve({ status, signal, stdout, stderr }))
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
type GitHubAsset = {
|
||||
name: string;
|
||||
downloadUrl: string;
|
||||
|
||||
@@ -120,12 +120,11 @@ export function diagnoseSystem(): DoctorDiagnosis {
|
||||
const exportDir = join(home, "Downloads");
|
||||
|
||||
const globalBinaryCandidates = [
|
||||
"/opt/homebrew/bin/seal-use",
|
||||
"/usr/local/bin/seal-use",
|
||||
join(home, ".local", "bin", "seal-use"),
|
||||
join(home, "bin", "seal-use")
|
||||
];
|
||||
const detectedBinary = globalBinaryCandidates.find((p) => existsSync(p)) ?? process.execPath;
|
||||
const detectedBinary = Bun.which("seal-use") ?? globalBinaryCandidates.find((p) => existsSync(p)) ?? process.execPath;
|
||||
|
||||
const directories: Record<string, DirectoryHealth> = {
|
||||
configDir: {
|
||||
|
||||
@@ -71,7 +71,7 @@ export const EMBEDDED_DIRECTORY_SPECS: DirectorySpec[] = [
|
||||
{
|
||||
name: "全局命令行程序",
|
||||
category: "binary",
|
||||
standardPath: "/opt/homebrew/bin/seal-use",
|
||||
standardPath: "/usr/local/bin/seal-use",
|
||||
purpose: "macOS / Linux 全局独立单文件二进制程序;旧版 seal-home 命令仅保留解析兼容,不再新建全局别名。",
|
||||
accessMode: "executable",
|
||||
retention: "persistent"
|
||||
|
||||
Reference in new issue
Block a user