Skip to content

Commit 193b07d

Browse files
grichaclaude
andauthored
Add clone parameter support to startWorkspace in web and mobile clients (#12)
Previously, the `--clone` flag was only supported in the CLI's `perry start` command and worked correctly on the backend. However, the web and mobile API clients had type definitions and function signatures for `startWorkspace` that didn't include the `clone` parameter, preventing UI clients from passing repository URLs when starting workspaces. This change updates both web and mobile API clients to: - Add `clone` and `env` optional parameters to the `start` RPC type definition - Update the `startWorkspace` function to accept and pass through these options This aligns the web/mobile clients with the CLI behavior where `perry start --clone <url>` creates a workspace with a repository if it doesn't exist. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent b3c6454 commit 193b07d

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

mobile/src/lib/api.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ function createClient() {
151151
get: (input: { name: string }) => Promise<WorkspaceInfo>
152152
create: (input: CreateWorkspaceRequest) => Promise<WorkspaceInfo>
153153
delete: (input: { name: string }) => Promise<{ success: boolean }>
154-
start: (input: { name: string }) => Promise<WorkspaceInfo>
154+
start: (input: { name: string; clone?: string; env?: Record<string, string> }) => Promise<WorkspaceInfo>
155155
stop: (input: { name: string }) => Promise<WorkspaceInfo>
156156
logs: (input: { name: string; tail?: number }) => Promise<string>
157157
sync: (input: { name: string }) => Promise<{ success: boolean }>
@@ -230,7 +230,8 @@ export const api = {
230230
getWorkspace: (name: string) => client.workspaces.get({ name }),
231231
createWorkspace: (data: CreateWorkspaceRequest) => client.workspaces.create(data),
232232
deleteWorkspace: (name: string) => client.workspaces.delete({ name }),
233-
startWorkspace: (name: string) => client.workspaces.start({ name }),
233+
startWorkspace: (name: string, options?: { clone?: string; env?: Record<string, string> }) =>
234+
client.workspaces.start({ name, clone: options?.clone, env: options?.env }),
234235
stopWorkspace: (name: string) => client.workspaces.stop({ name }),
235236
getLogs: (name: string, tail = 100) => client.workspaces.logs({ name, tail }),
236237
syncWorkspace: (name: string) => client.workspaces.sync({ name }),

web/src/lib/api.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const client = createORPCClient<{
5353
get: (input: { name: string }) => Promise<WorkspaceInfo>
5454
create: (input: CreateWorkspaceRequest) => Promise<WorkspaceInfo>
5555
delete: (input: { name: string }) => Promise<{ success: boolean }>
56-
start: (input: { name: string }) => Promise<WorkspaceInfo>
56+
start: (input: { name: string; clone?: string; env?: Record<string, string> }) => Promise<WorkspaceInfo>
5757
stop: (input: { name: string }) => Promise<WorkspaceInfo>
5858
logs: (input: { name: string; tail?: number }) => Promise<string>
5959
sync: (input: { name: string }) => Promise<{ success: boolean }>
@@ -107,7 +107,8 @@ export const api = {
107107
getWorkspace: (name: string) => client.workspaces.get({ name }),
108108
createWorkspace: (data: CreateWorkspaceRequest) => client.workspaces.create(data),
109109
deleteWorkspace: (name: string) => client.workspaces.delete({ name }),
110-
startWorkspace: (name: string) => client.workspaces.start({ name }),
110+
startWorkspace: (name: string, options?: { clone?: string; env?: Record<string, string> }) =>
111+
client.workspaces.start({ name, clone: options?.clone, env: options?.env }),
111112
stopWorkspace: (name: string) => client.workspaces.stop({ name }),
112113
getLogs: (name: string, tail = 100) => client.workspaces.logs({ name, tail }),
113114
syncWorkspace: (name: string) => client.workspaces.sync({ name }),

0 commit comments

Comments
 (0)