OpenProgram Docs

Git folder pills

A working folder inside a Git checkout gets a git half in its pill in the environment row: which branch, what changed, and the few Git actions a chat needs.

Which folders

FolderGit half
Main project folderYes, for a real project. Not the default home-folder project: that repository is OpenProgram's storage.
Each additional working folderYes
Outside a Git checkoutNone
Two folders in one checkoutOne git half: project first, then list order (git-chip-registry.ts). Separate worktrees have separate roots and keep their own.

The pill

SegmentContent
Folder (left)Icon, name; on a working folder a ✕ on hover or keyboard focus. Opens the project menu.
Git (right)Solar git-branch, the branch's last path segment (claude/foo shows foo; short commit id when detached), uncommitted +N −N
DividerFull-height hairline with no width, so both hover fills meet; fades on hover or open
Diff badgeGreen and red halves, as on the file-change card. Untracked text files count as added. Only binary changes: neutral "N files", grey level-3 dot, never "+0 −0". Clean: branch alone.
TooltipRepository, full branch, counts

components/chat/top-bar/chips/folder-pill.ts. Squeeze levels: responsive composer controls.

The menu

SectionContent
HeaderRepository name, tagged worktree on a linked worktree
Changes"N uncommitted files +N −N" opens Review in its Unstaged scope; inert before the first message. Ahead/behind upstream when non-zero.
BranchFilter and local branches, newest commit first, up to 50. Tags: current; worktree, which a click opens. A new name offers "Create branch" or "… in a new worktree"; Enter does the same.
Pull requestSee below

Where a branch click goes

FolderResult
Cleangit switch in place
Uncommitted changesOpens in a new worktree and moves this slot there; the section header says so
Slot cannot moveAlways switches in place

Moving a slot to a worktree

Created at <repo>-worktrees/<branch>, beside the repository, so the source folder's files stay put. No separate worktree list.

SlotResult
Working folderReplaced in the folder list
Main folder, unsent draftThe draft's project re-points to the worktree (registered as a project)
Main folder, startedFixed: the worktree joins as an additional folder, and the menu says so

Pull request

StateRow
Open PR"View pull request #N", in the system browser
None"Create pull request": git push -u origin HEAD, gh pr create --fill against the default branch, opens it
DisabledWith the reason: no gh, no origin, detached HEAD, or on the default branch. The backend also refuses no commits ahead.
Uncommitted changes"Commit & open PR with the agent…" places an instruction in the composer, unsent

Errors

CaseCard
Any errorAt the bottom of the menu, which stays open: plain title, git output behind a "Show git output" text button
Switch would overwrite changesNames the files and offers Open in a worktree or Carry the changes over
CarryRuns stash (untracked included), switch, pop
Pop conflictsThe switch stands and the changes stay in the latest stash, which the card says
Not offeredForce-switch or discard

Freshness

Nothing polls. A pill reads on mount and folder change, when its menu opens (the only read that lists branches and looks up the PR), when a turn ends, on window focus, on project change, and after a mutation on the same checkout (op:git-changed).

Backend

openprogram/state/worktree/folder_git.py holds the logic; ws_actions/folder_git.py moves it off the event loop. Every reply echoes path.

ActionReplyDoes
git_folder_statusgit_folder_statusstatus --porcelain=v2 --branch, diff --numstat HEAD, worktree list, default branch, origin, gh; with include_branches, include_pr: branches, gh pr view
git_switch_branchgit_switch_branch_resultgit switch [-c] <branch>; with carry, stash around it. Refusal: code (overwrite with files, or stash_conflict), detail
git_create_worktreegit_worktree_createdgit worktree add [-b]
git_create_prgit_pr_createdPush, gh pr create --fill, returns the URL or the open PR

GIT_OPTIONAL_LOCKS=0 keeps status from contending with the user's git. GIT_TERMINAL_PROMPT=0 makes a push needing credentials fail, not hang.

Implementation status

Implemented, except: base-branch choice and draft PRs; pull, push and fetch controls; ahead/behind against the default branch when there is no upstream.

Last updated · 2026-11-25