@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
31 lines • 1.43 kB
TypeScript
/**
* One-shot on-disk migration of legacy provider ids in models.json (senpi#2044).
*
* A models.json written before the subscription rename (senpi#1989) keys its
* overlays and `disabledProviders` by the legacy ids. The read boundary in
* `model-config.ts` already normalizes them in memory; this module rewrites the
* file once so the notice never repeats. The file is user-authored JSONC, so
* only the affected key/element tokens are edited - comments and formatting
* survive - and the result must re-parse to exactly the migrated document
* before it replaces the original.
*/
export type ModelsJsonMigration = {
readonly kind: "unchanged";
} | {
readonly kind: "migrated";
readonly renamed: readonly string[];
readonly backupPath: string;
} | {
readonly kind: "failed";
readonly renamed: readonly string[];
readonly reason: string;
};
export declare function uniqueBackupPath(path: string): string;
/**
* Rewrite `path` once when its content (already read as `content`) uses a legacy
* provider id. Keeps a timestamped backup of the original bytes, writes through a
* temp file with the original mode, and refuses to replace a file that changed
* since it was read. Never throws: a failure leaves the original untouched.
*/
export declare function migrateModelsJsonProviderIds(path: string, content: string): ModelsJsonMigration;
//# sourceMappingURL=models-json-migration.d.ts.map