Conversation
There was a problem hiding this comment.
Pull request overview
This PR expands MineDock into a template-driven instance lifecycle loop, adding game/template discovery, real-time instance status sync, an in-browser console, and config rebuild flows, along with docs/CI/tasking updates to support the new architecture.
Changes:
- Introduces backend game catalog + YAML templates and updates instance creation/config update APIs accordingly.
- Adds WebSocket-based real-time instance snapshot push and a WebSocket console bridge (stdin/stdout/stderr).
- Evolves storage and engineering workflows: SQLite persistence improvements, new Taskfile quality gates, and reorganized documentation/exec plans.
Reviewed changes
Copilot reviewed 76 out of 78 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| Taskfile.yml | Adds fmt/lint/docs tasks and reorganizes global quality gates. |
| scripts/todo-gen/main.go | New TODO index generator for consolidating TODO: comments into docs. |
| Readme.md | Updates project TODO list and trims/adjusts run guidance. |
| frontend/vite.config.js | Adjusts dev server host/HMR and proxy WebSocket settings. |
| frontend/src/views/InstanceDetail.vue | New instance detail page with console/config tabs and console lifecycle management. |
| frontend/src/views/ImageRegistry.vue | New game template marketplace page with category filtering and navigation to create flow. |
| frontend/src/views/ContainerList.vue | Hooks in realtime sync, routes to registry/detail pages, and improves output i18n rendering. |
| frontend/src/stores/games.ts | New Pinia store for game list + template caching and fetching. |
| frontend/src/stores/containers.ts | Enhances store with i18n-safe error mapping, WS connection state, snapshot apply, and updated create signature. |
| frontend/src/router/index.ts | Adds routes for registry, create instance, and instance detail pages. |
| frontend/src/locales/zh-CN.json | Adds i18n strings for console/config/registry/errors and realtime status. |
| frontend/src/locales/en-US.json | Adds i18n strings for console/config/registry/errors and realtime status. |
| frontend/src/composables/useInstanceSync.ts | New composable for WS realtime sync with polling fallback and exponential backoff reconnect. |
| frontend/src/composables/useConsole.ts | New xterm-based console composable over WebSocket bridge. |
| frontend/src/components/TopBar.vue | Adds realtime sync indicator and refines language menu behavior. |
| frontend/src/components/Sidebar.vue | Adds navigation entry for the registry and tweaks mobile/desktop hamburger spacing. |
| frontend/src/api/index.ts | Adds typed APIs for games/templates/config, WS URL builder, and structured request error type. |
| frontend/package.json | Adds xterm dependencies for the web console. |
| frontend/package-lock.json | Locks newly added xterm dependencies. |
| docs/standards/ops.md | New ops standards doc reflecting Taskfile/CI/release conventions. |
| docs/standards/frontend.md | New frontend standards doc describing architecture, routing, styling, and error handling conventions. |
| docs/standards/directory.md | New directory layout reference. |
| docs/standards/backend.md | New backend standards doc describing layering, error handling, DB constraints, and quality gates. |
| docs/ops_engineering_standards.md | Removes older ops standards doc in favor of reorganized standards. |
| docs/exec-plans/TODO.md | Adds generated TODO index output. |
| docs/exec-plans/README.md | Adds exec-plans directory guidance and TODO index generation instructions. |
| docs/exec-plans/completed/20260401-realtime-status-sync.md | Adds completed plan doc for WS realtime status sync design/implementation. |
| docs/exec-plans/completed/20260331-static-image-registry.md | Adds completed plan doc for static registry design/implementation history. |
| docs/exec-plans/completed/20260331-image-marketplace-page.md | Adds completed plan doc for marketplace UI flow. |
| docs/exec-plans/active/20260402-container-ports-volumes.md | Adds active plan doc for port/volume wiring on create. |
| docs/exec-plans/.markdownlint.json | Adds markdownlint overrides for exec-plans docs. |
| docs/domain_instance_lifecycle.md | Removes older lifecycle doc in favor of reorganized design docs. |
| docs/design-docs/instance_lifecycle.md | Adds updated lifecycle design doc including config rebuild, console, and consistency strategy. |
| docs/api/contracts.md | Adds consolidated API contracts including games/templates/ws/config endpoints. |
| docs/02_API_Contracts.md | Removes older API contracts doc in favor of new contracts location. |
| docs/01_Frontend_Standards.md | Removes older frontend standards doc in favor of new standards structure. |
| docs/01_Backend_Standards.md | Removes older backend standards doc in favor of new standards structure. |
| docs/00_Root_Context.md | Removes older root context doc in favor of reorganized docs. |
| backend/templates/terraria.yaml | Adds Terraria YAML template definition. |
| backend/templates/minecraft-java.yaml | Adds Minecraft Java YAML template definition. |
| backend/templates/minecraft-bedrock.yaml | Adds Minecraft Bedrock YAML template definition. |
| backend/main.go | Wires up game service, event hub, WS handlers, console service, and config handler into the server. |
| backend/internal/store/sqlite.go | Extends schema to store game_id, improves comments, and adds schema migration helper. |
| backend/internal/store/sqlite_test.go | Adds SQLite store tests covering save/get/upsert/unique name/delete/list. |
| backend/internal/service/game_service.go | Adds game catalog loader and YAML template parsing + normalization/validation. |
| backend/internal/service/game_service_test.go | Adds tests for game service loading, template resolution, and validation errors. |
| backend/internal/service/event_hub.go | Adds Docker events listener + WS broadcast hub with debounce, dedupe, and backoff. |
| backend/internal/service/event_hub_test.go | Adds tests for client add/remove and snapshot deduplication behavior. |
| backend/internal/service/console_service.go | Adds console attach service with running-state enforcement. |
| backend/internal/service/console_service_test.go | Adds tests for attach success/failure paths. |
| backend/internal/model/template.go | Adds template model types (image/container/ports/volumes/resources/params). |
| backend/internal/model/instance.go | Extends instance model to include game_id. |
| backend/internal/model/game.go | Adds game model for catalog listing. |
| backend/internal/model/errors.go | Adds shared domain errors used for consistent API error mapping. |
| backend/internal/api/ws_handler.go | Adds WS handler for instance snapshot events. |
| backend/internal/api/ws_handler_test.go | Adds WS handler tests for hub unavailable and client add/remove. |
| backend/internal/api/router.go | Registers new API routes (games/templates/ws/config/console) and adjusts CORS handling. |
| backend/internal/api/handlers.go | Updates instance APIs to accept game/template params/ports and centralizes error-to-status mapping. |
| backend/internal/api/game_handlers.go | Adds handlers for listing games and fetching templates by id. |
| backend/internal/api/console_handler.go | Adds WS console bridge handler piping WS <-> Docker attach streams. |
| backend/internal/api/config_handler.go | Adds config read/update handlers with rebuild flow support. |
| backend/internal/api/config_handler_test.go | Adds tests for config get/update endpoints and error mapping. |
| backend/go.sum | Adds dependency checksums (e.g., coder/websocket). |
| backend/go.mod | Adds coder/websocket and records yaml dependency. |
| backend/games.json | Adds game catalog data consumed by the backend and UI. |
| backend/.golangci.yml | Adds golangci-lint configuration for backend linting. |
| AGENTS.md | Adds documentation navigation index. |
| .markdownlint.json | Adds root markdownlint configuration. |
| .github/workflows/release.yml | Updates workflow to use new formatting task name. |
| .github/workflows/ci.yml | Updates CI to use new global formatting check task. |
Files not reviewed (1)
- frontend/package-lock.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| docs:links:check: | ||
| desc: Check Markdown links for the knowledge base | ||
| cmds: | ||
| - npx --yes markdown-link-check -q "AGENTS.md" "Readme.md" "docs" |
There was a problem hiding this comment.
docs:links:check passes the docs directory to markdown-link-check, but the CLI expects Markdown file paths; passing a directory typically fails with an EISDIR/stat error. Consider changing this to a glob of markdown files (e.g. docs/**/*.md) or enumerating files via find/git ls-files before invoking the checker so the task works in CI.
| - npx --yes markdown-link-check -q "AGENTS.md" "Readme.md" "docs" | |
| - find docs -type f -name '*.md' -exec npx --yes markdown-link-check -q "AGENTS.md" "Readme.md" {} + |
| socket.onclose = (event: CloseEvent) => { | ||
| if (disposed) { | ||
| return; | ||
| } | ||
| connected.value = false; | ||
| if (event.reason) { | ||
| error.value = event.reason; | ||
| return; | ||
| } | ||
| if (event.code !== 1000) { | ||
| error.value = "console.disconnected"; | ||
| } |
There was a problem hiding this comment.
The WebSocket close handler sets error.value = "console.disconnected", but the locales only define console.disconnectedLabel (no console.disconnected). This will render as a missing i18n key in InstanceDetail.vue (it translates any console.* errors). Align the key name (either add console.disconnected translations or reuse the existing console.disconnectedLabel).
| "dependencies": { | ||
| "@xterm/addon-attach": "^0.11.0", | ||
| "@xterm/addon-fit": "^0.10.0", | ||
| "@xterm/xterm": "^5.5.0", | ||
| "pinia": "^3.0.4", |
There was a problem hiding this comment.
@xterm/addon-attach is added as a dependency but does not appear to be imported/used anywhere in frontend/src (the console composable uses only @xterm/xterm and @xterm/addon-fit). If it's not needed, remove it (and the corresponding lockfile entry) to reduce install/bundle surface; otherwise add the integration that requires it.
| <div | ||
| v-for="item in store.instances" | ||
| :key="item.container_id" | ||
| class="card" | ||
| @click="openInstanceDetail(item.container_id)" | ||
| > |
There was a problem hiding this comment.
Each instance card is now a clickable <div> that navigates to the detail page. As-is it isn’t keyboard-accessible (no tabindex, no Enter/Space handling, no link semantics), which is an accessibility regression. Prefer using a semantic element (e.g. a <button>/<a> wrapper) or add role="link" + tabindex="0" and key handlers so keyboard users can open details.
| <div class="header-left"> | ||
| <button class="back-btn" @click="backToList"><</button> | ||
| </div> |
There was a problem hiding this comment.
The back button uses only the “<” glyph and has no accessible label. Add an aria-label (and preferably type="button") so screen readers announce its purpose and it won’t accidentally act as a submit button if nested in a form in the future.
变更概览
本 PR 将 MineDock 从“基础容器增删启停”扩展为“模板驱动创建 + 实时状态同步 + 在线控制台 + 配置重建”的完整链路,同时补齐文档体系与任务流水线。
主要改动
API 变化
行为说明与注意事项
影响范围