1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
//! `ccc` is the Rust library behind the `ccc` CLI.
//!
//! It provides:
//!
//! - direct subprocess execution via [`CommandSpec`] and [`Runner`]
//! - a typed invoke layer via [`Request`], [`Client`], [`Plan`], and [`Run`]
//! - `ccc`-style token parsing via [`parse_tokens_with_config`] and [`sugar`]
//! - transcript parsing and rendering helpers for supported coding-agent CLIs
//! - config, alias, and help utilities shared with the published binary
//!
//! The package published on crates.io is named `ccc`, while the library crate name
//! is `call_coding_clis`.
//!
//! # Supported runners
//!
//! The current built-in runner registry covers:
//!
//! - OpenCode
//! - Claude Code
//! - Codex
//! - Kimi
//! - Cursor Agent
//! - Gemini CLI
//! - RooCode
//! - Crush
//!
//! # Choose an entry point
//!
//! Use [`CommandSpec`] and [`Runner`] when you already know the exact argv you want
//! to execute.
//!
//! Use [`Request`] and [`Client`] when you want a typed Rust API that mirrors the
//! `ccc` CLI's controls for runner selection, model/provider selection, output
//! modes, and session-related flags.
//!
//! Use [`parse_tokens_with_config`] when you want to accept familiar `ccc`-style
//! tokens and turn them into a typed [`Request`].
//!
//! # Examples
//!
//! Run a command directly:
//!
//! ```no_run
//! use call_coding_clis::{CommandSpec, Runner};
//!
//! let spec = CommandSpec::new(["opencode", "run", "Explain this module"]);
//! let result = Runner::new().run(spec);
//!
//! println!("stdout: {}", result.stdout);
//! ```
//!
//! Build and plan a typed request:
//!
//! ```no_run
//! use call_coding_clis::{Client, OutputMode, Request, RunnerKind};
//!
//! let request = Request::new("review the current patch")
//! .with_runner(RunnerKind::Claude)
//! .with_output_mode(OutputMode::Formatted);
//!
//! let plan = Client::new().plan(&request)?;
//!
//! assert_eq!(plan.runner(), RunnerKind::Claude);
//! assert!(!plan.command_spec().argv.is_empty());
//! # Ok::<(), call_coding_clis::Error>(())
//! ```
//!
//! Parse `ccc`-style tokens into a request:
//!
//! ```no_run
//! use call_coding_clis::{parse_tokens_with_config, CccConfig, RunnerKind};
//!
//! let parsed = parse_tokens_with_config(
//! ["c", ":openai:gpt-5.4-mini", "debug this failure"],
//! &CccConfig::default(),
//! )?;
//!
//! assert_eq!(parsed.request.runner(), Some(RunnerKind::Codex));
//! assert_eq!(parsed.request.model(), Some("gpt-5.4-mini"));
//! # Ok::<(), call_coding_clis::Error>(())
//! ```
//!
//! Stream stdout and stderr incrementally:
//!
//! ```no_run
//! use call_coding_clis::{CommandSpec, Runner};
//!
//! let spec = CommandSpec::new(["opencode", "run", "Describe the next step"]);
//! let runner = Runner::new();
//!
//! let completed = runner.stream(spec, |channel, chunk| {
//! if channel == "stdout" {
//! print!("{chunk}");
//! } else {
//! eprint!("{chunk}");
//! }
//! });
//!
//! println!("exit code: {}", completed.exit_code);
//! ```
//!
//! # Output and transcript helpers
//!
//! For structured runner output, the crate also exports:
//!
//! - [`Transcript`], [`Event`], [`ToolCall`], [`ToolResult`], and [`Usage`]
//! - [`parse_transcript`] and [`parse_transcript_for_runner`]
//! - [`render_transcript`]
//! - formatted JSON helpers such as [`parse_json_output`] and
//! [`StructuredStreamProcessor`]
//!
//! # Config and CLI helpers
//!
//! Shared config and CLI-facing utilities remain public for applications that want
//! to integrate with the same config files or help/config rendering used by the
//! `ccc` binary. The main entry points are:
//!
//! - [`load_config`]
//! - [`render_example_config`]
//! - [`find_config_command_path`] and [`find_config_command_paths`]
//! - [`write_alias_block`] and [`render_alias_block`]
//! - [`print_help`], [`print_usage`], and [`print_version`]
//!
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;