home / skills / kool-dev / kool / kool-cli

kool-cli skill

/skills/kool-cli

This skill helps you manage docker-based development with kool-cli, including start, stop, exec, logs, and running scripts from kool.yml.

npx playbooks add skill kool-dev/kool --skill kool-cli

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
3.8 KB
---
name: kool-cli
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.
---

# Kool CLI

Kool simplifies Docker-based development with commands for container lifecycle, service execution, and custom scripts.

## Quick Reference

```bash
kool start                    # Start all services from docker-compose.yml
kool stop                     # Stop all services
kool restart --rebuild        # Restart and rebuild images
kool status                   # Show running containers
kool exec <service> <cmd>     # Run command in service container
kool logs -f <service>        # Follow service logs
kool run --json               # List available scripts as JSON
kool run <script>             # Run a script from kool.yml
```

## Service Lifecycle

Services are defined in `docker-compose.yml`. Kool wraps docker-compose with simpler commands.

```bash
kool start                    # Start all services
kool start app database       # Start specific services
kool start --rebuild          # Rebuild images before starting
kool start --foreground       # Run in foreground (see logs)
kool start --profile worker   # Enable a docker-compose profile

kool stop                     # Stop all services
kool stop app                 # Stop specific service
kool stop --purge             # Stop and remove volumes (destructive)

kool restart                  # Restart all services
kool restart --rebuild        # Rebuild images on restart
kool restart --purge          # Purge volumes on restart

kool status                   # Show status of all containers
```

## Executing Commands in Containers

Use `exec` to run commands inside running service containers (like SSH).

```bash
kool exec <service> <command>
kool exec app bash                      # Interactive shell
kool exec app php artisan migrate       # Run Laravel migration
kool exec app npm install               # Install npm packages
kool exec -e VAR=value app env          # With environment variable
```

## One-off Docker Containers

Use `docker` to run commands in temporary containers (not services).

```bash
kool docker <image> <command>
kool docker node npm init                           # Run npm in node container
kool docker --volume=$PWD:/app golang go build      # Mount current dir
kool docker --env=DEBUG=1 python python script.py  # With env var
kool docker --publish=3000:3000 node npm start      # Expose port
```

## Viewing Logs

```bash
kool logs                     # Last 25 lines from all services
kool logs app                 # Logs from specific service
kool logs -f                  # Follow logs (live)
kool logs -f app worker       # Follow multiple services
kool logs --tail 100          # Last 100 lines
kool logs --tail 0            # All logs
```

## Project Scripts

Scripts are defined in `kool.yml` and provide project-specific commands.

```bash
kool run --json               # List scripts as JSON [{name, comments, commands}]
kool run                      # List scripts (human-readable)
kool run <script>             # Run a script
kool run <script> -- <args>   # Pass args (single-line scripts only)
kool run -e VAR=1 <script>    # Run with environment variable
```

## Global Options

All commands support:

```bash
-w, --working_dir <path>      # Run from different directory
--verbose                     # Increase output verbosity
```

## Important Rules

- **ALWAYS** run from project root (has `docker-compose.yml` and `kool.yml`) or use `-w`.
- **Service names** come from `docker-compose.yml` service definitions.
- **Script args** only work with single-line scripts; multi-line scripts reject extra args.
- **Scripts** in `kool.yml` are not full bash - use `kool docker <image> bash -c "..."` for pipes/conditionals.

Overview

This skill provides a CLI for managing Docker-based development environments with simple, focused commands. It wraps docker-compose operations, lets you run one-off containers, execute commands inside service containers, view logs, and run project scripts defined in kool.yml. The goal is faster, less error-prone local development workflows for containerized web apps. It is lightweight and designed to keep common tasks readable and repeatable.

How this skill works

The CLI inspects your project root for docker-compose.yml and kool.yml (or you can set a different working directory with -w). It delegates lifecycle operations (start/stop/restart/status) to docker-compose, exposes an exec command to run commands inside service containers, and supports running transient docker containers via a docker subcommand. Project scripts from kool.yml can be listed or executed, and logs are available with tail and follow options.

When to use it

  • Starting, stopping, or restarting all or specific services from a docker-compose setup.
  • Opening an interactive shell or running maintenance commands inside a service container.
  • Running temporary build or test containers without modifying compose files.
  • Following service logs during development or debugging multi-service apps.
  • Executing project-defined scripts (kool.yml) consistently across team members.

Best practices

  • Always run the CLI from the project root (contains docker-compose.yml and kool.yml) or use -w to set the working directory.
  • Use service names exactly as declared in docker-compose.yml to avoid targeting the wrong container.
  • Use --rebuild when you need image updates and --purge only when you want to remove volumes (destructive).
  • Pass environment variables with -e for ephemeral changes and prefer scripts in kool.yml for repeatable tasks.
  • For complex shell logic (pipes, conditionals), run a shell inside a docker container (kool docker <image> bash -c "...") instead of multi-line kool scripts.

Example use cases

  • Start the full development stack and follow app logs while developing a feature.
  • Run database migrations inside the app container: kool exec app php artisan migrate.
  • Run a one-off Node container to install packages or build assets: kool docker node npm run build.
  • List available project scripts as JSON for integration with IDE tasks or CI helpers.
  • Restart services with rebuilt images after updating Dockerfiles: kool restart --rebuild.

FAQ

What if I need to run scripts from a different directory?

Use -w or --working_dir to point the CLI to the project root that contains docker-compose.yml and kool.yml.

Can I pass arguments to kool.yml scripts?

Yes for single-line scripts: use kool run <script> -- <args>. Multi-line scripts do not accept extra args.

How do I run complex shell commands with pipes or conditionals?

Run a shell inside a temporary container: kool docker <image> bash -c "your complex command".