Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- **A name with several definitions, or its references, opens a list under it in the editor.** F12, Ctrl+click or Shift+F12 list every place with its line of code; arrows and Enter open one. With Vim on, `gd`, `gr` and anything else that fills Neovim's quickfix list open the same list.
- **Commit from the Git panel.** The Uncommitted changes row at the top of the Git panel's log lists every changed file: check the ones to commit and write the message, or have the session's agent write it with the sparkle. The sparkle is not on Antigravity, Crush, Cursor CLI or Kiro CLI.
- **Commit from the Git panel.** The Git panel's Changes tab lists every changed file beside its diff: check the ones to commit and write the message, or have the session's agent write it with the sparkle. The sparkle is not on Antigravity, Crush, Cursor CLI or Kiro CLI.
- **Open projects on another machine over ssh.** Add a server from the `+` after the tabs or from Settings › Servers, which also connects, stops or removes one, and pick it as the scope in Settings to set up its agents and sign them in there; lich installs itself there, the folder you pick opens as a tab marked with the server's name, its sessions are marked the same way in the bell, the sidebar's usage line shows the server's own plan, and those tabs come back when lich starts again. The server must run Linux, Windows cannot connect yet, and files you drop, attach or paste into its sessions are copied there.
- **Keep several files open in the editor.** Each file you open gets its own row under the session in the sidebar and keeps its unsaved text, cursor and scroll while you look at another; click a row to go back to it. Close one with Ctrl+W in the editor, a middle click on its row, or the row's menu, which also has Close others and Copy path.
- **See the subagents an agent runs inside the chat.** A chip over the composer counts the ones still running, including the ones that keep going after the turn ends, and opens a list of each one's type, task and running time. Codex and Antigravity do not report them.
Expand All @@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

- **The Pulls screen is redrawn, and its list is sorted by what each pull request needs.** Open ones are grouped into Ready to merge, Needs work, In review and Drafts, in place of the All, Ready, Drafts and Failing filters and the Approved state. Inside a pull request, its facts stand beside the description, and Copy link and Copy Markdown are in the `⋯` menu.
- **The Git panel shows one thing at a time.** Changes and History are now two tabs, and a commit opens beside the log when you click it. The branches open from the branch's name in the panel's header: click one to check it out, type a new name to create it, and find the rest in its `⋯`.
- **Review threads in Pulls show who answers whom.** Each thread is a card with its file and code, and its replies hang from a line under the comment they answer, in Conversation and between the lines in Files.
- **Long conversations no longer slow the window down.** Scrolling, typing and watching an answer come in cost about the
same in a chat of thousands of messages as in a new one, and several agents working at once take about a third of the
Expand Down
58 changes: 30 additions & 28 deletions native/DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -1008,46 +1008,48 @@ to the chrome takes the same gap rather than a number of its own.

### The Git panel

The panel that rises from the stage's foot (`git_panel.go`) is three columns, the branch tree, the log and the
detail, a `gutter` apart with no rule between them; their resize handles take the gaps, as the sidebar's and the
dock's do.
The panel that rises from the stage's foot (`git_panel.go`) does one job at a time: **Changes**, what to commit, or
**History**, what was. It opens on Changes when there is something to commit and on History when there is not. Two
columns at most stand in it, a `gutter` apart with no rule between them, and the left one's resize handle takes the gap.

