SHA256
chore: 添加 docker 部署方案,创建账户生成随机密码 #2
+16
-31
@@ -1,6 +1,6 @@
|
||||
# Python CLI 管理工具
|
||||
|
||||
`tjhlp` 是课程答疑平台的命令行管理工具, 通过 Gitea REST API 批量管理用户、组织、仓库、Webhook、Label, 并提供 Issue 统计和邮件通知功能。
|
||||
`tjhlp` 是课程答疑平台的命令行管理工具, 通过 Gitea REST API 批量管理用户、组织、仓库、Webhook、Label, 并提供 Issue 统计功能。
|
||||
|
||||
## 前置要求
|
||||
|
||||
@@ -56,7 +56,7 @@ tjhlp
|
||||
│ ├── init 一键初始化: 创建组织/团队/仓库/Labels/Webhook
|
||||
│ └── status 检查 Gitea 连接状态
|
||||
├── users
|
||||
│ ├── create 从 CSV 批量创建账号(随机密码)
|
||||
│ ├── create 从 CSV 批量创建账号(初始密码与用户名相同)
|
||||
│ ├── list 列出所有用户
|
||||
│ └── delete 批量删除用户
|
||||
├── orgs
|
||||
@@ -77,12 +77,9 @@ tjhlp
|
||||
├── labels
|
||||
│ ├── sync 同步预定义 Label 到仓库
|
||||
│ └── list 列出仓库 Label
|
||||
├── stats
|
||||
│ ├── summary Issue 统计摘要
|
||||
│ └── export 导出 Issue 数据到 CSV
|
||||
└── labels
|
||||
├── sync 同步预定义 Label 到仓库
|
||||
└── list 列出仓库 Label
|
||||
└── stats
|
||||
├── summary Issue 统计摘要
|
||||
└── export 导出 Issue 数据到 CSV
|
||||
```
|
||||
|
||||
## 典型工作流
|
||||
@@ -103,29 +100,12 @@ uv run tjhlp setup init \
|
||||
uv run tjhlp users create --file members.csv --org tjhlp-2025f
|
||||
```
|
||||
|
||||
`cmd` 可直接复制的写法:
|
||||
|
||||
## 典型工作流
|
||||
|
||||
### 学期初始化
|
||||
|
||||
```bash
|
||||
# 1. 检查连接
|
||||
```cmd
|
||||
uv run tjhlp setup status
|
||||
|
||||
# 2. 一键初始化(创建组织 + 团队 + general 仓库 + Labels + Webhook)
|
||||
uv run tjhlp setup init \
|
||||
--org tjhlp-2025f \
|
||||
--webhook-url http://notify-server:8080/webhook \
|
||||
--webhook-secret mysecret
|
||||
|
||||
# 3. 批量创建用户并分配到团队
|
||||
uv run tjhlp setup init --org tjhlp-2025f --webhook-url http://notify-server:8080/webhook --webhook-secret mysecret
|
||||
uv run tjhlp users create --file members.csv --org tjhlp-2025f
|
||||
|
||||
# 4. 发送账号密码邮件
|
||||
uv run tjhlp notify send-credentials --file credentials_20250901_120000.csv
|
||||
|
||||
# 5. (可选)先预览邮件, 不实际发送
|
||||
uv run tjhlp notify send-credentials --file credentials_*.csv --dry-run
|
||||
```
|
||||
|
||||
### 每次布置作业
|
||||
@@ -138,6 +118,12 @@ uv run tjhlp repos create-homework \
|
||||
--webhook-url http://notify-server:8080/webhook
|
||||
```
|
||||
|
||||
`cmd` 可直接复制的写法:
|
||||
|
||||
```cmd
|
||||
uv run tjhlp repos create-homework --org tjhlp-2025f --number 3 --desc "作业3: 链表操作" --webhook-url http://notify-server:8080/webhook
|
||||
```
|
||||
|
||||
这会自动完成: 创建 `hw03` 仓库 -> 推送作业 Issue Template -> 同步 Labels -> 配置 Webhook -> 添加到 ta/students 团队。
|
||||
|
||||
### 日常管理
|
||||
@@ -174,10 +160,10 @@ id,name,role
|
||||
```
|
||||
|
||||
- `id` - 学号或工号, 同时作为 Gitea 用户名
|
||||
- `name` - 姓名, 作为 Gitea 的 full_name
|
||||
- `name` - 姓名, 作为 Gitea 的 `full_name`
|
||||
- `role` - `student` 或 `ta`, 决定分配到哪个团队
|
||||
- 邮箱自动生成为 `{id}@tongji.edu.cn`
|
||||
- **初始密码与用户名(学号/工号)相同**。
|
||||
- **初始密码与用户名(学号/工号)相同**
|
||||
|
||||
示例文件见 `example/members.csv`。
|
||||
|
||||
@@ -271,7 +257,6 @@ scripts/
|
||||
│ ├── test_models.py 数据模型测试
|
||||
│ ├── test_config.py 配置校验测试
|
||||
│ ├── test_utils.py 工具函数测试
|
||||
│ ├── test_pure_functions.py 纯函数测试
|
||||
│ ├── test_client.py API 客户端测试
|
||||
│ └── test_commands.py 命令集成测试
|
||||
└── src/tjhlp/
|
||||
|
||||
Reference in New Issue
Block a user