opencode-config/docs/handoff/pr-57-memory-plugin-dockerfile.md
Sergey 89a4d947fd
fix(docker): install opencode-memory plugin in Dockerfile (#57)
* fix(docker): install @mathew-cf/opencode-memory plugin in Dockerfile

* test(docker): add Dockerfile npm install test

* docs(handoff): set PR number 57 in handoff + ADR-024

---------

Co-authored-by: opencode-agent <agent@slaid098.dev>
2026-07-24 22:07:18 +03:00

45 lines
No EOL
4.8 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
pr: 57
title: install @mathew-cf/opencode-memory plugin in Dockerfile
---
# PR #57: install @mathew-cf/opencode-memory plugin in Dockerfile
## Что сделано
- `Dockerfile:34` — в строку `npm install -g opencode-ai repomix --unsafe-perm` добавлен `@mathew-cf/opencode-memory`. Итоговая строка:
```dockerfile
RUN npm install -g opencode-ai repomix @mathew-cf/opencode-memory --unsafe-perm
```
Единственное изменение в Dockerfile, больше ничего не трогалось.
- `tests/test_dockerfile.py` — новый файл, 6 тестов:
- `test_dockerfile_exists` — файл существует на repo root
- `test_memory_plugin_in_npm_install` — `npm install -g` строка содержит `@mathew-cf/opencode-memory` (parsed check по строкам с `npm install -g`)
- `test_memory_plugin_in_npm_install_raw` — raw text содержит `@mathew-cf/opencode-memory` (belt-and-suspenders)
- `test_opencode_ai_present` — `npm install -g` строка содержит `opencode-ai` (regression guard — не удалить случайно)
- `test_opencode_ai_present_raw` — raw text содержит `opencode-ai`
- `test_single_npm_install_line_has_all_packages` — все три пакета (`opencode-ai`, `repomix`, `@mathew-cf/opencode-memory`) в одной строке install (anti-split: запрещает разбивать install по нескольким RUN layer'ам)
- Проверки raw-text grep (без Docker build), по паттерну `test_docker_compose.py` (parsed + raw, belt-and-suspenders).
- ADR-024 + этот handoff.
## Почему
После миграции opencode-config на linux-1 обнаружено: `@mathew-cf/opencode-memory` MCP plugin НЕ установлен в контейнере. `opencode.json` ссылается на плагин:
```json
"@mathew-cf/opencode-memory",
{ "memoryDir": "{env:OPENCODE_MEMORY_DIR}" }
```
Но без `npm install -g` opencode молча пропускает плагин — MCP tools недоступны:
- `memory_save` — memory-syncer subagent не может коммитить в memory repo
- `memory_search` — нет semantic/keyword search
- `memory_list` — нет browsing по категориям
Добавление пакета в существующую строку `npm install -g` — минимальное изменение: один layer, все три пакета ставятся за один RUN, без нового layer'а.
## Pending
— (нет)
## Watch out
- **RAG CLI требует GLIBC 2.39, node:20-slim имеет GLIBC 2.36 — semantic search НЕ работает.** `@mathew-cf/opencode-memory` тянет `@mathew-cf/rag-cli` как dependency для semantic search. RAG CLI (native binary) требует GLIBC 2.39, а `node:20-slim` (Debian Bookworm) поставляется с GLIBC 2.36. Semantic search через RAG падает с ошибкой совместимости glibc. Memory plugin работает с **keyword search (grep)** без RAG — этого достаточно для `memory_search` и `memory_list`. Semantic search — опциональная фича, это **известная проблема, НЕ блокер**. Workaround: keyword search покрывает базовые сценарии. Полный fix semantic search потребует другого base image (например, `node:20-bookworm` с обновлённым glibc, или `node:20` на Debian Trixie с GLIBC 2.40) — вне scope этого PR.
- **Все три пакета в одной строке install** — тест `test_single_npm_install_line_has_all_packages` намеренно запрещает разбивку install по нескольким RUN layer'ам. Разбиение добавило бы лишние image layers и скрыло бы, какой пакет отсутствует, при grep-проверке Dockerfile.
- **Anti-regression тесты (raw + parsed)** — дублирующие raw-проверки добавлены намеренно (как в `test_docker_compose.py`): parsed-check может пропустить edge case (многострочный install, кавычки), raw-check ловит строку напрямую. Оба должны оставаться.
- **`opencode-ai` regression guard** — тест `test_opencode_ai_present` (+ raw) защищает от случайного удаления `opencode-ai` при редактировании строки install. `opencode-ai` — основной пакет, без него контейнер не запустится (ENTRYPOINT `opencode`).
- ADR number = 024 (sequential, следующий после 023), НЕ PR number.