Commit cd3b9fd
committed
search_code v2: graph-augmented code search with modes + path_filter
Rewrites search_code from a raw grep wrapper into a 4-phase pipeline:
grep scan → graph block expansion → batch degree ranking → context assembly.
- Scoped grep: queries indexed file paths from graph, passes to xargs
grep — eliminates scanning vendored/generated code (Fixes #102)
- Graph dedup: grep matches grouped into containing functions with
in_degree, out_degree, qualified_name, label
- Three output modes: compact (default, metadata only — token efficient),
full (with function source), files (just file paths)
- path_filter: regex on file paths (e.g. "^src/") to scope results
- context: N lines around each match (like grep -C) in compact mode
- directories: summary showing match distribution by top-level directory
- Ranking: project source first, vendored demoted, tests penalized
- Batch degree query via cbm_store_batch_count_degrees (2 SQL queries
instead of 52 individual ones)
- Fix yyjson pointer bugs: use strcpy variants for heap/stack strings
- Add cbm_store_list_files() for indexed file enumeration
- Code discovery gate hook: per-session block (PPID-keyed) nudging
Claude toward codebase-memory-mcp tools before grep fallback1 parent c38853f commit cd3b9fd
5 files changed
+608
-52
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1310 | 1310 | | |
1311 | 1311 | | |
1312 | 1312 | | |
1313 | | - | |
1314 | | - | |
1315 | | - | |
1316 | | - | |
1317 | | - | |
| 1313 | + | |
1318 | 1314 | | |
1319 | 1315 | | |
1320 | 1316 | | |
| |||
1470 | 1466 | | |
1471 | 1467 | | |
1472 | 1468 | | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
| 1472 | + | |
| 1473 | + | |
| 1474 | + | |
| 1475 | + | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
| 1494 | + | |
| 1495 | + | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
1473 | 1508 | | |
1474 | 1509 | | |
1475 | 1510 | | |
| |||
2218 | 2253 | | |
2219 | 2254 | | |
2220 | 2255 | | |
2221 | | - | |
| 2256 | + | |
2222 | 2257 | | |
2223 | 2258 | | |
2224 | 2259 | | |
2225 | 2260 | | |
| 2261 | + | |
2226 | 2262 | | |
2227 | | - | |
| 2263 | + | |
2228 | 2264 | | |
2229 | 2265 | | |
2230 | 2266 | | |
| |||
0 commit comments