diff --git a/src/cli/components/MemfsTreeViewer.tsx b/src/cli/components/MemfsTreeViewer.tsx index da1feab..980b069 100644 --- a/src/cli/components/MemfsTreeViewer.tsx +++ b/src/cli/components/MemfsTreeViewer.tsx @@ -55,7 +55,7 @@ function scanMemoryFilesystem(memoryRoot: string): TreeNode[] { (name) => !name.startsWith(".") && name !== MEMORY_FS_STATE_FILE, ); - // Sort: directories first, then alphabetically + // Sort: directories first, "system" always first among dirs, then alphabetically const sorted = filtered.sort((a, b) => { const aPath = join(dir, a); const bPath = join(dir, b); @@ -68,6 +68,11 @@ function scanMemoryFilesystem(memoryRoot: string): TreeNode[] { bIsDir = statSync(bPath).isDirectory(); } catch {} if (aIsDir !== bIsDir) return aIsDir ? -1 : 1; + // "system" directory comes first (only at root level, depth 0) + if (aIsDir && bIsDir && depth === 0) { + if (a === "system") return -1; + if (b === "system") return 1; + } return a.localeCompare(b); }); @@ -397,6 +402,8 @@ export function MemfsTreeViewer({ !node.isDirectory && node.relativePath === selectedFile?.relativePath; const prefix = renderTreePrefix(node); + // "system/" directory gets special green color + const isSystemDir = node.isDirectory && node.name === "system/"; return ( @@ -412,8 +419,14 @@ export function MemfsTreeViewer({ backgroundColor={ isSelected ? colors.selector.itemHighlighted : undefined } - color={isSelected ? "black" : undefined} - dimColor={node.isDirectory} + color={ + isSelected + ? "black" + : isSystemDir + ? colors.status.success + : undefined + } + dimColor={node.isDirectory && !isSystemDir} > {node.name}