- All 7 tasks archived (T1-T7 in .agent/archive/tasks/) - All 7 requests approved and moved to .agent/archive/requests/ - .agent/archive/index.json created - .agent/context/project-state.md updated (post-refactor snapshot) - .agent/handoff-summary.md (full summary for next agent) - .agent/session-summary.md (phase-level summary) - .agent/roadmap/sources.md (updated priorities) - .agent/checkpoints.json: handoff=completed All 8 phases completed: INIT, ANALYSE, ROADMAP, DECOMPOSITION, EXECUTION, METASTATE, HANDOFF (DESIGN skipped for existing project).
4.2 KiB
Task Manifest
Session: metaagent-005
Goal: Серьёзный архитектурный рефактор
Date: 2026-10-08
Total tasks: 7
T1: Реструктуризация в domain/application/infrastructure + version=1
Зависимости: — Файлы: domain/ (new), application/ (new), infrastructure/{cli,sync,ai}/ (new), tests/
Что: Ввести явные слои. Переместить пакеты. Добавить version: 1 в FinancialModel.
Acceptance:
- Структура domain/application/infrastructure создана
- Все исходные файлы перемещены
- Все импорты обновлены
FinancialModel.to_dict()→{'version': 1, ...}from_dict()поддерживает v0 (без version) и v1- pytest 63/63
T2: Pydantic v2 — миграция моделей
Зависимости: T1 Файлы: domain/*.py, pyproject.toml, infrastructure/sync/excel_sync.py
Что: @dataclass → pydantic.BaseModel. Удалить ручные to_dict/from_dict.
Acceptance:
- Все модели —
BaseModel - Удалены ручные to_dict/from_dict
- UUID в JSON как str
- Валидация (balance >= 0, и т.п.)
- Excel-sync адаптирован
- pytest 63/63
T3: Decimal для денег
Зависимости: T2 Файлы: domain/.py, application/.py, infrastructure/sync/excel_sync.py, infrastructure/cli/{main,config}.py
Что: float → Decimal для всех monetary полей. Арифметика engine, форматирование.
Acceptance:
- monetary поля —
Decimal - CurrencyConverter с Decimal
- ForecastService арифметика — Decimal
- Excel-sync читает числа как Decimal
- rich.print форматирует Decimal (2 знака)
- JSON-сериализация Decimal работает
- pytest 63/63
T4: Repository pattern — ModelRepository
Зависимости: T1 Файлы: application/repositories/model_repository.py, infrastructure/repositories/{json_file,excel}_repository.py, infrastructure/sync/excel_sync.py
Что: ModelRepository Protocol + JsonFileRepository + ExcelRepository (адаптер над ExcelSync).
Acceptance:
ModelRepositoryProtocol (load/save)JsonFileRepositoryреализует ProtocolExcelRepositoryреализует ProtocolFinancialModel.save/loadудалены- Тесты на каждый репозиторий
- pytest 63/63
T5: Dependency Injection в сервисах
Зависимости: T4 Файлы: application/forecast.py, scenarios.py, infrastructure/ai/assistant.py, infrastructure/cli/{main,config}.py
Что: Зависимости через конструктор. Composition root в CLI.
Acceptance:
ForecastService.__init__(model, repository, converter)- ScenarioService, AssistantService — то же
- Нет
new ForecastService()внутри других сервисов - CLI собирает граф зависимостей
- pytest 63/63
T6: Декомпозиция CLI
Зависимости: T5 Файлы: infrastructure/cli/main.py → app.py, infrastructure/cli/commands/*.py, infrastructure/cli/{paths,services}.py
Что: 8 команд в отдельных файлах. config.py → paths.py + services.py.
Acceptance:
- Каждая команда в cli/commands/*.py
- cli/paths.py — только пути
- cli/services.py — composition root
- Размер файлов < 100-150 LOC
- Поведение идентично
- pytest 63/63
T7: Финальная валидация
Зависимости: T6 Файлы: tests/, README.md, pyproject.toml
Что: Прогнать pytest, ручная проверка CLI, обновить README.
Acceptance:
- pytest 63/63+
- cf init, cf forecast, cf scenario, cf compare — работают
- cf import data.xlsx → cf export — round-trip
- README.md обновлён под новую структуру