Skip to content

Commit 4bab7e8

Browse files
committed
fix: cargo fmt all source files
1 parent d864f2e commit 4bab7e8

5 files changed

Lines changed: 63 additions & 75 deletions

File tree

crates/agentic-codebase-mcp/src/ghost_bridge.rs

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,10 @@ fn build_codebase_context(server: &agentic_codebase::mcp::McpServer) -> String {
103103
.as_deref()
104104
.map(|g| format!(" [{}]", g))
105105
.unwrap_or_default();
106-
md.push_str(&format!("- `{}`{} — {summary}\n", record.tool_name, graph_tag));
106+
md.push_str(&format!(
107+
"- `{}`{} — {summary}\n",
108+
record.tool_name, graph_tag
109+
));
107110
}
108111
md.push('\n');
109112
}
@@ -160,10 +163,26 @@ fn detect_all_memory_dirs() -> Vec<ClientDir> {
160163
};
161164

162165
let candidates = [
163-
("Claude Code", home.join(".claude").join("memory"), "CODEBASE_CONTEXT.md"),
164-
("Cursor", home.join(".cursor").join("memory"), "agentic-codebase.md"),
165-
("Windsurf", home.join(".windsurf").join("memory"), "agentic-codebase.md"),
166-
("Cody", home.join(".sourcegraph").join("cody").join("memory"), "agentic-codebase.md"),
166+
(
167+
"Claude Code",
168+
home.join(".claude").join("memory"),
169+
"CODEBASE_CONTEXT.md",
170+
),
171+
(
172+
"Cursor",
173+
home.join(".cursor").join("memory"),
174+
"agentic-codebase.md",
175+
),
176+
(
177+
"Windsurf",
178+
home.join(".windsurf").join("memory"),
179+
"agentic-codebase.md",
180+
),
181+
(
182+
"Cody",
183+
home.join(".sourcegraph").join("cody").join("memory"),
184+
"agentic-codebase.md",
185+
),
167186
];
168187

169188
let mut dirs = Vec::new();

crates/agentic-codebase-mcp/src/main.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,9 @@ fn run_stdio_loop<R: BufRead + Read, W: Write>(
207207
}
208208
let raw = String::from_utf8_lossy(&buf).to_string();
209209
let response = server.handle_raw(raw.trim());
210-
if let Some(ref mut g) = ghost { g.sync(server); }
210+
if let Some(ref mut g) = ghost {
211+
g.sync(server);
212+
}
211213
if !response.is_empty() && write_framed(writer, &response).is_err() {
212214
break;
213215
}
@@ -224,7 +226,9 @@ fn run_stdio_loop<R: BufRead + Read, W: Write>(
224226
}
225227

226228
let response = server.handle_raw(trimmed);
227-
if let Some(ref mut g) = ghost { g.sync(server); }
229+
if let Some(ref mut g) = ghost {
230+
g.sync(server);
231+
}
228232
if response.is_empty() {
229233
continue;
230234
}

src/parse/cpp.rs

