Sitelet https://github.com/Hrithik5/kb-cli
Skip to content

Latest commit

Β 

History

20 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

kb Banner

kb

⚑ Lightning-fast offline knowledge engine for developers.

Store commands, snippets, SQL queries, troubleshooting notes, and engineering knowledge in a local SQLite database with blazing-fast Full-Text Search.

Python License CI SQLite Platform Offline CLI


🎬 Demo

kb demo


Why kb?

Every developer builds a personal knowledge base over time.

Git commands.

Docker snippets.

SQL queries.

Terraform modules.

AWS CLI commands.

Kubernetes manifests.

Debugging notes.

Configuration snippets.

Unfortunately, that knowledge usually ends up scattered across multiple places:

  • Markdown files
  • Notion
  • Obsidian
  • Browser bookmarks
  • GitHub Gists
  • Terminal history
  • Sticky notes

Finding something later often means opening multiple files and repeatedly pressing Ctrl + F.

kb replaces that workflow with a fast, offline knowledge engine powered by SQLite FTS5, giving you instant full-text search across everything you've saved.

No cloud. No subscriptions. Just your knowledge, indexed locally.

✨ Features

kb is designed to be a fast, keyboard-first knowledge engine that lives entirely on your machine.

Feature Description
⚑ SQLite FTS5 Search Lightning-fast full-text search across all knowledge
🏷 Categories & Tags Organize snippets by category and searchable tags
⭐ Favorites Mark frequently used snippets for quick access
πŸ” Interactive Fuzzy Search Browse your knowledge base with an fzf powered interface
πŸ–₯ Interactive Shell Persistent history, tab completion, aliases and REPL mode
πŸ“‹ Clipboard Support Copy snippets directly to your clipboard
πŸ“‚ Import & Export Import Markdown/TXT and export to Markdown or JSON
πŸ“Š Statistics View usage statistics and most accessed snippets
🎨 Rich Terminal Output Colorized output for a better CLI experience
πŸ’Ύ Offline First No cloud account, internet connection or external services required
🐧 Cross Platform Works on macOS and Linux

πŸš€ Installation

Requirements

  • Python 3.10+
  • SQLite (included with Python)
  • fzf (optional but recommended for the interactive search interface)

Install from PyPI

pip install kb-cli

Verify the installation

kb --version

Example output

kb version 0.2.0

Optional Dependencies

Install fzf

macOS

brew install fzf

Ubuntu / Debian

sudo apt install fzf

Install bat (Recommended)

bat provides syntax highlighted previews inside the interactive search interface.

macOS

brew install bat

Ubuntu / Debian

sudo apt install bat

Homebrew

🚧 Homebrew support is planned for a future release.


⚑ Quick Start

Initialize your local knowledge database

kb init

Save your first snippet

kb add git "git status" \
    -t "Git Status" \
    --tags git,status

Search your knowledge

kb find git

Browse everything interactively

kb fzf

Launch the interactive shell

kb

View statistics

kb stats

You're ready to start building your personal offline knowledge base.

πŸ“– Command Reference

Command Description
kb init Initialize the local knowledge database
kb add Add a new knowledge entry
kb list List stored entries
kb find Perform full-text search using SQLite FTS5
kb get Retrieve a snippet by ID
kb edit Edit an existing entry
kb delete Delete an entry
kb favorite Mark or unmark an entry as a favorite
kb recent Show recently accessed entries
kb stats Display database statistics
kb import Import Markdown or TXT files
kb export Export the knowledge base to Markdown or JSON
kb copy Copy a snippet directly to the clipboard
kb fzf Launch the interactive fuzzy finder

πŸ’‘ Usage Examples

Git

Save a useful Git command

kb add git \
"git rebase -i HEAD~3" \
-t "Interactive Rebase" \
--tags git,rebase

Search it later

kb find rebase

Docker

Store Docker Compose commands

kb add docker \
"docker compose up -d" \
-t "Start Containers" \
--tags docker,compose

SQL

Save frequently used SQL queries

kb add sql \
"SELECT * FROM users WHERE active = TRUE;" \
-t "Active Users" \
--tags postgres,sql

AWS CLI

Save AWS commands

kb add aws \
"aws s3 sync ./dist s3://my-bucket" \
-t "Upload Build Artifacts"

Kubernetes

Store kubectl commands

kb add kubernetes \
"kubectl logs deployment/api -f" \
-t "Follow Deployment Logs"

Terraform

