Search recorded source in this working copy's desired view. Renders bytes from the graph through the view's closure rather than consulting the working-copy content index, so results match `atomic query code`, are filtered by the view, and cover recorded files that are not materialized on disk.
(&self, args: &serde_json::Value)
| 967 | /// `atomic query code`, are filtered by the view, and cover recorded |
| 968 | /// files that are not materialized on disk. |
| 969 | fn exec_code_search(&self, args: &serde_json::Value) -> Result<String, String> { |
| 970 | let pattern = args["pattern"] |
| 971 | .as_str() |
| 972 | .ok_or("missing required parameter: pattern")?; |
| 973 | |
| 974 | let opts = crate::content_search::ContentSearchOptions { |
| 975 | path_filter: args["path_filter"].as_str().map(String::from), |
| 976 | file_type: args["file_type"].as_str().map(String::from), |
| 977 | exclude_type: None, |
| 978 | max_results: Some(args["max_results"].as_u64().unwrap_or(30) as usize), |
| 979 | case_insensitive: false, |
| 980 | }; |
| 981 | |
| 982 | let view = self |
| 983 | .desired_view() |
| 984 | .map_err(|e| format!("code_search failed: {e}"))?; |
| 985 | match self.repo.search_content_on_view(&view, pattern, opts) { |
| 986 | Ok(result) => { |
| 987 | if result.matches.is_empty() { |
| 988 | Ok("No matches found.".into()) |
| 989 | } else { |
| 990 | // Build a compact response with matches + metadata |
| 991 | let response = json!({ |
| 992 | "matches": result.matches, |
| 993 | "total_matches": result.total_matches, |
| 994 | "showing": result.matches.len(), |
| 995 | "dir_facets": result.dir_facets, |
| 996 | }); |
| 997 | serde_json::to_string_pretty(&response) |
| 998 | .map_err(|e| format!("serialize error: {e}")) |
| 999 | } |
| 1000 | } |
| 1001 | Err(e) => Err(format!("code_search failed: {e}")), |
| 1002 | } |
| 1003 | } |
| 1004 | |
| 1005 | fn exec_vault_read(&self, args: &serde_json::Value) -> Result<String, String> { |
| 1006 | let path = args["path"] |
no test coverage detected