Mod Editor for REDnode
Mod Editor for REDnode is an optional app pack (packs/mod-editor, released on its own Nexus page) for writing REDnode mods inside the game: a code editor for a mod’s page and its Node mod, with save to run, the debugger a button away, and REDnode’s and the game’s APIs searchable beside it, with completion as you type. Asked for by the owner on 2026-11-30, to release with the Proton Tools pack.
Status: ME1 passed in game on 2026-11-30 (laptop, REDnode 0.80.0, Mod Editor 0.1.0, all 9 steps). ME2 to ME4 are planned.
Plan (agreed with the owner on 2026-11-30)
What it reuses
| Need | Already in REDnode |
|---|---|
| The editor | The UI Workbench’s CodeMirror 6 bundle (JavaScript, HTML, lint, completion) and acorn, from tools/ui-tools/build-editor.mjs |
| Run | Hot reload: a saved file restarts the mod, and a page reloads |
| Debug | A mod’s Debug switch (Node’s DevTools on its worker) and the window debugger (Chromium’s DevTools for a page), from O9 |
| The player’s own mods | Development folders (#16): a copy there wins over the installed one, marked DEV in the Mod Manager. admin.projectsFolder makes and watches one under Documents\REDnode |
| The Edit button | Roles (#20): a package that says "provides": ["mod-editor"] and exports edit from its service file answers the Mod Manager’s Edit. Any editor can provide the role |
| Game API data | game.d.ts, generated from gameapi/2.5/rtti.json, with gameapi/notes, as the MCP tool gameapi_lookup reads them (packages/overlay/gameapi-lookup.js) |
| rednode API data | The rednode package’s TSDoc, in its built .d.ts files |
The pack
| Name | Mod Editor for REDnode (the owner’s naming: the mod’s name first, REDnode for search) |
| Id | mod-editor, in packs/mod-editor |
| Apps | Mod Editor (mod-editor) and API Docs (api-docs) |
| Permission | admin, as the UI Workbench has: it changes other packages’ files and restarts them |
| Needs | REDnode 0.80.0 or later (the host parts below) |
| Release | "unreleased": true until its tests pass; released in the same run as Proton Tools, on its own Nexus page (the owner makes it) |
Phases
Each phase stops for an in-game test.
| Phase | What it builds |
|---|---|
| ME1 Editor | A resizable window: the mod’s file tree, editor tabs and a log panel. Opens .html, .js, .mjs, .css, .json and rednode-app.json. Save writes the file, and hot reload runs it. New mod from templates (page app, Node mod, ui builder window, HUD widget, service), in Documents\REDnode\Mods. Syntax errors underlined as you type (acorn). In REDnode: the Mod Manager’s Edit through the mod-editor role, and the host calls the editor needs (restart a package, its Debug switch, open its debugger, its log lines) |
| ME2 API Docs | A window that searches the game API (classes, functions, enums, with REDnode’s notes) and the rednode API (every export with its doc comment and example). A hit shows its signature, notes and a link to the full page on the docs site. F1 on a word in the editor opens it there |
| ME3 Completion | Completion and hover docs from an index built at pack build time: the rednode exports (world. then spawn, load, …), api.<Class>. members, game class and enum names, rednode-app.json fields and permissions |
| ME4 Polish and release | This page as the pack’s guide, the example page, the Nexus page text and brand images, fixes from the tests. (The Debug and Inspect page buttons and the mod’s own log, planned here, came in ME1, since the host calls were there.) |
Decisions
| # | Question | Decided |
|---|---|---|
| 1 | Editing an installed mod, whose files may be hardlinks into EDGEdeck’s library or be overwritten by its next Nexus update | Edit on an installed mod first copies it to Documents\REDnode\Mods\<id> (a development folder), and the copy wins. A mod already in a development folder is edited in place |
| 2 | How smart completion is | A built index (ME3). TypeScript’s language service (about 20 MB with the game’s types) later, only if the index falls short |
| 3 | API docs: a tab or a window | Its own window, also opened with F1 from the editor |
| 4 | Permission | admin |
| 5 | Name | Mod Editor for REDnode |
ME1: built
Built on 2026-11-30 in REDnode 0.80.0 with Mod Editor 0.1.0 (pack 0.1.0, unreleased).
| Part | Where | What |
|---|---|---|
| Edit in the Mod Manager | editPackage, editorName, rednode:apps:edit in main.js; editWith in appList; the Mod Manager’s details (manager/app.js) |
Shown for every package not built into REDnode when one installed package provides mod-editor (several: the player’s choice under Provides). The host switches the editor on if it is off, or brings its window to the front, and calls its service’s edit({ id, name, version, dir, dev, kind }) as REDnode |
| Admin calls | rednode:tasks:packages, :debug, :inspect, :log in main.js; preload.js; admin.packages(), setDebug, inspect, log, onLog in packages/rednode/src/admin.ts |
For packages the player allowed admin. The log: the newest 500 lines, and new lines as { event: "mod-log" } once a page asks (watchLog) |
| Restart reloads a page | rednode:tasks:restart |
admin.restartTask also reloads the package’s open window, so Save runs a page app’s change with hot reload off (players’ default) |
| The editor | packs/mod-editor/apps/mod-editor: index.html, app.js |
A resizable window (1280 x 780, 760 x 420 at the least): the package list (development copies first), New mod, Save (Ctrl+S), Save all (Ctrl+Shift+S), Run, Stop, Debug, Inspect page; the file tree with New file, Rename, Delete; tabs; the log, live, with a splitter. CodeMirror 6 with JavaScript, HTML, CSS and JSON, the bundle shared with the UI Workbench (tools/ui-tools/build-editor.mjs now writes both, and adds CSS). Errors as you type: acorn for JavaScript, JSON.parse for JSON |
| Its files | service.mjs |
edit, takeEdit, tree, read, write, trash, rename, templates, create, copyToMods. Only the editor’s own page, or REDnode, may call them. Writes only in a development copy, through a temp file; a file never outside its package; deleted files go to the Mods folder’s .trash |
| New mod | templates.mjs |
Page app, Node mod, HUD widget, service; each a working package with "open": true, made in Documents\REDnode\Mods\<id> (written beside it, then moved in whole) |
Checked in the mock game (scratchpad me1/run.sh, 24 checks, dev host): Edit offered and answered; the copy asked for and made, the installed files untouched; the tree and the main file; Save writes and the mod restarts with the change (its log line in the editor’s log); a syntax error named; ✕ asks with unsaved changes; Debug opens the mod’s debugger; New mod makes, finds and runs a page app; another package’s call of the editor’s files refused.
ME1 test
REDnode 0.80.0 and the pack’s Mod Editor (copied by hand into the game’s apps folder, since the pack is not in the player zip), in a loaded save.
- F10. In the Mod Manager, select Mod Editor, allow its admin permission, and switch it on. Expect: its window opens, and its status line names the Mods folder,
Documents\REDnode\Mods. - In the Mod Manager, select Hello mod (or any mod of yours that is installed). Expect: an Edit button with “in Mod Editor”. Press it. Expect: the Mod Editor comes to the front and asks to copy Hello mod to the Mods folder.
- Press Copy and edit. Expect: the line under the toolbar says “Development copy” with the Mods folder’s path,
mod.mjsis open, and the Mod Manager shows Hello mod with DEV. - In
mod.mjs, changeconst VERSION = 'first version';to'second version'and press Ctrl+S. Expect: the status says the mod restarted with the change, and Hello mod’s window shows “Mod code: second version”. - Type
const = ;on a new line. Expect: a red wavy line there, and “mod.mjs line N: Unexpected token” under the log’s head. Delete it again and save. - Press New mod, choose Page app, name it
My first mod, press Make it. Expect: a “My first mod” window opens in the game, the editor shows itsindex.html, and Run and Stop switch it on and off. - Open
app.jsof My first mod, change “Where is V?” handling or any text inindex.html, press Ctrl+S. Expect: its window reloads with the change. - In the Mod Editor, open Hello mod again from its list and press the Mod Editor’s own Debug button, at the top right of its toolbar (not the Mod Manager’s Debug switch, which only turns Debug on). Expect: the status line counts while the mod restarts, then the Node debugger opens in the game by itself. Press Debug off in the Mod Editor: the debugger closes and the mod runs as before.
- Make a change, don’t save, and press the Mod Editor’s ✕. Expect: it asks first; Keep editing keeps it open.
After the test, delete Documents\REDnode\Mods\hello-mod (or keep it: it runs instead of the installed Hello mod until it is deleted).
Notes: the Mod Editor with the UI Workbench (not planned)
Raised by the owner on 2026-11-30: is there a preview, and should the Mod Editor and the UI Workbench work together? The owner agrees in principle but wants to use both tools in the game first, so nothing here is planned yet and it may change after that.
- Preview: none is needed. A saved change runs at once and the mod’s own window, HUD widget or ink panel shows on screen beside the editor, drawn by the game. A simulated preview, like the docs site’s, would only copy that worse in the game; it might suit editing outside the game later (REDcode).
- Two tools, linked, not merged: each pack works alone, and the links show only when both are installed.
- The UI Workbench keeps what only it does: Inspect, Pick, To source, Try.
- It hands writing to the Mod Editor: To source and New project open in it, and each project gets Open in Mod Editor, through the
mod-editorrole (a host call foradminpackages, like the Mod Manager’s Edit). Its own Edit tab would retire once the Mod Editor covers it, so no file has two editors.
- The Mod Editor learns ink markup:
ink.checkandink.markupTagsfor.ink.htmlfiles, as the Workbench has, and a Native UI panel template in New mod (the Workbench’s starter project). - Pick to the line: a widget picked in the game that the player’s own mod drew opens its
.ink.htmlat the line that made it. Unverified: whether the markup reader can keep line numbers through to the drawn widgets. - Layout helps instead of a preview pane: Side by side (the editor snaps to the left of the screen) and Peek (a key hides the editor until pressed again).
If taken up, this would be a phase ME5, before the first release or as an update after it, with small changes to the UI Workbench in the UI Tools pack.