Skip to content

Commit 4df7e9f

Browse files
committed
feat: update IPC types and handlers to support fullstack mode
1 parent 19d1a90 commit 4df7e9f

File tree

4 files changed

+25
-11
lines changed

4 files changed

+25
-11
lines changed

src/components/settings/RooCodeConfiguration.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export function RooCodeConfiguration({ provider }: RooCodeConfigurationProps) {
4242
}
4343

4444
const ipcClient = IpcClient.getInstance();
45-
await ipcClient.invoke("roocode:auth-callback", data.code, data.state);
45+
await ipcClient.roocodeAuthCallback(data.code, data.state);
4646
await checkAuthStatus(); // Refresh auth status
4747
} catch (error) {
4848
console.error("Failed to handle Roo Code auth callback:", error);
@@ -61,7 +61,7 @@ export function RooCodeConfiguration({ provider }: RooCodeConfigurationProps) {
6161
}
6262

6363
const ipcClient = IpcClient.getInstance();
64-
const status = await ipcClient.invoke("roocode:auth-status");
64+
const status = await ipcClient.roocodeAuthStatus();
6565
setAuthState(status);
6666
} catch (error) {
6767
console.error("Failed to check Roo Code auth status:", error);
@@ -80,7 +80,7 @@ export function RooCodeConfiguration({ provider }: RooCodeConfigurationProps) {
8080
}
8181

8282
const ipcClient = IpcClient.getInstance();
83-
await ipcClient.invoke("roocode:login");
83+
await ipcClient.roocodeLogin();
8484
// The login process will open a browser window and handle the callback
8585
} catch (error) {
8686
console.error("Failed to initiate Roo Code login:", error);
@@ -99,7 +99,7 @@ export function RooCodeConfiguration({ provider }: RooCodeConfigurationProps) {
9999
}
100100

101101
const ipcClient = IpcClient.getInstance();
102-
await ipcClient.invoke("roocode:logout");
102+
await ipcClient.roocodeLogout();
103103
await checkAuthStatus(); // Refresh auth status
104104
} catch (error) {
105105
console.error("Failed to logout from Roo Code:", error);

src/ipc/handlers/app_handlers.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,7 @@ export function registerAppHandlers() {
574574
fullAppPath,
575575
selectedTemplateId: params.selectedTemplateId,
576576
selectedBackendFramework: params.selectedBackendFramework,
577+
isFullStack: params.isFullStack,
577578
});
578579

579580
// Initialize git repo and create first commit

src/ipc/handlers/roocode_auth_handlers.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ async function handleRooCodeLogin(): Promise<void> {
155155

156156
// Store state for verification
157157
const authData = loadAuthData();
158-
authData[AUTH_STATE_KEY] = state;
158+
(authData as any)[AUTH_STATE_KEY] = state;
159159
saveAuthData(authData);
160160

161161
// Generate authorization URL
@@ -186,11 +186,7 @@ async function handleRooCodeLogin(): Promise<void> {
186186

187187
// Open browser for authentication
188188
try {
189-
const success = await shell.openExternal(authUrl);
190-
if (!success) {
191-
logger.warn("shell.openExternal returned false - browser may not have opened");
192-
throw new Error("Failed to open browser for authentication");
193-
}
189+
await shell.openExternal(authUrl);
194190
logger.info("Opened Roo Code authentication URL in browser");
195191
} catch (shellError) {
196192
logger.error("shell.openExternal failed:", shellError);
@@ -206,7 +202,7 @@ async function handleRooCodeCallback(code: string, state: string): Promise<void>
206202
try {
207203
// Verify state parameter
208204
const authData = loadAuthData();
209-
const storedState = authData[AUTH_STATE_KEY];
205+
const storedState = (authData as any)[AUTH_STATE_KEY];
210206

211207
if (state !== storedState) {
212208
throw new Error("Invalid state parameter. Authentication request may have been tampered with.");

src/ipc/ipc_client.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,4 +1218,21 @@ export class IpcClient {
12181218
public async createMissingFolder(params: { appId: number; folderType: "frontend" | "backend"; templateId?: string; backendFramework?: string }): Promise<void> {
12191219
return this.ipcRenderer.invoke("create-missing-folder", params);
12201220
}
1221+
1222+
// Roo Code authentication methods
1223+
public async roocodeLogin(): Promise<void> {
1224+
return this.ipcRenderer.invoke("roocode:login");
1225+
}
1226+
1227+
public async roocodeLogout(): Promise<void> {
1228+
return this.ipcRenderer.invoke("roocode:logout");
1229+
}
1230+
1231+
public async roocodeAuthStatus(): Promise<any> {
1232+
return this.ipcRenderer.invoke("roocode:auth-status");
1233+
}
1234+
1235+
public async roocodeAuthCallback(code: string, state: string): Promise<void> {
1236+
return this.ipcRenderer.invoke("roocode:auth-callback", code, state);
1237+
}
12211238
}

0 commit comments

Comments
 (0)