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.
function BranchMenu(props: BranchMenuProps): Element | nullParameters
| Name | Type | Description |
|---|---|---|
| props | BranchMenuProps | Component props. |
Returns
Element | nullProps
| Name | Type | Description |
|---|---|---|
| anchorRef | RefObject<HTMLElement | null> | The control the menu opens from. |
| className? | string | Extra classes on the menu surface. |
| current | string | null | The current branch, |
| 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". |
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.
const GitBar: MemoExoticComponent<(__namedParameters: GitBarProps) => Element>GitProviderComponent#
Provides a GitHost and optional label overrides to the git components below it.
function GitProvider(props: GitProviderProps): ElementParameters
| Name | Type | Description |
|---|---|---|
| props | GitProviderProps | Provider props: the |
Returns
ElementProps
| Name | Type | Description |
|---|---|---|
| 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. |
ImportRepoDialogComponent#
The import form: the repository field with its live preview, the parent folder, the clone's progress and error.
function ImportRepoDialog(props: ImportRepoDialogProps): ElementParameters
| Name | Type | Description |
|---|---|---|
| props | ImportRepoDialogProps |
Returns
ElementProps
| Name | Type | Description |
|---|---|---|
| className? | string | Extra class names for the root. |
| clone | GitClone | How the host clones. |
| hostId? | string | The saved server the clone lands on ( |
| 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; |
| style? | CSSProperties | Inline styles on the root element. |
MoveSessionDialogComponent#
The move dialog: where, then the folder when one is needed, then the confirmation.
function MoveSessionDialog(props: MoveSessionDialogProps): ElementParameters
| Name | Type | Description |
|---|---|---|
| props | MoveSessionDialogProps |
Returns
ElementProps
| Name | Type | Description |
|---|---|---|
| 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. |
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.
function RemoteFolderBrowser(props: RemoteFolderBrowserProps): Element | nullParameters
| Name | Type | Description |
|---|---|---|
| props | RemoteFolderBrowserProps | Component props. |
Returns
Element | nullProps
| Name | Type | Description |
|---|---|---|
| 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, |
| style? | CSSProperties | Inline styles on the menu. |
RemoteFolderPickerComponent#
Renders the folder pill and its browser. See the module doc.
function RemoteFolderPicker(props: RemoteFolderPickerProps): Element | nullParameters
| Name | Type | Description |
|---|---|---|
| props | RemoteFolderPickerProps | Component props. |
Returns
Element | nullProps
| Name | Type | Description |
|---|---|---|
| className? | string | Extra classes on the pill. |
| folder | string | null | The folder picked, |
| 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 |
| style? | CSSProperties | Inline styles on the pill. |
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.
function SyncChip(props: SyncChipProps): Element | nullParameters
| Name | Type | Description |
|---|---|---|
| props | SyncChipProps | The |
Returns
Element | nullProps
| Name | Type | Default | Description |
|---|---|---|---|
| className? | string | Extra class names for the root. | |
| confirm? | boolean | 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. |
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.
function WhereMenu(props: WhereMenuProps): Element | nullParameters
| Name | Type | Description |
|---|---|---|
| props | WhereMenuProps | Component props. |
Returns
Element | nullProps
| Name | Type | Description |
|---|---|---|
| className? | string | Extra classes on the menu. |
| descriptors | readonly EnvironmentDescriptor[] | The draft host's environment kinds ( |
| draft | DraftEnvironment | null | The draft's pick, |
| 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. |
WherePickerComponent#
Renders the where pill and its menu. Nothing when there is nothing to choose (one place, one way to run there).
function WherePicker(props: WherePickerProps): Element | nullParameters
| Name | Type | Description |
|---|---|---|
| props | WherePickerProps | Component props. |
Returns
Element | nullFunctions#
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.
function useEnvironmentChoices(
cwd: string | null,
hostId?: string,
): readonly EnvironmentDescriptor[]Parameters
| Name | Type | Description |
|---|---|---|
| cwd | string | null | The draft's folder ( |
| hostId? | string | The saved server the draft runs on (absent: this host). |
Returns
readonly EnvironmentDescriptor[]useGitBarFunction#
The checkout's live status and its branch's pull request, for a git bar.
function useGitBar(cwd: string | null, sessionId: string | null): GitBarStateParameters
| Name | Type | Description |
|---|---|---|
| cwd | string | null | The checkout, or |
| sessionId | string | null | The session working in it, whose activity refreshes it. |
Returns
useGitHostFunction#
The GitHost from the nearest GitProvider, or null outside one (the git components that need it render nothing).
useGitLabelsFunction#
Returns the git components' strings: the defaults merged with any overrides.
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 }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.
function useImportRepo(target?: ImportRepoTarget): () => Promise<string | null>Parameters
| Name | Type | Description |
|---|---|---|
| target? | ImportRepoTarget | A saved server to clone on. Absent: this computer. |
Returns
() => Promise<string | null>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.
function useMoveSession(): ((subject: MoveSessionSubject) => Promise<boolean>) | undefinedReturns
((subject: MoveSessionSubject) => Promise<boolean>) | undefineduseStartFromPanelFunction#
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.
function useStartFromPanel(
draft: StartFromPanelDraft,
cwd: string,
): (start: PanelStartSession) => Promise<StartFromPanelResult>Parameters
| Name | Type | Description |
|---|---|---|
| draft | StartFromPanelDraft | The new-chat draft on screen. |
| cwd | string | The folder the panel is for. |
Returns
(start: PanelStartSession) => Promise<StartFromPanelResult>Constants#
GIT_BAR_ITEMConstant#
The git bar's quiet item: a chip that only lifts on hover.
const GIT_BAR_ITEM: stringInterfaces#
BranchMenuPropsInterface#
Props for BranchMenu.
interface BranchMenuPropsProperties
| Name | Type | Description |
|---|---|---|
| anchorRef | RefObject<HTMLElement | null> | The control the menu opens from. |
| className? | string | Extra classes on the menu surface. |
| current | string | null | The current branch, |
| 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". |
BranchMenuWorktreeInterface#
The worktree a session can be moved into: the Worktree environment kind, as its host offers it.
interface BranchMenuWorktreeProperties
| Name | Type | Description |
|---|---|---|
| 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. |
GitBarBranchMenuPropsInterface#
What the git bar hands its branch menu.
interface GitBarBranchMenuPropsProperties
| Name | Type | Description |
|---|---|---|
| anchorRef | RefObject<HTMLButtonElement | null> | The branch button it opens from. |
| current | string | null | The current branch; |
| 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. |
GitBarPropsInterface#
Props for GitBar.
interface GitBarPropsProperties
| Name | Type | Default | Description |
|---|---|---|---|
| BranchMenu? | ComponentType<GitBarBranchMenuProps> | The branch switcher. Default: | |
| className? | string | Extra class names for the root. | |
| confirmSync? | boolean | true | Ask before a sync. |
| cwd | string | null | The checkout, or | |
| 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. |
GitBarStateInterface#
What useGitBar returns.
interface GitBarStateProperties
| Name | Type | Description |
|---|---|---|
| pending | boolean | A folder whose first answer is still on its way. |
| pullRequest | GitBranchPullRequest | null | The branch's open pull request, or |
| refresh | () => Promise<void> | Reads the status again now (after a switch or a sync). |
| status | GitStatus | null | Where the checkout stands; |
GitProviderPropsInterface#
Props for GitProvider.
interface GitProviderPropsProperties
| Name | Type | Description |
|---|---|---|
| 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. |
ImportRepoDialogPropsInterface#
Props for ImportRepoDialog.
interface ImportRepoDialogPropsProperties
| Name | Type | Description |
|---|---|---|
| className? | string | Extra class names for the root. |
| clone | GitClone | How the host clones. |
| hostId? | string | The saved server the clone lands on ( |
| 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; |
| style? | CSSProperties | Inline styles on the root element. |
ImportRepoTargetInterface#
Where useImportRepo clones.
interface ImportRepoTargetProperties
| Name | Type | Description |
|---|---|---|
| hostId | string | A saved server: the clone lands there ( |
MoveSessionDialogPropsInterface#
Props for MoveSessionDialog.
interface MoveSessionDialogPropsProperties
| Name | Type | Description |
|---|---|---|
| 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. |
RemoteFolderBrowserPropsInterface#
Props for RemoteFolderBrowser.
interface RemoteFolderBrowserPropsProperties
| Name | Type | Description |
|---|---|---|
| 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, |
| style? | CSSProperties | Inline styles on the menu. |
RemoteFolderPickerPropsInterface#
Props for RemoteFolderPicker.
interface RemoteFolderPickerPropsProperties
| Name | Type | Description |
|---|---|---|
| className? | string | Extra classes on the pill. |
| folder | string | null | The folder picked, |
| 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 |
| style? | CSSProperties | Inline styles on the pill. |
SyncChipPropsInterface#
Props for SyncChip.
interface SyncChipPropsProperties
| Name | Type | Default | Description |
|---|---|---|---|
| className? | string | Extra class names for the root. | |
| confirm? | boolean | 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. |
WhereMenuPropsInterface#
Props for WhereMenu: what WherePicker shows, and how a pick closes it.
interface WhereMenuPropsProperties
| Name | Type | Description |
|---|---|---|
| className? | string | Extra classes on the menu. |
| descriptors | readonly EnvironmentDescriptor[] | The draft host's environment kinds ( |
| draft | DraftEnvironment | null | The draft's pick, |
| 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. |
Types#
StartFromPanelDraftType#
The draft a start sets up.
type StartFromPanelDraft = Pick<DraftTarget, 'environment' | 'setEnvironment' | 'environmentChoices'>StartFromPanelResultType#
What a start answered: done, or why not in words.
type StartFromPanelResult = { ok: true } | { message: string; ok: false }WherePickerPropsType#
Props for WherePicker.
type WherePickerProps = Omit<WhereMenuProps, 'onClose'>