server: order library root as crabidy first, orphans last, rest alphabetical

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Test User 2026-07-24 16:46:58 +02:00
parent 2e94760a69
commit 6f3b60254e
1 changed files with 12 additions and 0 deletions

View File

@ -789,6 +789,18 @@ impl ProviderClient for ProviderOrchestrator {
);
root_node.children.push(child);
}
// Ordering: `crabidy` always first, `orphans` always last, everything
// else alphabetically by name.
root_node.children.sort_by(|a, b| {
fn rank(name: &str) -> (u8, &str) {
match name {
"crabidy" => (0, name),
"orphans" => (2, name),
_ => (1, name),
}
}
rank(&a.title).cmp(&rank(&b.title))
});
root_node
}