MCPcopy
hub / github.com/codeaashu/claude-code / resetProToOpusDefault

Function resetProToOpusDefault

src/migrations/resetProToOpusDefault.ts:7–51  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5import { getSettings_DEPRECATED } from '../utils/settings/settings.js'
6
7export function resetProToOpusDefault(): void {
8 const config = getGlobalConfig()
9
10 if (config.opusProMigrationComplete) {
11 return
12 }
13
14 const apiProvider = getAPIProvider()
15
16 // Pro users on firstParty get auto-migrated to Opus 4.5 default
17 if (apiProvider !== 'firstParty' || !isProSubscriber()) {
18 saveGlobalConfig(current => ({
19 ...current,
20 opusProMigrationComplete: true,
21 }))
22 logEvent('tengu_reset_pro_to_opus_default', { skipped: true })
23 return
24 }
25
26 const settings = getSettings_DEPRECATED()
27
28 // Only show notification if user was on default (no custom model setting)
29 if (settings?.model === undefined) {
30 const opusProMigrationTimestamp = Date.now()
31 saveGlobalConfig(current => ({
32 ...current,
33 opusProMigrationComplete: true,
34 opusProMigrationTimestamp,
35 }))
36 logEvent('tengu_reset_pro_to_opus_default', {
37 skipped: false,
38 had_custom_model: false,
39 })
40 } else {
41 // User has a custom model setting, just mark migration complete
42 saveGlobalConfig(current => ({
43 ...current,
44 opusProMigrationComplete: true,
45 }))
46 logEvent('tengu_reset_pro_to_opus_default', {
47 skipped: false,
48 had_custom_model: true,
49 })
50 }
51}
52

Callers 1

runMigrationsFunction · 0.85

Calls 5

getGlobalConfigFunction · 0.85
getAPIProviderFunction · 0.85
isProSubscriberFunction · 0.85
saveGlobalConfigFunction · 0.85
logEventFunction · 0.85

Tested by

no test coverage detected