
# Using `dk`

The CLI has three parts that build on each other. Start with fuzzy search, add project actions when you're in a directory, and combine both with command forwarding for maximum speed.

## Fuzzy Search

Type `dk` on its own and you get an interactive search prompt. It fuzzy-matches against all your tracked projects. Pick one and you land in that directory.

```bash
# Open the search prompt
dk

# Prefill the search with a term
dk my-app
```

If your search term matches exactly one project, it jumps there instantly. No prompt needed.

The project you select opens in a **subshell**. Type `exit` (or hit `Ctrl+D`) and you're right back where you started.

## Project Actions

When you're inside a project directory, `dk` gives you quick commands:

```bash
dk wake       # or: dk w     - Restore dependencies
dk hibernate  # or: dk h     - Clean up and free disk space
dk bookmark   # or: dk b     - Toggle bookmark
dk logs       # or: dk L     - Tail a log file
dk actions    # or: dk a     - Run a stack action
dk editor     # or: dk e     - Open in your configured IDE
dk finder     # or: dk f     - Open in Finder
dk remote     # or: dk g     - Open git remote in browser
dk open       # or: dk o     - Open in DevKeepr app
dk menu       # or: dk m     - Interactive action menu
```

Every command has a short alias. In practice you'll mostly type things like `dk e` to open your editor or `dk w` to wake a project.

Some of these are interactive. `dk logs` (or `dk L`) lists all detected log files for the project and lets you pick one to tail. `dk actions` (or `dk a`) does the same for stack actions, letting you search through what's available and run it.

You can also manage your projects from the terminal:

```bash
dk link       # or: dk l     - Track the current directory as a project
dk park       # or: dk p     - Track all subdirectories as projects
dk remove     # or: dk r     - Stop tracking a project
```

### The Action Menu

`dk menu` deserves special attention. It brings up the full project action menu right in your terminal: all your stack actions, scripts, and even GitHub Actions workflows in one searchable list. Pick one and it runs.

Combined with command forwarding, you can pull up the action menu for any project without leaving your current directory:

```bash
dk my-app -m
```

That's all it takes to browse a project's actions, trigger a deploy workflow, or kick off a CI run. From anywhere.

## Command Forwarding

Here's where it gets good. You can combine search with any action using flags:

```bash
# Open the menu for a project
dk my-app --menu       # or -m

# Open a project in your editor
dk my-app --editor     # or -e

# Open Finder for a project
dk my-app --finder     # or -f

# Wake a hibernated project
dk my-app --wake       # or -w
```

This means you never have to `cd` into a project just to run one command. Search, pick, act.

### Flag Stacking

You can stack flags to do multiple things at once:

```bash

# Open the editor, Finder, and the GitHub repo all at once
dk my-app -efr

# Wake a project, open DevKeepr, and jump into the action menu
dk my-app -wom

# Bookmark a project and open it in your editor
dk my-app -be
```

A couple keystrokes and your whole workspace is set up.
