Repository navigation
chore: import code-app sources into the monorepo - #5074
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
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 650732a0f3
ℹ️ 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".
| @@ -76,6 +83,8 @@ | |||
| ./packages/session-import | |||
| ./packages/telemetry | |||
| ./packages/tree-sitter-bash | |||
| ./packages/vite-preset | |||
| ./apps/desktop | |||
There was a problem hiding this comment.
Regenerate the Nix pnpm dependency hash
Adding the desktop and application workspaces changes both the src and pnpmWorkspaces inputs to fetchPnpmDeps, and this commit also substantially changes pnpm-lock.yaml, but the fixed-output hash at flake.nix:176 remains unchanged from the parent. Consequently, every nix build will stop at the dependency derivation with a hash mismatch before building the CLI; update the hash in this commit rather than deferring it to a later stacked change.
Useful? React with 👍 / 👎.
|
|
||
| const root = fileURLToPath(new URL('./src/renderer', import.meta.url)); | ||
| const outDir = fileURLToPath(new URL('./desktop-dist', import.meta.url)); | ||
| const coreDir = fileURLToPath(new URL('../../kimi-code', import.meta.url)); |
There was a problem hiding this comment.
Point the renderer core reference at the monorepo checkout
For every desktop renderer build, resolving ../../kimi-code relative to apps/desktop/vite.renderer.config.ts produces <repo>/kimi-code, which does not exist; the relevant checkout is the monorepo root or apps/kimi-code. The resulting git failure is caught and converted to an empty value, so Settings silently displays - for the built-in server version, and the copied E2E uses the same stale path and masks the regression.
AGENTS.md reference: AGENTS.md:L131-L133
Useful? React with 👍 / 👎.
| return { version, sha, short: sha === '' ? '' : sha.slice(0, 8), built }; | ||
| })(); | ||
|
|
||
| const commitUrl = buildInfo.sha === '' ? '' : `https://github.com/MoonshotAI/kimi-code-app/commit/${buildInfo.sha}`; |
There was a problem hiding this comment.
Link debug builds to the monorepo commit
For builds made after this migration, __KIMI_COMMIT_SHA__ is obtained by running git rev-parse HEAD in the monorepo, but this diagnostic link still looks that SHA up in the old MoonshotAI/kimi-code-app repository. Clicking the build identifier therefore opens a missing or unrelated commit instead of the imported source's MoonshotAI/kimi-code commit.
AGENTS.md reference: AGENTS.md:L131-L133
Useful? React with 👍 / 👎.
| "package:macos": "bash apps/desktop/scripts/package-local-macos.sh", | ||
| "e2e:desktop": "pnpm --filter kimi-code-app run e2e", | ||
| "e2e:desktop:headless": "pnpm --filter kimi-code-app run e2e:headless", | ||
| "typecheck": "pnpm run build:packages && pnpm -r --filter './packages/*' run typecheck && pnpm --filter @moonshot-ai/kimi-code run typecheck && pnpm --filter kimi-code run typecheck && pnpm --filter @moonshot-ai/vis-server run typecheck && pnpm --filter @moonshot-ai/vis-web run typecheck && pnpm --filter kimi-code-app run typecheck", |
There was a problem hiding this comment.
Run the desktop Vue typecheck in CI
Although this command now includes kimi-code-app's typecheck, the checked CI workflow never invokes the root command: its typecheck job runs a custom tsc loop over packages/*/tsconfig.json and apps/kimi-code/tsconfig.json, then checks VS Code and vis only. On every PR, apps/desktop is therefore omitted and its required vue-tsc -p tsconfig.renderer.json pass never runs, allowing renderer type errors in the newly imported application to merge.
Useful? React with 👍 / 👎.
| "build:native:clamshell": "node native/clamshell-tool/build.mjs", | ||
| "build": "npm run build:native:screenshot && npm run build:native:clamshell && tsdown", | ||
| "build:renderer": "vite build --config vite.renderer.config.ts", | ||
| "build:web": "vite build --config vite.web.config.ts", |
There was a problem hiding this comment.
Update the project map for the imported web source
After adding the web build from apps/desktop, the root AGENTS.md still states that the browser UI source is absent from this repository and directs contributors to edit and sync it from the separate code-app checkout. Because contributors are required to follow that project map, future web work will be sent to the obsolete location instead of the newly imported source; update the map and build/sync instructions as part of this migration.
AGENTS.md reference: AGENTS.md:L18-L18
Useful? React with 👍 / 👎.
| patchedDependencies: | ||
| [email protected]: patches/[email protected] |
There was a problem hiding this comment.
Include the declared pnpm patch in the Nix source
This newly declared patched dependency points to patches/[email protected], but the explicit Nix src union at flake.nix:152-167 includes only root manifests and workspace paths, not the root patches/ directory. Even after regenerating the pnpm dependency hash, fetchPnpmDeps or pnpmConfigHook will be unable to read and apply the patch, so the Nix build remains broken until ./patches is added to the fileset.
Useful? React with 👍 / 👎.
| - run: pnpm run lint | ||
| - run: node --test 'scripts/checks/*.test.mjs' | ||
| - run: node --test scripts/check-comments.test.mjs | ||
| - run: node --test scripts/desktop-artifact-prefix.test.mjs scripts/canary-version.test.mjs scripts/canary-linux.test.mjs scripts/mac-update-minimum-system-version.test.mjs |
There was a problem hiding this comment.
Run all imported release tests in CI
This CI command runs only four of the newly imported root Node test files and omits scripts/release.test.mjs, scripts/canary-provider.test.mjs, and scripts/verify-macos-installers.test.mjs. The root Vitest configuration runs only its listed package and app projects, so those suites are not picked up by pnpm test; as a result, the stable release state machine, updater manifest selection, and fail-closed macOS installer verification can regress without any CI signal.
Useful? React with 👍 / 👎.
| @@ -0,0 +1,86 @@ | |||
| { | |||
| "name": "kimi-code-app", | |||
| "version": "1.3.7", | |||
There was a problem hiding this comment.
Teach the required changeset workflow to version desktop
This introduces kimi-code-app as a separately versioned release target, and the imported canary/release scripts derive its next version from Changesets, but the mandatory gen-changesets skill still says the CLI is the only user-facing package and directs user-visible changes to @moonshot-ai/kimi-code or no changeset. A future desktop-only fix will therefore receive no kimi-code-app version entry, leaving its release plan stale or making the desktop release calculation fail; update the skill to select this package for desktop behavior changes.
AGENTS.md reference: AGENTS.md:L94-L95
Useful? React with 👍 / 👎.
| }, | ||
|
|
||
| deb: { | ||
| ...(canary ? { packageName: 'kimi-code-canary' } : {}), |
There was a problem hiding this comment.
Give Linux Preview packages a distinct install identity
When KIMI_DESKTOP_PREVIEW=true, the DEB and RPM configuration still uses the stable package name because only Canary receives an override here; the same Preview build also keeps the stable kimi-code executable, kimi-code.desktop entry, and metainfo identifiers. Installing a Linux Preview package will therefore collide with or replace an installed Stable package instead of coexisting under the distinct Preview identity configured by appId and productName; add Preview-specific names across these Linux fields.
Useful? React with 👍 / 👎.
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).
8db9f14 to
d7b3164
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d7b316408a
ℹ️ 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".
| "dev:desktop:debug": "pnpm --filter kimi-code-app run dev -- --remote-debugging-port=9222", | ||
| "dev:desktop:canary": "KIMI_DESKTOP_CANARY=true pnpm --filter kimi-code-app run dev", | ||
| "dev:web": "pnpm --filter kimi-code-app run dev:web", | ||
| "build:web": "pnpm --filter kimi-code-app run build:web", |
There was a problem hiding this comment.
Send the web build to the CLI asset directory
When contributors use the newly added root pnpm build:web command, Vite writes the result to the ignored apps/desktop/web-dist directory, while kimi web, the asset guard, and native packaging continue to consume only the committed apps/kimi-code/dist-web bundle. The command therefore succeeds without changing the browser UI that users receive; wire this build to update or synchronize the CLI asset directory.
AGENTS.md reference: AGENTS.md:L18-L18
Useful? React with 👍 / 👎.
| "@moonshot-ai/app-i18n", | ||
| "@moonshot-ai/app-markdown", | ||
| "@moonshot-ai/app-ui", | ||
| "@moonshot-ai/app-client" |
There was a problem hiding this comment.
Exclude every imported internal package from Changesets
The ignore list adds most imported private packages but omits @moonshot-ai/app-components and @moonshot-ai/app-composer. Consequently, pnpm changeset exposes these two non-publishable implementation packages even though .changeset/README.md promises that only publishable packages appear, making future changesets prone to selecting or versioning internal desktop packages; add both omitted names alongside the other app-* entries.
Useful? React with 👍 / 👎.
| // Imported from code-app: legacy findings are grandfathered into the | ||
| // ratchet baseline (scripts/checks/baselines/oxlint-ratchet.json), which | ||
| // re-enables these rules for these paths and only lets the counts shrink. | ||
| "files": ["apps/desktop/**/*", "packages/app-*/**/*", "scripts/**/*.mjs"], |
There was a problem hiding this comment.
Include desktop scripts in the lint ratchet
For changes under apps/desktop/scripts, this override cannot provide the promised ratchet coverage because both oxlint configurations still ignore apps/*/scripts/ entirely. As a result, executable build, development, and signing scripts imported by this commit can accumulate violations of all these disabled rules without either the normal lint pass or scripts/checks/ratchet.mjs reporting them; remove or narrow that ignore for the desktop scripts, or lint them through a separate checked path.
AGENTS.md reference: AGENTS.md:L86-L88
Useful? React with 👍 / 👎.
) * 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: 99ccc194cc
ℹ️ 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".
| { | ||
| "name": "kimi-code-app", | ||
| "version": "1.3.7", | ||
| "private": true, |
There was a problem hiding this comment.
Enable Changesets versioning for the desktop app
When a changeset names kimi-code-app, this private: true declaration causes Changesets to skip its version unless .changeset/config.json opts into privatePackages.version; Changesets documents that private applications are not versioned by default. Consequently, version-release.mjs observes no desktop version delta, omits the app from release-plan.json, and the desktop release workflow exits with build=false, so desktop changes can never produce a stable release. Add privatePackages: { "version": true, "tag": false } to the config.
AGENTS.md reference: AGENTS.md:L79-L80
Useful? React with 👍 / 👎.
| on: | ||
| push: | ||
| branches: ['release/**'] | ||
| workflow_dispatch: |
There was a problem hiding this comment.
Restore the scheduled Canary trigger
For Canary users intended to receive scheduled builds, the workflow contains github.event_name == 'schedule' paths for the nightly guard, build matrix, versioning, and publication, but this trigger block declares only pushes, manual dispatches, and reusable calls. GitHub only creates timed runs when on.schedule is configured, so none of those scheduled Canary paths can ever execute; add the intended cron schedule.
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.1(共 4 个,堆叠合入):把 Kimi Code 桌面端与其客户端包以快照方式导入 monorepo(不含 git 历史),并打通本仓的工程门禁。源:
MoonshotAI/kimi-code-app的desktop-opensource分支,快照含开源清洗(#1368)与 main 最新产品提交(#1364 更新灰度上限移除、#1365 本地文件页批注、#1367 空 tooltip 修复)。本 PR 之后:桌面端 / Web UI 源码与 CLI / server / agent 同仓,kap-server 等引擎改动随 desktop 构建自动生效,不再需要 submodule bump。
Bug 复现步骤
N/A
根本原因
N/A
代码变更
核心思路:纯快照导入 + 最小适配,不改产品行为。
新增(快照导入) ├── apps/desktop # kimi-code-app:Electron 壳 + 唯一渲染层(含 web 构建变体) ├── packages/app-{client,components,composer,core,i18n,markdown,ui} ├── packages/vite-preset ├── patches/ # markstream-vue patch ├── scripts/ # icon-tools + desktop 发布脚本子集(canary/verify/merge 等) └── KIMI CODE LOGO/ release-notes/ tsconfig.base.json 明确不带(后续处理) ├── apps/rc-portal # 留在 code-app 随归档处置 ├── 全部 README 与 apps/desktop/docs/ # 文档体系不在本次迁移范围 ├── .agents/skills 的 changeset / release-notes # 本仓已有 write-pr,保留 ├── code-app 的 26 个未消费 changeset # 切换时带回,保证 CHANGELOG 连续 └── .changeset/release-plan.json # 其引用的 changeset 留在源仓;发布流会在下一条 release 分支重新生成 适配(本仓侧) ├── pnpm-workspace.yaml # +ssh2/zod overrides、markstream patch、shiki/linkedom 钉版、排除 canvas ├── package.json # +dev:desktop / build:web 等命令,typecheck 聚合 ├── vitest.config.ts # projects +apps/desktop(packages/* 自动覆盖 app 包) ├── .oxlintrc.json # +desktop e2e jsPlugin;存量 finding 走 ratchet 豁免(见下) ├── .changeset/config.json # ignore +app 包 ├── flake.nix # workspacePaths/Names 登记 9 个新成员 ├── apps/desktop 内 4 处 # ../../kimi-code/... 子模块路径 → 仓内相对路径 ├── CI typecheck job # 循环跳过 source-only 的 packages/app-*,新增 desktop typecheck 步骤 └── 公开前审计清洗 # release_branch_kind.py 的内部 wiki 引用、签名脚本的 GitLab CI 措辞关键决策:
apps/desktop、packages/app-*、scripts/**/*.mjs关闭这些规则,ratchet 配置同路径重新启用并冻结基线(3732 条)check-comments --fix清除(401 条 / 59 文件,AST 等价校验)codeToTokens返回结构,Bash 工具高亮失效-i忽略影响范围
packages/引擎包源码。pnpm build:web产物无 @XTerm / qrcode;发布脚本测试 29 例并接入 ci.yml。fetchPnpmDepshash 待 desktop-opensource → main 的 PR 上由 CI 报值更新(本机无 nix;nix-build 不触发于本 PR 的目标分支)。Checklist
changesetskill,或本 PR 无需 changeset。(导入的包均 private/ignored,无用户可感知变化)