Skip to content

zidane-ui/git

import { … } from 'zidane-ui/git'ui/src/git/index.ts

Components#

BranchMenuComponent#

Renders the branch and pull request switcher, anchored to anchorRef. See the module doc.

TypeScript
function BranchMenu(props: BranchMenuProps): Element | null
Parameters
NameTypeDescription
propsBranchMenuProps

Component props.

Element | null
BranchMenu props
NameTypeDescription
anchorRefRefObject<HTMLElement | null>

The control the menu opens from.

className?string

Extra classes on the menu surface.

currentstring | null

The current branch, null when HEAD is detached.

cwdstring

The checkout.

onClose() => void

Closes the menu (an outside press, Esc, a pick of the current row).

onSwitched() => void

A switch, a new branch or a worktree move went through.

openboolean

Whether the menu is shown.

sessionIdstring | null

The session the checkout belongs to (the host refuses a switch while its agent runs).

style?CSSProperties

Inline styles on the menu surface.

worktree?BranchMenuWorktree

The worktree this session can move into. Absent: no "Start a worktree".

ui/src/git/BranchMenu.tsx:131

GitBarComponent#

The checkout's branch, sync state, pull request and uncommitted changes in one quiet line. Memoised: a composer re-renders per keystroke; the bar only when its inputs change.

TypeScript
const GitBar: MemoExoticComponent<(__namedParameters: GitBarProps) => Element>

ui/src/git/GitBar.tsx:91

GitProviderComponent#

Provides a GitHost and optional label overrides to the git components below it.

TypeScript
function GitProvider(props: GitProviderProps): Element
Parameters
NameTypeDescription
propsGitProviderProps

Provider props: the host, optional labels, and the children to render.

Element
GitProvider props
NameTypeDescription
childrenReactNode

The app.

hostGitHost

The host the git components read.

labels?Partial<{ gitAhead: (count: number) => string; gitApproved: string; gitAuthorLabel: (author: string) => string; gitBehind: (count: number) => string; gitBranch: string; gitBranchButton: (branch: string) => string; gitBranchChipLabel: (branch: string) => string; gitBranchDetached: (commit: string) => string; gitBranchHint: string; gitBranchPlaceholder: string; gitBranchSwitch: string; gitBranchSwitchLater: string; gitChangesRequested: string; gitChangesTooltip: string; gitChecksLabel: (checks: Checks) => string; gitChecksText: (checks: Checks) => string; gitCommitsAhead: (count: number, base: string | null) => string; gitCommitsBehind: (count: number) => string; gitCopyBranch: string; gitDefaultBranch: string; gitDontAskAgain: string; gitDraft: string; gitDriftLabel: (ahead: number, behind: number) => string; gitEnvironmentSettings: string; gitFactsThen: (facts: string, action: string) => string; gitFilesUnit: (count: number) => ' file' | ' files'; gitFolderBackToRoots: string; gitFolderCancel: string; gitFolderCreate: string; gitFolderCreating: string; gitFolderDefault: string; gitFolderDefaultTitle: (host: string) => string; gitFolderEmpty: string; gitFolderFilter: string; gitFolderFilterLabel: string; gitFolderNew: string; gitFolderNewName: string; gitFolderNewNameLabel: (parent: string) => string; gitFolderNoMatch: string; gitFolderOpenPath: (path: string) => string; gitFolderPathLabel: string; gitFolderPickerLabel: (host: string) => string; gitFolderReading: string; gitFolderRoots: string; gitFolderSearchDeeper: (query: string) => string; gitFolderSearching: string; gitFolderSearchNone: string; gitFolderSearchResults: string; gitFolderSearchTruncated: string; gitFolderTitle: (folder: string, host: string) => string; gitFolderUse: (name: string) => string; gitFork: string; gitFromHere: string; gitHostLocalDescription: string; gitHostServerDescription: string; gitImportArchived: string; gitImportCancel: string; gitImportChange: string; gitImportClone: string; gitImportCloning: string; gitImportConnecting: string; gitImportField: string; gitImportHintAfter: string; gitImportHintBefore: string; gitImportHintCode: string; gitImportInto: string; gitImportInvalid: string; gitImportPlaceholder: string; gitImportPreview: (label: string, branch: string | undefined, destination: string) => string; gitImportPrivate: string; gitImportProgress: (phase: string, percent: number) => string; gitImportStars: (stars: number) => string; gitImportStop: string; gitImportTitle: string; gitImportViewOnGithub: string; gitIsolation: string; gitIsolationDefault: string; gitLastCommitAge: (age: string, duration: boolean) => string; gitListLabel: string; gitLoadingBranches: string; gitLocal: string; gitLocalLabel: string; gitMachineDescription: (name: string) => string; gitMachineOffline: (name: string) => string; gitMachineStatus: (status: string) => string; gitMenuLabel: string; gitMore: (count: number) => string; gitMoreSearchHint: string; gitMoveBack: string; gitMoveBranch: string; gitMoveCancel: string; gitMoveChangeFolder: string; gitMoveConfirm: (name: string) => string; gitMoveConfirmDetail: string; gitMoveCurrent: string; gitMoveDone: string; gitMoveFolder: string; gitMoveKeepFolder: string; gitMoveLoading: string; gitMoveMainCheckout: string; gitMoveMoving: string; gitMoveNone: string; gitMoveOffline: string; gitMovePickFolder: (name: string) => string; gitMoveRemoveWorktree: string; gitMovesThisChat: string; gitMoveSubmit: string; gitMoveTitle: string; gitMoveWhere: string; gitMoveWorktreeKept: (reason: string | undefined) => string; gitNoGh: string; gitNoMatches: string; gitOpenOnGitHub: string; gitOpenPullRequest: (number: number) => string; gitPrDraft: string; gitPrTooltip: (pr: { draft: boolean; number: number; title: string }) => string; gitPublish: string; gitPublishBranch: (branch: string) => string; gitPublishDialog: string; gitPublishing: string; gitPublishLater: string; gitPublishSummary: (branch: string, ahead: number, remote: string | null) => string; gitPublishTo: (remote: string | null) => string; gitRateLimited: (clock: string) => string; gitRowCurrent: string; gitRowSwitching: string; gitRunsOn: string; gitRunsOnHelpLabel: string; gitRunsOnLocal: string; gitRunsOnLocalFact: string; gitRunsOnMachine: string; gitRunsOnMachineFact: string; gitRunsOnServer: string; gitRunsOnServerFact: string; gitSearching: string; gitSearchLabel: string; gitSearchPlaceholder: string; gitSectionBranches: string; gitSectionMine: string; gitSectionOther: string; gitSectionPullRequests: string; gitSectionReview: string; gitStartAsWorktree: string; gitStartBranch: string; gitStartBranchLabel: (name: string) => string; gitStartCheckedOutElsewhere: (path: string) => string; gitStartingWorktree: string; gitStartNoWorktree: string; gitStartTheWorktree: string; gitStartWorktree: string; gitStartWorktreeLabel: (name: string) => string; gitSync: string; gitSyncCancel: string; gitSyncDialog: string; gitSyncing: string; gitSyncKeepsChanges: string; gitSyncLater: string; gitSyncSummary: (behind: number, ahead: number, upstream: string) => string; gitSyncWith: (upstream: string | null) => string; gitToPull: (count: number) => string; gitToPush: (count: number) => string; gitUnavailable: string; gitUpdatedAge: (age: string, duration: boolean) => string; gitUpToDate: (upstream: string) => string; gitWhereLabel: string; gitWhereTitle: (place: string, isolation: string | undefined, branch: string | undefined) => string; gitWorktreeBranchLabel: string; gitWorktreeBranchPlaceholder: string; gitWorktreeShort: string }>

