feat: add grep option to content endpoints

Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
Andrew Phillips
2025-08-28 20:16:24 -03:00
parent a419ae960c
commit ee555b253f
2 changed files with 131 additions and 5 deletions

View File

@@ -76,6 +76,7 @@ impl AsyncItemService {
tail_lines: Option<usize>,
line_start: Option<usize>,
line_end: Option<usize>,
grep: Option<String>,
) -> Result<(Vec<u8>, String, bool), CoreError> {
let db = self.db.clone();
let item_service = self.item_service.clone();
@@ -92,7 +93,8 @@ impl AsyncItemService {
tail_words,
tail_lines,
line_start,
line_end
line_end,
grep
)
})
.await
@@ -188,6 +190,7 @@ impl AsyncItemService {
tail_lines: Option<usize>,
line_start: Option<usize>,
line_end: Option<usize>,
grep: Option<String>,
) -> Result<(std::pin::Pin<Box<dyn tokio_stream::Stream<Item = Result<tokio_util::bytes::Bytes, std::io::Error>> + Send>>, String), CoreError> {
// Use provided metadata to determine MIME type and binary status
let mime_type = metadata
@@ -236,7 +239,8 @@ impl AsyncItemService {
tail_words,
tail_lines,
line_start,
line_end
line_end,
grep
).map(|(reader, _, _)| reader)
})
.await
@@ -326,6 +330,7 @@ impl AsyncItemService {
tail_lines: Option<usize>,
line_start: Option<usize>,
line_end: Option<usize>,
grep: Option<String>,
) -> Result<(Box<dyn Read + Send>, String, bool), CoreError> {
let db = self.db.clone();
let item_service = self.item_service.clone();
@@ -342,7 +347,8 @@ impl AsyncItemService {
tail_words,
tail_lines,
line_start,
line_end
line_end,
grep
)
})
.await