Skip to content

emrg: GUI workspace panel P3 — file browser tree + basic viewer (rant 2026-08-11T12:20:35) - #665

Merged
argszero merged 1 commit into
masterfrom
feature/gui-workspace-panel-p3-filetree
Aug 11, 2026
Merged

emrg: GUI workspace panel P3 — file browser tree + basic viewer (rant 2026-08-11T12:20:35)#665
argszero merged 1 commit into
masterfrom
feature/gui-workspace-panel-p3-filetree

Conversation

@argszero

Copy link
Copy Markdown
Owner

P3 slice 1 of the workspace-panel rant (P1 data layer #661, P2 framework #664 merged). Fills the 文件 Tab with real content.

P3.1 File browser (new module renderer/js/file-tree.js)

  • Lazy directory tree: root = active session projectPath (wired into app.js switchSession/newSession/bindUi via FileTree.setSession(sid, path)); dir click → emrg.listFiles (P1 daemon) fetch-once + cache (collapse/re-expand does not refetch)
  • Sort (dirs-first)/5000-cap/truncated/symlink-safety/abs-path validation guaranteed by the daemon (P1)
  • File row click → ResultPanel.openFileTab(sid, path) (P2.2 tab framework)

P3.3 Viewer (basic tier)

  • New #result-viewer pane shown when a file tab is active; emrg.readFile content rendered as escaped text in <pre><code> (cached per tab — no refetch on tab re-activation / session switch)
  • Binary → localized hint ("open with system tool"); read error → localized error; header has path + system-open button
  • openFileTab/closeFileTab now treat null sid as the current session bucket (matches app.js switchSession+setSession pairing)

i18n: result.treeLoading/treeLoadFailed/viewerLoading/viewerBinary/viewerError/viewerOpen zh/en.

Tests: +5 renderer smoke (root auto-expand lazy load, dir lazy-load + cache no-refetch, file click → tab + viewer text, binary hint, per-session root switch); harness adds result-viewer id, file-tree module, listFiles/readFile mocks. GUI 193 → 198; pytest 694 ✓; doc guard 3/3 ✓; import + --help ✓.

Next slices: highlight.js code colors + md rendering + image display (P3.3 full), WebContentsView HTML preview (P2.3/P3.4), artifact list re-scope to write/edit files (P3.2).

@argszeroargszero left a comment

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle

P3 slice 1: file browser tree (lazy listFiles fetch + cache, root follows session projectPath) + basic viewer (readFile text, binary/error hints, system-open button). Verified: GUI 198/198 ✓ (5 new smoke tests incl. cache no-refetch + per-session root), pytest 694 ✓, doc guard 3/3 ✓, import + --help ✓. CI test run green.

@argszeroargszero left a comment

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle

Reviewed P3 slice 1 (file browser tree + basic viewer) in a local worktree at branch head ed99815:

  • file-tree.js: lazy directory tree — root = active session projectPath (app.js wires FileTree.setSession in switchSession/newSession/init via projectPathFor with openSessions→projectDir fallback); per-path cache (loaded/loading/error/entries) so collapse/re-expand never refetches; dirs-first sorting / 5000-cap / symlink-safety delegated to the P1 daemon list_files; file row click → ResultPanel.openFileTab(sid, path).
  • Viewer (P3.3 basic): #result-viewer pane activates on file tabs; emrg.readFile content rendered as escaped text in <pre><code> (el() text nodes — no XSS); content cached per tab (no refetch on re-activation/session switch); binary → localized hint, read error → localized error, header has path + system-open button (emrg.openFile → shell.openPath). openFileTab/closeFileTab null-sid = current-session bucket (matches app.js pairing).
  • IPC: preload exposes listFiles/readFile/openFile; main.js passthrough to daemon list_files/read_file (startLine/lineLimit included) + openFile existsSync guard — all from P1 (#661), consumed correctly here.
  • i18n: 6 new zh/en keys (treeLoading/treeLoadFailed/viewerLoading/viewerBinary/viewerError/viewerOpen).
  • Verification: renderer smoke + full GUI suite 198/198 (the 1 daemon_client 'python=python3' failure was purely environmental — fresh worktree lacked .venv; passes 43/43 with it, same as master), pytest 694/694, doc guard 3/3, import + --help OK. CI test run green (31461585861).

Note (non-blocking, already tracked): the P2.2 cross-session artifact-card DOM note stays open until P3.2 re-scopes the artifact list — consistent with the PR's stated next slices. No issues found.

@argszeroargszero left a comment

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle (3rd)

Re-verified against branch head ed99815: file browser tree (lazy listFiles + cache, root = session projectPath), basic viewer (readFile text/binary/error + system-open). Local GUI 198/198 ✓ pytest 694 ✓. CI test run green (31461585861). Merge conditions met (3 consecutive ✅ from different cycles).

@argszero
argszero merged commit 7c4e953 into masterAug 11, 2026
1 check passed
argszero pushed a commit to pm25coder/emrg that referenced this pull request Aug 11, 2026
argszero added a commit that referenced this pull request Aug 11, 2026
…rk), #665 (P3 file browser + viewer), #666 (per-session artifact isolation) (#667)
Co-authored-by: EMRG Evolution <emrg@argszero.dev>
@argszero
argszero deleted the feature/gui-workspace-panel-p3-filetree branch August 17, 2026 09:44
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@argszero