Skip to content

refactor(container): отделить определение контейнера в отдельный пакет (#412)#416

Merged
skulidropek merged 3 commits into
ProverCoderAI:mainfrom
skulidropek:issue-412
Jun 17, 2026
Merged

refactor(container): отделить определение контейнера в отдельный пакет (#412)#416
skulidropek merged 3 commits into
ProverCoderAI:mainfrom
skulidropek:issue-412

Conversation

@skulidropek

Copy link
Copy Markdown
Member

Closes #412.

Контекст

Issue #412: «Логика контейнеров должна лежать в отдельном сабмодуле, а сама панель — отдельный модуль.» По уточнению: сабмодуль = workspace-пакет; панель (app) ↔ REST ↔ бекенд (lib+api) уже разделены; вынести надо определение самого контейнера (Dockerfile / entrypoint / docker-compose — «что есть контейнер и что в нём ставится»), которое лежало внутри бекенда.

Что сделано

Phase A — новый leaf-пакет @prover-coder-ai/docker-git-container

Чистый CORE-слой рендеринга вынесен из packages/lib:

  • Перемещены (git mv, путь core/ сохранён → relative-импорты не тронуты): templates.ts (planFiles), templates-entrypoint*, templates/ (Dockerfile + docker-compose), templates-prompt/zsh, template-defaults.ts, shell-literals.ts + templates.test.ts.
  • Новое в пакете: domain.ts (контейнер-подмножество — TemplateConfig, GpuMode, resolveCompose*…), resource-limits.ts (тип ResolvedComposeResourceLimits), index.ts.
  • packages/lib зависит от пакета и реэкспортирует перенесённые символы → публичный API @effect-template/lib не сломан, churn у потребителей нулевой.
  • resource-limits.ts оставлен в lib (завязан на CLI RawOptions/ParseError); в контейнер вынесен только результирующий тип — пакет остаётся полностью чистым.

Phase B — убрана мёртвая копия контейнерной логики из панели

  • Удалён packages/app/src/lib (165 файлов дубля) + дублирующий тест/адаптер.
  • Убраны мёртвые @lib-алиасы (4 vite/vitest + tsconfig), неиспользуемая зависимость и билд-шаги @effect-template/lib из app.
  • Правило no-lib-imports расширено: панели запрещён импорт и бекенда, и контейнерного пакета.

Математические гарантии

  • Инвариант (эквивалентность): ∀ config ∈ TemplateConfig: planFiles_new(config) ≡ planFiles_old(config) — генерируемые Dockerfile/entrypoint.sh/docker-compose.yml побайтово идентичны.
  • Чистота: packages/container/src не импортирует shell/, usecases/, api, app (CORE остаётся CORE).
  • Ацикличность: container ← lib ← api; app не зависит ни от container, ни от lib.
  • Совместимость: публичный API @effect-template/lib сохранён через реэкспорт.

Proof of fix

  • Причина: определение контейнера было вшито в бекенд-пакет lib, а его мёртвая копия — в панель app; ответственности «панель» и «контейнер» не были выделены в модули.
  • Решение: чистый CORE-слой вынесен в самостоятельный пакет @prover-coder-ai/docker-git-container, от которого зависит только бекенд; мёртвая копия удалена из панели, граница закреплена eslint-правилом.
  • Доказательство: перенесённый property-based templates.test.ts (64 теста) проходит в новом пакете без изменений → генерация файлов идентична.

Verification

Пакет build typecheck tests lint lint:effect
container 64 ✓ 0
lib 227 ✓ 0
api
app build:web + build:docker-git ✓ 449 ✓ 0

🤖 Generated with Claude Code

…ckage (ProverCoderAI#412)

Separate the container definition from the panel and the backend.

- New leaf package @prover-coder-ai/docker-git-container owns the pure
  rendering layer (planFiles → Dockerfile/entrypoint.sh/docker-compose.yml,
  TemplateConfig, resolveCompose* helpers). Zero deps on shell/usecases/api/app.
- packages/lib (backend) now depends on it and re-exports the moved symbols,
  keeping the @effect-template/lib public API unchanged.
- Panel: removed the dead duplicate packages/app/src/lib (165 files), its
  @lib / @effect-template/lib aliases and unused dependency. The no-lib-imports
  ESLint rule now forbids the panel from importing the backend OR the
  container-definition package.

No runtime behaviour change: generated container files are byte-identical,
guaranteed by the unchanged property-based template test suite (moved to the
new package). Dependency graph stays acyclic: container <- lib <- api.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
skulidropek and others added 2 commits June 17, 2026 08:35
…t job (ProverCoderAI#412)

Fix CI regressions from extracting @prover-coder-ai/docker-git-container:

- packages/api/Dockerfile: controller image enumerated packages explicitly
  (api/app/session-sync/lib/terminal) and omitted the new container package,
  so `bun install --frozen-lockfile` failed (lockfile had a workspace member
  whose package.json was never copied) and the in-image lib build could not
  find ../container. Add container to mkdir, COPY package.json, the install
  --filter list, COPY source, and build it before lib. Fixes all docker E2E.

- packages/lib/package.json: add prelint/prelint:effect that build the
  container package, mirroring the existing pretypecheck/pretest. The CI lint
  job builds nothing, and lib's vibecode-linter runs tsc; without the built
  container .d.ts, FileSpec/TemplateConfig collapsed to `any` and
  Match.exhaustive failed (657 errors). Fixes Lint (lib).

- .github/workflows/check.yml: add first-class container steps to the build,
  types, test, lint and lint-effect jobs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…t:effect (ProverCoderAI#412)

Run eslint --fix / biome --write across the PR packages (container, lib, app)
and keep the resulting auto-fixes. Also drop lib's prelint:effect: lint:effect
is plain ESLint and needs no built container .d.ts (it passed in CI without it).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@skulidropek

Copy link
Copy Markdown
Member Author

@coderabbitai проведи REVIEW
Мы разделили панель и контейнер

@skulidropek skulidropek merged commit 17b45c4 into ProverCoderAI:main Jun 17, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Отделить саму панель и контейнеры

1 participant