Lines changed: 21 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,7 @@ impl CppParser {
7373
);
7474
}
7575
"namespace_definition" => {
76-
self.extract_namespace(
77-
child,
78-
source,
79-
file_path,
80-
units,
81-
next_id,
82-
parent_qname,
83-
);
76+
self.extract_namespace(child, source, file_path, units, next_id, parent_qname);
8477
}
8578
"enum_specifier" => {
8679
if let Some(unit) =
@@ -91,14 +84,7 @@ impl CppParser {
9184
}
9285
"template_declaration" => {
9386
// Recurse into the template body to find the actual declaration
94-
self.extract_from_node(
95-
child,
96-
source,
97-
file_path,
98-
units,
99-
next_id,
100-
parent_qname,
101-
);
87+
self.extract_from_node(child, source, file_path, units, next_id, parent_qname);
10288
}
10389
"preproc_include" => {
10490
if let Some(unit) =
@@ -109,14 +95,7 @@ impl CppParser {
10995
}
11096
// Top-level declarations wrapped in linkage_specification (extern "C" { ... })
11197
"linkage_specification" => {
112-
self.extract_from_node(
113-
child,
114-
source,
115-
file_path,
116-
units,
117-
next_id,
118-
parent_qname,
119-
);
98+
self.extract_from_node(child, source, file_path, units, next_id, parent_qname);
12099
}
121100
_ => {}
122101
}
@@ -145,8 +124,13 @@ impl CppParser {
145124
CodeUnitType::Function
146125
};
147126

148-
let mut unit =
149-
RawCodeUnit::new(unit_type, Language::Cpp, name, file_path.to_path_buf(), span);
127+
let mut unit = RawCodeUnit::new(
128+
unit_type,
129+
Language::Cpp,
130+
name,
131+
file_path.to_path_buf(),
132+
span,
133+
);
150134
unit.temp_id = id;
151135
unit.qualified_name = qname;
152136
unit.visibility = Visibility::Public;
@@ -246,13 +230,9 @@ impl CppParser {
246230
}
247231
"declaration" | "field_declaration" => {
248232
// Check if it's a method declaration inside a class
249-
if let Some(unit) = self.extract_declaration(
250-
child,
251-
source,
252-
file_path,
253-
parent_qname,
254-
next_id,
255-
) {
233+
if let Some(unit) =
234+
self.extract_declaration(child, source, file_path, parent_qname, next_id)
235+
{
256236
units.push(unit);
257237
}
258238
}
@@ -345,8 +325,13 @@ impl CppParser {
345325
let id = *next_id;
346326
*next_id += 1;
347327

348-
let mut unit =
349-
RawCodeUnit::new(CodeUnitType::Type, Language::Cpp, name, file_path.to_path_buf(), span);
328+
let mut unit = RawCodeUnit::new(
329+
CodeUnitType::Type,
330+
Language::Cpp,
331+
name,
332+
file_path.to_path_buf(),
333+
span,
334+
);
350335
unit.temp_id = id;
351336
unit.qualified_name = qname;
352337
unit.visibility = Visibility::Public;
@@ -437,10 +422,7 @@ impl LanguageParser for CppParser {
437422
}
438423

439424
fn is_test_file(&self, path: &Path, _source: &str) -> bool {
440-
let name = path
441-
.file_name()
442-
.and_then(|n| n.to_str())
443-
.unwrap_or("");
425+
let name = path.file_name().and_then(|n| n.to_str()).unwrap_or("");
444426
name.ends_with("_test.cpp")
445427
|| name.ends_with("_test.cc")
446428
|| name.starts_with("test_")

src/parse/csharp.rs

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,7 @@ impl CSharpParser {
9292
);
9393
}
9494
"namespace_declaration" | "file_scoped_namespace_declaration" => {
95-
self.extract_namespace(
96-
child,
97-
source,
98-
file_path,
99-
units,
100-
next_id,
101-
parent_qname,
102-
);
95+
self.extract_namespace(child, source, file_path, units, next_id, parent_qname);
10396
}
10497
"method_declaration" | "constructor_declaration" => {
10598
if let Some(unit) =
@@ -124,14 +117,7 @@ impl CSharpParser {
124117
}
125118
// Recurse into declaration_list (body of namespace/class)
126119
"declaration_list" => {
127-
self.extract_from_node(
128-
child,
129-
source,
130-
file_path,
131-
units,
132-
next_id,
133-
parent_qname,
134-
);
120+
self.extract_from_node(child, source, file_path, units, next_id, parent_qname);
135121
}
136122
_ => {}
137123
}
@@ -369,13 +355,8 @@ impl LanguageParser for CSharpParser {
369355
}
370356

371357
fn is_test_file(&self, path: &Path, _source: &str) -> bool {
372-
let name = path
373-
.file_name()
374-
.and_then(|n| n.to_str())
375-
.unwrap_or("");
376-
name.ends_with("Tests.cs")
377-
|| name.ends_with("Test.cs")
378-
|| name.starts_with("Test")
358+
let name = path.file_name().and_then(|n| n.to_str()).unwrap_or("");
359+
name.ends_with("Tests.cs") || name.ends_with("Test.cs") || name.starts_with("Test")
379360
}
380361
}
381362

src/parse/java.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,13 @@ impl JavaParser {
175175
CodeUnitType::Function
176176
};
177177

178-
let mut unit =
179-
RawCodeUnit::new(unit_type, Language::Java, name, file_path.to_path_buf(), span);
178+
let mut unit = RawCodeUnit::new(
179+
unit_type,
180+
Language::Java,
181+
name,
182+
file_path.to_path_buf(),
183+
span,
184+
);
180185
unit.temp_id = id;
181186
unit.qualified_name = qname;
182187
unit.visibility = vis;
@@ -259,10 +264,7 @@ impl LanguageParser for JavaParser {
259264
}
260265

261266
fn is_test_file(&self, path: &Path, _source: &str) -> bool {
262-
let name = path
263-
.file_name()
264-
.and_then(|n| n.to_str())
265-
.unwrap_or("");
267+
let name = path.file_name().and_then(|n| n.to_str()).unwrap_or("");
266268
name.ends_with("Test.java")
267269
|| name.ends_with("Tests.java")
268270
|| name.starts_with("Test")

0 commit comments

Comments
 (0)