mcp-architector 1.2.3 → 1.6.0

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.
Files changed (69) hide show
  1. package/README.md +130 -39
  2. package/README_RU.md +100 -20
  3. package/dist/agent-hints.d.ts +10 -0
  4. package/dist/agent-hints.d.ts.map +1 -0
  5. package/dist/agent-hints.js +42 -0
  6. package/dist/agent-hints.js.map +1 -0
  7. package/dist/data-flow.d.ts +22 -0
  8. package/dist/data-flow.d.ts.map +1 -0
  9. package/dist/data-flow.js +232 -0
  10. package/dist/data-flow.js.map +1 -0
  11. package/dist/data-flow.test.d.ts +2 -0
  12. package/dist/data-flow.test.d.ts.map +1 -0
  13. package/dist/data-flow.test.js.map +1 -0
  14. package/dist/entry-coverage.d.ts +6 -0
  15. package/dist/entry-coverage.d.ts.map +1 -0
  16. package/dist/entry-coverage.js +81 -0
  17. package/dist/entry-coverage.js.map +1 -0
  18. package/dist/entry-coverage.test.d.ts +2 -0
  19. package/dist/entry-coverage.test.d.ts.map +1 -0
  20. package/dist/entry-coverage.test.js.map +1 -0
  21. package/dist/entry-sync.d.ts +4 -0
  22. package/dist/entry-sync.d.ts.map +1 -0
  23. package/dist/entry-sync.js +42 -0
  24. package/dist/entry-sync.js.map +1 -0
  25. package/dist/index.js +432 -189
  26. package/dist/index.js.map +1 -1
  27. package/dist/migrate-scripts.d.ts +6 -0
  28. package/dist/migrate-scripts.d.ts.map +1 -0
  29. package/dist/migrate-scripts.js +70 -0
  30. package/dist/migrate-scripts.js.map +1 -0
  31. package/dist/project-validate.d.ts +10 -0
  32. package/dist/project-validate.d.ts.map +1 -0
  33. package/dist/project-validate.js +189 -0
  34. package/dist/project-validate.js.map +1 -0
  35. package/dist/project-validate.test.d.ts +2 -0
  36. package/dist/project-validate.test.d.ts.map +1 -0
  37. package/dist/project-validate.test.js.map +1 -0
  38. package/dist/slices.d.ts +12 -0
  39. package/dist/slices.d.ts.map +1 -0
  40. package/dist/slices.js +243 -0
  41. package/dist/slices.js.map +1 -0
  42. package/dist/storage.d.ts +22 -17
  43. package/dist/storage.d.ts.map +1 -1
  44. package/dist/storage.js +258 -41
  45. package/dist/storage.js.map +1 -1
  46. package/dist/tools-entries-slices.d.ts +43 -0
  47. package/dist/tools-entries-slices.d.ts.map +1 -0
  48. package/dist/tools-entries-slices.js +479 -0
  49. package/dist/tools-entries-slices.js.map +1 -0
  50. package/dist/types.d.ts +132 -11
  51. package/dist/types.d.ts.map +1 -1
  52. package/package.json +7 -5
  53. package/scripts/mcp-http-bridge.mjs +84 -0
  54. package/scripts/test-all-api.sh +72 -0
  55. package/server.json +2 -2
  56. package/src/agent-hints.ts +59 -0
  57. package/src/data-flow.test.ts +178 -0
  58. package/src/data-flow.ts +288 -0
  59. package/src/entry-coverage.test.ts +90 -0
  60. package/src/entry-coverage.ts +104 -0
  61. package/src/entry-sync.ts +54 -0
  62. package/src/index.ts +533 -219
  63. package/src/migrate-scripts.ts +104 -0
  64. package/src/project-validate.test.ts +107 -0
  65. package/src/project-validate.ts +250 -0
  66. package/src/slices.ts +294 -0
  67. package/src/storage.ts +316 -46
  68. package/src/tools-entries-slices.ts +629 -0
  69. package/src/types.ts +148 -12
