(Query(query): Query<ListFilesQuery>)
| 2976 | } |
| 2977 | |
| 2978 | async fn read_file(Query(query): Query<ListFilesQuery>) -> Result<Json<serde_json::Value>> { |
| 2979 | let root = project_root()?; |
| 2980 | let path = resolve_input_path(&query.path, &root)?; |
| 2981 | |
| 2982 | if path.is_file() { |
| 2983 | match std::fs::read_to_string(&path) { |
| 2984 | Ok(content) => Ok(Json( |
| 2985 | serde_json::json!({ "content": content, "path": query.path }), |
| 2986 | )), |
| 2987 | Err(e) => Err(ApiError::BadRequest(format!("Failed to read file: {}", e))), |
| 2988 | } |
| 2989 | } else { |
| 2990 | Err(ApiError::BadRequest("Path is not a file".to_string())) |
| 2991 | } |
| 2992 | } |
| 2993 | |
| 2994 | async fn get_file_status() -> Result<Json<Vec<FileStatusInfo>>> { |
| 2995 | let cwd = std::env::current_dir() |
nothing calls this directly
no test coverage detected