🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
TypeScript agentic-aiagentic-frameworkagentic-workflowagentsai-agentsai-assistantai-skillsautonomous-agentsclaudecodexdsh-pluginharnessmcp-servermulti-agentmulti-agent-systemsnpmskillsswarmswarm-intelligencetypescript
fix(scripts): build codex-mod hook bundles the same way on every OS
Mathew Beane14cdcbf07de7
diff --git a/scripts/build-codex-mod-hooks.mjs b/scripts/build-codex-mod-hooks.mjsindex 54f86d8315..71f93b71fe 100644--- a/scripts/build-codex-mod-hooks.mjs+++ b/scripts/build-codex-mod-hooks.mjs@@ -4,32 +4,31 @@ import fs from 'node:fs';import path from 'node:path';import os from 'node:os';import { execFileSync } from 'node:child_process';+import { createRequire } from 'node:module';import { fileURLToPath } from 'node:url';-const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');-const isWin = process.platform === 'win32';-const esbuildCmd = isWin ? 'npx' : (process.env.ESBUILD ?? path.join(root, 'node_modules', '.bin', 'esbuild'));+const options = ['--bundle', '--platform=node', '--target=node20', '--format=cjs', '--minify-whitespace'];+// ESBUILD names an executable (CI pins one); run it directly, never through a shell. Without it, use the+// repo's own esbuild through its JS API, which needs no .bin shim and behaves the same on every OS.+const bundle = process.env.ESBUILD ? (entry, output) => {+ execFileSync(process.env.ESBUILD, [entry, ...options, `--outfile=${output}`], { stdio: 'pipe' });+ return fs.readFileSync(output, 'utf8');+} : (() => {+ let esbuild;+ try { esbuild = createRequire(path.join(root, 'package.json'))('esbuild'); } catch {+ throw new Error('esbuild is not installed: run npm install at the repo root, or set ESBUILD to an esbuild executable');+ }+ return (entry, output) => esbuild.buildSync({ entryPoints: [entry], bundle: true, platform: 'node', target: 'node20', format: 'cjs', minifyWhitespace: true, outfile: output, write: false, logLevel: 'silent' }).outputFiles[0].text;+})();const temp = fs.mkdtempSync(path.join(os.tmpdir(), 'ruflo-codex-mod-build-'));-try {for (const name of ['adr', 'ddd', 'sparc']) {const target = path.join(root, `plugins/ruflo-${name}/hooks/codex-hook.cjs`);const output = path.join(temp, `${name}.cjs`);-- const args = isWin- ? ['esbuild', path.join(root, `plugins/ruflo-${name}/hooks/codex.ts`), '--bundle', '--platform=node', '--target=node20', '--format=cjs', '--minify-whitespace', `--outfile=${output}`]- : [path.join(root, `plugins/ruflo-${name}/hooks/codex.ts`), '--bundle', '--platform=node', '--target=node20', '--format=cjs', '--minify-whitespace', `--outfile=${output}`];-- execFileSync(esbuildCmd, args, { stdio: 'pipe', shell: isWin });-- const bytes = `// Generated by scripts/build-codex-mod-hooks.mjs; edit codex.ts or shared runtime, not this bundle.\n${fs.readFileSync(output, 'utf8')}`;+ const bytes = `// Generated by scripts/build-codex-mod-hooks.mjs; edit codex.ts or shared runtime, not this bundle.\n${bundle(path.join(root, `plugins/ruflo-${name}/hooks/codex.ts`), output)}`;if (process.argv.includes('--check')) {if (!fs.existsSync(target) || fs.readFileSync(target, 'utf8') !== bytes) throw new Error(`${name}: native bundle drift; rebuild before release`);- } else {- fs.writeFileSync(target, bytes);- }+ } else fs.writeFileSync(target, bytes);}console.log('codex-mod-hooks: three bundles match their shared sources');-} finally {- fs.rmSync(temp, { recursive: true, force: true });-}\ No newline at end of file+} finally { fs.rmSync(temp, { recursive: true, force: true }); }