Skip to main content

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 in apps/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
Example:

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
Returns: Created workspace object Example:

workspaces.delete

string
required
Workspace UUID
Example:

workspaces.refreshGitStatus

string
required
Workspace UUID
Returns: Git status information (branch, ahead/behind commits, dirty status)

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/bin for agent command wrappers
  • SUPERSET_PANE_ID: Pane identifier
  • SUPERSET_TAB_ID: Tab identifier
  • SUPERSET_WORKSPACE_ID: Workspace UUID
  • SUPERSET_WORKSPACE_NAME: Workspace name
  • SUPERSET_WORKSPACE_PATH: Worktree path
  • SUPERSET_ROOT_PATH: Main repo path
  • SUPERSET_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
Returns: { sessionKey: string } Example:

terminal.write

string
required
Pane identifier
string
required
Data to write to terminal
Example:

terminal.resize

string
required
Pane identifier
number
required
New column count
number
required
New row count

terminal.subscribe

Uses observable pattern (required by trpc-electron for Electron IPC subscriptions).
string
required
Pane identifier
Returns: Observable stream of terminal events Example:

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
boolean
default:false
Include hidden files (starting with .)
DirectoryEntry[]
Example:

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)
Example:

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
boolean
default:false
Search hidden files
number
default:200
Maximum matches
KeywordSearchMatch[]
Example:

filesystem.createFile

string
required
Parent directory path
string
required
File name
string
default:""
File content
Returns: { path: string }

filesystem.createDirectory

string
required
Parent directory
string
required
Directory name
Returns: { path: string }

filesystem.delete

string[]
required
Paths to delete
boolean
default:false
Permanently delete (true) or move to trash (false)
Returns:
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
Returns: Git status (staged, unstaged, untracked files)

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