Repository navigation
build: produce the CLI's bundled web UI from the desktop renderer - #5075
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: |
6081e4c to
8db9f14
Compare
9f377a7 to
12a03b0
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6ec07bf7dd
ℹ️ 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".
| const build = spawnSync(pnpm, ['--filter', 'kimi-code-app', 'run', 'build:web'], { | ||
| cwd: repoRoot, | ||
| stdio: 'inherit', | ||
| }); |
There was a problem hiding this comment.
Launch the pnpm shim through a Windows shell
When this script runs in either Windows native-build job or during a local Windows CLI build, it attempts to execute pnpm.cmd directly without shell: true, so spawning fails before dist-web is generated. The repository already codifies the required Windows behavior in apps/kimi-code/test/cli/update/preflight.test.ts:465-480, which invokes pnpm.cmd through a shell, while .github/workflows/_native-build.yml:73-76,119-124 now sends both win32 targets through this script. Invoke the shim through a correctly quoted shell or cmd.exe so Windows artifacts can be built.
Useful? React with 👍 / 👎.
| # Built from the desktop renderer web variant by scripts/sync-web-dist.mjs. | ||
| /dist-web/ |
There was a problem hiding this comment.
Update the mandated web-bundle workflow
Ignoring generated dist-web reverses the repository's documented workflow, but the mandatory root guide still tells contributors that the source is external, to run the old cross-repository sync command, and to force-add the bundle. Contributors preparing subsequent web releases will therefore follow instructions that either no longer work or recommit the generated output, undoing this migration; update the guide to describe the new desktop-renderer build path in the same change.
AGENTS.md reference: AGENTS.md:L17-L18
Useful? React with 👍 / 👎.
| @@ -51,7 +51,7 @@ | |||
| }, | |||
| "scripts": { | |||
| "build": "tsdown && tsdown --config tsdown.dist-worker.config.ts && node scripts/copy-native-assets.mjs && node scripts/check-web-assets.mjs", | |||
| "prebuild": "node scripts/build-vis-asset.mjs", | |||
| "prebuild": "node scripts/build-vis-asset.mjs && node scripts/sync-web-dist.mjs", | |||
There was a problem hiding this comment.
Sync web assets before every native build
On a clean checkout, invoking build:native:sea or build:native:release directly no longer works because the new sync runs only as the lifecycle hook for the separate build script; both native scripts execute scripts/native/build.mjs directly, whose SEA step requires dist-web/index.html. The previously committed bundle made these commands self-contained, whereas they now either fail on a clean checkout or silently embed stale ignored assets left from another branch. Run the sync from the native build entry point or add corresponding native pre-hooks.
Useful? React with 👍 / 👎.
| # committed — build it from the desktop renderer's web variant, | ||
| # then verify it is in place before producing the native | ||
| # executable. | ||
| node apps/kimi-code/scripts/sync-web-dist.mjs |
There was a problem hiding this comment.
Make the Nix web bundle deterministic
Rebuilding the same flake now executes the Vite web build, whose shared preset defines __KIMI_BUILD_TIME__ with new Date().toISOString() in packages/vite-preset/src/index.ts:77, and DebugMenu.vue:15-16 consumes that value in the emitted bundle. Because the SEA binary embeds every dist-web byte, identical Nix inputs now produce timestamp-dependent asset hashes and binaries, causing reproducibility checks such as nix build --check to fail. Supply a deterministic build timestamp, for example from SOURCE_DATE_EPOCH, when generating the Nix bundle.
Useful? React with 👍 / 👎.
12a03b0 to
54fcbd6
Compare
dist-web is no longer committed: apps/kimi-code's prebuild runs scripts/sync-web-dist.mjs, which builds the desktop renderer's web variant and copies it into apps/kimi-code/dist-web; the native-assets workflow and the nix build do the same before packaging. The root gains a sync:web alias and check-web-assets.mjs stays as the packaging guard with an updated message; the stale .commentignore exemption for the previously committed bundle is dropped.
8db9f14 to
d7b3164
Compare
54fcbd6 to
fd2d7eb
Compare
* ci: bring the desktop build workflows into the monorepo desktop-build.yml imported from code-app with the submodule checkout removed; triggers unchanged (release-branch pushes, dispatch, workflow_call). New desktop-ci.yml runs the Windows screenshot-native build, real window enumeration, and desktop tests on windows-latest, gated to desktop-related paths on PRs and full-suite on dispatch. The ci.yml release-workflow-tests job now also runs the imported release.test.mjs. desktop-e2e.yml is held back until the fullmoon-* self-hosted runners are granted to this repository. The main-window host-view tests now stub process.resourcesPath like the other describes in the file: on win32 runners windowsWindowOptions actually joins it, which failed with 'path argument must be of type string' the first time these tests ran on Windows. * ci: merge the desktop release flow into release.yml (#5077) One pipeline on release/* branches now ships both CLI and desktop: the version job runs scripts/version-release.mjs (records release-plan.json) so one version PR bumps CLI and kimi-code-app together; new desktop-release / desktop-artifacts / publish-desktop-assets jobs validate the plan, build four signed platform artifacts via desktop-build.yml, and publish a GitHub Release tagged kimi-code-desktop@<version>. CLI-only releases skip the desktop chain (release.mjs exits with build=false when the plan has no desktop package). The canary prerelease tag uses the same kimi-code-desktop@ prefix.
* chore: import code-app sources into the monorepo Snapshot-import the Kimi Code desktop app and its client packages from code-app (source: MoonshotAI/kimi-code-app desktop-opensource), without git history: apps/desktop, packages/app-*, vite-preset, patches, icon-tools, desktop release scripts, brand sources, release-notes. The snapshot includes code-app's latest product commits (#1364 rollout cap removal, #1365 local file annotations, #1367 empty tooltip fix). Not carried: apps/rc-portal, READMEs, apps/desktop/docs, the changeset/release-notes skills, code-app's pending changesets (they return at cutover), and .changeset/release-plan.json (its referenced changesets stay behind; the release flow regenerates it). Host-repo adaptations: workspace overrides (ssh2, zod, shiki 4.3.1, linkedom 0.18.12, canvas excluded), markstream-vue patch, root scripts and typecheck aggregation, vitest projects, flake.nix workspace lists, oxlint grandfathering of legacy findings via the ratchet baseline, check-comments strip of 401 legacy comments, a CI typecheck step for the desktop app, and pre-public audit scrubs (internal wiki revision in release_branch_kind.py, GitLab-CI wording in the local signing scripts). * build: produce the CLI's bundled web UI from the desktop renderer (#5075) * build: produce the CLI's bundled web UI from the desktop renderer dist-web is no longer committed: apps/kimi-code's prebuild runs scripts/sync-web-dist.mjs, which builds the desktop renderer's web variant and copies it into apps/kimi-code/dist-web; the native-assets workflow and the nix build do the same before packaging. The root gains a sync:web alias and check-web-assets.mjs stays as the packaging guard with an updated message; the stale .commentignore exemption for the previously committed bundle is dropped. * ci: bring the desktop build workflows into the monorepo (#5076) * ci: bring the desktop build workflows into the monorepo desktop-build.yml imported from code-app with the submodule checkout removed; triggers unchanged (release-branch pushes, dispatch, workflow_call). New desktop-ci.yml runs the Windows screenshot-native build, real window enumeration, and desktop tests on windows-latest, gated to desktop-related paths on PRs and full-suite on dispatch. The ci.yml release-workflow-tests job now also runs the imported release.test.mjs. desktop-e2e.yml is held back until the fullmoon-* self-hosted runners are granted to this repository. The main-window host-view tests now stub process.resourcesPath like the other describes in the file: on win32 runners windowsWindowOptions actually joins it, which failed with 'path argument must be of type string' the first time these tests ran on Windows. * ci: merge the desktop release flow into release.yml (#5077) One pipeline on release/* branches now ships both CLI and desktop: the version job runs scripts/version-release.mjs (records release-plan.json) so one version PR bumps CLI and kimi-code-app together; new desktop-release / desktop-artifacts / publish-desktop-assets jobs validate the plan, build four signed platform artifacts via desktop-build.yml, and publish a GitHub Release tagged kimi-code-desktop@<version>. CLI-only releases skip the desktop chain (release.mjs exits with build=false when the plan has no desktop package). The canary prerelease tag uses the same kimi-code-desktop@ prefix.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0d256bf863
ℹ️ 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".
| on: | ||
| push: | ||
| branches: ['release/**'] | ||
| workflow_dispatch: |
There was a problem hiding this comment.
Restore the scheduled Canary trigger
With no schedule entry under on, every github.event_name == 'schedule' branch—including nightly-guard and publish-canary—is unreachable; the only repository caller is the stable workflow_call from release.yml. Consequently, automatic nightly desktop Canary releases never run, so add the intended scheduled trigger.
Useful? React with 👍 / 👎.
| if (packages.length === 0) { | ||
| if (command === 'prepare') appendFileSync(process.env.GITHUB_OUTPUT, 'build=false\n'); | ||
| process.exit(0); |
There was a problem hiding this comment.
Enable private desktop versioning before gating on the plan
kimi-code-app is private, but .changeset/config.json does not enable privatePackages.version; Changesets therefore does not bump it by default (Changesets configuration). Since version-release.mjs records only packages whose versions changed, even a desktop changeset cannot place this package in release-plan.json, so this branch always emits build=false and skips every stable desktop artifact and publication job. Add an explicit private-app versioning path and update the mandated changeset policy before using plan membership as the release gate.
AGENTS.md reference: AGENTS.md:L94-L95
Useful? React with 👍 / 👎.
* chore: import code-app sources into the monorepo (#5074) * chore: import code-app sources into the monorepo Snapshot-import the Kimi Code desktop app and its client packages from code-app (source: MoonshotAI/kimi-code-app desktop-opensource), without git history: apps/desktop, packages/app-*, vite-preset, patches, icon-tools, desktop release scripts, brand sources, release-notes. The snapshot includes code-app's latest product commits (#1364 rollout cap removal, #1365 local file annotations, #1367 empty tooltip fix). Not carried: apps/rc-portal, READMEs, apps/desktop/docs, the changeset/release-notes skills, code-app's pending changesets (they return at cutover), and .changeset/release-plan.json (its referenced changesets stay behind; the release flow regenerates it). Host-repo adaptations: workspace overrides (ssh2, zod, shiki 4.3.1, linkedom 0.18.12, canvas excluded), markstream-vue patch, root scripts and typecheck aggregation, vitest projects, flake.nix workspace lists, oxlint grandfathering of legacy findings via the ratchet baseline, check-comments strip of 401 legacy comments, a CI typecheck step for the desktop app, and pre-public audit scrubs (internal wiki revision in release_branch_kind.py, GitLab-CI wording in the local signing scripts). * build: produce the CLI's bundled web UI from the desktop renderer (#5075) * build: produce the CLI's bundled web UI from the desktop renderer dist-web is no longer committed: apps/kimi-code's prebuild runs scripts/sync-web-dist.mjs, which builds the desktop renderer's web variant and copies it into apps/kimi-code/dist-web; the native-assets workflow and the nix build do the same before packaging. The root gains a sync:web alias and check-web-assets.mjs stays as the packaging guard with an updated message; the stale .commentignore exemption for the previously committed bundle is dropped. * ci: bring the desktop build workflows into the monorepo (#5076) * ci: bring the desktop build workflows into the monorepo desktop-build.yml imported from code-app with the submodule checkout removed; triggers unchanged (release-branch pushes, dispatch, workflow_call). New desktop-ci.yml runs the Windows screenshot-native build, real window enumeration, and desktop tests on windows-latest, gated to desktop-related paths on PRs and full-suite on dispatch. The ci.yml release-workflow-tests job now also runs the imported release.test.mjs. desktop-e2e.yml is held back until the fullmoon-* self-hosted runners are granted to this repository. The main-window host-view tests now stub process.resourcesPath like the other describes in the file: on win32 runners windowsWindowOptions actually joins it, which failed with 'path argument must be of type string' the first time these tests ran on Windows. * ci: merge the desktop release flow into release.yml (#5077) One pipeline on release/* branches now ships both CLI and desktop: the version job runs scripts/version-release.mjs (records release-plan.json) so one version PR bumps CLI and kimi-code-app together; new desktop-release / desktop-artifacts / publish-desktop-assets jobs validate the plan, build four signed platform artifacts via desktop-build.yml, and publish a GitHub Release tagged kimi-code-desktop@<version>. CLI-only releases skip the desktop chain (release.mjs exits with build=false when the plan has no desktop package). The canary prerelease tag uses the same kimi-code-desktop@ prefix. * build(nix): include patches/ in the nix src fileset pnpm-workspace.yaml now carries a patchedDependency ([email protected]) whose patch file lives under patches/; the nix build's src fileset did not include it, so fetchPnpmDeps failed with ENOENT before even reaching the hash check. * build(nix): update fetchPnpmDeps hash for the merged lockfile Reported by the nix-build CI on #5079 after patches/ entered the src fileset. * build(nix): include tsconfig.base.json in the nix src fileset The desktop renderer's tsconfig extends ../../tsconfig.base.json, and vite resolves it while building the web variant inside the nix sandbox (via sync-web-dist). The file came from the code-app import and was not in the fileset. * chore: bring over code-app's pending changesets and rewrite the release skills (#5081) 31 unconsumed changesets from code-app's desktop-opensource (26 at the snapshot point plus 5 added by later main merges), covering every user-facing desktop change since v1.3.7. Entries are translated to English per this repo's changeset conventions, with overlong ones condensed. code-app's release-plan.json is intentionally not carried: every consumer reads it gated on the branch name, so the stale plan would be inert on any new release branch. gen-changesets is rewritten for the three-product world: the CLI, desktop, and the VS Code extension are user-facing products whose changesets feed release notes, update dialogs, and marketplaces; library source changes always get a library changeset, and changes that flow into a product user-perceivably get a product entry too. sync-changelog now covers two flows: Flow A syncs the CLI changelog into the docs site (unchanged rules), and Flow B prepares the desktop update-dialog bilingual notes under release-notes/<version> from apps/desktop/CHANGELOG.md — curated from English entries and translated into Chinese, with hard length limits (15 words / 40 characters / 10 entries) and a review-before-commit gate. pre-changelog previews both Chinese surfaces before a release PR merges, and locates the version PR by its release/* base branch. * chore: rename dev:desktop:canary to dev:desktop-canary * fix: run the web-variant build through a shell on Windows Node cannot execute pnpm.cmd directly via spawnSync on Windows; the sync script now goes through the shell there, unblocking pnpm build on Windows machines and the Windows legs of the native-assets workflow. Also bring the root guide's web UI entry up to date with the imported reality: the source is the desktop renderer, dist-web is a build-time artifact, and pnpm dev:web / sync:web are the in-repo commands. (--no-verify: lint-staged's oxlint step fails with 'No files found to lint' for paths under its ignorePatterns, such as apps/*/scripts/; check-comments and node --check pass.) * docs: dedupe the gen-changesets rules after the main merge The conflict resolution re-inserted the product/library bullets that were shared context after the conflict block. * docs: rewrite the gen-changesets section 1 bullet list cleanly The previous dedupe commit made the duplication worse; the section is now rewritten as a whole: product, library, public KAP, flows-into- product, ignored packages, ask-when-unsure.
需求或 Bug
code-app 并入本仓的迁移 PR-2.2(堆叠于 PR-2.1):CLI 内置 Web UI 的产物
apps/kimi-code/dist-web从「提交入库的预构建 bundle」改为「构建期从 desktop renderer 的 web 变体现构」,跨仓 web 同步链就此退役;同时删除.commentignore中为旧 committed bundle 存在的豁免条目。Bug 复现步骤
N/A
根本原因
N/A
代码变更
CI test 分片(干净 checkout、无 dist-web)不受影响:引用 dist-web 的 3 个测试文件均用临时目录 fixture 或只断言路径字符串。
影响范围
pnpm build/ CI build job / native 打包 / nix 均自动携带。--no-verify:lint-staged 的 oxlint 步骤对「全是删除的暂存集」报 No files found(工具限制),门禁均已手动跑绿,commit message 已注明。Checklist
changesetskill,或本 PR 无需 changeset。(无用户可感知变化)