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
40 changes: 40 additions & 0 deletions .github/workflows/ci-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Builds and tests the Windows app on every change to the code, so a release
# never finds out about a Windows break. The zip is kept as an artifact for
# trying a change before it is released.
#
# Separate from ci.yml so the Windows and Linux CI can evolve independently.
name: CI Windows

on:
push:
branches: [main]
paths: ["src/**", "assets/**", "extensions/**", "Cargo.*", "rust-toolchain.toml", "script/bundle-windows.ps1", "script/third-party-licenses.sh", "resources/**", ".github/workflows/ci-windows.yml"]
pull_request:
paths: ["src/**", "assets/**", "extensions/**", "Cargo.*", "rust-toolchain.toml", "script/bundle-windows.ps1", "script/third-party-licenses.sh", "resources/**", ".github/workflows/ci-windows.yml"]
workflow_dispatch:

permissions:
contents: read

jobs:
windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4

- uses: Swatinem/rust-cache@v2

- name: Test
run: cargo test --locked

- name: Install cargo-about
run: cargo install cargo-about --locked --features cli --version 0.9.3

- name: Build the zip
run: pwsh -File script/bundle-windows.ps1

- uses: actions/upload-artifact@v4
with:
name: pi-gpui-windows-${{ runner.arch }}
path: target/release/pi-gpui-*-windows-*.zip
retention-days: 14
34 changes: 34 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,37 @@ jobs:
env:
GH_TOKEN: ${{ github.token }}
run: gh release upload "$GITHUB_REF_NAME" target/release/pi-gpui-*-linux-*.tar.gz --clobber

# Added by the Windows port: joins the release the macOS job created, as
# the Linux builds do. Windows builds are not code-signed yet.
windows:
needs: macos
runs-on: windows-latest
steps:
- uses: actions/checkout@v4

- name: Check that the tag matches Cargo.toml
shell: bash
run: |
version=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1)
if [ "v$version" != "$GITHUB_REF_NAME" ]; then
echo "Tag $GITHUB_REF_NAME does not match Cargo.toml version $version" >&2
exit 1
fi

- uses: Swatinem/rust-cache@v2

- name: Test
run: cargo test --locked

# Writes THIRD_PARTY_LICENSES.txt into the build (script/third-party-licenses.sh).
- name: Install cargo-about
run: cargo install cargo-about --locked --features cli --version 0.9.3

- name: Build the zip
run: pwsh -File script/bundle-windows.ps1

- name: Add it to the release
env:
GH_TOKEN: ${{ github.token }}
run: gh release upload "$GITHUB_REF_NAME" target/release/pi-gpui-*-windows-*.zip --clobber
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Types and where they end up:

Scopes are optional; use the area of the app when there is a clear one:
`chat`, `tabs`, `sidebar`, `files`, `diff`, `theme`, `settings`, `plugins`,
`updater`, `linux`, `site`, `examples`, `dev`.
`updater`, `linux`, `windows`, `site`, `examples`, `dev`.

