Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions docs/v1.2.1/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# KDM CLI — Versioned Command Documentation

**Version:** v1.2.1

This directory contains versioned documentation for all KDM CLI commands. Each section documents a top-level command group with usage, parameters, examples, and troubleshooting.

## Command Index

- [show](./show/README.md) — Show running runners, pods, containers, or minikube
- [health](./health/README.md) — Show health status for pods or containers
- [watch](./watch/README.md) — Live monitoring mode
- [logs](./logs/README.md) — Show logs for a container or pod
- [config](./config/README.md) — Manage KDM configuration

## Quick Start

```bash
# Install globally
npm install -g kdm-cli

# Show all workloads
kdm show runners

# Check pod health
kdm health pods

# Live watch
kdm watch

# View logs
kdm logs <name>

# Configure notifications
kdm config setup
```

## Version History

| Version | Release Date | Notes |
|---------|-------------|-------|
| v1.2.1 | — | Current release. Docker & Kubernetes monitoring, config management. |
| v1.1.0 | — | Initial release with core commands. |
134 changes: 134 additions & 0 deletions docs/v1.2.1/config/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# `kdm config` — Configuration Management

**Version:** v1.2.1

## Overview

The `kdm config` command group manages KDM CLI configuration, including notification service setup, custom settings, and credential management. Configuration is stored locally using the `conf` package.

## Syntax

```bash
kdm config <subcommand>
```

## Sub-commands

### `kdm config setup`

Interactively sets up the notification service (Discord webhook or Email SMTP).

**Example:**

```bash
kdm config setup
```

**Interactive Flow:**

1. Select a notification service:
- **Discord** — Send alerts to a Discord channel via webhook.
- **Email (SMTP)** — Send alerts via email SMTP.
- **None** — Disable notifications.

2. For **Discord**, you will be prompted for a webhook URL.
3. For **Email**, you will be prompted for SMTP host, port, user, and recipient email.

**Discord Webhook Setup:**

1. Open your Discord server settings.
2. Go to **Integrations > Webhooks**.
3. Create a new webhook and choose the alert channel.
4. Copy the webhook URL (must start with `https://discord.com/api/webhooks/`).

**Email SMTP Setup:**

| Setting | Default | Description |
|---------|---------|-------------|
| Host | `smtp.gmail.com` | SMTP server address |
| Port | `587` | SMTP port (STARTTLS) |
| User | — | Your email address |
| To | — | Alert recipient email |

> **Note:** SMTP passwords must be set via the `KDM_SMTP_PASSWORD` environment variable.

---

### `kdm config set <key> <value>`

Sets a specific configuration value.

**Example:**

```bash
kdm config set alert_cooldown 300
kdm config set email_port 465
```

**Supported Keys:**

| Key | Type | Description |
|-----|------|-------------|
| `alert_cooldown` | number | Cooldown period between alerts (seconds) |
| `email_port` | number | SMTP port |
| `notification_service` | string | `discord`, `email`, or `none` |
| `discord_webhook` | string | Discord webhook URL |
| `email_host` | string | SMTP host |
| `email_user` | string | SMTP username |
| `email_to` | string | Alert recipient email |

---

### `kdm config list`

Lists all current configuration values.

**Example:**

```bash
kdm config list
```

**Expected Output:**

```
Current KDM Configuration:
──────────────────────────────────────────────────
notification_service : discord
discord_webhook : https://discord.com/api/webhooks/...
──────────────────────────────────────────────────

Note: SMTP passwords must be set via KDM_SMTP_PASSWORD env var.
```

---

### `kdm config clear`

Clears all configuration and resets to defaults.

**Example:**

```bash
kdm config clear
```

**Expected Output:**

```
✓ Configuration cleared.
```

## Configuration File Location

Configuration is stored in the default `conf` package location:

- **macOS:** `~/Library/Application Support/kdm-cli`
- **Linux:** `~/.config/kdm-cli`
- **Windows:** `%APPDATA%\kdm-cli`

## Common Errors

- **Invalid webhook URL** — Must match `https://discord.com/api/webhooks/<id>/<token>`.
- **Invalid email address** — Must be a valid email format.
- **Invalid port number** — Must be between 1 and 65535.
91 changes: 91 additions & 0 deletions docs/v1.2.1/health/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# `kdm health` — Health Status

**Version:** v1.2.1

## Overview

The `kdm health` command checks and reports the health status of Kubernetes pods or Docker containers. It provides insights into readiness, crash loops, and other health conditions.

## Syntax

```bash
kdm health <target>
```

## Parameters

| Parameter | Description | Valid Values |
|-----------|-------------|--------------|
| `target` | The workload type to check | `pods`, `containers`, `all` |

## Usage

### `kdm health pods`

Checks the health status of all Kubernetes pods.

**Example:**

```bash
kdm health pods
```

**Expected Output:**

```
Checking health for pods...
Showing health for pods...
```

**Health Indicators:**

- **Ready** — Pod is running and accepting traffic.
- **Unhealthy** — Pod is running but probes are failing.
- **CrashLoopBackOff** — Pod is repeatedly crashing and restarting.

**Use Cases:**

- Monitor pod health in real time.
- Identify failing services before they cause outages.

---

### `kdm health containers`

Checks the health status of all Docker containers.

**Example:**

```bash
kdm health containers
```

**Expected Output:**

```
Checking health for containers...
Showing health for containers...
```

**Use Cases:**

- Verify container health.
- Detect containers that are unhealthy or restarting.

---

### `kdm health all`

Checks health for both pods and containers in a single call.

**Example:**

```bash
kdm health all
```

## Common Errors

- **Invalid target** — Use `pods`, `containers`, or `all`.
- **Docker daemon not running** — Start Docker before running `kdm health containers`.
- **Kubernetes context not found** — Run `kubectl config get-contexts` to verify your cluster connection.
52 changes: 52 additions & 0 deletions docs/v1.2.1/logs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# `kdm logs` — Show Logs

**Version:** v1.2.1

## Overview

The `kdm logs` command retrieves and displays logs from a specified Docker container or Kubernetes pod. This is useful for debugging application issues and reviewing runtime events.

## Syntax

```bash
kdm logs <name>
```

## Parameters

| Parameter | Description |
|-----------|-------------|
| `name` | The name of the container or pod to fetch logs from |

## Usage

### `kdm logs <name>`

Fetches and displays logs for the specified workload.

**Example:**

```bash
kdm logs nginx-abc12
```

**Expected Output:**

```
Fetching logs for nginx-abc12...
Logs for nginx-abc12 fetched
[timestamp] GET / 200 12ms
[timestamp] GET /favicon.ico 404 2ms
```

**Use Cases:**

- Debug application errors by reviewing container/pod logs.
- Monitor application events in real time.
- Investigate crash or restart causes.

## Common Errors

- **Name not found** — Verify the container or pod name using `kdm show containers` or `kdm show pods`.
- **Docker daemon not running** — Start Docker before fetching container logs.
- **Kubernetes context not found** — Ensure `kubectl` is configured with a valid cluster context.
Loading
Loading