diff --git a/README.md b/README.md index 017e324..f8c9ef5 100644 --- a/README.md +++ b/README.md @@ -118,6 +118,79 @@ opencode-multi-model open my-session -m openai/gpt-5.2 -b kilo Priority: CLI flag > Environment variable > Default ("opencode") +## CLI Reference + +### `open` - Create a new multi-model tmux session + +```bash +opencode-multi-model open [options] +``` + +**Arguments:** +- `` - Name for the tmux session (required) + +**Options:** +| Option | Description | +|--------|-------------| +| `-m, --models ` | Model IDs to launch (space-separated) | +| `-b, --binary ` | Binary to use (opencode or kilo). Defaults to env var `OPENCODE_MULTI_MODEL_BINARY` or 'opencode' | + +### `close` - Close a multi-model tmux session + +```bash +opencode-multi-model close [options] +``` + +**Arguments:** +- `` - Name of the tmux session to close (required) + +**Options:** +| Option | Description | +|--------|-------------| +| `--keep-worktrees` | Do not remove worktrees and delete branches | +| `--no-tags` | Do not create archive tags before deleting branches | +| `-f, --force` | Skip confirmation prompts | + +### Global Options + +| Option | Description | +|--------|-------------| +| `-h, --help` | Display help information | +| `-V, --version` | Display version number | + +## How it works + +### `open` command + +The `open` command performs the following steps: + +1. **Validation**: Checks that session name andmodels are provided, no duplicate models exist, and verifies git repo, tmux, and binary are available + +2. **Model verification**: Validates models against `opencode models` output to ensure only valid model IDs are used + +3. **Git worktree creation**: For each model, creates: + - A git worktree at `~/.local/share/opencode/multi-model///` + - A branch named `opencode//` + +4. **Tmux session**: Creates a tmux session with one window per model, each window's working directory set to its corresponding worktree + +5. **Launch**: Sends the launch command to each window to start the binary with the specified model + +### `close` command + +The `close` command performs the following steps: + +1. **Kill tmux session**: Terminates the tmux session if it exists + +2. **Worktree discovery**: Finds all worktrees under `~/.local/share/opencode/multi-model//` + +3. **Worktree cleanup** (unless `--keep-worktrees`): + - Removes each gitworktree + - Creates an archive tag (unless `--no-tags`): `archive/-` for recovery + - Deletes the associated branches + +4. **Directory cleanup**: Removes the base session directory + ## Requirements - tmux