package/README.md CHANGED
@@ -51,15 +51,54 @@ Store and manage project architecture, modules, scripts, data flow, and usage ex
51
51
  ```
52
52
  ~/.mcp-architector/
53
53
  └── {projectId}/
54
- ├── architecture.json # Overall architecture
54
+ ├── architecture.json # Modules + dataFlow (vertical structure)
55
55
  ├── modules/
56
- │ ├── {moduleId}.json # Module details
56
+ │ ├── {moduleId}.json
57
57
  │ └── ...
58
- └── scripts/
59
- ├── {scriptId}.json # Script documentation
60
- └── ...
58
+ ├── entries/
59
+ ├── index.json # Catalog (no duplicate bodies)
60
+ └── {entryId}.json # Canonical facts (API, domain, flows, …)
61
+ ├── slices/
62
+ │ └── {sliceId}.json # Custom filters only (no items)
61
63
  ```
62
64
 
65
+ ## Data model
66
+
67
+ | Layer | Purpose | Tools |
68
+ |-------|---------|-------|
69
+ | **Modules** | Vertical structure: components, dependencies, dataFlow | `set-project-architecture`, `set-module-details`, `set-module-data-flow`, `rebuild-data-flow`, `validate-architecture` |
70
+ | **Entries** | Single source of truth for horizontal facts (one fact = one file) | `set-entry`, `set-entries`, `get-entry`, `list-entries` |
71
+ | **Slices** | Read-only views over entries (built-in or custom filters) | `list-slices`, `get-slice` |
72
+
73
+ **Anti-patterns (no duplication):** Do not copy `module.description` into `entry.summary`. Link with `refs.moduleName`. Slices never store item copies—only filters in `slices/*.json`.
74
+
75
+ **Do not edit `~/.mcp-architector` directly** — always use MCP tools so timestamps, merge semantics, and dataFlow inverse sync stay consistent.
76
+
77
+ ## Agent workflow
78
+
79
+ 1. `list-projects` — confirm `projectId` if data looks empty or wrong.
80
+ 2. **Structure task** → `get-project-architecture` / `set-project-architecture`.
81
+ 3. **Each module** → `set-module-details` with `files` + **`facts[]`** (endpoints, entities, glossary) in the same call, or `set-entries` / `set-entry` with `refs.moduleName`.
82
+ 4. **Single module graph edge** → `set-module-data-flow`.
83
+ 5. **Bulk rebuild flow (many modules)** → `rebuild-data-flow`.
84
+ 6. **After edits, verify everything** → `validate` (summary + `issues[]`; no full project load).
85
+ 7. **Need a category** (all APIs, all domain terms) → `list-slices` → `get-slice` with `format=compact` or `table`; use `offset` when `hasMore` is true.
86
+ 8. **Find by name** → `search-entries` → `get-entry` for full payload.
87
+
88
+ | Scenario | Tool |
89
+ |----------|------|
90
+ | Update one module + its APIs/facts | `set-module-details` with `facts[]` |
91
+ | Bulk facts for a domain | `set-entries` with `moduleName` |
92
+ | Patch dataFlow for one module | `set-module-data-flow` |
93
+ | Rebuild all module edges | `rebuild-data-flow` |
94
+ | Diagnose graph + empty slices | `validate` (or `validate-architecture`) |
95
+ | Index out of sync | `rebuild-entry-index` |
96
+ | Create project from scratch | `set-project-architecture` with `replaceModules: true` |
97
+
98
+ **Full project picture:** modules alone do not populate slices — without `http-endpoint` (and other kinds) entries, slice `api` stays empty. New module → add `facts` or entries in the same step.
99
+
100
+ Example: `set-module-details` with `facts: [{ kind: "http-endpoint", title: "POST /orders", ... }]`, then `get-slice` `sliceId=api` `format=table`.
101
+
63
102
  ## Quick Start
64
103
 
65
104
  ### For Users (using npm package)
@@ -219,7 +258,7 @@ When calling tools, you can:
219
258
 
220
259
  ### set-project-architecture
221
260
 
222
- Creates or updates the overall architecture for a project.
261
+ Creates or updates the overall architecture for a project. **By default merges** modules and dataFlow by name; omit `dataFlow` to preserve existing flow. `dependsOn` is canonical; `providesTo` is recomputed on save.
223
262
 
224
263
  **Input:**
225
264
  - `projectId` (optional): Project ID (defaults to "default-project")
@@ -229,12 +268,14 @@ Creates or updates the overall architecture for a project.
229
268
  - `description`: Brief description of the module
230
269
  - `inputs` (optional): What this module requires to work
231
270
  - `outputs` (optional): What this module produces or generates
232
- - `dataFlow` (optional): Object describing data flow between modules:
271
+ - `dataFlow` (optional): Object describing data flow between modules (omit to keep existing):
233
272
  - Key: module name
234
273
  - Value: object with:
235
274
  - `dependsOn` (optional): Array of module names this module depends on
236
- - `providesTo` (optional): Array of module names that receive data from this module
275
+ - `providesTo` (optional): Derived on save from all `dependsOn` edges
237
276
  - `dataTransformation` (optional): How data is transformed between modules
277
+ - `replaceModules` (optional): Replace entire modules list (default `false` = merge by name)
278
+ - `replaceDataFlow` (optional): Replace entire dataFlow (default `false` = merge by module name)
238
279
 
239
280
  **Output:**
240
281
  - Project ID and success message
@@ -249,9 +290,46 @@ Retrieves the overall architecture of the project.
249
290
  **Output:**
250
291
  - Complete project architecture
251
292
 
293
+ ### list-projects
294
+
295
+ Lists all projects in local storage (`~/.mcp-architector`). Use when the workspace may map to a different normalized `projectId`.
296
+
297
+ **Input:**
298
+ - `query` (optional): Filter by substring in projectId or description (case-insensitive)
299
+
300
+ **Output:**
301
+ - Array of project summaries: `projectId`, `description`, `moduleCount`, `updatedAt`, `isCurrent` (matches current `MCP_PROJECT_ID`)
302
+
303
+ ### Entries and slices
304
+
305
+ | Tool | Purpose |
306
+ |------|---------|
307
+ | `set-entry` | Upsert one fact; response may include `reminder` if modules missing or unlinked |
308
+ | `set-entries` | Bulk upsert (max 200); optional `moduleName` sets `refs.moduleName` on all |
309
+ | `get-entry` | Full entry by `id` |
310
+ | `delete-entry` | Remove entry |
311
+ | `list-entries` | Catalog without payload; filter by `kind`, `tags`, `query` |
312
+ | `search-entries` | Text search in title, summary, kind, tags |
313
+ | `list-slices` | Built-in + custom slices with entry counts |
314
+ | `get-slice` | Filtered view: `sliceId`, `format`, `query`, `limit`, `offset`, `hasMore` |
315
+ | `set-slice` | Save custom filter (`kinds`, `tags`) — no items |
316
+ | `delete-slice` | Remove custom slice |
317
+ | `rebuild-entry-index` | Rebuild `entries/index.json` from entry files |
318
+
319
+ **Built-in `sliceId` values:** `api`, `persistence`, `events`, `domain`, `flows`, `integrations`, `config`, `runtime`, `decisions`, `scripts`.
320
+
321
+ **Recommended `kind` examples (any string allowed):**
322
+
323
+ | sliceId | kinds |
324
+ |---------|-------|
325
+ | api | `http-endpoint`, `grpc-method`, `mcp-tool`, `cli-command`, … |
326
+ | persistence | `db-table`, `entity`, `repository` |
327
+ | domain | `glossary`, `invariant`, `lifecycle` |
328
+ | scripts | `script` — use `set-entry` / `get-slice sliceId=scripts` |
329
+
252
330
  ### set-module-details
253
331
 
254
- Creates or updates detailed information about a module.
332
+ Creates or updates detailed information about a module. **Slices read entries, not module text** — pass `facts[]` to create linked entries in one call.
255
333
 
256
334
  **Input:**
257
335
  - `projectId` (optional): Project ID
@@ -259,8 +337,9 @@ Creates or updates detailed information about a module.
259
337
  - `description`: Detailed description of the module
260
338
  - `inputs`: What the module accepts as input
261
339
  - `outputs`: What the module produces as output
262
- - `dependencies` (optional): List of module dependencies
340
+ - `dependencies` (optional): List of module dependencies (syncs to `dataFlow.dependsOn` when provided)
263
341
  - `files` (optional): List of files belonging to this module
342
+ - `facts` (optional): Array of horizontal facts (`kind`, `title`, `summary`, …) — each upserted as entry with `refs.moduleName` = module name
264
343
  - `usageExamples` (optional): Array of usage examples with fields:
265
344
  - `title`: Example title
266
345
  - `description` (optional): Description of the example
@@ -273,74 +352,86 @@ Creates or updates detailed information about a module.
273
352
  **Output:**
274
353
  - Module ID and success message
275
354
 
276
- ### get-module-details
355
+ ### set-module-data-flow
277
356
 
278
- Retrieves detailed information about a specific module.
357
+ Patches `dataFlow` for a single module without sending the full architecture.
279
358
 
280
359
  **Input:**
281
360
  - `projectId` (optional): Project ID
