Group core utility modules into util, skill, and update

Move duration, redact, runtime, secure-file, and semver under core/util; embedded-skill and skill-version under core/skill; update-cache under core/update. Move the dev-override test next to the script it covers, and update the embedded-skill generator output path and regenerated manifest. No behavior change.
This commit is contained in:
gitea committed 2026-11-19 16:31:50 +08:00
1 parent 666a12c676
commit a189f49223
44 files changed
+146 -145

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
import { describe, expect, test } from "bun:test";
import { isCompiledBinary, resolveAppRoot, resolveDefaultLauncher } from "./runtime.js";
describe("runtime detection and launcher", () => {
test("isCompiledBinary detects bun runtime executable vs standalone binary", () => {
expect(isCompiledBinary("/Users/user/.bun/bin/bun", "file:///Users/user/code/src/cli.ts")).toBe(false);
expect(isCompiledBinary("C:\\Users\\user\\.bun\\bin\\bun.exe", "file:///C:/code/src/cli.ts")).toBe(false);
expect(isCompiledBinary("/usr/local/bin/seal-home", "file:///Users/user/code/src/cli.ts")).toBe(true);
expect(isCompiledBinary("/Users/user/.bun/bin/bun", "file:///$bunfs/root/src/cli.ts")).toBe(true);
});
test("resolveAppRoot returns cwd for compiled binary and project root for source", () => {
const sourceRoot = resolveAppRoot("/Users/user/code/src/cli.ts", false);
expect(sourceRoot).toBe("/Users/user/code");
const binaryRoot = resolveAppRoot(undefined, true);
expect(binaryRoot).toBe(process.cwd());
});
test("resolveDefaultLauncher configures args based on compiled mode", () => {
const sourceLauncher = resolveDefaultLauncher("/Users/user/code/src/cli.ts", false, "/path/to/bun");
expect(sourceLauncher).toEqual({
command: "/path/to/bun",
args: ["/Users/user/code/src/cli.ts"]
});
const binaryLauncher = resolveDefaultLauncher("/ignored", true, "/usr/local/bin/seal-home");
expect(binaryLauncher).toEqual({
command: "/usr/local/bin/seal-home",
args: []
});
});
});