migrateReplBridgeEnabledToRemoteControlAtStartup.ts
migrations/migrateReplBridgeEnabledToRemoteControlAtStartup.ts
23
Lines
1000
Bytes
1
Exports
1
Imports
10
Keywords
What this is
This page documents one file from the repository and includes its full source so you can read it without leaving the docs site.
Beginner explanation
This file is one piece of the larger system. Its name, directory, imports, and exports show where it fits. Start by reading the exports and related files first.
How it is used
Start from the exports list and related files. Those are the easiest clues for where this file fits into the system.
Expert explanation
Architecturally, this file intersects with remote-bridge. It contains 23 lines, 1 detected imports, and 1 detected exports.
Important relationships
- migrations/migrateAutoUpdatesToSettings.ts
- migrations/migrateBypassPermissionsAcceptedToSettings.ts
- migrations/migrateEnableAllProjectMcpServersToSettings.ts
- migrations/migrateFennecToOpus.ts
- migrations/migrateLegacyOpusToCurrent.ts
- migrations/migrateOpusToOpus1m.ts
- migrations/migrateSonnet1mToSonnet45.ts
- migrations/migrateSonnet45ToSonnet46.ts
Detected exports
migrateReplBridgeEnabledToRemoteControlAtStartup
Keywords
prevconfigreplbridgeenabledremotecontrolatstartupoldvaluenextsaveglobalconfigmigrateonlyexists
Detected imports
../utils/config.js
Source notes
This page embeds the full file contents. Small or leaf files are still indexed honestly instead of being over-explained.
Full source
import { saveGlobalConfig } from '../utils/config.js'
/**
* Migrate the `replBridgeEnabled` config key to `remoteControlAtStartup`.
*
* The old key was an implementation detail that leaked into user-facing config.
* This migration copies the value to the new key and removes the old one.
* Idempotent — only acts when the old key exists and the new one doesn't.
*/
export function migrateReplBridgeEnabledToRemoteControlAtStartup(): void {
saveGlobalConfig(prev => {
// The old key is no longer in the GlobalConfig type, so access it via
// an untyped cast. Only migrate if the old key exists and the new key
// hasn't been set yet.
const oldValue = (prev as Record<string, unknown>)['replBridgeEnabled']
if (oldValue === undefined) return prev
if (prev.remoteControlAtStartup !== undefined) return prev
const next = { ...prev, remoteControlAtStartup: Boolean(oldValue) }
delete (next as Record<string, unknown>)['replBridgeEnabled']
return next
})
}