Skip to content

Repository files navigation

zql

A small psql editor and runner: write SQL, run it, read the results. Built as a native desktop app on GPUI, with an agent panel alongside the editor.

Status

Early. What works today:

  • Connections — stored locally and encrypted at rest, with the master key in the OS keyring. Create, edit, delete, and test a connection; four environments (prod, staging, dev, local).
  • Query execution — run the editor's SQL against the active connection with Ctrl+Enter and see real rows, with column types and server errors.
  • Database browser — a schema tree in the right dock, sharing it with the agent panel. Schemas and their tables and views, with estimated row counts, and a filter that matches column names as well as table names.
  • Tables as tabs — clicking a table in the tree opens it beside the .sql files in the same tab strip, with a where box over a full-height grid and no editor: the editor belongs to .sql tabs, not to the window. A single click previews (the tab a later click replaces), a double click keeps it, and "Edit as query" turns the generated statement into a document.
  • Theming — bundled themes plus any theme written for Zed: drop a theme JSON into ~/.config/zql/themes/ and pick it.

Not yet: text editing in the editor buffer, the connection switcher and editor UI, and the agent panel is still a static mock.

Running it

cargo run                      # the app
cargo run --example seed       # put a connection in the store
cargo run --example query      # exercise the query layer from the terminal
cargo test                     # unit tests

Needs a checkout of zed at tag v1.9.0 in a sibling directory (../zed) — the UI is built from Zed's own ui crate. On Linux you will also need Wayland or X11 development libraries, Vulkan, and fontconfig.

Where things live

src/connection/   the connection model, validation, encrypted store
src/db/           postgres: connect, test, run queries
src/state/        shared app state as GPUI entities
src/sql/          SQL tokenizer for syntax highlighting
src/ui/           views, one file per region of the window
src/theming/      theme catalogue, install and switch
design/           the design canvas artboards (.dc.html)
design/browser/   the schema browser's own canvas

Licensing

GPL-3.0-or-later. zql links Zed's ui crate, which is GPL-3.0-or-later, so the binary inherits that license. See LICENSE.

The bundled typefaces in assets/fonts are Geist and Geist Mono, used under the SIL Open Font License 1.1.

About

A minimal psql editor and runner — GPUI desktop app with an agent panel

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages