Add seed configuration and initial package definitions

- Created .gitignore to exclude log and cache files.
- Added INDEX.md for quick reference of seed files and their purposes.
- Introduced README.md detailing the seed package system and usage.
- Established bootstrap.yaml for package system initialization configuration.
- Defined package-repo.yaml for package repository settings and conflict resolution.
- Created installed_packages.yaml for initial records of installed packages.
- Added package_permissions.yaml for default permissions in the system.
- Defined core-packages.yaml for essential packages to be auto-installed during bootstrap.
This commit is contained in:
2026-01-03 19:24:59 +00:00
parent c603784d44
commit 814dc5a9e0
8 changed files with 1564 additions and 0 deletions

9
seed/.gitignore vendored Normal file
View File

@@ -0,0 +1,9 @@
# Ignore log files
logs/*.log
logs/*.json
# Ignore cache
.cache/
# Keep directory structure
!logs/.gitkeep

272
seed/INDEX.md Normal file
View File

@@ -0,0 +1,272 @@
# Seed Directory Index
Quick reference for all seed files and their purposes.
## File Structure
```
seed/
├── README.md # Main documentation
├── INDEX.md # This file - quick reference
├── .gitignore # Git ignore rules for logs/cache
├── packages/ # Package manifests
│ └── core-packages.yaml # Core packages to auto-install
├── database/ # DBAL-format database seeds
│ ├── installed_packages.yaml # InstalledPackage table records
│ └── package_permissions.yaml # PackagePermission table records
├── config/ # Bootstrap configuration
│ ├── bootstrap.yaml # Bootstrap behavior and phases
│ └── package-repo.yaml # Package source and validation config
└── logs/ # Bootstrap execution logs
└── .gitkeep # Keep directory in git
```
## Quick Links
| File | Purpose | Lines | Key Sections |
|------|---------|-------|--------------|
| [README.md](README.md) | Main documentation | ~400 | Usage, integration, troubleshooting |
| [packages/core-packages.yaml](packages/core-packages.yaml) | Package definitions | ~150 | packages, recommended, development, bootstrap_order |
| [database/installed_packages.yaml](database/installed_packages.yaml) | Package install records | ~130 | records (11 packages) |
| [database/package_permissions.yaml](database/package_permissions.yaml) | Package ACL records | ~200 | records (~20 permissions), permission_levels |
| [config/bootstrap.yaml](config/bootstrap.yaml) | Bootstrap config | ~170 | bootstrap, phases, database, hooks, environments |
| [config/package-repo.yaml](config/package-repo.yaml) | Repository config | ~250 | sources, discovery, validation, conflicts, security |
## Usage Cheat Sheet
### Bootstrap Commands (DBAL CLI)
```bash
# Full bootstrap
dbal bootstrap --config seed/config/bootstrap.yaml
# Dry run
dbal bootstrap --dry-run
# Production mode
dbal bootstrap --env production
# Development with verbose output
dbal bootstrap --env development --verbose
```
### Seed Database
```bash
# Seed all
dbal seed --dir seed/database
# Seed specific table
dbal seed seed/database/installed_packages.yaml
dbal seed seed/database/package_permissions.yaml
# Force re-seed
dbal seed --force
```
### Validation
```bash
# Validate all seed files
dbal validate --dir seed
# Validate packages
dbal validate seed/packages/core-packages.yaml
# Check schema compatibility
dbal validate-schema seed/database/*.yaml
```
## File Details
### packages/core-packages.yaml
**11 Core Packages:**
1. package_manager (priority 1) - Required
2. ui_header, ui_footer, ui_auth, ui_login (priority 2) - Required
3. dashboard (priority 3) - Required
4. user_manager, role_editor (priority 4) - Required
5. admin_dialog (priority 5) - Optional
6. database_manager, schema_editor (priority 6) - Optional
**6 Recommended Packages:**
- notification_center, audit_log, data_table, form_builder, quick_guide
**5 Development Packages:**
- testing, package_validator, component_editor, theme_editor, code_editor
### database/installed_packages.yaml
**Fields per record:**
- packageId (PK)
- tenantId (null = system-wide)
- installedAt (0 = use current timestamp)
- version (semver)
- enabled (boolean)
- config (JSON string with package settings)
**Special config flags:**
- systemPackage: true → Cannot uninstall
- uninstallProtection: true → Extra confirmation required
- minLevel: 4-5 → Permission level requirement
- dangerousOperations: true → Can modify system
### database/package_permissions.yaml
**Permission levels:**
- 0: public → ui_auth, ui_login
- 1: user → ui_header, ui_footer, dashboard
- 3: admin → user_manager
- 4: god → package_manager, role_editor
- 5: supergod → database_manager, schema_editor
**Permission types:**
- read → View/access
- write → Modify data
- execute → Run scripts
- admin → Full control
### config/bootstrap.yaml
**6 Installation Phases:**
1. Core System (package_manager)
2. Base UI (ui components)
3. Essential Features (dashboard)
4. Administration (user/role management)
5. Admin Tools (database/schema tools)
6. Recommended (optional packages)
7. Development (dev-only tools)
**Hooks:**
- preBootstrap → Before start
- postBootstrap → After success (runs validate-schema, verify-packages)
- onError → On failure (runs rollback-seed)
- prePhase/postPhase → Around each phase
**Environment configs:**
- development → Verbose, include dev tools
- production → Strict validation, exclude dev tools
- test → Always re-seed, use transactions
### config/package-repo.yaml
**Sources:**
- local (/packages, priority 0)
- Future: remote registries, git repos
**Validation:**
- Required fields: packageId, name, version, description, author, license
- packageId pattern: ^[a-z][a-z0-9_]*$ (snake_case)
- Version format: semver
- Schema: https://metabuilder.dev/schemas/package-metadata.schema.json
**Conflict resolution:**
- Strategy: priority (lowest priority number wins)
- Duplicate versions: newest
**Security:**
- Sandbox package scripts
- Disallow: eval, Function, require, import
- Trust only: local source
## Integration Points
### Database Schema
- [prisma/schema.prisma:327](../prisma/schema.prisma#L327) → InstalledPackage
- [prisma/schema.prisma:1637](../prisma/schema.prisma#L1637) → PackagePermission
### DBAL Schema
- [dbal/shared/api/schema/entities/core/package.yaml](../dbal/shared/api/schema/entities/core/package.yaml)
### Frontend Integration
- [frontends/nextjs/src/lib/db/packages](../frontends/nextjs/src/lib/db/packages) → CRUD
- [frontends/nextjs/src/lib/packages](../frontends/nextjs/src/lib/packages) → Loading
### Package Sources
- [packages/](../packages/) → Local package directory
## Modification Guide
### Add a Core Package
1. Add to [packages/core-packages.yaml](packages/core-packages.yaml):
```yaml
- packageId: my_package
version: "1.0.0"
enabled: true
priority: 10
required: false
```
2. Add to [database/installed_packages.yaml](database/installed_packages.yaml):
```yaml
- packageId: my_package
tenantId: null
installedAt: 0
version: "1.0.0"
enabled: true
config: |
{
"systemPackage": false
}
```
3. Add to [database/package_permissions.yaml](database/package_permissions.yaml):
```yaml
- id: perm_my_package_user_read
packageId: my_package
role: user
permission: read
granted: true
```
### Add a Bootstrap Phase
Edit [config/bootstrap.yaml](config/bootstrap.yaml):
```yaml
phases:
- id: 8
name: "Custom Phase"
required: false
packages:
source: core-packages.yaml
filter: priority=100
```
### Add a Package Source
Edit [config/package-repo.yaml](config/package-repo.yaml):
```yaml
sources:
- id: custom-source
name: "Custom Packages"
type: git
url: https://github.com/org/packages.git
priority: 10
enabled: true
```
## Logs
Bootstrap logs are written to:
- `logs/bootstrap.log` - Main execution log
- Format: JSON (structured logging)
- Retention: 30 days (configurable in bootstrap.yaml)
Log levels:
- `debug` - Verbose debugging
- `info` - Normal operations (default)
- `warn` - Warnings and non-critical issues
- `error` - Failures and critical problems
---
**Last Updated:** 2026-01-03
**Bootstrap Version:** 1.0
**Generated with Claude Code**

392
seed/README.md Normal file
View File

@@ -0,0 +1,392 @@
# Seed - Package System Bootstrap
This directory contains seed data and configuration for bootstrapping the MetaBuilder package system.
## Directory Structure
```
seed/
├── packages/ # Package installation manifests
│ └── core-packages.yaml
├── database/ # Database seed data (DBAL format)
│ ├── installed_packages.yaml
│ └── package_permissions.yaml
├── config/ # System configuration
│ ├── bootstrap.yaml
│ └── package-repo.yaml
└── README.md
```
## Purpose
The seed system provides:
1. **Core Package Definitions** - Which packages to auto-install on first boot
2. **Database Seeds** - Initial records for `InstalledPackage` and `PackagePermission` tables
3. **Bootstrap Configuration** - How the package system initializes
4. **Repository Configuration** - Where packages are loaded from and how conflicts are resolved
## Files
### packages/core-packages.yaml
Defines the packages that should be automatically installed during system bootstrap.
**Categories:**
- **packages** - Core required packages (package_manager, ui components, dashboard, etc.)
- **recommended** - Optional but recommended packages (notifications, audit log, etc.)
- **development** - Dev-only tools (testing framework, validators, editors)
**Fields:**
- `packageId` - Unique package identifier (snake_case)
- `version` - Semantic version (e.g., "1.0.0")
- `enabled` - Whether package is active by default
- `priority` - Installation order (lower = earlier)
- `required` - Whether bootstrap fails if this package can't be installed
**Bootstrap Phases:**
1. Core System (package_manager)
2. Base UI (header, footer, auth, login)
3. Essential Features (dashboard)
4. Administration (user_manager, role_editor)
5. Admin Tools (database_manager, schema_editor)
6. Recommended Packages (optional)
### database/installed_packages.yaml
Seed data for the `InstalledPackage` table matching the Prisma schema at [prisma/schema.prisma:327](prisma/schema.prisma#L327).
**Fields:**
- `packageId` - Unique identifier (primary key)
- `tenantId` - Tenant isolation (null = system-wide)
- `installedAt` - Timestamp (0 = use current time)
- `version` - Package version
- `enabled` - Whether package is active
- `config` - JSON configuration specific to each package
**Special Flags:**
- `systemPackage: true` - Core packages that cannot be uninstalled
- `uninstallProtection: true` - Prevents accidental removal
- `minLevel` - Minimum permission level to access (1-5)
- `dangerousOperations: true` - Packages that can modify system
### database/package_permissions.yaml
Seed data for the `PackagePermission` table matching [prisma/schema.prisma:1637](prisma/schema.prisma#L1637).
**Permission Levels (MetaBuilder 6-level system):**
- 0: `public` - Unauthenticated users
- 1: `user` - Authenticated users
- 2: `moderator` - Content moderators
- 3: `admin` - Tenant administrators
- 4: `god` - System administrators
- 5: `supergod` - Super administrators
**Permission Types:**
- `read` - View/access package features
- `write` - Modify package data
- `execute` - Execute package scripts
- `admin` - Full package administration
**Default Permissions:**
- UI packages (header, footer, login) → `public` or `user` level
- Dashboard → `user` level
- User management → `admin` level
- Package management → `god` level
- Database/schema tools → `supergod` only
### config/bootstrap.yaml
Controls how the package system initializes.
**Key Sections:**
**bootstrap:**
- `mode` - auto | manual | interactive
- `failOnError` - Continue if optional packages fail
- `validatePackages` - Verify package.json before installing
- `skipBrokenPackages` - Skip invalid packages
**phases:**
Defines installation phases that map to core-packages.yaml priorities.
**database:**
- `seedFiles` - YAML files to load into database
- `skipIfPopulated` - Don't re-seed existing data
- `useTransactions` - Rollback on failure
**hooks:**
DBAL CLI commands to run at various stages:
- `preBootstrap` - Before any operations
- `postBootstrap` - After successful completion
- `onError` - If bootstrap fails
- `prePhase/postPhase` - Around each installation phase
**Environment Overrides:**
- `development` - Verbose logging, include dev tools
- `production` - Fail on errors, exclude dev tools
- `test` - Always re-seed, use transactions
### config/package-repo.yaml
Package repository configuration.
**Key Sections:**
**sources:**
Where to load packages from (priority order):
- `local` - /packages directory (priority 0)
- Future: remote registries, git repositories
**discovery:**
- `scanPatterns` - Glob patterns to find packages
- `excludePatterns` - Directories to ignore
- `maxConcurrent` - Parallel discovery limit
**validation:**
- `requiredFields` - Must be present in package.json
- `schemaUrl` - JSON schema for validation
- `packageIdPattern` - Regex for valid IDs (snake_case)
**dependencies:**
- `missingDependencies` - error | warn | ignore
- `detectCircular` - Find circular dependency chains
**conflicts:**
- `strategy: priority` - Use lowest-priority source
- `duplicateVersions: newest` - Pick latest version
**security:**
- `sandboxPackageScripts` - Isolate package code
- `disallowedPatterns` - Prevent dangerous code
## Usage
### Bootstrap with DBAL CLI
```bash
# Run bootstrap process
dbal bootstrap --config seed/config/bootstrap.yaml
# Dry run (simulate without changes)
dbal bootstrap --dry-run
# Interactive mode
dbal bootstrap --interactive
# Specific environment
dbal bootstrap --env production
```
### Seed Database Only
```bash
# Seed all database files
dbal seed --dir seed/database
# Seed specific file
dbal seed seed/database/installed_packages.yaml
# Force re-seed (ignore skipIfExists)
dbal seed --force
```
### Validate Configuration
```bash
# Validate all seed files
dbal validate --dir seed
# Validate package definitions
dbal validate seed/packages/core-packages.yaml
# Check database seeds against schema
dbal validate-schema seed/database/*.yaml
```
### Install Specific Packages
```bash
# Install core packages only
dbal install-packages --manifest seed/packages/core-packages.yaml --filter priority=1-3
# Install recommended packages
dbal install-packages --manifest seed/packages/core-packages.yaml --filter section=recommended
# Install development tools
dbal install-packages --manifest seed/packages/core-packages.yaml --filter section=development
```
## Bootstrap Process Flow
1. **Pre-bootstrap hooks** - Run preparation commands
2. **Validate configuration** - Check seed files and package definitions
3. **Phase 1: Core System**
- Install package_manager
- Seed database records
- Verify installation
4. **Phase 2: Base UI**
- Install ui_header, ui_footer, ui_auth, ui_login
- Set up permissions
5. **Phase 3-5: Features & Admin**
- Install dashboard, user management, admin tools
6. **Phase 6: Recommended** (optional)
- Install notification_center, audit_log, etc.
7. **Phase 7: Development** (dev only)
- Install testing, validators, editors
8. **Post-bootstrap hooks** - Verification and cleanup
9. **Logging** - Record installation to logs/bootstrap.log
## Integration with Existing System
### Frontend Integration
The bootstrap system integrates with:
- [frontends/nextjs/src/lib/db/packages](frontends/nextjs/src/lib/db/packages) - Package CRUD operations
- [frontends/nextjs/src/lib/packages](frontends/nextjs/src/lib/packages) - Package loading and discovery
### DBAL Integration
Seed files use DBAL entity schemas:
- [dbal/shared/api/schema/entities/core/package.yaml](dbal/shared/api/schema/entities/core/package.yaml)
- Package CRUD operations in [dbal/development/src/core/entities/package](dbal/development/src/core/entities/package)
### Database Schema
Seed data matches Prisma schema:
- [prisma/schema.prisma:327](prisma/schema.prisma#L327) - `InstalledPackage` model
- [prisma/schema.prisma:1637](prisma/schema.prisma#L1637) - `PackagePermission` model
## Customization
### Adding Custom Packages to Bootstrap
1. Edit [seed/packages/core-packages.yaml](seed/packages/core-packages.yaml):
```yaml
packages:
- packageId: my_custom_package
version: "1.0.0"
enabled: true
priority: 10
required: false
description: "My custom functionality"
```
2. Add database seed in [seed/database/installed_packages.yaml](seed/database/installed_packages.yaml):
```yaml
records:
- packageId: my_custom_package
tenantId: null
installedAt: 0
version: "1.0.0"
enabled: true
config: |
{
"customSetting": "value"
}
```
3. Add permissions in [seed/database/package_permissions.yaml](seed/database/package_permissions.yaml):
```yaml
records:
- id: perm_my_custom_user_read
packageId: my_custom_package
role: user
permission: read
granted: true
```
### Environment-Specific Bootstrapping
Modify [seed/config/bootstrap.yaml](seed/config/bootstrap.yaml):
```yaml
environments:
staging:
bootstrap:
verbose: true
failOnError: false
phases:
- id: 7
enabled: true # Include dev tools in staging
```
### Custom Package Sources
Edit [seed/config/package-repo.yaml](seed/config/package-repo.yaml):
```yaml
sources:
- id: company-packages
name: "Company Private Packages"
type: git
url: https://github.com/company/metabuilder-packages.git
priority: 5
enabled: true
```
## Troubleshooting
### Bootstrap Fails
Check logs:
```bash
cat logs/bootstrap.log
```
Common issues:
- Missing package directories → Verify /packages exists
- Database connection → Check DBAL daemon is running
- Permission denied → Ensure user has supergod role
- Version conflicts → Check package versions in core-packages.yaml
### Package Not Installing
```bash
# Validate package
dbal validate packages/my_package/package.json
# Check for errors
dbal install-package my_package --verbose
# Verify dependencies
dbal check-dependencies my_package
```
### Re-running Bootstrap
Bootstrap is idempotent with `skipIfPopulated: true`. To force re-bootstrap:
```bash
# Clear package data
dbal seed --force seed/database/installed_packages.yaml
# Re-run bootstrap
dbal bootstrap --force
```
## Future Enhancements
- [ ] Remote package registry support
- [ ] Package signing and verification
- [ ] Automatic dependency resolution
- [ ] Package update notifications
- [ ] Rollback capabilities
- [ ] Multi-environment sync
- [ ] Package health checks
- [ ] Usage analytics
## See Also
- [Main README](../README.md) - Project overview
- [Package System Documentation](../README.md#package-system) - Package architecture
- [DBAL Documentation](../dbal/README.md) - Database layer
- [Package Schema Examples](../schemas/package-schemas/examples/README.md) - Package examples
- [6-Level Permission System](../README.md#6-level-permission-system) - Access control
---
**Generated with Claude Code**

179
seed/config/bootstrap.yaml Normal file
View File

@@ -0,0 +1,179 @@
# Bootstrap Configuration
# Controls how the package system initializes
version: "1.0"
description: "Bootstrap configuration for MetaBuilder package system initialization"
bootstrap:
# Execution mode
mode: auto # auto | manual | interactive
# Behavior flags
failOnError: false # Continue installing optional packages even if some fail
verbose: true # Detailed logging during bootstrap
dryRun: false # Simulate without making changes
# Validation
validatePackages: true # Verify package.json exists before installing
validateDependencies: true # Check package dependencies
skipBrokenPackages: true # Skip packages with validation errors
# Timing
retryAttempts: 3
retryDelayMs: 1000
timeoutMs: 30000 # Per-package timeout
# Package source configuration
sources:
# Local package directory
local:
enabled: true
path: ./packages
priority: 0
description: "Local packages in /packages directory"
# Future: Remote package registry
# registry:
# enabled: false
# url: https://packages.metabuilder.dev
# priority: 1
# authentication: false
# Installation phases
phases:
- id: 1
name: "Core System"
description: "Essential system packages - installation cannot proceed without these"
required: true
packages:
source: core-packages.yaml
filter: priority=1
- id: 2
name: "Base UI"
description: "User interface foundation packages"
required: true
packages:
source: core-packages.yaml
filter: priority=2
- id: 3
name: "Essential Features"
description: "Core application features"
required: true
packages:
source: core-packages.yaml
filter: priority=3
- id: 4
name: "Administration"
description: "User and role management"
required: true
packages:
source: core-packages.yaml
filter: priority=4
- id: 5
name: "Admin Tools"
description: "Advanced administration tools"
required: false
packages:
source: core-packages.yaml
filter: priority=5-6
- id: 6
name: "Recommended"
description: "Recommended optional packages"
required: false
packages:
source: core-packages.yaml
filter: section=recommended
- id: 7
name: "Development Tools"
description: "Development and debugging packages (dev environments only)"
required: false
packages:
source: core-packages.yaml
filter: section=development
conditions:
- NODE_ENV=development
# Database seeding
database:
# Seed in order - later seeds may depend on earlier ones
seedFiles:
- database/installed_packages.yaml
- database/package_permissions.yaml
# Behavior
skipIfPopulated: true # Don't re-seed if InstalledPackage table has records
useTransactions: true # Rollback all changes if any seed fails
validateSchema: true # Verify entities match DBAL schema
# Hooks - DBAL CLI commands to run at various stages
hooks:
preBootstrap:
description: "Run before any bootstrap operations"
commands: []
postBootstrap:
description: "Run after successful bootstrap"
commands:
- dbal validate-schema
- dbal verify-packages
onError:
description: "Run if bootstrap fails"
commands:
- dbal rollback-seed
prePhase:
description: "Run before each installation phase"
commands: []
postPhase:
description: "Run after each installation phase"
commands:
- dbal verify-phase-integrity
# Logging
logging:
level: info # debug | info | warn | error
file: logs/bootstrap.log
console: true
structured: true # JSON-formatted logs
# Environment-specific overrides
environments:
development:
bootstrap:
verbose: true
failOnError: false
phases:
- id: 7
enabled: true # Include development tools
production:
bootstrap:
verbose: false
failOnError: true
validatePackages: true
validateDependencies: true
phases:
- id: 7
enabled: false # Exclude development tools
test:
bootstrap:
dryRun: false
skipIfPopulated: false # Always re-seed in tests
database:
skipIfPopulated: false
useTransactions: true
# Cleanup
cleanup:
removeOrphanedPackageData: false # Don't auto-delete PackageData for uninstalled packages
archiveOldVersions: false # Keep old package version records
cleanupLogs: true
logRetentionDays: 30

View File

@@ -0,0 +1,211 @@
# Package Repository Configuration
# Defines where packages are loaded from and conflict resolution
version: "1.0"
description: "Package repository configuration for MetaBuilder"
# Conflict resolution strategy
conflictResolution: priority # priority | newest | manual
# Package sources (checked in priority order)
sources:
- id: local
name: "Local Packages"
type: local
url: /packages
priority: 0
enabled: true
description: "Packages in the local /packages directory"
# Validation
validation:
requirePackageJson: true
requireValidStructure: true
allowedCategories: null # null = all categories allowed
# Caching
cache:
enabled: true
ttlSeconds: 3600 # Re-scan every hour
invalidateOnFileChange: true
# Example: Future remote registry
# - id: official-registry
# name: "Official MetaBuilder Registry"
# type: remote
# url: https://packages.metabuilder.dev
# priority: 10
# enabled: false
# authentication:
# type: bearer
# tokenEnv: METABUILDER_REGISTRY_TOKEN
# cache:
# enabled: true
# ttlSeconds: 86400
# Example: Git repository source
# - id: community-packages
# name: "Community Packages"
# type: git
# url: https://github.com/metabuilder/community-packages.git
# branch: main
# path: packages
# priority: 20
# enabled: false
# updateOnBoot: false
# Package discovery
discovery:
# How to find packages in local sources
scanPatterns:
- "*/package.json"
- "packages/*/package.json"
excludePatterns:
- "**/node_modules/**"
- "**/dist/**"
- "**/build/**"
- "**/.git/**"
- "**/tests/**"
- "**/examples/**"
# Parallel processing
maxConcurrent: 10
# Package validation rules
validation:
# Required fields in package.json
requiredFields:
- packageId
- name
- version
- description
- author
- license
# Schema validation
schemaUrl: "https://metabuilder.dev/schemas/package-metadata.schema.json"
enforceSchema: true
# Version validation
versionFormat: semver # Enforce semantic versioning
# Naming rules
packageIdPattern: "^[a-z][a-z0-9_]*$" # snake_case, starts with letter
maxPackageIdLength: 64
# Dependency resolution
dependencies:
# How to handle missing dependencies
missingDependencies: warn # error | warn | ignore
# Version constraints
allowVersionRanges: true # Support ^1.0.0, ~2.1.0, etc.
# Circular dependency detection
detectCircular: true
circularDependencies: error # error | warn | ignore
# Conflict handling
conflicts:
# What to do when multiple sources provide same packageId
strategy: priority # Use source with lowest priority number
# Handling duplicate packageIds with different versions
duplicateVersions: newest # newest | oldest | highest-priority-source
# Allow override by source priority
allowOverride: true
# Caching
cache:
enabled: true
directory: .cache/packages
# Cache invalidation
invalidateOn:
- fileChange
- configChange
- dailySchedule
# Cache key strategy
keyStrategy: content-hash # content-hash | timestamp | version
# Performance
performance:
# Lazy loading
lazyLoad: true # Don't load package contents until needed
# Pre-loading
preloadCorePackages: true
corePackagesList: packages/core-packages.yaml
# Parallel operations
parallelValidation: true
parallelLoading: true
# Security
security:
# Package verification
requireSignature: false # Future: verify package signatures
trustedSources: ["local"]
# Sandboxing
sandboxPackageScripts: true
allowedScriptActions:
- read-entity
- write-entity
- call-api
# Prevent certain operations
disallowedPatterns:
- "eval("
- "Function("
- "require("
- "import("
# Logging
logging:
logLevel: info # debug | info | warn | error
logPackageLoads: true
logValidationErrors: true
logConflicts: true
# Metadata
metadata:
# Package categories
categories:
- core
- ui
- tools
- admin
- content
- communication
- media
- analytics
- integration
- development
# Feature flags
features:
enablePackageUpdates: true
enablePackageUninstall: true
enableDependencyAutoInstall: false # Auto-install dependencies
enableVersionRollback: true
# Integration
integration:
# DBAL integration
dbal:
validateEntityReferences: true
checkSchemaCompatibility: true
# Frontend integration
frontend:
autoRegisterComponents: true
autoRegisterRoutes: true
autoRegisterScripts: true
# Storybook integration
storybook:
autoDiscoverStories: true
generateDocsOnLoad: false