Overrides for the built-in strings. Keys you leave out keep the default English label.

ui/src/git/GitProvider.tsx:33

ImportRepoDialogComponent#

The import form: the repository field with its live preview, the parent folder, the clone's progress and error.

TypeScript
function ImportRepoDialog(props: ImportRepoDialogProps): Element
Parameters
NameTypeDescription
propsImportRepoDialogProps

The ImportRepoDialogProps.

Element
ImportRepoDialog props
NameTypeDescription
className?string

Extra class names for the root.

cloneGitClone

How the host clones.

hostId?string

The saved server the clone lands on (HostView.id), for showing its folders. Absent: this computer.

initialParentstring

Where the clone lands until the user picks another folder.

onCancel() => void

Closed without cloning.

onDone(path: string) => void

The repository is in place: its folder.

pickFolder?() => Promise<string | null>

Picks another parent folder; null when cancelled. Absent: no Change button.

style?CSSProperties

Inline styles on the root element.

ui/src/git/ImportRepoDialog.tsx:68

MoveSessionDialogComponent#

The move dialog: where, then the folder when one is needed, then the confirmation.

TypeScript
function MoveSessionDialog(props: MoveSessionDialogProps): Element
Parameters
NameTypeDescription
propsMoveSessionDialogProps

The MoveSessionDialogProps.

Element
MoveSessionDialog props
NameTypeDescription
className?string

Extra class names for the root.

onCancel() => void

Closed without moving.

onDone() => void

The session moved.

style?CSSProperties

Inline styles on the root element.

subjectMoveSessionSubject

The session to move.

ui/src/git/MoveSessionDialog.tsx:71

RemoteFolderBrowserComponent#

Renders the folder browser: the roots, a filter (or a typed path), the folder's path, its folders, .., the folders found below, "New folder" and "Use" for the current one. A folder that can't be read offers the way back to the roots.

TypeScript
function RemoteFolderBrowser(props: RemoteFolderBrowserProps): Element | null
Parameters
NameTypeDescription
propsRemoteFolderBrowserProps

Component props.

Element | null
RemoteFolderBrowser props
NameTypeDescription
className?string

Extra classes on the menu.

hostId?string

The saved server whose folders to list (hosts that reach several).

machineId?string

A machine shared with that host: its folders instead.

onUse(path: string) => void

Called with the folder picked.

startstring | null

The folder to open on, null for the first root.

style?CSSProperties

Inline styles on the menu.

ui/src/git/RemoteFolderPicker.tsx:152

RemoteFolderPickerComponent#

Renders the folder pill and its browser. See the module doc.

TypeScript
function RemoteFolderPicker(props: RemoteFolderPickerProps): Element | null
Parameters
NameTypeDescription
propsRemoteFolderPickerProps

Component props.

Element | null
RemoteFolderPicker props
NameTypeDescription
className?string

Extra classes on the pill.

folderstring | null

The folder picked, null for the host's first workspace root.

hostId?string

The saved server whose folders to list (hosts that reach several).

hostNamestring

The host's (or machine's) name, as the pill and the menu say it.

machineId?string

A machine shared with that host: its folders instead.

onChange(folder: string | null) => void

