Skip to content

armgit / Orkas

Public Imported from GitHub
0

Orkas is an open-source (MIT), local-first AI team for your desktop: a Commander turns your goal into to-dos and coordinates 16 built-in specialist agents plus Claude Code, Codex, OpenCode, OpenClaw and Hermes, with projects, scheduled automations and connectors. Free app for macOS & Windows; built-in models or your own keys.

fix: support Windows dependency cross-build paths

wytc55b023df792
diff --git a/scripts/prepare-win-native-deps.cjs b/scripts/prepare-win-native-deps.cjs
index be8e3b63..6f66e31c 100644
--- a/scripts/prepare-win-native-deps.cjs
+++ b/scripts/prepare-win-native-deps.cjs
@@ -76,10 +76,13 @@ function allFilesExist(files) {
function extractTarballInTarget(targetDir, tarball, deps = {}) {
const fsImpl = deps.fsImpl || fs;
const runImpl = deps.runImpl || run;
- // This helper always prepares a Windows target, including when its behavior
- // is validated from a non-Windows host.
- const archiveName = path.win32.basename(tarball);
- const localTarball = path.win32.join(targetDir, archiveName);
+ // Cross-builds use host-native paths even though the extracted package is a
+ // Windows target. Keep Windows-shaped paths testable from a non-Windows host.
+ const pathImpl = path.win32.isAbsolute(targetDir) && !path.posix.isAbsolute(targetDir)
+ ? path.win32
+ : path.posix.isAbsolute(targetDir) ? path.posix : path;
+ const archiveName = pathImpl.basename(tarball);
+ const localTarball = pathImpl.join(targetDir, archiveName);
fsImpl.copyFileSync(tarball, localTarball);
try {
// GNU tar treats a Windows absolute archive path (`C:\...`) as a remote
diff --git a/test/main/util/prepare-win-native-deps.test.ts b/test/main/util/prepare-win-native-deps.test.ts
index 15f2f8ae..cbd55d2c 100644
--- a/test/main/util/prepare-win-native-deps.test.ts
+++ b/test/main/util/prepare-win-native-deps.test.ts
@@ -71,6 +71,29 @@ describe('prepare-win-native-deps Windows filesystem behavior', () => {
expect(rmSync).toHaveBeenCalledWith(localArchive, { force: true });
});
+ it('uses host-native paths when cross-building Windows dependencies', () => {
+ const copyFileSync = vi.fn();
+ const rmSync = vi.fn();
+ const runImpl = vi.fn();
+ const targetDir = '/tmp/orkas-win-build/node_modules/@esbuild/win32-x64';
+ const tarball = '/tmp/orkas-win-native-deps/esbuild-win32-x64-0.28.1.tgz';
+
+ prepare.extractTarballInTarget(
+ targetDir,
+ tarball,
+ { fsImpl: { copyFileSync, rmSync }, runImpl },
+ );
+
+ const localArchive = `${targetDir}/esbuild-win32-x64-0.28.1.tgz`;
+ expect(copyFileSync).toHaveBeenCalledWith(tarball, localArchive);
+ expect(runImpl).toHaveBeenCalledWith(
+ targetDir,
+ 'tar',
+ ['-xzf', 'esbuild-win32-x64-0.28.1.tgz', '--strip-components=1'],
+ );
+ expect(rmSync).toHaveBeenCalledWith(localArchive, { force: true });
+ });
+
it('prunes only matching native package directories', () => {
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'orkas-win-native-prune-'));
fixtureDirs.push(root);