Skip to content

GitBackend

reference
1 min readUpdated

Kind: Class

Source: atloria-monorepo/libs/agent-core/src/context/git-backend.ts

Implements: CheckpointBackend

Methods

MethodSignatureReturns
isGitRepoisGitRepo(dir: string)boolean
savesave(snap: Snapshot)void
loadload(relPath: string)Snapshot[]
loadLatestloadLatest(relPath: string)`Snapshot
deleteFiledeleteFile(relPath: string)void
deleteFromdeleteFrom(relPath: string, fromIndex: number)void
getTrackedFilesgetTrackedFiles()string[]
getTotalCountgetTotalCount()number
getSnapshotCountgetSnapshotCount(relPath: string)number
clearclear()void
evictOldestevictOldest()boolean

Properties

PropertyType
sessionIdstring

Where it refuses work

  • GitBackend stops the work with Error when !this.gitDir.
  • GitBackend stops the work with an early return when !entries || entries.length === 0, in 2 places.
  • GitBackend stops the work with an early return when !entries.
  • GitBackend stops the work with an early return when fromIndex < 0 || fromIndex >= entries.length.

When something fails

  • GitBackend handles failure in 7 places: it turns it into a return value in 3, discards it silently in 3, and logs it and continues in 1. A failure discarded silently leaves no trace for whoever debugs this later.

Was this page helpful?

Download as PDF