refactor: share cli runtime error handling

This commit is contained in:
Peter Steinberger
2026-01-19 00:52:17 +00:00
parent c532d161c4
commit 1fec41b3df
16 changed files with 288 additions and 452 deletions

View File

@@ -4,6 +4,7 @@ import { docsSearchCommand } from "../commands/docs.js";
import { defaultRuntime } from "../runtime.js";
import { formatDocsLink } from "../terminal/links.js";
import { theme } from "../terminal/theme.js";
import { runCommandWithRuntime } from "./cli-utils.js";
export function registerDocsCli(program: Command) {
program
@@ -15,11 +16,8 @@ export function registerDocsCli(program: Command) {
() => `\n${theme.muted("Docs:")} ${formatDocsLink("/cli/docs", "docs.clawd.bot/cli/docs")}\n`,
)
.action(async (queryParts: string[]) => {
try {
await runCommandWithRuntime(defaultRuntime, async () => {
await docsSearchCommand(queryParts, defaultRuntime);
} catch (err) {
defaultRuntime.error(String(err));
defaultRuntime.exit(1);
}
});
});
}