chore: initialize repository baseline
Import the existing Electron + React + TypeScript app as the version-control baseline before the scanner rework (C# input/capture sidecar, resolution-anchored layout profiles, OCR preprocessing, eval harness, rescan-merge, GOOD interop). Housekeeping in this commit: - Remove orphaned temp_inputhelper_block.ts (duplicate of the input-helper script). - Ignore .claude/scheduled_tasks.lock local session state. - Add .gitattributes to normalize line endings (LF in repo). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import type { SnapshotRepositoryPort } from "./contracts.js";
|
||||
import type { SaveResultWithPath } from "../../src/types/global.js";
|
||||
import type { AppSnapshot } from "../../src/types/domain.js";
|
||||
|
||||
export class JsonSnapshotRepository implements SnapshotRepositoryPort {
|
||||
private readonly filePath: string;
|
||||
|
||||
constructor(userDataPath: string, fileName = "snapshot.json") {
|
||||
this.filePath = path.join(userDataPath, fileName);
|
||||
}
|
||||
|
||||
async load() {
|
||||
try {
|
||||
return JSON.parse(await fs.readFile(this.filePath, "utf8")) as AppSnapshot;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
async save(snapshot: AppSnapshot): Promise<SaveResultWithPath> {
|
||||
await fs.mkdir(path.dirname(this.filePath), { recursive: true });
|
||||
await fs.writeFile(this.filePath, JSON.stringify(snapshot, null, 2), "utf8");
|
||||
return { ok: true, path: this.filePath };
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user