282
- - `moduleName`: Name of the module to retrieve
361
+ - `moduleName`: Module name
362
+ - `dependsOn` (optional): Modules this module depends on (canonical)
363
+ - `dataTransformation` (optional): How data is transformed
364
+ - `syncInverse` (optional): Recompute `providesTo` (default `true`)
283
365
 
284
366
  **Output:**
285
- - Complete module details
367
+ - Module name and success message
286
368
 
287
- ### list-modules
369
+ ### rebuild-data-flow
288
370
 
289
- Lists all modules in the project architecture.
371
+ Rebuilds `dataFlow` for all modules from module file `dependencies` or existing `dependsOn` edges. Replaces bulk manual edits to `architecture.json`.
290
372
 
291
373
  **Input:**
292
374
  - `projectId` (optional): Project ID
375
+ - `source` (optional): `module-dependencies` (default) or `dataFlow-dependsOn`
376
+ - `syncInverse` (optional): Recompute `providesTo` (default `true`)
377
+ - `pruneOrphans` (optional): Remove invalid module references (default `true`)
293
378
 
294
379
  **Output:**
295
- - Array of module summaries
380
+ - `edgesAdded`, `edgesRemoved`, `modulesUpdated`, message
296
381
 
297
- ### delete-module
382
+ ### validate
298
383
 
299
- Deletes a module from the project architecture.
384
+ **Primary post-edit check.** Read-only validation with a compact agent-friendly report. Does not modify data.
300
385
 
301
- **Input:**
302
- - `projectId` (optional): Project ID
303
- - `moduleName`: Name of the module to delete
386
+ **Checks (only rules we can verify from stored JSON):**
387
+ - dataFlow: inverse drift, dangling `dependsOn`/`providesTo`, orphan flow keys
388
+ - `module.dependencies` vs `dataFlow.dependsOn`
389
+ - entries: `entries-without-modules`, `entry-unlinked`, `orphan-entry-module`, `module-no-entries`, `module-missing-api` / `module-missing-persistence`
390
+ - storage: missing `modules/{id}.json`, orphan module files, entry index drift
391
+ - slices: empty built-in `api` / `domain` / `persistence` when modules exist
392
+
393
+ **Input:** `projectId`, `checkInverse`, `checkModuleDeps`, `checkEntryCoverage`, `checkStorage`, `checkEmptySlices` (all default `true`)
394
+
395
+ **Output:** `valid`, `issueCount`, `summary`, `stats`, `issuesByKind`, `issues[]`, `coverage`, `checksRun`
396
+
397
+ ### validate-architecture
398
+
399
+ Same as `validate` (legacy alias). Prefer `validate` after edits.
304
400
 
305
401
  **Output:**
306
- - Success message
402
+ - `valid` (boolean), `issues` array
307
403
 
308
- ### set-script-documentation
404
+ ### get-module-details
309
405
 
310
- Creates or updates documentation for a script or command.
406
+ Retrieves detailed information about a specific module.
311
407
 
312
408
  **Input:**
313
409
  - `projectId` (optional): Project ID
314
- - `scriptName`: Name of the script
315
- - `description`: Description of what the script does
316
- - `usage`: Usage command or syntax
317
- - `examples`: Array of usage examples
318
- - `parameters`: Object mapping parameter names to descriptions
319
- - `notes` (optional): Additional notes
410
+ - `moduleName`: Name of the module to retrieve
320
411
 
321
412
  **Output:**
322
- - Script ID and success message
413
+ - Complete module details
323
414
 
324
- ### get-script-documentation
415
+ ### list-modules
325
416
 
326
- Retrieves documentation for a specific script.
417
+ Lists all modules in the project architecture.
327
418
 
328
419
  **Input:**
329
420
  - `projectId` (optional): Project ID
330
- - `scriptName`: Name of the script to retrieve
331
421
 
332
422
  **Output:**
333
- - Script documentation
423
+ - Array of module summaries
334
424
 
335
- ### list-scripts
425
+ ### delete-module
336
426
 
337
- Lists all documented scripts in the project.
427
+ Deletes a module from the project architecture.
338
428
 
339
429
  **Input:**
340
430
  - `projectId` (optional): Project ID
431
+ - `moduleName`: Name of the module to delete
341
432
 
342
433
  **Output:**
343
- - Array of script documentations
434
+ - Success message
344
435
 
345
436
  ## Resources
346
437
 