Called with the folder picked.

placeholder?string

The pill's label while no folder is picked. Default: the gitFolderDefault label.

style?CSSProperties

Inline styles on the pill.

ui/src/git/RemoteFolderPicker.tsx:71

SyncChipComponent#

The ahead / behind counts of a checkout, and the sync (or publish) a click runs. Renders nothing when there is neither a count nor an action.

TypeScript
function SyncChip(props: SyncChipProps): Element | null
Parameters
NameTypeDescription
propsSyncChipProps

The SyncChipProps.

Element | null
SyncChip props
NameTypeDefaultDescription
className?string

Extra class names for the root.

confirm?booleantrue

Ask before syncing.

cwdstring

The checkout.

onConfirmChange?(confirm: boolean) => void

"Don't ask again" was ticked at a confirmed sync. Absent: no such checkbox.

onSynced() => void | Promise<void>

Called after every sync, worked or not (refresh the status).

runningboolean

The agent is working: the chip is disabled.

sessionIdstring | null

The session working in it (the host may refuse while it runs).

statusGitStatus

The checkout's status.

style?CSSProperties

Inline styles on the root element.

ui/src/git/SyncChip.tsx:68

WhereMenuComponent#

Renders the where menu: the places (hosts and machines), the isolation kinds there, the branch field of a kind that takes one, and the settings row.

TypeScript
function WhereMenu(props: WhereMenuProps): Element | null
Parameters
NameTypeDescription
propsWhereMenuProps

Component props.

Element | null
WhereMenu props
NameTypeDescription
className?string

Extra classes on the menu.

descriptorsreadonly EnvironmentDescriptor[]

The draft host's environment kinds (withMachines applied).

draftDraftEnvironment | null

The draft's pick, null for the default.

hiddenMachines?ReadonlySet<string>

Machine names not to list (servers this computer also uses as machines, shown as servers).

hostIdstring

The draft's host.

hostsreadonly HostView[]

This computer first, then the saved servers.

onChange(next: DraftEnvironment) => void

Called with the draft's new pick.

onClose?() => void

Called after a pick that ends the choice (the popover closes).

onHostChange(hostId: string) => void

Called with the host picked.

onOpenSettings?() => void

Opens the environment settings. Absent: no settings row.

style?CSSProperties

Inline styles on the menu.

ui/src/git/WherePicker.tsx:126

WherePickerComponent#

Renders the where pill and its menu. Nothing when there is nothing to choose (one place, one way to run there).

TypeScript
function WherePicker(props: WherePickerProps): Element | null
Parameters
NameTypeDescription
propsWherePickerProps

Component props.

Element | null

ui/src/git/WherePicker.tsx:314

Functions#

useEnvironmentChoicesFunction#

The environment kinds a draft in cwd can pick, withMachines applied. Empty while loading, when the list fails or without GitHost.environments: the draft runs on its default. A failed re-read keeps the last list.

TypeScript
function useEnvironmentChoices(
  cwd: string | null,
  hostId?: string,
): readonly EnvironmentDescriptor[]
Parameters
NameTypeDescription
cwdstring | null

The draft's folder ('': none); null reads nothing (no draft on screen).

hostId?string

The saved server the draft runs on (absent: this host).

readonly EnvironmentDescriptor[]

ui/src/git/useEnvironmentChoices.ts:23

useGitBarFunction#

The checkout's live status and its branch's pull request, for a git bar.

TypeScript
function useGitBar(cwd: string | null, sessionId: string | null): GitBarState
Parameters
NameTypeDescription
cwdstring | null

The checkout, or null (no folder: nothing to show).

sessionIdstring | null

The session working in it, whose activity refreshes it.

ui/src/git/useGitBar.ts:95

useGitHostFunction#

The GitHost from the nearest GitProvider, or null outside one (the git components that need it render nothing).

TypeScript
function useGitHost(): GitHost | null
GitHost | null

ui/src/git/GitProvider.tsx:42

useGitLabelsFunction#

Returns the git components' strings: the defaults merged with any overrides.

