winx_code_agent/utils/
mod.rs1pub mod bash_parser;
7pub mod command_safety;
8pub mod file_cache;
9pub mod mmap;
10pub mod path;
11pub mod repo;
12pub mod syntax;
13
14use crate::types::Initialize;
15use serde_json::Value;
16use tracing::debug;
17
18pub fn test_json_parsing(json_str: &str) -> Result<(), String> {
20 let raw_json_result = serde_json::from_str::<Value>(json_str);
22 if let Err(e) = raw_json_result {
23 return Err(format!("Invalid JSON format: {e}"));
24 }
25
26 let init_result = serde_json::from_str::<Initialize>(json_str);
28 match init_result {
29 Ok(init) => {
30 debug!(
31 init_type = ?init.init_type,
32 mode_name = ?init.mode_name,
33 code_writer_config = ?init.code_writer_config,
34 task_id_to_resume = init.task_id_to_resume,
35 "Successfully parsed JSON into Initialize struct"
36 );
37 Ok(())
38 }
39 Err(e) => Err(format!("Failed to parse JSON into Initialize struct: {e}")),
40 }
41}