|
1 | 1 | --- |
2 | 2 | name: kool |
3 | | -description: Discovers and runs project scripts with the kool CLI. Use when the user wants to list custom commands from kool.yml, understand project tasks, or run kool scripts. Use --json flag for machine-readable output. |
| 3 | +description: Docker development environment CLI. Use for managing containers (start/stop/restart), executing commands in services, viewing logs, and running project scripts from kool.yml. |
4 | 4 | --- |
5 | 5 |
|
6 | 6 | # Kool CLI |
7 | 7 |
|
8 | | -Use kool to discover and run project scripts defined in `kool.yml`. |
| 8 | +Kool simplifies Docker-based development with commands for container lifecycle, service execution, and custom scripts. |
9 | 9 |
|
10 | | -## Quick Start |
| 10 | +## Quick Reference |
11 | 11 |
|
12 | 12 | ```bash |
13 | | -kool run --json # List scripts as JSON |
14 | | -kool run <script> # Run a script |
| 13 | +kool start # Start all services from docker-compose.yml |
| 14 | +kool stop # Stop all services |
| 15 | +kool restart --rebuild # Restart and rebuild images |
| 16 | +kool status # Show running containers |
| 17 | +kool exec <service> <cmd> # Run command in service container |
| 18 | +kool logs -f <service> # Follow service logs |
| 19 | +kool run --json # List available scripts as JSON |
| 20 | +kool run <script> # Run a script from kool.yml |
15 | 21 | ``` |
16 | 22 |
|
17 | | -## Core Workflow |
| 23 | +## Service Lifecycle |
18 | 24 |
|
19 | | -1. Work from the project root (has `kool.yml`) or use `-w` to point to it. |
20 | | -2. Discover scripts: |
| 25 | +Services are defined in `docker-compose.yml`. Kool wraps docker-compose with simpler commands. |
21 | 26 |
|
22 | 27 | ```bash |
23 | | -kool run --json # Preferred: returns [{name, comments, commands}] |
24 | | -kool run # Human-readable list |
| 28 | +kool start # Start all services |
| 29 | +kool start app database # Start specific services |
| 30 | +kool start --rebuild # Rebuild images before starting |
| 31 | +kool start --foreground # Run in foreground (see logs) |
| 32 | +kool start --profile worker # Enable a docker-compose profile |
| 33 | + |
| 34 | +kool stop # Stop all services |
| 35 | +kool stop app # Stop specific service |
| 36 | +kool stop --purge # Stop and remove volumes (destructive) |
| 37 | + |
| 38 | +kool restart # Restart all services |
| 39 | +kool restart --rebuild # Rebuild images on restart |
| 40 | +kool restart --purge # Purge volumes on restart |
| 41 | + |
| 42 | +kool status # Show status of all containers |
| 43 | +``` |
| 44 | + |
| 45 | +## Executing Commands in Containers |
| 46 | + |
| 47 | +Use `exec` to run commands inside running service containers (like SSH). |
| 48 | + |
| 49 | +```bash |
| 50 | +kool exec <service> <command> |
| 51 | +kool exec app bash # Interactive shell |
| 52 | +kool exec app php artisan migrate # Run Laravel migration |
| 53 | +kool exec app npm install # Install npm packages |
| 54 | +kool exec -e VAR=value app env # With environment variable |
25 | 55 | ``` |
26 | 56 |
|
27 | | -3. Run scripts: |
| 57 | +## One-off Docker Containers |
| 58 | + |
| 59 | +Use `docker` to run commands in temporary containers (not services). |
| 60 | + |
| 61 | +```bash |
| 62 | +kool docker <image> <command> |
| 63 | +kool docker node npm init # Run npm in node container |
| 64 | +kool docker --volume=$PWD:/app golang go build # Mount current dir |
| 65 | +kool docker --env=DEBUG=1 python python script.py # With env var |
| 66 | +kool docker --publish=3000:3000 node npm start # Expose port |
| 67 | +``` |
| 68 | + |
| 69 | +## Viewing Logs |
| 70 | + |
| 71 | +```bash |
| 72 | +kool logs # Last 25 lines from all services |
| 73 | +kool logs app # Logs from specific service |
| 74 | +kool logs -f # Follow logs (live) |
| 75 | +kool logs -f app worker # Follow multiple services |
| 76 | +kool logs --tail 100 # Last 100 lines |
| 77 | +kool logs --tail 0 # All logs |
| 78 | +``` |
| 79 | + |
| 80 | +## Project Scripts |
| 81 | + |
| 82 | +Scripts are defined in `kool.yml` and provide project-specific commands. |
| 83 | + |
| 84 | +```bash |
| 85 | +kool run --json # List scripts as JSON [{name, comments, commands}] |
| 86 | +kool run # List scripts (human-readable) |
| 87 | +kool run <script> # Run a script |
| 88 | +kool run <script> -- <args> # Pass args (single-line scripts only) |
| 89 | +kool run -e VAR=1 <script> # Run with environment variable |
| 90 | +``` |
| 91 | + |
| 92 | +## Global Options |
| 93 | + |
| 94 | +All commands support: |
28 | 95 |
|
29 | 96 | ```bash |
30 | | -kool run <script> |
31 | | -kool run <script> -- <args> |
| 97 | +-w, --working_dir <path> # Run from different directory |
| 98 | +--verbose # Increase output verbosity |
32 | 99 | ``` |
33 | 100 |
|
34 | 101 | ## Important Rules |
35 | 102 |
|
36 | | -- **ALWAYS** run commands from the project root or use `-w/--working_dir`. |
37 | | -- **ONLY** pass extra args to single-line scripts; multi-line scripts reject extra args. |
38 | | -- **REMEMBER** `kool.yml` scripts are not full bash (no pipes/conditionals); use `kool docker <image> bash -c "..."` for complex shell logic. |
39 | | -- **CHECK** `kool.yml` or `kool.yaml` in the project root and `~/kool` for shared scripts. |
| 103 | +- **ALWAYS** run from project root (has `docker-compose.yml` and `kool.yml`) or use `-w`. |
| 104 | +- **Service names** come from `docker-compose.yml` service definitions. |
| 105 | +- **Script args** only work with single-line scripts; multi-line scripts reject extra args. |
| 106 | +- **Scripts** in `kool.yml` are not full bash - use `kool docker <image> bash -c "..."` for pipes/conditionals. |
0 commit comments