Adjust workspace setup logic to match conductor flow#167
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughRemoves setup file-copy functionality and UI, narrows setup config to commands only, and routes workspace setup commands into terminal creation flows by adding Changes
Sequence Diagram(s)sequenceDiagram
participant Renderer as Renderer (UI)
participant TRPC as TRPC Router (terminal)
participant Main as Main Process (TerminalManager)
participant Shell as Spawned Shell
Renderer->>TRPC: createOrAttach(workspaceId, initialCommands, rootPath, cwd, cols, rows)
TRPC->>Main: forward createOrAttach params (includes rootPath)
Main->>Main: set env SUPERSET_ROOT_PATH = rootPath || ""
Main->>Main: set env SUPERSET_WORKSPACE_PATH = workingDir
Main->>Shell: spawn shell with env and pty settings
Main-->>TRPC: return terminal/session info
TRPC-->>Renderer: respond with attachment info
alt initialCommands provided and terminal is new
Renderer->>TRPC: request write of concatenated initialCommands
TRPC->>Main: write data to terminal session
Main->>Shell: shell receives commands and executes
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (5)
🚧 Files skipped from review as they are similar to previous changes (5)
⏰ 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). (2)
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: 0
🧹 Nitpick comments (5)
superset-setup.sh (2)
23-28: Document the new environment variables required by the setup script.Lines 23-28 introduce conditional direnv linking based on
SUPERSET_MAIN_REPO_PATH. This is a new environment variable that developers need to know about. Similarly, line 32 usesSUPERSET_WORKSPACE_NAME. These should be documented in a README or setup guide so users understand when and how to set them.Consider adding comments in the script or creating/updating documentation that explains:
SUPERSET_MAIN_REPO_PATH: When and why to set it (optional, for direnv config from main repo)SUPERSET_WORKSPACE_NAME: When and why to set it (optional, defaults to current directory basename)Also verify these variables are documented in the project's setup or contributing guide.
39-40: Verify robustness of Neon connection string parsing.Lines 39-40 parse connection URIs by index (
[0]and[1]). This assumes the Neon API response structure is stable and returns URIs in this specific order. Consider adding error handling in case the response structure differs or indices are out of bounds.apps/desktop/src/lib/trpc/routers/workspaces/utils/setup.ts (1)
16-18: Consider validating array element types.The validation checks if
commandsis an array, but doesn't verify that all elements are strings. Invalid element types would only fail when the commands are executed later.Apply this diff to add element type validation:
if (parsed.commands && !Array.isArray(parsed.commands)) { throw new Error("'commands' field must be an array of strings"); } + +if (parsed.commands && !parsed.commands.every((cmd) => typeof cmd === "string")) { + throw new Error("'commands' field must contain only strings"); +}apps/desktop/src/lib/trpc/routers/terminal/terminal.ts (1)
72-76: Consider command error handling behavior.Commands are joined with
&&, which means execution stops at the first failure. While this is often desired, it may not be clear to users when setup commands fail silently. Consider whether you want to:
- Keep
&&for fail-fast behavior (current)- Use
;to continue on errors- Add error notification when commands fail
If fail-fast is intended, the current implementation is correct. Otherwise, consider using
;separator:-const commandString = `${initialCommands.join(" && ")}\n`; +const commandString = `${initialCommands.join("; ")}\n`;apps/desktop/src/renderer/react-query/workspaces/useCreateWorkspace.ts (1)
22-33: Consider adding error handling for terminal creation.The
createOrAttachmutation could fail, but there's no error handling. If terminal creation fails, the tab would exist but remain disconnected. Consider adding error handling to either:
- Remove the tab on terminal creation failure
- Show a user-facing error notification
- Log the error for debugging
Add error handling to the mutation:
createOrAttach.mutate({ tabId, workspaceId: data.workspace.id, tabTitle: "Terminal", initialCommands: data.setupConfig, +}, { + onError: (error) => { + console.error("Failed to create terminal for setup:", error); + // Consider: removeTab(tabId) or show user notification + } });
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (19)
.superset/setup.json(1 hunks)apps/desktop/src/lib/trpc/routers/terminal/terminal.ts(3 hunks)apps/desktop/src/lib/trpc/routers/workspaces/utils/setup.test.ts(2 hunks)apps/desktop/src/lib/trpc/routers/workspaces/utils/setup.ts(1 hunks)apps/desktop/src/lib/trpc/routers/workspaces/workspaces.ts(1 hunks)apps/desktop/src/main/lib/terminal-manager.ts(3 hunks)apps/desktop/src/renderer/react-query/workspaces/useCreateWorkspace.ts(1 hunks)apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/SetupTabView.tsx(0 hunks)apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/SetupTerminal/SetupTerminal.tsx(0 hunks)apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/SetupTerminal/index.ts(0 hunks)apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/index.tsx(0 hunks)apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/TabItem/index.tsx(0 hunks)apps/desktop/src/renderer/stores/tabs/helpers/tab-crud.ts(2 hunks)apps/desktop/src/renderer/stores/tabs/store.ts(1 hunks)apps/desktop/src/renderer/stores/tabs/types.ts(2 hunks)apps/desktop/src/shared/ipc-channels/worktree.ts(0 hunks)apps/desktop/src/shared/types.ts(0 hunks)conductor.json(0 hunks)superset-setup.sh(1 hunks)
💤 Files with no reviewable changes (8)
- apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/SetupTabView.tsx
- apps/desktop/src/shared/ipc-channels/worktree.ts
- apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/SetupTerminal/SetupTerminal.tsx
- apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/index.tsx
- conductor.json
- apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/TabItem/index.tsx
- apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/SetupTerminal/index.ts
- apps/desktop/src/shared/types.ts
🧰 Additional context used
📓 Path-based instructions (7)
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/main/lib/terminal-manager.tsapps/desktop/src/lib/trpc/routers/terminal/terminal.tsapps/desktop/src/renderer/stores/tabs/helpers/tab-crud.tsapps/desktop/src/renderer/stores/tabs/types.tsapps/desktop/src/lib/trpc/routers/workspaces/utils/setup.tsapps/desktop/src/renderer/react-query/workspaces/useCreateWorkspace.tsapps/desktop/src/lib/trpc/routers/workspaces/workspaces.tsapps/desktop/src/lib/trpc/routers/workspaces/utils/setup.test.tsapps/desktop/src/renderer/stores/tabs/store.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/main/lib/terminal-manager.tsapps/desktop/src/lib/trpc/routers/terminal/terminal.tsapps/desktop/src/renderer/stores/tabs/helpers/tab-crud.tsapps/desktop/src/renderer/stores/tabs/types.tsapps/desktop/src/lib/trpc/routers/workspaces/utils/setup.tsapps/desktop/src/renderer/react-query/workspaces/useCreateWorkspace.tsapps/desktop/src/lib/trpc/routers/workspaces/workspaces.tsapps/desktop/src/lib/trpc/routers/workspaces/utils/setup.test.tsapps/desktop/src/renderer/stores/tabs/store.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx}: Avoid usinganytype - use explicit types instead for type safety
Use camelCase for variable and function names following existing codebase patterns
Keep diffs minimal with targeted edits only - avoid unnecessary changes when making modifications
Follow existing patterns and match the codebase style when writing new code
Files:
apps/desktop/src/main/lib/terminal-manager.tsapps/desktop/src/lib/trpc/routers/terminal/terminal.tsapps/desktop/src/renderer/stores/tabs/helpers/tab-crud.tsapps/desktop/src/renderer/stores/tabs/types.tsapps/desktop/src/lib/trpc/routers/workspaces/utils/setup.tsapps/desktop/src/renderer/react-query/workspaces/useCreateWorkspace.tsapps/desktop/src/lib/trpc/routers/workspaces/workspaces.tsapps/desktop/src/lib/trpc/routers/workspaces/utils/setup.test.tsapps/desktop/src/renderer/stores/tabs/store.ts
apps/desktop/src/main/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Node.js modules (fs, path, os, net, etc.) can be used in main process code only
Files:
apps/desktop/src/main/lib/terminal-manager.ts
apps/desktop/src/lib/**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
Never import Node.js modules in shared code like
src/lib/electron-router-dom.ts- this code runs in both main and renderer processes
Files:
apps/desktop/src/lib/trpc/routers/terminal/terminal.tsapps/desktop/src/lib/trpc/routers/workspaces/utils/setup.tsapps/desktop/src/lib/trpc/routers/workspaces/workspaces.tsapps/desktop/src/lib/trpc/routers/workspaces/utils/setup.test.ts
apps/desktop/src/renderer/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Never import Node.js modules (fs, path, os, net, etc.) in renderer process code - browser environment only
Files:
apps/desktop/src/renderer/stores/tabs/helpers/tab-crud.tsapps/desktop/src/renderer/stores/tabs/types.tsapps/desktop/src/renderer/react-query/workspaces/useCreateWorkspace.tsapps/desktop/src/renderer/stores/tabs/store.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/utils/setup.test.ts
🧠 Learnings (5)
📚 Learning: 2025-11-28T01:03:47.951Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-28T01:03:47.951Z
Learning: Applies to **/*.{ts,tsx} : Keep diffs minimal with targeted edits only - avoid unnecessary changes when making modifications
Applied to files:
apps/desktop/src/renderer/stores/tabs/types.tsapps/desktop/src/lib/trpc/routers/workspaces/utils/setup.tsapps/desktop/src/lib/trpc/routers/workspaces/workspaces.tsapps/desktop/src/lib/trpc/routers/workspaces/utils/setup.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/**/*.{ts,tsx} : Please use alias as defined in `tsconfig.json` when possible
Applied to files:
apps/desktop/src/lib/trpc/routers/workspaces/utils/setup.ts
📚 Learning: 2025-11-28T01:03:47.951Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-28T01:03:47.951Z
Learning: Applies to apps/desktop/src/main/**/*.{ts,tsx} : Node.js modules (fs, path, os, net, etc.) can be used in main process code only
Applied to files:
apps/desktop/src/lib/trpc/routers/workspaces/utils/setup.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/utils/setup.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/utils/setup.test.ts
🧬 Code graph analysis (5)
apps/desktop/src/lib/trpc/routers/terminal/terminal.ts (2)
apps/desktop/src/main/lib/db/index.ts (1)
db(18-25)apps/desktop/src/main/lib/terminal-manager.ts (1)
terminalManager(394-394)
apps/desktop/src/renderer/stores/tabs/helpers/tab-crud.ts (1)
apps/desktop/src/renderer/stores/tabs/types.ts (1)
TabsState(28-32)
apps/desktop/src/renderer/stores/tabs/types.ts (1)
apps/desktop/src/shared/types.ts (2)
Tab(44-56)TabType(23-30)
apps/desktop/src/renderer/react-query/workspaces/useCreateWorkspace.ts (1)
apps/desktop/src/main/lib/terminal-manager.ts (1)
createOrAttach(43-189)
apps/desktop/src/renderer/stores/tabs/store.ts (1)
apps/desktop/src/renderer/stores/tabs/helpers/tab-crud.ts (1)
handleAddTab(6-32)
⏰ 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 (10)
superset-setup.sh (1)
32-36: Verify hardcoded Neon project ID and fallback behavior.Line 32 uses
SUPERSET_WORKSPACE_NAMEwith a sensible fallback tobasename "$PWD", which is good. However, line 34 contains a hardcoded Neon project ID (tiny-cherry-82420694).Verify:
- This project ID is correct and appropriate for the shared workspace setup flow.
- Whether this should be made configurable (e.g., via environment variable or
.superset/setup.json) for different deployment scenarios..superset/setup.json (2)
1-5: Verify script path and execution context.The change from
"bun i"to"./superset-setup.sh"shifts setup responsibility to the dedicated script. However, ensure:
- The relative path
./superset-setup.shis correct for the execution context (is the working directory the repo root or the.superset/directory?).- The script is marked as executable (
chmod +x superset-setup.sh) in the repository.- The conductor/workspace utils that load this config properly handle the working directory.
2-4: Confirm alignment with removal of copy functionality.The AI summary notes that copy patterns (e.g.,
"**/.env*") were removed from this configuration. The current state shows only thecommandssection. Verify that:
- All file-copying setup logic has been removed from the codebase and is no longer expected by the workspace/terminal initialization flow.
- No downstream code still references copy-related setup configuration that was removed.
apps/desktop/src/lib/trpc/routers/workspaces/utils/setup.test.ts (1)
1-57: LGTM!The test refactoring correctly reflects the simplified setup logic. Tests remain independent, readable, and appropriately cover the new behavior focusing on commands validation only.
apps/desktop/src/renderer/stores/tabs/store.ts (1)
43-51: LGTM with note on closure pattern.The implementation correctly uses a closure to capture the
tabIdfrom the state update. This pattern works with Zustand sinceset()is called synchronously, ensuringtabIdis assigned before the function returns.apps/desktop/src/main/lib/terminal-manager.ts (1)
48-48: LGTM!The
mainRepoPathparameter addition is clean and follows existing patterns. The environment variable is properly set with a safe fallback, maintaining backward compatibility.Also applies to: 57-66, 97-97
apps/desktop/src/lib/trpc/routers/workspaces/workspaces.ts (1)
94-100: LGTM!The simplified return structure correctly removes setup copying logic and returns only the essential data. This aligns with the PR's goal to shift setup handling to terminal-based operations.
apps/desktop/src/renderer/stores/tabs/helpers/tab-crud.ts (1)
6-32: LGTM!The refactored return structure properly exposes the
tabIdwhile maintaining the state update pattern. This change enables the store to return the newly created tab ID to callers, which is essential for the new terminal-based setup flow.apps/desktop/src/renderer/stores/tabs/types.ts (2)
21-27: Tab union simplification aligns with new workspace flowRestricting
TabtoSingleTab | TabGroupcleanly removes setup‑specific tab concepts and keeps the tab model focused on the remaining types. This is consistent with the conductor‑style flow and sharedTabTypeusage.
34-36: Perfect! I've completed the verification. Let me confirm the findings:Verification Results:
✅ Implementation returns valid string: The
addTabfunction initializestabIdas an empty string (line 44) and assigns it fromresult.tabId(line 47), then returns it (line 50). The return type is guaranteed to be a string.✅ Type signature is correct: The interface declaration
addTab: (workspaceId: string, type?: TabType) => stringaccurately matches the implementation.✅ All call sites are type-correct:
- WorkspaceView/index.tsx (line 40):
addTab(activeWorkspaceId)- ignores return value ✓- TabsView/index.tsx (line 31):
addTab(activeWorkspaceId)- ignores return value ✓- useCreateWorkspace.ts (line 24):
const tabId = addTab(data.workspace.id)- captures and uses the return value as intended ✓
Return type change from
voidtostringis correctly implemented and verified across all usage sites. No breaking changes detected.
c36ceb5 to
145eb57
Compare
145eb57 to
fe0981e
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/desktop/src/lib/trpc/routers/workspaces/utils/setup.ts (1)
16-18: Enhance validation and fix misleading error message.The error message claims to validate an "array of strings," but the code only checks
Array.isArray()without validating element types. SinceJSON.parsereturns untyped data, adding element validation prevents downstream runtime errors.Apply this diff to add proper validation:
if (parsed.commands && !Array.isArray(parsed.commands)) { - throw new Error("'commands' field must be an array of strings"); + throw new Error("'commands' field must be an array"); } + +if (parsed.commands && !parsed.commands.every(cmd => typeof cmd === 'string')) { + throw new Error("'commands' field must be an array of strings"); +}
🧹 Nitpick comments (2)
superset-setup.sh (1)
32-32: Consider validating the workspace name early.The workspace name is derived from
SUPERSET_WORKSPACE_NAMEenvironment variable (or falls back to directory basename) and passed directly to Neon without validation. Neon branch names have naming constraints (e.g., length limits, allowed characters). If an invalid name is passed, the script will fail at theneonctlcall with an unclear error message.Add early validation to improve user experience and provide clear feedback:
# Create Neon branch for this workspace echo "🗄️ Creating Neon branch..." WORKSPACE_NAME="${SUPERSET_WORKSPACE_NAME:-$(basename "$PWD")}" + +# Validate workspace name (Neon has naming constraints) +if ! [[ "$WORKSPACE_NAME" =~ ^[a-z0-9_-]+$ ]] || [ ${#WORKSPACE_NAME} -gt 63 ]; then + error "Invalid workspace name: '$WORKSPACE_NAME'. Use lowercase alphanumeric, hyphens, underscores. Max 63 chars." +fi + NEON_OUTPUT=$(neonctl branches create \apps/desktop/src/renderer/react-query/workspaces/useCreateWorkspace.ts (1)
27-32: Consider adding error handling for terminal creation.The
createOrAttach.mutatecall is fire-and-forget. If terminal creation fails, the user won't be notified and the setup commands won't execute. Consider adding error handling:createOrAttach.mutate({ tabId, workspaceId: data.workspace.id, tabTitle: "Terminal", initialCommands: data.setupConfig, +}, { + onError: (error) => { + console.error("Failed to create terminal for setup commands:", error); + }, });
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (19)
.superset/setup.json(1 hunks)apps/desktop/src/lib/trpc/routers/terminal/terminal.ts(3 hunks)apps/desktop/src/lib/trpc/routers/workspaces/utils/setup.test.ts(2 hunks)apps/desktop/src/lib/trpc/routers/workspaces/utils/setup.ts(1 hunks)apps/desktop/src/lib/trpc/routers/workspaces/workspaces.ts(1 hunks)apps/desktop/src/main/lib/terminal-manager.ts(3 hunks)apps/desktop/src/renderer/react-query/workspaces/useCreateWorkspace.ts(1 hunks)apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/SetupTabView.tsx(0 hunks)apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/SetupTerminal/SetupTerminal.tsx(0 hunks)apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/SetupTerminal/index.ts(0 hunks)apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/index.tsx(0 hunks)apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/TabItem/index.tsx(0 hunks)apps/desktop/src/renderer/stores/tabs/helpers/tab-crud.ts(2 hunks)apps/desktop/src/renderer/stores/tabs/store.ts(1 hunks)apps/desktop/src/renderer/stores/tabs/types.ts(2 hunks)apps/desktop/src/shared/ipc-channels/worktree.ts(0 hunks)apps/desktop/src/shared/types.ts(0 hunks)conductor.json(0 hunks)superset-setup.sh(1 hunks)
💤 Files with no reviewable changes (8)
- conductor.json
- apps/desktop/src/shared/types.ts
- apps/desktop/src/shared/ipc-channels/worktree.ts
- apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/index.tsx
- apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/TabsView/TabItem/index.tsx
- apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/SetupTerminal/index.ts
- apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/SetupTabView.tsx
- apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/SetupTerminal/SetupTerminal.tsx
🚧 Files skipped from review as they are similar to previous changes (5)
- apps/desktop/src/lib/trpc/routers/terminal/terminal.ts
- apps/desktop/src/main/lib/terminal-manager.ts
- apps/desktop/src/lib/trpc/routers/workspaces/utils/setup.test.ts
- apps/desktop/src/lib/trpc/routers/workspaces/workspaces.ts
- .superset/setup.json
🧰 Additional context used
📓 Path-based instructions (5)
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/renderer/stores/tabs/helpers/tab-crud.tsapps/desktop/src/renderer/react-query/workspaces/useCreateWorkspace.tsapps/desktop/src/renderer/stores/tabs/store.tsapps/desktop/src/renderer/stores/tabs/types.tsapps/desktop/src/lib/trpc/routers/workspaces/utils/setup.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/renderer/stores/tabs/helpers/tab-crud.tsapps/desktop/src/renderer/react-query/workspaces/useCreateWorkspace.tsapps/desktop/src/renderer/stores/tabs/store.tsapps/desktop/src/renderer/stores/tabs/types.tsapps/desktop/src/lib/trpc/routers/workspaces/utils/setup.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx}: Avoid usinganytype - use explicit types instead for type safety
Use camelCase for variable and function names following existing codebase patterns
Keep diffs minimal with targeted edits only - avoid unnecessary changes when making modifications
Follow existing patterns and match the codebase style when writing new code
Files:
apps/desktop/src/renderer/stores/tabs/helpers/tab-crud.tsapps/desktop/src/renderer/react-query/workspaces/useCreateWorkspace.tsapps/desktop/src/renderer/stores/tabs/store.tsapps/desktop/src/renderer/stores/tabs/types.tsapps/desktop/src/lib/trpc/routers/workspaces/utils/setup.ts
apps/desktop/src/renderer/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Never import Node.js modules (fs, path, os, net, etc.) in renderer process code - browser environment only
Files:
apps/desktop/src/renderer/stores/tabs/helpers/tab-crud.tsapps/desktop/src/renderer/react-query/workspaces/useCreateWorkspace.tsapps/desktop/src/renderer/stores/tabs/store.tsapps/desktop/src/renderer/stores/tabs/types.ts
apps/desktop/src/lib/**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
Never import Node.js modules in shared code like
src/lib/electron-router-dom.ts- this code runs in both main and renderer processes
Files:
apps/desktop/src/lib/trpc/routers/workspaces/utils/setup.ts
🧠 Learnings (1)
📚 Learning: 2025-11-28T01:03:47.951Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-28T01:03:47.951Z
Learning: Applies to **/*.{ts,tsx} : Keep diffs minimal with targeted edits only - avoid unnecessary changes when making modifications
Applied to files:
apps/desktop/src/lib/trpc/routers/workspaces/utils/setup.ts
🧬 Code graph analysis (4)
apps/desktop/src/renderer/stores/tabs/helpers/tab-crud.ts (1)
apps/desktop/src/renderer/stores/tabs/types.ts (1)
TabsState(28-32)
apps/desktop/src/renderer/react-query/workspaces/useCreateWorkspace.ts (1)
apps/desktop/src/main/lib/terminal-manager.ts (1)
createOrAttach(43-189)
apps/desktop/src/renderer/stores/tabs/store.ts (1)
apps/desktop/src/renderer/stores/tabs/helpers/tab-crud.ts (1)
handleAddTab(6-32)
apps/desktop/src/renderer/stores/tabs/types.ts (1)
apps/desktop/src/shared/types.ts (2)
Tab(44-56)TabType(23-30)
⏰ 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). (2)
- GitHub Check: Build - macOS (arm64)
- GitHub Check: Build
🔇 Additional comments (7)
superset-setup.sh (1)
23-28: Conditional direnv linking looks sound.The logic defensively checks both environment variable presence and file existence before creating the symlink. The use of
ln -sfsafely overwrites any existing symlink.apps/desktop/src/renderer/stores/tabs/store.ts (1)
43-51: LGTM -addTabnow correctly returns the new tab ID.The implementation correctly captures the
tabIdfrom thehandleAddTabresult and returns it. Zustand'sset()is synchronous, so the pattern of mutatingtabIdinside the callback and returning it after is safe and works as expected.apps/desktop/src/renderer/stores/tabs/helpers/tab-crud.ts (1)
6-32: LGTM - Clean refactor ofhandleAddTabreturn type.The function now correctly returns both the new state and the tab ID in a structured object. The implementation maintains the existing history stack logic while enabling callers to obtain the newly created tab's ID. Type annotation is explicit and accurate.
apps/desktop/src/renderer/stores/tabs/types.ts (1)
26-35: LGTM - Type definitions cleaned up appropriately.The
Tabunion type correctly reflects the removal ofSetupTab, andaddTabreturn type is updated tostringto match the implementation. The store'sTabTypeenum (Single,Group) serves a different purpose than the sharedTabTypestring union—the former describes tab structure while the latter describes content type.apps/desktop/src/renderer/react-query/workspaces/useCreateWorkspace.ts (1)
27-32: <function_calls>
<invoke name="shell
<invoke_arguments>
#!/bin/bashGet the full terminal router file
cat -n apps/desktop/src/lib/trpc/routers/terminal/terminal.ts
</invoke_arguments>
</function_calls>apps/desktop/src/lib/trpc/routers/workspaces/utils/setup.ts (2)
1-2: LGTM! Clean removal of unused imports.The import cleanup appropriately removes file-copy related dependencies (
copyFile,mkdir,dirname,fast-glob) while retaining only what's needed for config loading.
5-27: SetupConfig type is correctly aligned with the narrowed function behavior.Verification confirms the
SetupConfiginterface inapps/desktop/src/shared/types.ts(line 130-132) only defines acommands?: string[]field. Thecopyfield does not exist in the type, and the function's validation logic correctly mirrors this—it only validates thecommandsfield when present. No type mismatch exists.
- SUPERSET_MAIN_REPO_PATH → SUPERSET_ROOT_PATH - Add SUPERSET_WORKSPACE_PATH for worktree path - Rename setupConfig → initialCommands in workspace create response 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Description
Related Issues
Type of Change
Testing
Screenshots (if applicable)
Additional Notes
Summary by CodeRabbit
Refactor
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.