Files
CherryHQ-cherry-studio/packages/shared/data/bootConfig/bootConfigSchemas.ts

78 lines
3.1 KiB
TypeScript

/**
* Auto-generated boot config schema
* Generated at: 2026-04-16T11:08:02.758Z
*
* This file is automatically generated from classification.json (plus a
* small MANUAL_BOOT_CONFIG_ITEMS list in generate-boot-config.js for keys
* that don't fit classification.json's model yet, e.g. config-file sources).
*
* To update this file, either modify classification.json or the manual list
* in the generator, then run:
* node v2-refactor-temp/tools/data-classify/scripts/generate-boot-config.js
*
* === AUTO-GENERATED CONTENT START ===
*/
export interface BootConfigSchema {
// redux/settings/disableHardwareAcceleration
'app.disable_hardware_acceleration': boolean
/**
* Custom user data directory, keyed by executable path.
*
* Conceptually a single setting ("where user data lives"); stored as a
* Record so the same machine can host multiple installations (stable / dev /
* portable) with independent user data locations — matching the v1 behavior
* of ~/.cherrystudio/config/config.json's `appDataPath` array.
*
* Key: executable path (matches Electron's `app.getPath('exe')`).
* Value: absolute path to the chosen userData directory.
*
* Migrated from v1 ~/.cherrystudio/config/config.json on first v1→v2 run
* via the 'configfile' source in BootConfigMigrator.
*/
// configfile/legacy-home/appDataPath
'app.user_data_path': Record<string, string>
/**
* In-flight relocation of the Electron userData directory tree
* (the directory returned by `app.getPath('userData')`).
*
* Lives under the `temp.*` top-level namespace — reserved for ephemeral
* runtime state: single in-flight operations meant to be cleared once
* consumed. **Never** backed up or synced: restoring a stale temp.* entry
* on a different machine or at a different time can cause silent data
* corruption (e.g. re-executing a relocation that already happened).
*
* Lifecycle:
* - null: no relocation in progress (default).
* - { status: 'pending', from, to }: an IPC handler wrote this request
* and the next preboot should execute the copy.
* - { status: 'failed', from, to, error, failedAt }: a previous preboot
* attempted the copy and it failed. The record stays in BootConfig
* until a renderer recovery flow lets the user retry, abandon, or
* investigate. The app continues running on the previous userData
* location until then.
*
* Note: "userData" here means the Electron OS directory
* (app.getPath('userData')), not the colloquial sense of user content.
* The copy includes everything under that directory — user files,
* Chromium runtime state, logs, etc.
*
* Consumer: src/main/core/preboot/userDataLocation.ts
*/
// preboot/transient/userDataRelocation
'temp.user_data_relocation':
| { status: 'pending'; from: string; to: string }
| { status: 'failed'; from: string; to: string; error: string; failedAt: string }
| null
}
export const DefaultBootConfig: BootConfigSchema = {
'app.disable_hardware_acceleration': false,
'app.user_data_path': {},
'temp.user_data_relocation': null
}
// === AUTO-GENERATED CONTENT END ===