Save infrastructure commands

kb add terraform \
"terraform state list" \
-t "List Terraform Resources"

Search Across Everything

SQLite FTS5 searches titles, content and tags.

kb find terraform

kb find docker compose

kb find postgres

kb find eks

Browse Interactively

Launch the interactive fuzzy finder

kb fzf

Features include:

  • Live fuzzy filtering
  • Instant preview
  • Clipboard copy
  • Keyboard-first workflow
  • tmux popup support
  • Optional syntax-highlighted previews with bat

Interactive Shell

Launch the built-in REPL

kb

Example session

kb ❯ add
kb ❯ find docker
kb ❯ get 12
kb ❯ favorite 12
kb ❯ recent
kb ❯ stats
kb ❯ exit

The interactive shell supports:

  • Persistent command history
  • Tab completion
  • Command aliases
  • Colored prompt
  • Keyboard-first workflow

Export Your Knowledge

Export everything as Markdown

kb export markdown notes.md

Export as JSON

kb export json knowledge.json

Import Existing Notes

Import a Markdown document

kb import notes.md

Import a plain text file

kb import commands.txt

πŸ— Project Architecture

kb follows a simple layered architecture to keep the codebase modular, maintainable, and easy to extend.

                    User
                     β”‚
                     β–Ό
              kb CLI Interface
                     β”‚
                     β–Ό
          Command Layer (CLI Commands)
                     β”‚
                     β–Ό
             Service / Business Logic
                     β”‚
                     β–Ό
             Repository (SQLite)
                     β”‚
                     β–Ό
           SQLite Database (FTS5)
                     β”‚
                     β–Ό
              Local File System

Project Structure

kb-cli/
β”œβ”€β”€ kb/
β”‚   β”œβ”€β”€ commands/          # CLI commands
β”‚   β”œβ”€β”€ repositories/      # SQLite queries
β”‚   β”œβ”€β”€ services/          # Business logic
β”‚   β”œβ”€β”€ models/            # Data models
β”‚   β”œβ”€β”€ utils/             # Helpers & formatting
β”‚   β”œβ”€β”€ shell.py           # Interactive shell
β”‚   β”œβ”€β”€ shell_commands.py  # Interactive shell commands
β”‚   β”œβ”€β”€ database.py
β”‚   β”œβ”€β”€ config.py
β”‚   └── cli.py
β”‚
β”œβ”€β”€ tests/
β”œβ”€β”€ assets/
β”œβ”€β”€ README.md
β”œβ”€β”€ pyproject.toml
└── LICENSE

βš™οΈ Tech Stack

Component Technology
Language Python 3.10+
Database SQLite
Search Engine SQLite FTS5
Interactive Search fzf
Syntax Highlighting bat (optional)
Testing Pytest
Linting Ruff
Packaging setuptools
CI/CD GitHub Actions

πŸš€ Roadmap

βœ… v0.2.0

  • SQLite FTS5 Full-Text Search
  • Interactive Shell
  • Interactive Fuzzy Search (fzf)
  • Clipboard Support
  • Rich Terminal Output
  • Categories & Tags
  • Favorites
  • Import / Export
  • Usage Statistics
  • Shell Completion
  • PyPI Package
  • GitHub Actions CI

πŸ”œ Planned Features

v0.3

  • Homebrew Installation
  • Search Result Highlighting
  • Rich Metadata Preview
  • Multi-select in fzf
  • YAML Import / Export
  • Config Profiles

Future Ideas

  • Plugin System
  • Encrypted Database
  • Optional Cloud Sync
  • Custom Themes
  • AI-assisted Search

🀝 Contributing

Contributions are welcome!

If you'd like to improve kb, follow these steps:

git clone https://github.com/Hrithik5/kb-cli.git

cd kb-cli

pip install -e .

ruff check .

pytest

Before opening a Pull Request, please ensure:

  • Code is formatted
  • Ruff passes without errors
  • All tests pass
  • New features include tests where appropriate

Bug reports, feature requests, and pull requests are always appreciated.


πŸ“ Changelog

See the full project history in CHANGELOG.md.


πŸ“„ License

This project is licensed under the MIT License.

See the LICENSE file for details.


⭐ Support the Project

If you find kb useful, consider giving the repository a ⭐ on GitHub.

It helps others discover the project and motivates future development.


Built for developers who believe great tools should be fast, local, and simple.

About

Fast offline SQLite-powered developer knowledge base.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages