MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / deserializeMaintainHistory

Function deserializeMaintainHistory

src/cli/maintain-history.ts:85–93  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

83 * PURE.
84 */
85export function deserializeMaintainHistory(text: string): { runs: MaintainRun[]; exportedAt?: string; version?: number; audit?: HistoryAudit } {
86 let obj: any;
87 try { obj = JSON.parse(text); } catch { throw new Error('not valid JSON'); }
88 const rawRuns = Array.isArray(obj) ? obj : obj?.runs;
89 if (!Array.isArray(rawRuns)) throw new Error('no maintain runs found in the file');
90 const runs = rawRuns.filter(isRunLike).map(normalizeRun);
91 const audit = obj?.audit && typeof obj.audit === 'object' && typeof obj.audit.head === 'string' ? obj.audit as HistoryAudit : undefined;
92 return { runs, exportedAt: typeof obj?.exportedAt === 'string' ? obj.exportedAt : undefined, version: typeof obj?.version === 'number' ? obj.version : undefined, audit };
93}
94
95/** A stable identity for a run, so re-importing the same snapshot doesn't double-count. */
96function runKey(r: MaintainRun): string {

Callers 3

index.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected