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;
13pub mod workspace_stats;
14
15use crate::types::Initialize;
16use serde_json::Value;
17use tracing::debug;
18
19pub fn test_json_parsing(json_str: &str) -> Result<(), String> {
21 let raw_json_result = serde_json::from_str::<Value>(json_str);
23 if let Err(e) = raw_json_result {
24 return Err(format!("Invalid JSON format: {e}"));
25 }
26
27 let init_result = serde_json::from_str::<Initialize>(json_str);
29 match init_result {
30 Ok(init) => {
31 debug!(
32 init_type = ?init.init_type,
33 mode_name = ?init.mode_name,
34 code_writer_config = ?init.code_writer_config,
35 task_id_to_resume = init.task_id_to_resume,
36 "Successfully parsed JSON into Initialize struct"
37 );
38 Ok(())
39 }
40 Err(e) => Err(format!("Failed to parse JSON into Initialize struct: {e}")),
41 }
42}