View File

@@ -0,0 +1,140 @@
# InstalledPackage seed data
# DBAL entity: InstalledPackage
# Schema reference: prisma/schema.prisma (line 327)
entity: InstalledPackage
version: "1.0"
description: "Initial package installation records for bootstrapping the system"
# Default records for fresh installation
records:
# Core system package - always required
- packageId: package_manager
tenantId: null # Global/system-wide package
installedAt: 0 # Will be set to actual timestamp during bootstrap
version: "1.0.0"
enabled: true
config: |
{
"autoUpdate": false,
"systemPackage": true,
"uninstallProtection": true
}
# Base UI packages
- packageId: ui_header
tenantId: null
installedAt: 0
version: "1.0.0"
enabled: true
config: |
{
"systemPackage": true
}
- packageId: ui_footer
tenantId: null
installedAt: 0
version: "1.0.0"
enabled: true
config: |
{
"systemPackage": true
}
- packageId: ui_auth
tenantId: null
installedAt: 0
version: "1.0.0"
enabled: true
config: |
{
"systemPackage": true
}
- packageId: ui_login
tenantId: null
installedAt: 0
version: "1.0.0"
enabled: true
config: |
{
"systemPackage": true
}
# Core functionality
- packageId: dashboard
tenantId: null
installedAt: 0
version: "1.0.0"
enabled: true
config: |
{
"systemPackage": true,
"defaultRoute": "/"
}
- packageId: user_manager
tenantId: null
installedAt: 0
version: "1.0.0"
enabled: true
config: |
{
"systemPackage": true,
"minLevel": 4
}
- packageId: role_editor
tenantId: null
installedAt: 0
version: "1.0.0"
enabled: true
config: |
{
"systemPackage": false,
"minLevel": 4
}
# Admin tools
- packageId: admin_dialog
tenantId: null
installedAt: 0
version: "1.0.0"
enabled: true
config: |
{
"systemPackage": false,
"minLevel": 4
}
- packageId: database_manager
tenantId: null
installedAt: 0
version: "1.0.0"
enabled: true
config: |
{
"systemPackage": false,
"minLevel": 5,
"dangerousOperations": true
}
- packageId: schema_editor
tenantId: null
installedAt: 0
version: "1.0.0"
enabled: true
config: |
{
"systemPackage": false,
"minLevel": 5,
"dangerousOperations": true
}
# Metadata for seed process
metadata:
bootstrap: true
skipIfExists: true # Don't re-seed if records already exist
timestampField: installedAt
useCurrentTimestamp: true # Replace 0 with actual timestamp
validateReferences: true # Ensure referenced packages exist in /packages

