152 lines
9.0 KiB
Markdown
152 lines
9.0 KiB
Markdown
# Структура проекта
|
|
|
|
```
|
|
project/
|
|
│
|
|
├── app/ # Backend
|
|
│ ├── __init__.py
|
|
│ ├── main.py # FastAPI app: lifespan, middleware, routers, CORS
|
|
│ │
|
|
│ ├── api/ # HTTP слой
|
|
│ │ ├── __init__.py # api_v1_router
|
|
│ │ └── v1/ # Версионированные роуты
|
|
│ │ ├── __init__.py # Сборка всех роутеров
|
|
│ │ ├── auth.py # POST /login, /register, /refresh, /oauth
|
|
│ │ ├── users.py # GET/PATCH /me
|
|
│ │ ├── ideas.py # CRUD /ideas + POST /analyze
|
|
│ │ ├── agents.py # GET /agents + POST /run
|
|
│ │ ├── sync.py # POST /pull, /push
|
|
│ │ └── admin.py # GET /users, /health, /logs
|
|
│ │
|
|
│ ├── core/ # Фундамент
|
|
│ │ ├── __init__.py
|
|
│ │ ├── config.py # Pydantic Settings из .env
|
|
│ │ ├── base.py # SQLBase, CoreModel, UUIDMixin, TimestampMixin
|
|
│ │ ├── database.py # create_async_engine, async_session_maker, get_db
|
|
│ │ ├── security.py # create_token, decode_token, hash/verify password
|
|
│ │ ├── exceptions.py # HTTPException подклассы
|
|
│ │ ├── dependencies.py # get_db, get_current_user, require_admin
|
|
│ │ └── metrics.py # Middleware: request timer, counters
|
|
│ │
|
|
│ ├── models/ # SQLAlchemy модели
|
|
│ │ ├── __init__.py # Все модели в __all__
|
|
│ │ ├── user.py # User: id, email, password, roles
|
|
│ │ ├── idea.py # Idea: title, content, tags, status
|
|
│ │ ├── agent.py # AgentConfig: version, checksum
|
|
│ │ ├── backlog.py # BacklogTask: title, status, priority
|
|
│ │ └── log.py # LogEntry: level, source, message
|
|
│ │
|
|
│ ├── schemas/ # Pydantic схемы (Request/Response)
|
|
│ │ ├── __init__.py # Все схемы в __all__
|
|
│ │ ├── auth.py # LoginRequest, TokenResponse, etc.
|
|
│ │ ├── user.py # UserCreate, UserResponse, etc.
|
|
│ │ ├── idea.py # IdeaCreate, IdeaResponse, AnalyzeResponse
|
|
│ │ ├── agent.py # AgentRunRequest, AgentStatusResponse
|
|
│ │ ├── sync.py # SyncPullRequest, SyncResponse
|
|
│ │ └── admin.py # SystemHealth, LogEntryResponse
|
|
│ │
|
|
│ ├── services/ # Бизнес-логика
|
|
│ │ ├── __init__.py
|
|
│ │ ├── auth_service.py # Регистрация, логин, OAuth
|
|
│ │ ├── user_service.py # CRUD пользователей
|
|
│ │ ├── idea_service.py # CRUD идей
|
|
│ │ ├── agent_service.py # Управление агентами
|
|
│ │ ├── analysis_service.py # Запуск AI-анализа
|
|
│ │ └── sync_service.py # Синхронизация
|
|
│ │
|
|
│ ├── integrations/ # Внешние сервисы
|
|
│ │ ├── __init__.py
|
|
│ │ └── ai/ # AI провайдеры
|
|
│ │ ├── __init__.py # AIProvider, AIResult, FallbackChain
|
|
│ │ ├── base.py # AIProvider ABC, AIResult dataclass
|
|
│ │ ├── prompt_loader.py # Загрузка промптов из YAML/MD
|
|
│ │ ├── yandex_gpt.py # YandexGPTProvider
|
|
│ │ ├── gigachat.py # GigaChatProvider
|
|
│ │ └── fallback.py # FallbackChain
|
|
│ │
|
|
│ ├── tasks/ # Фоновые задачи
|
|
│ │ ├── __init__.py # Celery app (ленивый импорт)
|
|
│ │ └── analysis.py # analyze_idea (Celery или прямой вызов)
|
|
│ │
|
|
│ └── agents/ # Системные агенты
|
|
│ ├── __init__.py
|
|
│ ├── base.py # BaseAgent ABC, AgentResult, AgentStatus
|
|
│ ├── registry.py # AgentRegistry
|
|
│ ├── models.py # AgentState, AgentReport, AgentMetric
|
|
│ ├── triggers.py # Триггеры запуска
|
|
│ ├── doc_agent.py # Пишет документацию
|
|
│ ├── audit_agent.py # Проверяет правила
|
|
│ ├── evolution_agent.py # Версионирует агентов
|
|
│ ├── supervisor_agent.py # Следит за всеми агентами
|
|
│ └── ... # Остальные агенты по необходимости
|
|
│
|
|
├── webui/ # Frontend
|
|
│ ├── index.html
|
|
│ ├── package.json
|
|
│ ├── vite.config.ts # Vite + React + PWA + API proxy
|
|
│ ├── tsconfig.json
|
|
│ ├── tailwind.config.js
|
|
│ ├── postcss.config.js
|
|
│ ├── public/
|
|
│ │ ├── favicon.svg
|
|
│ │ ├── manifest.json
|
|
│ │ └── icons/
|
|
│ └── src/
|
|
│ ├── main.tsx
|
|
│ ├── App.tsx # BrowserRouter + Routes
|
|
│ ├── index.css # Tailwind directives
|
|
│ ├── vite-env.d.ts
|
|
│ ├── api/
|
|
│ │ ├── client.ts # apiFetch, setTokens, refreshAccessToken
|
|
│ │ └── ideas.ts # Типы + функции для /ideas
|
|
│ ├── auth/
|
|
│ │ └── AuthContext.tsx # useAuth() hook
|
|
│ ├── components/
|
|
│ │ ├── Layout.tsx # Header + main
|
|
│ │ └── ProtectedRoute.tsx # Auth guard
|
|
│ └── pages/
|
|
│ ├── LoginPage.tsx
|
|
│ ├── RegisterPage.tsx
|
|
│ ├── Dashboard.tsx # Список идей
|
|
│ ├── IdeaView.tsx # Просмотр + анализ
|
|
│ ├── IdeaCreate.tsx # Создание идеи
|
|
│ ├── IdeaEdit.tsx # Редактирование
|
|
│ └── AdminPage.tsx # Админ-панель
|
|
│
|
|
├── tests/ # Тесты
|
|
│ ├── conftest.py # Глобальные фикстуры
|
|
│ ├── unit/ # Unit-тесты
|
|
│ │ ├── conftest.py
|
|
│ │ └── test_*.py
|
|
│ ├── integration/ # Интеграционные тесты
|
|
│ │ ├── conftest.py
|
|
│ │ ├── test_api.py
|
|
│ │ └── test_db.py
|
|
│ └── smoke/ # Smoke-тесты
|
|
│ └── test_health.py
|
|
│
|
|
├── docs/ # Документация
|
|
│ ├── 00-rules.md
|
|
│ ├── ... (остальные файлы правил)
|
|
│ ├── adr/ # Architecture Decision Records
|
|
│ ├── agents/ # Системные агенты
|
|
│ ├── decisions/ # Руководства по выбору
|
|
│ ├── checklists/ # Чеклисты
|
|
│ └── runbook/ # Эксплуатация
|
|
│
|
|
├── CHANGELOG/ # Версионирование
|
|
│ ├── v1.0.md # CHANGELOG версии 1.0
|
|
│ └── agents/ # Changelog агентов
|
|
│ ├── doc_agent.md
|
|
│ └── ...
|
|
│
|
|
├── migrations/ # Alembic (если PostgreSQL)
|
|
│ └── versions/
|
|
│
|
|
├── .env.example
|
|
├── .gitignore
|
|
├── project.yaml
|
|
├── requirements.txt
|
|
└── README.md
|
|
```
|