From 5d333646e746427beb45434eed52a848cc5f951d Mon Sep 17 00:00:00 2001 From: "Peter.Morton" Date: Sat, 7 Mar 2026 12:33:36 -0600 Subject: [PATCH] Update constitution: Document literal function body pattern (v1.20.0) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updated constitution.md to reflect the new loading pattern for global variables: Version: 1.19.0 → 1.20.0 (MINOR) Changes documented: 1. Section I.II: Updated googleDriveAdapterHelper.js pattern - Files contain LITERAL BODY of a function - Use bare 'return {...}' statement (NOT valid standalone JS) - server.js wraps code in IIFE: (function() { })() - Clear separation: file = content, server = wrapper 2. Section I.V: Updated loadGlobalVariables() pattern - Shows wrapping logic with code examples - Explains IIFE creation and execution - Documents context creation and object capture 3. Added comprehensive examples: - Example file structure showing literal function body - Example server.js wrapping logic with vm.Script - Shows how return statement exports object 4. Version history updated: - Documented architecture changes - Explained rationale for pattern - Listed benefits of approach Key pattern documented: ✅ .js files in globalVariables/ contain function bodies with return ✅ Files are NOT valid standalone JavaScript (intentional) ✅ server.js wraps them: '(function() { })()' ✅ Wrapping creates IIFE that executes and returns object ✅ Pattern applies to ALL .js files in globalVariables/ Benefits explained: - Clear separation of content vs execution wrapper - Explicit return statement documents exports - Wrapping logic centralized in server.js - Consistent pattern across all global variable functions - Files clearly show their purpose (function bodies) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .specify/memory/constitution.md | 85 +++++++++++++++++++++++++++++++-- 1 file changed, 82 insertions(+), 3 deletions(-) diff --git a/.specify/memory/constitution.md b/.specify/memory/constitution.md index b4e10c1..b170cea 100644 --- a/.specify/memory/constitution.md +++ b/.specify/memory/constitution.md @@ -1,5 +1,44 @@