Expand description
ccc is the Rust library behind the ccc CLI.
It provides:
- direct subprocess execution via
CommandSpecandRunner - a typed invoke layer via
Request,Client,Plan, andRun ccc-style token parsing viaparse_tokens_with_configandsugar- 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:
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:
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());Parse ccc-style tokens into a request:
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"));Stream stdout and stderr incrementally:
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, andUsageparse_transcriptandparse_transcript_for_runnerrender_transcript- formatted JSON helpers such as
parse_json_outputandStructuredStreamProcessor
§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:
Re-exports§
pub use sugar::parse_tokens_with_config;pub use sugar::ParsedRequest;
Modules§
Structs§
- Alias
Def - CccConfig
- Client
- Command
Spec - Completed
Run - Formatted
Renderer - Json
Event - Json
Tool Call - Json
Tool Result - Output
Plan - Parsed
Args - Parsed
Json Output - Plan
- Request
- Run
- RunArtifacts
- Runner
- Runner
Info - Structured
Stream Processor - Text
Content - Thinking
Content - Tool
Call - Tool
Result - Transcript
- Usage
Enums§
Statics§
Functions§
- build_
prompt_ spec - find_
alias_ write_ path - find_
config_ command_ path - find_
config_ command_ paths - find_
config_ edit_ path - find_
local_ config_ write_ path - find_
project_ config_ path - find_
user_ config_ write_ path - load_
config - normalize_
alias_ name - output_
write_ warning - parse_
args - parse_
claude_ code_ json - parse_
codex_ json - parse_
cursor_ agent_ json - parse_
gemini_ json - parse_
json_ output - parse_
kimi_ json - parse_
opencode_ json - parse_
transcript - parse_
transcript_ for_ runner - print_
help - print_
usage - print_
version - render_
alias_ block - render_
example_ config - render_
parsed - render_
transcript - resolve_
command - resolve_
human_ tty - resolve_
output_ mode - resolve_
output_ plan - resolve_
sanitize_ osc - resolve_
show_ thinking - resolve_
state_ root - schema_
name_ for_ runner - transcript_
io_ warning - upsert_
alias_ block - write_
alias_ block