Metadata-Version: 2.4
Name: aicademy
Version: 0.1.1
Summary: Aicademy Practice CLI — solve Kubernetes exam scenarios locally with KIND
Project-URL: Homepage, https://aicademy.ac/practice
Project-URL: Repository, https://github.com/devcrypted/aicademy-cli
Project-URL: Issues, https://github.com/devcrypted/aicademy-cli/issues
Author-email: Aicademy <info@aicademy.ac>
License: MIT
Keywords: cka,ckad,cks,cli,devops,kubernetes,practice
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Education
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Education
Classifier: Topic :: System :: Systems Administration
Requires-Python: >=3.9
Requires-Dist: httpx>=0.28.1
Requires-Dist: rich>=15.0.0
Requires-Dist: typer
Description-Content-Type: text/markdown

# Aicademy CLI

> Practice CKA, CKAD, and CKS exam scenarios locally — powered by KIND + Aicademy API.

[![PyPI](https://img.shields.io/pypi/v/aicademy)](https://pypi.org/project/aicademy/)
[![Python](https://img.shields.io/pypi/pyversions/aicademy)](https://pypi.org/project/aicademy/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)

## Installation

### Using pip

```bash
pip install aicademy
```

### Using uv (recommended)

```bash
uv tool install aicademy
```

### Using pipx

```bash
pipx install aicademy
```

## Quick Start

```bash
# 1. Login to Aicademy
aicademy login

# 2. Check / install prerequisites
aicademy install-tool all --check
aicademy install-tool all

# 3. Start a practice question (creates KIND cluster automatically)
aicademy question start cka-01

# 4. Read the full task instructions in your terminal
aicademy question instructions

# 5. Solve the scenario using kubectl, helm, etc.

# 6. Verify your solution
aicademy verify

# 7. Clean up the cluster
aicademy question clear
```

## Command Reference

| Command                                     | Description                                       |
| ------------------------------------------- | ------------------------------------------------- |
| `aicademy login`                            | Authenticate (browser flow or direct token)       |
| `aicademy logout`                           | Clear stored credentials                          |
| `aicademy auth whoami`                      | Verify token validity                             |
| `aicademy question start <id>`              | Start question environment (creates KIND cluster) |
| `aicademy question instructions [id]`       | Show full task instructions in terminal           |
| `aicademy question instructions [id] --web` | Open question page in browser                     |
| `aicademy question clear [id]`              | Delete KIND cluster and clear session             |
| `aicademy verify [id]`                      | Run verify.sh and report result                   |
| `aicademy install-tool <name>`              | Install kubectl / kind / docker / all             |
| `aicademy install-tool <name> --check`      | Check if tool is installed (no install)           |
| `aicademy install-tool <name> --dry-run`    | Preview install commands                          |

## Prerequisites

| Tool    | Purpose           | Install                         |
| ------- | ----------------- | ------------------------------- |
| Docker  | Runs KIND nodes   | `aicademy install-tool docker`  |
| kubectl | Kubernetes CLI    | `aicademy install-tool kubectl` |
| kind    | Local K8s cluster | `aicademy install-tool kind`    |

## OS Support

| OS      | Package Manager        |
| ---------| ------------------------|
| Windows | winget                 |
| macOS   | Homebrew               |
| Linux   | Official shell scripts |

## Categories

| Exam                                       | Slug   | Questions | Free |
| --------------------------------------------| --------| -----------| ------|
| Certified Kubernetes Administrator         | `cka`  | 20        | 10   |
| Certified Kubernetes Application Developer | `ckad` | 20        | 10   |
| Certified Kubernetes Security Specialist   | `cks`  | 20        | 10   |

## Development

### Project Structure

The codebase is organized modularly:

- `aicademy_cli/main.py`: The entry point and top-level Typer application.
- `aicademy_cli/commands/`: All user-facing Typer CLI groups (`auth`, `question`, `tools`, `verify`).
- `aicademy_cli/api.py`: Centralized HTTP requests and error handling.
- `aicademy_cli/core/`: Internal logic like cluster management (`kind.py`) and helper methods (`utils.py`).

### Using uv

```bash
# Clone and install in dev mode
git clone https://github.com/devcrypted/aicademy-cli
cd aicademy-cli
uv sync

# Run against local dev server
AICADEMY_API_URL=http://localhost:5173 uv run aicademy login

# Run tests
uv run pytest

# Lint
uv run ruff check .
uv run mypy aicademy_cli/
```

### Building the wheel

```bash
# Build wheel + sdist
uv build

# Output will be in dist/
ls dist/
# aicademy-0.1.0-py3-none-any.whl
# aicademy-0.1.0.tar.gz
```

### Publishing to PyPI

```bash
# Test on TestPyPI first
uv publish --index testpypi

# Publish to production PyPI
uv publish
```

## Security

- CLI tokens stored in `~/.aicademy/config.json`
- Tokens expire after 7 days — run `aicademy login` to renew
- Question tasks and scenarios only delivered when you have an active session (anti-scraping)
- Revoke all tokens with `aicademy logout`

## License

MIT © [Aicademy](https://www.aicademy.ac)
