feat: add Google code retrieval across desktop CLI and MCP
Core CI / core (macos-latest) (push) Canceled after 0s
Core CI / core (windows-latest) (push) Canceled after 0s
Core CI / desktop (macos-latest) (push) Canceled after 0s
Core CI / desktop (ubuntu-latest) (push) Canceled after 0s
Core CI / desktop (windows-latest) (push) Canceled after 0s
Core CI / core (ubuntu-latest) (push) Canceled after 2m23s

This commit is contained in:
karl committed 2026-10-12 21:22:11 +02:00
1 parent 8b9b079469
commit 81846b3e98
32 files changed
+1303 -59

No files matched your search

+44 -21
View File
@@ -33,27 +33,30 @@ pub(crate) fn extract(path: &Path) -> Result<Option<Vec<Passage>>> {
docx(&bytes).map(Some)
};
}
if !matches!(
extension.as_str(),
"txt"
| "md"
| "rs"
| "py"
| "js"
| "ts"
| "tsx"
| "jsx"
| "json"
| "toml"
| "yaml"
| "yml"
| "csv"
| "html"
| "css"
| "xml"
| "log"
| "sh"
) {
let code = crate::is_code_path(path);
if !code
&& !matches!(
extension.as_str(),
"txt"
| "md"
| "rs"
| "py"
| "js"
| "ts"
| "tsx"
| "jsx"
| "json"
| "toml"
| "yaml"
| "yml"
| "csv"
| "html"
| "css"
| "xml"
| "log"
| "sh"
)
{
return Ok(None);
}
let file = File::open(path)?;
@@ -69,6 +72,26 @@ pub(crate) fn extract(path: &Path) -> Result<Option<Vec<Passage>>> {
return Ok(None);
};
let lines = text.split_inclusive('\n').collect::<Vec<_>>();
if code {
let mut passages = Vec::new();
for start in (0..lines.len()).step_by(96) {
if passages.len() >= MAX_PASSAGES {
return Ok(None);
}
let end = (start + 128).min(lines.len());
passages.push(Passage {
text: lines[start..end].concat(),
source: SourceLocation {
kind: "line".into(),
number: (start + 1) as u32,
},
});
if end == lines.len() {
break;
}
}
return Ok(Some(passages));
}
Ok(Some(
lines
.chunks(64)