Repository navigation
build: unify web asset directory naming - #5535
Conversation
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bfa817d503
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
|
||
| # Built from the desktop renderer web variant by scripts/sync-web-dist.mjs. | ||
| /dist-web/ | ||
| /web-dist/ |
There was a problem hiding this comment.
Clean up or keep ignoring the legacy Web output
For contributors who previously ran pnpm build or pnpm sync:web, Git preserves the generated apps/kimi-code/dist-web tree when this commit is checked out; replacing its ignore rule makes that entire tree untracked, while the updated sync script only removes web-dist. Subsequent builds therefore leave git status dirty and expose the stale generated JavaScript to repository checks such as the mandatory lint run. Delete the legacy directory during synchronization or retain a migration ignore entry.
AGENTS.md reference: AGENTS.md:L51-L55
Useful? React with 👍 / 👎.
Requirement or Bug
当前浏览器 Web UI 从共享 renderer 构建后已经输出到
apps/desktop/web-dist,但复制进 CLI 包时又改名为apps/kimi-code/dist-web;与此同时 Electron renderer 使用desktop-dist。同级构建产物存在两套命名方向,导致 CLI 运行时、npm 包、SEA manifest/cache、CI artifact 和测试都长期携带特例。本 PR 将产物命名统一为
web-dist与desktop-dist,并彻底移除dist-web。无关联 issue;这是明确提出的命名统一改动。Bug Reproduction Steps
N/A
Root Cause
N/A
Code Changes
核心思路
保留现有构建拓扑,只统一目录契约:浏览器变体无论位于 desktop 构建目录还是 CLI 包中,都叫
web-dist;Electron 变体继续叫desktop-dist。不增加旧目录探测、复制两份产物或运行时回退。flowchart LR Source[apps/desktop/src/renderer] Source -->|build:web| Web[apps/desktop/web-dist] Web -->|sync:web / CLI prebuild| CliWeb[apps/kimi-code/web-dist] Source -->|build:renderer| Desktop[apps/desktop/desktop-dist] CliWeb --> Npm[npm package] CliWeb --> SEA[native SEA assets] Desktop --> Electron[Electron resources]这样
sync:web仍负责构建并整体替换 CLI 的 Web 产物,但 source 与 target 的 basename 不再发生无意义的翻转。关键决策
web-dist/desktop-distdist-web特例<产品>-dist命名dist-web回退或双份目录web-dist、运行时仍按dist-web校验或解压改动范围
web-dist。web-dist解析静态资源。web/<target>/web-dist/...,manifest root 与解压缓存末级目录同步改为web-dist。dist-web。阅读指南
apps/kimi-code/scripts/sync-web-dist.mjs:确认 desktop Web 变体复制到 CLI 的新目标目录。apps/kimi-code/src/cli/sub/web/run.ts与apps/kimi-code/package.json:确认运行和 npm 包使用同一路径。apps/kimi-code/scripts/native/manifest.mjs、scripts/native/web-assets.mjs、src/native/web-assets.ts:确认 SEA 构建与运行时契约完整迁移。Behavior Changes and Affected Users
apps/kimi-code/dist-webapps/kimi-code/web-distweb-distweb/<target>/dist-web/...、缓存末级dist-webweb/<target>/web-dist/...、缓存末级web-distapps/kimi-code/dist-webapps/kimi-code/web-distpnpm sync:web、pnpm build与kimi web的调用方式apps/desktop/desktop-dist普通
kimi web用户不会看到界面、命令参数、服务生命周期或 HTTP 路由变化;变化集中在发布包和构建产物路径。webAssetsDir的通用服务端契约未改,Desktop 的desktop-dist路径也未改。受影响模块与覆盖:
apps/kimi-code/test/cli/web/web.test.ts。apps/kimi-code/test/scripts/native/web-assets.test.ts。apps/kimi-code/test/native/web-assets.test.ts。tests/e2e/surfaces/web.ts。npm pack --dry-run。验证记录
pnpm exec vitest run --reporter=agent apps/kimi-code/test/scripts/native/web-assets.test.ts apps/kimi-code/test/native/web-assets.test.ts apps/kimi-code/test/cli/web/web.test.ts:3 个文件、82 个用例通过。pnpm sync:web:成功;source 与 target 共 782 个文件,逐文件 SHA-256 一致;旧apps/kimi-code/dist-web未生成。pnpm --filter @moonshot-ai/kimi-code run build:通过。pnpm --filter @moonshot-ai/kimi-code run smoke:通过。npm pack --dry-run --ignore-scripts --json:包内包含web-dist/index.html,不包含dist-web。pnpm run check:duplication <base-sha>:通过。git diff --check:通过。check-comments与 type-aware oxlint:通过。pnpm lint未运行完成;停止前check-comments、oxlint、import boundaries 与 guards 已通过。完整 lint 由 PR CI 继续验证。Checklist
gen-changesetsskill; no changeset was requested for this internal build-artifact rename.gen-docsskill; no user documentation update is needed because CLI usage and user-visible behavior are unchanged.