Files
ewoooc/routes/README.md
OoO 07b76870c9
All checks were successful
CD Pipeline / deploy (push) Successful in 1m1s
feat(market-intel): add internal mcp contract
2026-05-18 14:42:25 +08:00

30 lines
2.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 路由模組說明
`app.py` 直接註冊所有 Flask Blueprint`USE_MODULAR_ROUTES``register_blueprints()`
`MODULAR_ENDPOINTS` 與 duplicate cleanup 開關已在 ADR-017 Phase 3f-1 移除。
## 啟動防線
`app.py` 會在啟動時檢查 `app.url_map`,同一組 `(URL, HTTP methods)` 不允許被兩個 endpoint
重複註冊;若發現衝突會直接 `SystemExit`
## 模組清單
| 模組 | 說明 | 主要路由 |
|------|------|----------|
| `dashboard_routes.py` | 商品看板首頁 | `/` |
| `sales_routes.py` | 業績分析與 ABC 明細 | `/sales_analysis`, `/growth_analysis`, `/abc_analysis/detail`, `/api/sales_analysis/*` |
| `system_public_routes.py` | 無 prefix 公開系統頁與監控 | `/health`, `/metrics`, `/ai_automation_smoke`, `/api/ai-automation/smoke*`, `/settings`, `/system_settings`, `/logs`, `/api/logs`, `/api/backup` |
| `system_routes.py` | 內部系統維護 API | `/api/system/*` |
| `edm_routes.py` | EDM 與節慶儀表板 | `/edm`, `/festival` |
| `monthly_routes.py` | 月結分析 | `/monthly_summary_analysis`, `/api/monthly_summary_data` |
| `daily_sales_routes.py` | 當日業績 | `/daily_sales`, `/daily_sales/export*` |
| `market_intel_routes.py` | 市場情報 Phase 29 internal MCP contract preview | `/market_intel`, `/market_intel/*`, `/api/market_intel/status`, `/api/market_intel/schema`, `/api/market_intel/schema_smoke`, `/api/market_intel/schema_db_probe`, `/api/market_intel/platform_seed_db_diff`, `/api/market_intel/legacy_source_bridge`, `/api/market_intel/mcp_readiness`, `/api/market_intel/mcp_tool_contract`, `/api/market_intel/adapters`, `/api/market_intel/dry_run_plan`, `/api/market_intel/discovery_plan`, `/api/market_intel/manual_discovery`, `/api/market_intel/candidate_preview`, `/api/market_intel/platform_seed_plan`, `/api/market_intel/platform_seed_write_guard`, `/api/market_intel/platform_seed_writer_plan`, `/api/market_intel/migration_blueprint`, `/api/market_intel/seed_writer_cli_status`, `/api/market_intel/write_approval_runbook`, `/api/market_intel/deployment_readiness` |
| `api_routes.py` | 通用任務與查詢 API | `/api/run_task`, `/api/history/*` |
| `export_routes.py` | 匯出功能 | `/api/export/*` |
| `import_routes.py` | 匯入功能 | `/api/import_excel`, `/api/import/monthly_summary` |
新增 route 時請優先放入對應 Blueprint並用本機 `app.url_map` duplicate check 驗證。
若 route 內開始出現大量資料處理、SQL、AI prompt 或外部 API 呼叫,請依
`docs/guides/modularization_governance.md` 抽到 `services/``utils/`,不要讓 Blueprint 變成新巨檔。