Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

624 B
Raw Blame
import { readFileSync } from 'node:fs';

import { snapshotPath } from './paths.ts';

export interface SnapshotColor {
  id: string;
  light: string | null;
  dark: string | null;
}

export interface ColorDefaultsSnapshot {
  source: string;
  count: number;
  colors: SnapshotColor[];
}

export function readSnapshot(repoRoot?: string): ColorDefaultsSnapshot {
  return JSON.parse(readFileSync(snapshotPath(repoRoot), 'utf8')) as ColorDefaultsSnapshot;
}

export function snapshotById(
  snapshot: ColorDefaultsSnapshot,
): Map<string, SnapshotColor> {
  return new Map(snapshot.colors.map((entry) => [entry.id, entry]));
}