(
sourceHome: string,
run: MarkerRun & { readonly targetPath: string },
)
| 55 | } |
| 56 | |
| 57 | export async function appendMarkerRun( |
| 58 | sourceHome: string, |
| 59 | run: MarkerRun & { readonly targetPath: string }, |
| 60 | ): Promise<void> { |
| 61 | const existing = await readMarker(sourceHome); |
| 62 | if (existing === undefined) throw new Error('appendMarkerRun: no existing marker'); |
| 63 | const updated: MarkerData = { |
| 64 | ...existing, |
| 65 | last_migrated_at: run.completedAt, |
| 66 | migrator_version: run.migratorVersion, |
| 67 | // Record the latest run's target so a rerun to a different KIMI_CODE_HOME |
| 68 | // updates the marker — otherwise `detectPendingMigration` keeps prompting |
| 69 | // for the new target even though it was just migrated. |
| 70 | target_path: run.targetPath, |
| 71 | runs: [ |
| 72 | ...existing.runs, |
| 73 | { |
| 74 | startedAt: run.startedAt, |
| 75 | completedAt: run.completedAt, |
| 76 | migratorVersion: run.migratorVersion, |
| 77 | summary: run.summary, |
| 78 | }, |
| 79 | ], |
| 80 | }; |
| 81 | await writeFile(migratedMarker(sourceHome), JSON.stringify(updated, null, 2), 'utf-8'); |
| 82 | } |
no test coverage detected