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(build): resolve headers from direct test runs

IgnoreMeBut4bf14ac6933b
diff --git a/scripts/build-notification-permission-addon.cjs b/scripts/build-notification-permission-addon.cjs
index dc1a0c83..9555c33f 100644
--- a/scripts/build-notification-permission-addon.cjs
+++ b/scripts/build-notification-permission-addon.cjs
@@ -37,6 +37,10 @@ function removeDarwinOutputs(exceptArch = null, root = outputDir) {
* binary, whose dist ships no headers. `npm_node_execpath` is the Node that
* launched the npm script, which is where a nvm/fnm install keeps its headers
* — without it, a machine with no Homebrew or system Node cannot build at all.
+ * `ORKAS_TEST_NODE` is the same outer Node, stamped by `scripts/run-tests.mjs`
+ * itself: it covers the runner being invoked directly (`node
+ * scripts/run-tests.mjs ...`), where npm sets no variables at all and the
+ * whole macOS suite would otherwise fail to build for the wrong reason.
*/
function findNodeHeaders({
env = process.env,
@@ -48,6 +52,7 @@ function findNodeHeaders({
env.npm_config_nodedir && path.resolve(env.npm_config_nodedir, 'include', 'node'),
includeDirOf(execPath),
env.npm_node_execpath && includeDirOf(env.npm_node_execpath),
+ env.ORKAS_TEST_NODE && includeDirOf(env.ORKAS_TEST_NODE),
'/opt/homebrew/include/node',
'/usr/local/include/node',
'/usr/include/node',
diff --git a/test/main/util/build-notification-permission-addon.test.ts b/test/main/util/build-notification-permission-addon.test.ts
index b3caaac6..602ab474 100644
--- a/test/main/util/build-notification-permission-addon.test.ts
+++ b/test/main/util/build-notification-permission-addon.test.ts
@@ -194,6 +194,16 @@ describe('notification permission native addon build', () => {
exists: has(nodedirHeaders, nvmHeaders),
})).toBe(nodedirHeaders);
+ // Invoking `scripts/run-tests.mjs` directly sets none of npm's variables,
+ // so the runner's own record of the outer Node has to carry the lookup —
+ // otherwise the macOS native suite fails on the harness rather than on the
+ // behavior it covers.
+ expect(addonBuilder.findNodeHeaders({
+ env: { ORKAS_TEST_NODE: nvmNode },
+ execPath: electron,
+ exists: has(nvmHeaders),
+ })).toBe(nvmHeaders);
+
// Negative control: with nothing available it must fail loudly and name
// the escape hatch, never hand the compiler a directory that is not there.
expect(() => addonBuilder.findNodeHeaders({