Files
nifodea/infrastructure/cli/app.py
T
oqyude 8af1d9a010 D2: починить lint-гейт — ruff check . проходит
Было: `ruff check .` → 10 ошибок, CI-гейт на ruff был бы красным сразу.
- 9× I001 (порядок импортов) — application/forecast.py:1,
  application/scenarios.py:1, domain/currency.py:1,
  infrastructure/ai/assistant.py:1, infrastructure/cli/app.py:11,
  infrastructure/cli/commands/init.py:2, infrastructure/cli/services.py:2,
  tests/test_model.py:1, tests/test_repositories.py:1
- 1× E501 — infrastructure/cli/services.py:30, сигнатура build_services
  перенесена на три строки

Поведение не меняется: переупорядочены только импорты, убраны пустые
строки, перенесена длинная сигнатура. Порядок импорта в app.py не влияет
на момент вызова setup_i18n() — он по-прежнему после импорта команд.

Проверка: 75/75 тестов зелёные, ruff check . — All checks passed.
2026-10-23 18:29:48 +03:00

46 lines
1.1 KiB
Python

"""Entry point приложения cf. Регистрирует все команды."""
import sys
import typer
try:
sys.stdout.reconfigure(encoding="utf-8")
except (AttributeError, OSError):
pass
from infrastructure.cli.commands import (
analyze,
compare,
config_cmd,
export_xlsx,
forecast,
import_xlsx,
info,
init,
scenario,
whatif,
)
from infrastructure.cli.i18n import setup_i18n, t
setup_i18n()
app = typer.Typer(name="cf", help=t("app.help"))
# Команды верхнего уровня
app.command(name="init")(init.init)
app.command(name="forecast")(forecast.forecast)
app.command(name="scenario")(scenario.scenario)
app.command(name="whatif")(whatif.whatif)
app.command(name="compare")(compare.compare)
app.command(name="import-xlsx")(import_xlsx.import_xlsx)
app.command(name="export-xlsx")(export_xlsx.export_xlsx)
app.command(name="analyze")(analyze.analyze)
app.command(name="info")(info.info)
# Под-приложение config
app.add_typer(config_cmd.app, name="config")
if __name__ == "__main__":
app()