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

# Suxiaoqiang CLI

> Use sxq to sync a superun project locally, push code, build previews, deploy releases, and apply database migrations.

The **Suxiaoqiang CLI** synchronizes a superun project's files with a local directory. Its terminal command is `sxq`. You can edit the project in your preferred IDE or with an AI coding agent, push changes back, build a preview, and deploy to production.

<Note>
  The CLI shares its name with superun's in-product AI assistant, Suxiaoqiang, but they are different things. The assistant provides guidance in superun; the `sxq` command manages a project from your terminal.
</Note>

It is a project development and release tool. It does not replace the [superun CLI](/superun/cli/superun-cli), which operates a running app's business data and APIs.

## Before you start

You need:

* Node.js 18 or later;
* access to the superun project you want to link;
* the project's `sessionId`, shown in its superun project URL.

## Install and log in

```bash theme={null}
npm install -g suxiaoqiang-cli
sxq login
```

`sxq login` opens a browser to authorize the CLI. You can also use an existing token:

```bash theme={null}
sxq login --token <token>
```

## Link and pull a project

Create an empty directory, link it to the remote project, and pull its files:

```bash theme={null}
mkdir my-app
cd my-app
sxq link <sessionId>
sxq pull
```

Linking verifies that the project belongs to the signed-in account. The first pull is full; later pulls are incremental and use a three-way merge.

## Edit and push changes

After editing locally, push the changes back to superun:

```bash theme={null}
sxq push -m "Update homepage copy"
```

`sxq push` pulls remote changes first. If a file cannot be merged cleanly, the command stops and writes Git-style `<<<<<<<`, `=======`, and `>>>>>>>` conflict markers into the file.

Resolve every conflict, remove the markers, test the result, and run `sxq push` again. Files matched by the project's `.gitignore`, plus built-in entries such as `node_modules`, `dist`, and `.git`, are not synchronized.

## Preview and deploy

Trigger a debug build and wait for its preview URL:

```bash theme={null}
sxq publish
```

When the preview is ready and verified, deploy the pending version:

```bash theme={null}
sxq deploy
```

Check release state without deploying:

```bash theme={null}
sxq deploy --status
```

<Warning>
  `sxq deploy` changes the live application and may incur cloud service fees. Verify the linked project, preview, and target region before confirming.
</Warning>

## Apply database migrations

Create migration files under `supabase/migrations/` using this format:

```text theme={null}
<digits>_<description>.sql
```

A timestamp prefix is recommended, for example:

```text theme={null}
supabase/migrations/20260709120000_create_orders.sql
```

Then apply migrations that do not yet exist remotely:

```bash theme={null}
sxq db push
```

Migrations run in filename order and stop at the first failure. After a migration succeeds, the server saves it as a project attachment. Do not send migration files with `sxq push`; the CLI blocks them.

## Command reference

| Command                                              | Purpose                                                           |
| ---------------------------------------------------- | ----------------------------------------------------------------- |
| `sxq login [-y] [--token <token>]`                   | Authorize through a browser or validate and use an existing token |
| `sxq link <sessionId> [-y]`                          | Link the current directory to a project                           |
| `sxq pull`                                           | Pull and merge remote project files                               |
| `sxq push [-m <message>]`                            | Pull first, then push local changes if there are no conflicts     |
| `sxq publish`                                        | Build a debug preview and print its URL                           |
| `sxq deploy [-y] [-m <message>] [--region CN\|INTL]` | Deploy the pending version and wait until it is live              |
| `sxq deploy --status`                                | Show pending and published versions without deploying             |
| `sxq db push`                                        | Apply new SQL migrations                                          |
| `sxq config set\|get\|unset\|list`                   | Manage `host` and `lang` configuration                            |
| `sxq upgrade`                                        | Upgrade the CLI from npm                                          |

For CI or an AI agent, use `-y` on commands that would otherwise ask for confirmation. In a non-interactive environment, the CLI fails with guidance instead of waiting indefinitely.

<CardGroup cols={2}>
  <Card title="Suxiaoqiang CLI on npm" icon="npm" href="https://www.npmjs.com/package/suxiaoqiang-cli">
    View the published package and current version.
  </Card>

  <Card title="Source code" icon="github" href="https://github.com/AiGuangInc/suxiaoqiang-cli">
    Read the complete reference or report an issue.
  </Card>
</CardGroup>