A change that breaks something users rely on (settings keys, plugin API,
supported pi versions) gets a `!` after the type and a `BREAKING CHANGE:` line
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ cargo run [-- /path/to/project]
cargo test && cargo clippy --all-targets
```

You need pi 1.4 or newer and either a Mac with Xcode or Linux with the build libraries (`script/linux-deps.sh` installs them on Debian and Ubuntu). Rust is pinned in `rust-toolchain.toml`. Changes to shared code should keep both systems working: CI builds and tests the Linux app, and [docs/LINUX_VM.md](docs/LINUX_VM.md) sets up a Linux desktop VM on a Mac.
You need pi 1.4 or newer and either a Mac with Xcode, Linux with the build libraries (`script/linux-deps.sh` installs them on Debian and Ubuntu), or Windows with Visual Studio Build Tools (the C++ workload and the Windows SDK). Rust is pinned in `rust-toolchain.toml`. Changes to shared code should keep macOS, Linux and Windows working. CI builds and tests Linux and Windows; [docs/LINUX_VM.md](docs/LINUX_VM.md) sets up a Linux desktop VM on a Mac.

## Before you write code

Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 20 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,32 @@ regex = "1"
# Already comes with gpui; local time for message timestamps.
libc = "0.2"
# Already comes with gpui; decodes plugin view frames without the async asset cache.
image = { version = "0.25", default-features = false, features = ["jpeg", "png"] }
# BMP and TIFF are what Windows and macOS screenshots put on the clipboard.
image = { version = "0.25", default-features = false, features = ["bmp", "jpeg", "png", "tiff"] }

[target.'cfg(target_os = "macos")'.dependencies]
objc = "0.2"
# Already comes with gpui; Objective-C blocks for the folder picker's completion handler.
block = "0.1"

[target.'cfg(target_os = "windows")'.dependencies]
# Already comes with gpui; the Win32 calls gpui 0.2.2 does not wrap: the trash,
# the clipboard's file list, process liveness, local time and ConPTY.
windows = { version = "0.61", features = [
"Win32_Foundation",
"Win32_Security",
"Win32_Storage_FileSystem",
"Win32_System_Console",
"Win32_System_DataExchange",
"Win32_System_Ole",
"Win32_System_Pipes",
"Win32_System_Threading",
"Win32_System_Time",
"Win32_UI_Input_KeyboardAndMouse",
"Win32_UI_Shell",
"Win32_UI_WindowsAndMessaging",
] }

[profile.dev]
# GPUI is slow in unoptimized builds; optimize dependencies, keep our code debuggable.
opt-level = 1
Expand Down
37 changes: 29 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Pi GPUI

A native GUI for the [pi](https://github.com/earendil-works/pi) coding agent, written in Rust with [GPUI](https://www.gpui.rs), the UI framework behind Zed. No Electron, no webview. It runs the pi you already have over RPC, with the same models, extensions, skills and sessions you use in the terminal. For macOS and Linux.
A native GUI for the [pi](https://github.com/earendil-works/pi) coding agent, written in Rust with [GPUI](https://www.gpui.rs), the UI framework behind Zed. No Electron, no webview. It runs the pi you already have over RPC, with the same models, extensions, skills and sessions you use in the terminal. For macOS, Linux and Windows.

The app is 16 MB, its window is up in about 0.4 s, and it uses about 75 MB of memory at idle. Electron clients for pi take 0.5 to 1.1 s and 190 to 430 MB. Measured on an M1 Pro with no projects open, counting each app's own processes ([method and script](docs/BENCHMARKS.md)).

[![macOS 13+, Apple silicon](https://img.shields.io/badge/macOS-13%2B%20Apple%20silicon-111?logo=apple&logoColor=white)](#install)
[![Linux x86_64 and arm64](https://img.shields.io/badge/Linux-x86__64%20%C2%B7%20arm64%20(beta)-111?logo=linux&logoColor=white)](#install)
[![Windows x86_64](https://img.shields.io/badge/Windows-x86__64%20(beta)-111?logo=windows&logoColor=white)](#install)
[![MIT](https://img.shields.io/badge/license-MIT-111)](LICENSE)

[Website](https://pi-gpui.dev) · [Download](https://github.com/bytesbay/pi-gpui/releases/latest) · [Plugins](docs/PLUGINS.md) · [中文](docs/README.zh-CN.md)
Expand All @@ -32,7 +33,11 @@ curl -fsSL https://pi-gpui.dev/install.sh | sh

The [script](site/install.sh) puts the app in `~/.local/pi-gpui.app`, links `~/.local/bin/pi-gpui` and adds a launcher entry. It needs no root. Or unpack `pi-gpui-*-linux-*.tar.gz` from [Releases](https://github.com/bytesbay/pi-gpui/releases) yourself. It runs on X11 and Wayland and needs glibc 2.35 or newer (Ubuntu 22.04, Debian 12, Fedora 36) and a Vulkan driver. See [Linux](#linux) for what differs from the Mac app.

On both systems the app updates itself: when a new version is downloaded, "Restart to update" appears in the title bar. Windows isn't supported.
**Windows** (x86_64, Windows 10 or newer, beta)

Download `pi-gpui-*-windows-x86_64.zip` from [Releases](https://github.com/bytesbay/pi-gpui/releases) and unpack it anywhere you can write, then run `pi-gpui.app\bin\pi-gpui.exe`. The build is not code-signed yet, so SmartScreen asks once; "More info" → "Run anyway". See [Windows](#windows) for what differs from the Mac app.

On every system the app updates itself: when a new version is downloaded, "Restart to update" appears in the title bar.

Needs pi 1.4 or newer within pi 1.x. The app finds pi in `PI_EXECUTABLE`, `PATH` or your login shell (so nvm installs work).

Expand All @@ -42,7 +47,7 @@ To move a session you started in the terminal into the app, add the `/gpui` comm
pi install npm:pi-gpui
```