TypeScript
function useGitLabels(): { gitAhead: (count: number) => string; gitApproved: string; gitAuthorLabel: (author: string) => string; gitBehind: (count: number) => string; gitBranch: string; gitBranchButton: (branch: string) => string; gitBranchChipLabel: (branch: string) => string; gitBranchDetached: (commit: string) => string; gitBranchHint: string; gitBranchPlaceholder: string; gitBranchSwitch: string; gitBranchSwitchLater: string; gitChangesRequested: string; gitChangesTooltip: string; gitChecksLabel: (checks: Checks) => string; gitChecksText: (checks: Checks) => string; gitCommitsAhead: (count: number, base: string | null) => string; gitCommitsBehind: (count: number) => string; gitCopyBranch: string; gitDefaultBranch: string; gitDontAskAgain: string; gitDraft: string; gitDriftLabel: (ahead: number, behind: number) => string; gitEnvironmentSettings: string; gitFactsThen: (facts: string, action: string) => string; gitFilesUnit: (count: number) => ' file' | ' files'; gitFolderBackToRoots: string; gitFolderCancel: string; gitFolderCreate: string; gitFolderCreating: string; gitFolderDefault: string; gitFolderDefaultTitle: (host: string) => string; gitFolderEmpty: string; gitFolderFilter: string; gitFolderFilterLabel: string; gitFolderNew: string; gitFolderNewName: string; gitFolderNewNameLabel: (parent: string) => string; gitFolderNoMatch: string; gitFolderOpenPath: (path: string) => string; gitFolderPathLabel: string; gitFolderPickerLabel: (host: string) => string; gitFolderReading: string; gitFolderRoots: string; gitFolderSearchDeeper: (query: string) => string; gitFolderSearching: string; gitFolderSearchNone: string; gitFolderSearchResults: string; gitFolderSearchTruncated: string; gitFolderTitle: (folder: string, host: string) => string; gitFolderUse: (name: string) => string; gitFork: string; gitFromHere: string; gitHostLocalDescription: string; gitHostServerDescription: string; gitImportArchived: string; gitImportCancel: string; gitImportChange: string; gitImportClone: string; gitImportCloning: string; gitImportConnecting: string; gitImportField: string; gitImportHintAfter: string; gitImportHintBefore: string; gitImportHintCode: string; gitImportInto: string; gitImportInvalid: string; gitImportPlaceholder: string; gitImportPreview: (label: string, branch: string | undefined, destination: string) => string; gitImportPrivate: string; gitImportProgress: (phase: string, percent: number) => string; gitImportStars: (stars: number) => string; gitImportStop: string; gitImportTitle: string; gitImportViewOnGithub: string; gitIsolation: string; gitIsolationDefault: string; gitLastCommitAge: (age: string, duration: boolean) => string; gitListLabel: string; gitLoadingBranches: string; gitLocal: string; gitLocalLabel: string; gitMachineDescription: (name: string) => string; gitMachineOffline: (name: string) => string; gitMachineStatus: (status: string) => string; gitMenuLabel: string; gitMore: (count: number) => string; gitMoreSearchHint: string; gitMoveBack: string; gitMoveBranch: string; gitMoveCancel: string; gitMoveChangeFolder: string; gitMoveConfirm: (name: string) => string; gitMoveConfirmDetail: string; gitMoveCurrent: string; gitMoveDone: string; gitMoveFolder: string; gitMoveKeepFolder: string; gitMoveLoading: string; gitMoveMainCheckout: string; gitMoveMoving: string; gitMoveNone: string; gitMoveOffline: string; gitMovePickFolder: (name: string) => string; gitMoveRemoveWorktree: string; gitMovesThisChat: string; gitMoveSubmit: string; gitMoveTitle: string; gitMoveWhere: string; gitMoveWorktreeKept: (reason: string | undefined) => string; gitNoGh: string; gitNoMatches: string; gitOpenOnGitHub: string; gitOpenPullRequest: (number: number) => string; gitPrDraft: string; gitPrTooltip: (pr: { draft: boolean; number: number; title: string }) => string; gitPublish: string; gitPublishBranch: (branch: string) => string; gitPublishDialog: string; gitPublishing: string; gitPublishLater: string; gitPublishSummary: (branch: string, ahead: number, remote: string | null) => string; gitPublishTo: (remote: string | null) => string; gitRateLimited: (clock: string) => string; gitRowCurrent: string; gitRowSwitching: string; gitRunsOn: string; gitRunsOnHelpLabel: string; gitRunsOnLocal: string; gitRunsOnLocalFact: string; gitRunsOnMachine: string; gitRunsOnMachineFact: string; gitRunsOnServer: string; gitRunsOnServerFact: string; gitSearching: string; gitSearchLabel: string; gitSearchPlaceholder: string; gitSectionBranches: string; gitSectionMine: string; gitSectionOther: string; gitSectionPullRequests: string; gitSectionReview: string; gitStartAsWorktree: string; gitStartBranch: string; gitStartBranchLabel: (name: string) => string; gitStartCheckedOutElsewhere: (path: string) => string; gitStartingWorktree: string; gitStartNoWorktree: string; gitStartTheWorktree: string; gitStartWorktree: string; gitStartWorktreeLabel: (name: string) => string; gitSync: string; gitSyncCancel: string; gitSyncDialog: string; gitSyncing: string; gitSyncKeepsChanges: string; gitSyncLater: string; gitSyncSummary: (behind: number, ahead: number, upstream: string) => string; gitSyncWith: (upstream: string | null) => string; gitToPull: (count: number) => string; gitToPush: (count: number) => string; gitUnavailable: string; gitUpdatedAge: (age: string, duration: boolean) => string; gitUpToDate: (upstream: string) => string; gitWhereLabel: string; gitWhereTitle: (place: string, isolation: string | undefined, branch: string | undefined) => string; gitWorktreeBranchLabel: string; gitWorktreeBranchPlaceholder: string; gitWorktreeShort: string }
{ gitAhead: (count: number) => string; gitApproved: string; gitAuthorLabel: (author: string) => string; gitBehind: (count: number) => string; gitBranch: string; gitBranchButton: (branch: string) => string; gitBranchChipLabel: (branch: string) => string; gitBranchDetached: (commit: string) => string; gitBranchHint: string; gitBranchPlaceholder: string; gitBranchSwitch: string; gitBranchSwitchLater: string; gitChangesRequested: string; gitChangesTooltip: string; gitChecksLabel: (checks: Checks) => string; gitChecksText: (checks: Checks) => string; gitCommitsAhead: (count: number, base: string | null) => string; gitCommitsBehind: (count: number) => string; gitCopyBranch: string; gitDefaultBranch: string; gitDontAskAgain: string; gitDraft: string; gitDriftLabel: (ahead: number, behind: number) => string; gitEnvironmentSettings: string; gitFactsThen: (facts: string, action: string) => string; gitFilesUnit: (count: number) => ' file' | ' files'; gitFolderBackToRoots: string; gitFolderCancel: string; gitFolderCreate: string; gitFolderCreating: string; gitFolderDefault: string; gitFolderDefaultTitle: (host: string) => string; gitFolderEmpty: string; gitFolderFilter: string; gitFolderFilterLabel: string; gitFolderNew: string; gitFolderNewName: string; gitFolderNewNameLabel: (parent: string) => string; gitFolderNoMatch: string; gitFolderOpenPath: (path: string) => string; gitFolderPathLabel: string; gitFolderPickerLabel: (host: string) => string; gitFolderReading: string; gitFolderRoots: string; gitFolderSearchDeeper: (query: string) => string; gitFolderSearching: string; gitFolderSearchNone: string; gitFolderSearchResults: string; gitFolderSearchTruncated: string; gitFolderTitle: (folder: string, host: string) => string; gitFolderUse: (name: string) => string; gitFork: string; gitFromHere: string; gitHostLocalDescription: string; gitHostServerDescription: string; gitImportArchived: string; gitImportCancel: string; gitImportChange: string; gitImportClone: string; gitImportCloning: string; gitImportConnecting: string; gitImportField: string; gitImportHintAfter: string; gitImportHintBefore: string; gitImportHintCode: string; gitImportInto: string; gitImportInvalid: string; gitImportPlaceholder: string; gitImportPreview: (label: string, branch: string | undefined, destination: string) => string; gitImportPrivate: string; gitImportProgress: (phase: string, percent: number) => string; gitImportStars: (stars: number) => string; gitImportStop: string; gitImportTitle: string; gitImportViewOnGithub: string; gitIsolation: string; gitIsolationDefault: string; gitLastCommitAge: (age: string, duration: boolean) => string; gitListLabel: string; gitLoadingBranches: string; gitLocal: string; gitLocalLabel: string; gitMachineDescription: (name: string) => string; gitMachineOffline: (name: string) => string; gitMachineStatus: (status: string) => string; gitMenuLabel: string; gitMore: (count: number) => string; gitMoreSearchHint: string; gitMoveBack: string; gitMoveBranch: string; gitMoveCancel: string; gitMoveChangeFolder: string; gitMoveConfirm: (name: string) => string; gitMoveConfirmDetail: string; gitMoveCurrent: string; gitMoveDone: string; gitMoveFolder: string; gitMoveKeepFolder: string; gitMoveLoading: string; gitMoveMainCheckout: string; gitMoveMoving: string; gitMoveNone: string; gitMoveOffline: string; gitMovePickFolder: (name: string) => string; gitMoveRemoveWorktree: string; gitMovesThisChat: string; gitMoveSubmit: string; gitMoveTitle: string; gitMoveWhere: string; gitMoveWorktreeKept: (reason: string | undefined) => string; gitNoGh: string; gitNoMatches: string; gitOpenOnGitHub: string; gitOpenPullRequest: (number: number) => string; gitPrDraft: string; gitPrTooltip: (pr: { draft: boolean; number: number; title: string }) => string; gitPublish: string; gitPublishBranch: (branch: string) => string; gitPublishDialog: string; gitPublishing: string; gitPublishLater: string; gitPublishSummary: (branch: string, ahead: number, remote: string | null) => string; gitPublishTo: (remote: string | null) => string; gitRateLimited: (clock: string) => string; gitRowCurrent: string; gitRowSwitching: string; gitRunsOn: string; gitRunsOnHelpLabel: string; gitRunsOnLocal: string; gitRunsOnLocalFact: string; gitRunsOnMachine: string; gitRunsOnMachineFact: string; gitRunsOnServer: string; gitRunsOnServerFact: string; gitSearching: string; gitSearchLabel: string; gitSearchPlaceholder: string; gitSectionBranches: string; gitSectionMine: string; gitSectionOther: string; gitSectionPullRequests: string; gitSectionReview: string; gitStartAsWorktree: string; gitStartBranch: string; gitStartBranchLabel: (name: string) => string; gitStartCheckedOutElsewhere: (path: string) => string; gitStartingWorktree: string; gitStartNoWorktree: string; gitStartTheWorktree: string; gitStartWorktree: string; gitStartWorktreeLabel: (name: string) => string; gitSync: string; gitSyncCancel: string; gitSyncDialog: string; gitSyncing: string; gitSyncKeepsChanges: string; gitSyncLater: string; gitSyncSummary: (behind: number, ahead: number, upstream: string) => string; gitSyncWith: (upstream: string | null) => string; gitToPull: (count: number) => string; gitToPush: (count: number) => string; gitUnavailable: string; gitUpdatedAge: (age: string, duration: boolean) => string; gitUpToDate: (upstream: string) => string; gitWhereLabel: string; gitWhereTitle: (place: string, isolation: string | undefined, branch: string | undefined) => string; gitWorktreeBranchLabel: string; gitWorktreeBranchPlaceholder: string; gitWorktreeShort: string }

