# Wix CLI Commands

## Core Commands

### `wix login`

Log in to your Wix account

**Options:**

- `--api-key <token>`: Authenticate using an API key for automations and CI environments

### `wix logout`

Log out of your Wix account

### `wix telemetry <on|off>`

Opt in/out of sending anonymous usage information (telemetry) to Wix

### `wix whoami`

Display the email of the logged in Wix user

## Development Commands

### `wix dev`

Start the local development server.

**Options:**

- `--port <port>`: Specify which port to run on. Defaults to 4321.
- `--allowed-hosts <allowedHosts>`: Specify a comma-separated list of allowed hosts or allow any hostname.

For app projects in non-interactive environments, select or create a development site with `wix dev-site` before running `wix dev`.

### `wix dev-site`

Manage the development site used by the current app.

**Subcommands:**

- `wix dev-site list [--search <query>]`: List account sites. Search matches site names, display names, and domains.
- `wix dev-site current`: Show the effective site ID and whether it came from `WIX_SITE_ID` or app config.
- `wix dev-site select <site-id>`: Validate and select a site, waiting for app installation when required.
- `wix dev-site create [--template dev|harmony] [--select]`: Create a development site and optionally select it.

`WIX_SITE_ID` takes precedence over the site saved in app config.

### `wix build`

Invoke the astro build process, forwarding all command-line arguments.

### `wix preview`

Create a preview deployment of your application.

### `wix release`

Release a new version of your application.

**Options:**

- `-c, --comment <comment>`: The comment for your release version, not visible by users
- `-t, --version-type <type>`: The type of version you would like to create (major or minor)

### `wix generate`

Generate a new extension for your project.

**Options:**

- `--type <type>`: Extension type to generate. Available types:
  - `DASHBOARD_PAGE`: A page in the Wix dashboard
  - `DASHBOARD_MODAL`: A modal dialog in the Wix dashboard
  - `DASHBOARD_PLUGIN`: A plugin for the Wix dashboard
  - `DASHBOARD_MENU_PLUGIN`: A menu plugin for the Wix dashboard
  - `EMBEDDED_SCRIPT`: An embedded script extension
  - `CUSTOM_ELEMENT`: A custom HTML element
  - `SITE_PLUGIN`: A plugin for Wix sites
  - `EVENT`: An event handler
  - `SERVICE_PLUGIN`: A service plugin (SPI implementation)

## Environment Variables

### `wix env`

Work with environment variables.

**Subcommands:**

#### `wix env pull`

Pulls environment variables and merge them into .env.local file.

#### `wix env set`

Sets an environment variable.

**Options:**

- `--key <key>`: Name of the variable (required)
- `--value <value>`: Value of the variable (required)

#### `wix env remove`

Removes an environment variable.

**Options:**

- `--key <key>`: Name of the variable (required)
