docs: fix documentation drift in CLAUDE.md
Correct 8 inaccuracies where CLAUDE.md diverged from the actual codebase: server is a Node.js launcher not Koa 3, apps/player/ doesn't exist, remove non-existent commands, fix adapter layer and event bridge file names, correct DI and module format claims. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -7,8 +7,8 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
|
||||
MediaGo is a cross-platform video downloader supporting m3u8/HLS streams. The codebase is a pnpm monorepo with three products:
|
||||
|
||||
1. **Desktop app** (`apps/electron` + `apps/ui`) — Electron wrapper that launches Go Core as a subprocess
|
||||
2. **Web server** (`apps/server` + `apps/ui`) — Koa 3 server that launches Go Core as a subprocess
|
||||
3. **Video player** (`apps/player` + `apps/player-ui`) — Standalone Go server with embedded React UI for video playback
|
||||
2. **Web server** (`apps/server` + `apps/ui`) — Node.js launcher that spawns Go Core as a subprocess
|
||||
3. **Video player** (`apps/core` + `apps/player-ui`) — Player UI embedded in Go Core for video playback
|
||||
|
||||
All three products share the Go Core backend (`apps/core`) for download orchestration.
|
||||
|
||||
@@ -17,9 +17,8 @@ All three products share the Go Core backend (`apps/core`) for download orchestr
|
||||
```bash
|
||||
pnpm install # Install all dependencies (run once per clone)
|
||||
pnpm dev:electron # Start Electron desktop dev environment (HMR)
|
||||
pnpm dev:server # Start Koa web server dev environment (HMR)
|
||||
pnpm dev:server # Start server dev environment (HMR)
|
||||
pnpm build:electron # Production build for Electron
|
||||
pnpm build:server # Production build for server
|
||||
pnpm build:web # Build UI only (server mode)
|
||||
pnpm core:dev # Start Go Core dev server (port 9900)
|
||||
pnpm core:build # Compile Go Core binary
|
||||
@@ -34,7 +33,6 @@ pnpm format:check # Check formatting without modifying
|
||||
pnpm check # Full check: lint + format + type check
|
||||
pnpm type:check # TypeScript type checking via Turborepo
|
||||
pnpm pack:electron # Build + package Electron distributable
|
||||
pnpm pack:server # Build + package server distributable
|
||||
```
|
||||
|
||||
Commits use Conventional Commits format (e.g. `feat(electron): add queue UI`).
|
||||
@@ -47,10 +45,9 @@ Commits use Conventional Commits format (e.g. `feat(electron): add queue UI`).
|
||||
|
||||
- **`apps/core/`** — Go (Gin) REST API backend for download orchestration. Runs on port 9900. Uses SQLite (GORM), SSE for real-time events, PTY for capturing download tool output. Built with Gulp + Go cross-compilation.
|
||||
- **`apps/electron/`** — Electron main process (tsdown build, inversify DI). Launches Go Core via `@mediago/service-runner`.
|
||||
- **`apps/server/`** — Koa 3 web server backend (tsdown build, inversify DI, socket.io). Launches Go Core via `@mediago/service-runner`.
|
||||
- **`apps/server/`** — Node.js launcher (tsdown build). Spawns Go Core via `@mediago/service-runner`.
|
||||
- **`apps/ui/`** — Shared React 19 frontend (Vite 8, Ant Design 6, Zustand, TailwindCSS 4, i18next). Used by both Electron and server targets.
|
||||
- **`apps/player/`** — Go (Gin) video player server. Embeds React UI via `//go:embed`. Built with Gulp + Go.
|
||||
- **`apps/player-ui/`** — React 19 frontend for player (Vite 8, shadcn/ui, video.js, TailwindCSS 4).
|
||||
- **`apps/player-ui/`** — React 19 frontend for player (Vite 8, shadcn/ui, video.js, TailwindCSS 4). Built assets are embedded into Go Core via `//go:embed`.
|
||||
|
||||
**Packages:**
|
||||
|
||||
@@ -67,23 +64,23 @@ The `APP_TARGET` env var (`electron` | `server`) controls which backend the UI b
|
||||
- **Electron**: IPC bridge (preload) + Go Core direct (via `@mediago/core-sdk`)
|
||||
- **Server/Web**: HTTP/WebSocket + Go Core direct (via `@mediago/core-sdk`)
|
||||
|
||||
The UI adapter layer (`apps/ui/src/hooks/adapters/`) abstracts this: `go-adapter.ts` calls Go Core SDK directly, `electron/` adapter uses IPC, and a Proxy-based `apiAdapter` routes to whichever is available.
|
||||
The UI adapter layer (`apps/ui/src/hooks/adapters/`) abstracts this: `electron.ts` provides IPC bridge in desktop mode, `platform-stubs.ts` provides no-op stubs in web mode, and `index.ts` exports `platformApi` which selects the appropriate adapter.
|
||||
|
||||
### Key Patterns
|
||||
|
||||
- **Go Core as subprocess**: Both Electron and server apps launch Go Core via `@mediago/service-runner`, which manages the process lifecycle and port allocation
|
||||
- **Dependency Injection**: inversify with `@inversifyjs/binding-decorators` in Electron and server backends
|
||||
- **Dependency Injection**: inversify with `@inversifyjs/binding-decorators` in Electron backend
|
||||
- **State Management**: Zustand in the UI
|
||||
- **Real-time events**: Go Core emits SSE events (`/api/events`); the UI's `go-event-bridge.ts` subscribes and dispatches to React via a listener pattern
|
||||
- **Real-time events**: Go Core emits SSE events (`/api/events`); the UI's `api/events.ts` subscribes and dispatches to React via a listener pattern
|
||||
- **TypeScript**: Strict mode with experimental decorators and decorator metadata enabled
|
||||
- **Module format**: ES Modules everywhere except server output (CommonJS)
|
||||
- **Module format**: ES Modules everywhere
|
||||
|
||||
## Tooling
|
||||
|
||||
- **Package manager**: pnpm 10.15.0 (enforced via `packageManager` field)
|
||||
- **Build orchestration**: Turborepo
|
||||
- **App bundling**: tsdown for Node/Electron, Vite 8 for UI apps
|
||||
- **Go builds**: Gulp orchestrating `go build` / `go run` in `apps/core` and `apps/player`
|
||||
- **Go builds**: Gulp orchestrating `go build` / `go run` in `apps/core`
|
||||
- **Linter**: oxlint (config in `.oxlintrc.json`)
|
||||
- **Formatter**: oxfmt (config in `.oxfmtrc.json`)
|
||||
- **Pre-commit**: husky + lint-staged (runs oxlint --fix + oxfmt --write on staged files)
|
||||
|
||||
Reference in New Issue
Block a user