package/README_RU.md CHANGED
@@ -51,15 +51,52 @@
51
51
  ```
52
52
  ~/.mcp-architector/
53
53
  └── {projectId}/
54
- ├── architecture.json # Общая архитектура
54
+ ├── architecture.json # Модули + dataFlow (вертикальная структура)
55
55
  ├── modules/
56
- │ ├── {moduleId}.json # Детали модуля
56
+ │ ├── {moduleId}.json
57
57
  │ └── ...
58
- └── scripts/
59
- ├── {scriptId}.json # Документация скрипта
60
- └── ...
58
+ ├── entries/
59
+ ├── index.json # Каталог без дублирования тел
60
+ └── {entryId}.json # Канонические факты (API, домен, flows, …)
61
+ ├── slices/
62
+ │ └── {sliceId}.json # Только фильтры (без items)
61
63
  ```
62
64
 
65
+ ## Модель данных
66
+
67
+ | Слой | Назначение | Инструменты |
68
+ |------|------------|-------------|
69
+ | **Модули** | Вертикальная структура: компоненты, dataFlow | `set-project-architecture`, `set-module-details`, `set-module-data-flow`, `rebuild-data-flow`, `validate-architecture` |
70
+ | **Entries** | Единственный источник фактов (один факт = один файл) | `set-entry`, `set-entries`, `get-entry`, `list-entries` |
71
+ | **Slices** | Представления над entries (встроенные или свои фильтры) | `list-slices`, `get-slice` |
72
+
73
+ **Анти-паттерны:** не копировать `module.description` в `entry.summary`; связь через `refs.moduleName`. Срезы не хранят копии items.
74
+
75
+ **Не редактируйте `~/.mcp-architector` напрямую** — используйте MCP tools, чтобы сохранялись timestamps, merge-семантика и синхронизация inverse для dataFlow.
76
+
77
+ ## Сценарий для агента
78
+
79
+ 1. `list-projects` — проверить `projectId`.
80
+ 2. Структура → `get-project-architecture` / `set-project-architecture`.
81
+ 3. **Каждый модуль** → `set-module-details` с `files` + **`facts[]`** (API, entity, glossary) в одном вызове, или `set-entries` / `set-entry` с `refs.moduleName`.
82
+ 4. Граф одного модуля → `set-module-data-flow`.
83
+ 5. Массовый пересчёт flow → `rebuild-data-flow`.
84
+ 6. После правок → `validate` (краткий отчёт и `issues[]`, без загрузки всего проекта).
85
+ 7. Категория (все API, домен) → `list-slices` → `get-slice`; при `hasMore` — `offset`.
86
+ 8. Поиск по имени → `search-entries` → `get-entry`.
87
+
88
+ | Сценарий | Tool |
89
+ |----------|------|
90
+ | Модуль + его факты | `set-module-details` с `facts[]` |
91
+ | Массовые факты | `set-entries` с `moduleName` |
92
+ | Patch dataFlow одного модуля | `set-module-data-flow` |
93
+ | Пересчитать все рёбра | `rebuild-data-flow` |
94
+ | Проверка после правок | `validate` |
95
+ | Рассинхрон index | `rebuild-entry-index` |
96
+ | Проект с нуля | `set-project-architecture` с `replaceModules: true` |
97
+
98
+ **Полная картина проекта:** одних модулей недостаточно для slices — без entries с `http-endpoint` срез `api` пуст. Новый модуль → `facts` или entries в том же шаге.
99
+
63
100
  ## Быстрый старт
64
101
 
65
102
  ### Для пользователей (через npm)
@@ -218,13 +255,15 @@ npm run inspector
218
255
 
219
256
  ### set-project-architecture
220
257
 
221
- Создаёт или обновляет общую архитектуру проекта.
258
+ Создаёт или обновляет общую архитектуру проекта. **По умолчанию merge** modules и dataFlow по имени; omit `dataFlow` сохраняет существующий flow. `dependsOn` — канон; `providesTo` пересчитывается при сохранении.
222
259
 
223
260
  **Вход:**
224
261
  - `projectId` (опц.): ID проекта (по умолчанию "default-project")
225
262
  - `description`: Описание проекта
226
263
  - `modules`: Массив модулей с полями `name`, `description`, `inputs`, `outputs`
227
- - `dataFlow` (опц.): Поток данных между модулями
264
+ - `dataFlow` (опц.): Поток данных между модулями (omit — сохранить существующий)
265
+ - `replaceModules` (опц.): Полная замена списка модулей (default `false` = merge)
266
+ - `replaceDataFlow` (опц.): Полная замена dataFlow (default `false` = merge)
228
267
 
