8000 GitHub - rexadbapp/rek: CLI for Supabase's splinter database linter — scans Postgres/Supabase for security & performance issues and hands a fix prompt to your AI coding agent (Claude Code, Codex, opencode, Cursor…). · GitHub
[go: up one dir, main page]

Skip to content
rexadbappPublic

About

CLI for Supabase's splinter database linter — scans Postgres/Supabase for security & performance issues and hands a fix prompt to your AI coding agent (Claude Code, Codex, opencode, Cursor…).

Resources

Stars

3 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rek

A command-line wrapper around Supabase's splinter database linter. rek scans your Postgres/Supabase database for security and performance issues, prints them, and then generates a fix prompt you can copy or open directly in an installed AI coding agent — with exact commands.

$ rek scan
 ERROR  RLS Disabled in Public (rls_disabled_in_public)
    Table `public.profiles` is public, but RLS has not been enabled.
    SECURITY  ·  https://supabase.com/docs/guides/database/database-linter?lint=0013_...

 WARN   Function Search Path Mutable (function_search_path_mutable)
    Function `public.handle_new_user` has a role mutable search_path.
 ...
────────────────────────────────────────────────
3 issue(s): 1 error  1 warn  1 info

What next?            ↑/↓ move · enter select · q cancel
❯ Copy fix prompt to clipboard
  Open in Claude Code
  Open in Codex CLI
  Open in opencode

Install

# install script (macOS/Linux) — downloads the right binary, no Go/brew needed
curl -fsSL https://raw.githubusercontent.com/rexadbapp/rek/main/scripts/install.sh | sh

# Homebrew
brew install rexadbapp/tap/rek

# or build from source (Go 1.25+)
go install github.com/rexadbapp/rek@latest

# or download a binary from the Releases page

Keep it current with rek update (or brew upgrade rek for Homebrew installs).

Quick start

# 1. Point it at your database (saved & verified for future runs)
rek connect "postgresql://postgres:[PASSWORD]@db.[REF].supabase.co:5432/postgres"

# 2. Scan and act on the findings
rek scan

No connect needed if you pass --db, set $SUPABASE_DB_URL / $DATABASE_URL, or run inside a linked local Supabase project.

Tip: try rek scan --demo to see the whole flow with sample findings — no database required.

Commands

rek scan

Runs the lints, prints findings, then offers actions on a generated fix prompt.

Flag Description
--db <url> Connection string (overrides env/saved config)
--use <name|local|env> Pick a source without the chooser prompt
--bundled Use the lint query embedded in this binary instead of fetching the latest
--level error,warn,info Only show these severities
--category security|performance Only show one category
--json Output findings as JSON and exit
--copy Copy the fix prompt to the clipboard and exit
--open <id> Open the prompt in a harness (claude, codex, …) or all to print every command
--save <path> Write the fix prompt to a file
--print-prompt Print the fix prompt to stdout and exit
--no-prompt Only report findings; skip the fix step
-y, --yes Non-interactive (defaults to copying the prompt)
--demo Use built-in sample findings (no database)

rek connect

Save one or more named connections (each is tested before saving):

rek connect "<CONNECTION_STRING>"          # saves as "default"
rek connect prod "<CONNECTION_STRING>"     # saves as "prod"
rek connect staging "<CONNECTION_STRING>"  # saves as "staging"
rek connect --list                         # list all (passwords redacted, * = default)
rek connect --default prod                 # set the default
rek connect --clear staging                # remove one
rek connect --clear                        # remove all

Saved to ~/.config/rek/config.json with 0600 permissions.

rek harnesses

Lists every supported AI agent and whether it's installed (detected via PATH).

rek update

Updates rek to the latest release (in-place binary swap; falls back to brew upgrade rek for Homebrew installs). rek also checks for a newer release at most once a day and prints a notice; disable with --no-update-check.

How the database connection is resolved

rek scan gathers every available source. When more than one exists, it asks which to scan (arrow keys + Enter); with a single source it just uses it.

Priority (used to skip the prompt with --db, and as the fallback in non-interactive runs like --json, -y, or no TTY):

  1. --db <url> — explicit, always wins
  2. $SUPABASE_DB_URL, then $DATABASE_URL
  3. A linked Supabase project — a supabase/config.toml in the working directory or an ancestor (uses supabase status when the local stack is running)
  4. Saved connections (rek connect), default first

Pick a source without the menu using --use:

rek scan --use prod      # a saved connection by name
rek scan --use local     # the detected linked Supabase project
rek scan --use env       # $SUPABASE_DB_URL / $DATABASE_URL
rek scan --use saved     # the default saved connection

Supported AI harnesses

Only the ones actually installed on your machine are offered. Each opens the agent's real interactive terminal UI (not a headless/one-shot mode), seeded with the fix prompt where the CLI supports it. Adding a new one is a single entry in internal/harness/harness.go.

id Tool Launch (interactive)
claude Claude Code claude "<prompt>"
codex Codex CLI codex "<prompt>"
gemini Gemini CLI gemini -i "<prompt>"
opencode opencode opencode --prompt "<prompt>"
aider Aider aider (prompt copied to clipboard to paste in)
cursor Cursor opens the saved prompt file
kilo Kilo Code opens the saved prompt file

Where the lints come from

By default scan fetches the latest splinter.sql from upstream and falls back to the bundled copy if offline. Use --bundled to force the embedded copy for fully offline / reproducible runs. The lint query is read-only and runs inside a transaction that is always rolled back.

The linter targets Supabase databases (it references Supabase roles such as anon/authenticated). Running it against a vanilla Postgres without those roles will error.

Project layout

cmd/                 cobra commands (scan, connect, harnesses, update)
internal/
  db/                connect + run the lint SQL into findings
  lints/             embedded splinter.sql + "fetch latest"
  config/            saved connections + connection resolution
  harness/           AI-agent registry, detection, command building
  promptgen/         build the AI fix prompt
  report/            terminal rendering
  clipboard/         cross-platform clipboard
  selfupdate/        GitHub-release check + in-place self-update
  scan/              orchestration + filters + demo findings
  ui/                interactive arrow-key selector
scripts/             install.sh (curl | sh) + release.sh (build + publish)

Development

make build     # -> bin/rek
make test
make run       # demo scan
make release   # VERSION=0.1.0 — build binaries, publish a GitHub release, bump the tap

License

MIT. splinter (the lint queries) is © Supabase and distributed under its own license.

About

CLI for Supabase's splinter database linter — scans Postgres/Supabase for security & performance issues and hands a fix prompt to your AI coding agent (Claude Code, Codex, opencode, Cursor…).

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0