archicore 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2267 -374
- package/dist/cli/commands/interactive.js +83 -23
- package/dist/cli/commands/projects.js +3 -3
- package/dist/cli/ui/prompt.d.ts +4 -0
- package/dist/cli/ui/prompt.js +22 -0
- package/dist/cli/utils/config.js +2 -2
- package/dist/cli/utils/upload-utils.js +65 -18
- package/dist/code-index/ast-parser.d.ts +4 -0
- package/dist/code-index/ast-parser.js +42 -0
- package/dist/code-index/index.d.ts +21 -1
- package/dist/code-index/index.js +45 -1
- package/dist/code-index/source-map-extractor.d.ts +71 -0
- package/dist/code-index/source-map-extractor.js +194 -0
- package/dist/gitlab/gitlab-service.d.ts +162 -0
- package/dist/gitlab/gitlab-service.js +652 -0
- package/dist/gitlab/index.d.ts +8 -0
- package/dist/gitlab/index.js +8 -0
- package/dist/server/config/passport.d.ts +14 -0
- package/dist/server/config/passport.js +86 -0
- package/dist/server/index.js +52 -10
- package/dist/server/middleware/api-auth.d.ts +2 -2
- package/dist/server/middleware/api-auth.js +21 -2
- package/dist/server/middleware/csrf.d.ts +23 -0
- package/dist/server/middleware/csrf.js +96 -0
- package/dist/server/routes/auth.d.ts +2 -2
- package/dist/server/routes/auth.js +204 -5
- package/dist/server/routes/device-auth.js +2 -2
- package/dist/server/routes/gitlab.d.ts +12 -0
- package/dist/server/routes/gitlab.js +528 -0
- package/dist/server/routes/oauth.d.ts +6 -0
- package/dist/server/routes/oauth.js +198 -0
- package/dist/server/services/audit-service.d.ts +1 -1
- package/dist/server/services/auth-service.d.ts +13 -1
- package/dist/server/services/auth-service.js +108 -7
- package/dist/server/services/email-service.d.ts +63 -0
- package/dist/server/services/email-service.js +586 -0
- package/dist/server/utils/disposable-email-domains.d.ts +14 -0
- package/dist/server/utils/disposable-email-domains.js +192 -0
- package/dist/types/api.d.ts +98 -0
- package/dist/types/gitlab.d.ts +245 -0
- package/dist/types/gitlab.js +11 -0
- package/package.json +12 -4
package/README.md
CHANGED
|
@@ -1,530 +1,2423 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
1
|
+
# ArchiCore - AI Software Architect
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
**Intelligent AI-Powered Software Architecture Analysis Platform**
|
|
8
|
+
|
|
9
|
+
[](https://www.typescriptlang.org/)
|
|
10
|
+
[](https://nodejs.org/)
|
|
11
|
+
[](LICENSE)
|
|
12
|
+
[](https://www.docker.com/)
|
|
13
|
+
[](https://www.postgresql.org/)
|
|
14
|
+
|
|
15
|
+
[🌐 Website](https://archicore.io) | [📖 Documentation](https://docs.archicore.io) | [🚀 API](https://api.archicore.io)
|
|
16
|
+
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 📋 Table of Contents
|
|
22
|
+
|
|
23
|
+
- [Overview](#overview)
|
|
24
|
+
- [Key Features](#key-features)
|
|
25
|
+
- [Architecture](#architecture)
|
|
26
|
+
- [Technology Stack](#technology-stack)
|
|
27
|
+
- [Quick Start](#quick-start)
|
|
28
|
+
- [Installation](#installation)
|
|
29
|
+
- [Usage](#usage)
|
|
30
|
+
- [Web Dashboard](#web-dashboard)
|
|
31
|
+
- [CLI Tool](#cli-tool)
|
|
32
|
+
- [REST API](#rest-api)
|
|
33
|
+
- [Authentication & Security](#authentication--security)
|
|
34
|
+
- [Configuration](#configuration)
|
|
35
|
+
- [Deployment](#deployment)
|
|
36
|
+
- [API Reference](#api-reference)
|
|
37
|
+
- [Development](#development)
|
|
38
|
+
- [Roadmap](#roadmap)
|
|
39
|
+
- [Contributing](#contributing)
|
|
40
|
+
- [License](#license)
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
**📚 Complete Documentation:**
|
|
45
|
+
- **[API & CLI Reference](./API_CLI_REFERENCE.md)** - Полная документация всех API endpoints, CLI команд и поддерживаемых языков
|
|
46
|
+
- **[TODO](./TODO.md)** - Список задач и планов развития
|
|
47
|
+
- **[Business Model](./BUSINESS-QA.md)** - Бизнес-модель и ответы на вопросы
|
|
48
|
+
- **[Deployment Guide](./DEPLOYMENT.md)** - Инструкция по развертыванию
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## 🎯 Overview
|
|
53
|
+
|
|
54
|
+
**ArchiCore** - это интеллектуальная платформа для анализа и управления архитектурой программного обеспечения, построенная на основе AI. Система понимает код на глубоком семантическом уровне, отслеживает все зависимости и помогает принимать обоснованные архитектурные решения.
|
|
55
|
+
|
|
56
|
+
### Зачем нужен ArchiCore?
|
|
57
|
+
|
|
58
|
+
**Проблема**: В больших проектах разработчики часто вносят изменения, не понимая полного влияния на систему. Это приводит к багам, техническому долгу и архитектурной деградации.
|
|
59
|
+
|
|
60
|
+
**Решение**: ArchiCore анализирует весь код, строит граф зависимостей, использует семантическую память и AI для предсказания влияния изменений, выявления рисков и генерации рекомендаций.
|
|
61
|
+
|
|
62
|
+
### Для кого?
|
|
63
|
+
|
|
64
|
+
- 👨💻 **Software Architects** - контроль архитектуры, выявление нарушений
|
|
65
|
+
- 👩💼 **Tech Leads** - review кода, анализ влияния изменений
|
|
66
|
+
- 🏢 **Development Teams** - снижение багов, улучшение code quality
|
|
67
|
+
- 📊 **CTO/Engineering Managers** - метрики, технический долг, risk assessment
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## ✨ Key Features
|
|
72
|
+
|
|
73
|
+
### 🧠 Intelligent Code Understanding
|
|
74
|
+
|
|
75
|
+
- **AST Parsing** - Глубокий синтаксический анализ через Tree-sitter (40+ языков)
|
|
76
|
+
- **Dependency Graph** - Полный граф зависимостей между компонентами, функциями, классами
|
|
77
|
+
- **Symbol Extraction** - Извлечение всех символов: функции, классы, интерфейсы, переменные
|
|
78
|
+
- **Call Graph Analysis** - Граф вызовов для отслеживания потоков данных
|
|
79
|
+
- **Semantic Memory** - Vector database (Qdrant) для семантического понимания кода
|
|
80
|
+
|
|
81
|
+
### 🎯 Change Impact Analysis
|
|
82
|
+
|
|
83
|
+
- **Real-time Impact Detection** - Определение затронутых компонентов при изменениях
|
|
84
|
+
- **Risk Assessment** - Автоматическая оценка рисков (Critical, High, Medium, Low)
|
|
85
|
+
- **Dependency Tracking** - Отслеживание прямых и транзитивных зависимостей
|
|
86
|
+
- **Impact Visualization** - Графическое представление влияния изменений
|
|
87
|
+
- **Smart Recommendations** - AI-генерируемые рекомендации по снижению рисков
|
|
88
|
+
|
|
89
|
+
### 🔍 Semantic Code Search
|
|
90
|
+
|
|
91
|
+
- **Natural Language Queries** - Поиск по смыслу: "функции обработки платежей"
|
|
92
|
+
- **Vector Similarity** - Поиск семантически похожих фрагментов кода
|
|
93
|
+
- **Context-Aware Results** - Результаты с учетом контекста и зависимостей
|
|
94
|
+
- **Multi-language Support** - Поиск во всех поддерживаемых языках одновременно
|
|
95
|
+
|
|
96
|
+
### 🤖 AI Architect Assistant
|
|
97
|
+
|
|
98
|
+
- **Architectural Questions** - "Как организована аутентификация в системе?"
|
|
99
|
+
- **Code Review** - Автоматический анализ качества и соответствия best practices
|
|
100
|
+
- **Documentation Generation** - Генерация архитектурной документации
|
|
101
|
+
- **Refactoring Suggestions** - Предложения по улучшению архитектуры
|
|
102
|
+
- **Dead Code Detection** - Выявление неиспользуемого кода
|
|
103
|
+
- **Code Duplication Analysis** - Поиск дублирования для рефакторинга
|
|
104
|
+
|
|
105
|
+
### 🔐 Enterprise-Grade Security
|
|
106
|
+
|
|
107
|
+
- **Multi-Provider OAuth** - Google, GitHub authentication
|
|
108
|
+
- **Email Verification** - 6-значные коды, SMTP integration (Zoho)
|
|
109
|
+
- **Disposable Email Protection** - Блокировка 180+ временных email доменов
|
|
110
|
+
- **JWT Authentication** - Secure token-based auth
|
|
111
|
+
- **Device Flow** - Безопасная CLI авторизация через web browser
|
|
112
|
+
- **API Keys Management** - Создание, ротация, отзыв API ключей
|
|
113
|
+
- **Audit Logs** - Полное логирование всех действий пользователей
|
|
114
|
+
- **Rate Limiting** - Защита от abuse и DDoS
|
|
115
|
+
- **CORS & Helmet** - Защита web endpoints
|
|
116
|
+
- **bcrypt Password Hashing** - Industry-standard password security
|
|
117
|
+
- **AES-256 Encryption** - Шифрование чувствительных данных
|
|
118
|
+
|
|
119
|
+
### 📊 Project Management
|
|
120
|
+
|
|
121
|
+
- **Multi-Project Support** - Управление несколькими проектами
|
|
122
|
+
- **Team Collaboration** - Совместная работа команд (до 20 разработчиков)
|
|
123
|
+
- **GitHub Integration** - Автоматический анализ PR, webhooks
|
|
124
|
+
- **Version Control** - Отслеживание изменений архитектуры
|
|
125
|
+
- **Progress Tracking** - Метрики качества и технического долга
|
|
126
|
+
|
|
127
|
+
### 🌐 Multiple Interfaces
|
|
128
|
+
|
|
129
|
+
- **Web Dashboard** - Интуитивный UI для визуализации и управления
|
|
130
|
+
- **CLI Tool** - Мощный command-line interface для automation
|
|
131
|
+
- **REST API** - Полное API для интеграции с CI/CD и другими системами
|
|
132
|
+
- **Webhooks** - GitHub webhooks для автоматического анализа
|
|
133
|
+
|
|
134
|
+
### 📈 Analytics & Metrics
|
|
135
|
+
|
|
136
|
+
- **Code Metrics** - Cyclomatic complexity, lines of code, maintainability index
|
|
137
|
+
- **Architecture Metrics** - Coupling, cohesion, modularity scores
|
|
138
|
+
- **Technical Debt Tracking** - Идентификация и quantification технического долга
|
|
139
|
+
- **Trend Analysis** - Отслеживание изменений метрик во времени
|
|
140
|
+
- **Custom Dashboards** - Настраиваемые дашборды для команд
|
|
141
|
+
|
|
142
|
+
### 🚀 Developer Experience
|
|
143
|
+
|
|
144
|
+
- **60+ Language Support** - TypeScript, JavaScript, Python, Go, Rust, Java, Kotlin, Scala, C#, F#, Swift, Dart, PHP, Ruby, Haskell, Elixir и другие
|
|
145
|
+
- **IDE Integration** - VS Code, JetBrains (в разработке)
|
|
146
|
+
- **CI/CD Ready** - Интеграция с GitLab CI, GitHub Actions, Jenkins
|
|
147
|
+
- **Docker Support** - Полная containerization для легкого deployment
|
|
148
|
+
- **Auto-Scaling** - Поддержка горизонтального масштабирования
|
|
149
|
+
- **Real-time Updates** - Live reload при изменениях кода
|
|
150
|
+
- **Interactive CLI** - Autocomplete, progress bars, colored output
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## 🏗️ Architecture
|
|
155
|
+
|
|
156
|
+
ArchiCore построен по принципам чистой архитектуры с четким разделением слоев:
|
|
157
|
+
|
|
158
|
+
```
|
|
159
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
160
|
+
│ Web Dashboard │
|
|
161
|
+
│ (React/Vue-like SPA - public/*.html) │
|
|
162
|
+
│ - Project Management - Analytics - Settings - Admin Panel │
|
|
163
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
164
|
+
↓ HTTPS/API
|
|
165
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
166
|
+
│ API Gateway (Express 5) │
|
|
167
|
+
│ OAuth, JWT Auth, Rate Limiting, CORS, Helmet, Audit Logging │
|
|
168
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
169
|
+
↓
|
|
170
|
+
┌─────────────────────┼─────────────────────┐
|
|
171
|
+
↓ ↓ ↓
|
|
172
|
+
┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐
|
|
173
|
+
│ Authentication │ │ Project Core │ │ Analysis Engine │
|
|
174
|
+
│ - OAuth 2.0 │ │ - Code Indexing │ │ - Impact Analysis│
|
|
175
|
+
│ - Email Verify │ │ - AST Parsing │ │ - Risk Assessment│
|
|
176
|
+
│ - Device Flow │ │ - Dependency Gr.│ │ - Recommendations│
|
|
177
|
+
│ - API Keys │ │ - Metrics │ │ - Dead Code Det. │
|
|
178
|
+
└──────────────────┘ └──────────────────┘ └──────────────────┘
|
|
179
|
+
↓ ↓ ↓
|
|
180
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
181
|
+
│ Semantic Memory Layer │
|
|
182
|
+
│ - Vector Embeddings (Jina AI) - Semantic Search (Qdrant) │
|
|
183
|
+
│ - Code Similarity - Natural Language Queries │
|
|
184
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
185
|
+
↓ ↓ ↓
|
|
186
|
+
┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐
|
|
187
|
+
│ PostgreSQL │ │ Redis │ │ Qdrant │
|
|
188
|
+
│ - Users, Auth │ │ - Cache Layer │ │ - Vector Store │
|
|
189
|
+
│ - Projects │ │ - Sessions │ │ - Embeddings │
|
|
190
|
+
│ - Audit Logs │ │ - Rate Limits │ │ - Similarity │
|
|
191
|
+
└──────────────────┘ └──────────────────┘ └──────────────────┘
|
|
192
|
+
↓ ↓ ↓
|
|
193
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
194
|
+
│ AI Orchestration Layer │
|
|
195
|
+
│ - Claude (Anthropic) - GPT (OpenAI) - DeepSeek (Budget) │
|
|
196
|
+
│ - Context Management - Prompt Optimization - Response Caching │
|
|
197
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Data Flow
|
|
201
|
+
|
|
202
|
+
1. **User Authentication** → OAuth/Email verification → JWT token
|
|
203
|
+
2. **Project Creation** → GitHub sync / Local upload → File indexing
|
|
204
|
+
3. **Code Indexing** → AST Parsing (Tree-sitter) → Symbol extraction → Dependency graph
|
|
205
|
+
4. **Semantic Embedding** → Code chunks → Jina AI → Vector storage (Qdrant)
|
|
206
|
+
5. **Change Analysis** → Modified files → Impact engine → Affected components → Risk assessment
|
|
207
|
+
6. **AI Query** → User question → Context retrieval → LLM (Claude/GPT) → Structured response
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## 🛠️ Technology Stack
|
|
212
|
+
|
|
213
|
+
### Backend
|
|
214
|
+
- **Runtime**: Node.js 18+ (LTS)
|
|
215
|
+
- **Language**: TypeScript 5.3
|
|
216
|
+
- **Framework**: Express 5.0
|
|
217
|
+
- **Authentication**: Passport.js (OAuth 2.0), JWT
|
|
218
|
+
- **Validation**: Zod, Express Validator
|
|
219
|
+
|
|
220
|
+
### Databases
|
|
221
|
+
- **Primary Database**: PostgreSQL 15 (users, projects, audit logs)
|
|
222
|
+
- **Cache Layer**: Redis 7 (sessions, rate limiting, temporary data)
|
|
223
|
+
- **Vector Database**: Qdrant (semantic embeddings, similarity search)
|
|
224
|
+
|
|
225
|
+
### AI & ML
|
|
226
|
+
- **LLM Providers**:
|
|
227
|
+
- Anthropic Claude (Opus 4.5, Sonnet 4.5) - Recommended
|
|
228
|
+
- OpenAI GPT (GPT-4 Turbo, GPT-4)
|
|
229
|
+
- DeepSeek (deepseek-chat, deepseek-coder) - Budget option
|
|
230
|
+
- **Embeddings**: Jina AI (jina-embeddings-v2-base-code)
|
|
231
|
+
- **Code Parsing**: Tree-sitter (40+ languages)
|
|
232
|
+
|
|
233
|
+
### Frontend
|
|
234
|
+
- **Architecture**: Vanilla JavaScript (SPA-like)
|
|
235
|
+
- **Styling**: Tailwind-like custom CSS
|
|
236
|
+
- **Build**: Vite (development), Custom minification & obfuscation
|
|
237
|
+
- **State Management**: localStorage + fetch API
|
|
238
|
+
|
|
239
|
+
### Infrastructure
|
|
240
|
+
- **Containerization**: Docker, Docker Compose
|
|
241
|
+
- **Reverse Proxy**: Nginx (SSL termination, load balancing)
|
|
242
|
+
- **SSL**: Let's Encrypt (auto-renewal)
|
|
243
|
+
- **CI/CD**: GitLab CI/CD
|
|
244
|
+
- **Monitoring**: Custom logging + Audit service
|
|
245
|
+
|
|
246
|
+
### Email & Notifications
|
|
247
|
+
- **SMTP**: Zoho Mail (verification codes, welcome emails)
|
|
248
|
+
- **Templates**: HTML email templates with branding
|
|
249
|
+
- **Rate Limiting**: 30s cooldown between resends
|
|
250
|
+
|
|
251
|
+
### Security
|
|
252
|
+
- **Password Hashing**: bcrypt (10 rounds)
|
|
253
|
+
- **Encryption**: AES-256-GCM (sensitive data)
|
|
254
|
+
- **CORS**: Configurable whitelist
|
|
255
|
+
- **Headers**: Helmet.js (CSP, HSTS, XSS protection)
|
|
256
|
+
- **Rate Limiting**: Express rate limit (100 req/15min)
|
|
257
|
+
- **Disposable Email**: 180+ domain blacklist
|
|
258
|
+
|
|
259
|
+
### Development Tools
|
|
260
|
+
- **Package Manager**: npm
|
|
261
|
+
- **Linting**: ESLint
|
|
262
|
+
- **Formatting**: Prettier
|
|
263
|
+
- **Testing**: Jest (planned)
|
|
264
|
+
- **Git Hooks**: Husky (planned)
|
|
265
|
+
|
|
266
|
+
### Supported Languages
|
|
267
|
+
**60+ языков** через Tree-sitter AST parsing и regex-based analysis:
|
|
268
|
+
|
|
269
|
+
**JavaScript/TypeScript Ecosystem:** TypeScript, JavaScript, JSX/TSX, Vue.js, Svelte, Astro
|
|
270
|
+
**Systems Programming:** Go, Rust, Zig, Nim, C, C++
|
|
271
|
+
**JVM Languages:** Java, Kotlin, Scala, Groovy, Clojure
|
|
272
|
+
**.NET Languages:** C#, F#, Visual Basic
|
|
273
|
+
**Web/Scripting:** PHP, Ruby, Perl, Lua
|
|
274
|
+
**Mobile:** Swift, Dart/Flutter, Objective-C
|
|
275
|
+
**Functional:** Haskell, OCaml, Erlang, Elixir, Julia, R
|
|
276
|
+
**Other:** Python, Crystal
|
|
277
|
+
**Markup/Styles:** HTML, CSS, SCSS, Sass, Less, Stylus, XML
|
|
278
|
+
**Data Formats:** JSON, YAML, TOML, INI
|
|
279
|
+
**Database:** SQL, Prisma, GraphQL
|
|
280
|
+
**Infrastructure:** Terraform, Protobuf, Docker, Makefile, CMake
|
|
281
|
+
**Shell:** Bash, Zsh, PowerShell, Batch
|
|
282
|
+
**Documentation:** Markdown, reStructuredText
|
|
283
|
+
|
|
284
|
+
📖 **[Complete Language Support Matrix →](./API_CLI_REFERENCE.md#supported-languages)**
|
|
285
|
+
|
|
286
|
+
---
|
|
287
|
+
|
|
288
|
+
## 🚀 Quick Start
|
|
289
|
+
|
|
290
|
+
### Prerequisites
|
|
291
|
+
|
|
292
|
+
- **Node.js** 18+ ([Download](https://nodejs.org/))
|
|
293
|
+
- **Docker** (optional but recommended) ([Download](https://www.docker.com/))
|
|
294
|
+
- **PostgreSQL** 15+ (или через Docker)
|
|
295
|
+
- **Redis** 7+ (или через Docker)
|
|
296
|
+
|
|
297
|
+
### 1. Clone Repository
|
|
96
298
|
|
|
97
299
|
```bash
|
|
98
|
-
|
|
300
|
+
git clone https://github.com/yourusername/archicore.git
|
|
301
|
+
cd archicore
|
|
99
302
|
```
|
|
100
303
|
|
|
101
|
-
###
|
|
304
|
+
### 2. Install Dependencies
|
|
102
305
|
|
|
103
|
-
|
|
306
|
+
```bash
|
|
307
|
+
npm install
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
### 3. Configure Environment
|
|
104
311
|
|
|
105
312
|
```bash
|
|
106
313
|
cp .env.example .env
|
|
107
314
|
```
|
|
108
315
|
|
|
109
|
-
Заполните
|
|
316
|
+
Заполните `.env` своими ключами:
|
|
110
317
|
|
|
111
318
|
```env
|
|
112
|
-
#
|
|
113
|
-
|
|
114
|
-
|
|
319
|
+
# Server
|
|
320
|
+
PORT=3000
|
|
321
|
+
NODE_ENV=production
|
|
322
|
+
BASE_URL=http://localhost:3000
|
|
323
|
+
|
|
324
|
+
# Database
|
|
325
|
+
DATABASE_URL=postgresql://postgres:password@localhost:5432/archicore
|
|
326
|
+
|
|
327
|
+
# Redis
|
|
328
|
+
REDIS_URL=redis://localhost:6379
|
|
115
329
|
|
|
116
|
-
# Vector
|
|
330
|
+
# Qdrant Vector DB
|
|
117
331
|
QDRANT_URL=http://localhost:6333
|
|
118
|
-
QDRANT_API_KEY=
|
|
119
332
|
|
|
120
|
-
#
|
|
121
|
-
|
|
333
|
+
# AI Providers (выберите один или несколько)
|
|
334
|
+
ANTHROPIC_API_KEY=sk-ant-xxx # Рекомендуется для production
|
|
335
|
+
OPENAI_API_KEY=sk-xxx # Альтернатива
|
|
336
|
+
DEEPSEEK_API_KEY=sk-xxx # Бюджетный вариант
|
|
337
|
+
JINA_API_KEY=jina_xxx # Для embeddings
|
|
338
|
+
|
|
339
|
+
# OAuth (опционально)
|
|
340
|
+
GOOGLE_CLIENT_ID=xxx.apps.googleusercontent.com
|
|
341
|
+
GOOGLE_CLIENT_SECRET=GOCSPX-xxx
|
|
342
|
+
GITHUB_CLIENT_ID=xxx
|
|
343
|
+
GITHUB_CLIENT_SECRET=xxx
|
|
344
|
+
|
|
345
|
+
# Email (для verification)
|
|
346
|
+
ZOHO_SMTP_USER=noreply@archicore.io
|
|
347
|
+
ZOHO_SMTP_PASS=xxx
|
|
348
|
+
EMAIL_FROM_ADDRESS=noreply@archicore.io
|
|
349
|
+
EMAIL_FROM_NAME=ArchiCore
|
|
350
|
+
|
|
351
|
+
# Security
|
|
352
|
+
JWT_SECRET=your-super-secret-jwt-key-change-this
|
|
353
|
+
ENCRYPTION_KEY=your-32-char-encryption-key-here
|
|
354
|
+
SESSION_SECRET=your-session-secret-change-this
|
|
355
|
+
|
|
356
|
+
# Admin
|
|
357
|
+
ADMIN_EMAIL=admin@archicore.io
|
|
122
358
|
```
|
|
123
359
|
|
|
124
|
-
### 4.
|
|
360
|
+
### 4. Start with Docker (Recommended)
|
|
125
361
|
|
|
126
|
-
|
|
362
|
+
```bash
|
|
363
|
+
# Запустить все сервисы (PostgreSQL, Redis, Qdrant, ArchiCore)
|
|
364
|
+
docker compose up -d
|
|
365
|
+
|
|
366
|
+
# Проверить логи
|
|
367
|
+
docker compose logs -f archicore
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
ArchiCore будет доступен на:
|
|
371
|
+
- **Dashboard**: http://localhost:3000
|
|
372
|
+
- **API**: http://localhost:3000/api
|
|
373
|
+
|
|
374
|
+
### 5. Start Manually (Alternative)
|
|
127
375
|
|
|
128
376
|
```bash
|
|
129
|
-
#
|
|
130
|
-
|
|
377
|
+
# Запустить PostgreSQL
|
|
378
|
+
docker run -d --name postgres -p 5432:5432 \
|
|
379
|
+
-e POSTGRES_PASSWORD=password \
|
|
380
|
+
-e POSTGRES_DB=archicore \
|
|
381
|
+
postgres:15
|
|
382
|
+
|
|
383
|
+
# Запустить Redis
|
|
384
|
+
docker run -d --name redis -p 6379:6379 redis:7
|
|
131
385
|
|
|
132
|
-
#
|
|
133
|
-
|
|
134
|
-
|
|
386
|
+
# Запустить Qdrant
|
|
387
|
+
docker run -d --name qdrant -p 6333:6333 qdrant/qdrant
|
|
388
|
+
|
|
389
|
+
# Собрать проект
|
|
390
|
+
npm run build
|
|
391
|
+
|
|
392
|
+
# Запустить ArchiCore
|
|
393
|
+
npm start
|
|
135
394
|
```
|
|
136
395
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
396
|
+
### 6. Create First User
|
|
397
|
+
|
|
398
|
+
Откройте браузер: http://localhost:3000
|
|
399
|
+
|
|
400
|
+
1. Нажмите **Sign Up**
|
|
401
|
+
2. Введите email и password
|
|
402
|
+
3. Подтвердите email (код придет на почту)
|
|
403
|
+
4. Готово! Вы в системе
|
|
404
|
+
|
|
405
|
+
---
|
|
406
|
+
|
|
407
|
+
## 📦 Installation
|
|
408
|
+
|
|
409
|
+
### Docker Deployment (Production)
|
|
140
410
|
|
|
141
|
-
|
|
411
|
+
Рекомендуется для production. Все сервисы в контейнерах.
|
|
142
412
|
|
|
143
413
|
```bash
|
|
144
|
-
|
|
414
|
+
# 1. Клонировать репозиторий
|
|
415
|
+
git clone https://github.com/yourusername/archicore.git
|
|
416
|
+
cd archicore
|
|
417
|
+
|
|
418
|
+
# 2. Настроить .env
|
|
419
|
+
cp .env.example .env
|
|
420
|
+
nano .env # Заполнить все ключи
|
|
421
|
+
|
|
422
|
+
# 3. Собрать и запустить
|
|
423
|
+
docker compose build
|
|
424
|
+
docker compose up -d
|
|
425
|
+
|
|
426
|
+
# 4. Проверить статус
|
|
427
|
+
docker compose ps
|
|
428
|
+
|
|
429
|
+
# 5. Просмотр логов
|
|
430
|
+
docker compose logs -f archicore
|
|
431
|
+
|
|
432
|
+
# 6. Остановить
|
|
433
|
+
docker compose down
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
**Docker Compose включает:**
|
|
437
|
+
- ArchiCore (Node.js app)
|
|
438
|
+
- PostgreSQL 15
|
|
439
|
+
- Redis 7
|
|
440
|
+
- Qdrant vector DB
|
|
441
|
+
- Nginx reverse proxy (если настроен)
|
|
442
|
+
|
|
443
|
+
### Manual Installation (Development)
|
|
444
|
+
|
|
445
|
+
Для локальной разработки без Docker.
|
|
446
|
+
|
|
447
|
+
#### Step 1: Install Node.js
|
|
448
|
+
|
|
449
|
+
```bash
|
|
450
|
+
# Ubuntu/Debian
|
|
451
|
+
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
|
|
452
|
+
sudo apt-get install -y nodejs
|
|
453
|
+
|
|
454
|
+
# macOS (Homebrew)
|
|
455
|
+
brew install node@18
|
|
456
|
+
|
|
457
|
+
# Windows
|
|
458
|
+
# Download from https://nodejs.org/
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
#### Step 2: Install Databases
|
|
462
|
+
|
|
463
|
+
**PostgreSQL:**
|
|
464
|
+
```bash
|
|
465
|
+
# Ubuntu/Debian
|
|
466
|
+
sudo apt install postgresql postgresql-contrib
|
|
467
|
+
|
|
468
|
+
# macOS
|
|
469
|
+
brew install postgresql@15
|
|
470
|
+
brew services start postgresql@15
|
|
471
|
+
|
|
472
|
+
# Windows
|
|
473
|
+
# Download from https://www.postgresql.org/download/windows/
|
|
145
474
|
```
|
|
146
475
|
|
|
147
|
-
|
|
476
|
+
**Redis:**
|
|
477
|
+
```bash
|
|
478
|
+
# Ubuntu/Debian
|
|
479
|
+
sudo apt install redis-server
|
|
480
|
+
sudo systemctl start redis
|
|
481
|
+
|
|
482
|
+
# macOS
|
|
483
|
+
brew install redis
|
|
484
|
+
brew services start redis
|
|
485
|
+
|
|
486
|
+
# Windows
|
|
487
|
+
# Download from https://github.com/microsoftarchive/redis/releases
|
|
488
|
+
```
|
|
148
489
|
|
|
490
|
+
**Qdrant:**
|
|
149
491
|
```bash
|
|
492
|
+
# Через Docker (рекомендуется)
|
|
150
493
|
docker run -d --name qdrant -p 6333:6333 -p 6334:6334 qdrant/qdrant
|
|
494
|
+
|
|
495
|
+
# Или скачать binary
|
|
496
|
+
./start-qdrant.sh # Linux/Mac
|
|
497
|
+
start-qdrant.bat # Windows
|
|
151
498
|
```
|
|
152
499
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
500
|
+
#### Step 3: Setup Database
|
|
501
|
+
|
|
502
|
+
```bash
|
|
503
|
+
# Создать базу данных
|
|
504
|
+
createdb archicore
|
|
505
|
+
|
|
506
|
+
# Или через psql
|
|
507
|
+
psql -U postgres
|
|
508
|
+
CREATE DATABASE archicore;
|
|
509
|
+
\q
|
|
510
|
+
```
|
|
156
511
|
|
|
157
|
-
|
|
512
|
+
#### Step 4: Install ArchiCore
|
|
158
513
|
|
|
159
514
|
```bash
|
|
515
|
+
# Клонировать и установить зависимости
|
|
516
|
+
git clone https://github.com/yourusername/archicore.git
|
|
517
|
+
cd archicore
|
|
518
|
+
npm install
|
|
519
|
+
|
|
520
|
+
# Настроить .env
|
|
521
|
+
cp .env.example .env
|
|
522
|
+
nano .env
|
|
523
|
+
|
|
524
|
+
# Собрать проект
|
|
160
525
|
npm run build
|
|
526
|
+
|
|
527
|
+
# Запустить
|
|
528
|
+
npm start
|
|
161
529
|
```
|
|
162
530
|
|
|
163
|
-
|
|
531
|
+
#### Step 5: Verify Installation
|
|
164
532
|
|
|
165
|
-
|
|
533
|
+
```bash
|
|
534
|
+
# Проверить доступность API
|
|
535
|
+
curl http://localhost:3000/health
|
|
536
|
+
|
|
537
|
+
# Должен вернуть:
|
|
538
|
+
# {"status":"ok","version":"0.3.1"}
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
### NPM Package (CLI Only)
|
|
166
542
|
|
|
167
|
-
|
|
543
|
+
Установить ArchiCore CLI глобально:
|
|
168
544
|
|
|
169
545
|
```bash
|
|
170
|
-
npm
|
|
171
|
-
|
|
172
|
-
|
|
546
|
+
npm install -g archicore
|
|
547
|
+
|
|
548
|
+
# Авторизоваться
|
|
549
|
+
archicore login
|
|
550
|
+
|
|
551
|
+
# Начать использование
|
|
552
|
+
archicore projects list
|
|
173
553
|
```
|
|
174
554
|
|
|
175
|
-
|
|
555
|
+
---
|
|
556
|
+
|
|
557
|
+
## 💻 Usage
|
|
558
|
+
|
|
559
|
+
ArchiCore предоставляет три способа взаимодействия: Web Dashboard, CLI Tool и REST API.
|
|
560
|
+
|
|
561
|
+
### 🌐 Web Dashboard
|
|
562
|
+
|
|
563
|
+
#### 1. Landing Page (`/`)
|
|
564
|
+
|
|
565
|
+
Главная страница с описанием продукта, ценами и возможностями.
|
|
566
|
+
|
|
567
|
+
**Features:**
|
|
568
|
+
- Hero section с CTA
|
|
569
|
+
- Features overview
|
|
570
|
+
- Pricing plans (Free, Team, Pro, Enterprise)
|
|
571
|
+
- Footer с navigation
|
|
572
|
+
|
|
573
|
+
#### 2. Authentication (`/auth`)
|
|
574
|
+
|
|
575
|
+
Страница входа/регистрации.
|
|
576
|
+
|
|
577
|
+
**Login:**
|
|
578
|
+
```
|
|
579
|
+
1. Email + Password
|
|
580
|
+
2. OAuth (Google / GitHub)
|
|
581
|
+
```
|
|
582
|
+
|
|
583
|
+
**Sign Up:**
|
|
584
|
+
```
|
|
585
|
+
1. Enter email + password
|
|
586
|
+
2. Verify email (6-digit code sent via SMTP)
|
|
587
|
+
3. Automatic login after verification
|
|
176
588
|
```
|
|
177
|
-
✓ Проект проиндексирован!
|
|
178
589
|
|
|
179
|
-
|
|
590
|
+
**Features:**
|
|
591
|
+
- Email verification required
|
|
592
|
+
- Disposable email blocked (180+ domains)
|
|
593
|
+
- Device flow for CLI auth
|
|
594
|
+
- Password recovery (planned)
|
|
180
595
|
|
|
181
|
-
|
|
182
|
-
Всего символов: 1243
|
|
183
|
-
Узлов в графе: 1399
|
|
184
|
-
Связей: 2847
|
|
596
|
+
#### 3. Dashboard (`/dashboard`)
|
|
185
597
|
|
|
186
|
-
|
|
598
|
+
Главный рабочий интерфейс после авторизации.
|
|
187
599
|
|
|
188
|
-
|
|
189
|
-
class: 234
|
|
190
|
-
interface: 145
|
|
191
|
-
variable: 177
|
|
600
|
+
**Sections:**
|
|
192
601
|
|
|
193
|
-
|
|
602
|
+
**Projects:**
|
|
603
|
+
- Create new project (name, description, GitHub URL)
|
|
604
|
+
- List all projects with stats
|
|
605
|
+
- Select active project
|
|
606
|
+
- Delete projects
|
|
194
607
|
|
|
195
|
-
|
|
196
|
-
Точек: 1243
|
|
608
|
+
**Project Actions:**
|
|
197
609
|
```
|
|
610
|
+
├── Index Project - Анализ кода и построение графа
|
|
611
|
+
├── Full Analysis - Полный отчет (metrics, security, duplication, dead code)
|
|
612
|
+
├── Security Analysis - Проверка уязвимостей
|
|
613
|
+
├── Dead Code Detection - Поиск неиспользуемого кода
|
|
614
|
+
├── Code Duplication - Поиск дублирования
|
|
615
|
+
├── Metrics Report - Code metrics (complexity, LOC, maintainability)
|
|
616
|
+
├── Refactoring Suggestions - AI рекомендации
|
|
617
|
+
└── Export Data - JSON/HTML/Markdown/CSV
|
|
618
|
+
```
|
|
619
|
+
|
|
620
|
+
**Code Search:**
|
|
621
|
+
- Semantic search: "функции для обработки платежей"
|
|
622
|
+
- Results with file paths, line numbers, relevance scores
|
|
623
|
+
|
|
624
|
+
**AI Architect:**
|
|
625
|
+
- Ask questions: "Как организована аутентификация?"
|
|
626
|
+
- Context-aware answers based on your codebase
|
|
627
|
+
- Architecture recommendations
|
|
628
|
+
|
|
629
|
+
**Account Section:**
|
|
630
|
+
- Profile information
|
|
631
|
+
- Subscription tier (Free/Team/Pro/Enterprise)
|
|
632
|
+
- Usage statistics (API calls, projects, storage)
|
|
633
|
+
- Logout
|
|
634
|
+
|
|
635
|
+
#### 4. Pricing Page (`/pricing`)
|
|
636
|
+
|
|
637
|
+
Тарифные планы с подробным описанием.
|
|
638
|
+
|
|
639
|
+
**Plans:**
|
|
640
|
+
|
|
641
|
+
| Feature | Free | Team | Pro | Enterprise |
|
|
642
|
+
|---------|------|------|-----|------------|
|
|
643
|
+
| **Price** | $0 | $249/mo | $599/mo | Custom |
|
|
644
|
+
| **Repositories** | 1 | 3 | 10 | Unlimited |
|
|
645
|
+
| **Developers** | 1 | 5 | 20 | Unlimited |
|
|
646
|
+
| **Analysis** | Snapshot | Regular | PR-level | Continuous |
|
|
647
|
+
| **API Access** | ❌ | ❌ | ✅ | ✅ |
|
|
648
|
+
| **GitHub/GitLab Integration** | ❌ | ❌ | ✅ | ✅ |
|
|
649
|
+
| **Data Retention** | 7 days | 14 days | 30 days | Custom |
|
|
650
|
+
| **Support** | Community | Email | Priority | Dedicated manager |
|
|
651
|
+
|
|
652
|
+
#### 5. Admin Panel (`/admin`)
|
|
653
|
+
|
|
654
|
+
Панель администратора (только для admin role).
|
|
655
|
+
|
|
656
|
+
**Features:**
|
|
657
|
+
- **Users Management**: List, search, edit, delete users
|
|
658
|
+
- **Tier Management**: Change user subscription tiers
|
|
659
|
+
- **Statistics**: Total users, projects, API calls, storage
|
|
660
|
+
- **Audit Logs**: View all user actions with filters
|
|
661
|
+
- **System Settings**:
|
|
662
|
+
- Maintenance mode toggle
|
|
663
|
+
- Email configuration test
|
|
664
|
+
- Cache management (clear Redis/memory)
|
|
665
|
+
- System backup & restore
|
|
666
|
+
- Factory reset
|
|
667
|
+
- **Export**: Export all system data (JSON/CSV)
|
|
668
|
+
|
|
669
|
+
#### 6. Legal Pages
|
|
198
670
|
|
|
199
|
-
|
|
671
|
+
- **Privacy Policy** (`/privacy.html`)
|
|
672
|
+
- **Terms of Service** (`/terms.html`)
|
|
673
|
+
- **Security** (`/security.html`)
|
|
674
|
+
|
|
675
|
+
---
|
|
676
|
+
|
|
677
|
+
### 🖥️ CLI Tool
|
|
678
|
+
|
|
679
|
+
ArchiCore CLI - мощный инструмент для автоматизации и CI/CD интеграции.
|
|
680
|
+
|
|
681
|
+
#### Installation
|
|
200
682
|
|
|
201
683
|
```bash
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
684
|
+
# Установить глобально
|
|
685
|
+
npm install -g archicore
|
|
686
|
+
|
|
687
|
+
# Или использовать локально
|
|
688
|
+
npx archicore [command]
|
|
206
689
|
```
|
|
207
690
|
|
|
208
|
-
|
|
691
|
+
#### Authentication
|
|
692
|
+
|
|
693
|
+
```bash
|
|
694
|
+
# Device Flow (открывает браузер для авторизации)
|
|
695
|
+
archicore login
|
|
696
|
+
|
|
697
|
+
# Введите код из терминала на странице авторизации
|
|
698
|
+
# После успеха токен сохраняется в ~/.archicore/config.json
|
|
209
699
|
```
|
|
210
|
-
📋 ОТЧЁТ ОБ АНАЛИЗЕ ВЛИЯНИЯ
|
|
211
700
|
|
|
212
|
-
|
|
701
|
+
#### Project Management
|
|
213
702
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
703
|
+
```bash
|
|
704
|
+
# Список проектов
|
|
705
|
+
archicore projects list
|
|
706
|
+
|
|
707
|
+
# Создать проект
|
|
708
|
+
archicore projects create --name "My App" --github "https://github.com/user/repo"
|
|
219
709
|
|
|
220
|
-
|
|
710
|
+
# Выбрать активный проект
|
|
711
|
+
archicore projects select
|
|
221
712
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
Direct dependency
|
|
226
|
-
- ProgressTracker (src/tracking/progress.ts)
|
|
227
|
-
Direct dependency
|
|
713
|
+
# Удалить проект
|
|
714
|
+
archicore projects delete --id abc123
|
|
715
|
+
```
|
|
228
716
|
|
|
229
|
-
|
|
717
|
+
#### Code Analysis
|
|
230
718
|
|
|
231
|
-
|
|
232
|
-
|
|
719
|
+
```bash
|
|
720
|
+
# Индексировать проект (AST + граф зависимостей)
|
|
721
|
+
archicore index --dir /path/to/project
|
|
233
722
|
|
|
234
|
-
|
|
235
|
-
|
|
723
|
+
# Полный анализ
|
|
724
|
+
archicore full-analysis
|
|
236
725
|
|
|
237
|
-
|
|
726
|
+
# Анализ безопасности
|
|
727
|
+
archicore security
|
|
238
728
|
|
|
239
|
-
|
|
240
|
-
|
|
729
|
+
# Поиск мертвого кода
|
|
730
|
+
archicore dead-code
|
|
241
731
|
|
|
242
|
-
|
|
243
|
-
|
|
732
|
+
# Метрики кода
|
|
733
|
+
archicore metrics
|
|
244
734
|
|
|
245
|
-
|
|
246
|
-
|
|
735
|
+
# Дублирование кода
|
|
736
|
+
archicore duplication
|
|
737
|
+
|
|
738
|
+
# Рефакторинг рекомендации
|
|
739
|
+
archicore refactoring
|
|
247
740
|
```
|
|
248
741
|
|
|
249
|
-
####
|
|
742
|
+
#### Semantic Search
|
|
250
743
|
|
|
251
744
|
```bash
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
745
|
+
# Поиск по смыслу
|
|
746
|
+
archicore search --query "функции валидации email" --limit 10
|
|
747
|
+
|
|
748
|
+
# Результат:
|
|
749
|
+
# 🔍 RESULTS:
|
|
750
|
+
#
|
|
751
|
+
# 1. src/utils/validators.ts:45 (relevance: 94.2%)
|
|
752
|
+
# export function validateEmail(email: string): boolean {
|
|
753
|
+
#
|
|
754
|
+
# 2. src/auth/email-validator.ts:12 (relevance: 89.7%)
|
|
755
|
+
# class EmailValidator {
|
|
255
756
|
```
|
|
256
757
|
|
|
257
|
-
|
|
258
|
-
```
|
|
259
|
-
🔍 РЕЗУЛЬТАТЫ ПОИСКА:
|
|
758
|
+
#### AI Architect
|
|
260
759
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
760
|
+
```bash
|
|
761
|
+
# Задать вопрос
|
|
762
|
+
archicore ask --question "Как организована работа с платежами?"
|
|
763
|
+
|
|
764
|
+
# Анализ изменений
|
|
765
|
+
archicore analyze \
|
|
766
|
+
--description "Добавить новый метод оплаты" \
|
|
767
|
+
--files "src/payments/processor.ts" \
|
|
768
|
+
--type "feature"
|
|
769
|
+
|
|
770
|
+
# Результат:
|
|
771
|
+
# ⚠️ AFFECTED COMPONENTS: 23
|
|
772
|
+
# 🔴 CRITICAL: 5
|
|
773
|
+
# 🟠 HIGH: 11
|
|
774
|
+
# 🟡 MEDIUM: 7
|
|
775
|
+
#
|
|
776
|
+
# RISKS:
|
|
777
|
+
# [HIGH] Breaking change in PaymentProcessor interface
|
|
778
|
+
# [MEDIUM] New dependencies added to payment flow
|
|
779
|
+
#
|
|
780
|
+
# RECOMMENDATIONS:
|
|
781
|
+
# ✅ Add backward compatibility wrapper
|
|
782
|
+
# ✅ Update API documentation
|
|
783
|
+
# ✅ Write integration tests for new method
|
|
784
|
+
```
|
|
264
785
|
|
|
265
|
-
|
|
266
|
-
Релевантность: 87.15%
|
|
267
|
-
async function handleStripePayment(...)
|
|
786
|
+
#### Export
|
|
268
787
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
788
|
+
```bash
|
|
789
|
+
# Экспорт результатов анализа
|
|
790
|
+
archicore export --format json --output analysis.json
|
|
791
|
+
archicore export --format html --output report.html
|
|
792
|
+
archicore export --format markdown --output ANALYSIS.md
|
|
793
|
+
archicore export --format csv --output metrics.csv
|
|
272
794
|
```
|
|
273
795
|
|
|
274
|
-
####
|
|
796
|
+
#### Interactive Mode
|
|
275
797
|
|
|
276
798
|
```bash
|
|
277
|
-
|
|
278
|
-
|
|
799
|
+
# Интерактивный режим с autocomplete
|
|
800
|
+
archicore chat
|
|
801
|
+
|
|
802
|
+
# Внутри появится меню команд:
|
|
803
|
+
# > /help - Показать доступные команды
|
|
804
|
+
# > /search - Семантический поиск
|
|
805
|
+
# > /ask - Вопрос AI архитектору
|
|
806
|
+
# > /analyze - Анализ изменений
|
|
807
|
+
# > /metrics - Метрики проекта
|
|
808
|
+
# > /exit - Выход
|
|
279
809
|
```
|
|
280
810
|
|
|
281
|
-
|
|
282
|
-
```
|
|
283
|
-
💬 ОТВЕТ AI АРХИТЕКТОРА:
|
|
811
|
+
📖 **[Complete CLI Documentation →](./API_CLI_REFERENCE.md#complete-cli-reference)**
|
|
284
812
|
|
|
285
|
-
|
|
813
|
+
---
|
|
286
814
|
|
|
287
|
-
|
|
288
|
-
- PaymentEntity - доменная сущность платежа
|
|
289
|
-
- PaymentStatus - статусы платежа
|
|
290
|
-
- Бизнес-правила валидации
|
|
815
|
+
### 🔌 REST API
|
|
291
816
|
|
|
292
|
-
|
|
293
|
-
- PaymentService - основной сервис обработки платежей
|
|
294
|
-
- UseCase классы для различных сценариев
|
|
817
|
+
Полное REST API для интеграции с CI/CD, webhooks, custom tools.
|
|
295
818
|
|
|
296
|
-
|
|
297
|
-
- StripeAdapter - интеграция со Stripe
|
|
298
|
-
- PaymentRepository - персистентность
|
|
299
|
-
- EventPublisher - публикация событий
|
|
819
|
+
#### Base URL
|
|
300
820
|
|
|
301
|
-
|
|
302
|
-
|
|
821
|
+
```
|
|
822
|
+
Production: https://api.archicore.io
|
|
823
|
+
Development: http://localhost:3000/api
|
|
303
824
|
```
|
|
304
825
|
|
|
305
|
-
####
|
|
826
|
+
#### Authentication
|
|
306
827
|
|
|
828
|
+
**JWT Token:**
|
|
307
829
|
```bash
|
|
308
|
-
|
|
830
|
+
# Login
|
|
831
|
+
curl -X POST https://api.archicore.io/auth/login \
|
|
832
|
+
-H "Content-Type: application/json" \
|
|
833
|
+
-d '{"email":"user@example.com","password":"secret"}'
|
|
834
|
+
|
|
835
|
+
# Response:
|
|
836
|
+
# {"success":true,"token":"eyJhbGc...","user":{...}}
|
|
837
|
+
|
|
838
|
+
# Use token in requests
|
|
839
|
+
curl -H "Authorization: Bearer eyJhbGc..." \
|
|
840
|
+
https://api.archicore.io/projects
|
|
309
841
|
```
|
|
310
842
|
|
|
311
|
-
|
|
843
|
+
**API Key:**
|
|
844
|
+
```bash
|
|
845
|
+
# Create API key (через dashboard /developer)
|
|
846
|
+
curl -X POST https://api.archicore.io/developer/keys \
|
|
847
|
+
-H "Authorization: Bearer YOUR_JWT" \
|
|
848
|
+
-d '{"name":"CI/CD Key","expiresInDays":365}'
|
|
849
|
+
|
|
850
|
+
# Use API key
|
|
851
|
+
curl -H "X-API-Key: ak_xxx" \
|
|
852
|
+
https://api.archicore.io/projects
|
|
853
|
+
```
|
|
312
854
|
|
|
313
|
-
|
|
855
|
+
#### Endpoints Overview
|
|
314
856
|
|
|
315
|
-
|
|
857
|
+
**Authentication:**
|
|
858
|
+
```
|
|
859
|
+
POST /api/auth/register - Регистрация
|
|
860
|
+
POST /api/auth/login - Вход
|
|
861
|
+
POST /api/auth/logout - Выход
|
|
862
|
+
GET /api/auth/me - Текущий пользователь
|
|
863
|
+
GET /api/auth/usage - Статистика использования
|
|
864
|
+
POST /api/auth/send-verification-code - Отправить код верификации
|
|
865
|
+
POST /api/auth/verify-email - Подтвердить email
|
|
866
|
+
```
|
|
316
867
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
-
|
|
320
|
-
-
|
|
321
|
-
-
|
|
868
|
+
**OAuth:**
|
|
869
|
+
```
|
|
870
|
+
GET /api/auth/oauth/google - Начать Google OAuth
|
|
871
|
+
GET /api/auth/oauth/google/callback - Google callback
|
|
872
|
+
GET /api/auth/oauth/github - Начать GitHub OAuth
|
|
873
|
+
GET /api/auth/oauth/github/callback - GitHub callback
|
|
874
|
+
```
|
|
322
875
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
-
|
|
326
|
-
-
|
|
327
|
-
-
|
|
876
|
+
**Device Flow (CLI):**
|
|
877
|
+
```
|
|
878
|
+
POST /api/auth/device/code - Получить device code
|
|
879
|
+
POST /api/auth/device/token - Обменять код на токен
|
|
880
|
+
GET /api/auth/device/verify/:code - Проверить код
|
|
881
|
+
POST /api/auth/device/authorize - Авторизовать устройство
|
|
882
|
+
```
|
|
328
883
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
-
|
|
332
|
-
-
|
|
333
|
-
-
|
|
334
|
-
-
|
|
884
|
+
**Projects:**
|
|
885
|
+
```
|
|
886
|
+
GET /api/projects - Список проектов
|
|
887
|
+
POST /api/projects - Создать проект
|
|
888
|
+
GET /api/projects/:id - Получить проект
|
|
889
|
+
PUT /api/projects/:id - Обновить проект
|
|
890
|
+
DELETE /api/projects/:id - Удалить проект
|
|
891
|
+
POST /api/projects/:id/index - Индексировать код
|
|
892
|
+
GET /api/projects/:id/architecture - Архитектурная информация
|
|
893
|
+
GET /api/projects/:id/graph - Граф зависимостей
|
|
894
|
+
GET /api/projects/:id/metrics - Метрики кода
|
|
895
|
+
```
|
|
335
896
|
|
|
336
|
-
|
|
897
|
+
**Analysis:**
|
|
898
|
+
```
|
|
899
|
+
POST /api/analyze/impact - Анализ влияния изменений
|
|
900
|
+
POST /api/analyze/security - Анализ безопасности
|
|
901
|
+
POST /api/analyze/full - Полный анализ
|
|
902
|
+
POST /api/analyze/dead-code - Мертвый код
|
|
903
|
+
POST /api/analyze/duplication - Дублирование
|
|
904
|
+
POST /api/analyze/refactoring - Рекомендации по рефакторингу
|
|
905
|
+
```
|
|
906
|
+
|
|
907
|
+
**AI:**
|
|
908
|
+
```
|
|
909
|
+
POST /api/ai/search - Семантический поиск
|
|
910
|
+
POST /api/ai/ask - Вопрос AI архитектору
|
|
911
|
+
POST /api/ai/simulate - Симуляция изменений
|
|
912
|
+
```
|
|
337
913
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
-
|
|
914
|
+
**GitHub:**
|
|
915
|
+
```
|
|
916
|
+
GET /api/github/auth - GitHub OAuth
|
|
917
|
+
GET /api/github/callback - GitHub callback
|
|
918
|
+
GET /api/github/repositories - Список репозиториев
|
|
919
|
+
POST /api/github/webhooks - Создать webhook
|
|
920
|
+
```
|
|
341
921
|
|
|
342
|
-
|
|
922
|
+
**Admin:**
|
|
923
|
+
```
|
|
924
|
+
GET /api/admin/users - Список пользователей
|
|
925
|
+
PUT /api/admin/users/:id/tier - Изменить tier
|
|
926
|
+
GET /api/admin/stats - Статистика системы
|
|
927
|
+
GET /api/admin/audit-logs - Аудит логи
|
|
928
|
+
GET /api/admin/settings - Настройки системы
|
|
929
|
+
POST /api/admin/settings - Обновить настройки
|
|
930
|
+
POST /api/admin/test-email - Тест email
|
|
931
|
+
POST /api/admin/maintenance - Включить maintenance mode
|
|
932
|
+
GET /api/admin/export/all - Экспорт всех данных
|
|
933
|
+
```
|
|
934
|
+
|
|
935
|
+
**Developer:**
|
|
936
|
+
```
|
|
937
|
+
GET /api/developer/keys - Список API ключей
|
|
938
|
+
POST /api/developer/keys - Создать API ключ
|
|
939
|
+
DELETE /api/developer/keys/:id - Удалить API ключ
|
|
940
|
+
POST /api/developer/keys/:id/revoke - Отозвать API ключ
|
|
941
|
+
```
|
|
942
|
+
|
|
943
|
+
**Upload & Utilities:**
|
|
944
|
+
```
|
|
945
|
+
POST /api/upload - Загрузить файлы проекта
|
|
946
|
+
POST /api/report-issue - Отправить bug report
|
|
947
|
+
GET /api/tasks/:taskId - Статус задачи
|
|
948
|
+
GET /api/tasks/:taskId/stream - WebSocket progress updates
|
|
949
|
+
```
|
|
343
950
|
|
|
344
|
-
|
|
345
|
-
2. **Сокращает контекст** - только топ-3 самых важных фрагмента
|
|
346
|
-
3. **Переводит на английский** - DeepSeek лучше понимает английский
|
|
347
|
-
4. **Структурирует вывод** - требует четкий формат ответа
|
|
348
|
-
5. **Обрезает до оптимума** - 8000 символов вместо 32K
|
|
349
|
-
6. **Retry с упрощением** - до 2 попыток с прогрессивным упрощением
|
|
951
|
+
📖 **[Complete API Documentation →](./API_CLI_REFERENCE.md#complete-api-reference)**
|
|
350
952
|
|
|
351
|
-
|
|
953
|
+
#### Example: Analyze Impact
|
|
352
954
|
|
|
353
|
-
|
|
955
|
+
```bash
|
|
956
|
+
curl -X POST https://api.archicore.io/analyze/impact \
|
|
957
|
+
-H "Authorization: Bearer YOUR_TOKEN" \
|
|
958
|
+
-H "Content-Type: application/json" \
|
|
959
|
+
-d '{
|
|
960
|
+
"projectId": "proj_abc123",
|
|
961
|
+
"change": {
|
|
962
|
+
"type": "modify",
|
|
963
|
+
"description": "Рефакторинг AuthService",
|
|
964
|
+
"files": ["src/services/auth-service.ts"],
|
|
965
|
+
"symbols": ["AuthService", "login", "register"]
|
|
966
|
+
}
|
|
967
|
+
}'
|
|
968
|
+
```
|
|
354
969
|
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
970
|
+
**Response:**
|
|
971
|
+
```json
|
|
972
|
+
{
|
|
973
|
+
"success": true,
|
|
974
|
+
"impact": {
|
|
975
|
+
"affectedNodes": [
|
|
976
|
+
{
|
|
977
|
+
"id": "AuthController",
|
|
978
|
+
"file": "src/controllers/auth.ts",
|
|
979
|
+
"severity": "critical",
|
|
980
|
+
"reason": "Direct dependency on modified AuthService"
|
|
981
|
+
},
|
|
982
|
+
{
|
|
983
|
+
"id": "UserService",
|
|
984
|
+
"file": "src/services/user-service.ts",
|
|
985
|
+
"severity": "high",
|
|
986
|
+
"reason": "Calls AuthService.login()"
|
|
987
|
+
}
|
|
988
|
+
],
|
|
989
|
+
"risks": [
|
|
990
|
+
{
|
|
991
|
+
"severity": "high",
|
|
992
|
+
"message": "Breaking change in public API",
|
|
993
|
+
"recommendation": "Add deprecation warnings before removing methods"
|
|
994
|
+
}
|
|
995
|
+
],
|
|
996
|
+
"recommendations": [
|
|
997
|
+
"Review 15 affected components",
|
|
998
|
+
"Add integration tests for auth flow",
|
|
999
|
+
"Update API documentation"
|
|
1000
|
+
],
|
|
1001
|
+
"summary": {
|
|
1002
|
+
"total": 15,
|
|
1003
|
+
"critical": 3,
|
|
1004
|
+
"high": 7,
|
|
1005
|
+
"medium": 4,
|
|
1006
|
+
"low": 1
|
|
1007
|
+
}
|
|
367
1008
|
}
|
|
368
|
-
}
|
|
1009
|
+
}
|
|
369
1010
|
```
|
|
370
1011
|
|
|
371
|
-
|
|
1012
|
+
---
|
|
372
1013
|
|
|
373
|
-
|
|
1014
|
+
## 🔐 Authentication & Security
|
|
374
1015
|
|
|
375
|
-
|
|
1016
|
+
ArchiCore реализует многоуровневую систему безопасности корпоративного уровня.
|
|
376
1017
|
|
|
377
|
-
|
|
378
|
-
- **`analyze-project.sh`** - Полный анализ проекта
|
|
379
|
-
- **`ask-question.sh`** - Интерактивные вопросы AI
|
|
380
|
-
- **`search-code.sh`** - Семантический поиск
|
|
381
|
-
- **`test-full.sh`** - Проверка всей системы
|
|
382
|
-
- **`start-qdrant-docker.sh`** - Запуск Qdrant в Docker
|
|
1018
|
+
### Authentication Methods
|
|
383
1019
|
|
|
384
|
-
|
|
385
|
-
```bash
|
|
386
|
-
# 1. Запустить установку
|
|
387
|
-
chmod +x setup.sh
|
|
388
|
-
./setup.sh
|
|
1020
|
+
#### 1. Email + Password
|
|
389
1021
|
|
|
390
|
-
|
|
391
|
-
|
|
1022
|
+
**Registration Flow:**
|
|
1023
|
+
```
|
|
1024
|
+
1. User submits email + password
|
|
1025
|
+
2. System checks disposable email (180+ blocked domains)
|
|
1026
|
+
3. Sends 6-digit verification code via SMTP (Zoho)
|
|
1027
|
+
4. User enters code (10-minute expiry)
|
|
1028
|
+
5. Password hashed with bcrypt (10 rounds)
|
|
1029
|
+
6. User created, JWT token issued
|
|
1030
|
+
7. Welcome email sent
|
|
1031
|
+
```
|
|
392
1032
|
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
**Преимущества Linux:**
|
|
402
|
-
- ✅ Лучше для production серверов
|
|
403
|
-
- ✅ Легкая автоматизация (cron jobs)
|
|
404
|
-
- ✅ Нет проблем с кодировкой
|
|
405
|
-
- ✅ Отличная поддержка Docker
|
|
406
|
-
- ✅ SSH доступ для удаленной работы
|
|
407
|
-
|
|
408
|
-
## Программное использование
|
|
409
|
-
|
|
410
|
-
```typescript
|
|
411
|
-
import { AIArhitector, Change } from 'aiarhitector';
|
|
412
|
-
|
|
413
|
-
// Создание экземпляра
|
|
414
|
-
const ai = new AIArhitector({
|
|
415
|
-
rootDir: '/path/to/project',
|
|
416
|
-
llm: {
|
|
417
|
-
provider: 'anthropic',
|
|
418
|
-
model: 'claude-sonnet-4-20250514',
|
|
419
|
-
temperature: 0.1,
|
|
420
|
-
maxTokens: 4096
|
|
421
|
-
},
|
|
422
|
-
vectorStore: {
|
|
423
|
-
url: 'http://localhost:6333',
|
|
424
|
-
collectionName: 'my-project'
|
|
425
|
-
}
|
|
426
|
-
});
|
|
1033
|
+
**Login Flow:**
|
|
1034
|
+
```
|
|
1035
|
+
1. User submits email + password
|
|
1036
|
+
2. Password verified with bcrypt
|
|
1037
|
+
3. JWT token issued (24h expiry)
|
|
1038
|
+
4. Refresh token stored in DB (30d expiry)
|
|
1039
|
+
5. Audit log created
|
|
1040
|
+
```
|
|
427
1041
|
|
|
428
|
-
|
|
429
|
-
await ai.initialize();
|
|
1042
|
+
#### 2. OAuth 2.0 (Google, GitHub)
|
|
430
1043
|
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
1044
|
+
**Flow:**
|
|
1045
|
+
```
|
|
1046
|
+
1. User clicks "Continue with Google/GitHub"
|
|
1047
|
+
2. Redirected to provider authorization page
|
|
1048
|
+
3. User grants permissions
|
|
1049
|
+
4. Provider redirects to /callback with code
|
|
1050
|
+
5. ArchiCore exchanges code for access token
|
|
1051
|
+
6. Fetches user profile (email, name, avatar)
|
|
1052
|
+
7. Creates user if first login OR logs in existing
|
|
1053
|
+
8. JWT token issued
|
|
1054
|
+
9. Redirected to dashboard with token in URL
|
|
1055
|
+
10. Frontend saves token to localStorage
|
|
1056
|
+
```
|
|
438
1057
|
|
|
439
|
-
|
|
1058
|
+
**Implemented Providers:**
|
|
1059
|
+
- ✅ Google OAuth 2.0 (scope: profile, email)
|
|
1060
|
+
- ✅ GitHub OAuth 2.0 (scope: user:email)
|
|
440
1061
|
|
|
441
|
-
|
|
442
|
-
console.log('Риски:', impact.risks);
|
|
443
|
-
console.log('Рекомендации:', impact.recommendations);
|
|
1062
|
+
#### 3. Device Flow (CLI)
|
|
444
1063
|
|
|
445
|
-
|
|
446
|
-
|
|
1064
|
+
**Flow for CLI authentication:**
|
|
1065
|
+
```
|
|
1066
|
+
1. CLI requests device code: POST /api/auth/device/code
|
|
1067
|
+
2. Server returns: {device_code, user_code, verification_url}
|
|
1068
|
+
3. CLI displays: "Go to https://archicore.io/auth/device and enter: ABCD-1234"
|
|
1069
|
+
4. User opens browser, enters code
|
|
1070
|
+
5. User authorizes device
|
|
1071
|
+
6. CLI polls: POST /api/auth/device/token with device_code
|
|
1072
|
+
7. On success, receives JWT token
|
|
1073
|
+
8. Token saved to ~/.archicore/config.json
|
|
1074
|
+
```
|
|
447
1075
|
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
1076
|
+
#### 4. API Keys
|
|
1077
|
+
|
|
1078
|
+
**For programmatic access:**
|
|
1079
|
+
```
|
|
1080
|
+
1. User creates API key via dashboard (/developer)
|
|
1081
|
+
2. Key format: ak_xxxxxxxxxxxxxxxxxx (40 chars)
|
|
1082
|
+
3. Key stored hashed in database
|
|
1083
|
+
4. Use in requests: X-API-Key: ak_xxx
|
|
1084
|
+
5. Keys can be revoked or deleted
|
|
1085
|
+
6. Supports expiration (optional)
|
|
1086
|
+
```
|
|
452
1087
|
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
)
|
|
1088
|
+
### Security Features
|
|
1089
|
+
|
|
1090
|
+
#### Password Security
|
|
1091
|
+
- **Hashing**: bcrypt with 10 salt rounds
|
|
1092
|
+
- **Validation**: Min 8 chars, complexity requirements (planned)
|
|
1093
|
+
- **Reset**: Email-based password reset (planned)
|
|
1094
|
+
|
|
1095
|
+
#### JWT Tokens
|
|
1096
|
+
- **Algorithm**: HS256
|
|
1097
|
+
- **Expiry**: 24 hours (configurable)
|
|
1098
|
+
- **Payload**: userId, email, role, tier
|
|
1099
|
+
- **Secret**: From environment variable JWT_SECRET
|
|
1100
|
+
- **Refresh**: Refresh tokens with 30d expiry (planned)
|
|
1101
|
+
|
|
1102
|
+
#### Disposable Email Protection
|
|
1103
|
+
- **Database**: 180+ temporary email domains
|
|
1104
|
+
- **Blocked services**: 10minutemail, guerrillamail, mailinator, yopmail, temp-mail, etc.
|
|
1105
|
+
- **Check points**: Registration, email verification, OAuth
|
|
1106
|
+
- **Error message**: "Temporary/disposable email addresses are not allowed"
|
|
1107
|
+
|
|
1108
|
+
#### Email Verification
|
|
1109
|
+
- **Code**: 6 random digits
|
|
1110
|
+
- **Expiry**: 10 minutes
|
|
1111
|
+
- **Storage**: In-memory Map (auto-cleanup on expiry)
|
|
1112
|
+
- **Rate limit**: 30 seconds between resends
|
|
1113
|
+
- **Transport**: SMTP via Zoho (TLS, port 587)
|
|
1114
|
+
- **Templates**: Branded HTML emails
|
|
1115
|
+
|
|
1116
|
+
#### Rate Limiting
|
|
1117
|
+
- **Global**: 100 requests per 15 minutes per IP
|
|
1118
|
+
- **Auth endpoints**: 5 login attempts per 15 minutes
|
|
1119
|
+
- **Email sending**: 3 codes per hour per email
|
|
1120
|
+
- **Headers**: X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset
|
|
1121
|
+
|
|
1122
|
+
#### Encryption
|
|
1123
|
+
- **Algorithm**: AES-256-GCM
|
|
1124
|
+
- **Key**: From environment ENCRYPTION_KEY (32 chars)
|
|
1125
|
+
- **Use cases**: Sensitive user data, API keys in DB, OAuth tokens
|
|
1126
|
+
|
|
1127
|
+
#### Audit Logging
|
|
1128
|
+
**All actions logged:**
|
|
1129
|
+
- Authentication (login, logout, register, OAuth)
|
|
1130
|
+
- Project operations (create, update, delete)
|
|
1131
|
+
- Analysis requests
|
|
1132
|
+
- Admin actions (user management, settings changes)
|
|
1133
|
+
- API key operations
|
|
1134
|
+
|
|
1135
|
+
**Log fields:**
|
|
1136
|
+
- userId, username, action, timestamp, ip, userAgent
|
|
1137
|
+
- success/failure, errorMessage
|
|
1138
|
+
- details (JSON with context-specific data)
|
|
1139
|
+
|
|
1140
|
+
#### CORS & Headers
|
|
1141
|
+
- **CORS**: Configurable whitelist (production), allow-all (development)
|
|
1142
|
+
- **Helmet.js**: CSP, HSTS, X-Frame-Options, XSS Protection
|
|
1143
|
+
- **Gzip**: Response compression
|
|
1144
|
+
|
|
1145
|
+
#### HTTPS
|
|
1146
|
+
- **Production**: Let's Encrypt SSL certificates
|
|
1147
|
+
- **Auto-renewal**: Certbot cron job
|
|
1148
|
+
- **Redirect**: HTTP → HTTPS (nginx)
|
|
1149
|
+
- **HSTS**: Strict-Transport-Security header
|
|
1150
|
+
|
|
1151
|
+
---
|
|
1152
|
+
|
|
1153
|
+
## ⚙️ Configuration
|
|
1154
|
+
|
|
1155
|
+
### Environment Variables
|
|
1156
|
+
|
|
1157
|
+
Полный список переменных окружения:
|
|
458
1158
|
|
|
459
|
-
|
|
460
|
-
|
|
1159
|
+
```env
|
|
1160
|
+
# ═══════════════════════════════════════════════════════════
|
|
1161
|
+
# SERVER CONFIGURATION
|
|
1162
|
+
# ═══════════════════════════════════════════════════════════
|
|
1163
|
+
PORT=3000
|
|
1164
|
+
NODE_ENV=production
|
|
1165
|
+
BASE_URL=https://archicore.io
|
|
1166
|
+
|
|
1167
|
+
# ═══════════════════════════════════════════════════════════
|
|
1168
|
+
# DATABASE
|
|
1169
|
+
# ═══════════════════════════════════════════════════════════
|
|
1170
|
+
DATABASE_URL=postgresql://user:password@localhost:5432/archicore
|
|
1171
|
+
DATABASE_POOL_MIN=2
|
|
1172
|
+
DATABASE_POOL_MAX=20
|
|
1173
|
+
|
|
1174
|
+
# ═══════════════════════════════════════════════════════════
|
|
1175
|
+
# REDIS CACHE
|
|
1176
|
+
# ═══════════════════════════════════════════════════════════
|
|
1177
|
+
REDIS_URL=redis://localhost:6379
|
|
1178
|
+
REDIS_PASSWORD=
|
|
1179
|
+
REDIS_DB=0
|
|
1180
|
+
|
|
1181
|
+
# ═══════════════════════════════════════════════════════════
|
|
1182
|
+
# QDRANT VECTOR DATABASE
|
|
1183
|
+
# ═══════════════════════════════════════════════════════════
|
|
1184
|
+
QDRANT_URL=http://localhost:6333
|
|
1185
|
+
QDRANT_API_KEY=
|
|
1186
|
+
QDRANT_COLLECTION_NAME=archicore
|
|
1187
|
+
|
|
1188
|
+
# ═══════════════════════════════════════════════════════════
|
|
1189
|
+
# AI PROVIDERS
|
|
1190
|
+
# ═══════════════════════════════════════════════════════════
|
|
1191
|
+
|
|
1192
|
+
# Anthropic Claude (Рекомендуется)
|
|
1193
|
+
ANTHROPIC_API_KEY=sk-ant-api03-xxx
|
|
1194
|
+
ANTHROPIC_MODEL=claude-sonnet-4-20250514
|
|
1195
|
+
# Доступные модели:
|
|
1196
|
+
# - claude-opus-4-20250514 (самый умный, дорогой)
|
|
1197
|
+
# - claude-sonnet-4-20250514 (баланс качество/цена) ⭐
|
|
1198
|
+
# - claude-haiku-4-20250514 (быстрый, дешевый)
|
|
1199
|
+
|
|
1200
|
+
# OpenAI GPT
|
|
1201
|
+
OPENAI_API_KEY=sk-xxx
|
|
1202
|
+
OPENAI_MODEL=gpt-4-turbo-preview
|
|
1203
|
+
# Доступные модели:
|
|
1204
|
+
# - gpt-4-turbo-preview (новый GPT-4 Turbo)
|
|
1205
|
+
# - gpt-4 (стандартный GPT-4)
|
|
1206
|
+
# - gpt-3.5-turbo (быстрый, дешевый)
|
|
1207
|
+
|
|
1208
|
+
# DeepSeek (Бюджетный вариант)
|
|
1209
|
+
DEEPSEEK_API_KEY=sk-xxx
|
|
1210
|
+
DEEPSEEK_MODEL=deepseek-chat
|
|
1211
|
+
# Доступные модели:
|
|
1212
|
+
# - deepseek-chat (общего назначения)
|
|
1213
|
+
# - deepseek-coder (для кода) ⭐
|
|
1214
|
+
|
|
1215
|
+
# Jina AI (Embeddings)
|
|
1216
|
+
JINA_API_KEY=jina_xxx
|
|
1217
|
+
JINA_MODEL=jina-embeddings-v2-base-code
|
|
1218
|
+
|
|
1219
|
+
# ═══════════════════════════════════════════════════════════
|
|
1220
|
+
# OAUTH PROVIDERS
|
|
1221
|
+
# ═══════════════════════════════════════════════════════════
|
|
1222
|
+
|
|
1223
|
+
# Google OAuth 2.0
|
|
1224
|
+
GOOGLE_CLIENT_ID=xxx.apps.googleusercontent.com
|
|
1225
|
+
GOOGLE_CLIENT_SECRET=GOCSPX-xxx
|
|
1226
|
+
GOOGLE_CALLBACK_URL=https://archicore.io/api/auth/oauth/google/callback
|
|
1227
|
+
|
|
1228
|
+
# GitHub OAuth
|
|
1229
|
+
GITHUB_CLIENT_ID=xxx
|
|
1230
|
+
GITHUB_CLIENT_SECRET=xxx
|
|
1231
|
+
GITHUB_CALLBACK_URL=https://archicore.io/api/auth/oauth/github/callback
|
|
1232
|
+
|
|
1233
|
+
# ═══════════════════════════════════════════════════════════
|
|
1234
|
+
# EMAIL (SMTP)
|
|
1235
|
+
# ═══════════════════════════════════════════════════════════
|
|
1236
|
+
SMTP_HOST=smtp.zoho.com
|
|
1237
|
+
SMTP_PORT=587
|
|
1238
|
+
SMTP_SECURE=false
|
|
1239
|
+
ZOHO_SMTP_USER=noreply@archicore.io
|
|
1240
|
+
ZOHO_SMTP_PASS=xxx
|
|
1241
|
+
EMAIL_FROM_ADDRESS=noreply@archicore.io
|
|
1242
|
+
EMAIL_FROM_NAME=ArchiCore
|
|
1243
|
+
|
|
1244
|
+
# ═══════════════════════════════════════════════════════════
|
|
1245
|
+
# SECURITY
|
|
1246
|
+
# ═══════════════════════════════════════════════════════════
|
|
1247
|
+
JWT_SECRET=your-super-secret-jwt-key-min-32-chars
|
|
1248
|
+
JWT_EXPIRY=24h
|
|
1249
|
+
ENCRYPTION_KEY=your-32-character-encryption-key
|
|
1250
|
+
SESSION_SECRET=your-session-secret-min-32-chars
|
|
1251
|
+
|
|
1252
|
+
# CORS
|
|
1253
|
+
CORS_ORIGIN=https://archicore.io,https://app.archicore.io
|
|
1254
|
+
CORS_CREDENTIALS=true
|
|
1255
|
+
|
|
1256
|
+
# Rate Limiting
|
|
1257
|
+
RATE_LIMIT_WINDOW_MS=900000
|
|
1258
|
+
RATE_LIMIT_MAX_REQUESTS=100
|
|
1259
|
+
|
|
1260
|
+
# ═══════════════════════════════════════════════════════════
|
|
1261
|
+
# ADMIN
|
|
1262
|
+
# ═══════════════════════════════════════════════════════════
|
|
1263
|
+
ADMIN_EMAIL=admin@archicore.io
|
|
1264
|
+
ADMIN_PASSWORD=change-this-in-production
|
|
1265
|
+
|
|
1266
|
+
# ═══════════════════════════════════════════════════════════
|
|
1267
|
+
# FEATURES (Optional)
|
|
1268
|
+
# ═══════════════════════════════════════════════════════════
|
|
1269
|
+
ENABLE_GITHUB_INTEGRATION=true
|
|
1270
|
+
ENABLE_WEBHOOKS=true
|
|
1271
|
+
ENABLE_METRICS=true
|
|
1272
|
+
ENABLE_ANALYTICS=true
|
|
1273
|
+
|
|
1274
|
+
# ═══════════════════════════════════════════════════════════
|
|
1275
|
+
# LOGGING
|
|
1276
|
+
# ═══════════════════════════════════════════════════════════
|
|
1277
|
+
LOG_LEVEL=info
|
|
1278
|
+
# Levels: error, warn, info, debug, trace
|
|
1279
|
+
LOG_FORMAT=json
|
|
1280
|
+
# Formats: json, pretty
|
|
461
1281
|
```
|
|
462
1282
|
|
|
463
|
-
|
|
1283
|
+
### Architecture Configuration
|
|
464
1284
|
|
|
465
|
-
|
|
1285
|
+
Файл `.archicore/architecture.json` для определения правил архитектуры:
|
|
466
1286
|
|
|
467
1287
|
```json
|
|
468
1288
|
{
|
|
469
1289
|
"boundedContexts": [
|
|
1290
|
+
{
|
|
1291
|
+
"id": "auth",
|
|
1292
|
+
"name": "Authentication Context",
|
|
1293
|
+
"description": "User authentication and authorization",
|
|
1294
|
+
"modules": ["src/server/routes/auth.ts", "src/server/services/auth-service.ts"],
|
|
1295
|
+
"dependencies": [],
|
|
1296
|
+
"prohibitedDependencies": ["src/ui", "src/business-logic"]
|
|
1297
|
+
},
|
|
470
1298
|
{
|
|
471
1299
|
"id": "core",
|
|
472
|
-
"name": "Core
|
|
473
|
-
"description": "
|
|
1300
|
+
"name": "Core Business Logic",
|
|
1301
|
+
"description": "Main business domain",
|
|
474
1302
|
"modules": ["src/core"],
|
|
475
|
-
"dependencies": [],
|
|
476
|
-
"prohibitedDependencies": ["src/
|
|
1303
|
+
"dependencies": ["auth"],
|
|
1304
|
+
"prohibitedDependencies": ["src/infrastructure"]
|
|
477
1305
|
}
|
|
478
1306
|
],
|
|
479
1307
|
"entities": [
|
|
480
1308
|
{
|
|
481
1309
|
"id": "user",
|
|
482
1310
|
"name": "User",
|
|
483
|
-
"context": "
|
|
484
|
-
"properties": [
|
|
485
|
-
"relationships": [
|
|
486
|
-
|
|
1311
|
+
"context": "auth",
|
|
1312
|
+
"properties": ["id", "email", "username", "role"],
|
|
1313
|
+
"relationships": [
|
|
1314
|
+
{"entity": "project", "type": "one-to-many"}
|
|
1315
|
+
],
|
|
1316
|
+
"invariants": [
|
|
1317
|
+
"email must be unique",
|
|
1318
|
+
"email must be verified before login"
|
|
1319
|
+
]
|
|
1320
|
+
}
|
|
1321
|
+
],
|
|
1322
|
+
"rules": [
|
|
1323
|
+
{
|
|
1324
|
+
"id": "no-circular-deps",
|
|
1325
|
+
"description": "No circular dependencies allowed",
|
|
1326
|
+
"severity": "error",
|
|
1327
|
+
"check": "circular-dependencies"
|
|
1328
|
+
},
|
|
1329
|
+
{
|
|
1330
|
+
"id": "layer-separation",
|
|
1331
|
+
"description": "UI layer cannot depend on database layer",
|
|
1332
|
+
"severity": "error",
|
|
1333
|
+
"check": "layer-violation",
|
|
1334
|
+
"config": {
|
|
1335
|
+
"layers": ["ui", "business", "data"],
|
|
1336
|
+
"allowedDependencies": {
|
|
1337
|
+
"ui": ["business"],
|
|
1338
|
+
"business": ["data"],
|
|
1339
|
+
"data": []
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
],
|
|
1344
|
+
"invariants": [
|
|
1345
|
+
"All API endpoints must have rate limiting",
|
|
1346
|
+
"All user actions must be logged in audit",
|
|
1347
|
+
"Passwords must be hashed with bcrypt"
|
|
1348
|
+
]
|
|
1349
|
+
}
|
|
1350
|
+
```
|
|
1351
|
+
|
|
1352
|
+
### Docker Compose Configuration
|
|
1353
|
+
|
|
1354
|
+
Пример production `docker-compose.yml`:
|
|
1355
|
+
|
|
1356
|
+
```yaml
|
|
1357
|
+
version: '3.9'
|
|
1358
|
+
|
|
1359
|
+
services:
|
|
1360
|
+
# ArchiCore Application
|
|
1361
|
+
archicore:
|
|
1362
|
+
build: .
|
|
1363
|
+
container_name: archicore
|
|
1364
|
+
restart: unless-stopped
|
|
1365
|
+
ports:
|
|
1366
|
+
- "3000:3000"
|
|
1367
|
+
environment:
|
|
1368
|
+
- NODE_ENV=production
|
|
1369
|
+
- DATABASE_URL=postgresql://postgres:${DB_PASSWORD}@postgres:5432/archicore
|
|
1370
|
+
- REDIS_URL=redis://redis:6379
|
|
1371
|
+
- QDRANT_URL=http://qdrant:6333
|
|
1372
|
+
env_file:
|
|
1373
|
+
- .env
|
|
1374
|
+
depends_on:
|
|
1375
|
+
- postgres
|
|
1376
|
+
- redis
|
|
1377
|
+
- qdrant
|
|
1378
|
+
volumes:
|
|
1379
|
+
- ./data:/app/data
|
|
1380
|
+
networks:
|
|
1381
|
+
- archicore-network
|
|
1382
|
+
healthcheck:
|
|
1383
|
+
test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
|
|
1384
|
+
interval: 30s
|
|
1385
|
+
timeout: 10s
|
|
1386
|
+
retries: 3
|
|
1387
|
+
|
|
1388
|
+
# PostgreSQL Database
|
|
1389
|
+
postgres:
|
|
1390
|
+
image: postgres:15-alpine
|
|
1391
|
+
container_name: archicore-postgres
|
|
1392
|
+
restart: unless-stopped
|
|
1393
|
+
environment:
|
|
1394
|
+
- POSTGRES_USER=postgres
|
|
1395
|
+
- POSTGRES_PASSWORD=${DB_PASSWORD}
|
|
1396
|
+
- POSTGRES_DB=archicore
|
|
1397
|
+
volumes:
|
|
1398
|
+
- postgres-data:/var/lib/postgresql/data
|
|
1399
|
+
networks:
|
|
1400
|
+
- archicore-network
|
|
1401
|
+
healthcheck:
|
|
1402
|
+
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
|
1403
|
+
interval: 10s
|
|
1404
|
+
timeout: 5s
|
|
1405
|
+
retries: 5
|
|
1406
|
+
|
|
1407
|
+
# Redis Cache
|
|
1408
|
+
redis:
|
|
1409
|
+
image: redis:7-alpine
|
|
1410
|
+
container_name: archicore-redis
|
|
1411
|
+
restart: unless-stopped
|
|
1412
|
+
command: redis-server --appendonly yes
|
|
1413
|
+
volumes:
|
|
1414
|
+
- redis-data:/data
|
|
1415
|
+
networks:
|
|
1416
|
+
- archicore-network
|
|
1417
|
+
healthcheck:
|
|
1418
|
+
test: ["CMD", "redis-cli", "ping"]
|
|
1419
|
+
interval: 10s
|
|
1420
|
+
timeout: 3s
|
|
1421
|
+
retries: 3
|
|
1422
|
+
|
|
1423
|
+
# Qdrant Vector Database
|
|
1424
|
+
qdrant:
|
|
1425
|
+
image: qdrant/qdrant:latest
|
|
1426
|
+
container_name: archicore-qdrant
|
|
1427
|
+
restart: unless-stopped
|
|
1428
|
+
volumes:
|
|
1429
|
+
- qdrant-data:/qdrant/storage
|
|
1430
|
+
networks:
|
|
1431
|
+
- archicore-network
|
|
1432
|
+
healthcheck:
|
|
1433
|
+
test: ["CMD-SHELL", "timeout 1 bash -c '</dev/tcp/localhost/6333'"]
|
|
1434
|
+
interval: 10s
|
|
1435
|
+
timeout: 5s
|
|
1436
|
+
retries: 3
|
|
1437
|
+
|
|
1438
|
+
# Nginx Reverse Proxy (Optional)
|
|
1439
|
+
nginx:
|
|
1440
|
+
image: nginx:alpine
|
|
1441
|
+
container_name: archicore-nginx
|
|
1442
|
+
restart: unless-stopped
|
|
1443
|
+
ports:
|
|
1444
|
+
- "80:80"
|
|
1445
|
+
- "443:443"
|
|
1446
|
+
volumes:
|
|
1447
|
+
- ./nginx.conf:/etc/nginx/nginx.conf:ro
|
|
1448
|
+
- ./ssl:/etc/nginx/ssl:ro
|
|
1449
|
+
depends_on:
|
|
1450
|
+
- archicore
|
|
1451
|
+
networks:
|
|
1452
|
+
- archicore-network
|
|
1453
|
+
|
|
1454
|
+
volumes:
|
|
1455
|
+
postgres-data:
|
|
1456
|
+
redis-data:
|
|
1457
|
+
qdrant-data:
|
|
1458
|
+
|
|
1459
|
+
networks:
|
|
1460
|
+
archicore-network:
|
|
1461
|
+
driver: bridge
|
|
1462
|
+
```
|
|
1463
|
+
|
|
1464
|
+
---
|
|
1465
|
+
|
|
1466
|
+
## 🚢 Deployment
|
|
1467
|
+
|
|
1468
|
+
### Production Deployment (Linux Server)
|
|
1469
|
+
|
|
1470
|
+
Полная инструкция для deployment на production сервер.
|
|
1471
|
+
|
|
1472
|
+
#### Prerequisites
|
|
1473
|
+
|
|
1474
|
+
- Ubuntu 20.04+ / Debian 11+ / CentOS 8+
|
|
1475
|
+
- Root или sudo доступ
|
|
1476
|
+
- Домен с настроенным DNS (A record → server IP)
|
|
1477
|
+
|
|
1478
|
+
#### Step 1: Prepare Server
|
|
1479
|
+
|
|
1480
|
+
```bash
|
|
1481
|
+
# Обновить систему
|
|
1482
|
+
sudo apt update && sudo apt upgrade -y
|
|
1483
|
+
|
|
1484
|
+
# Установить Docker
|
|
1485
|
+
curl -fsSL https://get.docker.com -o get-docker.sh
|
|
1486
|
+
sudo sh get-docker.sh
|
|
1487
|
+
sudo usermod -aG docker $USER
|
|
1488
|
+
|
|
1489
|
+
# Установить Docker Compose
|
|
1490
|
+
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
|
|
1491
|
+
sudo chmod +x /usr/local/bin/docker-compose
|
|
1492
|
+
|
|
1493
|
+
# Установить Nginx
|
|
1494
|
+
sudo apt install nginx -y
|
|
1495
|
+
|
|
1496
|
+
# Установить Certbot (Let's Encrypt)
|
|
1497
|
+
sudo apt install certbot python3-certbot-nginx -y
|
|
1498
|
+
```
|
|
1499
|
+
|
|
1500
|
+
#### Step 2: Clone & Configure
|
|
1501
|
+
|
|
1502
|
+
```bash
|
|
1503
|
+
# Клонировать репозиторий
|
|
1504
|
+
cd /opt
|
|
1505
|
+
sudo git clone https://github.com/yourusername/archicore.git
|
|
1506
|
+
cd archicore
|
|
1507
|
+
|
|
1508
|
+
# Создать .env
|
|
1509
|
+
sudo cp .env.example .env
|
|
1510
|
+
sudo nano .env # Заполнить production значения
|
|
1511
|
+
|
|
1512
|
+
# Установить правильные permissions
|
|
1513
|
+
sudo chown -R $USER:$USER /opt/archicore
|
|
1514
|
+
```
|
|
1515
|
+
|
|
1516
|
+
#### Step 3: SSL Certificate
|
|
1517
|
+
|
|
1518
|
+
```bash
|
|
1519
|
+
# Получить SSL сертификат
|
|
1520
|
+
sudo certbot --nginx -d archicore.io -d www.archicore.io -d api.archicore.io -d docs.archicore.io
|
|
1521
|
+
|
|
1522
|
+
# Auto-renewal настроен автоматически через systemd timer
|
|
1523
|
+
# Проверить:
|
|
1524
|
+
sudo systemctl status certbot.timer
|
|
1525
|
+
```
|
|
1526
|
+
|
|
1527
|
+
#### Step 4: Nginx Configuration
|
|
1528
|
+
|
|
1529
|
+
```bash
|
|
1530
|
+
# Создать конфиг
|
|
1531
|
+
sudo nano /etc/nginx/sites-available/archicore
|
|
1532
|
+
|
|
1533
|
+
# Вставить:
|
|
1534
|
+
```
|
|
1535
|
+
|
|
1536
|
+
```nginx
|
|
1537
|
+
# Main app (archicore.io)
|
|
1538
|
+
server {
|
|
1539
|
+
listen 443 ssl http2;
|
|
1540
|
+
server_name archicore.io www.archicore.io;
|
|
1541
|
+
|
|
1542
|
+
ssl_certificate /etc/letsencrypt/live/archicore.io/fullchain.pem;
|
|
1543
|
+
ssl_certificate_key /etc/letsencrypt/live/archicore.io/privkey.pem;
|
|
1544
|
+
|
|
1545
|
+
location / {
|
|
1546
|
+
proxy_pass http://localhost:3000;
|
|
1547
|
+
proxy_http_version 1.1;
|
|
1548
|
+
proxy_set_header Upgrade $http_upgrade;
|
|
1549
|
+
proxy_set_header Connection 'upgrade';
|
|
1550
|
+
proxy_set_header Host $host;
|
|
1551
|
+
proxy_set_header X-Real-IP $remote_addr;
|
|
1552
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
1553
|
+
proxy_set_header X-Forwarded-Proto $scheme;
|
|
1554
|
+
proxy_cache_bypass $http_upgrade;
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1558
|
+
# API subdomain (api.archicore.io)
|
|
1559
|
+
server {
|
|
1560
|
+
listen 443 ssl http2;
|
|
1561
|
+
server_name api.archicore.io;
|
|
1562
|
+
|
|
1563
|
+
ssl_certificate /etc/letsencrypt/live/archicore.io/fullchain.pem;
|
|
1564
|
+
ssl_certificate_key /etc/letsencrypt/live/archicore.io/privkey.pem;
|
|
1565
|
+
|
|
1566
|
+
location / {
|
|
1567
|
+
proxy_pass http://localhost:3000/api;
|
|
1568
|
+
proxy_http_version 1.1;
|
|
1569
|
+
proxy_set_header Host $host;
|
|
1570
|
+
proxy_set_header X-Real-IP $remote_addr;
|
|
1571
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
1572
|
+
proxy_set_header X-Forwarded-Proto $scheme;
|
|
1573
|
+
}
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1576
|
+
# Redirect HTTP to HTTPS
|
|
1577
|
+
server {
|
|
1578
|
+
listen 80;
|
|
1579
|
+
server_name archicore.io www.archicore.io api.archicore.io;
|
|
1580
|
+
return 301 https://$host$request_uri;
|
|
1581
|
+
}
|
|
1582
|
+
```
|
|
1583
|
+
|
|
1584
|
+
```bash
|
|
1585
|
+
# Включить сайт
|
|
1586
|
+
sudo ln -s /etc/nginx/sites-available/archicore /etc/nginx/sites-enabled/
|
|
1587
|
+
sudo nginx -t
|
|
1588
|
+
sudo systemctl reload nginx
|
|
1589
|
+
```
|
|
1590
|
+
|
|
1591
|
+
#### Step 5: Start Services
|
|
1592
|
+
|
|
1593
|
+
```bash
|
|
1594
|
+
cd /opt/archicore
|
|
1595
|
+
|
|
1596
|
+
# Собрать образы
|
|
1597
|
+
sudo docker compose build
|
|
1598
|
+
|
|
1599
|
+
# Запустить все сервисы
|
|
1600
|
+
sudo docker compose up -d
|
|
1601
|
+
|
|
1602
|
+
# Проверить статус
|
|
1603
|
+
sudo docker compose ps
|
|
1604
|
+
sudo docker compose logs -f archicore
|
|
1605
|
+
```
|
|
1606
|
+
|
|
1607
|
+
#### Step 6: Setup Systemd Service (Optional)
|
|
1608
|
+
|
|
1609
|
+
Для автоматического запуска при перезагрузке:
|
|
1610
|
+
|
|
1611
|
+
```bash
|
|
1612
|
+
sudo nano /etc/systemd/system/archicore.service
|
|
1613
|
+
```
|
|
1614
|
+
|
|
1615
|
+
```ini
|
|
1616
|
+
[Unit]
|
|
1617
|
+
Description=ArchiCore Application
|
|
1618
|
+
Requires=docker.service
|
|
1619
|
+
After=docker.service
|
|
1620
|
+
|
|
1621
|
+
[Service]
|
|
1622
|
+
Type=oneshot
|
|
1623
|
+
RemainAfterExit=yes
|
|
1624
|
+
WorkingDirectory=/opt/archicore
|
|
1625
|
+
ExecStart=/usr/local/bin/docker-compose up -d
|
|
1626
|
+
ExecStop=/usr/local/bin/docker-compose down
|
|
1627
|
+
TimeoutStartSec=0
|
|
1628
|
+
|
|
1629
|
+
[Install]
|
|
1630
|
+
WantedBy=multi-user.target
|
|
1631
|
+
```
|
|
1632
|
+
|
|
1633
|
+
```bash
|
|
1634
|
+
sudo systemctl enable archicore
|
|
1635
|
+
sudo systemctl start archicore
|
|
1636
|
+
```
|
|
1637
|
+
|
|
1638
|
+
#### Step 7: Monitoring & Logs
|
|
1639
|
+
|
|
1640
|
+
```bash
|
|
1641
|
+
# Просмотр логов
|
|
1642
|
+
sudo docker compose logs -f archicore
|
|
1643
|
+
sudo docker compose logs -f postgres
|
|
1644
|
+
sudo docker compose logs -f redis
|
|
1645
|
+
|
|
1646
|
+
# Статус контейнеров
|
|
1647
|
+
sudo docker compose ps
|
|
1648
|
+
|
|
1649
|
+
# Использование ресурсов
|
|
1650
|
+
sudo docker stats
|
|
1651
|
+
|
|
1652
|
+
# Nginx access log
|
|
1653
|
+
sudo tail -f /var/log/nginx/access.log
|
|
1654
|
+
|
|
1655
|
+
# Nginx error log
|
|
1656
|
+
sudo tail -f /var/log/nginx/error.log
|
|
1657
|
+
```
|
|
1658
|
+
|
|
1659
|
+
#### Step 8: Backup Strategy
|
|
1660
|
+
|
|
1661
|
+
```bash
|
|
1662
|
+
# Создать backup скрипт
|
|
1663
|
+
sudo nano /opt/archicore/backup.sh
|
|
1664
|
+
```
|
|
1665
|
+
|
|
1666
|
+
```bash
|
|
1667
|
+
#!/bin/bash
|
|
1668
|
+
BACKUP_DIR=/opt/backups/archicore
|
|
1669
|
+
DATE=$(date +%Y%m%d_%H%M%S)
|
|
1670
|
+
|
|
1671
|
+
# Создать директорию
|
|
1672
|
+
mkdir -p $BACKUP_DIR
|
|
1673
|
+
|
|
1674
|
+
# Backup PostgreSQL
|
|
1675
|
+
docker exec archicore-postgres pg_dump -U postgres archicore | gzip > $BACKUP_DIR/postgres_$DATE.sql.gz
|
|
1676
|
+
|
|
1677
|
+
# Backup Redis
|
|
1678
|
+
docker exec archicore-redis redis-cli BGSAVE
|
|
1679
|
+
docker cp archicore-redis:/data/dump.rdb $BACKUP_DIR/redis_$DATE.rdb
|
|
1680
|
+
|
|
1681
|
+
# Backup Qdrant
|
|
1682
|
+
docker cp archicore-qdrant:/qdrant/storage $BACKUP_DIR/qdrant_$DATE
|
|
1683
|
+
|
|
1684
|
+
# Удалить старые бэкапы (>30 дней)
|
|
1685
|
+
find $BACKUP_DIR -name "*.gz" -mtime +30 -delete
|
|
1686
|
+
|
|
1687
|
+
echo "Backup completed: $DATE"
|
|
1688
|
+
```
|
|
1689
|
+
|
|
1690
|
+
```bash
|
|
1691
|
+
# Сделать исполняемым
|
|
1692
|
+
sudo chmod +x /opt/archicore/backup.sh
|
|
1693
|
+
|
|
1694
|
+
# Добавить в cron (ежедневно в 2 AM)
|
|
1695
|
+
sudo crontab -e
|
|
1696
|
+
0 2 * * * /opt/archicore/backup.sh >> /var/log/archicore-backup.log 2>&1
|
|
1697
|
+
```
|
|
1698
|
+
|
|
1699
|
+
#### Step 9: Update Procedure
|
|
1700
|
+
|
|
1701
|
+
```bash
|
|
1702
|
+
# Обновление ArchiCore до новой версии
|
|
1703
|
+
cd /opt/archicore
|
|
1704
|
+
sudo git pull origin main
|
|
1705
|
+
sudo docker compose build
|
|
1706
|
+
sudo docker compose up -d
|
|
1707
|
+
|
|
1708
|
+
# Откатиться к предыдущей версии при проблемах
|
|
1709
|
+
sudo git log --oneline # Найти хеш коммита
|
|
1710
|
+
sudo git checkout <commit-hash>
|
|
1711
|
+
sudo docker compose build
|
|
1712
|
+
sudo docker compose up -d
|
|
1713
|
+
```
|
|
1714
|
+
|
|
1715
|
+
### CI/CD Pipeline (GitLab CI)
|
|
1716
|
+
|
|
1717
|
+
Пример `.gitlab-ci.yml`:
|
|
1718
|
+
|
|
1719
|
+
```yaml
|
|
1720
|
+
stages:
|
|
1721
|
+
- test
|
|
1722
|
+
- build
|
|
1723
|
+
- deploy
|
|
1724
|
+
|
|
1725
|
+
variables:
|
|
1726
|
+
DOCKER_DRIVER: overlay2
|
|
1727
|
+
DOCKER_TLS_CERTDIR: "/certs"
|
|
1728
|
+
|
|
1729
|
+
# Run tests
|
|
1730
|
+
test:
|
|
1731
|
+
stage: test
|
|
1732
|
+
image: node:18
|
|
1733
|
+
cache:
|
|
1734
|
+
paths:
|
|
1735
|
+
- node_modules/
|
|
1736
|
+
script:
|
|
1737
|
+
- npm ci
|
|
1738
|
+
- npm run lint
|
|
1739
|
+
- npm run test # Когда тесты будут написаны
|
|
1740
|
+
only:
|
|
1741
|
+
- merge_requests
|
|
1742
|
+
- main
|
|
1743
|
+
|
|
1744
|
+
# Build Docker image
|
|
1745
|
+
build:
|
|
1746
|
+
stage: build
|
|
1747
|
+
image: docker:latest
|
|
1748
|
+
services:
|
|
1749
|
+
- docker:dind
|
|
1750
|
+
script:
|
|
1751
|
+
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
|
1752
|
+
- docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA .
|
|
1753
|
+
- docker build -t $CI_REGISTRY_IMAGE:latest .
|
|
1754
|
+
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
|
|
1755
|
+
- docker push $CI_REGISTRY_IMAGE:latest
|
|
1756
|
+
only:
|
|
1757
|
+
- main
|
|
1758
|
+
|
|
1759
|
+
# Deploy to production
|
|
1760
|
+
deploy_production:
|
|
1761
|
+
stage: deploy
|
|
1762
|
+
image: alpine:latest
|
|
1763
|
+
before_script:
|
|
1764
|
+
- apk add --no-cache openssh-client
|
|
1765
|
+
- eval $(ssh-agent -s)
|
|
1766
|
+
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
|
|
1767
|
+
- mkdir -p ~/.ssh
|
|
1768
|
+
- chmod 700 ~/.ssh
|
|
1769
|
+
- ssh-keyscan $PRODUCTION_SERVER >> ~/.ssh/known_hosts
|
|
1770
|
+
script:
|
|
1771
|
+
- ssh $PRODUCTION_USER@$PRODUCTION_SERVER "cd /opt/archicore && git pull && docker compose pull && docker compose up -d"
|
|
1772
|
+
only:
|
|
1773
|
+
- main
|
|
1774
|
+
when: manual
|
|
1775
|
+
```
|
|
1776
|
+
|
|
1777
|
+
---
|
|
1778
|
+
|
|
1779
|
+
## 📚 API Reference
|
|
1780
|
+
|
|
1781
|
+
### Authentication API
|
|
1782
|
+
|
|
1783
|
+
#### POST /api/auth/register
|
|
1784
|
+
|
|
1785
|
+
Регистрация нового пользователя.
|
|
1786
|
+
|
|
1787
|
+
**Request:**
|
|
1788
|
+
```json
|
|
1789
|
+
{
|
|
1790
|
+
"email": "user@example.com",
|
|
1791
|
+
"password": "SecurePass123!",
|
|
1792
|
+
"username": "johndoe"
|
|
1793
|
+
}
|
|
1794
|
+
```
|
|
1795
|
+
|
|
1796
|
+
**Response (200):**
|
|
1797
|
+
```json
|
|
1798
|
+
{
|
|
1799
|
+
"success": true,
|
|
1800
|
+
"message": "Verification code sent to your email"
|
|
1801
|
+
}
|
|
1802
|
+
```
|
|
1803
|
+
|
|
1804
|
+
**Errors:**
|
|
1805
|
+
- `400` - Invalid email/password, disposable email blocked
|
|
1806
|
+
- `409` - Email already exists
|
|
1807
|
+
|
|
1808
|
+
---
|
|
1809
|
+
|
|
1810
|
+
#### POST /api/auth/verify-email
|
|
1811
|
+
|
|
1812
|
+
Подтверждение email с verification code.
|
|
1813
|
+
|
|
1814
|
+
**Request:**
|
|
1815
|
+
```json
|
|
1816
|
+
{
|
|
1817
|
+
"email": "user@example.com",
|
|
1818
|
+
"code": "123456"
|
|
1819
|
+
}
|
|
1820
|
+
```
|
|
1821
|
+
|
|
1822
|
+
**Response (200):**
|
|
1823
|
+
```json
|
|
1824
|
+
{
|
|
1825
|
+
"success": true,
|
|
1826
|
+
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
|
|
1827
|
+
"user": {
|
|
1828
|
+
"id": "usr_abc123",
|
|
1829
|
+
"email": "user@example.com",
|
|
1830
|
+
"username": "johndoe",
|
|
1831
|
+
"role": "user",
|
|
1832
|
+
"tier": "free",
|
|
1833
|
+
"createdAt": "2026-01-17T10:00:00Z"
|
|
1834
|
+
}
|
|
1835
|
+
}
|
|
1836
|
+
```
|
|
1837
|
+
|
|
1838
|
+
**Errors:**
|
|
1839
|
+
- `400` - Invalid or expired code
|
|
1840
|
+
- `404` - Email not found
|
|
1841
|
+
|
|
1842
|
+
---
|
|
1843
|
+
|
|
1844
|
+
#### POST /api/auth/login
|
|
1845
|
+
|
|
1846
|
+
Вход с email и паролем.
|
|
1847
|
+
|
|
1848
|
+
**Request:**
|
|
1849
|
+
```json
|
|
1850
|
+
{
|
|
1851
|
+
"email": "user@example.com",
|
|
1852
|
+
"password": "SecurePass123!"
|
|
1853
|
+
}
|
|
1854
|
+
```
|
|
1855
|
+
|
|
1856
|
+
**Response (200):**
|
|
1857
|
+
```json
|
|
1858
|
+
{
|
|
1859
|
+
"success": true,
|
|
1860
|
+
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
|
|
1861
|
+
"user": {
|
|
1862
|
+
"id": "usr_abc123",
|
|
1863
|
+
"email": "user@example.com",
|
|
1864
|
+
"username": "johndoe",
|
|
1865
|
+
"role": "user",
|
|
1866
|
+
"tier": "pro",
|
|
1867
|
+
"createdAt": "2026-01-17T10:00:00Z"
|
|
1868
|
+
}
|
|
1869
|
+
}
|
|
1870
|
+
```
|
|
1871
|
+
|
|
1872
|
+
**Errors:**
|
|
1873
|
+
- `401` - Invalid credentials
|
|
1874
|
+
- `403` - Email not verified
|
|
1875
|
+
|
|
1876
|
+
---
|
|
1877
|
+
|
|
1878
|
+
### Projects API
|
|
1879
|
+
|
|
1880
|
+
#### GET /api/projects
|
|
1881
|
+
|
|
1882
|
+
Получить список проектов пользователя.
|
|
1883
|
+
|
|
1884
|
+
**Headers:**
|
|
1885
|
+
```
|
|
1886
|
+
Authorization: Bearer <token>
|
|
1887
|
+
```
|
|
1888
|
+
|
|
1889
|
+
**Response (200):**
|
|
1890
|
+
```json
|
|
1891
|
+
{
|
|
1892
|
+
"success": true,
|
|
1893
|
+
"projects": [
|
|
1894
|
+
{
|
|
1895
|
+
"id": "proj_abc123",
|
|
1896
|
+
"name": "E-commerce Platform",
|
|
1897
|
+
"description": "Online store backend",
|
|
1898
|
+
"githubUrl": "https://github.com/user/ecommerce",
|
|
1899
|
+
"language": "TypeScript",
|
|
1900
|
+
"filesCount": 243,
|
|
1901
|
+
"linesOfCode": 15420,
|
|
1902
|
+
"indexed": true,
|
|
1903
|
+
"lastIndexed": "2026-01-17T12:00:00Z",
|
|
1904
|
+
"createdAt": "2026-01-15T10:00:00Z"
|
|
1905
|
+
}
|
|
1906
|
+
]
|
|
1907
|
+
}
|
|
1908
|
+
```
|
|
1909
|
+
|
|
1910
|
+
---
|
|
1911
|
+
|
|
1912
|
+
#### POST /api/projects
|
|
1913
|
+
|
|
1914
|
+
Создать новый проект.
|
|
1915
|
+
|
|
1916
|
+
**Request:**
|
|
1917
|
+
```json
|
|
1918
|
+
{
|
|
1919
|
+
"name": "E-commerce Platform",
|
|
1920
|
+
"description": "Online store backend",
|
|
1921
|
+
"githubUrl": "https://github.com/user/ecommerce"
|
|
1922
|
+
}
|
|
1923
|
+
```
|
|
1924
|
+
|
|
1925
|
+
**Response (201):**
|
|
1926
|
+
```json
|
|
1927
|
+
{
|
|
1928
|
+
"success": true,
|
|
1929
|
+
"project": {
|
|
1930
|
+
"id": "proj_abc123",
|
|
1931
|
+
"name": "E-commerce Platform",
|
|
1932
|
+
"description": "Online store backend",
|
|
1933
|
+
"githubUrl": "https://github.com/user/ecommerce",
|
|
1934
|
+
"indexed": false,
|
|
1935
|
+
"createdAt": "2026-01-17T12:00:00Z"
|
|
1936
|
+
}
|
|
1937
|
+
}
|
|
1938
|
+
```
|
|
1939
|
+
|
|
1940
|
+
---
|
|
1941
|
+
|
|
1942
|
+
#### POST /api/projects/:id/index
|
|
1943
|
+
|
|
1944
|
+
Индексировать код проекта.
|
|
1945
|
+
|
|
1946
|
+
**Response (200):**
|
|
1947
|
+
```json
|
|
1948
|
+
{
|
|
1949
|
+
"success": true,
|
|
1950
|
+
"stats": {
|
|
1951
|
+
"filesProcessed": 243,
|
|
1952
|
+
"symbolsExtracted": 1854,
|
|
1953
|
+
"graphNodes": 2107,
|
|
1954
|
+
"graphEdges": 4523,
|
|
1955
|
+
"vectorsCreated": 1854,
|
|
1956
|
+
"languages": {
|
|
1957
|
+
"TypeScript": 180,
|
|
1958
|
+
"JavaScript": 45,
|
|
1959
|
+
"JSON": 18
|
|
1960
|
+
},
|
|
1961
|
+
"symbols": {
|
|
1962
|
+
"function": 892,
|
|
1963
|
+
"class": 156,
|
|
1964
|
+
"interface": 234,
|
|
1965
|
+
"variable": 572
|
|
1966
|
+
}
|
|
1967
|
+
}
|
|
1968
|
+
}
|
|
1969
|
+
```
|
|
1970
|
+
|
|
1971
|
+
---
|
|
1972
|
+
|
|
1973
|
+
### Analysis API
|
|
1974
|
+
|
|
1975
|
+
#### POST /api/analyze/impact
|
|
1976
|
+
|
|
1977
|
+
Анализ влияния изменений.
|
|
1978
|
+
|
|
1979
|
+
**Request:**
|
|
1980
|
+
```json
|
|
1981
|
+
{
|
|
1982
|
+
"projectId": "proj_abc123",
|
|
1983
|
+
"change": {
|
|
1984
|
+
"type": "modify",
|
|
1985
|
+
"description": "Refactor payment service",
|
|
1986
|
+
"files": ["src/services/payment-service.ts"],
|
|
1987
|
+
"symbols": ["PaymentService", "processPayment"]
|
|
1988
|
+
}
|
|
1989
|
+
}
|
|
1990
|
+
```
|
|
1991
|
+
|
|
1992
|
+
**Response (200):**
|
|
1993
|
+
```json
|
|
1994
|
+
{
|
|
1995
|
+
"success": true,
|
|
1996
|
+
"impact": {
|
|
1997
|
+
"affectedComponents": [
|
|
1998
|
+
{
|
|
1999
|
+
"id": "PaymentController",
|
|
2000
|
+
"file": "src/controllers/payment.ts",
|
|
2001
|
+
"line": 45,
|
|
2002
|
+
"severity": "critical",
|
|
2003
|
+
"reason": "Direct dependency on PaymentService"
|
|
2004
|
+
},
|
|
2005
|
+
{
|
|
2006
|
+
"id": "OrderService",
|
|
2007
|
+
"file": "src/services/order-service.ts",
|
|
2008
|
+
"line": 120,
|
|
2009
|
+
"severity": "high",
|
|
2010
|
+
"reason": "Calls PaymentService.processPayment()"
|
|
2011
|
+
}
|
|
2012
|
+
],
|
|
2013
|
+
"risks": [
|
|
2014
|
+
{
|
|
2015
|
+
"severity": "critical",
|
|
2016
|
+
"message": "Breaking change in public API",
|
|
2017
|
+
"recommendation": "Add deprecation warnings"
|
|
2018
|
+
},
|
|
2019
|
+
{
|
|
2020
|
+
"severity": "high",
|
|
2021
|
+
"message": "12 components depend on modified code",
|
|
2022
|
+
"recommendation": "Review all affected components"
|
|
2023
|
+
}
|
|
2024
|
+
],
|
|
2025
|
+
"recommendations": [
|
|
2026
|
+
"Add integration tests for payment flow",
|
|
2027
|
+
"Update API documentation",
|
|
2028
|
+
"Notify team about breaking changes"
|
|
2029
|
+
],
|
|
2030
|
+
"summary": {
|
|
2031
|
+
"total": 23,
|
|
2032
|
+
"critical": 3,
|
|
2033
|
+
"high": 12,
|
|
2034
|
+
"medium": 6,
|
|
2035
|
+
"low": 2
|
|
2036
|
+
}
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
2039
|
+
```
|
|
2040
|
+
|
|
2041
|
+
---
|
|
2042
|
+
|
|
2043
|
+
#### POST /api/analyze/security
|
|
2044
|
+
|
|
2045
|
+
Анализ безопасности кода.
|
|
2046
|
+
|
|
2047
|
+
**Response (200):**
|
|
2048
|
+
```json
|
|
2049
|
+
{
|
|
2050
|
+
"success": true,
|
|
2051
|
+
"findings": [
|
|
2052
|
+
{
|
|
2053
|
+
"severity": "critical",
|
|
2054
|
+
"type": "SQL Injection",
|
|
2055
|
+
"file": "src/database/users.ts",
|
|
2056
|
+
"line": 45,
|
|
2057
|
+
"message": "Unsanitized user input in SQL query",
|
|
2058
|
+
"recommendation": "Use parameterized queries"
|
|
2059
|
+
},
|
|
2060
|
+
{
|
|
2061
|
+
"severity": "high",
|
|
2062
|
+
"type": "XSS Vulnerability",
|
|
2063
|
+
"file": "src/views/profile.ts",
|
|
2064
|
+
"line": 23,
|
|
2065
|
+
"message": "Unescaped user content in HTML",
|
|
2066
|
+
"recommendation": "Use proper HTML escaping"
|
|
487
2067
|
}
|
|
488
2068
|
],
|
|
489
|
-
"
|
|
490
|
-
|
|
2069
|
+
"summary": {
|
|
2070
|
+
"critical": 1,
|
|
2071
|
+
"high": 3,
|
|
2072
|
+
"medium": 7,
|
|
2073
|
+
"low": 12,
|
|
2074
|
+
"info": 5
|
|
2075
|
+
}
|
|
2076
|
+
}
|
|
2077
|
+
```
|
|
2078
|
+
|
|
2079
|
+
---
|
|
2080
|
+
|
|
2081
|
+
### AI API
|
|
2082
|
+
|
|
2083
|
+
#### POST /api/ai/search
|
|
2084
|
+
|
|
2085
|
+
Семантический поиск кода.
|
|
2086
|
+
|
|
2087
|
+
**Request:**
|
|
2088
|
+
```json
|
|
2089
|
+
{
|
|
2090
|
+
"projectId": "proj_abc123",
|
|
2091
|
+
"query": "функции валидации email",
|
|
2092
|
+
"limit": 5
|
|
2093
|
+
}
|
|
2094
|
+
```
|
|
2095
|
+
|
|
2096
|
+
**Response (200):**
|
|
2097
|
+
```json
|
|
2098
|
+
{
|
|
2099
|
+
"success": true,
|
|
2100
|
+
"results": [
|
|
2101
|
+
{
|
|
2102
|
+
"file": "src/utils/validators.ts",
|
|
2103
|
+
"line": 45,
|
|
2104
|
+
"code": "export function validateEmail(email: string): boolean {",
|
|
2105
|
+
"relevance": 0.942,
|
|
2106
|
+
"context": "Email validation utility"
|
|
2107
|
+
},
|
|
2108
|
+
{
|
|
2109
|
+
"file": "src/auth/email-validator.ts",
|
|
2110
|
+
"line": 12,
|
|
2111
|
+
"code": "class EmailValidator implements IValidator {",
|
|
2112
|
+
"relevance": 0.897,
|
|
2113
|
+
"context": "Authentication email validation"
|
|
2114
|
+
}
|
|
2115
|
+
]
|
|
2116
|
+
}
|
|
2117
|
+
```
|
|
2118
|
+
|
|
2119
|
+
---
|
|
2120
|
+
|
|
2121
|
+
#### POST /api/ai/ask
|
|
2122
|
+
|
|
2123
|
+
Задать вопрос AI архитектору.
|
|
2124
|
+
|
|
2125
|
+
**Request:**
|
|
2126
|
+
```json
|
|
2127
|
+
{
|
|
2128
|
+
"projectId": "proj_abc123",
|
|
2129
|
+
"question": "Как организована аутентификация в системе?"
|
|
491
2130
|
}
|
|
492
2131
|
```
|
|
493
2132
|
|
|
494
|
-
|
|
2133
|
+
**Response (200):**
|
|
2134
|
+
```json
|
|
2135
|
+
{
|
|
2136
|
+
"success": true,
|
|
2137
|
+
"answer": "В системе используется многоуровневая аутентификация:\n\n1. **JWT Tokens** - основной механизм (src/auth/jwt.ts)\n2. **OAuth 2.0** - Google и GitHub (src/auth/oauth/)\n3. **Email Verification** - подтверждение через SMTP (src/auth/email-verify.ts)\n\nПоток аутентификации:\n- User → Email+Password OR OAuth\n- Verification code → Email\n- Code validation → JWT token\n- Token → Stored in localStorage\n- Requests → Authorization: Bearer <token>\n\nБезопасность:\n- Passwords: bcrypt (10 rounds)\n- Tokens: HS256, 24h expiry\n- Rate limiting: 5 attempts/15min",
|
|
2138
|
+
"sources": [
|
|
2139
|
+
{"file": "src/auth/jwt.ts", "relevance": 0.95},
|
|
2140
|
+
{"file": "src/auth/oauth/google.ts", "relevance": 0.88},
|
|
2141
|
+
{"file": "src/auth/email-verify.ts", "relevance": 0.91}
|
|
2142
|
+
]
|
|
2143
|
+
}
|
|
2144
|
+
```
|
|
2145
|
+
|
|
2146
|
+
---
|
|
2147
|
+
|
|
2148
|
+
## 🛠️ Development
|
|
2149
|
+
|
|
2150
|
+
### Setup Development Environment
|
|
2151
|
+
|
|
2152
|
+
```bash
|
|
2153
|
+
# Clone repository
|
|
2154
|
+
git clone https://github.com/yourusername/archicore.git
|
|
2155
|
+
cd archicore
|
|
2156
|
+
|
|
2157
|
+
# Install dependencies
|
|
2158
|
+
npm install
|
|
2159
|
+
|
|
2160
|
+
# Start databases (Docker)
|
|
2161
|
+
docker compose -f docker-compose.dev.yml up -d
|
|
2162
|
+
|
|
2163
|
+
# Copy env file
|
|
2164
|
+
cp .env.example .env
|
|
2165
|
+
|
|
2166
|
+
# Fill in development keys
|
|
2167
|
+
nano .env
|
|
2168
|
+
|
|
2169
|
+
# Start in development mode (with hot reload)
|
|
2170
|
+
npm run dev
|
|
2171
|
+
```
|
|
2172
|
+
|
|
2173
|
+
### Project Structure
|
|
2174
|
+
|
|
2175
|
+
```
|
|
2176
|
+
archicore/
|
|
2177
|
+
├── public/ # Frontend (SPA-like vanilla JS)
|
|
2178
|
+
│ ├── index.html # Dashboard
|
|
2179
|
+
│ ├── auth.html # Authentication page
|
|
2180
|
+
│ ├── pricing.html # Pricing page
|
|
2181
|
+
│ ├── admin.html # Admin panel
|
|
2182
|
+
│ ├── privacy.html # Privacy policy
|
|
2183
|
+
│ ├── terms.html # Terms of service
|
|
2184
|
+
│ └── assets/ # Static assets
|
|
2185
|
+
├── src/
|
|
2186
|
+
│ ├── server/ # Backend (Express)
|
|
2187
|
+
│ │ ├── routes/ # API routes
|
|
2188
|
+
│ │ │ ├── auth.ts # Authentication endpoints
|
|
2189
|
+
│ │ │ ├── oauth.ts # OAuth flows
|
|
2190
|
+
│ │ │ ├── projects.ts # Project management
|
|
2191
|
+
│ │ │ ├── analyze.ts # Analysis endpoints
|
|
2192
|
+
│ │ │ ├── ai.ts # AI endpoints
|
|
2193
|
+
│ │ │ ├── admin.ts # Admin endpoints
|
|
2194
|
+
│ │ │ └── developer.ts # API keys management
|
|
2195
|
+
│ │ ├── services/ # Business logic
|
|
2196
|
+
│ │ │ ├── auth-service.ts
|
|
2197
|
+
│ │ │ ├── audit-service.ts
|
|
2198
|
+
│ │ │ ├── database.ts
|
|
2199
|
+
│ │ │ ├── email-service.ts
|
|
2200
|
+
│ │ │ └── encryption.ts
|
|
2201
|
+
│ │ ├── config/ # Configuration
|
|
2202
|
+
│ │ │ └── passport.ts # OAuth strategies
|
|
2203
|
+
│ │ └── middleware/ # Express middleware
|
|
2204
|
+
│ ├── code-index/ # Code indexing engine
|
|
2205
|
+
│ │ ├── index.ts # Main indexer
|
|
2206
|
+
│ │ ├── ast-parser.ts # Tree-sitter parser
|
|
2207
|
+
│ │ ├── symbol-extractor.ts
|
|
2208
|
+
│ │ └── dependency-graph.ts
|
|
2209
|
+
│ ├── semantic-memory/ # Vector DB layer
|
|
2210
|
+
│ │ ├── index.ts
|
|
2211
|
+
│ │ ├── embedding-service.ts # Jina AI
|
|
2212
|
+
│ │ └── vector-store.ts # Qdrant
|
|
2213
|
+
│ ├── impact-engine/ # Change impact analysis
|
|
2214
|
+
│ │ └── index.ts
|
|
2215
|
+
│ ├── orchestrator/ # AI orchestration
|
|
2216
|
+
│ │ └── index.ts # Claude/GPT/DeepSeek
|
|
2217
|
+
│ ├── analyzers/ # Code analyzers
|
|
2218
|
+
│ │ ├── security.ts
|
|
2219
|
+
│ │ ├── dead-code.ts
|
|
2220
|
+
│ │ ├── duplication.ts
|
|
2221
|
+
│ │ └── metrics.ts
|
|
2222
|
+
│ ├── cli/ # CLI tool
|
|
2223
|
+
│ │ └── commands/
|
|
2224
|
+
│ ├── types/ # TypeScript types
|
|
2225
|
+
│ └── utils/ # Utilities
|
|
2226
|
+
├── .archicore/ # Architecture config
|
|
2227
|
+
│ └── architecture.json
|
|
2228
|
+
├── docker-compose.yml # Production compose
|
|
2229
|
+
├── docker-compose.dev.yml # Development compose
|
|
2230
|
+
├── Dockerfile
|
|
2231
|
+
├── package.json
|
|
2232
|
+
├── tsconfig.json
|
|
2233
|
+
└── README.md
|
|
2234
|
+
```
|
|
2235
|
+
|
|
2236
|
+
### Available Scripts
|
|
2237
|
+
|
|
2238
|
+
```bash
|
|
2239
|
+
# Development
|
|
2240
|
+
npm run dev # Start with hot reload (tsx watch)
|
|
2241
|
+
npm run dev:debug # Start with debugger
|
|
2242
|
+
|
|
2243
|
+
# Build
|
|
2244
|
+
npm run build # Compile TypeScript
|
|
2245
|
+
npm run build:frontend # Minify & obfuscate frontend
|
|
2246
|
+
npm run build:all # Build backend + frontend
|
|
2247
|
+
|
|
2248
|
+
# Production
|
|
2249
|
+
npm start # Start production server
|
|
2250
|
+
|
|
2251
|
+
# CLI
|
|
2252
|
+
npm run cli # Run CLI commands
|
|
2253
|
+
|
|
2254
|
+
# Database
|
|
2255
|
+
npm run db:migrate # Run migrations (planned)
|
|
2256
|
+
npm run db:seed # Seed database (planned)
|
|
2257
|
+
|
|
2258
|
+
# Testing
|
|
2259
|
+
npm test # Run tests (planned)
|
|
2260
|
+
npm run test:watch # Watch mode (planned)
|
|
2261
|
+
npm run test:coverage # Coverage report (planned)
|
|
2262
|
+
|
|
2263
|
+
# Linting
|
|
2264
|
+
npm run lint # ESLint
|
|
2265
|
+
npm run lint:fix # Auto-fix issues
|
|
2266
|
+
npm run format # Prettier (planned)
|
|
2267
|
+
|
|
2268
|
+
# Docker
|
|
2269
|
+
npm run docker:build # Build Docker image
|
|
2270
|
+
npm run docker:up # Start containers
|
|
2271
|
+
npm run docker:down # Stop containers
|
|
2272
|
+
npm run docker:logs # View logs
|
|
2273
|
+
```
|
|
2274
|
+
|
|
2275
|
+
### Code Style
|
|
2276
|
+
|
|
2277
|
+
- **Language**: TypeScript (strict mode)
|
|
2278
|
+
- **Formatting**: Prettier (2 spaces, single quotes)
|
|
2279
|
+
- **Linting**: ESLint (Airbnb config)
|
|
2280
|
+
- **Naming**:
|
|
2281
|
+
- Files: `kebab-case.ts`
|
|
2282
|
+
- Classes: `PascalCase`
|
|
2283
|
+
- Functions: `camelCase`
|
|
2284
|
+
- Constants: `UPPER_SNAKE_CASE`
|
|
2285
|
+
- Interfaces: `PascalCase` (no `I` prefix)
|
|
2286
|
+
|
|
2287
|
+
### Contributing Guidelines
|
|
2288
|
+
|
|
2289
|
+
1. **Fork** the repository
|
|
2290
|
+
2. **Create** feature branch (`git checkout -b feature/amazing-feature`)
|
|
2291
|
+
3. **Commit** changes (`git commit -m 'Add amazing feature'`)
|
|
2292
|
+
4. **Push** to branch (`git push origin feature/amazing-feature`)
|
|
2293
|
+
5. **Open** Pull Request
|
|
2294
|
+
|
|
2295
|
+
**PR Requirements:**
|
|
2296
|
+
- Clear description of changes
|
|
2297
|
+
- Tests for new features (when test framework is ready)
|
|
2298
|
+
- No linting errors
|
|
2299
|
+
- Updated documentation if needed
|
|
2300
|
+
|
|
2301
|
+
---
|
|
2302
|
+
|
|
2303
|
+
## 🗺️ Roadmap
|
|
2304
|
+
|
|
2305
|
+
### Q1 2026 (Current)
|
|
2306
|
+
|
|
2307
|
+
- [x] ✅ Core code indexing (AST + dependency graph)
|
|
2308
|
+
- [x] ✅ Semantic memory (Qdrant + embeddings)
|
|
2309
|
+
- [x] ✅ Impact analysis engine
|
|
2310
|
+
- [x] ✅ Web dashboard
|
|
2311
|
+
- [x] ✅ Authentication (Email, OAuth, Device Flow)
|
|
2312
|
+
- [x] ✅ Email verification system
|
|
2313
|
+
- [x] ✅ Disposable email protection
|
|
2314
|
+
- [x] ✅ PostgreSQL integration
|
|
2315
|
+
- [x] ✅ Redis caching
|
|
2316
|
+
- [x] ✅ Audit logging
|
|
2317
|
+
- [x] ✅ Admin panel
|
|
2318
|
+
- [x] ✅ Domain & SSL setup
|
|
2319
|
+
- [ ] ⏳ Payment integration (Revolut)
|
|
2320
|
+
- [ ] ⏳ Unit & integration tests
|
|
2321
|
+
|
|
2322
|
+
### Q2 2026
|
|
2323
|
+
|
|
2324
|
+
- [ ] GitHub PR analysis (automatic comments)
|
|
2325
|
+
- [ ] GitLab integration
|
|
2326
|
+
- [ ] VS Code extension
|
|
2327
|
+
- [ ] Slack/Discord notifications
|
|
2328
|
+
- [ ] Custom architecture rules engine
|
|
2329
|
+
- [ ] Team collaboration features
|
|
2330
|
+
- [ ] Advanced metrics dashboard
|
|
2331
|
+
- [ ] Code quality trends
|
|
2332
|
+
|
|
2333
|
+
### Q3 2026
|
|
2334
|
+
|
|
2335
|
+
- [ ] JetBrains IDE plugin (IntelliJ, WebStorm)
|
|
2336
|
+
- [ ] Automated refactoring suggestions with code generation
|
|
2337
|
+
- [ ] Technical debt tracking & prioritization
|
|
2338
|
+
- [ ] AI-powered architecture recommendations
|
|
2339
|
+
- [ ] On-premise deployment option
|
|
2340
|
+
- [ ] SAML/SSO authentication
|
|
2341
|
+
|
|
2342
|
+
### Q4 2026
|
|
2343
|
+
|
|
2344
|
+
- [ ] Real-time collaboration (shared analysis sessions)
|
|
2345
|
+
- [ ] Custom LLM fine-tuning for domain-specific code
|
|
2346
|
+
- [ ] Advanced visualization (3D dependency graphs)
|
|
2347
|
+
- [ ] Mobile app (iOS/Android)
|
|
2348
|
+
- [ ] Kubernetes operator
|
|
2349
|
+
- [ ] Multi-region deployment
|
|
2350
|
+
|
|
2351
|
+
### Future Vision
|
|
2352
|
+
|
|
2353
|
+
- **AI Pair Programmer**: Real-time coding assistant with full codebase context
|
|
2354
|
+
- **Autonomous Refactoring**: AI automatically refactors technical debt
|
|
2355
|
+
- **Predictive Analytics**: Predict bugs before they happen
|
|
2356
|
+
- **Architecture Governance**: Enforce architectural rules at commit time
|
|
2357
|
+
- **Cross-Project Intelligence**: Learn from multiple projects to improve recommendations
|
|
2358
|
+
|
|
2359
|
+
---
|
|
2360
|
+
|
|
2361
|
+
## 📄 License
|
|
2362
|
+
|
|
2363
|
+
MIT License
|
|
2364
|
+
|
|
2365
|
+
Copyright (c) 2026 ArchiCore
|
|
2366
|
+
|
|
2367
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
2368
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
2369
|
+
in the Software without restriction, including without limitation the rights
|
|
2370
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
2371
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
2372
|
+
furnished to do so, subject to the following conditions:
|
|
2373
|
+
|
|
2374
|
+
The above copyright notice and this permission notice shall be included in all
|
|
2375
|
+
copies or substantial portions of the Software.
|
|
2376
|
+
|
|
2377
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
2378
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
2379
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
2380
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
2381
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
2382
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
2383
|
+
SOFTWARE.
|
|
2384
|
+
|
|
2385
|
+
---
|
|
2386
|
+
|
|
2387
|
+
## 📚 Documentation
|
|
2388
|
+
|
|
2389
|
+
- **[Complete API & CLI Reference](./API_CLI_REFERENCE.md)** - Все endpoints, команды и языки
|
|
2390
|
+
- **[Online Documentation](https://docs.archicore.io)** - Интерактивная документация
|
|
2391
|
+
- **[TODO & Roadmap](./TODO.md)** - Планы развития
|
|
2392
|
+
- **[Business Model](./BUSINESS-QA.md)** - Бизнес-модель
|
|
495
2393
|
|
|
496
|
-
##
|
|
2394
|
+
## 🤝 Support
|
|
497
2395
|
|
|
498
|
-
|
|
499
|
-
-
|
|
500
|
-
-
|
|
501
|
-
-
|
|
2396
|
+
- **Email**: support@archicore.io
|
|
2397
|
+
- **GitHub Issues**: https://github.com/yourusername/archicore/issues
|
|
2398
|
+
- **Twitter**: [@archicore_ai](https://twitter.com/archicore_ai)
|
|
2399
|
+
- **Discord**: https://discord.gg/archicore (coming soon)
|
|
502
2400
|
|
|
503
|
-
|
|
504
|
-
- ⏳ PR-анализ
|
|
505
|
-
- ⏳ Автоматические подсказки
|
|
506
|
-
- ⏳ Интеграция с IDE
|
|
2401
|
+
---
|
|
507
2402
|
|
|
508
|
-
|
|
509
|
-
- ⏳ Микро-рефакторинг
|
|
510
|
-
- ⏳ Автоматическая документация
|
|
511
|
-
- ⏳ Continuous learning
|
|
2403
|
+
## 🙏 Acknowledgments
|
|
512
2404
|
|
|
513
|
-
|
|
2405
|
+
- **Tree-sitter** - Parsing framework
|
|
2406
|
+
- **Qdrant** - Vector database
|
|
2407
|
+
- **Anthropic** - Claude AI
|
|
2408
|
+
- **Jina AI** - Code embeddings
|
|
2409
|
+
- **PostgreSQL** - Reliable database
|
|
2410
|
+
- **Redis** - Fast caching
|
|
2411
|
+
- **Express.js** - Web framework
|
|
2412
|
+
- **Docker** - Containerization
|
|
2413
|
+
- **All contributors** who helped make ArchiCore better!
|
|
514
2414
|
|
|
515
|
-
|
|
516
|
-
- **AST**: Tree-sitter (TypeScript, JavaScript, Python)
|
|
517
|
-
- **Vector DB**: Qdrant
|
|
518
|
-
- **LLM**: Anthropic Claude, OpenAI GPT
|
|
519
|
-
- **Database**: PostgreSQL (опционально)
|
|
520
|
-
- **CLI**: Commander.js
|
|
521
|
-
- **Logging**: Custom logger with Chalk
|
|
2415
|
+
---
|
|
522
2416
|
|
|
523
|
-
|
|
2417
|
+
<div align="center">
|
|
524
2418
|
|
|
525
|
-
|
|
526
|
-
- Анализ влияния: ~2-5 секунд
|
|
527
|
-
- Семантический поиск: ~100ms
|
|
528
|
-
- LLM запрос: ~2-10 секунд (зависит от модели)
|
|
2419
|
+
**[⬆ Back to Top](#archicore---ai-software-architect)**
|
|
529
2420
|
|
|
2421
|
+
Made with ❤️ by the ArchiCore Team
|
|
530
2422
|
|
|
2423
|
+
</div>
|