diff --git a/src/cli/program/register.status-health-sessions.ts b/src/cli/program/register.status-health-sessions.ts index 3478df29c..bf302a36b 100644 --- a/src/cli/program/register.status-health-sessions.ts +++ b/src/cli/program/register.status-health-sessions.ts @@ -1,6 +1,6 @@ import type { Command } from "commander"; import { healthCommand } from "../../commands/health.js"; -import { sessionsCommand } from "../../commands/sessions.js"; +import { sessionsCommand, sessionsHealthCommand } from "../../commands/sessions.js"; import { statusCommand } from "../../commands/status.js"; import { setVerbose } from "../../globals.js"; import { defaultRuntime } from "../../runtime.js"; @@ -143,4 +143,36 @@ export function registerStatusHealthSessionsCommands(program: Command) { defaultRuntime, ); }); + + program + .command("sessions health") + .description("Check session health for tool call/result pairing issues") + .option("--verbose", "Show diagnostics for all sessions", false) + .option("--session-id ", "Check a specific session by ID") + .option("--store ", "Path to session store (default: resolved from config)") + .addHelpText( + "after", + () => + `\n${theme.heading("Examples:")}\n${formatHelpExamples([ + ["moltbot sessions health", "Check all sessions for tool pairing issues."], + ["moltbot sessions health --verbose", "Show detailed diagnostics."], + ["moltbot sessions health --session-id abc123", "Check specific session."], + ])}`, + ) + .addHelpText( + "after", + () => + `\n${theme.muted("Docs:")} ${formatDocsLink("/cli/sessions-health", "docs.molt.bot/cli/sessions-health")}\n`, + ) + .action(async (opts) => { + setVerbose(Boolean(opts.verbose)); + await sessionsHealthCommand( + { + sessionId: opts.sessionId as string | undefined, + verbose: Boolean(opts.verbose), + store: opts.store as string | undefined, + }, + defaultRuntime, + ); + }); }