diff --git a/PRD.md b/PRD.md index 53a28a033..d47c4d679 100644 --- a/PRD.md +++ b/PRD.md @@ -1,12 +1,13 @@ -# PRD: MetaBuilder Multi-Tenant Architecture with Super God Level +# PRD: MetaBuilder Multi-Tenant Architecture with Super God Level & Nerd Mode IDE ## Mission Statement -Elevate MetaBuilder to support multi-tenant architecture with a Super God level (Level 5) that enables supreme administrators to manage multiple tenant instances, assign custom homepages to different god users, and transfer supreme power while maintaining system-wide control and preventing conflicts over homepage ownership. +Elevate MetaBuilder to support multi-tenant architecture with a Super God level (Level 5) that enables supreme administrators to manage multiple tenant instances, assign custom homepages to different god users, and transfer supreme power while maintaining system-wide control and preventing conflicts over homepage ownership. Additionally, provide advanced developers with a powerful Nerd Mode IDE for direct code access, version control integration, and professional debugging tools. ## Experience Qualities 1. **Hierarchical** - Clear power structure with Super God at the apex, preventing homepage conflicts between god-level users through tenant-based isolation 2. **Controlled** - Power transfer mechanism ensures only one Super God exists, with explicit downgrade and upgrade paths that maintain system integrity 3. **Flexible** - Multi-tenant architecture allows multiple god users to operate independently with their own homepage configurations +4. **Professional** - Nerd Mode provides advanced developers with full IDE capabilities for fine-grained control and professional workflows ## Complexity Level **Complex Application** (advanced functionality with multiple views) - This extends the existing 4-level meta-framework with a 5th supreme administrator level, adding multi-tenant management, power transfer workflows, tenant-specific homepage configuration, and cross-level preview capabilities for all user roles. @@ -122,7 +123,33 @@ Elevate MetaBuilder to support multi-tenant architecture with a Super God level - Import/Export accessible from Package Manager - Visual feedback during import/export operations -### 9. CSS Class Builder +### 9. Nerd Mode IDE +**Functionality:** Toggleable full-featured web IDE with virtual file tree, Monaco code editor, GitHub/GitLab integration, test runner, and debugging console +**Purpose:** Provide advanced developers with professional development tools for direct code access, version control, and comprehensive testing workflows while maintaining the visual builder for rapid prototyping +**Trigger:** God or Super God user clicks "Nerd" button in Level 4 or Level 5 toolbar +**Progression:** Click Nerd button → Toggle activates IDE panel → Virtual file explorer appears → Select file → Edit code in Monaco editor → Configure Git integration → Push/pull changes → Run tests → Debug in console → Toggle off to hide +**Success Criteria:** +- Nerd Mode toggle button visible in Level 4 (God) and Level 5 (Super God) toolbars +- State persists between sessions using KV storage +- Fixed position panel in bottom-right corner (600px height, max 1400px width) +- Virtual file tree with folder expansion/collapse +- File CRUD operations (create, edit, save, delete files and folders) +- Monaco editor with syntax highlighting for TypeScript, JavaScript, Lua, JSON, HTML, CSS, Python, Markdown +- Tabbed interface for Editor, Console, Tests, and Git views +- Console output panel with command history +- Test runner with mock test execution and visual results (pass/fail/duration) +- Git integration dialog for configuring GitHub/GitLab credentials +- Push/Pull operations with commit message input +- Repository URL, branch, and access token configuration +- File language detection from extension +- Run code button executes selected file +- Visual terminal-style console output +- Delete file confirmation +- Toast notifications for all operations +- Responsive layout adapts to available space +- Z-index ensures IDE floats above other content + +### 10. CSS Class Builder **Functionality:** Visual selector for Tailwind CSS classes organized into logical categories **Purpose:** Eliminate the need to memorize or type CSS class names, reducing errors and speeding up styling **Trigger:** User clicks palette icon next to any className field in PropertyInspector @@ -133,7 +160,7 @@ Elevate MetaBuilder to support multi-tenant architecture with a Super God level - 200+ predefined classes organized into 10 categories - Custom class input available for edge cases -### 10. Dynamic Dropdown Configuration +### 11. Dynamic Dropdown Configuration **Functionality:** Centralized management of dropdown option sets usable across multiple components **Purpose:** Prevent duplication and ensure consistency when the same options appear in multiple places **Trigger:** User navigates to "Dropdowns" tab in god-tier panel or components reference dropdown by name @@ -144,7 +171,7 @@ Elevate MetaBuilder to support multi-tenant architecture with a Super God level - Visual GUI for managing options (no JSON required) - Pre-loaded with common examples (status, priority, category) -### 11. CSS Class Library Manager +### 12. CSS Class Library Manager **Functionality:** Manage the catalog of CSS classes available in the builder **Purpose:** Allow customization of available classes and organization for project-specific needs **Trigger:** User navigates to "CSS Classes" tab in god-tier panel @@ -155,7 +182,7 @@ Elevate MetaBuilder to support multi-tenant architecture with a Super God level - Changes immediately reflected in CSS Class Builder - System initializes with comprehensive Tailwind utilities -### 12. Monaco Code Editor Integration +### 13. Monaco Code Editor Integration **Functionality:** Professional-grade code editor for JSON and Lua with syntax highlighting and validation **Purpose:** When code editing is necessary, provide best-in-class tooling comparable to VS Code **Trigger:** User opens SchemaEditor, LuaEditor, or JsonEditor components diff --git a/src/components/Level4.tsx b/src/components/Level4.tsx index b5f342c9e..960445b5f 100644 --- a/src/components/Level4.tsx +++ b/src/components/Level4.tsx @@ -8,7 +8,7 @@ import { DropdownMenuItem, DropdownMenuTrigger, } from '@/components/ui/dropdown-menu' -import { SignOut, Database as DatabaseIcon, Lightning, Code, Eye, House, Download, Upload, BookOpen, HardDrives, MapTrifold, Tree, Users, Gear, Palette, ListDashes, Sparkle, Package } from '@phosphor-icons/react' +import { SignOut, Database as DatabaseIcon, Lightning, Code, Eye, House, Download, Upload, BookOpen, HardDrives, MapTrifold, Tree, Users, Gear, Palette, ListDashes, Sparkle, Package, Terminal } from '@phosphor-icons/react' import { toast } from 'sonner' import { SchemaEditorLevel4 } from './SchemaEditorLevel4' import { WorkflowEditor } from './WorkflowEditor' @@ -23,10 +23,12 @@ import { CssClassManager } from './CssClassManager' import { DropdownConfigManager } from './DropdownConfigManager' import { QuickGuide } from './QuickGuide' import { PackageManager } from './PackageManager' +import { NerdModeIDE } from './NerdModeIDE' import { Database } from '@/lib/database' import { seedDatabase } from '@/lib/seed-data' import type { User as UserType, AppConfiguration } from '@/lib/level-types' import type { ModelSchema } from '@/lib/schema-types' +import { useKV } from '@github/spark/hooks' interface Level4Props { user: UserType @@ -38,6 +40,7 @@ interface Level4Props { export function Level4({ user, onLogout, onNavigate, onPreview }: Level4Props) { const [appConfig, setAppConfig] = useState(null) const [isLoading, setIsLoading] = useState(true) + const [nerdMode, setNerdMode] = useKV('level4-nerd-mode', false) useEffect(() => { const loadConfig = async () => { @@ -181,6 +184,17 @@ export function Level4({ user, onLogout, onNavigate, onPreview }: Level4Props) {
+ @@ -364,6 +378,12 @@ export function Level4({ user, onLogout, onNavigate, onPreview }: Level4Props) {
+ + {nerdMode && ( +
+ +
+ )} ) diff --git a/src/components/Level5.tsx b/src/components/Level5.tsx index 80daeb353..af8a97ae0 100644 --- a/src/components/Level5.tsx +++ b/src/components/Level5.tsx @@ -25,10 +25,12 @@ import { AlertDialogHeader, AlertDialogTitle, } from '@/components/ui/alert-dialog' -import { Crown, Users, House, ArrowsLeftRight, Shield, Eye, SignOut, Buildings } from '@phosphor-icons/react' +import { Crown, Users, House, ArrowsLeftRight, Shield, Eye, SignOut, Buildings, Terminal } from '@phosphor-icons/react' import { toast } from 'sonner' import type { User, AppLevel, Tenant, PowerTransferRequest } from '@/lib/level-types' import { Database } from '@/lib/database' +import { NerdModeIDE } from './NerdModeIDE' +import { useKV } from '@github/spark/hooks' interface Level5Props { user: User @@ -47,6 +49,7 @@ export function Level5({ user, onLogout, onNavigate, onPreview }: Level5Props) { const [selectedUserId, setSelectedUserId] = useState('') const [newTenantName, setNewTenantName] = useState('') const [showCreateTenant, setShowCreateTenant] = useState(false) + const [nerdMode, setNerdMode] = useKV('level5-nerd-mode', false) useEffect(() => { loadData() @@ -150,6 +153,18 @@ export function Level5({ user, onLogout, onNavigate, onPreview }: Level5Props) { {user.username} + + + + + + +
+
+
+
FILE EXPLORER
+
+ +
{renderFileTree(fileTree)}
+
+
+ +
+ {selectedFile ? ( + <> +
+
+ + {selectedFile.name} + + {selectedFile.language} + +
+
+ + + +
+
+ +
+ + + Editor + Console + Tests + Git + + + + setFileContent(value || '')} + theme="vs-dark" + options={{ + minimap: { enabled: false }, + fontSize: 13, + lineNumbers: 'on', + scrollBeyondLastLine: false, + automaticLayout: true, + }} + /> + + + +
+

Console Output

+ +
+ +
+ {consoleOutput.length === 0 ? ( +
No output yet
+ ) : ( + consoleOutput.map((line, i) => ( +
+ {line} +
+ )) + )} +
+
+
+ + +
+

Test Suite

+ +
+ +
+ {testResults.length === 0 ? ( +
+ +

No tests run yet

+
+ ) : ( + testResults.map((test, i) => ( + + +
+ + {test.status} + + {test.name} +
+ {test.duration && ( + + {test.duration}ms + + )} +
+
+ )) + )} +
+
+
+ + +
+
+

Git Operations

+ {gitConfig ? ( +
+
+ {gitConfig.provider} + {gitConfig.repoUrl} +
+
+ + {gitConfig.branch} +
+
+ ) : ( +

+ No Git configuration found +

+ )} +
+ + + +
+
+ + setGitCommitMessage(e.target.value)} + className="mt-1" + /> +
+ +
+ + +
+ + +
+
+
+
+
+ + ) : ( +
+
+ +

Select a file to edit

+
+
+ )} +
+
+
+ + + + + + Configure Git Integration + + Connect to GitHub or GitLab to sync your code + + +
+
+ + +
+
+ + + setGitConfig((current) => ({ ...(current || { provider: 'github', token: '', branch: 'main' }), repoUrl: e.target.value })) + } + /> +
+
+ + + setGitConfig((current) => ({ ...(current || { provider: 'github', token: '', repoUrl: '' }), branch: e.target.value })) + } + /> +
+
+ + + setGitConfig((current) => ({ ...(current || { provider: 'github', repoUrl: '', branch: 'main' }), token: e.target.value })) + } + /> +
+
+ + + + +
+
+ + + + + Create New {newFileType === 'file' ? 'File' : 'Folder'} + +
+
+ + +
+
+ + setNewFileName(e.target.value)} + onKeyDown={(e) => { + if (e.key === 'Enter') handleCreateFile() + }} + /> +
+
+ + + + +
+
+ + ) +}