Skip to content

feat(desktop): file-tree context-menu ops, git timeline, system tray#89

Merged
deepagent-ai merged 2 commits into
deepagent-ltd:devfrom
thomas-yanga:feat/desktop-file-management
Jul 24, 2026
Merged

feat(desktop): file-tree context-menu ops, git timeline, system tray#89
deepagent-ai merged 2 commits into
deepagent-ltd:devfrom
thomas-yanga:feat/desktop-file-management

Conversation

@thomas-yanga

@thomas-yanga thomas-yanga commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Adds local filesystem operations and a git timeline to the desktop file tree, plus a system tray and power
management so the app can stay resident.

File-tree context menu (packages/app/src/components/file-tree-*,
packages/desktop/src/main/file-ops.ts): right-click any node to copy / cut / paste / delete / rename /
compress to ZIP / extract ZIP. Ops run in the main process over IPC; every positional path is checked with
assertWithinRoot so the bridge can't touch files outside the workspace. movePath falls back to copy+remove
on EXDEV (cross-device). renamePath rejects Windows-illegal chars up front.

Git file timeline (git-timeline-dialog.tsx, git.ts): lists commit history for a single file via git log --follow. Degrades to an empty state when git is missing or the path is outside a repo.

System tray + close-to-tray (tray.ts, close-to-tray.ts, windows.ts): closing the window hides to
tray only when a tray was created. On Linux GNOME (no StatusNotifierItem host) tray creation fails silently and
close-to-tray stays disabled, so a window is never stranded. before-quit / tray Quit / Cmd+Q set isQuitting
to bypass hide; macOS activate re-shows a hidden window.

Power: powerSaveBlocker("prevent-app-suspension") keeps the app running while active, letting the
display sleep.

Server Edition gating (desktop-api.ts, context/file.tsx): local fs + git ops require the desktop
bridge AND a loopback sidecar — a remote Server Edition connection never touches the local filesystem.

CI (.github/workflows/test.yml, turbo.json): adds macos-14 to the unit matrix; wires
@deepagent-code/desktop#test / test:ci into turbo with JUnit output.

How did you verify your code works?

  • bun typecheck passes across @deepagent-code/app and @deepagent-code/desktop (15-package turbo run).
  • 62 new unit tests pass, zero mocks — real fs, real git binary, real zip.js:
    • file-ops.test.ts (29): all ops, path-traversal defense, the rename cwd≠root edge case, and a real EXDEV
      cross-device move via /dev/shm.
    • git.test.ts (6): isTracked/fileLog/rename-follow against a throwaway repo.
    • close-to-tray.test.ts (4): the full boolean table incl. the GNOME no-tray fallback.
    • desktop-api.test.ts (8) + file-tree-menu.test.ts (15): the degradation rules.

Screenshots / recordings

UI change — TODO: attach a screenshot of the file-tree context menu and the git timeline dialog.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

- file-tree right-click menu: copy/cut/paste/delete/rename/archive/extract
- git file timeline dialog backed by a local git binary
- system tray with close-to-tray (graceful Linux GNOME fallback when no
  StatusNotifierItem host, so a window is never stranded)
- powerSaveBlocker to prevent idle sleep while the app is active
- multi-platform hardening: EXDEV cross-device move fallback, Windows
  illegal filename chars, git-missing degradation, loopback-only filesystem
  bridge so a remote Server Edition sidecar never touches local paths
- CI: add macOS to the unit matrix; wire desktop test/test:ci into turbo
- tests: 62 unit cases covering pure decision logic and real fs/git/zip paths
The desktop file-management branch added ContextMenu, InlineInput,
GitTimelineDialog, and toast/language imports to file-tree.tsx. Their
Kobalte-backed UI leaves (context-menu, dialog, toast, v2/toast-v2) call
solid-js/web template() at module top level; under bun:test solid-js
resolves to its server build and template() throws notSup(), failing the
file-tree.test.ts load. Stub those leaves the way collapsible/tooltip
already are so the pure-function tests load the module without the
client-only render path.
@github-actions

Copy link
Copy Markdown

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@deepagent-ai
deepagent-ai merged commit 721ac77 into deepagent-ltd:dev Jul 24, 2026
6 of 13 checks passed
deepagent-ai pushed a commit that referenced this pull request Jul 24, 2026
### Issue for this PR

   Closes #

(no tracking issue — this fixes the `unit (macos)` CI failure seen on
#89)

   ### Type of change

   - [x] Bug fix
   - [ ] New feature
   - [ ] Refactor / code improvement
   - [ ] Documentation

   ### What does this PR do?

`c0b79979` ("perf(core): 修复启动慢根因 — sessions.json 防抖") changed
`session-state.ts` `saveToDisk()` from a synchronous write to a
debounced
`setImmediate(flushToDisk)`. The I33-1 plan-store test
(`packages/core/test/deepagent/plan-store.test.ts`) predates that change
and still assumed synchronous
 persistence:

   ```ts
SessionState.setPlan("s3", p) // only schedules
setImmediate(flushToDisk), nothing on disk yet
const raw = readFileSync(path.join(stateDir, "sessions.json"), "utf8")
// ENOENT
 ```

The test body is fully synchronous, so whether the file exists at read
time depends on event-loop timing — on the macOS runner it consistently
fails with
ENOENT, which is what failed unit (macos) (@deepagent-code/core#test:ci
exit 1) on #89. The linux/windows jobs in that run were cancelled
(fail-fast) before
 executing, so this is not actually macOS-specific.

Fix: make the test async and yield one event-loop turn (await new
Promise((resolve) => setImmediate(resolve))) after setPlan, so the
debounced flushToDisk lands
sessions.json before the assertion reads it. No production code changes.
I also replaced the inline require("node:fs").readFileSync with the
top-level
 readFileSync import.

I verified the root cause by checking out c0b7997^ in a worktree: the
test passes there and fails at dev HEAD, so the debounce commit is what
broke it.

 ### How did you verify your code works?

- cd packages/core && bun test test/deepagent/plan-store.test.ts → 8
pass / 0 fail (previously 7 pass / 1 fail with ENOENT)
- Full package suite bun test (2236 tests / 225 files): this test was
the only failure before the fix
 - bun run typecheck in packages/core passes

 ### Screenshots / recordings

 If this is a UI change, please include a screenshot or recording.

 N/A — test-only change.

 ### Checklist

 - [x] I have tested my changes locally
 - [x] I have not included unrelated changes in this PR

Signed-off-by: thomas-yanga <odie_majere@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants