(encoded: string)
| 10 | const MAX_LINES_PER_FILE = 500; |
| 11 | |
| 12 | function readableProjectName(encoded: string): string { |
| 13 | const homeParts = homedir().split(sep).filter(Boolean); |
| 14 | const encodedHome = homeParts.join("-"); |
| 15 | let name = encoded; |
| 16 | if (name.startsWith(encodedHome + "-")) { |
| 17 | name = name.slice(encodedHome.length + 1); |
| 18 | } else if (name.startsWith("-")) { |
| 19 | name = name.slice(1); |
| 20 | const homePrefix = homeParts.join("-") + "-"; |
| 21 | if (name.startsWith(homePrefix)) { |
| 22 | name = name.slice(homePrefix.length); |
| 23 | } |
| 24 | } |
| 25 | const parts = name.split("-").filter(Boolean); |
| 26 | if (parts.length <= 2) return parts.join("-") || "root"; |
| 27 | return parts.slice(-2).join("-"); |
| 28 | } |
| 29 | |
| 30 | function extractText(content: unknown): string { |
| 31 | if (typeof content === "string") return content; |
no test coverage detected