MCPcopy Create free account
hub / github.com/Noumena-Network/code / MemoryFileSelector

Function MemoryFileSelector

src/components/memory/MemoryFileSelector.tsx:100–449  ·  view source on GitHub ↗
(t0)

Source from the content-addressed store, hash-verified

98}
99
100export function MemoryFileSelector(t0) {
101 const $ = _c(58);
102 const {
103 onSelect,
104 onCancel
105 } = t0;
106 const existingMemoryFiles = use(getMemoryFiles());
107 const projectRoot = getOriginalCwd();
108 const userMemoryPath = join(getCanonicalNcodeConfigHomeDir(), "NCODE.md");
109 const legacyUserMemoryPath = join(getLegacyClaudeConfigHomeDir(), "CLAUDE.md");
110 const {
111 canonical: projectMemoryPath,
112 legacy: legacyProjectMemoryPath,
113 agents: projectAgentsPath
114 } = getTopLevelProjectInstructionPaths(projectRoot);
115 const hasUserMemory = existingMemoryFiles.some(f => f.path === userMemoryPath);
116 const hasProjectMemory = existingMemoryFiles.some(f_0 => f_0.path === projectMemoryPath);
117 const allMemoryFiles = [...existingMemoryFiles.filter(_temp).map(_temp2), ...(hasUserMemory ? [] : [{
118 path: userMemoryPath,
119 type: "User" as const,
120 content: "",
121 exists: false
122 }]), ...(hasProjectMemory ? [] : [{
123 path: projectMemoryPath,
124 type: "Project" as const,
125 content: "",
126 exists: false
127 }])];
128 const depths = new Map();
129 const isGit = projectIsInGitRepo(projectRoot);
130 const memoryOptions = allMemoryFiles.map(file => {
131 const depth = file.parent ? (depths.get(file.parent) ?? 0) + 1 : 0;
132 depths.set(file.path, depth);
133 const indent = depth > 0 ? " ".repeat(depth - 1) : "";
134 let label = getMemoryOptionLabel(file, userMemoryPath, projectMemoryPath, projectAgentsPath, legacyUserMemoryPath, legacyProjectMemoryPath);
135 if (depth > 0) {
136 const displayPath = getDisplayPath(file.path);
137 const existsLabel = file.exists ? "" : " (new)";
138 label = `${indent}L ${displayPath}${existsLabel}`;
139 } else {
140 label = label || `${getDisplayPath(file.path)}`;
141 }
142 const description = getMemoryOptionDescription(file, userMemoryPath, projectMemoryPath, projectAgentsPath, legacyUserMemoryPath, legacyProjectMemoryPath, isGit);
143 return {
144 label,
145 value: file.path,
146 description
147 };
148 });
149 const folderOptions = [];
150 const agentDefinitions = useAppState(_temp3);
151 if (isAutoMemoryEnabled()) {
152 let t1;
153 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
154 t1 = {
155 label: "Open auto-memory folder",
156 value: `${OPEN_FOLDER_PREFIX}${getAutoMemPath()}`,
157 description: ""

Callers

nothing calls this directly

Calls 15

getOriginalCwdFunction · 0.85
projectIsInGitRepoFunction · 0.85
getMemoryOptionLabelFunction · 0.85
getDisplayPathFunction · 0.85
useAppStateFunction · 0.85
isAutoMemoryEnabledFunction · 0.85
getAgentMemoryDirFunction · 0.85
readLastConsolidatedAtFunction · 0.85
formatRelativeTimeAgoFunction · 0.85

Tested by

no test coverage detected