From 2a9364d4512c4f227496e7162e5a774caf1ff27d Mon Sep 17 00:00:00 2001 From: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com> Date: Thu, 10 Sep 2026 13:30:27 -0300 Subject: [PATCH 1/2] chore(electron): prune the root-level files of every translated docs mirror MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The desktop runtime reads exactly one slice of docs/i18n: the translated docs/** tree, through the in-app docs route (src/lib/docsI18nPath.ts pins the path). Each locale's root-level mirrors — README.md, llm.txt, CLAUDE.md, GEMINI.md, CONTRIBUTING.md, SECURITY.md, CODE_OF_CONDUCT.md — exist for GitHub readers and are never opened by the packaged app, so they leave the bundle together with the translated CHANGELOG that was already pruned. Measured on release/v3.8.51 with 51 locales: docs/i18n is 139 MB, of which 25.7 MB is the served docs/** tree (kept), 103.5 MB the CHANGELOG mirrors (already pruned) and 11.4 MB these root files (pruned now). The plan's D4 called for dropping docs/i18n entirely; that would have broken localized docs inside the app, which is why the served subtree stays. --- .../0000-electron-prune-locale-root-mirrors.md | 1 + scripts/build/electronRuntimeDocs.mjs | 18 +++++++++++++++++- tests/unit/electron-packaging.test.ts | 13 ++++++++++++- 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 changelog.d/maintenance/0000-electron-prune-locale-root-mirrors.md diff --git a/changelog.d/maintenance/0000-electron-prune-locale-root-mirrors.md b/changelog.d/maintenance/0000-electron-prune-locale-root-mirrors.md new file mode 100644 index 000000000000..c8bd46e47b0f --- /dev/null +++ b/changelog.d/maintenance/0000-electron-prune-locale-root-mirrors.md @@ -0,0 +1 @@ +- **chore(electron):** the desktop bundle no longer ships the root-level files of every translated docs mirror (`README.md`, `llm.txt`, `CLAUDE.md`, `GEMINI.md`, `CONTRIBUTING.md`, `SECURITY.md`, `CODE_OF_CONDUCT.md`) — the packaged app only reads `docs/i18n//docs/**`, which stays. Saves ~11 MB on top of the translated CHANGELOGs already pruned. (#0000) diff --git a/scripts/build/electronRuntimeDocs.mjs b/scripts/build/electronRuntimeDocs.mjs index b9d5a8aa10b4..957664e85012 100644 --- a/scripts/build/electronRuntimeDocs.mjs +++ b/scripts/build/electronRuntimeDocs.mjs @@ -1,8 +1,24 @@ import { existsSync, lstatSync, readdirSync, rmSync } from "node:fs"; import { join, relative, resolve, sep } from "node:path"; +// The packaged app reads exactly one slice of the translated mirrors: +// `docs/i18n//docs/**`, through the in-app docs route (the path is +// pinned by src/lib/docsI18nPath.ts). Everything at a locale's root — the +// README, llm.txt and the agent/contributor guides — is authoring material +// mirrored for GitHub readers and never opened by the runtime, so it leaves +// the bundle together with the translated CHANGELOG (~115 MB across 51 +// locales, 103 MB of it CHANGELOG). The translated `docs/**` tree stays. export const ELECTRON_RUNTIME_DOC_PRUNE_RULES = Object.freeze({ - localeRootFiles: Object.freeze(["CHANGELOG.md"]), + localeRootFiles: Object.freeze([ + "CHANGELOG.md", + "CLAUDE.md", + "CODE_OF_CONDUCT.md", + "CONTRIBUTING.md", + "GEMINI.md", + "README.md", + "SECURITY.md", + "llm.txt", + ]), authoringDirectories: Object.freeze(["docs/research", "docs/superpowers"]), }); diff --git a/tests/unit/electron-packaging.test.ts b/tests/unit/electron-packaging.test.ts index cbddd60babd8..cfc4e22add36 100644 --- a/tests/unit/electron-packaging.test.ts +++ b/tests/unit/electron-packaging.test.ts @@ -73,6 +73,8 @@ test("electron docs manifest prunes authoring payloads without removing runtime ["docs/guides/CODEX-CLI-CONFIGURATION.md", "# Codex CLI"], ["docs/i18n/ko/docs/guides/ELECTRON_GUIDE.md", "# Electron"], ["docs/i18n/ko/CHANGELOG.md", "translated release history"], + ["docs/i18n/ko/README.md", "translated readme"], + ["docs/i18n/ko/llm.txt", "translated llm summary"], ["docs/i18n/fr/CHANGELOG.md", "historique traduit"], ["docs/research/desktop-notes.md", "authoring notes"], ["docs/superpowers/plans/desktop-plan.md", "implementation plan"], @@ -87,16 +89,23 @@ test("electron docs manifest prunes authoring payloads without removing runtime const result = pruneElectronRuntimeDocs(bundleRoot); + // Only `docs/i18n//docs/**` is read at runtime (the in-app docs + // route, see src/lib/docsI18nPath.ts); every root-level mirror of a locale + // is authoring material and leaves the bundle with the CHANGELOG. assert.deepEqual(result.removedPaths, [ "docs/i18n/fr/CHANGELOG.md", "docs/i18n/ko/CHANGELOG.md", + "docs/i18n/ko/README.md", + "docs/i18n/ko/llm.txt", "docs/research", "docs/superpowers", ]); - assert.equal(result.removedFiles, 4); + assert.equal(result.removedFiles, 6); assert.equal( result.removedBytes, Buffer.byteLength("translated release history") + + Buffer.byteLength("translated readme") + + Buffer.byteLength("translated llm summary") + Buffer.byteLength("historique traduit") + Buffer.byteLength("authoring notes") + Buffer.byteLength("implementation plan") @@ -106,6 +115,8 @@ test("electron docs manifest prunes authoring payloads without removing runtime assert.equal(existsSync(join(bundleRoot, "docs/guides/CODEX-CLI-CONFIGURATION.md")), true); assert.equal(existsSync(join(bundleRoot, "docs/i18n/ko/docs/guides/ELECTRON_GUIDE.md")), true); assert.equal(existsSync(join(bundleRoot, "docs/i18n/ko/CHANGELOG.md")), false); + assert.equal(existsSync(join(bundleRoot, "docs/i18n/ko/README.md")), false); + assert.equal(existsSync(join(bundleRoot, "docs/i18n/ko/llm.txt")), false); assert.equal(existsSync(join(bundleRoot, "docs/research")), false); assert.equal(existsSync(join(bundleRoot, "docs/superpowers")), false); From 3e56c46feb87d371fa44422c86079d30626fbc39 Mon Sep 17 00:00:00 2001 From: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com> Date: Thu, 10 Sep 2026 13:35:57 -0300 Subject: [PATCH 2/2] docs(changelog): point the PR-5 fragment at #13235 --- ...oot-mirrors.md => 13235-electron-prune-locale-root-mirrors.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename changelog.d/maintenance/{0000-electron-prune-locale-root-mirrors.md => 13235-electron-prune-locale-root-mirrors.md} (100%) diff --git a/changelog.d/maintenance/0000-electron-prune-locale-root-mirrors.md b/changelog.d/maintenance/13235-electron-prune-locale-root-mirrors.md similarity index 100% rename from changelog.d/maintenance/0000-electron-prune-locale-root-mirrors.md rename to changelog.d/maintenance/13235-electron-prune-locale-root-mirrors.md