View File

@@ -0,0 +1,192 @@
# PackagePermission seed data
# DBAL entity: PackagePermission
# Schema reference: prisma/schema.prisma (line 1637)
entity: PackagePermission
version: "1.0"
description: "Default package permissions for the 6-level permission system"
# Permission levels: Public (0) → User (1) → Moderator (2) → Admin (3) → God (4) → Supergod (5)
records:
# Package Manager - God+ only
- id: perm_package_manager_god_admin
packageId: package_manager
tenantId: null
userId: null
role: god
permission: admin
resource: null
granted: true
createdAt: 0
- id: perm_package_manager_supergod_admin
packageId: package_manager
tenantId: null
userId: null
role: supergod
permission: admin
resource: null
granted: true
createdAt: 0
# UI Packages - Available to all authenticated users
- id: perm_ui_header_user_read
packageId: ui_header
tenantId: null
userId: null
role: user
permission: read
resource: null
granted: true
createdAt: 0
- id: perm_ui_footer_user_read
packageId: ui_footer
tenantId: null
userId: null
role: user
permission: read
resource: null
granted: true
createdAt: 0
- id: perm_ui_auth_public_read
packageId: ui_auth
tenantId: null
userId: null
role: public
permission: read
resource: null
granted: true
createdAt: 0
- id: perm_ui_login_public_read
packageId: ui_login
tenantId: null
userId: null
role: public
permission: read
resource: null
granted: true
createdAt: 0
# Dashboard - User+
- id: perm_dashboard_user_read
packageId: dashboard
tenantId: null
userId: null
role: user
permission: read
resource: null
granted: true
createdAt: 0
# User Manager - Admin+
- id: perm_user_manager_admin_admin
packageId: user_manager
tenantId: null
userId: null
role: admin
permission: admin
resource: null
granted: true
createdAt: 0
- id: perm_user_manager_god_admin
packageId: user_manager
tenantId: null
userId: null
role: god
permission: admin
resource: null
granted: true
createdAt: 0
- id: perm_user_manager_supergod_admin
packageId: user_manager
tenantId: null
userId: null
role: supergod
permission: admin
resource: null
granted: true
createdAt: 0
# Role Editor - God+
- id: perm_role_editor_god_admin
packageId: role_editor
tenantId: null
userId: null
role: god
permission: admin
resource: null
granted: true
createdAt: 0
- id: perm_role_editor_supergod_admin
packageId: role_editor
tenantId: null
userId: null
role: supergod
permission: admin
resource: null
granted: true
createdAt: 0
# Database Manager - Supergod only
- id: perm_database_manager_supergod_admin
packageId: database_manager
tenantId: null
userId: null
role: supergod
permission: admin
resource: null
granted: true
createdAt: 0
# Schema Editor - Supergod only
- id: perm_schema_editor_supergod_admin
packageId: schema_editor
tenantId: null
userId: null
role: supergod
permission: admin
resource: null
granted: true
createdAt: 0
# Metadata for seed process
metadata:
bootstrap: true
skipIfExists: true
timestampField: createdAt
useCurrentTimestamp: true
validateReferences: true
# Permission matrix reference
permission_levels:
description: "MetaBuilder 6-level permission system"
levels:
- level: 0
name: public
description: "Unauthenticated users"
- level: 1
name: user
description: "Authenticated users"
- level: 2
name: moderator
description: "Content moderators"
- level: 3
name: admin
description: "Tenant administrators"
- level: 4
name: god
description: "System administrators"
- level: 5
name: supergod
description: "Super administrators with full access"
permission_types:
- read: "View/access package features"
- write: "Modify package data"
- execute: "Execute package scripts/functions"
- admin: "Full package administration"

