Files
rspade_system/config/rsx.php
root 9ebcc359ae Fix code quality violations and enhance ROUTE-EXISTS-01 rule
Implement JQHTML function cache ID system and fix bundle compilation
Implement underscore prefix for system tables
Fix JS syntax linter to support decorators and grant exception to Task system
SPA: Update planning docs and wishlists with remaining features
SPA: Document Navigation API abandonment and future enhancements
Implement SPA browser integration with History API (Phase 1)
Convert contacts view page to SPA action
Convert clients pages to SPA actions and document conversion procedure
SPA: Merge GET parameters and update documentation
Implement SPA route URL generation in JavaScript and PHP
Implement SPA bootstrap controller architecture
Add SPA routing manual page (rsx:man spa)
Add SPA routing documentation to CLAUDE.md
Phase 4 Complete: Client-side SPA routing implementation
Update get_routes() consumers for unified route structure
Complete SPA Phase 3: PHP-side route type detection and is_spa flag
Restore unified routes structure and Manifest_Query class
Refactor route indexing and add SPA infrastructure
Phase 3 Complete: SPA route registration in manifest
Implement SPA Phase 2: Extract router code and test decorators
Rename Jqhtml_Component to Component and complete SPA foundation setup

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-19 17:48:15 +00:00

607 lines
24 KiB
PHP
Executable File

<?php
/**
* RSX Framework Configuration
*
* Framework defaults and core operational settings. User customizations belong
* in /rsx/resource/config/rsx.php which is merged with this file.
*
* For extended documentation: php artisan rsx:man config_rsx
*
* ---
*
* MOVED TO USER CONFIG (/rsx/resource/config/rsx.php):
*
* The following configuration keys were moved from this file to user config
* because they represent user preferences rather than framework requirements:
*
* - locking
* - locking.timeout - Performance tuning preference
* - locking.always_write_lock - Debugging preference
* - locking.site_always_write - Debugging preference
* Reason: Developers may need to tune locking behavior for performance
*
* - development.auto_rename_files - IDE preference for file auto-renaming
* Reason: VS Code extension user preference
*
* - development.ignore_filename_convention - Disable filename checks globally
* Reason: Developer choice for convention enforcement
*
* - manifest.excluded_dirs - Additional directories to exclude from scanning
* Reason: Users may want custom exclusions (framework exclusions are hardcoded)
*
* - code_quality.generic_suffix_replacements - Required suffix specificity rules
* Reason: Users define their own naming patterns (Handler, Service, etc.)
*
* - console_debug.outputs - Debug output destinations (cli, web, ajax, laravel_log)
* Reason: User preference for debug visibility
*
* - console_debug.filter_mode - Filter mode (all, whitelist, blacklist, specific)
* Reason: User debugging workflow preference
*
* - console_debug.specific_channel - Specific channel to show
* Reason: User debugging focus
*
* - console_debug.whitelist - Channels to show in whitelist mode
* Reason: Users add custom application debug channels
*
* - console_debug.blacklist - Channels to hide in blacklist mode
* Reason: User preference for hiding noisy channels
*
* - console_debug.include_benchmark - Include timing in debug output
* Reason: User preference for performance analysis
*
* - console_debug.include_location - Include file/line in debug output
* Reason: User debugging preference
*
* - console_debug.include_backtrace - Include call stack in debug output
* Reason: User debugging preference
*
* - console_debug.enable_get_trace - Enable ?__trace=1 for plain text output
* Reason: User debugging preference
*
* - log_browser_errors - Log JavaScript errors to Laravel log
* Reason: User preference for client-side error tracking
*
* - response.default_view - Default view when controller doesn't specify
* Reason: Application-specific default
*
* - response.error_views - Custom error view templates (404, 500)
* Reason: Application-specific error pages
*
* - response.cors - CORS settings for API responses
* Reason: Application-specific API configuration
*
* - gatekeeper - Development preview authentication
* - gatekeeper.enabled - Enable/disable authentication
* - gatekeeper.password - Shared password
* - gatekeeper.cookie_name - Cookie name for auth
* - gatekeeper.cookie_lifetime_hours - Cookie lifetime
* - gatekeeper.title - Login page title
* - gatekeeper.subtitle - Login page description
* - gatekeeper.logo - Custom logo path
* Reason: Application-specific development site protection
*
* REMOVED (DEAD CODE):
*
* - middleware - RSX middleware configuration (UNUSED - no code references)
* - response.asset_cache - Asset caching settings (UNUSED - no code references)
*/
return [
/*
|--------------------------------------------------------------------------
| Manifest Modules
|--------------------------------------------------------------------------
|
| These modules process files during manifest scanning. Each module
| handles specific file types and extracts metadata. Modules are
| processed in priority order (lower number = higher priority).
|
*/
'manifest_modules' => [
// Core modules (can be copied and modified)
// PHP extraction is handled directly in Manifest to avoid DRY violations
// JavaScript is a first-class citizen, handled directly in Manifest.php
\App\RSpade\Core\Manifest\Modules\Blade_ManifestModule::class,
\App\RSpade\Integrations\Scss\Scss_ManifestModule::class,
// Custom modules
// \App\RSpade\Modules\Custom\MyCustomModule::class,
],
/*
|--------------------------------------------------------------------------
| Manifest Support Modules
|--------------------------------------------------------------------------
|
| These modules run AFTER the primary manifest is built to add
| supplementary metadata that requires the full manifest to be available.
| Order matters - modules are processed in the order listed.
|
*/
'manifest_support' => [
\App\RSpade\Core\Dispatch\Route_ManifestSupport::class,
\App\RSpade\Modules\Model_ManifestSupport::class,
\App\RSpade\Integrations\Jqhtml\Jqhtml_ManifestSupport::class,
\App\RSpade\Core\SPA\Spa_ManifestSupport::class,
],
/*
|--------------------------------------------------------------------------
| Integrations
|--------------------------------------------------------------------------
|
| External integrations that extend the framework's capabilities.
| Each integration can provide file discovery, processing, and bundling.
|
*/
'integrations' => [
// Register integration service providers here
// These will be loaded automatically if enabled
'providers' => [
\App\RSpade\Integrations\Jqhtml\Jqhtml_Service_Provider::class,
\App\RSpade\Core\Controller\Controller_Service_Provider::class,
\App\RSpade\Core\Database\Database_Service_Provider::class,
],
// Integration-specific configuration
'jqhtml' => [
'compiler' => [
'cache' => true,
'cache_ttl' => 3600,
'source_maps' => true,
],
],
],
/*
|--------------------------------------------------------------------------
| Bundle Processors
|--------------------------------------------------------------------------
|
| Configure global processors that transform files during bundle compilation.
| These processors are automatically applied to all bundles based on file
| extensions. Order matters - processors with lower priority run first.
|
*/
'bundle_processors' => [
// SCSS/Sass processor
\App\RSpade\Integrations\Scss\Scss_BundleProcessor::class,
// JQHTML processor
\App\RSpade\Integrations\Jqhtml\Jqhtml_BundleProcessor::class,
// Add custom processors here
// \App\RSpade\Processors\MyCustomProcessor::class,
],
/*
|--------------------------------------------------------------------------
| Required Bundles
|--------------------------------------------------------------------------
|
| These bundles are automatically prepended to every bundle's include list.
| They provide core functionality that all bundles need.
|
*/
'required_bundles' => [
'jquery', // jQuery library - foundation for many components
'lodash', // Lodash utility library - common utilities
'core', // Core framework JS - Manifest, Rsx, cache, etc.
'jqhtml', // Jqhtml library - client side templating library
],
/*
|--------------------------------------------------------------------------
| Bundle Aliases
|--------------------------------------------------------------------------
|
| Map bundle aliases to their corresponding bundle classes.
| These aliases can be used in bundle 'include' arrays for convenience.
|
*/
'bundle_aliases' => [
'core' => \App\RSpade\Core\Bundle\Core_Bundle::class,
'jquery' => \App\RSpade\Bundles\Jquery_Bundle::class,
'lodash' => \App\RSpade\Bundles\Lodash_Bundle::class,
'bootstrap5' => \App\RSpade\Bundles\Bootstrap5_Bundle::class,
'jqhtml' => \App\RSpade\Integrations\Jqhtml\Jqhtml_Bundle::class,
],
/*
|--------------------------------------------------------------------------
| RSX Routing Configuration
|--------------------------------------------------------------------------
|
| Configure how RSX handles routing, caching, and request dispatch.
|
*/
'routing' => [
// Directories to check for static assets
'asset_dirs' => ['public', 'assets', 'static', 'dist', 'build'],
// Handler type priorities (lower number = higher priority)
'handler_priority' => [
'controller' => 1,
'file' => 2,
'asset' => 3,
'custom' => 4,
],
],
/*
|--------------------------------------------------------------------------
| Public Directory Configuration
|--------------------------------------------------------------------------
|
| Configure security and access control for the /rsx/public/ directory.
| Files in this directory are served at the root URL of the application.
|
*/
'public' => [
// Global patterns blocked from HTTP access for security
// These patterns are always blocked regardless of public_ignore.json
'ignore_patterns' => [
'public_ignore.json',
'.git',
'.gitignore',
'.gitattributes',
'*.php',
'.env',
'.env.*',
'*.sh',
'*.py',
'*.rb',
'*.conf',
'*.ini',
'*.sql',
'*.bak',
'*.tmp',
'*~',
],
],
/*
|--------------------------------------------------------------------------
| RSX Manifest Configuration
|--------------------------------------------------------------------------
|
| Configure how RSX discovers and indexes classes, routes, and attributes.
|
*/
'manifest' => [
// Base directories to scan (relative to base_path())
// Can be directories (will be scanned recursively) or individual files
'scan_directories' => [
'rsx', // Main RSX application directory (symlinked to ../rsx)
'app/RSpade/Core', // Core framework classes (runtime essentials)
'app/RSpade/Modules', // Manifest support modules
'app/RSpade/Integrations', // Integration modules (Jqhtml, Scss, etc.)
'app/RSpade/Bundles', // Third-party bundles
'app/RSpade/CodeQuality', // Code quality rules and checks
'app/RSpade/Testing', // Testing framework classes
'app/RSpade/Lib', // UI features and other extras
'app/RSpade/temp', // Framework developer testing directory
],
// Specific filenames to exclude from manifest scanning (anywhere in tree)
'excluded_files' => [
'CLAUDE.md', // Documentation for AI assistants
'.placeholder', // Empty directory markers
'.DS_Store', // macOS folder metadata
'Thumbs.db', // Windows thumbnail cache
'desktop.ini', // Windows folder settings
'.gitkeep', // Git empty directory markers
'.gitattributes', // Git attributes config
'._rsx_helper.php', // IDE helper stubs (auto-generated)
],
],
/*
|--------------------------------------------------------------------------
| RSX Development Settings
|--------------------------------------------------------------------------
|
| Diagnostic flags for debugging. Override in user config for preferences.
|
*/
'development' => [
// Show detailed error messages
'debug' => env('RSX_DEBUG', env('APP_DEBUG', false)),
// Log all dispatches for debugging
'log_dispatches' => env('RSX_LOG_DISPATCHES', false),
// Show route matching details in error pages
'show_route_details' => env('RSX_SHOW_ROUTE_DETAILS', env('APP_DEBUG', false)),
// Disable AJAX request batching for easier debugging
// When true, each Ajax.call() makes an immediate individual request
// When false (default), requests are batched using setTimeout(0)
'ajax_disable_batching' => env('AJAX_DISABLE_BATCHING', false),
],
/*
|--------------------------------------------------------------------------
| Code Quality Configuration
|--------------------------------------------------------------------------
|
| Settings for code quality checks and validation rules.
|
*/
'code_quality' => [
// Framework developer mode - enables additional testing capabilities
// When true, allows testing rules in app/RSpade/temp directory
'is_framework_developer' => env('IS_FRAMEWORK_DEVELOPER', false),
// Whitelisted PHP/JS files allowed in project root directory
// These are typically build configuration files and IDE helpers
'root_whitelist' => [
'vite.config.js',
'webpack.config.js',
'webpack.mix.js',
'_ide_helper.php', // Laravel IDE Helper
'._rsx_helper.php', // RSX IDE Helper
'.phpstorm.meta.php', // PhpStorm metadata
],
// Whitelisted test files allowed in rsx/ directory (not subdirectories)
// Test files should normally be in proper test directories, not loose in rsx/
'rsx_test_whitelist' => [
// Currently no test files should exist directly in rsx/
],
// Classes exempt from suffix inheritance rules
// Children of these classes can use any naming pattern
'suffix_exempt_classes' => [
'Component', // JQHTML components can have flexible naming
'Component', // JQHTML v2 components can have flexible naming
'Rsx_System_Model_Abstract', // System models (e.g., Session) have special naming
],
],
/*
|--------------------------------------------------------------------------
| IDE Integration Configuration
|--------------------------------------------------------------------------
|
| Settings for VS Code extension and IDE bridge communication.
|
*/
'ide_integration' => [
// Application domain for IDE to connect to
// Set to 'auto' to auto-discover from first web request
// Or specify explicitly: 'https://example.com'
//
// WARNING: When set to 'auto', email sending will be restricted to test mode
// with whitelisted receivers only, as email functionality requires a hardcoded
// domain. Production email sending will be disabled.
// TODO: Implement email test mode when email functionality is added (~1 month)
'application_domain' => env('RSX_APPLICATION_DOMAIN', 'auto'),
// Path where IDE bridge files are stored (auth tokens, discovered domain)
'bridge_path' => 'storage/rsx-ide-bridge',
// Enable IDE services endpoint (disabled in production by default)
'enabled' => env('RSX_IDE_SERVICES_ENABLED', env('APP_ENV', 'local') !== 'production'),
],
/*
|--------------------------------------------------------------------------
| JavaScript Configuration
|--------------------------------------------------------------------------
|
| Settings for JavaScript parsing and transformation.
|
*/
'javascript' => [
'babel' => [
// Enable Babel transformation for decorators
'transform_enabled' => env('BABEL_TRANSFORM', true),
// Target environment for transformation (modern, es6, es5)
'target' => env('BABEL_TARGET', 'modern'),
// Cache directory for transformed files
'cache_dir' => 'storage/rsx-tmp/babel_cache',
],
// Enable decorator support (parsed and optionally transformed)
'decorators' => true,
// Note: Private fields (#private) use native browser support, not transpiled
],
/*
|--------------------------------------------------------------------------
| Console Debug Configuration
|--------------------------------------------------------------------------
|
| Core debug system settings. Override outputs and filters in user config.
|
*/
'console_debug' => [
// Master switch to enable/disable all console debug output
'enabled' => env('CONSOLE_DEBUG_ENABLED', true),
],
/*
|--------------------------------------------------------------------------
| Exception Handlers
|--------------------------------------------------------------------------
|
| Exception handlers are executed in priority order when exceptions occur.
| Each handler can choose to handle the exception (return a response) or
| pass it to the next handler (return null). Handlers are sorted by priority
| with lower numbers running first.
|
| Handler Priority Ranges:
| - 1-50: Critical/environment-specific (CLI, AJAX, Playwright)
| - 51-100: Standard handlers
| - 101-500: Low priority handlers
| - 501+: Fallback* or catch-all handlers (RSX dispatch bootstrapper)
|
| Users can add custom handlers or reorder existing ones by modifying this array.
|
*/
'exception_handlers' => [
\App\RSpade\Core\Exceptions\Cli_Exception_Handler::class, // Priority 10
\App\RSpade\Core\Exceptions\Ajax_Exception_Handler::class, // Priority 20
\App\RSpade\Core\Debug\Playwright_Exception_Handler::class, // Priority 30
\App\RSpade\Core\Providers\Rsx_Dispatch_Bootstrapper_Handler::class, // Priority 1000
],
/*
|--------------------------------------------------------------------------
| SSR Full Page Cache (FPC) Configuration
|--------------------------------------------------------------------------
|
| Settings for server-side rendered static page caching. Routes marked with
| #[Static_Page] attribute are pre-rendered as static HTML via headless
| Chrome (Playwright) and cached in Redis for optimal SEO and performance.
|
| Cache Behavior:
| - Only served to unauthenticated users (no active session)
| - Auto-invalidates on deployment (build_key changes)
| - Supports ETags for 304 Not Modified responses
| - Cache headers: 0s in dev, 5min in prod
|
| Commands:
| - php artisan rsx:ssr_fpc:create /route # Generate cache for route
| - php artisan rsx:ssr_fpc:reset # Clear all FPC caches
|
*/
'ssr_fpc' => [
// Enable SSR Full Page Cache system
'enabled' => env('SSR_FPC_ENABLED', false),
// Playwright generation timeout in milliseconds
'generation_timeout' => env('SSR_FPC_TIMEOUT', 30000),
],
/*
|--------------------------------------------------------------------------
| Thumbnail Configuration
|--------------------------------------------------------------------------
|
| Configure the two-tier thumbnail caching system with named presets
| (developer-defined) and dynamic thumbnails (ad-hoc sizes).
|
| Storage Structure:
| - storage/rsx-thumbnails/preset/ - Named preset thumbnails
| - storage/rsx-thumbnails/dynamic/ - Dynamic ad-hoc thumbnails
|
| Quota Management:
| - Preset thumbnails: Enforced via scheduled rsx:thumbnails:clean task
| - Dynamic thumbnails: Enforced synchronously after each new thumbnail
| - Both use LRU eviction (oldest mtime deleted first)
|
| LRU Tracking:
| - Both preset and dynamic thumbnails have mtime touched on cache hit
| - Touch only occurs if mtime is older than touch_interval (default 10 min)
| - Prevents excessive filesystem writes while maintaining LRU accuracy
|
| Commands:
| - php artisan rsx:thumbnails:clean [--preset] [--dynamic]
| - php artisan rsx:thumbnails:generate [--preset=name]
| - php artisan rsx:thumbnails:stats
|
*/
'thumbnails' => [
// Named preset definitions
// Format: 'name' => ['type' => 'cover'|'fit', 'width' => int, 'height' => int]
'presets' => [
'profile' => ['type' => 'cover', 'width' => 200, 'height' => 200],
'gallery' => ['type' => 'fit', 'width' => 400, 'height' => 300],
'icon_small' => ['type' => 'cover', 'width' => 32, 'height' => 32],
'icon_large' => ['type' => 'cover', 'width' => 64, 'height' => 64],
],
// Storage quotas in bytes (both enforced via LRU eviction)
'quotas' => [
'preset_max_bytes' => 100 * 1024 * 1024, // 100MB (enforced via scheduled task)
'dynamic_max_bytes' => 50 * 1024 * 1024, // 50MB (enforced synchronously)
],
// Maximum dimension limit for dynamic thumbnails (base resolution before 2x scaling)
// This value is doubled during generation (800 becomes 1600x1600 after 2x scaling)
// Preset thumbnails have no enforced maximum (developer-controlled)
// NOTE: Application configuration - not overridable via environment variable
'max_dynamic_size' => 800,
// Touch mtime on cache hit to update LRU tracking (both preset and dynamic)
'touch_on_read' => env('THUMBNAILS_TOUCH_ON_READ', true),
// Only touch if mtime is older than this many seconds (prevents excessive filesystem writes)
'touch_interval' => env('THUMBNAILS_TOUCH_INTERVAL', 600), // 10 minutes
],
/*
|--------------------------------------------------------------------------
| Task System
|--------------------------------------------------------------------------
|
| Configuration for the unified task execution system supporting:
| - Immediate CLI execution
| - Scheduled tasks (cron-based)
| - Queued async tasks with worker management
|
| Worker Concurrency:
| - global_max_workers: Maximum total workers across all queues
| - Per-queue max_workers: Maximum concurrent workers for specific queue
| - Workers are spawned up to configured limits
|
| Task Lifecycle:
| - Tasks start as "pending" in database
| - Worker process marks as "running" and updates heartbeat
| - Completes as "completed" or "failed"
| - Stuck tasks detected via timeout + heartbeat + PID checking
|
| Queues:
| - default: General purpose task queue
| - scheduled: Auto-created tasks from #[Schedule] attributes
| - Custom queues: Define as needed (video, export, email, etc.)
|
| Commands:
| - php artisan rsx:task:process (run via cron every minute)
| - php artisan rsx:task:run Service method [params]
| - php artisan rsx:task:list
|
*/
'tasks' => [
// Maximum workers across all queues (prevents server overload)
'global_max_workers' => 1,
// Default timeout for tasks (seconds) - used if task doesn't specify
'default_timeout' => 1800, // 30 minutes
// How long before a task is considered stuck (seconds)
'cleanup_stuck_after' => 1800, // 30 minutes
// Default TTL for task temp directories (seconds)
'temp_directory_default_ttl' => 3600, // 1 hour
// How long to keep completed/failed task records (days)
'task_retention_days' => 30,
// Queue-specific configuration
'queues' => [
'default' => [
'max_workers' => 1,
],
'scheduled' => [
'max_workers' => 1,
],
// Future queues can be added here:
// 'video' => ['max_workers' => 2],
// 'export' => ['max_workers' => 1],
// 'email' => ['max_workers' => 5],
],
],
];