ClaudeCode

works.iterative.claude.zio.ClaudeCode
object ClaudeCode

Entry point for querying the Claude Code CLI with ZIO.

query streams messages as the CLI produces them; querySync and queryResult are convenience collectors. session opens a scoped multi-turn conversation. All operations fail with a typed CLIError.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
ClaudeCode.type

Members list

Value members

Concrete methods

def ask(prompt: String): IO[CLIError, String]

Ask Claude a question with sane defaults, returning the assistant's text.

Ask Claude a question with sane defaults, returning the assistant's text.

Attributes

def query(options: QueryOptions): ZStream[Any, CLIError, Message]

Execute a query and stream messages from the Claude CLI as they arrive.

Execute a query and stream messages from the Claude CLI as they arrive.

Attributes

def queryResult(options: QueryOptions): IO[CLIError, String]

Execute a query and extract the assistant's text result.

Execute a query and extract the assistant's text result.

Attributes

def querySync(options: QueryOptions): IO[CLIError, List[Message]]

Execute a query and collect all messages into a list.

Execute a query and collect all messages into a list.

Attributes

def session(options: SessionOptions, archive: Option[ArchiveConfig] = ..., eventsBufferSize: Int = ...): ZIO[Scope, CLIError, Session]

Open a scoped session backed by a long-lived CLI process.

Open a scoped session backed by a long-lived CLI process.

When archive is set, the session mirrors the vendor transcript tree after each real result and on close — best-effort, so a mirror failure is logged and never breaks the session. Closing the session waits for the final mirror, bounded by works.iterative.claude.zio.internal.cli.SessionArchiveHook.CloseMirrorTimeout (after which it logs a warning and moves on). eventsBufferSize sizes the lossy events Hub (see Session.events); the default is conservative.

Attributes