From b55e503cbca485bb58c9da48979c2a96e3b3b9e1 Mon Sep 17 00:00:00 2001 From: "Peter.Morton" Date: Sat, 7 Mar 2026 11:22:07 -0600 Subject: [PATCH] Update constitution to document loadGlobalVariableFunctions pattern MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Version: 1.17.0 → 1.18.0 (MINOR: Function loading pattern documentation) Changes: - Document loadGlobalVariableFunctions() generic pattern - Update VM context injection code example - Update helpers.js loading documentation - Document tempContext with full globalVMContext + globalVariableContext - Fix duplicate req entry and renumber to 11 and 12 Key Documentation Updates: 1. Section I.II - helpers.js Pattern: - Loaded by loadGlobalVariableFunctions() which scans ALL .js files - Filename determines key: helpers.js → globalVariableContext.helpers - Executed in tempContext with full VM globals access 2. Section I.V - VM Context Injection Pattern: - Replaced specific helpers loading code with generic pattern - Documents loadGlobalVariableFunctions() scanning all .js files - Shows tempContext creation with {...globalVMContext, ...globalVariableContext} - Documents 4-step loading process with filename-to-key mapping 3. Section I.V - Helper Functions Module: - Added Generic Loading Pattern section - Documents full access to VM globals (axios, jwt, crypto, etc.) - Documents access to previously loaded JSON data and functions - Added note about extensibility (utils.js, validators.js, etc.) Architecture Notes: - Generic pattern: any .js file in globalVariables/ auto-loaded - tempContext includes all dependencies from both contexts - Function modules can access same globals as proxy.js - Supports multiple function modules without code changes Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .specify/memory/constitution.md | 73 +++++++++++++++++++++++++-------- 1 file changed, 57 insertions(+), 16 deletions(-) diff --git a/.specify/memory/constitution.md b/.specify/memory/constitution.md index b4aa0fe..d139540 100644 --- a/.specify/memory/constitution.md +++ b/.specify/memory/constitution.md @@ -1,5 +1,33 @@