From 7a82c07bfe45c505e02aa1bafdf31d1a56ffc1b4 Mon Sep 17 00:00:00 2001 From: johndoe6345789 Date: Fri, 2 Jan 2026 16:26:34 +0000 Subject: [PATCH] feat(codegen_studio): add Codegen Studio components for template generation and project scaffolding - Introduced `CodegenStudio`, `TemplateSelector`, and `PackageGenerator` components with detailed props and rendering logic. - Created UI styles and tokens for consistent theming across components. - Implemented permissions for template viewing, creation, and code generation. - Added functions for lifecycle events, blueprint building, and package generation. - Developed storybook stories for visual testing and documentation of components. feat(config_summary): implement configuration summary components and styles - Added `ConfigSummary`, `SummaryRow`, and related components for displaying system stats. - Defined permissions for viewing and exporting configuration summaries. - Created functions for rendering and aggregating summary data. - Established storybook stories for showcasing summary components and their variations. - Introduced styles and tokens for consistent UI presentation across summary components. --- packages/arcade_lobby/components/ui.json | 450 ++++++++++++++++++ packages/arcade_lobby/package.json | 46 ++ packages/arcade_lobby/permissions/roles.json | 83 ++++ packages/arcade_lobby/scripts/functions.json | 57 +++ packages/arcade_lobby/storybook/stories.json | 173 +++++++ packages/arcade_lobby/styles/tokens.json | 65 +++ packages/code_editor/components/ui.json | 299 ++++++++++++ packages/code_editor/package.json | 45 ++ packages/code_editor/permissions/roles.json | 53 +++ packages/code_editor/scripts/functions.json | 93 ++++ packages/code_editor/storybook/stories.json | 108 +++++ packages/code_editor/styles/tokens.json | 36 ++ packages/codegen_studio/components/ui.json | 413 ++++++++++++++++ packages/codegen_studio/package.json | 49 ++ .../codegen_studio/permissions/roles.json | 76 +++ .../codegen_studio/scripts/functions.json | 120 +++++ .../codegen_studio/storybook/stories.json | 97 ++++ packages/codegen_studio/styles/tokens.json | 29 ++ packages/config_summary/components/ui.json | 276 +++++++++++ packages/config_summary/package.json | 39 ++ .../config_summary/permissions/roles.json | 44 ++ .../config_summary/scripts/functions.json | 111 +++++ .../config_summary/storybook/stories.json | 113 +++++ packages/config_summary/styles/tokens.json | 36 ++ 24 files changed, 2911 insertions(+) create mode 100644 packages/arcade_lobby/components/ui.json create mode 100644 packages/arcade_lobby/package.json create mode 100644 packages/arcade_lobby/permissions/roles.json create mode 100644 packages/arcade_lobby/scripts/functions.json create mode 100644 packages/arcade_lobby/storybook/stories.json create mode 100644 packages/arcade_lobby/styles/tokens.json create mode 100644 packages/code_editor/components/ui.json create mode 100644 packages/code_editor/package.json create mode 100644 packages/code_editor/permissions/roles.json create mode 100644 packages/code_editor/scripts/functions.json create mode 100644 packages/code_editor/storybook/stories.json create mode 100644 packages/code_editor/styles/tokens.json create mode 100644 packages/codegen_studio/components/ui.json create mode 100644 packages/codegen_studio/package.json create mode 100644 packages/codegen_studio/permissions/roles.json create mode 100644 packages/codegen_studio/scripts/functions.json create mode 100644 packages/codegen_studio/storybook/stories.json create mode 100644 packages/codegen_studio/styles/tokens.json create mode 100644 packages/config_summary/components/ui.json create mode 100644 packages/config_summary/package.json create mode 100644 packages/config_summary/permissions/roles.json create mode 100644 packages/config_summary/scripts/functions.json create mode 100644 packages/config_summary/storybook/stories.json create mode 100644 packages/config_summary/styles/tokens.json diff --git a/packages/arcade_lobby/components/ui.json b/packages/arcade_lobby/components/ui.json new file mode 100644 index 000000000..ecfc12201 --- /dev/null +++ b/packages/arcade_lobby/components/ui.json @@ -0,0 +1,450 @@ +{ + "$schema": "https://metabuilder.dev/schemas/json-script-components.schema.json", + "schemaVersion": "2.0.0", + "package": "arcade_lobby", + "description": "Arcade lobby components including game browser, party queue, and tournament list", + "components": [ + { + "id": "arcade_lobby", + "name": "ArcadeLobby", + "description": "Main arcade lobby layout with game queues and player stats", + "props": [ + { + "name": "playersOnline", + "type": "number", + "required": false, + "default": 0, + "description": "Number of players currently online" + }, + { + "name": "queuesOpen", + "type": "number", + "required": false, + "default": 0, + "description": "Number of queues currently open" + }, + { + "name": "liveTournaments", + "type": "number", + "required": false, + "default": 0, + "description": "Number of live tournaments" + } + ], + "render": { + "type": "element", + "template": { + "type": "Stack", + "direction": "column", + "spacing": 3, + "className": "arcade-lobby", + "children": [ + { + "type": "Card", + "variant": "outlined", + "className": "arcade-lobby-hero", + "children": [ + { + "type": "CardContent", + "children": [ + { + "type": "Text", + "variant": "h4", + "fontWeight": "bold", + "children": "Arcade Lobby" + }, + { + "type": "Text", + "variant": "body2", + "color": "secondary", + "children": "Drop into live queues, join tournaments, and spotlight the best plays of the night." + }, + { + "type": "Flex", + "gap": 1, + "sx": { "mt": 2 }, + "children": [ + { + "type": "Chip", + "label": "Matchmaking", + "color": "secondary", + "size": "small" + }, + { + "type": "Chip", + "label": "Live tournaments", + "color": "secondary", + "size": "small" + }, + { + "type": "Chip", + "label": "Party chat", + "variant": "outlined", + "size": "small" + } + ] + } + ] + } + ] + } + ] + } + } + }, + { + "id": "game_browser", + "name": "GameBrowser", + "description": "Grid of featured game queues with wait times", + "props": [ + { + "name": "games", + "type": "array", + "required": true, + "description": "List of games to display" + }, + { + "name": "columns", + "type": "number", + "required": false, + "default": 3, + "description": "Number of grid columns" + } + ], + "render": { + "type": "element", + "template": { + "type": "Card", + "variant": "outlined", + "className": "game-browser", + "children": [ + { + "type": "CardContent", + "children": [ + { + "type": "Text", + "variant": "h5", + "fontWeight": "semibold", + "children": "Featured queues" + }, + { + "type": "Grid", + "container": true, + "spacing": 2, + "sx": { "mt": 2 }, + "children": { + "type": "iterator", + "items": "{{games}}", + "itemTemplate": { + "type": "Grid", + "item": true, + "xs": 12, + "sm": 6, + "md": 4, + "children": [ + { + "type": "Card", + "variant": "outlined", + "children": [ + { + "type": "CardContent", + "children": [ + { + "type": "Text", + "variant": "subtitle1", + "fontWeight": "semibold", + "children": "{{item.title}}" + }, + { + "type": "Text", + "variant": "caption", + "color": "secondary", + "children": "{{item.description}} · Avg wait {{item.waitTime}}" + } + ] + } + ] + } + ] + } + } + } + ] + } + ] + } + } + }, + { + "id": "party_queue", + "name": "PartyQueue", + "description": "Party creation and queue status component", + "props": [ + { + "name": "queueName", + "type": "string", + "required": false, + "default": "", + "description": "Current queue name" + }, + { + "name": "progress", + "type": "number", + "required": false, + "default": 0, + "description": "Queue progress percentage" + }, + { + "name": "estimatedWait", + "type": "string", + "required": false, + "default": "Unknown", + "description": "Estimated wait time" + } + ], + "render": { + "type": "element", + "template": { + "type": "Card", + "variant": "outlined", + "className": "party-queue", + "children": [ + { + "type": "CardContent", + "children": [ + { + "type": "Text", + "variant": "h5", + "fontWeight": "semibold", + "children": "Queue status" + }, + { + "type": "Text", + "variant": "body2", + "color": "secondary", + "children": "{{queueName}} matchmaking is ramping up. Estimated wait: {{estimatedWait}}." + }, + { + "type": "LinearProgress", + "variant": "determinate", + "value": "{{progress}}", + "sx": { "mt": 2 } + } + ] + } + ] + } + } + }, + { + "id": "tournament_list", + "name": "TournamentList", + "description": "List of available tournaments with join actions", + "props": [ + { + "name": "tournaments", + "type": "array", + "required": true, + "description": "List of tournaments" + }, + { + "name": "canCreate", + "type": "boolean", + "required": false, + "default": false, + "description": "Whether user can create tournaments" + } + ], + "render": { + "type": "element", + "template": { + "type": "Card", + "variant": "outlined", + "className": "tournament-list", + "children": [ + { + "type": "CardContent", + "children": [ + { + "type": "Flex", + "justifyContent": "space-between", + "alignItems": "center", + "children": [ + { + "type": "Text", + "variant": "h5", + "fontWeight": "semibold", + "children": "Tournaments" + }, + { + "type": "conditional", + "condition": "{{canCreate}}", + "then": { + "type": "Button", + "variant": "outlined", + "size": "small", + "children": "Create tournament" + } + } + ] + }, + { + "type": "Stack", + "spacing": 1, + "sx": { "mt": 2 }, + "children": { + "type": "iterator", + "items": "{{tournaments}}", + "itemTemplate": { + "type": "Card", + "variant": "outlined", + "children": [ + { + "type": "CardContent", + "children": [ + { + "type": "Flex", + "justifyContent": "space-between", + "alignItems": "center", + "children": [ + { + "type": "Stack", + "children": [ + { + "type": "Text", + "variant": "subtitle1", + "fontWeight": "medium", + "children": "{{item.name}}" + }, + { + "type": "Text", + "variant": "caption", + "color": "secondary", + "children": "{{item.participants}} participants · {{item.status}}" + } + ] + }, + { + "type": "Button", + "variant": "contained", + "size": "small", + "children": "Join" + } + ] + } + ] + } + ] + } + } + } + ] + } + ] + } + } + }, + { + "id": "stat_card_players", + "name": "PlayersOnlineStat", + "description": "Stat card showing players currently online", + "props": [ + { + "name": "count", + "type": "number", + "required": true, + "description": "Number of players online" + } + ], + "render": { + "type": "element", + "template": { + "type": "Card", + "variant": "outlined", + "className": "stat-card", + "children": [ + { + "type": "CardContent", + "children": [ + { + "type": "Text", + "variant": "caption", + "color": "secondary", + "children": "Players online" + }, + { + "type": "Text", + "variant": "h5", + "fontWeight": "semibold", + "children": "{{count}}" + } + ] + } + ] + } + } + }, + { + "id": "party_cta", + "name": "PartyCTA", + "description": "Call to action for creating parties and tournaments", + "props": [ + { + "name": "canCreateTournament", + "type": "boolean", + "required": false, + "default": false, + "description": "Whether user can create tournaments" + } + ], + "render": { + "type": "element", + "template": { + "type": "Card", + "variant": "outlined", + "className": "party-cta", + "children": [ + { + "type": "CardContent", + "children": [ + { + "type": "Text", + "variant": "h5", + "fontWeight": "semibold", + "children": "Party up" + }, + { + "type": "Text", + "variant": "body2", + "color": "secondary", + "children": "Create a squad, invite friends, and keep the lobby humming." + }, + { + "type": "Flex", + "gap": 1, + "sx": { "mt": 2 }, + "children": [ + { + "type": "Button", + "variant": "contained", + "children": "Start party" + }, + { + "type": "conditional", + "condition": "{{canCreateTournament}}", + "then": { + "type": "Button", + "variant": "outlined", + "children": "Create tournament" + } + } + ] + } + ] + } + ] + } + } + } + ] +} diff --git a/packages/arcade_lobby/package.json b/packages/arcade_lobby/package.json new file mode 100644 index 000000000..ade3aa7e9 --- /dev/null +++ b/packages/arcade_lobby/package.json @@ -0,0 +1,46 @@ +{ + "$schema": "https://metabuilder.dev/schemas/package-metadata.schema.json", + "packageId": "arcade_lobby", + "name": "Arcade Lobby", + "version": "1.0.0", + "description": "Gaming lobby for tournaments, party queues, and highlights", + "author": "MetaBuilder", + "license": "MIT", + "category": "gaming", + "minLevel": 2, + "primary": true, + "dependencies": { + "ui_permissions": "*", + "dashboard": "*" + }, + "devDependencies": { + "lua_test": "*" + }, + "exports": { + "components": [ + "ArcadeLobby", + "GameBrowser", + "PartyQueue", + "TournamentList" + ], + "scripts": [ + "matchmaking", + "queue_metrics", + "permissions" + ] + }, + "tests": { + "scripts": [ + "tests/metadata.test.lua", + "tests/components.test.lua" + ], + "parameterized": [ + { + "parameters": "tests/metadata.cases.json" + }, + { + "parameters": "tests/components.cases.json" + } + ] + } +} diff --git a/packages/arcade_lobby/permissions/roles.json b/packages/arcade_lobby/permissions/roles.json new file mode 100644 index 000000000..4c90edacf --- /dev/null +++ b/packages/arcade_lobby/permissions/roles.json @@ -0,0 +1,83 @@ +{ + "$schema": "https://metabuilder.dev/schemas/permissions.schema.json", + "schemaVersion": "1.0.0", + "package": "arcade_lobby", + "description": "Arcade lobby access and management permissions", + "permissions": [ + { + "id": "arcade.lobby.view", + "name": "View Arcade Lobby", + "description": "View arcade lobby and game listings", + "resource": "arcade_lobby", + "action": "read", + "scope": "global", + "minLevel": 2 + }, + { + "id": "arcade.party.create", + "name": "Create Party", + "description": "Create party queues", + "resource": "arcade_party", + "action": "create", + "scope": "global", + "minLevel": 2 + }, + { + "id": "arcade.tournament.join", + "name": "Join Tournament", + "description": "Join tournaments", + "resource": "arcade_tournament", + "action": "read", + "scope": "global", + "minLevel": 2 + }, + { + "id": "arcade.tournament.create", + "name": "Create Tournament", + "description": "Create new tournaments", + "resource": "arcade_tournament", + "action": "create", + "scope": "global", + "minLevel": 3 + }, + { + "id": "arcade.queue.manage", + "name": "Manage Queues", + "description": "Manage and configure game queues", + "resource": "arcade_queue", + "action": "manage", + "scope": "global", + "minLevel": 3 + } + ], + "resources": [ + { + "id": "arcade_lobby", + "name": "Arcade Lobby", + "type": "ui", + "description": "Main arcade lobby interface", + "actions": ["read"] + }, + { + "id": "arcade_party", + "name": "Party", + "type": "entity", + "description": "Party queue resources", + "actions": ["read", "create", "delete"] + }, + { + "id": "arcade_tournament", + "name": "Tournament", + "type": "entity", + "description": "Tournament resources", + "actions": ["read", "create", "update", "delete"] + }, + { + "id": "arcade_queue", + "name": "Game Queue", + "type": "entity", + "description": "Game matchmaking queues", + "actions": ["read", "manage"] + } + ] +} diff --git a/packages/arcade_lobby/scripts/functions.json b/packages/arcade_lobby/scripts/functions.json new file mode 100644 index 000000000..0b060220d --- /dev/null +++ b/packages/arcade_lobby/scripts/functions.json @@ -0,0 +1,57 @@ +{ + "$schema": "https://metabuilder.dev/schemas/json-script.schema.json", + "schemaVersion": "2.2.0", + "package": "arcade_lobby", + "description": "Arcade lobby matchmaking, queue metrics, and permission functions", + "functions": [ + { + "id": "matchmaking_assign_bucket", + "name": "assignBucket", + "exported": true, + "description": "Assign party to matchmaking bucket based on size", + "category": "matching", + "luaScript": "matchmaking.lua" + }, + { + "id": "queue_metrics_summarize", + "name": "summarizeQueues", + "exported": true, + "description": "Summarize queue health and wait times", + "category": "analytics", + "luaScript": "queue_metrics.lua" + }, + { + "id": "permissions_can_create_tournament", + "name": "canCreateTournament", + "exported": true, + "description": "Check if user can create tournaments", + "category": "security", + "luaScript": "permissions.lua" + }, + { + "id": "init_on_install", + "name": "onInstall", + "exported": true, + "description": "Lifecycle hook for package installation", + "category": "lifecycle", + "luaScript": "init.lua" + }, + { + "id": "init_on_remove", + "name": "onRemove", + "exported": true, + "description": "Lifecycle hook for package removal", + "category": "lifecycle", + "luaScript": "init.lua" + } + ], + "exports": { + "functions": [ + "assignBucket", + "summarizeQueues", + "canCreateTournament", + "onInstall", + "onRemove" + ] + } +} diff --git a/packages/arcade_lobby/storybook/stories.json b/packages/arcade_lobby/storybook/stories.json new file mode 100644 index 000000000..d140b0bcb --- /dev/null +++ b/packages/arcade_lobby/storybook/stories.json @@ -0,0 +1,173 @@ +{ + "$schema": "https://metabuilder.dev/schemas/package-storybook.schema.json", + "featured": true, + "title": "Arcade Lobby Components", + "description": "Gaming lobby for tournaments, party queues, and highlights", + "stories": [ + { + "name": "GameBrowser", + "render": "game_browser", + "description": "Featured game queues grid with wait times", + "args": { + "games": [ + { + "title": "Neon Rush", + "description": "Fast-paced sprint arenas", + "waitTime": "45s" + }, + { + "title": "Gridline", + "description": "Team tactics mode", + "waitTime": "2m" + }, + { + "title": "Star Kart", + "description": "Party racing", + "waitTime": "30s" + } + ], + "columns": 3 + } + }, + { + "name": "PartyQueue", + "render": "party_queue", + "description": "Queue status with progress indicator", + "args": { + "queueName": "Neon Rush", + "progress": 65, + "estimatedWait": "45s" + } + }, + { + "name": "TournamentList", + "render": "tournament_list", + "description": "List of available tournaments", + "args": { + "tournaments": [ + { + "name": "Friday Night Showdown", + "participants": 128, + "status": "Live" + }, + { + "name": "Weekend Warriors Cup", + "participants": 64, + "status": "Registering" + }, + { + "name": "Pro League Qualifier", + "participants": 256, + "status": "Starting soon" + } + ], + "canCreate": false + } + }, + { + "name": "TournamentListAdmin", + "render": "tournament_list", + "description": "Tournament list with admin create button", + "args": { + "tournaments": [ + { + "name": "Friday Night Showdown", + "participants": 128, + "status": "Live" + } + ], + "canCreate": true + } + }, + { + "name": "PartyCTA", + "render": "party_cta", + "description": "Call to action for creating parties", + "args": { + "canCreateTournament": false + } + }, + { + "name": "PartyCTAAdmin", + "render": "party_cta", + "description": "Party CTA with tournament creation for admins", + "args": { + "canCreateTournament": true + } + } + ], + "renders": { + "game_browser": { + "description": "Featured game queues grid", + "featured": true + }, + "party_queue": { + "description": "Queue status with progress" + }, + "tournament_list": { + "description": "Available tournaments list" + }, + "party_cta": { + "description": "Party creation call to action" + } + }, + "defaultContext": { + "user": { + "id": "demo-user", + "username": "gamer123", + "level": 2, + "email": "gamer@example.com" + }, + "tenant": { + "id": "arcade-tenant", + "name": "Arcade Gaming Hub" + } + }, + "contextVariants": [ + { + "name": "Standard Player", + "description": "Can view lobby and join queues", + "context": { + "user": { + "username": "player1", + "level": 2 + } + } + }, + { + "name": "Tournament Admin", + "description": "Can create and manage tournaments", + "context": { + "user": { + "username": "tournament_admin", + "level": 3 + } + } + }, + { + "name": "God User", + "description": "Full arcade management access", + "context": { + "user": { + "username": "arcade_god", + "level": 4 + } + } + } + ], + "scripts": { + "renderFunctions": ["game_browser", "party_queue", "tournament_list", "party_cta"], + "ignoredScripts": ["tests"] + }, + "parameters": { + "layout": "padded", + "backgrounds": { + "default": "dark", + "values": [ + { "name": "light", "value": "#f5f5f5" }, + { "name": "dark", "value": "#0f0f23" }, + { "name": "arcade", "value": "#1a1a2e" } + ] + } + } +} diff --git a/packages/arcade_lobby/styles/tokens.json b/packages/arcade_lobby/styles/tokens.json new file mode 100644 index 000000000..60cc12d0d --- /dev/null +++ b/packages/arcade_lobby/styles/tokens.json @@ -0,0 +1,65 @@ +{ + "$schema": "https://metabuilder.dev/schemas/package-styles.schema.json", + "schemaVersion": "2.0.0", + "colors": { + "arcadePrimary": "#6366f1", + "arcadeSecondary": "#8b5cf6", + "arcadeAccent": "#f59e0b", + "queueActive": "#22c55e", + "queueWaiting": "#eab308", + "queueFull": "#ef4444", + "tournamentLive": "#ec4899", + "tournamentUpcoming": "#3b82f6", + "partyHighlight": "#14b8a6", + "statPositive": "#28a745", + "statNegative": "#dc3545", + "statNeutral": "#6c757d" + }, + "spacing": { + "lobbyPadding": "24px", + "cardGap": "16px", + "gridGap": "16px", + "sectionSpacing": "24px", + "statCardPadding": "16px", + "badgeGap": "8px" + }, + "shadows": { + "card": "0 2px 8px rgba(0, 0, 0, 0.1)", + "cardHover": "0 4px 12px rgba(0, 0, 0, 0.15)", + "statCard": "0 1px 4px rgba(0, 0, 0, 0.08)", + "gameCard": "0 2px 6px rgba(99, 102, 241, 0.12)" + }, + "borderRadius": { + "card": "12px", + "badge": "6px", + "button": "8px", + "progress": "4px" + }, + "typography": { + "lobbyTitle": { + "fontSize": "1.5rem", + "fontWeight": 700, + "lineHeight": 1.2 + }, + "sectionTitle": { + "fontSize": "1.25rem", + "fontWeight": 600, + "lineHeight": 1.3 + }, + "gameTitle": { + "fontSize": "1.125rem", + "fontWeight": 600, + "lineHeight": 1.4 + }, + "statValue": { + "fontSize": "1.25rem", + "fontWeight": 600, + "lineHeight": 1.2 + }, + "statLabel": { + "fontSize": "0.875rem", + "fontWeight": 400, + "lineHeight": 1.4 + } + } +} diff --git a/packages/code_editor/components/ui.json b/packages/code_editor/components/ui.json new file mode 100644 index 000000000..e87a28a50 --- /dev/null +++ b/packages/code_editor/components/ui.json @@ -0,0 +1,299 @@ +{ + "$schema": "https://metabuilder.dev/schemas/json-script-components.schema.json", + "schemaVersion": "2.0.0", + "package": "code_editor", + "description": "Code editor components for JSON, Lua, and theme editing", + "components": [ + { + "id": "code_editor", + "name": "CodeEditor", + "description": "Base code editor component with language selection and theming", + "props": [ + { + "name": "language", + "type": "string", + "required": false, + "default": "json", + "description": "Programming language for syntax highlighting" + }, + { + "name": "value", + "type": "string", + "required": false, + "default": "", + "description": "Editor content" + }, + { + "name": "readOnly", + "type": "boolean", + "required": false, + "default": false, + "description": "Whether the editor is read-only" + }, + { + "name": "lineNumbers", + "type": "boolean", + "required": false, + "default": true, + "description": "Show line numbers" + }, + { + "name": "theme", + "type": "string", + "required": false, + "default": "light", + "description": "Editor color theme" + } + ], + "render": { + "type": "element", + "template": { + "type": "Card", + "variant": "outlined", + "className": "code-editor-container", + "children": [ + { + "type": "Toolbar", + "variant": "dense", + "children": [ + { + "type": "Select", + "size": "small", + "label": "Language", + "value": "{{language}}" + }, + { + "type": "Select", + "size": "small", + "label": "Theme", + "value": "{{theme}}" + } + ] + }, + { + "type": "Box", + "className": "code-editor-content", + "sx": { + "height": "400px", + "overflow": "auto" + }, + "children": "{{value}}" + }, + { + "type": "Box", + "className": "code-editor-status", + "children": [] + } + ] + } + } + }, + { + "id": "json_editor", + "name": "JsonEditor", + "description": "JSON-specific code editor with formatting and validation", + "props": [ + { + "name": "value", + "type": "string", + "required": false, + "default": "{}", + "description": "JSON content" + }, + { + "name": "readOnly", + "type": "boolean", + "required": false, + "default": false, + "description": "Whether the editor is read-only" + }, + { + "name": "autoFormat", + "type": "boolean", + "required": false, + "default": true, + "description": "Auto-format JSON on blur" + } + ], + "render": { + "type": "element", + "template": { + "type": "Card", + "variant": "outlined", + "className": "json-editor-container", + "children": [ + { + "type": "Toolbar", + "variant": "dense", + "children": [ + { + "type": "IconButton", + "title": "Format JSON", + "icon": "FormatAlignLeft" + }, + { + "type": "IconButton", + "title": "Validate JSON", + "icon": "Check" + } + ] + }, + { + "type": "Box", + "className": "json-editor-content", + "children": "{{value}}" + } + ] + } + } + }, + { + "id": "lua_editor", + "name": "LuaEditor", + "description": "Lua code editor with sandbox execution support", + "props": [ + { + "name": "value", + "type": "string", + "required": false, + "default": "", + "description": "Lua code content" + }, + { + "name": "readOnly", + "type": "boolean", + "required": false, + "default": false, + "description": "Whether the editor is read-only" + }, + { + "name": "showSnippets", + "type": "boolean", + "required": false, + "default": true, + "description": "Show code snippets panel" + }, + { + "name": "showOutput", + "type": "boolean", + "required": false, + "default": true, + "description": "Show output panel" + } + ], + "render": { + "type": "element", + "template": { + "type": "Card", + "variant": "outlined", + "className": "lua-editor-container", + "children": [ + { + "type": "Toolbar", + "variant": "dense", + "children": [ + { + "type": "Button", + "variant": "contained", + "color": "primary", + "size": "small", + "children": "Run" + } + ] + }, + { + "type": "Box", + "className": "lua-editor-content", + "children": "{{value}}" + }, + { + "type": "conditional", + "condition": "{{showOutput}}", + "then": { + "type": "Box", + "className": "lua-editor-output", + "children": [] + } + } + ] + } + } + }, + { + "id": "theme_editor", + "name": "ThemeEditor", + "description": "Theme customization editor with color pickers and mode toggle", + "props": [ + { + "name": "primary", + "type": "string", + "required": false, + "default": "#1976d2", + "description": "Primary color" + }, + { + "name": "secondary", + "type": "string", + "required": false, + "default": "#dc004e", + "description": "Secondary color" + }, + { + "name": "mode", + "type": "string", + "required": false, + "default": "light", + "description": "Color mode (light/dark)" + } + ], + "render": { + "type": "element", + "template": { + "type": "Card", + "variant": "outlined", + "className": "theme-editor-container", + "children": [ + { + "type": "Toolbar", + "variant": "dense", + "children": [] + }, + { + "type": "Box", + "className": "theme-editor-preview", + "children": [] + }, + { + "type": "Stack", + "spacing": 2, + "className": "theme-editor-controls", + "children": [ + { + "type": "ColorPicker", + "name": "primary", + "value": "{{primary}}", + "label": "Primary Color" + }, + { + "type": "ColorPicker", + "name": "secondary", + "value": "{{secondary}}", + "label": "Secondary Color" + }, + { + "type": "Switch", + "label": "Dark Mode", + "name": "dark_mode", + "checked": "{{mode === 'dark'}}" + } + ] + } + ] + } + } + } + ], + "exports": { + "components": ["CodeEditor", "JsonEditor", "LuaEditor", "ThemeEditor"] + } +} diff --git a/packages/code_editor/package.json b/packages/code_editor/package.json new file mode 100644 index 000000000..284293329 --- /dev/null +++ b/packages/code_editor/package.json @@ -0,0 +1,45 @@ +{ + "$schema": "https://metabuilder.dev/schemas/package-metadata.schema.json", + "packageId": "code_editor", + "name": "Code Editor", + "version": "1.0.0", + "description": "Code editor components for JSON, Lua, and theme editing", + "author": "MetaBuilder", + "license": "MIT", + "category": "editors", + "minLevel": 5, + "primary": false, + "dependencies": {}, + "devDependencies": { + "lua_test": "*" + }, + "exports": { + "components": [ + "CodeEditor", + "JsonEditor", + "LuaEditor", + "ThemeEditor" + ], + "scripts": [ + "json", + "lua", + "theme" + ] + }, + "tests": { + "scripts": [ + "tests/metadata.test.lua", + "tests/components.test.lua", + "tests/editor.test.lua", + "tests/theme.test.lua", + "tests/json.test.lua", + "tests/lua.test.lua", + "tests/init.test.lua" + ], + "parameterized": [ + { + "parameters": "tests/editor.cases.json" + } + ] + } +} diff --git a/packages/code_editor/permissions/roles.json b/packages/code_editor/permissions/roles.json new file mode 100644 index 000000000..6610a071f --- /dev/null +++ b/packages/code_editor/permissions/roles.json @@ -0,0 +1,53 @@ +{ + "$schema": "https://metabuilder.dev/schemas/permissions.schema.json", + "schemaVersion": "1.0.0", + "package": "code_editor", + "description": "Code editor access permissions", + "permissions": [ + { + "id": "editor.code.view", + "name": "View Code Editor", + "description": "View code in editor (read-only access)", + "resource": "code_editor", + "action": "read", + "scope": "global", + "minLevel": 5 + }, + { + "id": "editor.code.edit", + "name": "Edit Code", + "description": "Edit code in editor", + "resource": "code_editor", + "action": "write", + "scope": "global", + "minLevel": 5 + }, + { + "id": "editor.theme.apply", + "name": "Apply Editor Themes", + "description": "Apply and customize editor themes", + "resource": "code_editor", + "action": "configure", + "scope": "global", + "minLevel": 5 + }, + { + "id": "editor.lua.execute", + "name": "Execute Lua Code", + "description": "Execute Lua code in sandbox environment", + "resource": "code_editor", + "action": "execute", + "scope": "global", + "minLevel": 5 + } + ], + "resources": [ + { + "id": "code_editor", + "name": "Code Editor", + "type": "ui", + "description": "Code editor resources", + "actions": ["read", "write", "configure", "execute"] + } + ] +} diff --git a/packages/code_editor/scripts/functions.json b/packages/code_editor/scripts/functions.json new file mode 100644 index 000000000..152294760 --- /dev/null +++ b/packages/code_editor/scripts/functions.json @@ -0,0 +1,93 @@ +{ + "$schema": "https://metabuilder.dev/schemas/json-script.schema.json", + "schemaVersion": "2.2.0", + "package": "code_editor", + "description": "Code editor functions for JSON, Lua, and theme editing", + "functions": [ + { + "id": "json_render", + "name": "renderJsonEditor", + "exported": true, + "description": "Render JSON editor component with options", + "category": "json", + "luaScript": "json.lua" + }, + { + "id": "json_validate", + "name": "validateJson", + "exported": true, + "description": "Validate JSON string syntax", + "category": "json", + "luaScript": "json.lua" + }, + { + "id": "json_format", + "name": "formatJson", + "exported": true, + "description": "Format JSON string with indentation", + "category": "json", + "luaScript": "json.lua" + }, + { + "id": "lua_render", + "name": "renderLuaEditor", + "exported": true, + "description": "Render Lua code editor component", + "category": "lua", + "luaScript": "lua.lua" + }, + { + "id": "lua_validate", + "name": "validateLua", + "exported": true, + "description": "Validate Lua code syntax", + "category": "lua", + "luaScript": "lua.lua" + }, + { + "id": "lua_run_sandbox", + "name": "runLuaSandbox", + "exported": true, + "description": "Execute Lua code in sandbox environment", + "category": "lua", + "luaScript": "lua.lua" + }, + { + "id": "theme_render", + "name": "renderThemeEditor", + "exported": true, + "description": "Render theme customization editor", + "category": "theme", + "luaScript": "theme.lua" + }, + { + "id": "theme_color_picker", + "name": "renderColorPicker", + "exported": true, + "description": "Render color picker component", + "category": "theme", + "luaScript": "theme.lua" + }, + { + "id": "theme_mode_toggle", + "name": "renderModeToggle", + "exported": true, + "description": "Render light/dark mode toggle", + "category": "theme", + "luaScript": "theme.lua" + } + ], + "exports": { + "functions": [ + "renderJsonEditor", + "validateJson", + "formatJson", + "renderLuaEditor", + "validateLua", + "runLuaSandbox", + "renderThemeEditor", + "renderColorPicker", + "renderModeToggle" + ] + } +} diff --git a/packages/code_editor/storybook/stories.json b/packages/code_editor/storybook/stories.json new file mode 100644 index 000000000..cd26d0d34 --- /dev/null +++ b/packages/code_editor/storybook/stories.json @@ -0,0 +1,108 @@ +{ + "$schema": "https://metabuilder.dev/schemas/package-storybook.schema.json", + "featured": false, + "title": "Code Editor Components", + "description": "Code editor components for JSON, Lua, and theme editing", + "stories": [ + { + "name": "JsonEditor", + "render": "json", + "description": "JSON editor with formatting and validation", + "args": { + "value": "{\n \"name\": \"example\",\n \"version\": \"1.0.0\"\n}", + "readOnly": false, + "autoFormat": true + } + }, + { + "name": "LuaEditor", + "render": "lua", + "description": "Lua code editor with sandbox execution", + "args": { + "value": "-- Example Lua script\nlocal function greet(name)\n return \"Hello, \" .. name\nend\n\nreturn greet(\"World\")", + "readOnly": false, + "showSnippets": true, + "showOutput": true + } + }, + { + "name": "ThemeEditor", + "render": "theme", + "description": "Theme customization editor", + "args": { + "primary": "#1976d2", + "secondary": "#dc004e", + "mode": "light" + } + }, + { + "name": "CodeEditorReadOnly", + "render": "json", + "description": "Read-only code editor", + "args": { + "value": "{\n \"readonly\": true,\n \"content\": \"Cannot edit\"\n}", + "readOnly": true + } + } + ], + "renders": { + "json": { + "description": "JSON editor with validation and formatting", + "featured": true + }, + "lua": { + "description": "Lua code editor with sandbox execution" + }, + "theme": { + "description": "Theme customization interface" + } + }, + "defaultContext": { + "user": { + "id": "demo-user", + "username": "demo_editor", + "level": 5, + "email": "demo@example.com" + }, + "tenant": { + "id": "demo-tenant", + "name": "Demo Organization" + } + }, + "contextVariants": [ + { + "name": "God User", + "description": "Full code editing access", + "context": { + "user": { + "username": "god_user", + "level": 5 + } + } + }, + { + "name": "Supergod User", + "description": "Maximum access level", + "context": { + "user": { + "username": "supergod", + "level": 6 + } + } + } + ], + "scripts": { + "renderFunctions": ["json", "lua", "theme"], + "ignoredScripts": ["tests"] + }, + "parameters": { + "layout": "padded", + "backgrounds": { + "default": "dark", + "values": [ + { "name": "light", "value": "#ffffff" }, + { "name": "dark", "value": "#1e1e1e" } + ] + } + } +} diff --git a/packages/code_editor/styles/tokens.json b/packages/code_editor/styles/tokens.json new file mode 100644 index 000000000..495ecbff6 --- /dev/null +++ b/packages/code_editor/styles/tokens.json @@ -0,0 +1,36 @@ +{ + "$schema": "https://metabuilder.dev/schemas/package-styles.schema.json", + "schemaVersion": "2.0.0", + "colors": { + "editorBackground": "#1e1e1e", + "editorBackgroundLight": "#ffffff", + "editorForeground": "#d4d4d4", + "editorForegroundLight": "#333333", + "lineNumbersColor": "#858585", + "selectionBackground": "#264f78", + "cursorColor": "#aeafad", + "syntaxKeyword": "#569cd6", + "syntaxString": "#ce9178", + "syntaxNumber": "#b5cea8", + "syntaxComment": "#6a9955", + "syntaxFunction": "#dcdcaa", + "syntaxVariable": "#9cdcfe", + "syntaxOperator": "#d4d4d4", + "syntaxType": "#4ec9b0", + "errorColor": "#f44747", + "warningColor": "#dcdcaa", + "successColor": "#4ec9b0" + }, + "spacing": { + "editorPadding": "16px", + "toolbarHeight": "48px", + "statusBarHeight": "24px", + "lineNumberWidth": "48px", + "gutterWidth": "8px" + }, + "shadows": { + "editorContainer": "0 2px 8px rgba(0, 0, 0, 0.15)", + "toolbar": "0 1px 2px rgba(0, 0, 0, 0.1)", + "dropdown": "0 4px 12px rgba(0, 0, 0, 0.2)" + } +} diff --git a/packages/codegen_studio/components/ui.json b/packages/codegen_studio/components/ui.json new file mode 100644 index 000000000..8d654dd9f --- /dev/null +++ b/packages/codegen_studio/components/ui.json @@ -0,0 +1,413 @@ +{ + "$schema": "https://metabuilder.dev/schemas/json-script-components.schema.json", + "schemaVersion": "2.0.0", + "package": "codegen_studio", + "description": "Codegen Studio components for template generation and project scaffolding", + "components": [ + { + "id": "codegen_studio", + "name": "CodegenStudio", + "description": "Main Codegen Studio interface with template selection and generation controls", + "props": [ + { + "name": "projectName", + "type": "string", + "required": false, + "description": "Initial project name" + }, + { + "name": "runtime", + "type": "string", + "required": false, + "default": "web", + "description": "Target runtime: web, cli, or desktop" + }, + { + "name": "onGenerate", + "type": "function", + "required": false, + "description": "Callback when generation is triggered" + } + ], + "render": { + "type": "element", + "template": { + "type": "Stack", + "direction": "column", + "spacing": 3, + "className": "codegen-studio", + "children": [ + { + "type": "Card", + "variant": "outlined", + "children": [ + { + "type": "CardContent", + "children": [ + { + "type": "Text", + "variant": "h4", + "fontWeight": "bold", + "children": "Codegen Studio" + }, + { + "type": "Text", + "variant": "body1", + "color": "secondary", + "children": "Ship a new app in minutes with curated templates and export-ready bundles." + }, + { + "type": "Flex", + "gap": 1, + "sx": { "mt": 2 }, + "children": [ + { + "type": "Chip", + "label": "Next.js", + "variant": "outlined", + "size": "small" + }, + { + "type": "Chip", + "label": "React", + "variant": "outlined", + "size": "small" + }, + { + "type": "Chip", + "label": "CLI", + "variant": "outlined", + "size": "small" + } + ] + } + ] + } + ] + }, + { + "type": "Grid", + "container": true, + "spacing": 2, + "children": [ + { + "type": "Grid", + "item": true, + "xs": 4, + "children": [ + { + "type": "Card", + "variant": "outlined", + "children": [ + { + "type": "CardContent", + "children": [ + { + "type": "Text", + "variant": "caption", + "color": "secondary", + "children": "Templates ready" + }, + { + "type": "Text", + "variant": "h5", + "fontWeight": "bold", + "children": "12" + } + ] + } + ] + } + ] + }, + { + "type": "Grid", + "item": true, + "xs": 4, + "children": [ + { + "type": "Card", + "variant": "outlined", + "children": [ + { + "type": "CardContent", + "children": [ + { + "type": "Text", + "variant": "caption", + "color": "secondary", + "children": "Targets" + }, + { + "type": "Text", + "variant": "h6", + "fontWeight": "bold", + "children": "Web · CLI · Desktop" + } + ] + } + ] + } + ] + }, + { + "type": "Grid", + "item": true, + "xs": 4, + "children": [ + { + "type": "Card", + "variant": "outlined", + "children": [ + { + "type": "CardContent", + "children": [ + { + "type": "Text", + "variant": "caption", + "color": "secondary", + "children": "Last export" + }, + { + "type": "Text", + "variant": "h5", + "fontWeight": "bold", + "children": "2m ago" + } + ] + } + ] + } + ] + } + ] + } + ] + } + } + }, + { + "id": "template_selector", + "name": "TemplateSelector", + "description": "Template selection and configuration form", + "props": [ + { + "name": "templates", + "type": "array", + "required": false, + "description": "Available templates" + }, + { + "name": "onSelect", + "type": "function", + "required": false, + "description": "Callback when template is selected" + } + ], + "render": { + "type": "element", + "template": { + "type": "Card", + "variant": "outlined", + "children": [ + { + "type": "CardHeader", + "title": "Project setup" + }, + { + "type": "CardContent", + "children": [ + { + "type": "Grid", + "container": true, + "spacing": 2, + "children": [ + { + "type": "Grid", + "item": true, + "xs": 6, + "children": [ + { + "type": "TextField", + "label": "Project name", + "placeholder": "nebula-launch", + "fullWidth": true + } + ] + }, + { + "type": "Grid", + "item": true, + "xs": 6, + "children": [ + { + "type": "TextField", + "label": "Package id", + "placeholder": "nebula_launch", + "fullWidth": true + } + ] + }, + { + "type": "Grid", + "item": true, + "xs": 6, + "children": [ + { + "type": "TextField", + "label": "Target runtime", + "placeholder": "web | cli | desktop", + "fullWidth": true + } + ] + }, + { + "type": "Grid", + "item": true, + "xs": 6, + "children": [ + { + "type": "TextField", + "label": "Design tone", + "placeholder": "newsroom · cozy · neon", + "fullWidth": true + } + ] + }, + { + "type": "Grid", + "item": true, + "xs": 12, + "children": [ + { + "type": "TextField", + "label": "Creative brief", + "placeholder": "Describe the product and target audience...", + "multiline": true, + "rows": 3, + "fullWidth": true + } + ] + } + ] + } + ] + } + ] + } + } + }, + { + "id": "package_generator", + "name": "PackageGenerator", + "description": "Generation controls and status display", + "props": [ + { + "name": "progress", + "type": "number", + "required": false, + "default": 0, + "description": "Generation progress percentage" + }, + { + "name": "status", + "type": "string", + "required": false, + "default": "idle", + "description": "Current generation status" + }, + { + "name": "onGenerate", + "type": "function", + "required": false, + "description": "Callback to trigger generation" + }, + { + "name": "onPreview", + "type": "function", + "required": false, + "description": "Callback to preview manifest" + } + ], + "render": { + "type": "element", + "template": { + "type": "Stack", + "direction": "column", + "spacing": 2, + "children": [ + { + "type": "Flex", + "gap": 1, + "flexWrap": "wrap", + "children": [ + { + "type": "Button", + "variant": "contained", + "children": "Generate zip" + }, + { + "type": "Button", + "variant": "outlined", + "children": "Preview manifest" + }, + { + "type": "Button", + "variant": "text", + "children": "Save preset" + } + ] + }, + { + "type": "Card", + "variant": "outlined", + "children": [ + { + "type": "CardHeader", + "title": "Generation plan" + }, + { + "type": "CardContent", + "children": [ + { + "type": "Text", + "variant": "body2", + "component": "pre", + "sx": { "whiteSpace": "pre-wrap" }, + "children": "• Scaffold Next.js app shell\n• Add package metadata + Lua hooks\n• Produce CLI bundle + desktop notes\n• Export a ready-to-ship zip" + } + ] + } + ] + }, + { + "type": "Card", + "variant": "outlined", + "children": [ + { + "type": "CardContent", + "children": [ + { + "type": "Alert", + "severity": "info", + "children": "Queue ready. Waiting on an approved build request." + }, + { + "type": "LinearProgress", + "variant": "determinate", + "value": "{{progress}}", + "sx": { "mt": 2 } + } + ] + } + ] + } + ] + } + } + } + ], + "exports": { + "components": ["CodegenStudio", "TemplateSelector", "PackageGenerator"] + } +} diff --git a/packages/codegen_studio/package.json b/packages/codegen_studio/package.json new file mode 100644 index 000000000..6e03d9461 --- /dev/null +++ b/packages/codegen_studio/package.json @@ -0,0 +1,49 @@ +{ + "$schema": "https://metabuilder.dev/schemas/package-metadata.schema.json", + "packageId": "codegen_studio", + "name": "Codegen Studio", + "version": "1.1.0", + "description": "Generate Next.js, React, CLI starters, and MetaBuilder packages from configurable templates.", + "author": "MetaBuilder", + "license": "MIT", + "category": "tools", + "minLevel": 5, + "primary": true, + "dependencies": {}, + "devDependencies": { + "lua_test": "*" + }, + "exports": { + "components": [ + "CodegenStudio", + "TemplateSelector", + "PackageGenerator" + ], + "scripts": [ + "init", + "blueprint", + "package_template", + "package_template.generator", + "package_template.templates", + "package_template.cli" + ] + }, + "tests": { + "scripts": [ + "tests/metadata.test.lua", + "tests/components.test.lua", + "package_template/tests/generator.test.lua" + ], + "parameterized": [ + { + "parameters": "tests/metadata.cases.json" + }, + { + "parameters": "tests/components.cases.json" + }, + { + "parameters": "package_template/tests/generator.cases.json" + } + ] + } +} diff --git a/packages/codegen_studio/permissions/roles.json b/packages/codegen_studio/permissions/roles.json new file mode 100644 index 000000000..86590f58a --- /dev/null +++ b/packages/codegen_studio/permissions/roles.json @@ -0,0 +1,76 @@ +{ + "$schema": "https://metabuilder.dev/schemas/permissions.schema.json", + "schemaVersion": "1.0.0", + "package": "codegen_studio", + "description": "Codegen Studio access permissions for template viewing, creation, and generation", + "permissions": [ + { + "id": "codegen.templates.view", + "name": "View Templates", + "description": "View available code templates", + "resource": "codegen_templates", + "action": "read", + "scope": "global", + "minLevel": 5 + }, + { + "id": "codegen.templates.create", + "name": "Create Templates", + "description": "Create custom templates", + "resource": "codegen_templates", + "action": "create", + "scope": "global", + "minLevel": 5 + }, + { + "id": "codegen.generate", + "name": "Generate Code", + "description": "Generate code from templates", + "resource": "codegen_output", + "action": "create", + "scope": "global", + "minLevel": 5 + }, + { + "id": "codegen.package.create", + "name": "Create Packages", + "description": "Create new MetaBuilder packages", + "resource": "codegen_packages", + "action": "create", + "scope": "global", + "minLevel": 5 + }, + { + "id": "codegen.package.scaffold", + "name": "Scaffold Packages", + "description": "Generate package scaffolding", + "resource": "codegen_packages", + "action": "scaffold", + "scope": "global", + "minLevel": 5 + } + ], + "resources": [ + { + "id": "codegen_templates", + "name": "Code Templates", + "type": "content", + "description": "Code generation templates", + "actions": ["read", "create", "update", "delete"] + }, + { + "id": "codegen_output", + "name": "Generated Output", + "type": "content", + "description": "Generated code and files", + "actions": ["create", "read", "download"] + }, + { + "id": "codegen_packages", + "name": "Package Scaffolding", + "type": "content", + "description": "MetaBuilder package scaffolding", + "actions": ["create", "scaffold", "read"] + } + ] +} diff --git a/packages/codegen_studio/scripts/functions.json b/packages/codegen_studio/scripts/functions.json new file mode 100644 index 000000000..145538e74 --- /dev/null +++ b/packages/codegen_studio/scripts/functions.json @@ -0,0 +1,120 @@ +{ + "$schema": "https://metabuilder.dev/schemas/json-script.schema.json", + "schemaVersion": "2.2.0", + "package": "codegen_studio", + "description": "Codegen Studio functions for template generation, blueprint creation, and package scaffolding", + "functions": [ + { + "id": "init_on_install", + "name": "onInstall", + "exported": true, + "description": "Initialize Codegen Studio on package install", + "category": "lifecycle", + "luaScript": "init.lua" + }, + { + "id": "init_on_uninstall", + "name": "onUninstall", + "exported": true, + "description": "Clean up Codegen Studio on package uninstall", + "category": "lifecycle", + "luaScript": "init.lua" + }, + { + "id": "blueprint_build", + "name": "buildBlueprint", + "exported": true, + "description": "Build project blueprint from input configuration", + "category": "generation", + "luaScript": "blueprint.lua" + }, + { + "id": "generator_get_default_config", + "name": "getDefaultConfig", + "exported": true, + "description": "Get default package configuration for a given package ID", + "category": "generation", + "luaScript": "package_template/generator.lua" + }, + { + "id": "generator_validate_config", + "name": "validateConfig", + "exported": true, + "description": "Validate package configuration before generation", + "category": "validation", + "luaScript": "package_template/generator.lua" + }, + { + "id": "generator_generate_package", + "name": "generatePackage", + "exported": true, + "description": "Generate complete package from configuration", + "category": "generation", + "luaScript": "package_template/generator.lua" + }, + { + "id": "templates_get_categories", + "name": "getCategories", + "exported": true, + "description": "Get list of available package categories", + "category": "templates", + "luaScript": "package_template/templates.lua" + }, + { + "id": "templates_generate_metadata", + "name": "generateMetadata", + "exported": true, + "description": "Generate metadata.json content from config", + "category": "templates", + "luaScript": "package_template/templates.lua" + }, + { + "id": "templates_generate_permissions", + "name": "generateDefaultPermissions", + "exported": true, + "description": "Generate default permissions based on package config", + "category": "templates", + "luaScript": "package_template/templates.lua" + }, + { + "id": "cli_print_help", + "name": "printHelp", + "exported": true, + "description": "Print CLI usage help", + "category": "cli", + "luaScript": "package_template/cli.lua" + }, + { + "id": "cli_parse_args", + "name": "parseArgs", + "exported": true, + "description": "Parse command line arguments", + "category": "cli", + "luaScript": "package_template/cli.lua" + }, + { + "id": "cli_run", + "name": "runCli", + "exported": true, + "description": "Run CLI command with parsed arguments", + "category": "cli", + "luaScript": "package_template/cli.lua" + } + ], + "exports": { + "functions": [ + "onInstall", + "onUninstall", + "buildBlueprint", + "getDefaultConfig", + "validateConfig", + "generatePackage", + "getCategories", + "generateMetadata", + "generateDefaultPermissions", + "printHelp", + "parseArgs", + "runCli" + ] + } +} diff --git a/packages/codegen_studio/storybook/stories.json b/packages/codegen_studio/storybook/stories.json new file mode 100644 index 000000000..53a9ac780 --- /dev/null +++ b/packages/codegen_studio/storybook/stories.json @@ -0,0 +1,97 @@ +{ + "$schema": "https://metabuilder.dev/schemas/package-storybook.schema.json", + "featured": true, + "title": "Codegen Studio", + "description": "Generate Next.js, React, CLI starters, and MetaBuilder packages from configurable templates", + "stories": [ + { + "name": "CodegenStudio", + "render": "init", + "description": "Main Codegen Studio interface with template selection and generation", + "args": { + "projectName": "my-app", + "runtime": "web" + } + }, + { + "name": "TemplateSelector", + "render": "blueprint", + "description": "Template selection and project configuration form", + "args": { + "project_name": "nebula-launch", + "runtime": "web", + "description": "A modern web application starter" + } + }, + { + "name": "PackageGenerator", + "render": "generator", + "description": "Package generation with progress tracking", + "type": "function", + "args": { + "packageId": "my_package", + "category": "ui" + } + } + ], + "renders": { + "init": { + "description": "Initialize and render main Codegen Studio view", + "featured": true + }, + "blueprint": { + "description": "Build and render project blueprint form" + }, + "generator": { + "description": "Package generation interface with validation" + } + }, + "defaultContext": { + "user": { + "id": "god-user", + "username": "god_user", + "level": 5, + "email": "god@example.com" + }, + "tenant": { + "id": "dev-tenant", + "name": "Development Organization" + } + }, + "contextVariants": [ + { + "name": "God User", + "description": "Full access to all Codegen Studio features", + "context": { + "user": { + "username": "god", + "level": 5 + } + } + }, + { + "name": "Supergod User", + "description": "Complete system access including advanced templates", + "context": { + "user": { + "username": "supergod", + "level": 6 + } + } + } + ], + "scripts": { + "renderFunctions": ["init", "blueprint", "generator"], + "ignoredScripts": ["tests", "types", "permissions", "db", "zip_plan"] + }, + "parameters": { + "layout": "padded", + "backgrounds": { + "default": "light", + "values": [ + { "name": "light", "value": "#f8fafc" }, + { "name": "dark", "value": "#0f172a" } + ] + } + } +} diff --git a/packages/codegen_studio/styles/tokens.json b/packages/codegen_studio/styles/tokens.json new file mode 100644 index 000000000..ab3e5b4c3 --- /dev/null +++ b/packages/codegen_studio/styles/tokens.json @@ -0,0 +1,29 @@ +{ + "$schema": "https://metabuilder.dev/schemas/package-styles.schema.json", + "schemaVersion": "2.0.0", + "colors": { + "templateCard": "#f8fafc", + "templateCardHover": "#e2e8f0", + "templateBadgeNext": "#0070f3", + "templateBadgeReact": "#61dafb", + "templateBadgeCli": "#22c55e", + "progressTrack": "#e2e8f0", + "progressFill": "#3b82f6", + "statusReady": "#22c55e", + "statusPending": "#f59e0b", + "statusError": "#ef4444" + }, + "spacing": { + "studioContainer": "24px", + "cardPadding": "24px", + "cardGap": "16px", + "formGap": "16px", + "sectionGap": "24px", + "badgeGap": "8px" + }, + "shadows": { + "templateCard": "0 1px 3px rgba(0, 0, 0, 0.1)", + "templateCardHover": "0 4px 12px rgba(0, 0, 0, 0.15)", + "actionButton": "0 2px 4px rgba(0, 0, 0, 0.1)" + } +} diff --git a/packages/config_summary/components/ui.json b/packages/config_summary/components/ui.json new file mode 100644 index 000000000..9962ac806 --- /dev/null +++ b/packages/config_summary/components/ui.json @@ -0,0 +1,276 @@ +{ + "$schema": "https://metabuilder.dev/schemas/json-script-components.schema.json", + "schemaVersion": "2.0.0", + "package": "config_summary", + "description": "Configuration summary UI components for displaying system stats and metadata", + "components": [ + { + "id": "config_summary", + "name": "ConfigSummary", + "description": "Card container for configuration summary with header, content table, and optional footer", + "props": [ + { + "name": "title", + "type": "string", + "required": true, + "description": "Summary card title" + }, + { + "name": "rows", + "type": "array", + "required": true, + "description": "Array of summary row data objects" + }, + { + "name": "showFooter", + "type": "boolean", + "required": false, + "default": false, + "description": "Whether to show the footer section" + }, + { + "name": "variant", + "type": "string", + "required": false, + "default": "outlined" + } + ], + "render": { + "type": "element", + "template": { + "type": "Card", + "variant": "{{variant}}", + "className": "config-summary", + "children": [ + { + "type": "Box", + "className": "config-summary-header", + "sx": { + "p": 2, + "borderBottom": 1, + "borderColor": "divider" + }, + "children": [ + { + "type": "Text", + "variant": "h6", + "fontWeight": "bold", + "className": "config-summary-title", + "children": "{{title}}" + } + ] + }, + { + "type": "Box", + "className": "config-summary-content", + "sx": { + "p": 2 + }, + "children": [ + { + "type": "Table", + "size": "small", + "className": "config-summary-table", + "children": [ + { + "type": "TableBody", + "children": "{{rows}}" + } + ] + } + ] + }, + { + "type": "conditional", + "condition": "{{showFooter}}", + "then": { + "type": "Box", + "className": "config-summary-footer", + "sx": { + "p": 1, + "borderTop": 1, + "borderColor": "divider" + }, + "children": [] + } + } + ] + } + } + }, + { + "id": "summary_row", + "name": "SummaryRow", + "description": "Table row displaying a label-value pair in the config summary", + "props": [ + { + "name": "label", + "type": "string", + "required": true, + "description": "Row label text" + }, + { + "name": "value", + "type": "string", + "required": true, + "description": "Row value text" + }, + { + "name": "visible", + "type": "boolean", + "required": false, + "default": true, + "description": "Whether the row is visible" + } + ], + "render": { + "type": "element", + "template": { + "type": "conditional", + "condition": "{{visible}}", + "then": { + "type": "TableRow", + "className": "summary-row", + "children": [ + { + "type": "TableCell", + "className": "summary-row-label-cell", + "sx": { + "fontWeight": "medium", + "color": "text.secondary", + "width": "40%", + "py": 1 + }, + "children": [ + { + "type": "Text", + "variant": "body2", + "className": "summary-row-label", + "children": "{{label}}" + } + ] + }, + { + "type": "TableCell", + "className": "summary-row-value-cell", + "sx": { + "py": 1 + }, + "children": [ + { + "type": "Text", + "variant": "body2", + "fontWeight": "medium", + "className": "summary-row-value", + "children": "{{value}}" + } + ] + } + ] + } + } + } + }, + { + "id": "summary_row_inline", + "name": "SummaryRowInline", + "description": "Inline flex row displaying a label-value pair (non-table variant)", + "props": [ + { + "name": "label", + "type": "string", + "required": true, + "description": "Row label text" + }, + { + "name": "value", + "type": "string", + "required": true, + "description": "Row value text" + } + ], + "render": { + "type": "element", + "template": { + "type": "Box", + "className": "summary-row-inline", + "sx": { + "display": "flex", + "justifyContent": "space-between", + "alignItems": "center", + "py": 1 + }, + "children": [ + { + "type": "Text", + "variant": "body2", + "color": "text.secondary", + "className": "summary-row-inline-label", + "children": "{{label}}" + }, + { + "type": "Text", + "variant": "body2", + "fontWeight": "medium", + "className": "summary-row-inline-value", + "children": "{{value}}" + } + ] + } + } + }, + { + "id": "summary_divider", + "name": "SummaryDivider", + "description": "Divider component for separating summary sections", + "props": [ + { + "name": "spacing", + "type": "number", + "required": false, + "default": 1, + "description": "Vertical margin in theme spacing units" + } + ], + "render": { + "type": "element", + "template": { + "type": "Divider", + "className": "summary-divider", + "sx": { + "my": "{{spacing}}" + } + } + } + }, + { + "id": "config_summary_stack", + "name": "ConfigSummaryStack", + "description": "Vertical stack container for multiple config summary cards", + "props": [ + { + "name": "children", + "type": "any", + "required": true + }, + { + "name": "spacing", + "type": "number", + "default": 2 + } + ], + "render": { + "type": "element", + "template": { + "type": "Stack", + "spacing": "{{spacing}}", + "className": "config-summary-stack", + "children": "{{children}}" + } + } + } + ], + "exports": { + "components": ["ConfigSummary", "SummaryRow", "SummaryRowInline", "SummaryDivider", "ConfigSummaryStack"] + } +} diff --git a/packages/config_summary/package.json b/packages/config_summary/package.json new file mode 100644 index 000000000..38b096ccc --- /dev/null +++ b/packages/config_summary/package.json @@ -0,0 +1,39 @@ +{ + "$schema": "https://metabuilder.dev/schemas/package-metadata.schema.json", + "packageId": "config_summary", + "name": "Config Summary", + "version": "1.0.0", + "description": "Configuration summary panels for displaying system stats and metadata", + "author": "MetaBuilder", + "license": "MIT", + "category": "ui", + "minLevel": 4, + "primary": false, + "dependencies": {}, + "devDependencies": { + "lua_test": "*" + }, + "exports": { + "components": [ + "ConfigSummary", + "SummaryRow", + "SummaryRowInline", + "SummaryDivider" + ], + "scripts": [ + "summary", + "aggregators" + ] + }, + "tests": { + "scripts": [ + "tests/summary.test.lua", + "tests/aggregators.test.lua" + ], + "parameterized": [ + { + "parameters": "tests/config.cases.json" + } + ] + } +} diff --git a/packages/config_summary/permissions/roles.json b/packages/config_summary/permissions/roles.json new file mode 100644 index 000000000..7ce897e5b --- /dev/null +++ b/packages/config_summary/permissions/roles.json @@ -0,0 +1,44 @@ +{ + "$schema": "https://metabuilder.dev/schemas/permissions.schema.json", + "schemaVersion": "1.0.0", + "package": "config_summary", + "description": "Configuration summary access permissions", + "permissions": [ + { + "id": "config.summary.view", + "name": "View Configuration Summary", + "description": "View configuration summaries", + "resource": "config_summary", + "action": "read", + "scope": "global", + "minLevel": 4 + }, + { + "id": "config.summary.export", + "name": "Export Configuration Data", + "description": "Export configuration data from summaries", + "resource": "config_summary", + "action": "export", + "scope": "global", + "minLevel": 4 + }, + { + "id": "config.summary.configure", + "name": "Configure Summary Display", + "description": "Configure which data appears in configuration summaries", + "resource": "config_summary", + "action": "configure", + "scope": "global", + "minLevel": 5 + } + ], + "resources": [ + { + "id": "config_summary", + "name": "Configuration Summary", + "type": "ui", + "description": "Configuration summary panel resources", + "actions": ["read", "export", "configure"] + } + ] +} diff --git a/packages/config_summary/scripts/functions.json b/packages/config_summary/scripts/functions.json new file mode 100644 index 000000000..ae291c769 --- /dev/null +++ b/packages/config_summary/scripts/functions.json @@ -0,0 +1,111 @@ +{ + "$schema": "https://metabuilder.dev/schemas/json-script.schema.json", + "schemaVersion": "2.2.0", + "package": "config_summary", + "description": "Configuration summary generation and aggregation functions", + "functions": [ + { + "id": "summary_get_wrapper_class", + "name": "getWrapperClass", + "exported": true, + "description": "Get the default wrapper CSS class for summaries", + "category": "styling", + "luaScript": "summary/init.lua" + }, + { + "id": "summary_get_title_class", + "name": "getTitleClass", + "exported": true, + "description": "Get the default title CSS class for summaries", + "category": "styling", + "luaScript": "summary/init.lua" + }, + { + "id": "summary_get_grid_class", + "name": "getGridClass", + "exported": true, + "description": "Get the default grid CSS class for summaries", + "category": "styling", + "luaScript": "summary/init.lua" + }, + { + "id": "summary_get_row_class", + "name": "getRowClass", + "exported": true, + "description": "Get the default row CSS class for summaries", + "category": "styling", + "luaScript": "summary/init.lua" + }, + { + "id": "summary_get_label_class", + "name": "getLabelClass", + "exported": true, + "description": "Get the default label CSS class for summaries", + "category": "styling", + "luaScript": "summary/init.lua" + }, + { + "id": "summary_get_value_class", + "name": "getValueClass", + "exported": true, + "description": "Get the default value CSS class for summaries", + "category": "styling", + "luaScript": "summary/init.lua" + }, + { + "id": "summary_filter_visible_rows", + "name": "filterVisibleRows", + "exported": true, + "description": "Filter summary rows to only return visible ones", + "category": "data", + "luaScript": "summary/init.lua" + }, + { + "id": "summary_format_value", + "name": "formatValue", + "exported": true, + "description": "Format a value for display in the summary", + "category": "formatting", + "luaScript": "summary/init.lua" + }, + { + "id": "aggregator_render", + "name": "render", + "exported": true, + "description": "Render a summary configuration into a UI component", + "category": "rendering", + "luaScript": "aggregators.lua" + }, + { + "id": "aggregator_aggregate", + "name": "aggregate", + "exported": true, + "description": "Generate summary configurations from aggregate config data", + "category": "aggregation", + "luaScript": "aggregators.lua" + }, + { + "id": "aggregator_render_all", + "name": "renderAll", + "exported": true, + "description": "Render all summary configurations into UI components", + "category": "rendering", + "luaScript": "aggregators.lua" + } + ], + "exports": { + "functions": [ + "getWrapperClass", + "getTitleClass", + "getGridClass", + "getRowClass", + "getLabelClass", + "getValueClass", + "filterVisibleRows", + "formatValue", + "render", + "aggregate", + "renderAll" + ] + } +} diff --git a/packages/config_summary/storybook/stories.json b/packages/config_summary/storybook/stories.json new file mode 100644 index 000000000..f5c9d0107 --- /dev/null +++ b/packages/config_summary/storybook/stories.json @@ -0,0 +1,113 @@ +{ + "$schema": "https://metabuilder.dev/schemas/package-storybook.schema.json", + "featured": false, + "title": "Config Summary Components", + "description": "Configuration summary panels for displaying system stats and metadata", + "stories": [ + { + "name": "ConfigSummary", + "render": "summary", + "description": "Basic configuration summary card with label-value pairs", + "args": { + "title": "System Configuration", + "rows": [ + { "label": "Version", "value": "1.0.0" }, + { "label": "Environment", "value": "Production" }, + { "label": "Database", "value": "PostgreSQL 15" }, + { "label": "Cache", "value": "Redis 7.2" } + ] + } + }, + { + "name": "SummaryWithHiddenRows", + "render": "summary", + "description": "Summary with some rows hidden via visible flag", + "args": { + "title": "Filtered Configuration", + "rows": [ + { "label": "Public Setting", "value": "Visible", "visible": true }, + { "label": "Secret Key", "value": "****", "visible": false }, + { "label": "API Endpoint", "value": "https://api.example.com" } + ] + } + }, + { + "name": "InlineSummaryRows", + "render": "inline", + "description": "Inline flex-based summary rows (non-table variant)", + "args": { + "rows": [ + { "label": "Total Users", "value": "1,234" }, + { "label": "Active Sessions", "value": "42" }, + { "label": "Uptime", "value": "99.9%" } + ] + } + }, + { + "name": "AggregatedSummary", + "render": "aggregate", + "description": "Multiple summary cards generated from aggregate config data", + "type": "function" + } + ], + "renders": { + "summary": { + "description": "Single config summary card with table layout", + "featured": true + }, + "inline": { + "description": "Inline summary rows with flex layout" + }, + "aggregate": { + "description": "Aggregated summaries from multiple config sources" + } + }, + "defaultContext": { + "user": { + "id": "admin-user", + "username": "admin", + "level": 4, + "email": "admin@example.com" + }, + "tenant": { + "id": "demo-tenant", + "name": "Demo Organization" + } + }, + "contextVariants": [ + { + "name": "Admin User", + "description": "Can view configuration summaries", + "context": { + "user": { + "username": "admin", + "level": 4 + } + } + }, + { + "name": "God User", + "description": "Can view and configure summaries", + "context": { + "user": { + "username": "god", + "level": 5 + } + } + } + ], + "scripts": { + "renderFunctions": ["summary", "inline", "aggregate"], + "ignoredScripts": ["tests"] + }, + "parameters": { + "layout": "padded", + "backgrounds": { + "default": "light", + "values": [ + { "name": "light", "value": "#f8f9fa" }, + { "name": "dark", "value": "#212529" } + ] + } + } +} diff --git a/packages/config_summary/styles/tokens.json b/packages/config_summary/styles/tokens.json new file mode 100644 index 000000000..030a21d2a --- /dev/null +++ b/packages/config_summary/styles/tokens.json @@ -0,0 +1,36 @@ +{ + "$schema": "https://metabuilder.dev/schemas/package-styles.schema.json", + "schemaVersion": "2.0.0", + "colors": { + "summaryBorder": "#dee2e6", + "labelText": "#6c757d", + "valueText": "#212529", + "headerBackground": "rgba(0, 0, 0, 0.02)", + "rowHover": "rgba(0, 0, 0, 0.04)", + "divider": "#e9ecef" + }, + "spacing": { + "cardPadding": "16px", + "headerPadding": "12px 16px", + "rowPadding": "8px 0", + "labelWidth": "40%", + "gridGap": "8px", + "stackGap": "16px" + }, + "shadows": { + "card": "0 1px 3px rgba(0, 0, 0, 0.08)", + "cardHover": "0 2px 6px rgba(0, 0, 0, 0.12)" + }, + "typography": { + "titleSize": "1rem", + "titleWeight": "600", + "labelSize": "0.875rem", + "labelWeight": "500", + "valueSize": "0.875rem", + "valueWeight": "600" + }, + "borderRadius": { + "card": "8px", + "row": "4px" + } +}