Skip to content
Open
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- **A finished turn in the chat is your message, the answer and the files it changed.** The calls, thoughts and texts on the way fold under one line with the time they took, like Worked for 4m 6s; click it to read them in order. Each changed file is listed once under the answer, and a click opens all its edits.
- **A permission the agent asks for in the chat now waits over the message box.** It says what the agent wants to do and shows the whole command, or each file with its diff, with the answers always in view. Once you answer, only the call is left in the conversation, or a Denied line.
- **A command you run with `!` in the chat is one message with its output.** The command and what it printed stand together on your side of the conversation, with the time it took when it is a second or more, and in red when it fails. On Claude Code, Codex and opencode, the agents whose chat runs commands.
- **The sidebar fits more sessions, and its tooltip tells you where each one works.** Rows are shorter, a branch glyph marks a session off the main branch, and resting the pointer on a row shows its branch, worktree, changes, pull request and conflicts. Services moved to the glyph at the end of the foot, green while one runs and red when one failed; click it for the list.
- **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 All @@ -43,6 +44,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- **A session you open in a colored folder takes the folder's color.** It used to stay without one and take the color off the whole folder, and so did the sessions an agent opened under one filed there.
- **The window no longer stops for a moment at the first Chinese, Japanese or Korean text.** Its fonts are read in the
background, and the text takes them a moment later.
- **A chat reopened after lich restarts shows each of your messages at the time you sent it.** Every message used to read the time of the restart. Claude Code and Codex chats are fixed; an agent that gives no time for a past message, the ones over ACP, still shows the restart's.
Expand Down
2 changes: 1 addition & 1 deletion README.es.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ en [INSTALL.md](INSTALL.md).
2. **Elige tu agente.** La primera vez que lo abres, lista los agentes que
encontró en tu máquina. En Ajustes › Proveedores defines el predeterminado y
la ruta de cada binario.
3. **Inicia una sesión.** *Nueva sesión* abre tu agente en el proyecto como chat,
3. **Inicia una sesión.** *Nueva* abre tu agente en el proyecto como chat,
o en su terminal si Ajustes › Proveedores lo indica. El `+` del encabezado de
un checkout abre cualquier agente, o una terminal sin agente, en ese checkout.
4. **Dale un worktree** *(opcional)*. Créalo a partir de cualquier rama base y
Expand Down
2 changes: 1 addition & 1 deletion README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Gatekeeper や SmartScreen の警告が出ます。Homebrew でインストー
フォルダー選択ダイアログが出ます。git リポジトリを選んでください。
2. **使うエージェントを選びます。** 初回起動時に、マシン上で見つかったエージェントが一覧されます。
設定 › プロバイダーで、既定のエージェントと各バイナリのパスを設定できます。
3. **セッションを開始します。** *新規セッション* で、プロジェクト内でエージェントがチャットとして開きます。
3. **セッションを開始します。** *新規* で、プロジェクト内でエージェントがチャットとして開きます。
設定 › プロバイダーでそう指定していれば、ターミナルで開きます。
各チェックアウトのヘッダーにある `+` からは、好きなエージェントや通常のターミナルを、そのチェックアウトで開けます。
4. **ワークツリーを作ります** *(任意)*。どのベースブランチからでも作成でき、
Expand Down
2 changes: 1 addition & 1 deletion README.ko.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ SmartScreen이 경고를 띄웁니다. Homebrew로 설치하면 Gatekeeper 경
열립니다. 여기서 git 저장소를 고르세요.
2. **에이전트를 고릅니다.** 처음 실행하면 머신에서 찾은 에이전트 목록이 나옵니다.
설정 › 프로바이더에서 기본값과 바이너리 경로를 지정할 수 있습니다.
3. **세션을 시작합니다.** *새 세션*을 누르면 프로젝트에서 에이전트가 채팅으로 열리고, 설정 ›
3. **세션을 시작합니다.** *새로 만들기*를 누르면 프로젝트에서 에이전트가 채팅으로 열리고, 설정 ›
프로바이더에서 터미널을 골랐다면 터미널로 열립니다. 체크아웃 헤더의 `+`로는 원하는
에이전트나 일반 터미널을 바로 그 체크아웃에서 열 수 있습니다.
4. **worktree를 만듭니다** *(선택)*. 원하는 베이스 브랜치에서 하나 만들면 lich가 그 안에
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ upgrading from the old Homebrew formula are in [INSTALL.md](INSTALL.md).
and opens a folder picker. Point it at a git repository.
2. **Pick your agent.** The first launch lists the agents it found on your
machine. Settings › Providers sets the default and each binary's path.
3. **Start a session.** *New Session* opens your agent in the project as a chat,
3. **Start a session.** *New* opens your agent in the project as a chat,
or in its terminal if Settings › Providers says so. The `+` on a checkout's
header opens any agent, or a plain terminal, in that checkout.
4. **Give it a worktree** *(optional)*. Create one from any base branch and lich
Expand Down
2 changes: 1 addition & 1 deletion README.pt-BR.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ estão no [INSTALL.md](INSTALL.md).
2. **Escolha o seu agente.** Na primeira execução, o lich lista os agentes que
encontrou na máquina. Em Configurações › Provedores você define o padrão e o
caminho de cada binário.
3. **Inicie uma sessão.** *Nova sessão* abre o seu agente no projeto como chat,
3. **Inicie uma sessão.** *Nova* abre o seu agente no projeto como chat,
ou no terminal se Configurações › Provedores pedir. O `+` no cabeçalho de um
checkout abre qualquer agente, ou um terminal comum, naquele checkout.
4. **Dê uma worktree para ela** *(opcional)*. Crie uma a partir de qualquer
Expand Down
2 changes: 1 addition & 1 deletion README.ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Linux, снятие флага карантина и переход со ста
2. **Выберите агента.** При первом запуске lich покажет агентов, которых нашёл на
вашей машине. В разделе Настройки › Провайдеры задаются агент по умолчанию и
путь к исполняемому файлу каждого.
3. **Запустите сессию.** Кнопка *Новая сессия* открывает вашего агента в проекте
3. **Запустите сессию.** Кнопка *Новая* открывает вашего агента в проекте
как чат или в терминале, если так выбрано в Настройки › Провайдеры. Кнопка `+`
в заголовке checkout открывает любого агента или обычный терминал именно в
этом checkout.
Expand Down
2 changes: 1 addition & 1 deletion README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ tarball、清除隔离标记,以及从旧的 Homebrew formula 升级,见 [IN
仓库即可。
2. **选择智能体。** 首次启动会列出在你机器上找到的智能体。设置 › 提供商里可以设置默认智能体,
以及每个可执行文件的路径。
3. **开启会话。** *新建会话*会在项目里以聊天打开你的智能体;如果设置 › 提供商里选了终端,
3. **开启会话。** *新建*会在项目里以聊天打开你的智能体;如果设置 › 提供商里选了终端,
则在终端里打开。每个检出目录标题栏上的 `+`,可以在该检出目录里打开任意智能体或普通终端。
4. **给它一个 worktree** *(可选)*。从任意基础分支创建,lich 会在其中打开一个新会话。

Expand Down
2 changes: 1 addition & 1 deletion docs/ceilings.md
Original file line number Diff line number Diff line change
Expand Up @@ -2523,7 +2523,7 @@ work when nobody knows it and that the call site never shows. The mechanism and
when every session is in one, which is also what a session closed there or a window reopened lands on, so
the tab does not come back on the session it last showed. A layout's tab has a sidebar of its own, its
sessions under their projects' names in the project sidebar's tree. That list is not the project's: it has
no New Session, filter or services, a card there offers no folder and is not dragged, a mother's children
no New or filter, a card there offers no folder and is not dragged, a mother's children
cannot be folded, a checkout row has no menu, a folder is not drawn, and no card is lit, the panes showing
which session has the focus. The collapsed sidebar still lists the focused pane's project. A split
is refused, with a toast, when a pane would drop under 480dp (51 columns at the default 13sp, measured with
Expand Down
2 changes: 1 addition & 1 deletion docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ session on /home/you/src/revu again reopens the project with them.

### `lich service [--project <name-or-path>] [--name <name>] [--command <command>] [--start-with-lich[=false]] [--json] <verb> [args]`

Manages a project's services, the commands the window's Services footer runs
Manages a project's services, the commands the window's services panel runs
on a console of their own. The project defaults to the caller's own; a service
is named by its name in the project, matched without regard to case. Flags go
before the verb.
Expand Down
5 changes: 3 additions & 2 deletions internal/spawn/folders.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,15 @@ func (s *Service) wearFolderColor(ctx context.Context, p store.Project, filed st
}

// sharedFolderColor is the color every session of p filed under folder but
// the one named except wears, "" when they wear different ones or none.
// the one named except wears, "" when they wear different ones or none. A pinned
// one is drawn out of the folder, so it has no say.
func sharedFolderColor(p store.Project, folder, except string) string {
if folder == "" {
return ""
}
tint, seen := "", false
for _, sess := range p.Sessions {
if sess.Folder != folder || sess.ID == except {
if sess.Folder != folder || sess.ID == except || sess.Pinned {
continue
}
if seen && sess.Color != tint {
Expand Down
14 changes: 14 additions & 0 deletions internal/spawn/folders_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -483,3 +483,17 @@ func TestFileIntoAFolderOfMixedColorsPaintsNothing(t *testing.T) {
t.Errorf("painted = %v, want nothing: Apps wears no one color", sessions.painted)
}
}

// A pinned card is drawn out of its folder, so its color is not the folder's.
func TestFileReadsAFoldersColorWithoutItsPinnedCards(t *testing.T) {
svc, sessions, _ := filer(t)
sessions.projects[0].Sessions[1].Color = "pink"
sessions.projects[0].Sessions[3].Color, sessions.projects[0].Sessions[3].Pinned = "blue", true

if _, err := svc.File(t.Context(), FileOptions{From: "s1", Target: "shared-b", Folder: "Apps"}); err != nil {
t.Fatalf("File: %v", err)
}
if sessions.painted["s3"] != "pink" {
t.Errorf("painted = %v, want s3 pink like the cards Apps draws", sessions.painted)
}
}
41 changes: 41 additions & 0 deletions internal/store/folder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,3 +237,44 @@ func TestAddSessionFilesTheRowItInserts(t *testing.T) {
}
}
}

// A folder wears the color its cards share, so a session born in one without
// it would take the color off the whole folder.
func TestASessionBornInAColoredFolderWearsItsColor(t *testing.T) {
colorOf := func(svc *Service, id string) string {
sessions, err := svc.sessionsOf("p1")
if err != nil {
t.Fatalf("sessionsOf: %v", err)
}
i := slices.IndexFunc(sessions, func(s Session) bool { return s.ID == id })
return sessions[i].Color
}
svc := newTestStore(t)
_, _ = svc.AddProject(t.Context(), api.AddProjectOptions{ID: "p1", Name: "alpha", Path: "/tmp/alpha"})
for _, s := range []struct{ id, folder, color string }{
{"s1", "Apps", "teal"}, {"s2", "Apps", "teal"}, {"s3", "Mixed", "red"}, {"s4", "Mixed", "blue"}, {"s5", "", "pink"},
} {
_, _ = svc.AddSessionInFolder(t.Context(), api.AddSessionInFolderOptions{ProjectID: "p1", SessionID: s.id, Label: s.id, Folder: s.folder})
_, _ = svc.SetSessionColor(t.Context(), api.SessionColorOptions{SessionID: s.id, Color: s.color})
}
// A pinned card is drawn out of its folder, so its color is not the folder's.
_, _ = svc.AddSessionInFolder(t.Context(), api.AddSessionInFolderOptions{ProjectID: "p1", SessionID: "pin", Label: "pin", Folder: "Apps"})
_, _ = svc.SetSessionColor(t.Context(), api.SessionColorOptions{SessionID: "pin", Color: "red"})
_, _ = svc.SetSessionPinned(t.Context(), api.SessionPinnedOptions{SessionID: "pin", Pinned: true})

for folder, want := range map[string]string{"Apps": "teal", "Mixed": "", "New": "", "": ""} {
id := "born-" + folder
if _, err := svc.AddSessionInFolder(t.Context(), api.AddSessionInFolderOptions{ProjectID: "p1", SessionID: id, Label: id, Folder: folder}); err != nil {
t.Fatalf("AddSessionInFolder: %v", err)
}
if got := colorOf(svc, id); got != want {
t.Errorf("born in %q: color %q, want %q", folder, got, want)
}
}
if _, err := svc.AddSessionFrom(t.Context(), api.AddSessionFromOptions{ProjectID: "p1", SessionID: "fork", Label: "fork", OriginID: "s1", Folder: "Apps"}); err != nil {
t.Fatalf("AddSessionFrom: %v", err)
}
if got := colorOf(svc, "fork"); got != "teal" {
t.Errorf("a fork born in Apps: color %q, want teal", got)
}
}
12 changes: 9 additions & 3 deletions internal/store/mutations.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ var now = time.Now
// order can never be decided against a stale count.
const nextSessionPosition = `(SELECT COALESCE(MAX(position), -1) + 1 FROM sessions WHERE project_id = ?)`

// folderColor is the color the cards a folder draws share, "" when they differ:
// a folder has no color of its own, so a session born in one without it would
// take it off the folder.
const folderColor = `(SELECT CASE WHEN COUNT(DISTINCT color) = 1 THEN MAX(color) ELSE '' END FROM sessions
WHERE project_id = ? AND folder = ? AND folder <> '' AND is_open = 1 AND pinned = 0)`

// setActiveSessionSQL is shared by the transactional helper below and the
// standalone SetActiveSession, so the two can never drift apart.
const setActiveSessionSQL = `UPDATE projects SET active_session_id = ? WHERE id = ?`
Expand Down Expand Up @@ -176,9 +182,9 @@ func (s *Service) addSession(
}
return s.tx(func(tx *sql.Tx) error {
if _, err := tx.Exec(
`INSERT INTO sessions (id, project_id, label, kind, path, origin_session_id, origin_label, sandbox, folder, profile, model, effort, view, position)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, `+nextSessionPosition+`)`,
sessionID, projectID, label, kind, path, originID, originLabel, sandbox, folder, profile, model, effort, view, projectID,
`INSERT INTO sessions (id, project_id, label, kind, path, origin_session_id, origin_label, sandbox, folder, profile, model, effort, view, color, position)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, `+folderColor+`, `+nextSessionPosition+`)`,
sessionID, projectID, label, kind, path, originID, originLabel, sandbox, folder, profile, model, effort, view, projectID, folder, projectID,
); err != nil {
return fmt.Errorf("insert session %q: %w", sessionID, err)
}
Expand Down
Loading
Loading