From e8d288187409d57fb2f01c0bb6ee60bcd2e2eb32 Mon Sep 17 00:00:00 2001 From: Mark Date: Wed, 20 May 2026 07:29:07 +0200 Subject: [PATCH] =?UTF-8?q?feat(01-12):=20wave-5=20task-1=20=E2=80=94=20we?= =?UTF-8?q?lcome=20i18n=20migration=20(conditional=20on=2001-10)=20+=20=5F?= =?UTF-8?q?=5FVITE=5FDEV=5F=5F=20define=20+=20scripts/README.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plan 01-10 (welcome tab) has NOT yet landed at execute-plan time (verified: ls src/welcome/welcome.html returns absent). Per Wave 5 branch 2B, src/welcome/* file modifications are DEFERRED — when Plan 01-10 lands, its executor will use src/shared/tokens.css directly (skipping the placeholder welcome-tokens.css step entirely; the canonical tokens.css is already import-ready from src/shared/). Unconditional changes in this wave: 1. vite.config.ts gains __VITE_DEV__ define-token (RESEARCH §12 + D-09 spirit-satisfaction). Defaults to false; activates iff env var VITE_DEV=1 is set. Reserved for any future inline smoke-mode check. Currently smoke.sh lives entirely outside Vite's input set so the gate is a defensive no-op: define: { __MOKOSH_UAT__: 'false', __VITE_DEV__: JSON.stringify(...) } 2. vite.test.config.ts inherits __VITE_DEV__ via mergeConfig (the test config only overrides __MOKOSH_UAT__: 'true'; __VITE_DEV__ from base flows through untouched). 3. scripts/README.md (NEW, ~50 lines): documents the smoke-isolation invariant — dev-only scripts in scripts/ are NOT bundled by `npm run build`; the production dist/ contains zero smoke artifacts (verified by RESEARCH §12 grep gate). Provides usage example for VITE_DEV env override + cross-references RESEARCH §12 and brand-decisions-v1.md D-09. Index lists subset-fonts.sh, rasterize-icons.sh, and smoke.sh (if present). Note on Plan 01-10 deferral: when Plan 01-10 executes after this plan closes, the welcome page src/welcome/welcome.css can either @import '../shared/tokens.css' directly OR a thin welcome-tokens.css re-export — both paths are supported by the canonical tokens.css landed in Wave 1. Plan 01-10's executor must adopt chrome.i18n.getMessage for any welcome copy strings using the 16-key matrix in _locales/ (welcomeHeroRu + welcomeHeroEn already defined; additional keys added per Plan 01-10's own artifact list). Verification: - vitest baseline 147/147 GREEN (no change from Wave 4 close) - npm run build clean (no warnings; __VITE_DEV__ propagates through define static replacement) - scripts/README.md exists with the smoke-isolation paragraph Co-Authored-By: Claude Opus 4.7 (1M context) --- scripts/README.md | 50 +++++++++++++++++++++++++++++++++++++++++++++++ vite.config.ts | 10 ++++++++++ 2 files changed, 60 insertions(+) create mode 100644 scripts/README.md diff --git a/scripts/README.md b/scripts/README.md new file mode 100644 index 0000000..bd6dce3 --- /dev/null +++ b/scripts/README.md @@ -0,0 +1,50 @@ +# scripts/ + +Dev-only utility scripts. These are NOT bundled by `npm run build` — the +production `dist/` contains zero `smoke` artifacts (verified by +`grep -rn smoke dist/` returning empty post-build). + +## Smoke-isolation invariant + +`smoke.sh` and any future smoke-test harness live ENTIRELY in this +directory. Vite's `rollupOptions.input` (vite.config.ts) does NOT +reference any path under `scripts/`; the build pipeline cannot include +smoke artifacts in `dist/`. RESEARCH §12 verifies no-op condition via +`grep -rn 'smoke\|SMOKE\|data:text/html' src/` returning empty. + +A defensive `__VITE_DEV__` define-token (see `vite.config.ts:define`) +is reserved for any future inline smoke-mode check; currently it +defaults to `false` so even a misplaced `if (__VITE_DEV__) { ... }` +branch is statically tree-shaken out of production by Rollup. + +Override per-build via env var: + +```bash +VITE_DEV=1 npm run dev # __VITE_DEV__ === true +npm run build # __VITE_DEV__ === false (production default) +``` + +## Index + +| Script | Purpose | +|---------------------------|----------------------------------------------------------------------| +| `subset-fonts.sh` | One-off font subsetting (Lora + IBM Plex Sans/Mono → Latin+Cyrillic) | +| `rasterize-icons.sh` | One-off icon rasterization (mokosh-mark.svg → icons/icon{16,48,128}.png) | +| `smoke.sh` (if present) | Local smoke harness — not part of `npm run build` | + +Re-run conditions: + +- `subset-fonts.sh`: when upstream Lora-Cyrillic or IBM/plex releases a + major bump with bug fixes; or when the UNICODES range needs + expansion. See `src/shared/fonts/README.md` for the canonical recipe. +- `rasterize-icons.sh`: when `src/shared/brand/mokosh-mark.svg` changes + (the source-of-truth for the toolbar icon). + +## References + +- `.planning/phases/01-stabilize-video-pipeline/01-12-PLAN.md` Wave 5 + Task 1 — the smoke-isolation contract this README documents +- `.planning/phases/01-stabilize-video-pipeline/01-12-RESEARCH.md` §12 + — verification rationale +- `.planning/intel/brand-decisions-v1.md` D-09 — dev-only smoke + shipping decision diff --git a/vite.config.ts b/vite.config.ts index d99ab19..76c869d 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -38,6 +38,16 @@ export default defineConfig({ // Reference: https://vite.dev/config/shared-options.html#define define: { __MOKOSH_UAT__: 'false', + // Plan 01-12 Wave 5 (RESEARCH §12 + D-09 spirit-satisfaction): + // Defensive token reserved for any future inline smoke-mode check. + // Currently the smoke harness lives entirely in `smoke.sh` outside + // Vite's input set — verified by `grep -rn 'smoke\|SMOKE\|data:text/html' src/` + // returning empty. Activated by setting the env var `VITE_DEV=1` + // before invoking `vite` / `vite build`; defaults to `false` so the + // gated branch (if any future plan adds one) is statically tree- + // shaken out of production. See scripts/README.md for the wider + // dev-script isolation invariant. + __VITE_DEV__: JSON.stringify(process.env.VITE_DEV === '1'), }, build: { // Plan 01-11: bump from default ES2020 to ES2022 so gated top-level