integram-mcp 0.4.5 → 0.5.1

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 (3) hide show
  1. package/README.md +1 -1
  2. package/index.js +32 -8
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -126,7 +126,7 @@ claude mcp add integram \
126
126
  | **portal** | Портал: конфиг, каталог, корзины, заказы, тикеты, KB, метрики, Telegram-боты | 42 |
127
127
  | **docs** | Документы, блоки, версии, шаринг, папки, теги, шаблоны, PDF | 38 |
128
128
  | **schema** | Таблицы, колонки, кнопки (AI/HTTP/script), вычисляемые колонки, валидация | 27 |
129
- | **codespace** | Git-репозитории: ветки, коммиты, файлы, pull requests | 21 |
129
+ | **codespace** | Git-репозитории: ветки, коммиты, файлы, точечная правка (`patch_file`), pull requests; запись с `baseCommit` сливается с чужими изменениями вместо перезаписи | 22 |
130
130
  | **reports** | Отчёты: CRUD, колонки, JOIN, фильтры, экспорт | 15 |
131
131
  | **grants** | Роли, гранты, row-level правила (только admin) | 11 |
132
132
  | **teamchat** | Сообщения, решения, метрики агентов, W-матрица, топики | 10 |
package/index.js CHANGED
@@ -155,7 +155,7 @@ Only core tools (~15: CRUD, search, graph, comments, bulk, history) are loaded b
155
155
  - "portal" — portal config, catalog, carts, orders, tickets, KB articles, metrics, customer profiles, Telegram bots (~42 tools)
156
156
  - "telegram" — Telegram bot management, messaging, moderation, payments, stories, business API (subset of portal group)
157
157
  - "grants" — roles, grants, row-level rules, member access (admin only) (~11 tools)
158
- - "codespace" — git repositories: branches, commits, files, pull requests (~21 tools)
158
+ - "codespace" — git repositories: branches, commits, files, pull requests, conflict-safe writes (~22 tools)
159
159
  - "teamchat" — rooms, topics, messages, decisions, agent metrics, W-matrix (ONA) (~35 tools)
160
160
  - "graph" — get_related, graph_query, neighborhood, shortest path, health, memory agents (~9 tools)
161
161
  - "meta-kb" — debate-based knowledge curation: start debates, parallel experts, LLM synthesis (~6 tools)
@@ -865,10 +865,27 @@ Git repository hosting per workspace. Activate via search_tools("codespace").
865
865
  - list_commits(slug, ref?, limit?, offset?) — list commits on a branch
866
866
  - get_commit_diff(slug, sha) — unified diff for a single commit (works for initial commit)
867
867
  - get_file_tree(slug, ref?, path?) — list files/dirs in a repo. Returns { items: [{ name, type, size, path }], ref, path }
868
- - read_blob(slug, path, ref?) — read file content. Returns text (up to 200K chars, supports offset/limit for pagination) for text files, metadata only for binary. Use for reading custom_code components.
869
- - commit_file(slug, branch, filePath, content, message?) — create/update file in one commit
870
- - commit_multi_files(slug, branch, files, message) — commit multiple files atomically; files = [{filePath, content}] (up to 100 files)
871
- - delete_repo_file(slug, branch, filePath, message?) — delete file via git rm + commit. **TIER_HIGH**
868
+ - read_blob(slug, path, ref?, offset?, limit?) — прочитать файл. Возвращает baseCommit — состояние ветки на момент чтения. Если baseCommit пришёл null, файл прочитан не целиком: перечитайте без offset/limit, прежде чем писать.
869
+ - patch_file(slug, branch, filePath, oldStr, newStr, message?, baseCommit?) — ПРЕДПОЧТИТЕЛЬНЫЙ способ править существующий файл. Заменяет уникальный кусок текста, файл целиком слать не нужно. oldStr должен встречаться ровно один раз.
870
+ - commit_file(slug, branch, filePath, content, message?, baseCommit?) — записать файл целиком. Для новых и коротких файлов; для правки существующих используйте patch_file.
871
+ - commit_multi_files(slug, branch, files, message, baseCommit?) — несколько файлов одним коммитом.
872
+ - delete_repo_file(slug, branch, filePath, message?, baseCommit?) — удалить файл (git rm + commit). **TIER_HIGH**
873
+
874
+ Запись ведёт себя как git: коммит создаётся на указанном baseCommit, ветка двигается только если не ушла вперёд, иначе выполняется слияние. Всегда передавайте baseCommit при правке существующего — иначе рискуете затереть чужую работу.
875
+
876
+ Разрешение конфликта. Ответ MERGE_CONFLICT содержит всё нужное, перечитывать файл не надо:
877
+ - details.conflicts — список конфликтующих файлов;
878
+ - details.blocks — их содержимое с конфликтными блоками. В блоке три части: ваша версия, исходная (между строками ||||||| и =======), версия ветки. Сравнивайте с исходной — она показывает, что именно меняла каждая сторона;
879
+ - details.baseCommit — состояние, на которое надо писать разрешение;
880
+ - details.retryable=false — повторять ту же запись бессмысленно, ответ будет тот же.
881
+
882
+ Порядок разрешения — выполняйте именно так, не сокращая:
883
+ 1. Для каждого конфликтного блока выпишите ДВА изменения относительно исходной части: что сделала ваша сторона и что сделала сторона ветки.
884
+ 2. Сформулируйте намерение каждой стороны. Удаление строки — тоже намерение: если исходная часть содержит строку, которой нет в одной из версий, эту строку намеренно удалили, и в итог её возвращать нельзя.
885
+ 3. Соедините оба намерения. Механическое склеивание обеих половин — типичная ошибка: так в итог попадает то, что одна из сторон осознанно убрала.
886
+ 4. Соберите итоговый текст без маркеров конфликта и запишите через commit_file с baseCommit из details.
887
+
888
+ При WRITE_CONTENTION (retryable=true) — наоборот, ничего разбирать не надо, достаточно повторить запись.
872
889
 
873
890
  **Pull Requests:**
874
891
  - list_prs(slug, status?, limit?, offset?) — list PRs (status: open|closed|merged|draft)
@@ -1033,7 +1050,7 @@ Destructive and schema operations return "REQUIRES CONFIRMATION". Ask the user t
1033
1050
  `;
1034
1051
 
1035
1052
  const server = new Server(
1036
- { name: 'integram', version: '1.0.0' },
1053
+ { name: 'integram', version: '0.5.0' },
1037
1054
  { capabilities: { tools: { listChanged: true }, elicitation: {} }, instructions: INSTRUCTIONS },
1038
1055
  );
1039
1056
 
@@ -1206,7 +1223,8 @@ const EN_DESCRIPTIONS = {
1206
1223
  mark_file_imported: 'Mark a file as imported and link it to a created object.',
1207
1224
  // Codespace
1208
1225
  get_file_tree: 'List files and directories in a codespace repository at a given path and ref (branch/commit). Returns: { items: [{ name, type, size, path }], ref, path }.',
1209
- read_blob: 'Read file content from a codespace repository. Returns text for text files (up to 200K chars, supports offset/limit for pagination), metadata only for binary files. Returns: { content, path, ref, binary, size, truncated }. Use after get_file_tree to read specific files.',
1226
+ read_blob: 'Read file content from a codespace repository. Returns text for text files (up to 200K chars, supports offset/limit for pagination), metadata only for binary files. Returns: { content, path, ref, binary, size, truncated, baseCommit }. Pass baseCommit to patch_file/commit_file so your write merges with concurrent changes instead of overwriting them. baseCommit is null when the read was truncated or offset — re-read in full before writing.',
1227
+ patch_file: 'Replace one unique snippet of text in a repository file. Preferred over commit_file for editing existing files: no need to send the whole file, works at any file size, rarely conflicts. oldStr must occur exactly once — lengthen the anchor if it does not. Matching is exact, including indentation.',
1210
1228
  // Notifications
1211
1229
  get_notification_count: 'Get the number of unread notifications for the current user. Returns: { count }.',
1212
1230
  // Workspace
@@ -1408,7 +1426,13 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
1408
1426
 
1409
1427
  // Detect tool-level errors returned as structured JSON from backend
1410
1428
  if (result?.error === true && result?.message) {
1411
- return { content: [{ type: 'text', text: `Error: ${result.message}` }], isError: true };
1429
+ // details несёт то, без чего ошибку не исправить: блоки конфликта
1430
+ // с исходной версией, новый baseCommit, признак повторяемости.
1431
+ // Без него вызывающий видит только текст и вынужден гадать.
1432
+ const text = result.details
1433
+ ? `Error: ${result.message}\n\n${JSON.stringify(result.details, null, 2)}`
1434
+ : `Error: ${result.message}`;
1435
+ return { content: [{ type: 'text', text }], isError: true };
1412
1436
  }
1413
1437
 
1414
1438
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "integram-mcp",
3
- "version": "0.4.5",
3
+ "version": "0.5.1",
4
4
  "type": "module",
5
5
  "description": "MCP server for Integram — connect AI assistants to your workspace via Model Context Protocol",
6
6
  "mcpName": "io.github.judas-priest/integram",