MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / runMigration

Function runMigration

packages/migration-legacy/src/run-migration.ts:34–152  ·  view source on GitHub ↗
(input: RunMigrationInput)

Source from the content-addressed store, hash-verified

32}
33
34export async function runMigration(input: RunMigrationInput): Promise<MigrationReport> {
35 const startedAt = new Date().toISOString();
36 const version = input.migratorVersion ?? DEFAULT_MIGRATOR_VERSION;
37 const log = (m: string): void => {
38 input.onProgress?.(m);
39 };
40
41 const config = input.scope.config
42 ? await migrateConfigStep({ sourceHome: input.source, targetHome: input.target })
43 : {
44 migrated: false,
45 tuiExtracted: false,
46 droppedProviders: [],
47 droppedModels: [],
48 droppedKeys: [],
49 configConflicts: [],
50 wroteSiblingDueToConflict: false,
51 wroteTuiSibling: false,
52 migratedHooks: 0,
53 droppedHooks: 0,
54 siblingContents: { providers: [], models: [], hooks: 0 },
55 };
56 log('config done');
57
58 const mcp = input.scope.mcp
59 ? await migrateMcpStep({ sourceHome: input.source, targetHome: input.target })
60 : { mergedServers: [], keptNewForConflicts: [], droppedServers: [], wroteSiblingDueToConflict: false };
61 log('mcp done');
62
63 const userHistory = input.scope.userHistory
64 ? await migrateUserHistoryStep({ sourceHome: input.source, targetHome: input.target })
65 : { copied: 0, skippedExisting: 0 };
66 log('user-history done');
67
68 const skills = input.scope.skills
69 ? await migrateSkillsStep({ sourceHome: input.source, targetHome: input.target })
70 : { copied: 0, skippedExisting: 0 };
71 log('skills done');
72
73 const sessions: SessionsSummary = input.scope.sessions
74 ? await migrateSessionsStep({
75 sourceHome: input.source,
76 targetHome: input.target,
77 onSessionProgress: input.onSessionProgress,
78 })
79 : emptyConfigOnlySessions();
80 log('sessions done');
81
82 const completedAt = new Date().toISOString();
83
84 const report: MigrationReport = {
85 startedAt,
86 completedAt,
87 migratorVersion: version,
88 source: input.source,
89 target: input.target,
90 summary: {
91 config,

Callers 1

Calls 12

migrateConfigStepFunction · 0.85
migrateMcpStepFunction · 0.85
migrateUserHistoryStepFunction · 0.85
migrateSkillsStepFunction · 0.85
migrateSessionsStepFunction · 0.85
emptyConfigOnlySessionsFunction · 0.85
writeReportFunction · 0.85
writeMigrationErrorsLogFunction · 0.85
readMarkerFunction · 0.85
writeMarkerFunction · 0.85
appendMarkerRunFunction · 0.85
logFunction · 0.70

Tested by

no test coverage detected