# @fluid-app/fluid-cli-connect

Fluid CLI plugin for Fluid Connect: link a back-office platform (Exigo,
InfoTrax, ByDesign, or Pillars) to Fluid, then set its credentials, data
mappings, and sync settings.

```bash
npm install -g @fluid-app/fluid-cli @fluid-app/fluid-cli-connect
fluid login
fluid connect list                                   # each provider and whether it's installed
fluid connect install exigo --yes                    # install the droplet, creating the connection
fluid connect credentials exigo --yes \
  --set api.company=acme --set api.username=api_user --set api.password=... \
  --set mssql.dataserver=sql.example.com --set mssql.database=acme \
  --set mssql.username=reader --set mssql.password=...
fluid connect show exigo                             # state, supported mappings, every setting
fluid connect unmapped exigo --auto-map --yes        # map exact name matches, list what's left
fluid connect mappings exigo customer_type --options # Fluid's and Exigo's values to map
fluid connect map exigo customer_type --yes --set source_type_slug=rep --set target_type_id=2
fluid connect settings exigo --yes --defaults        # take every default
fluid connect settings exigo --yes --set order.refund_handling=hold
fluid connect status exigo --range 24h               # sync health: success rate, tier, failures by category
```

## Set up interactively

```bash
fluid connect walk exigo     # or: fluid setup run connect-exigo
```

`walk` runs the whole setup in the terminal, one question at a time:

1. Installs the provider if it isn't installed, after you confirm.
2. Asks each credential (passwords and tokens are typed hidden; Exigo also
   asks the environment, and the sandbox ID outside production). Fluid tests
   the connection before saving; if the provider refuses, its reason is shown
   and the questions are asked again, with Enter keeping what you typed.
   On a connected provider, you can keep the saved credentials.
3. Maps what's unmapped. Exigo first offers to map exact name matches, then
   gives a searchable list of Exigo's values; for the others you type the
   provider's value. Answer `*` to send every remaining value of that type to
   one value. Ranks and ship methods get a note and an optional row by hand.
4. Settings: keep them as they are, put them all back to the defaults, or go
   through the common settings, each with its label, description, default,
   and options.
5. Prints a summary, and the result as JSON.

Every answer is saved as you give it, through the same calls as the commands
above. Type `<` to go back (a changed mapping replaces the row it saved), `>`
to skip, and `?` for the menu: jump to a part, change an answer, finish, or
stop. Run `walk` again later to pick up what's left. In a script, use the
commands above with `--yes`; `walk` needs a terminal.

## Commands

`unmapped` lists, per mapping type, the Fluid values that have no row and no
`*` fallback. `done: true` means nothing is left. Ranks and ship methods come
back as `check_by_hand` because the API doesn't list Fluid's values for them.
`--auto-map` works for Exigo only, since it is the one provider whose values
the API lists. It adds a row wherever a Fluid value's name matches exactly one
Exigo value, and leaves ambiguous names for a person.

A new connection already starts on the default settings. `settings --defaults`
puts them back, all at once or one at a time with `--only order.refund_handling`.

Values passed with `--set` end up in your shell history and are visible in
process listings. For passwords and tokens, prefer `fluid connect walk`, which
asks for them without echoing. `credentials` keeps every value as typed (a
password like `123456` stays a string), and creates the connection if
installing the droplet hasn't yet. `unmapped` exits non-zero when a mapping
type couldn't be checked.

`status` reads the provider's sync status from Fluid
(`/api/company/v2026-10/connect/integrations`): the dashboard's success rate,
tier, synced, held, quarantined and skipped counts, and the top failure
categories, for `--range` `60m`, `24h` (the default), `7d` or `30d`. It
carries counts and category codes, never error text. A provider the company
hasn't installed prints the same result as `list`. When Fluid can't read the
status, it exits non-zero with the error's `status` and `code`: 404
`not_found`, 409 `not_connected` (fluid-integrations has no record of the
installation), 502 `backend_unavailable` or `backend_rejected`, or 503
`connect_unconfigured` (Fluid has no API host for the integration). It needs
the `droplets.view` permission.

Every command prints JSON; failures print a JSON `error` on stderr and exit
non-zero. A failed credential test prints the provider's reason in `details`.
Commands that change live configuration ask for confirmation unless you pass
`--yes`.

The CLI talks to two services with the same Fluid API token: api.fluid.app to
install the droplet and read `status`, and fluid-integrations for everything
else. Set
`FLUID_INTEGRATIONS_BASE` to point at another fluid-integrations host.

The walkthroughs for each provider, including data mapping and the common
settings, are the Connect guided setups at https://docs.fluid.app/setup.
