Skip to content

About

Stoolap tern plugin

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

stoolap-tern

A database client for Stoolap that runs in a Tern pane. The engine is linked in as a crate, so there is no server and no driver, and the interface is drawn natively over the Tern Surface Protocol from Tern's own kinds: no stylesheet, light and dark from the user's theme. Outside Tern the same binary prints plain text.

It follows Stoolap Desktop: the same script and transaction rules, the same dump format, the same filters and the same SQL from its dialogs.

Install

Rust 1.88 or newer:

cargo install --git https://github.com/stoolap/stoolap-tern
tern plugin install github.com/stoolap/stoolap-tern/plugin

The plugin is optional: it adds palette commands that open a tab running stoolap-tern (New Stoolap Database…, New In-Memory Stoolap Database, Open Stoolap Database…, Open Stoolap Database Read-Only…, Open Recent Stoolap Database) and an Open in Stoolap button in the Files pane.

The SQL agent needs Claude Code installed and signed in; everything else works without it.

Use

stoolap-tern ./mydb                 # a folder, created when missing
stoolap-tern file:///var/lib/app/db
stoolap-tern memory://
stoolap-tern --read-only ./mydb     # only SELECT, SHOW, DESCRIBE and EXPLAIN run
stoolap-tern -e "SELECT 1" ./mydb   # run SQL first; outside Tern, print the result

What it does

  • Schema sidebar: tables and views with row counts and a filter (/); the selected table's columns, marked by type, with their keys and defaults, and its indexes and foreign keys as a tree; a right-click menu per table for its data, SELECT *, its DDL, vector search, inserting a row, an INSERT template, a new index, editing the table, import, export, truncate and drop, and per index a query that uses it (a k-NN query for HNSW) or dropping it.
  • Query tabs: a SQL editor with native editing; ctrl+enter runs, ctrl+shift+enter runs the statement at the caret, ctrl+e explains. A script shows every statement's result and stops at the first error; its writes run in one transaction that a failure rolls back, unless you opened one with BEGIN, which stays open across runs (a badge says so, Commit and Roll back end it). Plans draw as a tree. A per-tab history, a query timeout, open and save .sql files.
  • Data tabs: pages of a table with server-side sort, filters (=, !=, <, >, LIKE, IN, IS NULL, vector distance) and time travel with AS OF TIMESTAMP; the selected row's card shows every value, JSON as a tree, a vector as a chart, foreign keys to follow and Find similar for vectors; insert, edit and delete rows, several at once.
  • Dialogs: new and edit table (types, keys, auto increment, NOT NULL, UNIQUE, CHECK, DEFAULT, foreign keys with their actions, the next id), new index (B-tree or HNSW with its parameters), new view, vector search, CSV and JSON export and import, and SQL backup and restore; each shows the SQL it will run.
  • SQL agent (ctrl+l): your own Claude Code, with its built-in tools off and only the database's: it reads the schema and the bundled Stoolap documentation, checks queries in transactions it rolls back, and writes SQL into a query tab, where reads run at once and writes wait for you unless you allow them. Pick the model in the panel; enter sends, shift+enter adds a line. Fix with agent on a failed run.

Read-only is enforced by the app, not the engine: every statement is parsed first, and only reads run. Stoolap opens a database for one process at a time, so a database another program holds open fails to open here.

Keys

Key Does
ctrl+enter Run the query tab
ctrl+shift+enter Run the statement at the caret
ctrl+e Explain
ctrl+t, ctrl+w New tab, close tab
tab, ], [ Next and previous tab
ctrl+o, ctrl+s Open and save a SQL file
ctrl+l SQL agent
ctrl+b Sidebar
/ Find a table
o Open the sidebar's table
e Edit the query
j, k Move the selected row
enter Edit the selected row
i, x Insert a row, delete the selected or picked rows
f Filters
n, p Next and previous page
s Rows similar to the row's vector
r Refresh
esc Leave a field, close a dialog, quit
? Every key

License

Apache-2.0

About

Stoolap tern plugin

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages