MCPcopy Create free account
hub / github.com/Railly/agentfiles / readableProjectName

Function readableProjectName

src/conversations/parser.ts:12–28  ·  view source on GitHub ↗
(encoded: string)

Source from the content-addressed store, hash-verified

10const MAX_LINES_PER_FILE = 500;
11
12function 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
30function extractText(content: unknown): string {
31 if (typeof content === "string") return content;

Callers 1

collectMetaFunction · 0.85

Calls 2

sliceMethod · 0.80
filterMethod · 0.45

Tested by

no test coverage detected