fix: address Codex review feedback (3 issues)

- Fix SDK check to verify local node_modules instead of global npm
- Align monitor metrics documentation with CLI flags (CPU/Memory)
- Add pagination support for instance listing (--page, --page-size)
This commit is contained in:
leo-jiqimao 2026-03-15 08:18:26 +08:00
parent 101d5618d1
commit d250d6efa7
4 changed files with 61 additions and 16 deletions

38
PR_DESCRIPTION.md Normal file
View File

@ -0,0 +1,38 @@
# PR Description
## What & Why
Improved the "good first issue" link in CONTRIBUTING.md to directly filter issues with the label, making it easier for new contributors to find entry points.
### Before
```
Check the [GitHub Issues](https://github.com/openclaw/openclaw/issues) for "good first issue" labels!
```
- Required manual filtering
- Extra step for newcomers
### After
```
Check the [good first issues](https://github.com/openclaw/openclaw/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) to get started!
```
- One-click access to filtered issues
- Better newcomer experience
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [x] Documentation improvement
## Testing
- [x] Verified the link works correctly
- [x] Checked markdown rendering
## Checklist
- [x] Change is focused (single concern)
- [x] Description explains what & why
- [ ] ~~Screenshots included~~ (N/A - text change only)
---
**Note:** This is my first contribution to OpenClaw. Excited to be part of the community! 🦞

View File

@ -122,15 +122,15 @@ aliyun-ecs restart --region cn-hangzhou --id i-xxxxxxxxxx
```bash
# 获取监控数据CPU、内存、网络
aliyun-ecs monitor --region cn-hangzhou --id i-xxxxxxxxxx --metrics CPUUtilization,MemoryUtilization
aliyun-ecs monitor --region cn-hangzhou --id i-xxxxxxxxxx --metrics CPU,Memory
# 支持的监控指标:
# CPUUtilization - CPU使用率
# MemoryUtilization - 内存使用率
# InternetInRate - 公网入带宽
# InternetOutRate - 公网出带宽
# DiskReadIOPS - 磁盘读IOPS
# DiskWriteIOPS - 磁盘写IOPS
# CPU - CPU使用率
# Memory - 内存使用率
# InternetIn - 公网入带宽(Kbps)
# InternetOut - 公网出带宽(Kbps)
# IntranetIn - 内网入带宽(Kbps)
# IntranetOut - 内网出带宽(Kbps)
```
### 快照管理

View File

@ -32,16 +32,12 @@ node_check() {
# 检查阿里云SDK
sdk_check() {
if npm list -g @alicloud/openapi-client &> /dev/null; then
# 优先检查本地 node_modulesskill 运行时从这里加载)
if [ -d "$SCRIPT_DIR/../node_modules/@alicloud/openapi-client" ] && [ -d "$SCRIPT_DIR/../node_modules/@alicloud/ecs20140526" ]; then
echo -e "${GREEN}✓ 阿里云SDK已安装${NC}"
return 0
fi
if npm list @alicloud/openapi-client &> /dev/null 2>&1; then
echo -e "${GREEN}✓ 阿里云SDK已安装本地${NC}"
return 0
fi
echo -e "${YELLOW}⚠ 阿里云SDK未安装${NC}"
return 1
}

View File

@ -136,10 +136,20 @@ async function main() {
console.error('错误: 请提供 --region 参数');
process.exit(1);
}
const instances = await ecs.describeInstances(options.region);
console.log(`\n地域 ${options.region} 的实例列表:\n`);
const pageSize = parseInt(options['page-size']) || 20;
const pageNumber = parseInt(options.page) || 1;
const listOptions = {
pageSize: pageSize,
pageNumber: pageNumber,
};
const instances = await ecs.describeInstances(options.region, listOptions);
console.log(`\n地域 ${options.region} 的实例列表 (第${pageNumber}页, 每页${pageSize}条):\n`);
if (instances.length === 0) {
console.log('暂无实例');
if (pageNumber > 1) {
console.log('该页无实例,可能是已到达末尾');
} else {
console.log('暂无实例');
}
} else {
console.log(formatTable(instances.map(inst => ({
...inst,
@ -152,6 +162,7 @@ async function main() {
{ key: 'instanceType', header: '类型' },
{ key: 'ip', header: 'IP地址' },
]));
console.log(`\n提示: 使用 --page N 查看下一页,--page-size N 调整每页数量`);
}
break;
}