ui/src/git/GitProvider.tsx:47

useImportRepoFunction#

Opens the import dialog above whatever is open, over the GitHost in context (clone, pickFolder), or on a saved server with target. The returned function resolves with the cloned (or already present) folder, null when closed. Without what it needs (GitHost.clone; on a server cloneOnServer and listFolders) it opens nothing and resolves null: hide the control that calls it.

TypeScript
function useImportRepo(target?: ImportRepoTarget): () => Promise<string | null>
Parameters
NameTypeDescription
target?ImportRepoTarget

A saved server to clone on. Absent: this computer.

() => Promise<string | null>

ui/src/git/ImportRepoDialog.tsx:344

useMoveSessionFunction#

Opens the move dialog above whatever is open, over the GitHost in context. undefined without what it needs (GitHost.moveSession and environments, a modal layer): hide the control that calls it. The returned function resolves true once the session moved, false when closed.

TypeScript
function useMoveSession(): ((subject: MoveSessionSubject) => Promise<boolean>) | undefined
((subject: MoveSessionSubject) => Promise<boolean>) | undefined

ui/src/git/MoveSessionDialog.tsx:363

useStartFromPanelFunction#

Returns the start for cwd's draft: it sets the draft's environment, switches the folder when asked, replaces the composer's text with the row's prompt and focuses it.

