move worktree created directory to home dir#148
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughWorktree creation now places new worktrees under the user's home directory at Changes
Sequence DiagramsequenceDiagram
participant Router as Workspace Router
participant OS as node:os (homedir)
participant Git as Git Utils
participant DB as Mock DB
Note over Router,OS: Create workspace request
Router->>OS: homedir()
OS-->>Router: user home dir
Router->>Router: build path: homedir()/.superset/worktrees/{branch}
Router->>Git: createWorktree(mainRepoPath, branch, worktreePath)
Git-->>Router: resolve
Router->>DB: insert workspace + worktreePath + tab order
DB-->>Router: confirm stored
Router-->>Client: return workspace + worktreePath
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
apps/desktop/src/lib/trpc/routers/workspaces/workspaces.ts (1)
32-37: Use constants and consider operational implications of home directory storage.As noted in
apps/desktop/src/shared/constants.ts, the hardcoded strings".superset"and"worktrees"should be replaced with the defined constantsSUPERSET_DIR_NAMEandWORKTREES_DIR_NAME.
🧹 Nitpick comments (2)
apps/desktop/src/lib/trpc/routers/workspaces/workspaces.ts (1)
32-37: Consider cleanup strategy for home-directory-based worktrees.Moving worktrees to the user's home directory (
~/.superset/worktrees/) means they persist independently of project lifecycle and could accumulate over time. Consider implementing:
- A cleanup mechanism for orphaned worktrees when projects are removed
- Documentation or UI to inform users of this storage location
- Periodic checks for disk usage or stale worktrees
- Migration path for existing worktrees in the old location (if applicable)
apps/desktop/src/lib/trpc/routers/workspaces/workspaces.test.ts (1)
116-158: Well-structured test with good coverage.The test correctly validates:
- Path construction using
homedir()- Function call arguments
- Returned workspace properties
- Database state updates
For consistency, consider using the constants from
apps/desktop/src/shared/constants.ts:+import { SUPERSET_DIR_NAME, WORKTREES_DIR_NAME } from "shared/constants"; import { homedir } from "node:os"; import { join } from "node:path";const expectedPath = join( homedir(), - ".superset", - "worktrees", + SUPERSET_DIR_NAME, + WORKTREES_DIR_NAME, "test-branch-123", );
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
apps/desktop/src/lib/trpc/routers/workspaces/workspaces.test.ts(3 hunks)apps/desktop/src/lib/trpc/routers/workspaces/workspaces.ts(2 hunks)apps/desktop/src/shared/constants.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{ts,tsx,js,jsx,json}
📄 CodeRabbit inference engine (AGENTS.md)
Apply Biome formatting, linting, and import organization at the root level for all code files
Files:
apps/desktop/src/lib/trpc/routers/workspaces/workspaces.tsapps/desktop/src/shared/constants.tsapps/desktop/src/lib/trpc/routers/workspaces/workspaces.test.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx}: Avoid usinganytype; use type-safe approaches instead, unless necessary
Ensure TypeScript type checking passes across all packages using bun run typecheck
Files:
apps/desktop/src/lib/trpc/routers/workspaces/workspaces.tsapps/desktop/src/shared/constants.tsapps/desktop/src/lib/trpc/routers/workspaces/workspaces.test.ts
apps/**/*.{tsx,ts}
📄 CodeRabbit inference engine (AGENTS.md)
apps/**/*.{tsx,ts}: Structure React applications with one folder per component following the pattern: ComponentName/ComponentName.tsx with index.ts barrel export
Co-locate component dependencies (hooks, utils, constants, tests, stories) next to the file using them
Files:
apps/desktop/src/lib/trpc/routers/workspaces/workspaces.tsapps/desktop/src/shared/constants.tsapps/desktop/src/lib/trpc/routers/workspaces/workspaces.test.ts
apps/desktop/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (apps/desktop/AGENTS.md)
For Electron interprocess communication, ALWAYS use tRPC as defined in
src/lib/trpc
Files:
apps/desktop/src/lib/trpc/routers/workspaces/workspaces.tsapps/desktop/src/shared/constants.tsapps/desktop/src/lib/trpc/routers/workspaces/workspaces.test.ts
apps/desktop/**/*.{ts,tsx}
📄 CodeRabbit inference engine (apps/desktop/AGENTS.md)
apps/desktop/**/*.{ts,tsx}: Please use alias as defined intsconfig.jsonwhen possible
Prefer zustand for state management if it makes sense. Do not use effect unless absolutely necessary
Files:
apps/desktop/src/lib/trpc/routers/workspaces/workspaces.tsapps/desktop/src/shared/constants.tsapps/desktop/src/lib/trpc/routers/workspaces/workspaces.test.ts
apps/**/*.test.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Co-locate tests with their corresponding components (e.g., Component.test.tsx next to Component.tsx)
Files:
apps/desktop/src/lib/trpc/routers/workspaces/workspaces.test.ts
apps/desktop/**/*.test.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (apps/desktop/AGENTS.md)
apps/desktop/**/*.test.{ts,tsx,js,jsx}: Tests should have one assert per test
Tests should be readable
Tests should be fast
Tests should be independent
Tests should be repeatable
Files:
apps/desktop/src/lib/trpc/routers/workspaces/workspaces.test.ts
🧠 Learnings (5)
📚 Learning: 2025-11-24T21:32:46.559Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T21:32:46.559Z
Learning: Applies to apps/desktop/src/main/lib/*-ipcs.ts : Implement Electron IPC handlers in dedicated files under apps/desktop/src/main/lib/ (e.g., workspace-ipcs.ts, terminal-ipcs.ts)
Applied to files:
apps/desktop/src/lib/trpc/routers/workspaces/workspaces.ts
📚 Learning: 2025-11-24T21:32:46.559Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T21:32:46.559Z
Learning: Applies to apps/desktop/src/main/index.ts : Load environment variables from monorepo root .env file in apps/desktop/src/main/index.ts before any imports with override: true
Applied to files:
apps/desktop/src/shared/constants.ts
📚 Learning: 2025-11-24T21:33:13.244Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: apps/desktop/AGENTS.md:0-0
Timestamp: 2025-11-24T21:33:13.244Z
Learning: Applies to apps/desktop/**/*.{ts,tsx} : Please use alias as defined in `tsconfig.json` when possible
Applied to files:
apps/desktop/src/shared/constants.ts
📚 Learning: 2025-11-24T21:33:13.244Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: apps/desktop/AGENTS.md:0-0
Timestamp: 2025-11-24T21:33:13.244Z
Learning: Applies to apps/desktop/**/*.test.{ts,tsx,js,jsx} : Tests should be independent
Applied to files:
apps/desktop/src/lib/trpc/routers/workspaces/workspaces.test.ts
📚 Learning: 2025-11-24T21:33:13.244Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: apps/desktop/AGENTS.md:0-0
Timestamp: 2025-11-24T21:33:13.244Z
Learning: Applies to apps/desktop/**/*.test.{ts,tsx,js,jsx} : Tests should be repeatable
Applied to files:
apps/desktop/src/lib/trpc/routers/workspaces/workspaces.test.ts
🧬 Code graph analysis (1)
apps/desktop/src/lib/trpc/routers/workspaces/workspaces.test.ts (1)
apps/desktop/src/lib/trpc/routers/workspaces/workspaces.ts (1)
createWorkspacesRouter(15-428)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Build
🔇 Additional comments (3)
apps/desktop/src/lib/trpc/routers/workspaces/workspaces.ts (1)
1-1: LGTM!The import of
homediris appropriate for the new home-directory-based worktree storage.apps/desktop/src/lib/trpc/routers/workspaces/workspaces.test.ts (2)
1-2: LGTM!The imports are appropriate for constructing and validating the expected home-directory-based worktree path.
59-62: LGTM!The mock signature correctly reflects the updated
createWorktreefunction that now accepts the worktree path as a third argument.
Summary by CodeRabbit
Refactor
Tests
Style
✏️ Tip: You can customize this high-level summary in your review settings.