diff --git a/src/main.ts b/src/main.ts index 3d5e242..59ee589 100644 --- a/src/main.ts +++ b/src/main.ts @@ -3,6 +3,16 @@ * opencli — Make any website your CLI. AI-powered. */ +// Ensure standard system paths are available for child processes. +// Some environments (GUI apps, cron, IDE terminals) launch with a minimal PATH +// that excludes /usr/local/bin, /usr/sbin, etc., causing external CLIs to fail. +if (process.platform !== 'win32') { + const std = ['/usr/local/bin', '/usr/bin', '/bin', '/usr/sbin', '/sbin']; + const cur = new Set((process.env.PATH ?? '').split(':').filter(Boolean)); + for (const p of std) cur.add(p); + process.env.PATH = [...cur].join(':'); +} + import * as os from 'node:os'; import * as path from 'node:path'; import { fileURLToPath } from 'node:url';