MCPcopy Create free account
hub / github.com/Bitterbot-AI/bitterbot-desktop / runCommandWithRuntime

Function runCommandWithRuntime

src/cli/cli-utils.ts:34–49  ·  view source on GitHub ↗
(
  runtime: { error: (message: string) => void; exit: (code: number) => void },
  action: () => Promise<void>,
  onError?: (error: unknown) => void,
)

Source from the content-addressed store, hash-verified

32}
33
34export async function runCommandWithRuntime(
35 runtime: { error: (message: string) => void; exit: (code: number) => void },
36 action: () => Promise<void>,
37 onError?: (error: unknown) => void,
38): Promise<void> {
39 try {
40 await action();
41 } catch (err) {
42 if (onError) {
43 onError(err);
44 return;
45 }
46 runtime.error(String(err));
47 runtime.exit(1);
48 }
49}
50
51export function resolveOptionFromCommand<T>(
52 command: Command | undefined,

Callers 15

runModelsCommandFunction · 0.85
registerDocsCliFunction · 0.85
runBrowserObserveFunction · 0.85
runBrowserCommandFunction · 0.85
runBrowserDebugFunction · 0.85
runChannelsCommandFunction · 0.85
runBrowserCommandFunction · 0.85
runNodesCommandFunction · 0.85
registerSetupCommandFunction · 0.85
registerAgentCommandsFunction · 0.85

Calls 2

errorMethod · 0.80
onErrorFunction · 0.50

Tested by

no test coverage detected