# Task: Implement Learning project catalog ## Identity - Task ID: 20260819-learning-project-catalog-impl-4e9c71a2 - Mode: Feature - Branch: codex/20260819-learning-project-catalog-impl-4e9c71a2-learning-project-catalog-impl - Worktree: D:\Datas\OthersProjects\makelore-learning-project-catalog-impl-4e9c71a2 - Base commit: 2cb8a7aef490b118a0968a5a77893f0cf4d3ebea - Owner: codex - Status: Ready for integration ## Scope - Replace AI Learning's course catalog/generation/player product with a curated project catalog, project README detail, controlled README media, and verified user-selected ZIP download. - Preserve the existing login and `module_access.learning` entry policy while replacing the Learning Renderer/Main contract without a legacy compatibility path. - Remove obsolete course UI, DTOs, IPC, Main services, OpenMAIC player packaging hooks, and focused tests. - Update the product README and add the Works Square operations/API contract because that backend source is not present in this repository. ## Intent And Constraints - Renderer access remains behind `src/lib/host-api.ts`; Works credentials, arbitrary upstream URLs, object-storage credentials, and local filesystem paths stay Main-owned. - README images must render only through HTTPS or fixed server-controlled project-media paths; server-controlled media is fetched through a bounded Main proxy and projected as a validated data URL. - Project downloads use a native save dialog, stream to a temporary file, enforce declared byte size, SHA-256, ZIP signature, redirect/origin, and 512 MiB limits, then rename atomically. - The new client never reads or migrates previously downloaded course data. It does not delete that historical user data automatically. - Keep the Makelore light visual system and Chinese-only product copy. Do not restore Works gallery, publishing, or client-side upload workbench behavior. - Operations backend implementation and deployment are external to this repository; do not claim them complete. ## Plan 1. Replace the shared Learning contract and Main Host API routes with project list/detail/media/download endpoints. 2. Rebuild the Learning Renderer as a project card grid plus Markdown detail page and simplify the Learning sidebar. 3. Delete old generation/player/local-library/runtime/IPC/package-artifact code and update app routing/layout. 4. Replace obsolete focused tests, update README and publish a precise Works Square admin/API contract. 5. Run focused tests, typecheck, lint, production build, then the task documentation gate. ## Outcome - Replaced the Learning course/generation/player surface with an authenticated, permission-gated project catalog and `/learning/project/:projectId` README detail route. - Added strict shared DTOs plus Main-owned Host API projection for project list, detail, bounded media proxy, and native ZIP download. Downloads are streamed to a temporary file and checked for account ownership, origin/redirect policy, size, ZIP signature, and SHA-256 before atomic rename. - Added Markdown rendering with raw HTML disabled. README images are restricted to server-controlled project media paths; the external server contract requires operations to mirror remote HTTPS images at publish time. - Removed the obsolete course library, generation, speech, runtime bridge, player server, package consumer, Learning IPC/preload channels, player artifact scripts, packaging resources, CI artifact steps, routes, and tests. Historical downloaded course data is neither read nor automatically deleted. - Updated the product README and added `docs/learning-project-catalog-server-contract.md` for the external Works Square operations menu, upload fields, publishing validation, image mirroring, and API contract. That external backend/admin implementation is intentionally not claimed as complete in this repository. ## Verification - `pnpm exec vitest run tests/unit/learning-client.test.ts tests/unit/learning-route.test.ts tests/unit/learning-project-download.test.ts tests/unit/learning-page.test.tsx tests/unit/learning-sidebar.test.tsx tests/unit/main-layout-module-gate.test.tsx tests/unit/app-module-provider-gate.test.tsx` — passed, 7 files / 47 tests after the final path-hardening change. - `pnpm run typecheck` — passed. - `pnpm test` — passed, 175 files / 2057 tests. - `pnpm run lint:check` — passed with 0 errors and 6 pre-existing warnings outside this change. - `pnpm run build:vite` — passed after the final change; existing bundle-size and mixed static/dynamic import warnings remain. - `pnpm run test:e2e -- tests/e2e/main-navigation.spec.ts` — passed, 3 tests. - `git diff --check` — passed; Git only reported repository line-ending conversion warnings. ## Follow-ups - Implement and deploy the operations admin/API contract in the external Works Square backend, then smoke-test list, README media, and ZIP download with a real account and published project. - Decide separately whether a future maintenance release should offer an explicit user-controlled cleanup of historical downloaded course data; this task intentionally preserves it for recoverability. ## Promotion Candidates - Target: `.project-docs/20-architecture/system-overview.md` and `.project-docs/20-architecture/data-flow.md`. Proposal: replace the Learning course/player architecture with the project catalog, bounded media proxy, and verified native download boundary. Evidence: implementation and focused/full verification above. Future impact: future Learning work must use the Host API and must not restore Renderer-held Works credentials or arbitrary download URLs. Semantic conflict: existing canonical Learning architecture still describes the removed player path. Human confirmation required: yes, during integration. - Target: `.project-docs/40-domain/business-rules.md` and `.project-docs/00-brief/success-criteria.md`. Proposal: record Learning as a curated project catalog whose README images are mirrored by the server and whose downloads are user-selected ZIP files. Evidence: `README.md`, `docs/learning-project-catalog-server-contract.md`, and the new tests. Future impact: operations/backend and client changes share one publish/download contract. Semantic conflict: existing course-oriented rules are superseded. Human confirmation required: yes, during integration. - Target: `.project-docs/80-commitments/commitments.md`. Proposal: record the external Works Square backend/admin implementation and real-account smoke test as an open integration commitment. Evidence: backend source is absent from this repository. Future impact: prevents treating the client-only delivery as an end-to-end production rollout. Semantic conflict: none known. Human confirmation required: yes, during integration.