- **One header line.** "Git" stands over the tree, the log's filters (text or hash, Author, Date, Path) over the
log, and full screen and close at the right. The tree's own field is its first row, not a band of its own.
- **Push and pull** (`git_sync.go`) stand in the header left of full screen, and only the action the branch's
- **One header line.** The tabs (ghost, as Pulls') at the left; the branch, the push or pull it calls for, full screen
and close at the right. Nothing in it belongs to one tab alone.
- **Push and pull** (`git_sync.go`) stand after the branch, and only the action the branch's
standing against its upstream calls for: Push with the commits to send ("Push 2", Lucide `arrow-up`), Pull with
the commits to bring ("Pull 1", `arrow-down`), or Publish (`cloud-upload`) for a branch with no upstream; even
with its upstream, or on a detached HEAD, the header has none. The one that resolves the state is filled and
stands last. Diverged, Pull is filled and Push is a ghost, disabled, saying why in its tooltip ("Pull first:
origin/x has 1 commit this branch doesn't"). While one runs it is `Busy` and the other is disabled. A pull
with its upstream, or on a detached HEAD, the header has none. The one that resolves the state stands last, filled,
or outline while there are uncommitted changes, since Commit is then the view's filled button. Diverged, Pull
resolves and Push is a ghost, disabled, saying why in its tooltip ("Pull first: origin/x has 1 commit this branch
doesn't"). While one runs it is `Busy` and the other is disabled. A pull
under a session asks first, naming it, in the dialog a checkout under a session uses; a push changes no file
and asks nothing. A failure is a toast with git's own words. There is no Fetch button: the counts come from the
status read, and lich already fetches origin for the base status.
- **The tree.** Its first row is the branch HEAD is on, by name, in `Foreground` and medium, with no "HEAD" before
it. Local branches that share a prefix before their first slash (`feat/`, `fix/`) sit in a folder row: a chevron,
the prefix and the count in mono, all muted; a click opens or shuts it, the folder holding HEAD's branch opens by
itself and a typed filter opens them all. Its branches stand `gitFolderIndent` in; branches with no prefix stay
loose after the folders.
- **Changes** (`git_commit.go`) is the files over the message, and the diff of one file at the right, the first until
another is clicked. A file's box is the index itself (checked while it holds the file), a conflicted file's box is
disabled with why in its tooltip; its name is ink, its folder muted, and git's letter is the one word in a tone, a
deleted file `D` in `Destructive`. The message is `writeBox`'s shape: a box filled with `Background`, no field in it,
growing with the text, a ghost `IconAction` sparkle (Lucide `sparkles`) in its top right corner, the text wrapping
short of it (`PadRight`); while the agent writes, the field is read only and the sparkle is the kit's spinner,
which cancels. Commit stands last inside it, filled, counting its files, with its keys after the text; disabled, it
says why in its tooltip. The box of every file but the conflicted ones is at the foot's left. A failure is git's
first line in `Destructive` `TextXS` left of Commit, the rest in its tooltip, and the message stays.
- **History** (`git_log.go`) is the log on the panel's whole width, under a search with no box. Author, Date and Path are a line of
their own under it, shown by the filter icon and while one of them is set; the icon is then lit, and a click clears
them. A click on a commit opens it beside the log (`git_detail.go`), which gives up the author's column; a click on
the same commit shuts it. The commit is one list: its subject, who, when, hash and refs on one muted line, the
message, the files. A file's diff takes that list's place, a back arrow before its name.
- **A log row** is the graph, the subject, then the commit's one ref right after it (Lucide `git-branch` or `tag`
and the name in mono, in its lane's tone), and who and when in fixed columns at the right. The ref is laid out
and the name, muted: the graph has the color), and who and when in fixed columns at the right. The ref is laid out
first, so a long subject is cut short of it.
- **The graph.** Lanes 12dp apart, 2dp lines, a lane changing lanes on an S curve. A commit is a disc of radius 4
on a 2dp halo of its row's own ground (rest, hover or selection), so a line stops short of it; a merge is a
hollow ring; HEAD wears a second ring 3dp out. The lanes' colors are the one exception to "color encodes
state" (see Semantic color).
- **Uncommitted changes** is the log's first row while the checkout has any and no filter narrows the log: a
hollow ring in HEAD's lane and tone, tied to HEAD's node by a dashed line when HEAD heads the page, and the
lines it changes as `+a -d`. The panel opens on it when there are changes and on HEAD when there are none, so
the detail never opens empty.
- **The commit form** is that row's detail, in the shape a commit's has: the files over the message, the seam
between them dragged. A file's box is the index itself (checked while it holds the file), a conflicted file's
box is disabled with why in its tooltip, and the rest of the row opens its diff in the log's place; the file's
name and git's letter take the Code tab's tree's tones, a deleted file `D` in `Destructive`. The message is a
`Textarea` with a ghost `IconAction` sparkle (Lucide `sparkles`) in its top right corner, the text wrapping
short of it (`PadRight`); while the agent writes, the field is read only and the sparkle is the kit's spinner,
which cancels. Commit stands last, filled, with its keys after the text; disabled, it says why in its tooltip.
A failure is git's first line in `Destructive` `TextXS` left of Commit, the rest in its tooltip, and the
message stays.
- **The branches** (`git_refs.go`) open from the branch in the header: a field that finds one or names a new one, the
branch HEAD is on first with its check, the other local ones by their whole name, then Remote branches and Tags, shut
until clicked or until something typed is in them. A click goes there: a checkout, or the session on the branch, whose
name stands at the row's end; a tag shows its history. Everything else a ref offers (Merge, New branch from here,
Rename, Show its history, Delete) is in the row's `⋯` and right click.

### Pulls

Expand Down
35 changes: 23 additions & 12 deletions native/cmd/lich-native/git_branch.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package main

// The branch tree's actions: the menu of each ref row, the in-row fields that
// The branches' actions: the menu of each ref row, the in-row fields that
// rename a branch or start one, and the two confirmations, a checkout under a
// session's agent and a delete that leaves commits without a branch.

Expand All @@ -27,6 +27,7 @@ const (
gitActRename
gitActDelete
gitActMerge
gitActHistory
)

// gitBlocked is why a menu entry is there but cannot be chosen.
Expand All @@ -50,12 +51,12 @@ type gitMenuItem struct {
// worktree cannot be checked out here, so its first entry opens the session on
// it when there is one; a remote branch is checked out as the local one that
// tracks it.
func gitBranchMenu(row gitTreeRow, hasSession bool) []gitMenuItem {
func gitBranchMenu(row gitRefRow, hasSession bool) []gitMenuItem {
switch {
case row.remote:
return []gitMenuItem{{act: gitActCheckoutRemote}, {act: gitActNewBranch}}
return []gitMenuItem{{act: gitActCheckoutRemote}, {act: gitActNewBranch}, {act: gitActHistory}}
case row.tag:
return []gitMenuItem{{act: gitActNewBranch}}
return []gitMenuItem{{act: gitActHistory}, {act: gitActNewBranch}}
}
held := row.worktree != "" && !row.head
var items []gitMenuItem
Expand All @@ -65,7 +66,7 @@ func gitBranchMenu(row gitTreeRow, hasSession bool) []gitMenuItem {
case !held && !row.head:
items = append(items, gitMenuItem{act: gitActCheckout})
}
items = append(items, gitMenuItem{act: gitActNewBranch}, gitMenuItem{act: gitActRename})
items = append(items, gitMenuItem{act: gitActNewBranch}, gitMenuItem{act: gitActRename}, gitMenuItem{act: gitActHistory})
del := gitMenuItem{act: gitActDelete}
switch {
case row.head:
Expand All @@ -78,7 +79,7 @@ func gitBranchMenu(row gitTreeRow, hasSession bool) []gitMenuItem {

// gitEdit is the in-row field renaming from, or starting a branch at it.
type gitEdit struct {
from gitTreeRow
from gitRefRow
create bool
field ui.InlineEdit
}
Expand All @@ -88,7 +89,7 @@ type gitEdit struct {
type gitConfirm struct {
remove bool
pull bool
row gitTreeRow
row gitRefRow
session string
only int
}
Expand Down Expand Up @@ -134,6 +135,8 @@ func gitActLabel(act gitBranchAct, session string) string {
return i18n.T("git.branch.newBranch")
case gitActRename:
return i18n.T("git.branch.rename")
case gitActHistory:
return i18n.T("git.branch.history")
}
return i18n.T("git.branch.delete")
}
Expand All @@ -152,7 +155,7 @@ func gitBlockedText(b gitBlocked) string {
return i18n.T("git.branch.inWorktree")
}

func (g *gitPanel) branchEntries(row gitTreeRow, in gitPanelInput) []ui.MenuEntry {
func (g *gitPanel) branchEntries(row gitRefRow, in gitPanelInput) []ui.MenuEntry {
sv, hasSession := in.sessions[row.branch]
hasSession = hasSession && row.branch != ""
var out []ui.MenuEntry
Expand Down Expand Up @@ -183,14 +186,22 @@ func (g *gitPanel) branchEntries(row gitTreeRow, in gitPanelInput) []ui.MenuEntr
return out
}

func (g *gitPanel) doBranch(act gitBranchAct, row gitTreeRow, sv sessionView, in gitPanelInput) {
// doBranch runs a ref's action. The ones that type in the row keep the
// branches open; the rest are done with them.
func (g *gitPanel) doBranch(act gitBranchAct, row gitRefRow, sv sessionView, in gitPanelInput) {
if act != gitActNewBranch && act != gitActRename {
g.picker.panel.Close()
}
switch act {
case gitActCheckout, gitActCheckoutRemote:
if in.here != nil {
g.confirm = &gitConfirm{row: row, session: in.here.Label}
return
}
g.checkout(row)
case gitActHistory:
g.filter.ref, g.filterRef, g.selected = row.ref, row.name, ""
g.show(gitTabHistory)
case gitActOpenSession:
g.openSession(sv.projectID, sv.ID)
case gitActNewBranch, gitActRename:
Expand Down Expand Up @@ -222,15 +233,15 @@ func (g *gitPanel) runBranchOp(fail string, op func(context.Context, *backend.Cl
}()
}

func (g *gitPanel) checkout(row gitTreeRow) {
func (g *gitPanel) checkout(row gitRefRow) {
g.runBranchOp(i18n.T("git.branch.checkoutFailed", i18n.Args{"name": row.name}), func(ctx context.Context, c *backend.Client, path string) error {
return c.For(path).GitCheckout(ctx, path, row.name, row.remote)
}, nil)
}

// askDelete counts what only the branch holds: nothing, and it goes at once
// with an Undo; something, and the dialog asks first.
func (g *gitPanel) askDelete(row gitTreeRow) {
func (g *gitPanel) askDelete(row gitRefRow) {
path, fail := g.path, i18n.T("git.branch.deleteFailed", i18n.Args{"name": row.name})
go func() {
only, err := g.store.client.For(path).GitBranchOnly(g.store.ctx, path, row.name)
Expand Down Expand Up @@ -292,7 +303,7 @@ func (g *gitPanel) newBranchRow(gtx C, th *ui.Theme) D {
e := g.editing
size := image.Pt(gtx.Constraints.Max.X, gtx.Dp(gitRowHeight))
gtx.Constraints = layout.Exact(size)
return layout.Inset{Left: ui.Space(5.5), Right: ui.Space(1.5)}.Layout(gtx, func(gtx C) D {
return layout.Inset{Left: ui.Space(2), Right: ui.Space(2)}.Layout(gtx, func(gtx C) D {
return layout.Flex{Alignment: layout.Middle}.Layout(gtx,
layout.Rigid(func(gtx C) D { return icBranch.Layout(gtx, ui.Space(3), th.MutedForeground) }),
ui.Gap(1.5),
Expand Down
Loading
Loading