Skip to content

TraceCommands

typescript
import { TraceCommands } from '@zoebuildsai/trace'

Core version control operations — save, log, diff, restore, status.

.commit()
message: string, author?: string, metadata?: Record<string, unknown>
Returns: string (hash)
Save a snapshot of the current working directory.
typescript
const hash = trace.commit('Updated memory', 'agent-42', { batch: 150 })
.log()
limit?: number
Returns: LogEntry[]
View save history. Returns array of {hash, shortHash, message, timestamp, author}.
typescript
const entries = trace.log(10)
.diff()
hash1: string, hash2: string, options?: DiffOptions
Returns: string
Compare two snapshots. Pass {lines: true} for line-level detail.
typescript
const output = trace.diff('abc1234', 'def5678', { lines: true })
.checkout()
hash: string, options?: CheckoutOptions
Returns: void
Restore working directory to a previous state.
typescript
trace.checkout('abc1234', { force: true })
.status()
none
Returns: StatusResult
Show changes since last save. Returns {modified, added, deleted, untracked, clean}.
typescript
const s = trace.status()
if (!s.clean) trace.commit('[auto] snapshot')
.getCurrentCommit()
none
Returns: CommitObject | null
Get the current HEAD commit object.
typescript
const head = trace.getCurrentCommit()