TypeScript
function useStartFromPanel(
  draft: StartFromPanelDraft,
  cwd: string,
): (start: PanelStartSession) => Promise<StartFromPanelResult>
Parameters
NameTypeDescription
draftStartFromPanelDraft

The new-chat draft on screen.

cwdstring

The folder the panel is for.

(start: PanelStartSession) => Promise<StartFromPanelResult>

ui/src/git/useStartFromPanel.ts:46

Constants#

GIT_BAR_ITEMConstant#

The git bar's quiet item: a chip that only lifts on hover.

TypeScript
const GIT_BAR_ITEM: string

ui/src/git/SyncChip.tsx:29

Interfaces#

BranchMenuPropsInterface#

Props for BranchMenu.

TypeScript
interface BranchMenuProps
BranchMenuProps properties
NameTypeDescription
anchorRefRefObject<HTMLElement | null>

The control the menu opens from.

className?string

Extra classes on the menu surface.

currentstring | null

The current branch, null when HEAD is detached.

cwdstring

The checkout.

onClose() => void

Closes the menu (an outside press, Esc, a pick of the current row).

onSwitched() => void

A switch, a new branch or a worktree move went through.

openboolean

Whether the menu is shown.

sessionIdstring | null

The session the checkout belongs to (the host refuses a switch while its agent runs).

style?CSSProperties

Inline styles on the menu surface.

worktree?BranchMenuWorktree

The worktree this session can move into. Absent: no "Start a worktree".

ui/src/git/BranchMenu.tsx:93

BranchMenuWorktreeInterface#

The worktree a session can be moved into: the Worktree environment kind, as its host offers it.

TypeScript
interface BranchMenuWorktree
BranchMenuWorktree properties
NameTypeDescription
availableboolean

It can be started now.

reason?string

Why it cannot, when it cannot.

suggestedBranch?string

The branch name a new worktree takes when none is typed.

ui/src/git/BranchMenu.tsx:83

GitBarBranchMenuPropsInterface#

What the git bar hands its branch menu.

TypeScript
interface GitBarBranchMenuProps
GitBarBranchMenuProps properties
NameTypeDescription
anchorRefRefObject<HTMLButtonElement | null>

The branch button it opens from.

currentstring | null

The current branch; null when detached.

cwdstring

The checkout.

onClose() => void

Close it.

onSwitched() => void

A switch landed: the bar refreshes.

openboolean

The menu is open.

sessionIdstring | null

The session working in it.

ui/src/git/GitBar.tsx:39

GitBarPropsInterface#

Props for GitBar.

TypeScript
interface GitBarProps
GitBarProps properties
NameTypeDefaultDescription
BranchMenu?ComponentType<GitBarBranchMenuProps>

The branch switcher. Default: BranchMenu. Keep it stable.

className?string

Extra class names for the root.

confirmSync?booleantrue

Ask before a sync.

cwdstring | null

The checkout, or null (a chat without a folder): the bar slides away.

onConfirmSyncChange?(confirm: boolean) => void

"Don't ask again" at a sync's confirmation. Absent: no such checkbox.

onOpenPullRequest?(url: string) => void

Opens the pull request's page, when the extensions' link handlers don't. Default: a new browser tab.

onShowChanges?() => void

Shows the uncommitted changes (a Diffs panel). Absent: the count is not clickable.

runningboolean

The agent is working: no switching, no syncing.

sessionIdstring | null

The session working in it, whose activity refreshes the bar.

style?CSSProperties

Inline styles on the root element.

ui/src/git/GitBar.tsx:57

GitBarStateInterface#

What useGitBar returns.

TypeScript
interface GitBarState
GitBarState properties
NameTypeDescription
pendingboolean

A folder whose first answer is still on its way.

pullRequestGitBranchPullRequest | null

The branch's open pull request, or null.

refresh() => Promise<void>

Reads the status again now (after a switch or a sync).

statusGitStatus | null

Where the checkout stands; null outside a git checkout, for no folder, or before the first answer.

ui/src/git/useGitBar.ts:78

GitProviderPropsInterface#

Props for GitProvider.

TypeScript
interface GitProviderProps
GitProviderProps properties
NameTypeDescription
childrenReactNode

The app.

hostGitHost

The host the git components read.

