The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import * as Effect from "effect/Effect"; |
| 2 | import { Argument, Command } from "effect/cli"; |
| 3 | |
| 4 | /** Single-executable builds lack Node, so they use this subcommand instead of claudeHistoryWorker.mjs. */ |
| 5 | export const claudeHistoryCommand = Command.make("__claude-history", { |
| 6 | method: Argument.String("method"), |
| 7 | sessionId: Argument.String("session-id"), |
| 8 | options: Argument.String("options").pipe(Argument.optional), |
| 9 | }).pipe( |
| 10 | Command.unlisted, |
| 11 | Command.withHandler(({ method, sessionId, options }) => |
| 12 | // Two effects, so an interrupt during the import never starts the worker. |
| 13 | Effect.promise(() => import("../claudeHistoryWorker.ts")).pipe( |
| 14 | Effect.flatMap(({ runClaudeHistoryWorker }) => |
| 15 | Effect.promise(() => |
| 16 | runClaudeHistoryWorker( |
| 17 | method, |
| 18 | sessionId, |
| 19 | options._tag === "Some" ? options.value : undefined, |
| 20 | ), |
| 21 | ), |
| 22 | ), |
| 23 | ), |
| 24 | ), |
| 25 | ); |