JSDoc
Classes
SerialQueue
classSerial command queue — guarantees no two `run()` calls overlap. Framework-agnostic: no MobX. Observers subscribe via callback on construction.
class SerialQueue
constructor
constructorconstructor(observers?: QueueObserver[]): SerialQueue
enqueue
methodAdd work to the end of the queue. Returns a promise that resolves (or rejects) with the result once it's this item's turn to execute.
<T>(id: string, label: string, run: () => Promise<T>): Promise<T>
whenIdle
methodReturns a promise that resolves when the queue is idle (no pending or in-flight commands). Safe to call when already idle.
whenIdle(): Promise<void>
pause
methodpause(): void
resume
methodresume(): void
WatchRegistry
classclass WatchRegistry
subscribe
methodSubscribe to events for paths matching `prefix`. Returns an unsubscribe function.
subscribe(prefix: string, cb: (event: WatchEvent) => void): () => void
emit
methodEmit a watch event to all subscribers whose prefix matches at least one of the changed paths.
emit(event: WatchEvent): void
Functions
runTransaction
functionExecute one transaction: resolve mutations → commit → push → handle conflicts. Called from within the serial queue; guaranteed exclusive access to gitFs.
runTransaction(tx: Transaction, config: RunnerConfig): Promise<TransactionResult>
runSyncIn
functionPull from remote, fire watch events for changed paths, return SyncInResult. Called from within the serial queue.
runSyncIn(config: RunnerConfig): Promise<SyncInResult>
createGitAppDocStore
functioncreateGitAppDocStore(_config: GitAppDocStoreConfig): DocStore
Interfaces
GitAppDocStoreConfig
interfaceinterface GitAppDocStoreConfig
gitFs
propertygitFs: GitFs
mgmt
propertymgmt: RepoManagement
repoRef
propertyrepoRef: { provider: "github" | "gitea" | "gitlab"; owner: string; name: string; branch: string; proxyBase: string; }getToken
propertyToken lookup is a function (not a value) so the docstore picks up fresh tokens when the user re-auths without needing reconstruction.
getToken: () => TokenLookup
author
propertyAuthor identity for commits. `timestampISO` is a function so each commit gets the current time — pass `() => new Date().toISOString()` in prod, fix it in tests.
author: Omit<{ name: string; email: string; timestampISO: string; }, "timestampISO"> & { readonly timestampISO: () => string; }RunnerConfig
interfaceinterface RunnerConfig
gitFs
propertygitFs: GitFs
repoRef
propertyrepoRef: { provider: "github" | "gitea" | "gitlab"; owner: string; name: string; branch: string; proxyBase: string; }getToken
propertygetToken: () => TokenLookup
author
propertyauthor: Omit<{ name: string; email: string; timestampISO: string; }, "timestampISO"> & { readonly timestampISO: () => string; }watchRegistry
propertywatchRegistry: WatchRegistry