* Migrates old autoUpdaterStatus to new installMethod and autoUpdates fields * @internal
(config: GlobalConfig)
| 910 | * @internal |
| 911 | */ |
| 912 | function migrateConfigFields(config: GlobalConfig): GlobalConfig { |
| 913 | // Already migrated |
| 914 | if (config.installMethod !== undefined) { |
| 915 | return config |
| 916 | } |
| 917 | |
| 918 | // autoUpdaterStatus is removed from the type but may exist in old configs |
| 919 | const legacy = config as GlobalConfig & { |
| 920 | autoUpdaterStatus?: |
| 921 | | 'migrated' |
| 922 | | 'installed' |
| 923 | | 'disabled' |
| 924 | | 'enabled' |
| 925 | | 'no_permissions' |
| 926 | | 'not_configured' |
| 927 | } |
| 928 | |
| 929 | // Determine install method and auto-update preference from old field |
| 930 | let installMethod: InstallMethod = 'unknown' |
| 931 | let autoUpdates = config.autoUpdates ?? true // Default to enabled unless explicitly disabled |
| 932 | |
| 933 | switch (legacy.autoUpdaterStatus) { |
| 934 | case 'migrated': |
| 935 | installMethod = 'local' |
| 936 | break |
| 937 | case 'installed': |
| 938 | installMethod = 'native' |
| 939 | break |
| 940 | case 'disabled': |
| 941 | // When disabled, we don't know the install method |
| 942 | autoUpdates = false |
| 943 | break |
| 944 | case 'enabled': |
| 945 | case 'no_permissions': |
| 946 | case 'not_configured': |
| 947 | // These imply global installation |
| 948 | installMethod = 'global' |
| 949 | break |
| 950 | case undefined: |
| 951 | // No old status, keep defaults |
| 952 | break |
| 953 | } |
| 954 | |
| 955 | return { |
| 956 | ...config, |
| 957 | installMethod, |
| 958 | autoUpdates, |
| 959 | } |
| 960 | } |
| 961 | |
| 962 | /** |
| 963 | * Removes history field from projects (migrated to history.jsonl) |
no outgoing calls
no test coverage detected