# Install

## 1. System requirements

- WordPress 6.2+
- PHP 8.0+
- `ext-json`, `ext-hash` (both bundled in stock PHP)
- A Seekmodo tenant — sign up at <https://seekmodo.com/signup>

WooCommerce is optional. The plugin's commerce vertical activates
automatically when WooCommerce ≥ 8.0 is detected and stays dormant
otherwise — no errors, no admin nag.

## 2. Install the plugin

### From the signed zip (recommended)

```bash
curl -fLO https://seekmodo.com/plugins/seekmodo-wordpress-v0.1.0.zip
curl -fLO https://seekmodo.com/plugins/seekmodo-wordpress-v0.1.0.zip.sha256
sha256sum -c seekmodo-wordpress-v0.1.0.zip.sha256
```

Then in **Plugins → Add New → Upload Plugin**, select the zip, and
**Install Now** → **Activate**.

### From WP-CLI (headless / CI)

```bash
wp plugin install seekmodo-wordpress-v0.1.0.zip --activate
```

## 3. Pair with Seekmodo

### Browser flow

1. Go to **Settings → Seekmodo Search**.
2. Click **Connect to Seekmodo**.
3. Approve the pairing on `seekmodo.com/connect`.
4. The tenant ID + HMAC secret are written to `wp_options` automatically.

### CLI flow

```bash
wp seekmodo connect --tenant=<tenant_id> --secret=<shared_secret>
```

The CLI flow is idempotent — re-running it rotates the credentials.

## 4. Index your content

```bash
# One-shot full reindex (Posts + Pages + every public CPT).
wp seekmodo index --full

# After this the scheduled wp_cron `seekmodo_wp_index_tick` keeps the
# index fresh via the delta hooks on save_post / transition_post_status
# / before_delete_post (plus the WooCommerce delta hooks if Woo is active).
```

For Woo stores, products + variations + stock + visibility + price +
SKU + attributes are all picked up. See
[`COMMERCE_VERTICAL.md`](COMMERCE_VERTICAL.md) for details.

## 5. Flip the mode

The default is `MODE=off`. Once paired and indexed, set the mode in one
of two equivalent ways:

```bash
# From the WordPress side
wp option update seekmodo_wp_mode shadow

# From admin.seekmodo.com (preferred — survives plugin reinstalls)
# Open Settings → Seekmodo Search → "Open admin.seekmodo.com" → flip Mode.
```

Recommended progression: `off → shadow → active`. `active` is the
self-tuning mode; the auto-promoter handles the `shadow → enforce`
transition once health gauges are inside threshold for a sustained
window (5xx<1%, p95<300ms, fallback<2% over the last 5 min).

## 6. Verify

```bash
wp seekmodo shadow-report --window=7d   # divergence vs native search
wp seekmodo cutover-readiness            # green/red gate
```

Or visit **Dashboard → Seekmodo health** for a live read of current
mode, breaker state, last indexer run, and gateway p95.
