(lib: LibrarySearchResult, index: number)
| 25 | } |
| 26 | |
| 27 | function formatLibraryResult(lib: LibrarySearchResult, index: number): string { |
| 28 | const lines: string[] = []; |
| 29 | lines.push(`${pc.dim(`${index + 1}.`)} ${pc.bold(`Title: ${lib.title}`)}`); |
| 30 | lines.push(` ${pc.cyan(`Context7-compatible library ID: ${lib.id}`)}`); |
| 31 | |
| 32 | if (lib.description) { |
| 33 | lines.push(` ${pc.dim(`Description: ${lib.description}`)}`); |
| 34 | } |
| 35 | |
| 36 | if (lib.totalSnippets) { |
| 37 | lines.push(` ${pc.dim(`Code Snippets: ${lib.totalSnippets}`)}`); |
| 38 | } |
| 39 | if (lib.trustScore !== undefined) { |
| 40 | lines.push(` ${pc.dim(`Source Reputation: ${getReputationLabel(lib.trustScore)}`)}`); |
| 41 | } |
| 42 | if (lib.benchmarkScore !== undefined && lib.benchmarkScore > 0) { |
| 43 | lines.push(` ${pc.dim(`Benchmark Score: ${lib.benchmarkScore}`)}`); |
| 44 | } |
| 45 | if (lib.versions && lib.versions.length > 0) { |
| 46 | lines.push(` ${pc.dim(`Versions: ${lib.versions.join(", ")}`)}`); |
| 47 | } |
| 48 | |
| 49 | return lines.join("\n"); |
| 50 | } |
| 51 | |
| 52 | async function resolveCommand( |
| 53 | library: string, |
no test coverage detected