Skip to content

fix(import-existing-worktrees): import existing worktrees on load/pro…#250

Open
JayGhiya wants to merge 2 commits intocoollabsio:mainfrom
JayGhiya:feat/166-import-existing-worktrees
Open

fix(import-existing-worktrees): import existing worktrees on load/pro…#250
JayGhiya wants to merge 2 commits intocoollabsio:mainfrom
JayGhiya:feat/166-import-existing-worktrees

Conversation

@JayGhiya
Copy link
Copy Markdown

  1. src-tauri/src/projects/commands.rs: added helper functions to normalize paths and compare Git worktrees against Jean-tracked worktrees safely.
  2. src-tauri/src/projects/commands.rs: tightened import_worktree so manual import only accepts existing, untracked paths that actually belong to the selected repo’s Git worktree list.
  3. src-tauri/src/projects/commands.rs: added sync_project_worktrees to silently import missing Git worktrees into Jean storage, save once, and emit worktrees:changed.
  4. src-tauri/src/lib.rs: registered sync_project_worktrees in the native Tauri command handler.
  5. src-tauri/src/http_server/dispatch.rs: registered the same command for web/headless WebSocket dispatch so it works outside native IPC too.
  6. src/services/projects.ts: added syncProjectWorktrees(projectId) as the frontend wrapper around the new backend sync command.
  7. src/services/projects.ts: added useSyncProjectWorktrees(projectId, enabled) to run opportunistic background sync through TanStack Query.
  8. src/components/projects/ProjectTreeItem.tsx: mounted that sync hook when a project is selected or expanded, so Jean reconciles active projects instead of scanning all projects on startup.
  9. src/components/projects/panes/GeneralPane.tsx: after saving or resetting worktrees_dir, immediately re-runs the same silent sync so externally existing worktrees show up right away.
  10. e2e/fixtures/invoke-handlers.ts: added the sync_project_worktrees mock handler so E2E/tests remain compatible with the new frontend sync flow.

If this looks correct will also enable manual refresh. This would be required as people inside jean terminal or ghostty/cmux use https://worktrunk.dev . it is a great way to manage worktrees plus setup scripts if worktrunk looks good iin future we can ensure to add this as a primitive for jean

@JayGhiya
Copy link
Copy Markdown
Author

image Pushing manual sync too.

Add a manual Refresh Project Worktrees action to the worktree header dropdown so users can rescan Git worktrees on demand.

Return the sync import count from the backend and surface it in the UI for success and no-op refresh feedback.

Co-Authored-By: Oz <oz-agent@warp.dev>
@JayGhiya
Copy link
Copy Markdown
Author

@andrasbacsai please let me know any feedback :)

@JayGhiya
Copy link
Copy Markdown
Author

JayGhiya commented Apr 1, 2026

would appreciate this getting merged to solve the onboarding friction i personally have and lot of other people that want to try jean might have @andrasbacsai

Sign up for free to 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