MCPcopy
hub / github.com/codeaashu/claude-code / score

Function score

web/components/command-palette/CommandPalette.tsx:25–34  ·  view source on GitHub ↗

Score a command against a search query (higher = better)

(cmd: Command, query: string)

Source from the content-addressed store, hash-verified

23
24/** Score a command against a search query (higher = better) */
25function score(cmd: Command, query: string): number {
26 const q = query.toLowerCase();
27 const label = cmd.label.toLowerCase();
28 if (label === q) return 100;
29 if (label.startsWith(q)) return 80;
30 if (label.includes(q)) return 60;
31 if (cmd.description.toLowerCase().includes(q)) return 40;
32 if (fuzzyMatch(label, q)) return 20;
33 return 0;
34}
35
36interface GroupedResults {
37 label: string;

Callers 1

CommandPaletteFunction · 0.85

Calls 1

fuzzyMatchFunction · 0.85

Tested by

no test coverage detected