Metadata-Version: 2.4
Name: karabo-ml
Version: 0.2.0
Summary: kb — DevOps RAG Assistant CLI. Query docs, check clusters, manage infra.
Project-URL: Homepage, https://github.com/DynamicKarabo/karabo-ml
Project-URL: Repository, https://github.com/DynamicKarabo/karabo-ml
Project-URL: Documentation, https://github.com/DynamicKarabo/karabo-ml#readme
Author-email: Karabo Oliphant <karabooliphant34@gmail.com>
License: MIT
Keywords: cli,devops,kubernetes,platform-engineering,rag
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Build Tools
Classifier: Topic :: System :: Systems Administration
Requires-Python: >=3.10
Requires-Dist: click>=8.1.0
Requires-Dist: httpx>=0.25.0
Requires-Dist: pyyaml>=6.0
Requires-Dist: rich>=13.0.0
Provides-Extra: dev
Requires-Dist: build>=1.0.0; extra == 'dev'
Requires-Dist: pytest>=8.0.0; extra == 'dev'
Requires-Dist: ruff>=0.9.0; extra == 'dev'
Provides-Extra: web
Requires-Dist: fastapi>=0.133.0; extra == 'web'
Requires-Dist: jinja2>=3.1.0; extra == 'web'
Requires-Dist: python-multipart>=0.0.9; extra == 'web'
Requires-Dist: uvicorn[standard]>=0.41.0; extra == 'web'
Description-Content-Type: text/markdown

# ── kb — Karabo ML CLI ──

**kb** is a polished CLI tool for DevOps RAG — query documentation, check cluster health, and manage your infrastructure, all from the terminal.

```
kb rag query "how to setup ArgoCD"
kb rag chat
kb drift check
kb cluster status
kb config show
```

## Quick Start

### pip install

```bash
pip install karabo-ml
kb --help
```

### Docker

```bash
docker run --rm ghcr.io/dynamickarabo/karabo-ml kb --help
```

### From source

```bash
git clone https://github.com/DynamicKarabo/karabo-ml.git
cd karabo-ml
pip install -e .
kb --help
```

## Commands

### `kb rag query` — Ask a DevOps question

```bash
kb rag query "How do I set up ArgoCD in a k3s cluster?"
kb rag query --top-k 10 --json "What is the best way to configure Prometheus?"
```

### `kb rag chat` — Interactive mode

```bash
kb rag query
# or
kb rag chat
# Then type questions interactively. /exit to quit.
```

### `kb model serve` — Start the RAG API

```bash
kb model serve                 # via docker-compose
kb model serve --build         # rebuild images first
kb model serve --profile ingest  # include ingestion
kb model stop                  # stop services
```

### `kb drift check` — System health

```bash
kb drift check                 # API + Qdrant health
kb drift collections           # list Qdrant collections
```

### `kb cluster status` — Cluster monitoring

```bash
kb cluster status              # Docker + k3s status
kb cluster status --json       # JSON output
kb cluster logs api            # view API logs
kb cluster logs qdrant --tail 200
```

### `kb config` — Configuration

```bash
kb config init                 # create ~/.kb/config.yaml
kb config show                 # view current config
kb config edit                 # open in $EDITOR
```

### `kb completions` — Shell completions

```bash
kb completions install bash    # add to ~/.bashrc
kb completions install zsh     # add to ~/.zshrc
kb completions bash            # print completions script
```

## Configuration

Config loaded from (in priority order):

1. `~/.kb/config.yaml` (defaults)
2. Environment variables (`KB_API_URL`, `KB_QDRANT_URL`, etc.)

Create your config:

```bash
kb config init
```

Example `~/.kb/config.yaml`:

```yaml
api:
  url: http://localhost:8000
  timeout: 30
qdrant:
  url: http://localhost:6333
  collection: devops_docs
logging:
  level: INFO
  file: ~/.kb/kb.log
```

## Architecture

```
┌──────────┐     ┌──────────┐     ┌──────────┐
│  kb CLI  │────▶│ RAG API  │────▶│  Qdrant  │
│ (Python) │     │ (FastAPI)│     │(Vectors) │
└──────────┘     └────┬─────┘     └──────────┘
                      │
               ┌──────▼──────┐
               │  OpenRouter │
               │   (LLM)     │
               └─────────────┘

┌──────────┐     ┌──────────┐
│ Web UI   │────▶│ RAG API  │
│(HTMX+FA) │     │ (same)   │
└──────────┘     └──────────┘
```

## Development

```bash
pip install -e ".[dev]"
ruff check src/
ruff format src/
```

## Tech Stack

| Layer | Tool |
|-------|------|
| CLI framework | Click + Rich |
| HTTP client | httpx |
| Config | PyYAML + env vars |
| Backend API | FastAPI + Qdrant |
| LLM | OpenRouter (OpenAI-compatible) |
| Web UI | FastAPI + HTMX + Jinja2 |
| Container | Docker multi-stage |
| Orchestration | Docker Compose / k3s |
| CI/CD | GitHub Actions |
| Distribution | PyPI + GHCR |
