# zidane-ui/git

Import: `import { … } from 'zidane-ui/git'`. Source: [ui/src/git/index.ts](https://github.com/Tahul/zidane/blob/main/ui/src/git/index.ts).

## Components

### `BranchMenu`

Component.

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

```ts
function BranchMenu(props: BranchMenuProps): Element | null
```

**Parameters**

- `props` (`BranchMenuProps`): Component props.

**Returns** `Element | null`

**Props**

- `anchorRef` (`RefObject<HTMLElement | null>`): The control the menu opens from.
- `className?` (`string`): Extra classes on the menu surface.
- `current` (`string | null`): The current branch, `null` when HEAD is detached.
- `cwd` (`string`): 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.
- `open` (`boolean`): Whether the menu is shown.
- `sessionId` (`string | 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".

Source: [ui/src/git/BranchMenu.tsx:131](https://github.com/Tahul/zidane/blob/main/ui/src/git/BranchMenu.tsx#L131)

### `GitBar`

Component.

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.

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

Source: [ui/src/git/GitBar.tsx:91](https://github.com/Tahul/zidane/blob/main/ui/src/git/GitBar.tsx#L91)

### `GitProvider`

Component.

Provides a [`GitHost`](https://zidane.si/docs/reference/ui-git-headless.md#GitHost) and optional label overrides to the git components below it.

```ts
function GitProvider(props: GitProviderProps): Element
```

**Parameters**

- `props` (`GitProviderProps`): Provider props: the `host`, optional `labels`, and the `children` to render.

**Returns** `Element`

**Props**

- `children` (`ReactNode`): The app.
- `host` (`GitHost`): 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.

Source: [ui/src/git/GitProvider.tsx:33](https://github.com/Tahul/zidane/blob/main/ui/src/git/GitProvider.tsx#L33)

### `ImportRepoDialog`

Component.

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

```ts
function ImportRepoDialog(props: ImportRepoDialogProps): Element
```

**Parameters**

- `props` (`ImportRepoDialogProps`): The [`ImportRepoDialogProps`](https://zidane.si/docs/reference/ui-git.md#ImportRepoDialogProps).

**Returns** `Element`

**Props**

- `className?` (`string`): Extra class names for the root.
- `clone` (`GitClone`): How the host clones.
- `hostId?` (`string`): The saved server the clone lands on (`HostView.id`), for showing its folders. Absent: this computer.
- `initialParent` (`string`): 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.

Source: [ui/src/git/ImportRepoDialog.tsx:68](https://github.com/Tahul/zidane/blob/main/ui/src/git/ImportRepoDialog.tsx#L68)

### `MoveSessionDialog`

Component.

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

```ts
function MoveSessionDialog(props: MoveSessionDialogProps): Element
```

**Parameters**

- `props` (`MoveSessionDialogProps`): The [`MoveSessionDialogProps`](https://zidane.si/docs/reference/ui-git.md#MoveSessionDialogProps).

**Returns** `Element`

**Props**

- `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.
- `subject` (`MoveSessionSubject`): The session to move.

Source: [ui/src/git/MoveSessionDialog.tsx:71](https://github.com/Tahul/zidane/blob/main/ui/src/git/MoveSessionDialog.tsx#L71)

### `RemoteFolderBrowser`

Component.

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.

```ts
function RemoteFolderBrowser(props: RemoteFolderBrowserProps): Element | null
```

**Parameters**

- `props` (`RemoteFolderBrowserProps`): Component props.

**Returns** `Element | null`

**Props**

- `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.
- `start` (`string | null`): The folder to open on, `null` for the first root.
- `style?` (`CSSProperties`): Inline styles on the menu.

Source: [ui/src/git/RemoteFolderPicker.tsx:152](https://github.com/Tahul/zidane/blob/main/ui/src/git/RemoteFolderPicker.tsx#L152)

### `RemoteFolderPicker`

Component.

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

```ts
function RemoteFolderPicker(props: RemoteFolderPickerProps): Element | null
```

**Parameters**

- `props` (`RemoteFolderPickerProps`): Component props.

**Returns** `Element | null`

**Props**

- `className?` (`string`): Extra classes on the pill.
- `folder` (`string | 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).
- `hostName` (`string`): 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.

Source: [ui/src/git/RemoteFolderPicker.tsx:71](https://github.com/Tahul/zidane/blob/main/ui/src/git/RemoteFolderPicker.tsx#L71)

### `SyncChip`

Component.

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.

```ts
function SyncChip(props: SyncChipProps): Element | null
```

**Parameters**

- `props` (`SyncChipProps`): The [`SyncChipProps`](https://zidane.si/docs/reference/ui-git.md#SyncChipProps).

**Returns** `Element | null`

**Props**

- `className?` (`string`): Extra class names for the root.
- `confirm?` (`boolean`, default `true`): Ask before syncing.
- `cwd` (`string`): 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).
- `running` (`boolean`): The agent is working: the chip is disabled.
- `sessionId` (`string | null`): The session working in it (the host may refuse while it runs).
- `status` (`GitStatus`): The checkout's status.
- `style?` (`CSSProperties`): Inline styles on the root element.

Source: [ui/src/git/SyncChip.tsx:68](https://github.com/Tahul/zidane/blob/main/ui/src/git/SyncChip.tsx#L68)

### `WhereMenu`

Component.

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.

```ts
function WhereMenu(props: WhereMenuProps): Element | null
```

**Parameters**

- `props` (`WhereMenuProps`): Component props.

**Returns** `Element | null`

**Props**

- `className?` (`string`): Extra classes on the menu.
- `descriptors` (`readonly EnvironmentDescriptor[]`): The draft host's environment kinds (`withMachines` applied).
- `draft` (`DraftEnvironment | 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).
- `hostId` (`string`): The draft's host.
- `hosts` (`readonly 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.

Source: [ui/src/git/WherePicker.tsx:126](https://github.com/Tahul/zidane/blob/main/ui/src/git/WherePicker.tsx#L126)

### `WherePicker`

Component.

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

```ts
function WherePicker(props: WherePickerProps): Element | null
```

**Parameters**

- `props` (`WherePickerProps`): Component props.

**Returns** `Element | null`

Source: [ui/src/git/WherePicker.tsx:314](https://github.com/Tahul/zidane/blob/main/ui/src/git/WherePicker.tsx#L314)

## Functions

### `useEnvironmentChoices`

Function.

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.

```ts
function useEnvironmentChoices(
  cwd: string | null,
  hostId?: string,
): readonly EnvironmentDescriptor[]
```

**Parameters**

- `cwd` (`string | 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).

**Returns** `readonly EnvironmentDescriptor[]`

Source: [ui/src/git/useEnvironmentChoices.ts:23](https://github.com/Tahul/zidane/blob/main/ui/src/git/useEnvironmentChoices.ts#L23)

### `useGitBar`

Function.

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

```ts
function useGitBar(cwd: string | null, sessionId: string | null): GitBarState
```

**Parameters**

- `cwd` (`string | null`): The checkout, or `null` (no folder: nothing to show).
- `sessionId` (`string | null`): The session working in it, whose activity refreshes it.

**Returns** `GitBarState`

Source: [ui/src/git/useGitBar.ts:95](https://github.com/Tahul/zidane/blob/main/ui/src/git/useGitBar.ts#L95)

### `useGitHost`

Function.

The [`GitHost`](https://zidane.si/docs/reference/ui-git-headless.md#GitHost) from the nearest [`GitProvider`](https://zidane.si/docs/reference/ui-git.md#GitProvider), or `null` outside one (the git components that need it render nothing).

```ts
function useGitHost(): GitHost | null
```

**Returns** `GitHost | null`

Source: [ui/src/git/GitProvider.tsx:42](https://github.com/Tahul/zidane/blob/main/ui/src/git/GitProvider.tsx#L42)

### `useGitLabels`

Function.

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

```ts
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 }
```

**Returns** `{ 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 }`

Source: [ui/src/git/GitProvider.tsx:47](https://github.com/Tahul/zidane/blob/main/ui/src/git/GitProvider.tsx#L47)

### `useImportRepo`

Function.

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.

```ts
function useImportRepo(target?: ImportRepoTarget): () => Promise<string | null>
```

**Parameters**

- `target?` (`ImportRepoTarget`): A saved server to clone on. Absent: this computer.

**Returns** `() => Promise<string | null>`

Source: [ui/src/git/ImportRepoDialog.tsx:344](https://github.com/Tahul/zidane/blob/main/ui/src/git/ImportRepoDialog.tsx#L344)

### `useMoveSession`

Function.

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.

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

**Returns** `((subject: MoveSessionSubject) => Promise<boolean>) | undefined`

Source: [ui/src/git/MoveSessionDialog.tsx:363](https://github.com/Tahul/zidane/blob/main/ui/src/git/MoveSessionDialog.tsx#L363)

### `useStartFromPanel`

Function.

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.

```ts
function useStartFromPanel(
  draft: StartFromPanelDraft,
  cwd: string,
): (start: PanelStartSession) => Promise<StartFromPanelResult>
```

**Parameters**

- `draft` (`StartFromPanelDraft`): The new-chat draft on screen.
- `cwd` (`string`): The folder the panel is for.

**Returns** `(start: PanelStartSession) => Promise<StartFromPanelResult>`

Source: [ui/src/git/useStartFromPanel.ts:46](https://github.com/Tahul/zidane/blob/main/ui/src/git/useStartFromPanel.ts#L46)

## Constants

### `GIT_BAR_ITEM`

Constant.

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

```ts
const GIT_BAR_ITEM: string
```

Source: [ui/src/git/SyncChip.tsx:29](https://github.com/Tahul/zidane/blob/main/ui/src/git/SyncChip.tsx#L29)

## Interfaces

### `BranchMenuProps`

Interface.

Props for [`BranchMenu`](https://zidane.si/docs/reference/ui-git.md#BranchMenu).

```ts
interface BranchMenuProps
```

**Properties**

- `anchorRef` (`RefObject<HTMLElement | null>`): The control the menu opens from.
- `className?` (`string`): Extra classes on the menu surface.
- `current` (`string | null`): The current branch, `null` when HEAD is detached.
- `cwd` (`string`): 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.
- `open` (`boolean`): Whether the menu is shown.
- `sessionId` (`string | 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".

Source: [ui/src/git/BranchMenu.tsx:93](https://github.com/Tahul/zidane/blob/main/ui/src/git/BranchMenu.tsx#L93)

### `BranchMenuWorktree`

Interface.

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

```ts
interface BranchMenuWorktree
```

**Properties**

- `available` (`boolean`): 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.

Source: [ui/src/git/BranchMenu.tsx:83](https://github.com/Tahul/zidane/blob/main/ui/src/git/BranchMenu.tsx#L83)

### `GitBarBranchMenuProps`

Interface.

What the git bar hands its branch menu.

```ts
interface GitBarBranchMenuProps
```

**Properties**

- `anchorRef` (`RefObject<HTMLButtonElement | null>`): The branch button it opens from.
- `current` (`string | null`): The current branch; `null` when detached.
- `cwd` (`string`): The checkout.
- `onClose` (`() => void`): Close it.
- `onSwitched` (`() => void`): A switch landed: the bar refreshes.
- `open` (`boolean`): The menu is open.
- `sessionId` (`string | null`): The session working in it.

Source: [ui/src/git/GitBar.tsx:39](https://github.com/Tahul/zidane/blob/main/ui/src/git/GitBar.tsx#L39)

### `GitBarProps`

Interface.

Props for [`GitBar`](https://zidane.si/docs/reference/ui-git.md#GitBar).

```ts
interface GitBarProps
```

**Properties**

- `BranchMenu?` (`ComponentType<GitBarBranchMenuProps>`): The branch switcher. Default: `BranchMenu`. Keep it stable.
- `className?` (`string`): Extra class names for the root.
- `confirmSync?` (`boolean`, default `true`): Ask before a sync.
- `cwd` (`string | 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.
- `running` (`boolean`): The agent is working: no switching, no syncing.
- `sessionId` (`string | null`): The session working in it, whose activity refreshes the bar.
- `style?` (`CSSProperties`): Inline styles on the root element.

Source: [ui/src/git/GitBar.tsx:57](https://github.com/Tahul/zidane/blob/main/ui/src/git/GitBar.tsx#L57)

### `GitBarState`

Interface.

What [`useGitBar`](https://zidane.si/docs/reference/ui-git.md#useGitBar) returns.

```ts
interface GitBarState
```

**Properties**

- `pending` (`boolean`): A folder whose first answer is still on its way.
- `pullRequest` (`GitBranchPullRequest | null`): The branch's open pull request, or `null`.
- `refresh` (`() => Promise<void>`): Reads the status again now (after a switch or a sync).
- `status` (`GitStatus | null`): Where the checkout stands; `null` outside a git checkout, for no folder, or before the first answer.

Source: [ui/src/git/useGitBar.ts:78](https://github.com/Tahul/zidane/blob/main/ui/src/git/useGitBar.ts#L78)

### `GitProviderProps`

Interface.

Props for [`GitProvider`](https://zidane.si/docs/reference/ui-git.md#GitProvider).

```ts
interface GitProviderProps
```

**Properties**

- `children` (`ReactNode`): The app.
- `host` (`GitHost`): 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.

Source: [ui/src/git/GitProvider.tsx:19](https://github.com/Tahul/zidane/blob/main/ui/src/git/GitProvider.tsx#L19)

### `ImportRepoDialogProps`

Interface.

Props for [`ImportRepoDialog`](https://zidane.si/docs/reference/ui-git.md#ImportRepoDialog).

```ts
interface ImportRepoDialogProps
```

**Properties**

- `className?` (`string`): Extra class names for the root.
- `clone` (`GitClone`): How the host clones.
- `hostId?` (`string`): The saved server the clone lands on (`HostView.id`), for showing its folders. Absent: this computer.
- `initialParent` (`string`): 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.

Source: [ui/src/git/ImportRepoDialog.tsx:44](https://github.com/Tahul/zidane/blob/main/ui/src/git/ImportRepoDialog.tsx#L44)

### `ImportRepoTarget`

Interface.

Where [`useImportRepo`](https://zidane.si/docs/reference/ui-git.md#useImportRepo) clones.

```ts
interface ImportRepoTarget
```

**Properties**

- `hostId` (`string`): A saved server: the clone lands there (`GitHost.cloneOnServer`).

Source: [ui/src/git/ImportRepoDialog.tsx:331](https://github.com/Tahul/zidane/blob/main/ui/src/git/ImportRepoDialog.tsx#L331)

### `MoveSessionDialogProps`

Interface.

Props for [`MoveSessionDialog`](https://zidane.si/docs/reference/ui-git.md#MoveSessionDialog).

```ts
interface MoveSessionDialogProps
```

**Properties**

- `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.
- `subject` (`MoveSessionSubject`): The session to move.

Source: [ui/src/git/MoveSessionDialog.tsx:41](https://github.com/Tahul/zidane/blob/main/ui/src/git/MoveSessionDialog.tsx#L41)

### `RemoteFolderBrowserProps`

Interface.

Props for [`RemoteFolderBrowser`](https://zidane.si/docs/reference/ui-git.md#RemoteFolderBrowser).

```ts
interface RemoteFolderBrowserProps
```

**Properties**

- `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.
- `start` (`string | null`): The folder to open on, `null` for the first root.
- `style?` (`CSSProperties`): Inline styles on the menu.

Source: [ui/src/git/RemoteFolderPicker.tsx:31](https://github.com/Tahul/zidane/blob/main/ui/src/git/RemoteFolderPicker.tsx#L31)

### `RemoteFolderPickerProps`

Interface.

Props for [`RemoteFolderPicker`](https://zidane.si/docs/reference/ui-git.md#RemoteFolderPicker).

```ts
interface RemoteFolderPickerProps
```

**Properties**

- `className?` (`string`): Extra classes on the pill.
- `folder` (`string | 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).
- `hostName` (`string`): 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.

Source: [ui/src/git/RemoteFolderPicker.tsx:47](https://github.com/Tahul/zidane/blob/main/ui/src/git/RemoteFolderPicker.tsx#L47)

### `SyncChipProps`

Interface.

Props for [`SyncChip`](https://zidane.si/docs/reference/ui-git.md#SyncChip).

```ts
interface SyncChipProps
```

**Properties**

- `className?` (`string`): Extra class names for the root.
- `confirm?` (`boolean`, default `true`): Ask before syncing.
- `cwd` (`string`): 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).
- `running` (`boolean`): The agent is working: the chip is disabled.
- `sessionId` (`string | null`): The session working in it (the host may refuse while it runs).
- `status` (`GitStatus`): The checkout's status.
- `style?` (`CSSProperties`): Inline styles on the root element.

Source: [ui/src/git/SyncChip.tsx:38](https://github.com/Tahul/zidane/blob/main/ui/src/git/SyncChip.tsx#L38)

### `WhereMenuProps`

Interface.

Props for [`WhereMenu`](https://zidane.si/docs/reference/ui-git.md#WhereMenu): what [`WherePicker`](https://zidane.si/docs/reference/ui-git.md#WherePicker) shows, and how a pick closes it.

```ts
interface WhereMenuProps
```

**Properties**

- `className?` (`string`): Extra classes on the menu.
- `descriptors` (`readonly EnvironmentDescriptor[]`): The draft host's environment kinds (`withMachines` applied).
- `draft` (`DraftEnvironment | 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).
- `hostId` (`string`): The draft's host.
- `hosts` (`readonly 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.

Source: [ui/src/git/WherePicker.tsx:41](https://github.com/Tahul/zidane/blob/main/ui/src/git/WherePicker.tsx#L41)

## Types

### `StartFromPanelDraft`

Type.

The draft a start sets up.

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

Source: [ui/src/git/useStartFromPanel.ts:24](https://github.com/Tahul/zidane/blob/main/ui/src/git/useStartFromPanel.ts#L24)

### `StartFromPanelResult`

Type.

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

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

Source: [ui/src/git/useStartFromPanel.ts:21](https://github.com/Tahul/zidane/blob/main/ui/src/git/useStartFromPanel.ts#L21)

### `WherePickerProps`

Type.

Props for [`WherePicker`](https://zidane.si/docs/reference/ui-git.md#WherePicker).

```ts
type WherePickerProps = Omit<WhereMenuProps, 'onClose'>
```

Source: [ui/src/git/WherePicker.tsx:67](https://github.com/Tahul/zidane/blob/main/ui/src/git/WherePicker.tsx#L67)
