Files
google-drive-content-adapter/.specify/memory
Peter.Morton 5d333646e7 Update constitution: Document literal function body pattern (v1.20.0)
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() { <code> })()
   - 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() { <code> })()'
 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>
2026-03-07 12:33:36 -06:00
..