229
268
  **Выход:** ID проекта и сообщение об успехе
230
269
 
@@ -232,33 +271,74 @@ npm run inspector
232
271
 
233
272
  Получает архитектуру проекта.
234
273
 
274
+ ### list-projects
275
+
276
+ Список всех проектов в локальном хранилище (`~/.mcp-architector`). Нужен, когда workspace может соответствовать другому нормализованному `projectId`.
277
+
278
+ **Вход:**
279
+ - `query` (опц.): Фильтр по подстроке в projectId или description (без учёта регистра)
280
+
281
+ **Выход:**
282
+ - Массив кратких записей: `projectId`, `description`, `moduleCount`, `updatedAt`, `isCurrent` (совпадает с текущим `MCP_PROJECT_ID`)
283
+
284
+ ### Entries и slices
285
+
286
+ | Tool | Назначение |
287
+ |------|------------|
288
+ | `set-entry` | Upsert факта; в ответе `reminder`, если нет модулей или нет `refs.moduleName` |
289
+ | `set-entries` | Массовый upsert (до 200); `moduleName` проставляет `refs.moduleName` |
290
+ | `get-entry` | Полная entry по `id` |
291
+ | `delete-entry` | Удаление |
292
+ | `list-entries` | Каталог без payload |
293
+ | `search-entries` | Поиск по тексту |
294
+ | `list-slices` | Встроенные и custom срезы |
295
+ | `get-slice` | Срез: `sliceId`, `format`, `query`, `limit`, `offset`, `hasMore` |
296
+ | `set-slice` / `delete-slice` | Custom фильтр (без items) |
297
+ | `rebuild-entry-index` | Пересборка `entries/index.json` |
298
+
299
+ **Встроенные sliceId:** `api`, `persistence`, `events`, `domain`, `flows`, `integrations`, `config`, `runtime`, `decisions`, `scripts`.
300
+
301
+ Команды: `set-entry` с `kind=script` или `get-slice sliceId=scripts`. При первом обращении к entries старая папка `scripts/` мигрируется и удаляется.
302
+
235
303
  ### set-module-details
236
304
 
237
- Создаёт или обновляет детали модуля.
305
+ Создаёт или обновляет детали модуля. Срезы читают **entries**, не текст модуля — передавайте `facts[]` для API/домена в том же вызове. При `dependencies` синхронизирует `dataFlow.dependsOn`.
238
306
 
239
- ### get-module-details
307
+ ### set-module-data-flow
240
308
 
241
- Получает детали модуля.
309
+ Patch `dataFlow` одного модуля: `moduleName`, `dependsOn`, `dataTransformation`, `syncInverse`.
242
310
 
243
- ### list-modules
311
+ ### rebuild-data-flow
244
312
 
245
- Список всех модулей проекта.
313
+ Пересборка `dataFlow` для всех модулей из `dependencies` в module files или из `dependsOn`. Замена массовой правки `architecture.json`.
246
314
 
247
- ### delete-module
315
+ **Вход:** `source` (`module-dependencies` | `dataFlow-dependsOn`), `syncInverse`, `pruneOrphans`.
248
316
 
249
- Удаляет модуль из архитектуры.
317
+ **Выход:** `edgesAdded`, `edgesRemoved`, `modulesUpdated`.
250
318
 
251
- ### set-script-documentation
319
+ ### validate
252
320
 
253
- Документация скрипта или команды.
321
+ **Главная проверка после правок.** Read-only отчёт для агента: `summary`, `stats`, `issuesByKind`, `issues[]` — не нужно тянуть весь проект.
254
322
 
255
- ### get-script-documentation
323
+ **Проверяет:** dataFlow, связь модуль↔entry, файлы модулей, рассинхрон index, пустые срезы api/domain/persistence.
256
324
 
257
- Получает документацию скрипта.
325
+ **Выход:** `valid`, `issueCount`, `summary`, `coverage`, `checksRun`.
258
326
 
259
- ### list-scripts
327
+ ### validate-architecture
260
328
 
261
- Список всех задокументированных скриптов.
329
+ То же, что `validate` (алиас). Предпочтительно вызывать `validate`.
330
+
331
+ ### get-module-details
332
+
333
+ Получает детали модуля.
334
+
335
+ ### list-modules
336
+
337
+ Список всех модулей проекта.
338
+
339
+ ### delete-module
340
+
341
+ Удаляет модуль из архитектуры.
262
342
 
263
343
  ## Ресурсы
264
344
 
@@ -0,0 +1,10 @@
1
+ export declare const MODULE_ENTRIES_REMINDER: string;
2
+ export declare const ENTRIES_MODULE_REMINDER: string;
3
+ export declare function suggestKindsFromFiles(files: string[]): string[];
4
+ export interface EntryLinkHints {
5
+ reminder?: string;
6
+ warning?: string;
7
+ suggestedModuleNames?: string[];
8
+ }
9
+ export declare function buildEntryLinkHints(moduleNames: string[], refsModuleName?: string): EntryLinkHints;
10
+ //# sourceMappingURL=agent-hints.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-hints.d.ts","sourceRoot":"","sources":["../src/agent-hints.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,QAIgC,CAAC;AAErE,eAAO,MAAM,uBAAuB,QAG0D,CAAC;AAE/F,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAgB/D;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;CACjC;AAED,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,MAAM,EAAE,EACrB,cAAc,CAAC,EAAE,MAAM,GACtB,cAAc,CAoBhB"}
@@ -0,0 +1,42 @@
1
+ export const MODULE_ENTRIES_REMINDER = 'After saving a module, add horizontal facts as entries (or pass facts[] here): ' +
2
+ 'http-endpoint for controllers, entity/repository for persistence, glossary for domain. ' +
3
+ 'Slices (api, domain, persistence) read entries only—modules alone leave slices empty. ' +
4
+ 'Link via refs.moduleName; use list-slices for recommended kinds.';
5
+ export const ENTRIES_MODULE_REMINDER = 'Entries need vertical structure: create modules via set-project-architecture / set-module-details ' +
6
+ 'before or when adding entries. Set refs.moduleName to an existing module name from list-modules. ' +
7
+ 'Run validate after edits to find entries-without-modules, entry-unlinked, or empty slices.';
8
+ export function suggestKindsFromFiles(files) {
9
+ const kinds = new Set();
10
+ for (const file of files) {
11
+ const lower = file.toLowerCase();
12
+ const base = file.split('/').pop() ?? file;
13
+ if (/controller/i.test(base) || lower.endsWith('.http')) {
14
+ kinds.add('http-endpoint');
15
+ }
16
+ if (/repository/i.test(base)) {
17
+ kinds.add('repository');
18
+ }
19
+ if (/entity/i.test(base) && !/repository/i.test(base)) {
20
+ kinds.add('entity');
21
+ }
22
+ }
23
+ return [...kinds];
24
+ }
25
+ export function buildEntryLinkHints(moduleNames, refsModuleName) {
26
+ const hints = {};
27
+ if (moduleNames.length === 0) {
28
+ hints.reminder = ENTRIES_MODULE_REMINDER;
29
+ return hints;
30
+ }
31
+ if (!refsModuleName?.trim()) {
32
+ hints.reminder = ENTRIES_MODULE_REMINDER;
33
+ hints.suggestedModuleNames = moduleNames;
34
+ return hints;
35
+ }
36
+ if (!moduleNames.includes(refsModuleName)) {
37
+ hints.warning = `refs.moduleName '${refsModuleName}' does not match any module (orphan-entry-module).`;
38
+ hints.suggestedModuleNames = moduleNames;
39
+ }
40
+ return hints;
41
+ }
42
+ //# sourceMappingURL=agent-hints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-hints.js","sourceRoot":"","sources":["../src/agent-hints.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,uBAAuB,GAClC,iFAAiF;IACjF,yFAAyF;IACzF,wFAAwF;IACxF,kEAAkE,CAAC;AAErE,MAAM,CAAC,MAAM,uBAAuB,GAClC,oGAAoG;IACpG,mGAAmG;IACnG,4FAA4F,CAAC;AAE/F,MAAM,UAAU,qBAAqB,CAAC,KAAe;IACnD,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;IAChC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC;QAC3C,IAAI,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YACxD,KAAK,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;QAC7B,CAAC;QACD,IAAI,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAC7B,KAAK,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAC1B,CAAC;QACD,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YACtD,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACtB,CAAC;IACH,CAAC;IACD,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC;AACpB,CAAC;AAQD,MAAM,UAAU,mBAAmB,CACjC,WAAqB,EACrB,cAAuB;IAEvB,MAAM,KAAK,GAAmB,EAAE,CAAC;IAEjC,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC7B,KAAK,CAAC,QAAQ,GAAG,uBAAuB,CAAC;QACzC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,CAAC,cAAc,EAAE,IAAI,EAAE,EAAE,CAAC;QAC5B,KAAK,CAAC,QAAQ,GAAG,uBAAuB,CAAC;QACzC,KAAK,CAAC,oBAAoB,GAAG,WAAW,CAAC;QACzC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;QAC1C,KAAK,CAAC,OAAO,GAAG,oBAAoB,cAAc,oDAAoD,CAAC;QACvG,KAAK,CAAC,oBAAoB,GAAG,WAAW,CAAC;IAC3C,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,22 @@
1
+ import type { DataFlow, ModuleDetails, ModuleSummary, ProjectArchitecture, ValidationIssue } from "./types.js";
2
+ export declare function recomputeProvidesTo(dataFlow: DataFlow, moduleNames: string[]): DataFlow;
3
+ export declare function syncModuleDependsOn(dataFlow: DataFlow, moduleName: string, dependsOn: string[], moduleNames: string[]): DataFlow;
4
+ export declare function buildDataFlowFromModules(modules: ModuleSummary[], moduleDetailsMap: Map<string, ModuleDetails>): DataFlow;
5
+ export declare function buildDataFlowFromDependsOn(dataFlow: DataFlow, moduleNames: string[]): DataFlow;
6
+ export declare function pruneDataFlow(dataFlow: DataFlow, validNames: string[]): DataFlow;
7
+ export declare function removeModuleFromDataFlow(dataFlow: DataFlow | undefined, moduleName: string): DataFlow | undefined;
8
+ export declare function mergeModules(existing: ModuleSummary[] | undefined, incoming: ModuleSummary[], options: {
9
+ replace: boolean;
10
+ }): ModuleSummary[];
11
+ export declare function mergeDataFlow(existing: DataFlow | undefined, incoming: DataFlow | undefined, options: {
12
+ replace: boolean;
13
+ }): DataFlow | undefined;
14
+ export declare function validateDataFlow(architecture: ProjectArchitecture, moduleDetailsMap: Map<string, ModuleDetails>, options?: {
15
+ checkInverse?: boolean;
16
+ checkModuleDeps?: boolean;
17
+ }): ValidationIssue[];
18
+ export declare function diffFlowEdges(before: DataFlow | undefined, after: DataFlow | undefined): {
19
+ edgesAdded: number;
20
+ edgesRemoved: number;
21
+ };
22
+ //# sourceMappingURL=data-flow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-flow.d.ts","sourceRoot":"","sources":["../src/data-flow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,aAAa,EACb,aAAa,EACb,mBAAmB,EACnB,eAAe,EAChB,MAAM,YAAY,CAAC;AAmBpB,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,QAAQ,CAqCvF;AAED,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EAAE,EACnB,WAAW,EAAE,MAAM,EAAE,GACpB,QAAQ,CAOV;AAED,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,aAAa,EAAE,EACxB,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,GAC3C,QAAQ,CASV;AAED,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,QAAQ,CAY9F;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,QAAQ,CAuBhF;AAED,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,QAAQ,GAAG,SAAS,EAC9B,UAAU,EAAE,MAAM,GACjB,QAAQ,GAAG,SAAS,CAwBtB;AAED,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,aAAa,EAAE,GAAG,SAAS,EACrC,QAAQ,EAAE,aAAa,EAAE,EACzB,OAAO,EAAE;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,GAC5B,aAAa,EAAE,CASjB;AAED,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,QAAQ,GAAG,SAAS,EAC9B,QAAQ,EAAE,QAAQ,GAAG,SAAS,EAC9B,OAAO,EAAE;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,GAC5B,QAAQ,GAAG,SAAS,CAetB;AAED,wBAAgB,gBAAgB,CAC9B,YAAY,EAAE,mBAAmB,EACjC,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,EAC5C,OAAO,GAAE;IAAE,YAAY,CAAC,EAAE,OAAO,CAAC;IAAC,eAAe,CAAC,EAAE,OAAO,CAAA;CAAO,GAClE,eAAe,EAAE,CAkEnB;AAED,wBAAgB,aAAa,CAC3B,MAAM,EAAE,QAAQ,GAAG,SAAS,EAC5B,KAAK,EAAE,QAAQ,GAAG,SAAS,GAC1B;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAgB9C"}