From 950e3483573e458cc2aa7bc255d9590808947faa Mon Sep 17 00:00:00 2001 From: Byron Gamatos Date: Wed, 8 Jul 2026 10:14:40 +0200 Subject: [PATCH] R0: module-migration rails (src/ serving, live-edit cache, scriptType loading, governance) (#812) Host enablement for the plugin ES-module migration: sandboxed /api/plugins/{id}/src/ serving, no-cache+weak-ETag/304 live-edit caching on src/+screen.js+assets, scriptType:module loader injection + scriptType/minHost manifest passthrough; constitution v1.2.0 + module playbook + signed size-exemptions register + maintainer/CI-only ESLint gate; rerunnable perf-baseline harness. Reviewed by Codex (local), Copilot, and CodeRabbit. --- .github/workflows/ci.yml | 25 + .specify/memory/constitution.md | 30 +- CHANGELOG.md | 3 + CLAUDE.md | 2 + docs/perf-baseline.md | 67 + docs/plugin-modules.md | 103 ++ docs/size-exemptions.md | 62 + eslint.config.js | 66 + package-lock.json | 1759 +++++++++++++++++++- package.json | 7 +- plugins/__init__.py | 114 +- scripts/perf-baseline.mjs | 94 ++ static/app.js | 8 + tests/js/plugin_loader_script_type.test.js | 59 + tests/test_plugin_src_route.py | 140 ++ 15 files changed, 2520 insertions(+), 19 deletions(-) create mode 100644 docs/perf-baseline.md create mode 100644 docs/plugin-modules.md create mode 100644 docs/size-exemptions.md create mode 100644 eslint.config.js create mode 100644 scripts/perf-baseline.mjs create mode 100644 tests/js/plugin_loader_script_type.test.js create mode 100644 tests/test_plugin_src_route.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 55d618f..5190973 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -123,3 +123,28 @@ jobs: sys.exit(1) print(f"Validated {len(manifests)} manifest(s) — OK") EOF + + lint: + # Maintainer/CI-only size + module-hygiene gate (constitution Principle I: + # dev tooling, never on the serve/Docker path — same category as + # scripts/build-tailwind.sh). max-lines WARNS (the 1,500-line size ratchet; + # non-blocking), while import-x/no-unresolved + no-cycle HARD-ERROR on the + # ES-module graphs the refactor produces. Exemptions: docs/size-exemptions.md. + name: lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + # npm ci runs third-party postinstall scripts; don't leave the token in + # git config for them (this job never pushes). + with: + persist-credentials: false + + - uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install dependencies + run: npm ci + + - name: ESLint (size norm + module hygiene) + run: npm run lint diff --git a/.specify/memory/constitution.md b/.specify/memory/constitution.md index db3b68f..0930772 100644 --- a/.specify/memory/constitution.md +++ b/.specify/memory/constitution.md @@ -48,11 +48,30 @@ output is committed, so Docker / desktop / end users never build. New features extend `app.js` and the existing globals (`window.playSong`, `window.showScreen`, `window.createHighway`, `window.feedBack`). +Native ES modules are a first-class, build-free extension mechanism. +Because `