Skip to content
claudestream._cli
Edit
On this page

Command-line interface entry point for claudestream, providing send, listen, and agent commands for interacting with Claude Code.

#claudestream._cli

#claudestream._cli

Command-line interface entry point for claudestream, providing send, listen, and agent commands for interacting with Claude Code.

#_get_version

python
def _get_version() -> str

Read version from pyproject.toml (editable installs) or fall back to package metadata.

#_opt

python
def _opt(value, fallback)

Resolve an optional flag's absence to the fallback its help declares.

strictcli's mutating-default ban forbids default= on any flag of a mutating command: a value the framework picks is a value the framework writes. claudestream's session commands are all mutating, so their behavioral switches (--footer, --color, --raw, --stdin, --skip-permissions, --json-output) declare presence="optional" and name their fallback in their own help text. This is the one place where absence becomes that fallback, so nothing downstream ever sees a None it would silently read as false.

#_resolve_prompt

python
def _resolve_prompt(prompt: str | None, stdin: bool, color: Colorizer) -> str | int

Resolve prompt from argument or stdin. Returns the prompt string, or 1 on error.

prompt is None when the positional argument was not supplied at all -- the optional presence declaration delivers absence as absence, so an explicitly supplied empty string is a supplied prompt, not an absent one.

#_build_config

python
def _build_config(model: str, profile: str, cwd: str | None=None, skip_permissions: bool=False, system_prompt: str | None=None, resume: str | None=None, from_pr: str | None=None) -> SessionConfig

Build a SessionConfig from common CLI flags.

Every str | None parameter here is fed by a flag declaring presence="optional", so absence arrives as None and is passed straight through -- no empty-string sentinel is constructed or tested.

#_run_with_session

python
def _run_with_session(config: SessionConfig, handler: Any, color: Colorizer) -> int | None

Run handler(session) inside a SyncSession context with standard error handling.

#_stream_events

python
def _stream_events(session: SyncSession, prompt: str, footer: bool, color: Colorizer) -> None

Shared streaming event loop used by cmd_stream and cmd_agent_run.

#cmd_send

python
def cmd_send(ctx, prompt: str | None=None, model: str='', profile: str='', cwd: str | None=None, raw: bool | None=None, json_output: bool | None=None, skip_permissions: bool | None=None, footer: bool | None=None, system_prompt: str | None=None, stdin: bool | None=None, color: bool | None=None, resume: str | None=None, from_pr: str | None=None) -> int | None

#cmd_stream

python
def cmd_stream(ctx, prompt: str | None=None, model: str='', profile: str='', cwd: str | None=None, skip_permissions: bool | None=None, footer: bool | None=None, system_prompt: str | None=None, stdin: bool | None=None, color: bool | None=None, resume: str | None=None, from_pr: str | None=None) -> int | None

#cmd_events

python
def cmd_events(ctx, prompt: str | None=None, model: str='', profile: str='', cwd: str | None=None, skip_permissions: bool | None=None, footer: bool | None=None, system_prompt: str | None=None, stdin: bool | None=None, color: bool | None=None, resume: str | None=None, from_pr: str | None=None) -> int | None

#cmd_repl

python
def cmd_repl(ctx, model: str, profile: str, cwd: str | None=None, skip_permissions: bool | None=None, footer: bool | None=None, system_prompt: str | None=None, color: bool | None=None, resume: str | None=None, from_pr: str | None=None) -> None

#cmd_agent_run

python
def cmd_agent_run(ctx, definition: str, prompt: str, var: list[str], profile: str, model: str | None=None, cwd: str | None=None, footer: bool | None=None, color: bool | None=None) -> int | None

#cmd_agent_list

python
def cmd_agent_list(ctx, cwd: str | None=None) -> int | None

#cmd_agent_info

python
def cmd_agent_info(ctx, name: str) -> int | None

#cmd_agent_validate

python
def cmd_agent_validate(ctx, name: str) -> int | None

#cmd_ask

python
def cmd_ask(ctx, prompt: str | None=None, model: str='', profile: str='', cwd: str | None=None, skip_permissions: bool | None=None, system_prompt: str | None=None, stdin: bool | None=None, json_output: bool | None=None, color: bool | None=None, from_pr: str | None=None) -> int | None

#cmd_doctor

python
def cmd_doctor(ctx, profile: str | None=None) -> int | None

#cmd_config

python
def cmd_config(ctx, profile: str | None=None) -> int | None

#EventPrinter

Stateful event printer that deduplicates AssistantText against StreamDelta.

python
def print_event(self, event: Event) -> None

Pretty-print an event to stdout, deduplicating AssistantText.

#_print_json

python
def _print_json(event: Event) -> None

Print an event as a JSON line.

#main

python
def main() -> None

More tools from this site

  • claudewheel A TUI Claude Code Launcher that lets you have more than one profile, manage sessions lifecycle, pick the exact CC version, model to use (even older unlisted ones), pick which GitHub account to use, etc.
  • dirstat Fast, single-binary directory statistics CLI: every file under a tree grouped by format, with counts, sizes, and lines of code, as a colored terminal table or as JSON
  • fastware A batteries-included ASGI framework: msgspec JSON, a managed Granian server, dependency injection, SSE, WebSockets, auth, and a test client
  • go-toml-edit Zero-dep TOML editing library for Go with comment preservation
  • howmuchleft The fastest Claude Code statusline: context window, 5-hour, and weekly limit usage as three customizable gradient bars, rendering in about 6 ms
  • orxtra
  • pgdesign
  • predraw Declarative rendering pipeline: describe a scene in JSON and get SVG, PNG and WebP out, with light and dark style tokens, reusable components and text converted to path outlines
  • reposummary Turn a git repository's history into a Markdown journal: pick a time window or revision range and get a readable digest of what changed, optionally narrated by an LLM
  • rlsbl Release orchestration and project scaffolding CLI that bumps versions, validates a structured JSONL changelog, tags only the commit CI verified, and publishes to npm, PyPI, Go and more
  • safegit git wrapper CLI that gives each commit its own temporary index and retries ref updates on conflict, so concurrent agents share one repository
  • saferm Command-line replacement for rm that archives every deletion with a mandatory reason and the context it ran in, so deleted files can be listed, inspected and restored
  • selfdoc Static Site Generator that builds a project's documentation site directly from its source code, so the docs can never drift from the code they describe, with SEO/AEO, first-class blog, search, and cross-project linking built in
  • strictcli
  • stricttest An always-on test-isolation floor: a pytest plugin and a Go env-hygiene module that make a test suite structurally unable to reach real credentials, the real HOME, the network, or the development repository.
  • wesktop A Python framework that turns an ASGI web app into a desktop application, serving it from a local Granian server and displaying it in a native OS window via pywebview
Search