MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / try_generate_reasoning

Function try_generate_reasoning

atomic-agent/src/transcript/generator.rs:383–405  ·  view source on GitHub ↗

Generate reasoning if Claude CLI is available, returning None if not. This is the non-fatal version — returns `None` instead of an error when Claude CLI is not installed or generation fails. Suitable for the recording pipeline where reasoning is optional enrichment.

(condensed_text: &str, files: &[String])

Source from the content-addressed store, hash-verified

381/// Claude CLI is not installed or generation fails. Suitable for the
382/// recording pipeline where reasoning is optional enrichment.
383pub fn try_generate_reasoning(condensed_text: &str, files: &[String]) -> Option<TurnReasoning> {
384 let generator = ClaudeCliGenerator::new();
385
386 if !generator.is_available() {
387 log::debug!("Claude CLI not available — skipping reasoning generation");
388 return None;
389 }
390
391 match generator.generate(condensed_text, files) {
392 Ok(reasoning) => {
393 if reasoning.is_empty() {
394 log::debug!("Reasoning generator returned empty result — skipping");
395 None
396 } else {
397 Some(reasoning)
398 }
399 }
400 Err(e) => {
401 log::warn!("Reasoning generation failed (non-fatal): {}", e);
402 None
403 }
404 }
405}
406
407// Mock Generator (for testing)
408

Callers

nothing calls this directly

Calls 3

is_availableMethod · 0.45
generateMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected