refactor(quality): Q36 predictUtils.ts 巨型工具文件拆分 — 716L→49L barrel re-export (-93%)
提取 3 个域文件: - predict-types.ts 140L: 类型定义 + 共享常量 (METRIC_DEFS/TIME_RANGE_*) - capacity-predict.ts 194L: 容量预测 (linearRegression + extractSeries + computePredictions + capacityRecommendation + trendColorClass + buildCapacityInsightPrompt) - cost-predict.ts 434L: 云成本预测 (monthStartDate + daysRemainingInMonth + aggregateDailyCosts + sumMonthCost + costRecommendation + computeCostPredictions + buildCostInsightPrompt + 私有函数 forecastMonthEnd/detectBillingPattern/recentRunRate/topServicesByCost/budgetRiskAction) predictUtils.ts 改为 barrel re-export 保持向后兼容, 3 个消费者 (AIPredictiveAnalytics/PredictiveCostTab/PredictiveCapacityTab) import 路径无需修改。 零逻辑变更, tsc -b=0, npm build✓ (17.26s), ESLint errors=0/warnings=66/any=0, go build=0, 17/17 集成测试通过
This commit is contained in:
1 parent
4283fb93c1
commit
a2edf6aa9f
5 files changed
+809
-707
No files matched your search
@@ -507,6 +507,7 @@ services/api.ts (1324L)
|
||||
| Q33 | 前端巨型组件拆分(DashboardRecent 518L→25L (-95%),提取 dashboard-recent/ 7 个文件 (types 48L + shared-components(StatusDot/SeverityBadge) 35L + AlertMessagesCard 72L + CertificateExpiryCard 99L + ReleaseHistoryCard 99L + OpsOverviewCard 77L + KubernetesClusterCard 97L),主文件改为 barrel re-export 保持向后兼容,tsc -b=0,npm build✓,ESLint=0/0/0,go build=0,17/17 测试通过) | P0 | **done** |
|
||||
| Q34 | 前端巨型组件拆分(AIOpsAssistant 505L→288L (-43%),提取 aiops-assistant/ 5 个文件 (types 39L Message/QuickAction/defaultConfig/fmtTime + context-loaders.ts 69L loadAlerts/loadMetrics/loadReport 3 个平台数据加载纯函数 + quick-actions.tsx 17L + ChatMessage 47L 消息气泡(含 streaming/thinking/error 状态) + AssistantSidebar 76L 快捷操作+能力卡片),tsc -b=0,npm build✓,ESLint=0/0/0,go build=0,17/17 测试通过) | P0 | **done** |
|
||||
| Q35 | 前端巨型组件拆分(AgentCLI 521L→399L (-23%),提取 agent-cli/ 2 个文件 (event-handler.ts 149L createWsEventHandler 工厂函数封装 8 种 WS 事件分发+高危命令确认 + ChatInputArea.tsx 44L 受控输入区组件),导出 ConfirmOptions 接口供跨模块引用,tsc -b=0,npm build✓,ESLint=0/66/0,go build=0,17/17 测试通过。最后一个 ≥500L 业务组件拆分完成,剩余最大业务组件 UnifiedQueryPanel 529L(已从 682L 拆分)) | P0 | **done** |
|
||||
| Q36 | 前端巨型工具文件拆分(predictUtils.ts 716L→49L barrel re-export (-93%),提取 predict-types.ts 140L 类型+常量 + capacity-predict.ts 194L 容量预测函数(linearRegression+computePredictions+buildCapacityInsightPrompt) + cost-predict.ts 434L 云成本预测函数(computeCostPredictions+buildCostInsightPrompt),3 个消费者 import 路径无需修改,tsc -b=0,npm build✓ (17.26s),ESLint=0/66/0,go build=0,17/17 测试通过) | P0 | **done** |
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in new issue
Block a user