(t0)
| 42 | onCancel: () => void; |
| 43 | }; |
| 44 | export function MemoryFileSelector(t0) { |
| 45 | const $ = _c(58); |
| 46 | const { |
| 47 | onSelect, |
| 48 | onCancel |
| 49 | } = t0; |
| 50 | const existingMemoryFiles = use(getMemoryFiles()); |
| 51 | const userMemoryPath = join(getClaudeConfigHomeDir(), "CLAUDE.md"); |
| 52 | const projectMemoryPath = join(getOriginalCwd(), "CLAUDE.md"); |
| 53 | const hasUserMemory = existingMemoryFiles.some(f => f.path === userMemoryPath); |
| 54 | const hasProjectMemory = existingMemoryFiles.some(f_0 => f_0.path === projectMemoryPath); |
| 55 | const allMemoryFiles = [...existingMemoryFiles.filter(_temp).map(_temp2), ...(hasUserMemory ? [] : [{ |
| 56 | path: userMemoryPath, |
| 57 | type: "User" as const, |
| 58 | content: "", |
| 59 | exists: false |
| 60 | }]), ...(hasProjectMemory ? [] : [{ |
| 61 | path: projectMemoryPath, |
| 62 | type: "Project" as const, |
| 63 | content: "", |
| 64 | exists: false |
| 65 | }])]; |
| 66 | const depths = new Map(); |
| 67 | const memoryOptions = allMemoryFiles.map(file => { |
| 68 | const displayPath = getDisplayPath(file.path); |
| 69 | const existsLabel = file.exists ? "" : " (new)"; |
| 70 | const depth = file.parent ? (depths.get(file.parent) ?? 0) + 1 : 0; |
| 71 | depths.set(file.path, depth); |
| 72 | const indent = depth > 0 ? " ".repeat(depth - 1) : ""; |
| 73 | let label; |
| 74 | if (file.type === "User" && !file.isNested && file.path === userMemoryPath) { |
| 75 | label = "User memory"; |
| 76 | } else { |
| 77 | if (file.type === "Project" && !file.isNested && file.path === projectMemoryPath) { |
| 78 | label = "Project memory"; |
| 79 | } else { |
| 80 | if (depth > 0) { |
| 81 | label = `${indent}L ${displayPath}${existsLabel}`; |
| 82 | } else { |
| 83 | label = `${displayPath}`; |
| 84 | } |
| 85 | } |
| 86 | } |
| 87 | let description; |
| 88 | const isGit = projectIsInGitRepo(getOriginalCwd()); |
| 89 | if (file.type === "User" && !file.isNested) { |
| 90 | description = "Saved in ~/.claude/CLAUDE.md"; |
| 91 | } else { |
| 92 | if (file.type === "Project" && !file.isNested && file.path === projectMemoryPath) { |
| 93 | description = `${isGit ? "Checked in at" : "Saved in"} ./CLAUDE.md`; |
| 94 | } else { |
| 95 | if (file.parent) { |
| 96 | description = "@-imported"; |
| 97 | } else { |
| 98 | if (file.isNested) { |
| 99 | description = "dynamically loaded"; |
| 100 | } else { |
| 101 | description = ""; |
nothing calls this directly
no test coverage detected