labels?Partial<{ gitAhead: (count: number) => string; gitApproved: string; gitAuthorLabel: (author: string) => string; gitBehind: (count: number) => string; gitBranch: string; gitBranchButton: (branch: string) => string; gitBranchChipLabel: (branch: string) => string; gitBranchDetached: (commit: string) => string; gitBranchHint: string; gitBranchPlaceholder: string; gitBranchSwitch: string; gitBranchSwitchLater: string; gitChangesRequested: string; gitChangesTooltip: string; gitChecksLabel: (checks: Checks) => string; gitChecksText: (checks: Checks) => string; gitCommitsAhead: (count: number, base: string | null) => string; gitCommitsBehind: (count: number) => string; gitCopyBranch: string; gitDefaultBranch: string; gitDontAskAgain: string; gitDraft: string; gitDriftLabel: (ahead: number, behind: number) => string; gitEnvironmentSettings: string; gitFactsThen: (facts: string, action: string) => string; gitFilesUnit: (count: number) => ' file' | ' files'; gitFolderBackToRoots: string; gitFolderCancel: string; gitFolderCreate: string; gitFolderCreating: string; gitFolderDefault: string; gitFolderDefaultTitle: (host: string) => string; gitFolderEmpty: string; gitFolderFilter: string; gitFolderFilterLabel: string; gitFolderNew: string; gitFolderNewName: string; gitFolderNewNameLabel: (parent: string) => string; gitFolderNoMatch: string; gitFolderOpenPath: (path: string) => string; gitFolderPathLabel: string; gitFolderPickerLabel: (host: string) => string; gitFolderReading: string; gitFolderRoots: string; gitFolderSearchDeeper: (query: string) => string; gitFolderSearching: string; gitFolderSearchNone: string; gitFolderSearchResults: string; gitFolderSearchTruncated: string; gitFolderTitle: (folder: string, host: string) => string; gitFolderUse: (name: string) => string; gitFork: string; gitFromHere: string; gitHostLocalDescription: string; gitHostServerDescription: string; gitImportArchived: string; gitImportCancel: string; gitImportChange: string; gitImportClone: string; gitImportCloning: string; gitImportConnecting: string; gitImportField: string; gitImportHintAfter: string; gitImportHintBefore: string; gitImportHintCode: string; gitImportInto: string; gitImportInvalid: string; gitImportPlaceholder: string; gitImportPreview: (label: string, branch: string | undefined, destination: string) => string; gitImportPrivate: string; gitImportProgress: (phase: string, percent: number) => string; gitImportStars: (stars: number) => string; gitImportStop: string; gitImportTitle: string; gitImportViewOnGithub: string; gitIsolation: string; gitIsolationDefault: string; gitLastCommitAge: (age: string, duration: boolean) => string; gitListLabel: string; gitLoadingBranches: string; gitLocal: string; gitLocalLabel: string; gitMachineDescription: (name: string) => string; gitMachineOffline: (name: string) => string; gitMachineStatus: (status: string) => string; gitMenuLabel: string; gitMore: (count: number) => string; gitMoreSearchHint: string; gitMoveBack: string; gitMoveBranch: string; gitMoveCancel: string; gitMoveChangeFolder: string; gitMoveConfirm: (name: string) => string; gitMoveConfirmDetail: string; gitMoveCurrent: string; gitMoveDone: string; gitMoveFolder: string; gitMoveKeepFolder: string; gitMoveLoading: string; gitMoveMainCheckout: string; gitMoveMoving: string; gitMoveNone: string; gitMoveOffline: string; gitMovePickFolder: (name: string) => string; gitMoveRemoveWorktree: string; gitMovesThisChat: string; gitMoveSubmit: string; gitMoveTitle: string; gitMoveWhere: string; gitMoveWorktreeKept: (reason: string | undefined) => string; gitNoGh: string; gitNoMatches: string; gitOpenOnGitHub: string; gitOpenPullRequest: (number: number) => string; gitPrDraft: string; gitPrTooltip: (pr: { draft: boolean; number: number; title: string }) => string; gitPublish: string; gitPublishBranch: (branch: string) => string; gitPublishDialog: string; gitPublishing: string; gitPublishLater: string; gitPublishSummary: (branch: string, ahead: number, remote: string | null) => string; gitPublishTo: (remote: string | null) => string; gitRateLimited: (clock: string) => string; gitRowCurrent: string; gitRowSwitching: string; gitRunsOn: string; gitRunsOnHelpLabel: string; gitRunsOnLocal: string; gitRunsOnLocalFact: string; gitRunsOnMachine: string; gitRunsOnMachineFact: string; gitRunsOnServer: string; gitRunsOnServerFact: string; gitSearching: string; gitSearchLabel: string; gitSearchPlaceholder: string; gitSectionBranches: string; gitSectionMine: string; gitSectionOther: string; gitSectionPullRequests: string; gitSectionReview: string; gitStartAsWorktree: string; gitStartBranch: string; gitStartBranchLabel: (name: string) => string; gitStartCheckedOutElsewhere: (path: string) => string; gitStartingWorktree: string; gitStartNoWorktree: string; gitStartTheWorktree: string; gitStartWorktree: string; gitStartWorktreeLabel: (name: string) => string; gitSync: string; gitSyncCancel: string; gitSyncDialog: string; gitSyncing: string; gitSyncKeepsChanges: string; gitSyncLater: string; gitSyncSummary: (behind: number, ahead: number, upstream: string) => string; gitSyncWith: (upstream: string | null) => string; gitToPull: (count: number) => string; gitToPush: (count: number) => string; gitUnavailable: string; gitUpdatedAge: (age: string, duration: boolean) => string; gitUpToDate: (upstream: string) => string; gitWhereLabel: string; gitWhereTitle: (place: string, isolation: string | undefined, branch: string | undefined) => string; gitWorktreeBranchLabel: string; gitWorktreeBranchPlaceholder: string; gitWorktreeShort: string }>

