Files
openclaw/src/entry.ts

33 lines
889 B
TypeScript
Raw Normal View History

2026-01-05 01:25:37 +01:00
#!/usr/bin/env node
import process from "node:process";
import { applyCliProfileEnv, parseCliProfileArgs } from "./cli/profile.js";
if (process.argv.includes("--no-color")) {
process.env.NO_COLOR = "1";
process.env.FORCE_COLOR = "0";
}
2026-01-05 01:25:37 +01:00
const parsed = parseCliProfileArgs(process.argv);
if (!parsed.ok) {
// Keep it simple; Commander will handle rich help/errors after we strip flags.
console.error(`[clawdbot] ${parsed.error}`);
process.exit(2);
}
if (parsed.profile) {
applyCliProfileEnv({ profile: parsed.profile });
// Keep Commander and ad-hoc argv checks consistent.
process.argv = parsed.argv;
}
2026-01-12 10:35:50 +00:00
import("./cli/run-main.js")
.then(({ runCli }) => runCli(process.argv))
.catch((error) => {
console.error(
"[clawdbot] Failed to start CLI:",
2026-01-12 10:52:34 +00:00
error instanceof Error ? (error.stack ?? error.message) : error,
2026-01-12 10:35:50 +00:00
);
process.exitCode = 1;
});