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

# CLI Integration Setup

> Connect GitHub, Linear, Slack, Railway, and Vercel from the Squasher CLI with a browser-backed setup flow.

# CLI Integration Setup

Use the Squasher CLI when you want an agent or local script to kick off integration setup without hunting through the dashboard.

<Card title="Squasher CLI Agent Skill" icon="sparkles" href="/integrations/agent-skills">
  Install the `squasher-cli` skill so coding assistants use the right CLI command names and auth
  flow.
</Card>

## What the command does

* Opens a browser-backed Squasher OAuth flow.
* Prompts you to sign in first if your Squasher session is missing.
* Connects the provider account.
* Optionally saves the project integration before returning control to the CLI.

## Commands

Authenticate the CLI itself with your Squasher account:

```bash theme={null}
squasher login
```

That opens a browser, signs you into Squasher if needed, and stores an OAuth session using the configured credentials backend.

Use device-code login when the CLI is running over SSH, inside a container, in a remote development environment, or anywhere the local browser callback is not reachable:

```bash theme={null}
squasher login --device-code
```

The CLI prints a URL and a short code:

```text theme={null}
To sign in, open this URL on any device:
  https://app.squasher.ai/oauth/device
And enter this code:
  BCDF-GHJK
```

Open the URL on a device with a browser, enter the code, approve the request, and the CLI finishes the OAuth login.

If you prefer the old manual flow for CI or local scripts, API keys still work:

```bash theme={null}
squasher login --key sq_pk_your_api_key
```

Connect provider integrations after the CLI is signed in:

```bash theme={null}
squasher integrations providers
squasher integrations connect github
squasher integrations connect linear
squasher integrations connect slack
squasher integrations connect railway
squasher integrations connect vercel
```

`squasher oauth ...` works as an alias for the same flow.

## Credential storage

New CLI installs default to `credentials_store: "auto"` in `~/.squasher/config.json`.
In `auto` mode, Squasher stores API keys and OAuth access/refresh tokens in the OS keyring when available:

* macOS: Keychain
* Windows: Credential Manager
* Linux: Secret Service, such as GNOME Keyring or KWallet

If the OS keyring is unavailable, `auto` falls back to the local config file and prints a warning.
Existing installs that do not already have `credentials_store` set keep the file backend until you opt in.

To choose a backend explicitly, edit `~/.squasher/config.json`:

```json theme={null}
{
  "credentials_store": "auto"
}
```

Supported values:

* `auto`: use the OS keyring when available, otherwise fall back to `~/.squasher/config.json`.
* `keyring`: require the OS keyring and fail if it cannot be reached.
* `file`: keep credentials in `~/.squasher/config.json`, protected as `0600` on Unix.

Run `squasher config` to see which backend is active. Run `squasher logout` to clear both the OS keyring entry and local config credentials.

## Profiles and active project

Save the project you use most often so agents can omit repetitive `--project` flags:

```bash theme={null}
squasher projects use 7063a770-8cc6-4284-b5f9-c0cb19e6fa79
squasher settings view
```

Use profiles when you switch between teams, projects, or API endpoints:

```bash theme={null}
squasher profiles create production \
  --project 7063a770-8cc6-4284-b5f9-c0cb19e6fa79 \
  --api-key-env SQUASHER_PRODUCTION_API_KEY
squasher profiles use production
squasher --profile production logs query "level:error" --since 1h
```

`--api-key-env` saves only the environment variable name in the profile. Keep the API key itself
in your shell, CI secret store, or secrets manager and inject it when the CLI runs. This lets two
profiles use different project-scoped keys without writing either key into the profile definition.

When a profile has `--api-key-env`, that variable takes precedence over the legacy shared
`SQUASHER_API_KEY` and stored login. If the selected variable is missing or empty, the command
fails instead of silently authenticating with another profile's key. Profiles without
`--api-key-env` keep the existing `SQUASHER_API_KEY`, OAuth, and stored-key behavior.
Profile updates preserve omitted project, URL, and key-selector fields. Remove one explicitly with
`--clear-project`, `--clear-api-url`, `--clear-app-url`, or `--clear-api-key-env`.

For example, configure two project boundaries using placeholder variable names:

```bash theme={null}
squasher profiles create default \
  --project <dogfood_project_id> \
  --api-key-env SQUASHER_DOGFOOD_API_KEY
squasher profiles create winterrx \
  --project <winterrx_project_id> \
  --api-key-env SQUASHER_WINTERRX_API_KEY

SQUASHER_DOGFOOD_API_KEY="$DOGFOOD_KEY_FROM_SECRET_MANAGER" \
  squasher --profile default projects get <dogfood_project_id>
SQUASHER_WINTERRX_API_KEY="$WINTERRX_KEY_FROM_SECRET_MANAGER" \
  squasher --profile winterrx projects get <winterrx_project_id>
```

Do not put the exports or resolved key values in a tracked file. API-key profiles still cannot
perform per-user mutations; use `squasher login` for those operations.

`--project` and `SQUASHER_PROJECT_ID` still override the active project for one command.

## Examples

Connect GitHub only:

```bash theme={null}
squasher integrations connect github
```

Connect GitHub and link a repo to a project:

```bash theme={null}
squasher integrations connect github \
  --project 7063a770-8cc6-4284-b5f9-c0cb19e6fa79 \
  --repo squasher-ai/squasher \
  --branch main
```

Connect Linear and save a team on a project:

```bash theme={null}
squasher oauth connect linear \
  --project 7063a770-8cc6-4284-b5f9-c0cb19e6fa79 \
  --team-id 9c0fdad1-0dc8-4f82-b0f0-f90f44258c10
```

Connect Slack and save a channel on a project:

```bash theme={null}
squasher oauth connect slack \
  --project 7063a770-8cc6-4284-b5f9-c0cb19e6fa79 \
  --channel-id C01234567
```

Install Railway and bind a project in one flow:

```bash theme={null}
squasher integrations connect railway \
  --project 7063a770-8cc6-4284-b5f9-c0cb19e6fa79 \
  --railway-project-id railway_project_123 \
  --railway-workspace-id railway_workspace_123
```

Install Vercel and bind a project in one flow:

```bash theme={null}
squasher integrations connect vercel \
  --project 7063a770-8cc6-4284-b5f9-c0cb19e6fa79 \
  --vercel-project-id prj_123
```

## Agent-friendly behavior

* The CLI waits on a loopback callback and exits only after Squasher confirms success or failure.
* Successful runs write the connected account and saved integration target into `~/.squasher/config.json`.
* If the browser cannot be opened automatically, the CLI prints the exact URL to open.
* If the local callback or browser launch is not available, the CLI can fall back to `squasher login --device-code`.
* Squasher validates provider-specific setup fields from the same provider metadata returned by `GET /v1/integrations/providers`.
