A fast, terminal-native, LLM-first database companion written in Rust.
Chat with your Postgres database using natural language.
🚧 v0.1 Development — Core features implemented, testing in progress.
- Natural language queries — Ask questions, get SQL + results
- Auto-execute reads — SELECT queries run automatically
- Confirm writes — Mutations require explicit approval
- Schema-aware — LLM knows your tables and relationships
- Fast — Rust-native, instant startup, minimal footprint
- Rust 1.75+ (install)
- PostgreSQL 12+
- OpenAI or Anthropic API key
git clone https://github.com/SFerenczy/glance.git
cd glance
cargo build --releaseThe binary will be at target/release/glance.
export OPENAI_API_KEY=sk-...
# or
export ANTHROPIC_API_KEY=sk-ant-...# Using connection string
glance "postgres://user:password@localhost:5432/mydb"
# Using arguments
glance --host localhost --database mydb --user postgres --password> How many orders were placed this week?
Glance generates SQL, executes it safely, and displays results.
> Show me all users who signed up this month
> What's the average order value by customer?
> /sql SELECT COUNT(*) FROM orders WHERE status = 'pending'
> /schema
> /help
Create ~/.config/db-glance/config.toml:
[llm]
provider = "openai"
model = "gpt-5"
[connections.default]
host = "localhost"
port = 5432
database = "mydb"
user = "postgres"Then just run glance with no arguments.
- Usage Guide — Complete user guide with examples
- Testing Guide — Manual test cases and verification
- Development Guide — Setting up your dev environment
- Architecture — Technical design
- Tech Stack — Crate selections
- Implementation Plan — Development phases
- Vision — Product vision and positioning
- Roadmap — Feature milestones
- v0.1 Specification — Detailed requirements
Glance supports headless mode for AI-assisted testing and automation. Run without a terminal UI, execute scripted events, and capture output for verification.
# Run with inline events
glance --headless --mock-db --events "type:hello,key:enter"
# Run with script file
glance --headless --mock-db --script tests/tui/fixtures/basic_flow.txt
# JSON output for programmatic analysis
glance --headless --mock-db --events "type:test" --output json
# Frame-by-frame debugging
glance --headless --mock-db --events "type:a,type:b" --output frames| Event | Example | Description |
|---|---|---|
key: |
key:enter, key:ctrl+c |
Key press with optional modifiers |
type: |
type:hello world |
Type text into input |
wait: |
wait:100ms, wait:2s |
Wait for duration |
resize: |
resize:120x40 |
Resize terminal |
assert:contains: |
assert:contains:hello |
Assert screen contains text |
assert:state: |
assert:state:focus=Input |
Assert application state |
| Code | Meaning |
|---|---|
| 0 | Success (all assertions passed) |
| 1 | Test failure (assertions failed) |
| 2 | Error (invalid syntax, etc.) |
See v0.2e Specification for complete documentation.
# Start test database
just db
# Run all tests
just test
# Run with test database
just dev
# Format and lint
just checkSee Development Guide for full setup instructions.
| Key | Action |
|---|---|
| Enter | Submit input |
| Ctrl+C/Q | Exit |
| Ctrl+L | Clear chat |
| Tab | Switch panel focus |
| ↑/↓ | Scroll / navigate |
| Esc | Cancel / close modal |
MIT