`/gpui` closes that pi and opens the same session in Pi GPUI. Other tools can do the same with a link: `open "pi-gpui://open?workspace=/path/to/project&session=/path/to/session.jsonl"` (the session is optional). On Linux pass the link to the app: `pi-gpui "pi-gpui://open?..."`, or just a folder: `pi-gpui /path/to/project`.
`/gpui` closes that pi and opens the same session in Pi GPUI. Other tools can do the same with a link: `open "pi-gpui://open?workspace=/path/to/project&session=/path/to/session.jsonl"` (the session is optional). On Linux and Windows pass the link to the app: `pi-gpui "pi-gpui://open?..."`, or just a folder: `pi-gpui /path/to/project`.

## It runs DOOM

Expand Down Expand Up @@ -93,11 +98,11 @@ Plugins can draw live views inside tool calls, in any language. [This one](examp

In the tree: `↑↓` move, `←→` jump between branches, `↩` go there, `⌥↩` go there and summarize the branch you leave, `⌘↩` fork from your message.

On Linux `⌘` is `Ctrl` and `⌥` is `Alt`, with one exception: compact is `Ctrl+Alt+C`, because `Ctrl+Shift+C` copies the selection as it does in a terminal.
On Linux and Windows `⌘` is `Ctrl` and `⌥` is `Alt`, with one exception: compact is `Ctrl+Alt+C`, because `Ctrl+Shift+C` copies the selection as it does in a terminal. On Windows `Alt+F4` quits.

## Settings

`~/Library/Application Support/pi-gpui/settings.json` (on Linux `~/.config/pi-gpui/settings.json`) is the source of truth. The app applies it as soon as it is saved, so you or a pi agent can edit it directly; the Settings page (`⌘,`) writes the same file and keeps its comments.
`~/Library/Application Support/pi-gpui/settings.json` (on Linux `~/.config/pi-gpui/settings.json`, on Windows `%APPDATA%\pi-gpui\settings.json`) is the source of truth. The app applies it as soon as it is saved, so you or a pi agent can edit it directly; the Settings page (`⌘,`) writes the same file and keeps its comments.

```jsonc
{
Expand Down Expand Up @@ -147,6 +152,21 @@ The Linux app is the same code as the Mac app. What differs:

So far it was tested on Ubuntu 24.04 on arm64 in a VM (GNOME on X11, and Wayland under Weston). Other desktops, real GPUs and the x86_64 build have not been tried yet, hence beta: please report what you see in [#5](https://github.com/bytesbay/pi-gpui/issues/5).

## Windows

The Windows app is the same code as the Mac app. What differs:

- The window hides the native title bar and draws its own, like the Linux app; the buttons are on the right.
- There is no menu bar. Settings, Check for Updates and Quit are under `…` in the title bar.
- Shortcuts use `Ctrl` and `Alt` (see [Keys](#keys)).
- Settings, projects and plugins live in `%APPDATA%\pi-gpui`; downloads in `%LOCALAPPDATA%\pi-gpui\cache`.
- Deleted sessions go to the Recycle Bin.
- Only one app runs per user: starting `pi-gpui` again, with a folder or a `pi-gpui://` link, hands it to the running app (a named pipe).
- The build is not code-signed yet, so SmartScreen warns the first time.
- `pi` installed with npm is found through `PATHEXT` (it is `pi.cmd`), and `pi auth login` runs in a ConPTY, the Windows pseudo-terminal.

It has not been tried outside the CI build yet, hence beta: please report what you see in a new issue.

## Known limits

- A pi running in a terminal on the same session is not detected.
Expand All @@ -157,12 +177,13 @@ So far it was tested on Ubuntu 24.04 on arm64 in a VM (GNOME on X11, and Wayland
```sh
cargo run [-- /path/to/project]
cargo test && cargo clippy --all-targets
script/bundle.sh # macOS: target/release/Pi GPUI.app
script/bundle-linux.sh # Linux: target/release/pi-gpui.app and the release tarball
script/bundle.sh # macOS: target/release/Pi GPUI.app
script/bundle-linux.sh # Linux: target/release/pi-gpui.app and the release tarball
script/bundle-windows.ps1 # Windows: target/release/pi-gpui.app and the release zip
script/release.sh # tag the Cargo.toml version; CI builds and publishes the release
```

Rust 1.90 (pinned). On macOS you need Xcode; shaders compile at startup, so the Metal Toolchain is not needed. On Debian and Ubuntu `script/linux-deps.sh` installs the libraries the build needs (xkbcommon, Wayland, XCB, fontconfig, freetype); other distributions have the same ones under their own names. The bundle scripts write `THIRD_PARTY_LICENSES.txt` with [cargo-about](https://github.com/EmbarkStudios/cargo-about) (`cargo install cargo-about --locked --features cli`); without it they skip that file outside CI. Set `PI_GPUI_PRETEND_VERSION=<older>` to try the update flow against a real release.
Rust 1.90 (pinned). On macOS you need Xcode; shaders compile at startup, so the Metal Toolchain is not needed. On Debian and Ubuntu `script/linux-deps.sh` installs the libraries the build needs (xkbcommon, Wayland, XCB, fontconfig, freetype); other distributions have the same ones under their own names. On Windows the "Desktop development with C++" workload of Visual Studio Build Tools and the Windows SDK are enough; release builds compile the HLSL shaders with the SDK's `fxc.exe`. The bundle scripts write `THIRD_PARTY_LICENSES.txt` with [cargo-about](https://github.com/EmbarkStudios/cargo-about) (`cargo install cargo-about --locked --features cli`); without it they skip that file outside CI. Set `PI_GPUI_PRETEND_VERSION=<older>` to try the update flow against a real release.

Working on the Linux app from a Mac: [docs/LINUX_VM.md](docs/LINUX_VM.md) describes a local VM with a desktop that can be built in, clicked and screenshotted from the command line.

Expand Down
41 changes: 41 additions & 0 deletions script/bundle-windows.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Builds the Windows release in target/release:
# pi-gpui.app\
# bin\pi-gpui.exe
# share\pi-gpui\ plugins and licenses
# pi-gpui-<version>-windows-<arch>.zip
# The updater replaces the whole pi-gpui.app folder, as on Linux.
$ErrorActionPreference = 'Stop'
Set-Location (Split-Path $PSScriptRoot -Parent)

cargo build --release --locked
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }

$version = [regex]::Match(
(Get-Content Cargo.toml -Raw), '(?m)^version = "([^"]+)"').Groups[1].Value
$hostLine = (& rustc -vV | Select-String '^host:').ToString()
$arch = ($hostLine -replace '^host: ', '') -replace '-.*$', ''
$target = if ($env:CARGO_TARGET_DIR) { $env:CARGO_TARGET_DIR } else { 'target' }
$release = Join-Path $target 'release'
$app = Join-Path $release 'pi-gpui.app'

if (Test-Path $app) { Remove-Item $app -Recurse -Force }
New-Item -ItemType Directory -Force -Path `
(Join-Path $app 'bin'), (Join-Path $app 'share\pi-gpui') | Out-Null
Copy-Item (Join-Path $release 'pi-gpui.exe') (Join-Path $app 'bin\pi-gpui.exe')
if (Test-Path plugins) {
Copy-Item plugins (Join-Path $app 'share\pi-gpui\plugins') -Recurse
}
Copy-Item LICENSE (Join-Path $app 'share\pi-gpui\LICENSE')
# The bundled JetBrains Mono font is distributed under this license.
Copy-Item assets\fonts\OFL.txt (Join-Path $app 'share\pi-gpui\JetBrainsMono-OFL.txt')

# Writes the Rust crates' licenses and appends the syntax definitions' ones.
& bash script/third-party-licenses.sh `
(Join-Path $app 'bin\pi-gpui.exe') `
(Join-Path $app 'share\pi-gpui\THIRD_PARTY_LICENSES.txt')
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }

$asset = Join-Path $release "pi-gpui-$version-windows-$arch.zip"
if (Test-Path $asset) { Remove-Item $asset -Force }
Compress-Archive -Path $app -DestinationPath $asset
Write-Output $asset
Loading