Skip to content

Commit 64f9b66

Browse files
committed
Merge branch '3.6.x'
2 parents 0511072 + 83e3a1f commit 64f9b66

File tree

18 files changed

+879
-57
lines changed

18 files changed

+879
-57
lines changed

.ai-agents/codex/preferences.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ agent:
55
name: "GPT"
66
role: "Implementation & Testing Specialist"
77
version: "ChatGPT-4 / ChatGPT-4 Turbo"
8+
# 交流语言:跟随用户输入
9+
communication_language: "Adaptive (Match user's language)"
810

911
# 擅长的任务类型
1012
strengths:

.ai-agents/scripts/README.md

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
# FIT Framework 公共脚本
2+
3+
本目录包含 FIT Framework 的公共工具脚本,供测试命令和其他自动化任务调用。
4+
5+
## 脚本列表
6+
7+
### 1. fit-service.sh - FIT 服务管理脚本
8+
9+
提供 FIT 服务的启动、验证、停止和清理功能。
10+
11+
#### 功能模块
12+
13+
| 函数 | 说明 | 返回值 |
14+
|------|------|--------|
15+
| `init_log_dir()` | 初始化日志目录 `.ai-workspace/logs` | - |
16+
| `init_plugin_dir()` | 创建动态插件目录 `dynamic-plugins` | - |
17+
| `start_fit_service([log_file])` | 启动 FIT 服务,等待健康检查(60秒超时) | 0=成功, 1=失败 |
18+
| `verify_health()` | 验证健康检查接口 `/actuator/health` | 0=成功, 1=失败 |
19+
| `verify_plugins()` | 验证插件列表接口 `/actuator/plugins` | 0=成功, 1=失败 |
20+
| `verify_swagger()` | 验证 Swagger 文档页面 `/openapi.html` | 0=成功, 1=失败 |
21+
| `verify_all()` | 执行所有验证(health + plugins + swagger) | 0=成功, 1=失败 |
22+
| `stop_fit_service()` | 停止 FIT 服务进程 | - |
23+
| `cleanup([clean_build])` | 清理测试环境,可选清理构建产物 | - |
24+
25+
#### 全局变量
26+
27+
- `FIT_PID` - FIT 服务进程 ID(由 `start_fit_service` 设置)
28+
- `FIT_LOG` - FIT 服务日志文件路径(由 `start_fit_service` 设置)
29+
30+
#### 使用示例
31+
32+
##### 在脚本中调用
33+
34+
```bash
35+
#!/bin/bash
36+
37+
# 加载公共脚本
38+
source .ai-agents/scripts/fit-service.sh
39+
40+
# 初始化环境
41+
init_log_dir
42+
init_plugin_dir
43+
44+
# 启动服务
45+
start_fit_service
46+
if [ $? -ne 0 ]; then
47+
echo "服务启动失败"
48+
exit 1
49+
fi
50+
51+
# 执行验证
52+
verify_all
53+
TEST_RESULT=$?
54+
55+
# 清理环境
56+
cleanup false # 保留构建产物
57+
exit $TEST_RESULT
58+
```
59+
60+
##### 直接运行
61+
62+
```bash
63+
# 启动服务
64+
.ai-agents/scripts/fit-service.sh start
65+
66+
# 验证接口
67+
.ai-agents/scripts/fit-service.sh verify
68+
69+
# 停止服务
70+
.ai-agents/scripts/fit-service.sh stop
71+
72+
# 清理环境(保留构建产物)
73+
.ai-agents/scripts/fit-service.sh cleanup
74+
75+
# 清理环境(包含构建产物)
76+
.ai-agents/scripts/fit-service.sh cleanup true
77+
```
78+
79+
#### 特性
80+
81+
- ✅ 自动端口占用检测(8080)
82+
- ✅ 60秒服务启动超时
83+
- ✅ 进程存活检查
84+
- ✅ 彩色日志输出
85+
- ✅ 详细错误信息
86+
- ✅ 支持独立运行或作为库加载
87+
88+
### 2. run-test.sh - 完整测试流程
89+
90+
执行完整的 FIT Framework 测试流程(构建 + 集成测试)。
91+
92+
#### 使用方法
93+
94+
```bash
95+
.ai-agents/scripts/run-test.sh
96+
```
97+
98+
## 调用关系
99+
100+
```
101+
.opencode/commands/
102+
├── test.md → 调用 fit-service.sh(完整测试)
103+
└── integration-test.md → 调用 fit-service.sh(仅集成测试)
104+
105+
.ai-agents/scripts/
106+
├── fit-service.sh ← 被测试命令调用
107+
└── run-test.sh ← 独立测试脚本
108+
```
109+
110+
## 维护指南
111+
112+
### 添加新功能
113+
114+
1.`fit-service.sh` 中添加新函数
115+
2. 更新本 README 的功能列表
116+
3. 在测试命令中调用新函数
117+
118+
### 修改现有功能
119+
120+
1. 修改 `fit-service.sh` 中的函数实现
121+
2. 确保向后兼容,或同步更新调用方
122+
3. 更新本 README 文档
123+
124+
### 脚本规范
125+
126+
- ✅ 使用 `set -e` 遇错即停
127+
- ✅ 提供清晰的日志输出(log_info/log_error/log_warn)
128+
- ✅ 函数返回值:0=成功, 1=失败
129+
- ✅ 支持独立运行和作为库加载
130+
- ✅ 添加详细的函数注释
131+
132+
## 日志说明
133+
134+
所有脚本的日志输出到 `.ai-workspace/logs/` 目录:
135+
136+
- `maven-build-{timestamp}.log` - Maven 构建日志
137+
- `fit-server-{timestamp}.log` - FIT 服务启动日志
138+
139+
日志文件在测试完成后保留,便于问题排查。

0 commit comments

Comments
 (0)