From b1e0736e8eafad038407917bb66c47458d2fe7b4 Mon Sep 17 00:00:00 2001 From: znetsixe Date: Mon, 18 May 2026 21:31:23 +0200 Subject: [PATCH] docs: propagate folder-naming convention + bump submodules for editor refresh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Convention: * CLAUDE.md (root): new "Folder & File Layout (READ BEFORE CREATING NEW FILES)" section with required-name table and explicit legacy-drift list (mgc, vgc, dashboardapi). * .claude/rules/node-architecture.md: file-naming convention + src/editor/ module layout sections; serving recipe for //editor/:file. Submodule bumps: * generalFunctions: shared output-format picker, redesigned position SVGs, tighter asset wizard, restored curve preview size. * rotatingMachine: pump banner, circular state diagram, mode icon cards, picker integration, CLAUDE.md update. * 10 others: per-node CLAUDE.md "Folder & File Layout" sections — 3 of them (machineGroupControl, valveGroupControl, dashboardAPI) carry inline warnings about their entry-filename drift. Co-Authored-By: Claude Opus 4.7 (1M context) --- .claude/rules/node-architecture.md | 54 ++++++++++++++++++++++++++++++ CLAUDE.md | 29 ++++++++++++++-- nodes/dashboardAPI | 2 +- nodes/diffuser | 2 +- nodes/generalFunctions | 2 +- nodes/machineGroupControl | 2 +- nodes/measurement | 2 +- nodes/monster | 2 +- nodes/pumpingStation | 2 +- nodes/reactor | 2 +- nodes/rotatingMachine | 2 +- nodes/settler | 2 +- nodes/valve | 2 +- nodes/valveGroupControl | 2 +- 14 files changed, 93 insertions(+), 14 deletions(-) diff --git a/.claude/rules/node-architecture.md b/.claude/rules/node-architecture.md index 07f051e..563fe7b 100644 --- a/.claude/rules/node-architecture.md +++ b/.claude/rules/node-architecture.md @@ -23,9 +23,63 @@ Every node follows entry → nodeClass → specificClass: - Port 1: InfluxDB telemetry payload - Port 2: Registration/control plumbing (parent-child handshakes) +## File-Naming Convention +The folder name is the canonical node name and every per-node file MUST match it +exactly (case-sensitive). No abbreviations. + +| Path | Required name | +|---|---| +| Folder | `nodes//` | +| Entry file | `nodes//.js` | +| Editor HTML | `nodes//.html` | +| nodeClass | `nodes//src/nodeClass.js` | +| specificClass | `nodes//src/specificClass.js` | +| Editor JS modules | `nodes//src/editor/*.js` | + +`machineGroupControl/mgc.js`, `valveGroupControl/vgc.js`, and +`dashboardAPI/dashboardapi.js` are legacy drift. New nodes MUST use the full +folder name; legacy nodes get renamed when next touched (rename = update entry +file, HTML file, `package.json#node-red.nodes`, and any test imports in one +commit). + +## Editor JS Layout — `src/editor/` +Editor-side JavaScript that exceeds a couple of dozen lines lives in modular +files under `nodes//src/editor/`, served by the entry file via: + +```js +const path = require('path'); +RED.httpAdmin.get(`/${nameOfNode}/editor/:file`, (req, res) => { + const safe = String(req.params.file || '').replace(/[^a-zA-Z0-9._-]/g, ''); + if (!safe.endsWith('.js')) return res.status(400).send('// invalid'); + res.type('application/javascript'); + res.sendFile(path.join(__dirname, 'src', 'editor', safe), (err) => { + if (err && !res.headersSent) res.status(404).send('// editor module not found'); + }); +}); +``` + +The HTML file then loads them as plain `