Skip to content
juanhuanacoPublic

About

A lightweight AI-powered Go CLI that analyzes SQL code. Built as a hands-on learning project. 🛠️

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

KaizenSQL (kzql) 🚀

An AI-powered Go CLI that analyzes SQL. Provides Socratic guidance for query optimization—craftsmanship-driven and lightweight.

kzql banner


🛠️ Philosophy & Motivation

KaizenSQL (kzql) was built as an exploration project focused on crafting a simple idea and enjoying the process of building.

The goal wasn't to build disruptive SQL tooling, lol. I was finishing my work hours when an idea for a CLI tool - one that reads a file and uses an AI LLM agent to diagnose it - invaded my head haha.

This project served as a playground to explore and use:

  • TUI Animation: Building clean startup visuals using the Charm (bubbletea) ecosystem.
  • Unix-Native CLI: Managing explicit errors, API configuration persistence, and clean execution paths in Go.

To read the full journey behind the engineering friction and lessons learned:
👉 Read the technical story on Dev.to


✨ Features

  • Socratic Mentor Mode: Focused System Prompts designed to guide you through SQL bottlenecks without acting as a black-box query writer.
  • Animated ASCII Banner: Smooth startup splash screen built with bubbletea.
  • Zero-Dependency Core: Simple, standalone Go binary for Linux.
  • Unix-Native: Reads files directly, outputs errors to os.Stderr, saves config to standard directories, and respects shell exit codes.

⚙️ Setup

On your first execution, kzql will ask for your Groq API key and save it in your user configuration directory (on Unix/Linux systems, that's typically ~/.config/). It will display the exact path after saving.

kzql_configsave.png

Groq is an LLM provider similar to Gemini or OpenAI. It's used in this project for its generous free-tier token limits. I encourage you to try it in your own projects as well, bud. 😉


🚀 Usage

Mode Flag Key Analysis Points Primary Output
Mentor (Default) -m B-Tree index traversal, data page reads, and physical execution paths No code rewrites. Provides Socratic questions & conceptual hints.
Performance -p Non-SARGable predicates, leading wildcards, SELECT * waste, and implicit type conversions High-level cost diagnostic + fully optimized query rewrite.
Security -s SQL injection risks, unconstrained UPDATE/DELETE statements, and missing atomic blocks Threat level rating + parameterized, hardened SQL block.

📦 Installation

Check the Releases section for Linux binaries and installation steps.

This project currently targets Linux (I'm not wealthy enough to afford a Mac, haha). However, you're more than welcome to clone the repository and compile it for your own OS, that's the perk of being a dev!

Thanks ❤️

Special thanks to the people on the open-source world, it was a fun dev experience to work with their great software.

  • Go-OpenAI by sashabaranov - Used for communicating with Groq API
  • Bubbletea by charmbracelet - Text User Interface framework used to add a nice banner.
  • Ascii Motion by CameronFoxly - Awesome ascii-art animation software

About

A lightweight AI-powered Go CLI that analyzes SQL code. Built as a hands-on learning project. 🛠️

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages