MCPcopy Create free account
hub / github.com/arctic-cli/interface / assert

Function assert

packages/arctic/src/file/time.ts:28–37  ·  view source on GitHub ↗
(sessionID: string, filepath: string)

Source from the content-addressed store, hash-verified

26 }
27
28 export async function assert(sessionID: string, filepath: string) {
29 const time = get(sessionID, filepath)
30 if (!time) throw new Error(`You must read the file ${filepath} before overwriting it. Use the Read tool first`)
31 const stats = await Bun.file(filepath).stat()
32 if (stats.mtime.getTime() > time.getTime()) {
33 throw new Error(
34 `File ${filepath} has been modified since it was last read.\nLast modification: ${stats.mtime.toISOString()}\nLast read: ${time.toISOString()}\n\nPlease read the file again before modifying it.`,
35 )
36 }
37 }
38}

Callers

nothing calls this directly

Calls 1

getFunction · 0.70

Tested by

no test coverage detected