Gitapp
Gitapp

API

Reference for the public surface of every package in the stack. Generated from the package source — see JSDoc for the full type-level view.

@dev-bench/docstore

Storage-agnostic interface package. No git knowledge — implementations include @dev-bench/gitapp (git-backed) and future obsidian-store / fs-store backends.

Interface

ExportSignatureSummary
DocStoreinterfaceRead / list / runTransaction / watch / syncIn / drain. Atomic mutations, opaque versionToken CAS.

Schemas + types (Zod)

ExportKindSummary
ReadResult / ReadResultSchemaunionfound | missing for docStore.read.
DocEntry / DocEntrySchematypeListing entry: { path, type, versionToken }.
IfMatch / IfMatchSchemaunionOptimistic CAS token: any | absent | version.
JsonPatchOp / JsonPatchOpSchemaunionRFC-6902 op for json-patch mutations.
FrontmatterBody / FrontmatterBodySchemaunionBody for upsert-frontmatter mutations.
IfMissing / IfMissingSchemaenumcreate-empty | fail policy when target missing.
Mutation / MutationSchemaunionput | delete | json-patch | upsert-frontmatter.
ConflictPolicy / ConflictPolicySchemaunionfail | retry-after-pull | rebase-mutations.
Transaction / TransactionSchematypeInput to runTransaction.
TransactionResult / TransactionResultSchemaunionok | conflict | rejected | network.
WatchEvent / WatchEventSchemaunionRemote-driven change notification.
SyncInResult / SyncInResultSchemaunionResult of syncIn().

Pin to the v1 API explicitly via @dev-bench/docstore/apis/v1.

@dev-bench/git-fs

Cross-platform git filesystem layer with browser / Node / in-memory adapters and provider-specific REST management.

Interfaces

ExportKindSummary
GitFsinterfaceRead / list / commit / push / pull / clone / reset. Every method returns a discriminated union; nothing throws on user-recoverable conditions.
RepoManagementinterfaceREST ops: listMyRepos, createRepo, getRepo, currentLogin. Provider-orthogonal.

Adapter factories (deep imports)

ImportSignatureSummary
createBrowserGitFs(BrowserGitFsConfig) => GitFsLightningFS (IndexedDB) + isomorphic-git web http.
createInMemoryGitFs(InMemoryGitFsConfig?) => GitFsPure-memory fs for tests, sandboxes, fixtures.
createInMemoryRemote(id: string) => InMemoryRemotePair with createInMemoryGitFs to simulate push/pull.
createNodeGitFs(NodeGitFsConfig) => GitFsNode fs + isomorphic-git node http.

Imports:

import { createBrowserGitFs } from "@dev-bench/git-fs/adapters/browser";
import { createInMemoryGitFs, createInMemoryRemote } from "@dev-bench/git-fs/adapters/in-memory";
import { createNodeGitFs } from "@dev-bench/git-fs/adapters/node";

REST management (deep imports)

ImportSignatureSummary
githubManagement(GithubManagementConfig) => RepoManagementGitHub REST.
giteaManagement(GiteaManagementConfig) => RepoManagementGitea REST.
gitlabManagement(GitlabManagementConfig) => RepoManagementGitLab REST.

Imports:

import { githubManagement } from "@dev-bench/git-fs/mgmt/github";
import { giteaManagement } from "@dev-bench/git-fs/mgmt/gitea";
import { gitlabManagement } from "@dev-bench/git-fs/mgmt/gitlab";

Wire types (Zod)

ProviderId, TokenLookup (+ tokenAbsent / tokenPresent helpers), RepoRef, Author, FileChange, ReadFileResult, TreeEntry, HeadTreeState, CommitInput, CommitResult, PushResult, PullResult, ResetHeadResult, CloneResult, plus RepoInfo, CreateRepoArgs, CreatedRepo, RepoLookupResult, CurrentLoginResult for management ops. All exported as both *Schema (Zod) and T (inferred type).

Polyfills + tooling

ImportSummary
@dev-bench/git-fs/polyfills/browserWeb Crypto / SHA fallbacks for older browsers.
@dev-bench/git-fs/metro-configMetro resolver tweaks for React Native.

@dev-bench/gitapp

Layer 2: a DocStore implementation that wires @dev-bench/git-fs storage into the @dev-bench/docstore interface.

