Overview
The Desktop API provides type-safe Electron IPC communication via tRPC for managing workspaces, terminals, file systems, and git operations. Location:apps/desktop/src/lib/trpc/routers/
Router Structure
The desktop app router is created inapps/desktop/src/lib/trpc/routers/index.ts:29:
Workspaces API
Manage git worktrees and workspace lifecycle. Source:apps/desktop/src/lib/trpc/routers/workspaces/
Procedures
workspaces.getAll
void
Returns all workspaces
Workspace[]
Array of workspace objects
workspaces.create
string
required
Workspace name
string
required
Project UUID
string
Branch name (auto-generated if not provided)
string
default:"main"
Branch to create from
workspaces.delete
string
required
Workspace UUID
workspaces.refreshGitStatus
string
required
Workspace UUID
Terminal API
Manage terminal sessions with daemon-backed runtime. Source:apps/desktop/src/lib/trpc/routers/terminal/terminal.ts:48
Environment Variables
Terminal sessions receive these environment variables:PATH: Prepends~/.superset/binfor agent command wrappersSUPERSET_PANE_ID: Pane identifierSUPERSET_TAB_ID: Tab identifierSUPERSET_WORKSPACE_ID: Workspace UUIDSUPERSET_WORKSPACE_NAME: Workspace nameSUPERSET_WORKSPACE_PATH: Worktree pathSUPERSET_ROOT_PATH: Main repo pathSUPERSET_PORT: Hooks server port
Procedures
terminal.createOrAttach
string
required
Pane identifier (safe ID, no slashes)
string
required
Tab identifier
string
required
Workspace UUID
number
Terminal columns
number
Terminal rows
string
Working directory override
'dark' | 'light'
Terminal theme
{ sessionKey: string }
Example:
terminal.write
string
required
Pane identifier
string
required
Data to write to terminal
terminal.resize
string
required
Pane identifier
number
required
New column count
number
required
New row count
terminal.subscribe
string
required
Pane identifier
File System API
File operations with search capabilities. Source:apps/desktop/src/lib/trpc/routers/filesystem/index.ts:582
Procedures
filesystem.readDirectory
string
required
Directory path to read
string
required
Workspace root path
Include hidden files (starting with
.)DirectoryEntry[]
filesystem.searchFiles
Fuzzy search for files by name.
string
required
Search root directory
string
required
Search query
string
Glob pattern to include (e.g.,
"*.ts,*.tsx")string
Glob pattern to exclude (e.g.,
"node_modules,dist")number
default:200
Maximum results (max 500)
filesystem.searchKeyword
Search file contents using ripgrep (falls back to scan if ripgrep unavailable).
string
required
Search root directory
string
required
Search keyword
string
File patterns to include
string
File patterns to exclude
Search hidden files
number
default:200
Maximum matches
KeywordSearchMatch[]
filesystem.createFile
string
required
Parent directory path
string
required
File name
string
default:""
File content
{ path: string }
filesystem.createDirectory
string
required
Parent directory
string
required
Directory name
{ path: string }
filesystem.delete
string[]
required
Paths to delete
boolean
default:false
Permanently delete (true) or move to trash (false)
string[]
Successfully deleted paths
Array<{path: string, error: string}>
Failed deletions
Git/Changes API
Git operations and file staging. Source:apps/desktop/src/lib/trpc/routers/changes/
Procedures
changes.status
string
required
Workspace UUID
changes.stage
string
required
Workspace UUID
string[]
required
File paths to stage
changes.unstage
string
required
Workspace UUID
string[]
required
File paths to unstage
changes.commit
string
required
Workspace UUID
string
required
Commit message
Usage Patterns
React Hooks
Error Handling
TypeScript Types
Next Steps
tRPC Endpoints
Explore cloud tRPC API procedures