Overrides for the built-in strings. Keys you leave out keep the default English label.

ui/src/git/GitProvider.tsx:19

ImportRepoDialogPropsInterface#

Props for ImportRepoDialog.

TypeScript
interface ImportRepoDialogProps
ImportRepoDialogProps properties
NameTypeDescription
className?string

Extra class names for the root.

cloneGitClone

How the host clones.

hostId?string

The saved server the clone lands on (HostView.id), for showing its folders. Absent: this computer.

initialParentstring

Where the clone lands until the user picks another folder.

onCancel() => void

Closed without cloning.

onDone(path: string) => void

The repository is in place: its folder.

pickFolder?() => Promise<string | null>

Picks another parent folder; null when cancelled. Absent: no Change button.

style?CSSProperties

Inline styles on the root element.

ui/src/git/ImportRepoDialog.tsx:44

ImportRepoTargetInterface#

Where useImportRepo clones.

TypeScript
interface ImportRepoTarget
ImportRepoTarget properties
NameTypeDescription
hostIdstring

A saved server: the clone lands there (GitHost.cloneOnServer).

ui/src/git/ImportRepoDialog.tsx:331

MoveSessionDialogPropsInterface#

Props for MoveSessionDialog.

TypeScript
interface MoveSessionDialogProps
MoveSessionDialogProps properties
NameTypeDescription
className?string

Extra class names for the root.

onCancel() => void

Closed without moving.

onDone() => void

The session moved.

style?CSSProperties

Inline styles on the root element.

subjectMoveSessionSubject

The session to move.

ui/src/git/MoveSessionDialog.tsx:41

RemoteFolderBrowserPropsInterface#

Props for RemoteFolderBrowser.

TypeScript
interface RemoteFolderBrowserProps
RemoteFolderBrowserProps properties
NameTypeDescription
className?string

Extra classes on the menu.

hostId?string

The saved server whose folders to list (hosts that reach several).

machineId?string

A machine shared with that host: its folders instead.

onUse(path: string) => void

Called with the folder picked.

startstring | null

The folder to open on, null for the first root.

style?CSSProperties

Inline styles on the menu.

ui/src/git/RemoteFolderPicker.tsx:31

RemoteFolderPickerPropsInterface#

Props for RemoteFolderPicker.

TypeScript
interface RemoteFolderPickerProps
RemoteFolderPickerProps properties
NameTypeDescription
className?string

Extra classes on the pill.

folderstring | null

The folder picked, null for the host's first workspace root.

hostId?string

The saved server whose folders to list (hosts that reach several).

hostNamestring

The host's (or machine's) name, as the pill and the menu say it.

machineId?string

A machine shared with that host: its folders instead.

onChange(folder: string | null) => void

Called with the folder picked.

placeholder?string

The pill's label while no folder is picked. Default: the gitFolderDefault label.

style?CSSProperties

Inline styles on the pill.

ui/src/git/RemoteFolderPicker.tsx:47

SyncChipPropsInterface#

Props for SyncChip.

TypeScript
interface SyncChipProps
SyncChipProps properties
NameTypeDefaultDescription
className?string

Extra class names for the root.

confirm?booleantrue

Ask before syncing.

cwdstring

The checkout.

onConfirmChange?(confirm: boolean) => void

"Don't ask again" was ticked at a confirmed sync. Absent: no such checkbox.

onSynced() => void | Promise<void>

Called after every sync, worked or not (refresh the status).

runningboolean

The agent is working: the chip is disabled.

sessionIdstring | null

The session working in it (the host may refuse while it runs).

statusGitStatus

The checkout's status.

style?CSSProperties

Inline styles on the root element.

ui/src/git/SyncChip.tsx:38

WhereMenuPropsInterface#

Props for WhereMenu: what WherePicker shows, and how a pick closes it.

TypeScript
interface WhereMenuProps
WhereMenuProps properties
NameTypeDescription
className?string

Extra classes on the menu.

descriptorsreadonly EnvironmentDescriptor[]

The draft host's environment kinds (withMachines applied).

draftDraftEnvironment | null

The draft's pick, null for the default.

hiddenMachines?ReadonlySet<string>

Machine names not to list (servers this computer also uses as machines, shown as servers).

hostIdstring

The draft's host.

hostsreadonly HostView[]

This computer first, then the saved servers.

onChange(next: DraftEnvironment) => void

Called with the draft's new pick.

onClose?() => void

Called after a pick that ends the choice (the popover closes).

onHostChange(hostId: string) => void

Called with the host picked.

onOpenSettings?() => void

Opens the environment settings. Absent: no settings row.

style?CSSProperties

Inline styles on the menu.

ui/src/git/WherePicker.tsx:41

Types#

StartFromPanelDraftType#

The draft a start sets up.

TypeScript
type StartFromPanelDraft = Pick<DraftTarget, 'environment' | 'setEnvironment' | 'environmentChoices'>

ui/src/git/useStartFromPanel.ts:24

StartFromPanelResultType#

What a start answered: done, or why not in words.

TypeScript
type StartFromPanelResult = { ok: true } | { message: string; ok: false }

ui/src/git/useStartFromPanel.ts:21

WherePickerPropsType#

Props for WherePicker.

TypeScript
type WherePickerProps = Omit<WhereMenuProps, 'onClose'>

ui/src/git/WherePicker.tsx:67