Metadata-Version: 2.4
Name: qt-cli
Version: 0.1.0
Summary: Qitianbu command line login tool
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# qt-cli

`qt-cli` 是齐天簿的命令行登录工具，安装后命令名为 `qt`。

当前版本采用 device flow：

1. 终端发起登录请求
2. 浏览器打开 `https://qt.6-79.cn/cli`
3. 用户在网页端确认本次 CLI 登录
4. CLI 轮询拿到登录 token

## 安装

```bash
cd qt-cli
python3 -m pip install -e .
```

## 使用

```bash
qt login
qt profile
qt apps --scope developed
qt app list --scope in-use
qt whoami
qt token
qt oauth --app-id <APP_ID>
qt app oauth --app-id <APP_ID>
qt logout
```

## Reuse In Other CLI Tools

`qt` can act as a shared authentication broker for other command-line tools.

Read the current account profile:

```bash
qt profile --json
```

Read app lists:

```bash
qt apps --scope in-use
qt apps --scope developed
qt apps --scope discover --count 12
qt app list --scope developed
```

Print the current login token:

```bash
qt token
```

Issue an OAuth authorization code for another Qitianbu app:

```bash
qt oauth --app-id R41nXZEwpfl6tw6KYyoEZ4FYST4BXPlF
qt app oauth --app-id R41nXZEwpfl6tw6KYyoEZ4FYST4BXPlF
```

When there is no local login session, `qt oauth` and `qt app oauth` can now fall back to a browser-assisted CLI authorization flow. Use `--browser` to force that flow even if the local session already exists.