View File

@@ -0,0 +1,169 @@
# Core Packages - Auto-installed on system bootstrap
# These packages provide essential functionality for MetaBuilder
version: "1.0"
description: "Essential packages that are automatically installed during system initialization"
packages:
# Package Management
- packageId: package_manager
version: "1.0.0"
enabled: true
priority: 1
required: true
description: "Core package management interface - required for installing/managing other packages"
# Core UI Components
- packageId: ui_header
version: "1.0.0"
enabled: true
priority: 2
required: true
description: "Main application header navigation"
- packageId: ui_footer
version: "1.0.0"
enabled: true
priority: 2
required: true
description: "Application footer"
- packageId: ui_auth
version: "1.0.0"
enabled: true
priority: 2
required: true
description: "Authentication UI components"
- packageId: ui_login
version: "1.0.0"
enabled: true
priority: 2
required: true
description: "Login page and forms"
# Core Functionality
- packageId: dashboard
version: "1.0.0"
enabled: true
priority: 3
required: true
description: "Main dashboard interface"
- packageId: user_manager
version: "1.0.0"
enabled: true
priority: 4
required: true
description: "User management for admin/god levels"
- packageId: role_editor
version: "1.0.0"
enabled: true
priority: 4
required: false
description: "Role and permission management"
# Admin Tools
- packageId: admin_dialog
version: "1.0.0"
enabled: true
priority: 5
required: false
description: "Admin dialog utilities"
- packageId: database_manager
version: "1.0.0"
enabled: true
priority: 6
required: false
description: "Database management interface (god/supergod level)"
- packageId: schema_editor
version: "1.0.0"
enabled: true
priority: 6
required: false
description: "Database schema editing tools"
# Optional but recommended packages
recommended:
- packageId: notification_center
version: "1.0.0"
enabled: false
description: "User notifications and alerts"
- packageId: audit_log
version: "1.0.0"
enabled: false
description: "System audit logging"
- packageId: data_table
version: "1.0.0"
enabled: false
description: "Reusable data table components"
- packageId: form_builder
version: "1.0.0"
enabled: false
description: "Dynamic form generation"
- packageId: quick_guide
version: "1.0.0"
enabled: false
description: "User onboarding and help system"
# Development tools (only install in dev environments)
development:
- packageId: testing
version: "2.0.0"
enabled: false
description: "JSON-based testing framework"
- packageId: package_validator
version: "1.0.0"
enabled: false
description: "Package validation tools"
- packageId: component_editor
version: "1.0.0"
enabled: false
description: "Visual component editor"
- packageId: theme_editor
version: "1.0.0"
enabled: false
description: "Theme customization tools"
- packageId: code_editor
version: "1.0.0"
enabled: false
description: "Integrated code editing"
bootstrap_order:
description: "Packages are installed in priority order (lowest first)"
note: "Required packages must be successfully installed before optional packages"
phases:
- phase: 1
name: "Core System"
packages: ["package_manager"]
- phase: 2
name: "Base UI"
packages: ["ui_header", "ui_footer", "ui_auth", "ui_login"]
- phase: 3
name: "Essential Features"
packages: ["dashboard"]
- phase: 4
name: "Administration"
packages: ["user_manager", "role_editor"]
- phase: 5
name: "Admin Tools"
packages: ["admin_dialog", "database_manager", "schema_editor"]
- phase: 6
name: "Recommended Packages"
install: recommended
continue_on_error: true