refactor: extract magic numbers as named constants in diagnose report

Co-authored-by: qinfendebingshuo <207279273+qinfendebingshuo@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-03-13 13:55:14 +00:00
parent cecde1d924
commit 983fd6e951
1 changed files with 6 additions and 3 deletions

View File

@ -24,6 +24,9 @@ const HEALTH_REPORT = process.env.HEALTH_REPORT || '';
const NOTION_VERSION = '2022-06-28';
const NOTION_API_HOSTNAME = 'api.notion.com';
const NOTION_RICH_TEXT_MAX = 2000;
const MAX_PM2_REPORT_LENGTH = 3000;
const MAX_CLEANUP_REPORT_LENGTH = 2000;
const MAX_HEALTH_REPORT_LENGTH = 3000;
// ══════════════════════════════════════════════════════════
// Notion API 工具
@ -100,21 +103,21 @@ function buildReportContent() {
if (PM2_REPORT) {
sections.push('## 阶段一 · PM2 诊断结果');
sections.push('');
sections.push(PM2_REPORT.slice(0, 3000));
sections.push(PM2_REPORT.slice(0, MAX_PM2_REPORT_LENGTH));
sections.push('');
}
if (CLEANUP_REPORT) {
sections.push('## 清理操作结果');
sections.push('');
sections.push(CLEANUP_REPORT.slice(0, 2000));
sections.push(CLEANUP_REPORT.slice(0, MAX_CLEANUP_REPORT_LENGTH));
sections.push('');
}
if (HEALTH_REPORT) {
sections.push('## 阶段二 · 全系统健康检查');
sections.push('');
sections.push(HEALTH_REPORT.slice(0, 3000));
sections.push(HEALTH_REPORT.slice(0, MAX_HEALTH_REPORT_LENGTH));
sections.push('');
}