ExportSignatureSummary
createGitAppDocStore(GitAppDocStoreConfig) => DocStoreBuild a DocStore from gitFs, mgmt, repoRef, getToken, author.
GitAppDocStoreConfiginterfaceConfig shape (see Getting Started).

Internals (escape hatches)

These let advanced consumers assemble their own DocStore using the same building blocks the canonical implementation uses.

ExportSignatureSummary
SerialQueueclassFIFO promise queue; one-at-a-time transaction execution.
WatchRegistryclassPrefix-keyed subscriber registry for docStore.watch.
runTransaction(RunnerConfig, Transaction) => Promise<TransactionResult>Bare transaction runner — no queue, no watch.
runSyncIn(RunnerConfig) => Promise<SyncInResult>Bare pull + watch-emit cycle.
RunnerConfigtypeShared deps for runTransaction / runSyncIn.

@dev-bench/gitapp-ui

Layer 3: cross-platform UI primitives + components for any app built on top of the docstore. One codebase: React Native + react-native-web.

Peer dependencies: react, react-native (or react-native-web), react-native-svg.

Theme

ExportKindSummary
ThemeProvider, useThemecomponent / hookTheme injection.
defaultLightThemeconstLight theme v1.
mergeThemefunctionDeep-merge a partial theme into another.
Theme, ThemeColors, ThemeFonts, ThemeRadii, ThemeSpacing, ThemeShadow, ThemeShadows, ThemeTypographytypesToken shapes.

Cross-component types

ExportKindSummary
ResourceconstIdle / loading / ready / error sentinel constructors.
Resource<T> (ResourceT)typeThe 4-state discriminated union every async control branches on.
Err, StatusTone, Connectivity, ProviderIdtypesShared across components.

Primitives

ComponentSummary
Icon (+ IconName)Themed icon set (RN-svg).
SpinnerAnimated busy indicator.
ChipTag / pill.
DotStatus dot.
BannerInline banner (info / warning / error).
ButtonThemed pressable.
CardSurface container.
SkeletonLoading placeholder.
ProgressBarDeterminate progress.

Components

Each component takes a *ViewModel / *Model prop the host app implements. Async actions render the full idle / loading / ready / error cycle.

ComponentSummary
ConnectionPanelOAuth / PAT connection flow.
RepoPickerSheet (+ RepoRow)Pick a repo from the user's accessible list.
CreateRepoFormCreate a new repo on the active provider.
InitializationSequence (+ InitStepRow)Multi-step init progress (clone, validate, …).
SyncStatusBarReference 4-state sync indicator.
SyncStatusBadgeCompact always-visible sync state badge.
ConflictShell (+ FileTreeRow)Layout shell for the conflict resolver.
BranchGraphDivergence visualization.
DivergenceExplainerPlain-English explanation of why local and remote diverged.
ConflictResolverSheet (+ TextPreview)Per-file conflict resolution.
RepoStateRecoveryPanel (+ FindingItem)Diagnose + recover a broken local repo.
ValidationFailureBanner (+ FailureRow)Show schema-validation failures from a transaction.
RepoStatusRowSingle-line repo status.
ResourceButtonButton that renders a Resource<T> lifecycle.
DiagnosticsSheet (+ DiagnosticsRow)Live diagnostics log surface.
ProviderSelectorGitHub / Gitea / GitLab picker.
EditorialBadgeEditorial-state chip (draft / pr-open / merged / …).
ForkRepoButton4-state fork action.
PullRequestComposerCompose / publish a PR over the docstore.
EditorialQueueScreen (+ EditorialQueueRowCard)Top-level kanban/list of content records.
RecordReviewSheetPer-record PR review (approve / request-changes / close).

Preview-slot adapters

Drop-in renderers for common record types in editorial UIs:

ComponentRecord type
PreviewPpaTaskPPA task.
PreviewCmsArticleCMS article (frontmatter diff aware).
PreviewBookmarkBookmark.
PreviewPasswordEntryPassword entry.

Domain types

ExportKindSummary
RepoMode (+ RepoModeSchema, isWritable, describeMode)union + helpersRead-only / writable repo mode.
RecordEditorialState (+ schema, describeEditorialState)unionEditorial lifecycle of a single record.
RepoEditorialMode (+ schema)unionRepo-level editorial mode (direct / pr-only / …).
PullRequestRef (+ schema)typeReference to a PR.
readEditorialConfigfunctionRead editorial config from a EditorialConfigSource.

On this page