mirror of
https://github.com/openclaw/lobster.git
synced 2026-07-19 23:35:13 -04:00
25 lines
713 B
JavaScript
Executable File
25 lines
713 B
JavaScript
Executable File
#!/usr/bin/env node
|
|
|
|
import { spawnSync } from "node:child_process";
|
|
import { dirname, join } from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
function shellQuote(arg) {
|
|
if (/^[A-Za-z0-9_\-./:=@]+$/.test(arg)) return arg;
|
|
return `'${String(arg).replace(/'/g, `'\\''`)}'`;
|
|
}
|
|
|
|
const argv = process.argv.slice(2);
|
|
const pipeline = ["clawd.invoke", ...argv.map(shellQuote)].join(" ");
|
|
const lobsterBin = join(dirname(fileURLToPath(import.meta.url)), "lobster.js");
|
|
|
|
const res = spawnSync(process.execPath, [lobsterBin, pipeline], {
|
|
stdio: "inherit",
|
|
env: process.env,
|
|
});
|
|
if (res.error) {
|
|
console.error(`clawd.invoke failed to spawn lobster: ${res.error.message}`);
|
|
}
|
|
|
|
process.exit(res.status ?? 1);
|