From 514a3f8bcfd2b40657bc01a4b774a22a9316a0ba Mon Sep 17 00:00:00 2001 From: Charles Packer Date: Sat, 31 Jan 2026 23:53:55 -0800 Subject: [PATCH] feat(cli): prioritize system/ directory in /memory viewer (#771) Co-authored-by: Letta --- src/cli/components/MemfsTreeViewer.tsx | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) 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}