An open API service indexing awesome lists of open source software.

https://github.com/aygp-dr/gemini-repl-001

Simple REPL interface for Gemini API in ClojureScript with formal specifications, literate programming, and self-hosting capabilities
https://github.com/aygp-dr/gemini-repl-001

alloy clojurescript formal-methods gemini-api literate-programming repl shadow-cljs tla-plus

Last synced: 5 months ago
JSON representation

Simple REPL interface for Gemini API in ClojureScript with formal specifications, literate programming, and self-hosting capabilities

Awesome Lists containing this project

README

          

#+TITLE: Gemini REPL
#+AUTHOR: jwalsh
#+DATE: 2025-07-14

* Gemini REPL

[[https://github.com/aygp-dr/gemini-repl-001/blob/main/LICENSE][file:https://img.shields.io/badge/License-MIT-yellow.svg]]
[[https://github.com/aygp-dr/gemini-repl-001/actions/workflows/ci.yml][file:https://github.com/aygp-dr/gemini-repl-001/actions/workflows/ci.yml/badge.svg]]
[[https://clojurescript.org][file:https://img.shields.io/badge/ClojureScript-Shadow--CLJS-blue.svg]]
[[https://github.com/tlaplus][file:https://img.shields.io/badge/Formal-TLA%2B-purple.svg]]
[[https://alloytools.org][file:https://img.shields.io/badge/Formal-Alloy-green.svg]]

A simple console application in ClojureScript that provides a REPL-like interface for interacting with the Gemini API, featuring formal specifications, literate programming, and self-hosting capabilities.

** Features

*** Current Features
- Interactive REPL interface with slash commands
- Conversation context maintained across interactions
- Compact metadata display with token counts and costs
- Real-time confidence indicators (🟒 🟑 πŸ”΄)
- Structured JSON logging (FIFO and file)
- Live reload development mode
- Formal methods specifications (TLA+ and Alloy)
- Comprehensive test infrastructure with expect
- ASCII art banner on startup
- Environment variable configuration

*** Configuration
Configure behavior via environment variables in =.env=:
- =GEMINI_API_KEY= - Your Gemini API key (required)
- =GEMINI_LOG_ENABLED= - Enable logging (true/false)
- =GEMINI_LOG_TYPE= - Log destination (fifo/file/both)
- =GEMINI_LOG_FILE= - Log file path
- =GEMINI_LOG_FIFO= - FIFO path for real-time monitoring

** Getting Started

1. Clone the repository:
#+BEGIN_SRC bash
git clone https://github.com/aygp-dr/gemini-repl-001.git
cd gemini-repl-001
#+END_SRC

2. Set up environment:
#+BEGIN_SRC bash
cp .env.example .env
# Edit .env and add your GEMINI_API_KEY
#+END_SRC

3. Install dependencies:
#+BEGIN_SRC bash
npm install
#+END_SRC

4. Run the REPL:
#+BEGIN_SRC bash
make run
# or
npm run build && node target/main.js
#+END_SRC

** Commands

- =/help= - Show available commands
- =/exit= - Exit the REPL
- =/clear= - Clear the screen
- =/stats= - Show session statistics

** Development

*** Building
#+BEGIN_SRC bash
make build
#+END_SRC

*** Testing
#+BEGIN_SRC bash
make test
#+END_SRC

*** Linting
#+BEGIN_SRC bash
make lint
#+END_SRC

*** Development Mode
#+BEGIN_SRC bash
make dev
#+END_SRC

** Project Structure

- =src/= - ClojureScript source code
- =specs/= - Formal specifications (TLA+ and Alloy)
- =tests/= - Test files
- =.claude/commands/= - AI assistant command definitions
- =.github/= - GitHub workflows and templates

** Contributing

Please see our contributing guidelines and use the GitHub issue templates for:
- Bug reports
- Feature requests
- RFCs (Request for Comments)

** UI Example

#+BEGIN_EXAMPLE
┏━╸┏━╸┏┳┓╻┏┓╻╻ ┏━┓┏━╸┏━┓╻
┃╺┓┣╸ ┃┃┃┃┃┗┫┃ ┣┳┛┣╸ ┣━┛┃
┗━┛┗━╸╹ β•Ήβ•Ήβ•Ή β•Ήβ•Ή ╹┗╸┗━╸╹ ┗━╸
Type /help for commands, /exit to quit.

> What is the capital of France?

Gemini: The capital of France is Paris.
[🟒 245 tokens | $0.0001 | 0.8s]

> What is its population?

Gemini: The population of Paris is approximately 2.1 million people within
the city proper, and over 12 million in the greater Paris metropolitan area.
[🟒 312 tokens | $0.0002 | 0.9s]

> /stats

Session Statistics:
Total requests: 2
Total tokens: 557
Session time: 2 minutes

> /help

Gemini REPL Commands:
/help - Show this help message
/exit - Exit the REPL
/clear - Clear the screen
/stats - Show session statistics
/context - Show conversation context

> /exit
Goodbye!
#+END_EXAMPLE

** License

MIT License - see LICENSE file for details