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