Architecture: Where should locally-generated code be written — inside the ...

Documentation for Sessions

🏗️ Architecture: Where should locally-generated code be written — inside the ...

Date: 2026-03-11
Time: 19:38:22 UTC
Session: gspace1-204.15
Agent: architecture
Confidence: 93%
Status: ✅ Documented


📋 Decision Context

Question:

Where should locally-generated code be written — inside the monorepo (platforms/{space}/{universe}/) or an isolated directory?

Task: S204.19: Fix local generation output location


🎯 Decision Made

Chosen:

Option A: Write to ~/.gograb/generated/{spaceSlug}/{universeSlug}/ — completely outside the monorepo. Each generation gets its own standalone package.json, README, and the same file structure as GitLab (apps/ + modules/).

Options Considered:

  1. Write inside monorepo at platforms/{space}/{universe}/ (old, broken)
  2. Write to ~/.gograb/generated/ isolated directory (chosen)
  3. Write to /tmp/gograb-generated/ (ephemeral, lost on reboot)
  4. Rewrite imports to use @module/* aliases for monorepo integration (too complex)

💭 Reasoning

The old approach wrote into the monorepo under platforms/ and modules/, which caused 3 critical issues: (1) NX enforces npm-scope imports — relative paths like '../../../modules/structural/...' trigger build errors, (2) project.json had wrong sourceRoot paths since the file tree didn't match, (3) tsconfig includes pointed 2 levels up which doesn't resolve from the actual location. Generated code is designed for standalone deployment (GitLab repo), not monorepo embedding. Writing to ~/.gograb/ keeps the monorepo clean, avoids NX lint rules, and the output is immediately servable with cd ~/.gograb/generated/... && npm install && npm start.


📁 Files Involved


🔗 Related


Auto-generated by MCP Smart Consolidation