Files
orca/src/main/ipc/onboarding.ts
T
JinjingandOrca e0851ec722 feat: onboarding flow for new users (#1596)
* wip

* WIP: Changes before auto-review fixes

Co-authored-by: Orca <help@stably.ai>

* WIP: Changes before auto-review fixes

Co-authored-by: Orca <help@stably.ai>

* WIP: Changes before auto-review fixes

Co-authored-by: Orca <help@stably.ai>

* fix: address auto-review findings (iteration 1)

Co-authored-by: Orca <help@stably.ai>

* fix: address auto-review findings (iteration 2)

Co-authored-by: Orca <help@stably.ai>

* fix: archive review context and improve agent detection on wizard mount

Co-authored-by: Orca <help@stably.ai>

* fix: address CI lint failures and split use-onboarding-flow.ts

Co-authored-by: Orca <help@stably.ai>

* fix: mock ./onboarding in register-core-handlers test

Co-authored-by: Orca <help@stably.ai>

* fix: also toggle light class on documentElement so onboarding e2e theme wait resolves

The onboarding e2e calls waitForFunction(() => classList.contains('dark') || classList.contains('light')) before snapshotting the starting theme. applyDocumentTheme only toggled 'dark', so on a host that resolves system to light the wait timed out (CI Linux headless). Toggle 'light' as the inverse class so consumers can observe the resolved theme symmetrically; Tailwind keys only on 'dark' so styling is unchanged.

Co-authored-by: Orca <help@stably.ai>

* fix: add braces to Landing menu close-on-outside-click handler

oxlint config requires braces for all if statements.

Co-authored-by: Orca <help@stably.ai>

* chore: trigger CI

Co-authored-by: Orca <help@stably.ai>

---------

Co-authored-by: Orca <help@stably.ai>
2026-05-08 14:17:50 -07:00

17 lines
777 B
TypeScript

import { ipcMain } from 'electron'
import { sanitizeOnboardingUpdate, type Store } from '../persistence'
import type { OnboardingState } from '../../shared/types'
export function registerOnboardingHandlers(store: Store): void {
ipcMain.removeHandler('onboarding:get')
ipcMain.removeHandler('onboarding:update')
ipcMain.handle('onboarding:get', (): OnboardingState => store.getOnboarding())
// Why: never trust renderer input — a compromised/buggy caller could send
// unknown keys or wrong-typed values that would poison persisted state.
// Run every update through the shared whitelist sanitizer.
ipcMain.handle('onboarding:update', (_event, updates: unknown): OnboardingState => {
return store.updateOnboarding(sanitizeOnboardingUpdate(updates))
})
}