# 主题命令

> Shoplazza CLI 主题命令参考：init、serve、pull、push、share、package、publish、list 的参数与行为说明。

本参考文档列出 Shoplazza CLI 的主题开发命令。完整命令参考见 [CLI 命令参考](/zh-CN/docs/app/developer-tools/shoplazza-cli/commands/)。

## 命令总览

| 命令 | 说明 |
|------|------|
| [themes init](#init) | 基于 Nova 2023 创建新主题 |
| [themes serve](#serve) | 实时预览主题 |
| [themes pull](#pull) | 从店铺下载主题 |
| [themes push](#push) | 上传主题到店铺 |
| [themes share](#share) | 分享预览链接 |
| [themes package](#package) | 打包主题为 ZIP |
| [themes publish](#publish) | 发布主题 |
| [themes list](#list) | 列出店铺主题 |
| [themes delete](#delete) | 删除主题 |
| [auth login](#login) | 登录 |
| [auth logout](#logout) | 注销 |
| [auth store use](#store-use) | 切换店铺 |
| [version](#version) | 显示版本 |
| [help](#help) | 显示帮助 |

## 主题快捷命令

### init
基于 [Nova 2023](/zh-CN/docs/theme/developer-tools/nova-2023) 创建新主题脚手架。
```shell
shoplazza themes init --name <dir>
```

### serve
上传主题到店铺并实时预览。返回预览链接和主题编辑器链接。
```shell
shoplazza themes serve
```
| 参数 | 说明 |
|------|------|
| `--theme-id, -t <THEME_ID>` | 要预览的主题 ID，省略则使用开发主题 |

### pull
从 Shoplazza 下载主题文件。
```shell
shoplazza themes pull --theme-id <THEME_ID>
```

### push
上传本地主题文件到 Shoplazza，覆盖远端版本。
```shell
shoplazza themes push --theme-id <THEME_ID>
```

### share
上传主题为未发布主题，返回可分享的预览链接。
```shell
shoplazza themes share
```

### package
将主题文件打包为 `theme_name-theme_version.zip`。
```shell
shoplazza themes package
```

## 主题 API 命令

### list
列出店铺所有主题及其 ID 和状态。
```shell
shoplazza themes list --format table
```

### publish
发布主题到线上店铺。
```shell
shoplazza themes publish --id <THEME_ID>
```

### delete
删除主题。
```shell
shoplazza themes delete --id <THEME_ID>
```

## 认证命令

### login
通过 OAuth 2.0 登录：
```shell
shoplazza auth login --store-domain my-store.myshoplaza.com --domain themes
```

### logout
注销并移除凭证：
```shell
shoplazza auth logout
```

### store use
切换到其他店铺：
```shell
shoplazza auth store use --store-domain another-store.myshoplaza.com
```

## 工具命令

### version
```shell
shoplazza version
```

### help
```shell
shoplazza help
shoplazza help [命令]
shoplazza [命令] --help
```
