openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
39 lines (38 loc) • 1.6 kB
JavaScript
import { d as isRootVersionInvocation } from "./argv-DNjh_yaF.js";
import { r as resolveCliContainerTarget } from "./container-target-yd6OnwF_.js";
//#region src/entry.version-fast-path.ts
function tryHandleRootVersionFastPath(argv, deps = {}) {
if (resolveCliContainerTarget(argv, deps.env)) return false;
if (!isRootVersionInvocation(argv)) return false;
const output = deps.output ?? ((message) => console.log(message));
const exit = deps.exit ?? ((code) => process.exit(code));
const onError = deps.onError ?? (async (error) => {
const message = `[openclaw] Failed to resolve version: ${error instanceof Error ? error.stack ?? error.message : String(error)}\n`;
try {
const [{ loadCliDotEnv }, { formatConsoleDiagnosticBlock }] = await Promise.all([import("./dotenv-Bvm6eLnE.js"), import("./json-console-line-kiRP3hor.js")]);
loadCliDotEnv({ quiet: true });
process.stderr.write(formatConsoleDiagnosticBlock({
level: "error",
message
}));
} catch {
process.stderr.write(message);
} finally {
exit(1);
}
});
(deps.resolveVersion ?? (async () => {
const [{ VERSION }, { resolveCommitHash }] = await Promise.all([import("./version-avvr-e37.js"), import("./git-commit-BZ2yb9DD.js")]);
return {
VERSION,
resolveCommitHash
};
}))().then(({ VERSION, resolveCommitHash }) => {
const commit = resolveCommitHash({ moduleUrl: deps.moduleUrl ?? import.meta.url });
output(commit ? `OpenClaw ${VERSION} (${commit})` : `OpenClaw ${VERSION}`);
exit(0);
}).catch(onError);
return true;
}
//#endregion
export { tryHandleRootVersionFastPath as t };