mirror of
https://github.com/openclaw/openclaw.git
synced 2026-02-19 18:39:20 -05:00
Add shared parseBooleanValue()/isTruthyEnvValue() and apply across CLI, gateway, memory, and live-test flags for consistent env handling. Introduce route-first fast paths, lazy subcommand registration, and deferred plugin loading to reduce CLI startup overhead. Centralize config validation via ensureConfigReady() and add config caching/deferred shell env fallback for fewer IO passes. Harden logger initialization/imports and add focused tests for argv, boolean parsing, frontmatter, and CLI subcommands.
20 lines
558 B
TypeScript
20 lines
558 B
TypeScript
import { VERSION } from "../../version.js";
|
|
import { resolveCliChannelOptions } from "../channel-options.js";
|
|
|
|
export type ProgramContext = {
|
|
programVersion: string;
|
|
channelOptions: string[];
|
|
messageChannelOptions: string;
|
|
agentChannelOptions: string;
|
|
};
|
|
|
|
export function createProgramContext(): ProgramContext {
|
|
const channelOptions = resolveCliChannelOptions();
|
|
return {
|
|
programVersion: VERSION,
|
|
channelOptions,
|
|
messageChannelOptions: channelOptions.join("|"),
|
|
agentChannelOptions: ["last", ...channelOptions].join("|"),
|
|
};
|
|
}
|