| 213 | * projects in different parent directories. |
| 214 | */ |
| 215 | export function projectMemoryDirName(projectPath: string): string { |
| 216 | assert(projectPath !== "", "projectMemoryDirName requires a project identity"); |
| 217 | const hash = createHash("sha256").update(projectPath).digest("hex").slice(0, 12); |
| 218 | // getProjectName falls back to "unknown" and sanitization maps (never |
| 219 | // drops) disallowed chars, so base is always non-empty. |
| 220 | const base = PlatformPaths.getProjectName(projectPath) |
| 221 | .replace(/[^A-Za-z0-9._-]/g, "_") |
| 222 | .slice(0, 40); |
| 223 | return `${base}-${hash}`; |
| 224 | } |
| 225 | |
| 226 | function toVirtualPath(scope: MemoryScope, relPath: string): string { |
| 227 | return relPath === "" |