function shouldForceReadOnlyAuthStore(argv: string[]): boolean { const tokens = argv.slice(2).filter((token) => token.length > 0 && !token.startsWith("-")); for (let index = 0; index < tokens.length - 1; index += 1) { if (tokens[index] === "secrets" && tokens[index + 1] === "audit") { returntrue;
}
} returnfalse;
}
// Guard: only run entry-point logic when this file is the main module. // The bundler may import entry.js as a shared dependency when dist/index.js // is the actual entry point; without this guard the top-level code below // would call runCli a second time, starting a duplicate gateway that fails // on the lock / port and crashes the process. if (
!isMainModule({
currentFile: fileURLToPath(import.meta.url),
wrapperEntryPairs: [...ENTRY_WRAPPER_PAIRS],
})
) { // Imported as a dependency — skip all entry-point side effects.
} else {
process.title = "openclaw";
ensureOpenClawExecMarkerOnProcess();
installProcessWarningFilter();
normalizeEnv(); if (!isTruthyEnvValue(process.env.NODE_DISABLE_COMPILE_CACHE)) { try {
enableCompileCache();
} catch { // Best-effort only; never block startup.
}
}
if (shouldForceReadOnlyAuthStore(process.argv)) {
process.env.OPENCLAW_AUTH_STORE_READONLY = "1";
}
if (process.argv.includes("--no-color")) {
process.env.NO_COLOR = "1";
process.env.FORCE_COLOR = "0";
}
function ensureCliRespawnReady(): boolean { const plan = buildCliRespawnPlan(); if (!plan) { returnfalse;
}
if (!ensureCliRespawnReady()) { const parsedContainer = parseCliContainerArgs(process.argv); if (!parsedContainer.ok) {
console.error(`[openclaw] ${parsedContainer.error}`);
process.exit(2);
}
const parsed = parseCliProfileArgs(parsedContainer.argv); if (!parsed.ok) { // Keep it simple; Commander will handle rich help/errors after we strip flags.
console.error(`[openclaw] ${parsed.error}`);
process.exit(2);
}
const containerTargetName = resolveCliContainerTarget(process.argv); if (containerTargetName && parsed.profile) {
console.error("[openclaw] --container cannot be combined with --profile/--dev");
process.exit(2);
}
if (parsed.profile) {
applyCliProfileEnv({ profile: parsed.profile }); // Keep Commander and ad-hoc argv checks consistent.
process.argv = parsed.argv;
}
if (!tryHandleRootVersionFastPath(process.argv)) {
runMainOrRootHelp(process.argv);
}
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.