## Usage

```bash
npx @gentleduck/cli update [components...]
```

Updates installed components to the latest registry versions. If you have local modifications, the CLI launches an **interactive merge TUI** for hunk-by-hunk conflict resolution.

***

## Options

| Flag | Description |
| --- | --- |
| `-a, --all` | Update all installed components |
| `-y, --yes` | Skip confirmation prompts |
| `-c, --cwd <cwd>` | Working directory |
| `-w, --workspace <path>` | Target workspace |

***

## The merge TUI

For each changed file, hunks are presented one at a time:

| Key | Action |
| --- | --- |
| `1` | Keep your local version |
| `2` | Take the registry version |
| `3` | Keep both |
| `h` / `l` | Navigate between files |
| `j` / `k` | Navigate between hunks |
| `N` / `P` | Jump to next/previous unresolved hunk |
| `Enter` | Confirm and write the merged result |
| `Esc` | Abort, leave files untouched |

After resolving all hunks, you see a preview of the merged result before writing to disk.

No git merge markers. No manual conflict resolution. No diff tool required.

***

## Examples

```bash
# Update a specific component
npx @gentleduck/cli update button

# Update all components
npx @gentleduck/cli update --all

# Update inside a workspace
npx @gentleduck/cli update --all --workspace packages/ui
```

***

## When the merge TUI does NOT open

* **No local changes** — file matches registry, replaced silently
* **No registry changes** — local file is already up to date

The TUI only triggers when both sides diverged.

***

## Diff first, update second

To preview changes before running update, use [`diff`](/duck-cli/commands/diff):

```bash
npx @gentleduck/cli diff button   # see what would change
npx @gentleduck/cli update button # apply with the merge TUI
```