> ## Documentation Index
> Fetch the complete documentation index at: https://sincronizado.micr.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI

> Command-line interface reference.

The `sinc` CLI is designed to be simple and mnemonic. Most of the time, you just run `sinc`.

## Usage

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
sinc [options] [command]
```

## Core Commands

### `sinc` (Connect)

**The main command.**

* Checks if a session exists for the **current directory**.
* If yes, attaches to it (if `-r` is implied or auto-detected).
* If no, creates a new sync session and new tmux session.
* **Behavior**: Syncs local files -> Remote, then drops you into the remote shell.

### `sinc -r` / `sinc --resume`

**Explicit Resume.**

* Only tries to attach to an existing session.
* Fails if no session exists for the current directory.
* Use this when you know you have a session running and want to jump back in.

### `sinc --setup`

**Configuration Wizard.**

* Interactive prompt to set up `config.json`.
* Checks and installs dependencies (`mutagen`).
* Can trigger the VPS bootstrap script.

### `sinc --list` / `sinc -l` / `sinc list`

**Status Check.**

* Lists all active sincronizado sessions.
* Shows: Session Name, Local Path, Remote Path, Sync Status.

### `sinc push`

**Force Sync (Local -> Remote).**

* Forces local files to overwrite the remote side of the current session.
* Requires an active session for the current directory.
* Shows an overwrite summary and asks for confirmation unless `--yes` is provided.

### `sinc pull`

**Force Sync (Remote -> Local).**

* Forces remote files to overwrite the local side of the current session.
* Requires an active session for the current directory.
* Shows an overwrite summary and asks for confirmation unless `--yes` is provided.

### `sinc --kill <session_name>` / `sinc -k <session_name>` / `sinc kill <session_name>`

**Cleanup.**

* Terminates the Mutagen sync session.
* Kills the remote `tmux` session.
* *Does NOT delete the files on the VPS.*

### `sinc --uninstall`

**Local Cleanup.**

* Removes `~/.config/sincronizado`.
* Stops the sync session for the current project.
* Useful if you want to reset everything on your machine.

## Flags

| Flag        | Short | Description                                             |
| :---------- | :---- | :------------------------------------------------------ |
| `--help`    | `-h`  | Show help text.                                         |
| `--version` | `-V`  | Show version number.                                    |
| `--resume`  | `-r`  | Resume existing session.                                |
| `--quiet`   | `-q`  | Suppress logs (useful for scripts).                     |
| `--verbose` | `-v`  | Show debug logs (SSH commands, Mutagen output).         |
| `--yes`     |       | Skip confirmation prompts for destructive sync actions. |
| `--json`    |       | Output status as JSON (for tool integration).           |

## JSON Output

For developers building tools on top of `sinc`, use `--json`.

**Connect Event:**

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "event": "sync-status",
  "session": "sinc-myapp-7f8a9d",
  "exists": true,
  "status": "Watching for changes",
  "watching": true
}
```

**List Output:**

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
[
  {
    "name": "sinc-myapp-7f8a9d",
    "sync": {
      "exists": true,
      "status": "Watching for changes",
      "conflicts": []
    }
  }
]
```

## Exit Codes

* `0`: Success
* `1`: Generic Error
* `2`: Usage Error (invalid flags)
* `69`: Dependency Missing (Mutagen not found)
* `76`: Connection Error (SSH failed)
* `78`: Config Error (Invalid JSON or missing fields)
