--- name: sgs-framework-development description: Develop and verify SGS Framework Core, plugin manifests, plugin settings, Laya runtime events, hot reload, and the public manual. --- # SGS Framework Development ## Scope Use this skill for files under `framework/`. The runtime is a zero-build browser framework loaded by `download.mjs` before Laya starts. `core.mjs` and every plugin must remain directly downloadable JavaScript. ## Required Reads Read these files before changing the related surface: - `memory/framework-contract.md` for Core, plugin, storage, update, and UI contracts. - `memory/runtime-evidence.md` for battle, window, log, and Laya evidence boundaries. - `plugin/index.json` for the official catalog shape. ## Runtime Rules - Keep `window.SgsFramework` and `window.__SgsFramework` as the public globals. - A replacement Core must call the previous Core's `dispose("framework-replaced")` before publishing itself. - Every hook, timer, DOM node, listener, and plugin action must have a disposer. - Plugins declare permissions for disclosure. Core reports them to the user but does not reject a plugin solely because of a permission. - Plugin code is not sandboxed. Show the manifest, description, source URL, version, and permissions before first installation. - Persist plugin data only through the plugin-scoped storage/config APIs. Core owns the real LocalStorage prefix. - Do not use hidden opponent hand cards as tracker facts. - Do not use screenshots or OCR as runtime data. ## Verification - Run `node --check` for every changed `.mjs` file. - Run a mocked browser lifecycle check for Core replacement, plugin load/unload, storage, and update selection. - Verify UI in a browser at desktop and narrow/mobile viewport sizes. - Verify the synced public files from `https://sgs.senrax.com/script/` after local checks pass. - Keep the Windows watcher disabled; synchronize with `sync-framework-to-oracle.ps1 -Once` after a completed local change set.