refactor: streamline agent turn handling and background review process
This commit is contained in:
@@ -163,28 +163,26 @@ pub fn build_workspace_tree(root: &Path, max_files: usize) -> String {
|
||||
|
||||
// hidden(false) allows files like .github to be seen, but it still respects .gitignore
|
||||
// and ignores .git directories by default.
|
||||
for result in WalkBuilder::new(root).hidden(false).build() {
|
||||
if let Ok(entry) = result {
|
||||
if count >= max_files {
|
||||
tree.push_str("\n... (truncated)");
|
||||
break;
|
||||
}
|
||||
|
||||
let path = entry.path();
|
||||
if let Ok(rel) = path.strip_prefix(root) {
|
||||
let name = rel.to_string_lossy();
|
||||
if name.is_empty() {
|
||||
tree.push_str(".\n");
|
||||
} else {
|
||||
let depth = entry.depth();
|
||||
let indent = " ".repeat(depth.saturating_sub(1));
|
||||
let is_dir = entry.file_type().map(|ft| ft.is_dir()).unwrap_or(false);
|
||||
let suffix = if is_dir { "/" } else { "" };
|
||||
|
||||
let filename = entry.file_name().to_string_lossy();
|
||||
tree.push_str(&format!("{indent}{filename}{suffix}\n"));
|
||||
count += 1;
|
||||
}
|
||||
for entry in WalkBuilder::new(root).hidden(false).build().flatten() {
|
||||
if count >= max_files {
|
||||
tree.push_str("\n... (truncated)");
|
||||
break;
|
||||
}
|
||||
|
||||
let path = entry.path();
|
||||
if let Ok(rel) = path.strip_prefix(root) {
|
||||
let name = rel.to_string_lossy();
|
||||
if name.is_empty() {
|
||||
tree.push_str(".\n");
|
||||
} else {
|
||||
let depth = entry.depth();
|
||||
let indent = " ".repeat(depth.saturating_sub(1));
|
||||
let is_dir = entry.file_type().map(|ft| ft.is_dir()).unwrap_or(false);
|
||||
let suffix = if is_dir { "/" } else { "" };
|
||||
|
||||
let filename = entry.file_name().to_string_lossy();
|
||||
tree.push_str(&format!("{indent}{filename}{suffix}\n"));
|
||||
count += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user