MCPcopy
hub / github.com/garrytan/gstack / writeSnapshot

Function writeSnapshot

lib/gstack-decision.ts:226–230  ·  view source on GitHub ↗
(paths: DecisionPaths, active: ActiveDecision[])

Source from the content-addressed store, hash-verified

224 * O(active), not O(history).
225 */
226export function writeSnapshot(paths: DecisionPaths, active: ActiveDecision[]): void {
227 const tmp = `${paths.snapshot}.tmp.${process.pid}`;
228 writeFileSync(tmp, JSON.stringify(active), "utf-8");
229 renameSync(tmp, paths.snapshot);
230}
231
232/** Read the bounded active snapshot. Returns [] if missing/corrupt (caller may rebuild). */
233export function readSnapshot(paths: DecisionPaths): ActiveDecision[] {

Callers 3

rebuildSnapshotFunction · 0.85
compactFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected