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>
This commit is contained in:
root
2025-11-19 17:48:15 +00:00
parent 77b4d10af8
commit 9ebcc359ae
4360 changed files with 37751 additions and 18578 deletions

View File

@@ -86,16 +86,36 @@ class RouteExists_CodeQualityRule extends CodeQualityRule_Abstract
*/
private function route_exists(string $controller, string $method): bool
{
// First check if this is a SPA action (JavaScript class extending Spa_Action)
if ($this->is_spa_action($controller)) {
return true;
}
// Otherwise check PHP routes
try {
// Use the same validation logic as Rsx::Route()
// If this doesn't throw an exception, the route exists
\App\RSpade\Core\Rsx::Route($controller, $method);
\App\RSpade\Core\Rsx::Route($controller . '::' . $method);
return true;
} catch (\Exception $e) {
return false;
}
}
/**
* Check if a controller name is actually a SPA action class
*/
private function is_spa_action(string $class_name): bool
{
try {
// Use manifest to check if this JavaScript class extends Spa_Action
return \App\RSpade\Core\Manifest\Manifest::js_is_subclass_of($class_name, 'Spa_Action');
} catch (\Exception $e) {
// If manifest not available, class doesn't exist, or any error, return false
return false;
}
}
/**
* Check a file for violations
@@ -114,9 +134,9 @@ class RouteExists_CodeQualityRule extends CodeQualityRule_Abstract
// Pattern to match Rsx::Route and Rsx.Route calls (NOT plain Route())
// Matches both single and double parameter versions:
// - Rsx::Route('Controller') // PHP, defaults to 'index'
// - Rsx::Route('Controller', 'method') // PHP
// - Rsx::Route('Controller::method') // PHP
// - Rsx.Route('Controller') // JavaScript, defaults to 'index'
// - Rsx.Route('Controller', 'method') // JavaScript
// - Rsx.Route('Controller::method') // JavaScript
// Pattern for two parameters
$pattern_two_params = '/(?:Rsx::Route|Rsx\.Route)\s*\(\s*[\'"]([^\'"]+)[\'"]\s*,\s*[\'"]([^\'"]+)[\'"]\s*\)/';
@@ -190,11 +210,24 @@ class RouteExists_CodeQualityRule extends CodeQualityRule_Abstract
}
// Extract controller from ORIGINAL content, not sanitized
$controller = $original_matches[1][$index][0] ?? $matches[1][$index][0];
$method = 'index'; // Default to 'index'
$controller_string = $original_matches[1][$index][0] ?? $matches[1][$index][0];
// Check if using Controller::method syntax
if (str_contains($controller_string, '::')) {
[$controller, $method] = explode('::', $controller_string, 2);
} else {
$controller = $controller_string;
$method = 'index'; // Default to 'index'
}
// Skip if contains template variables like {$variable}
if (str_contains($controller, '{$') || str_contains($controller, '${')) {
if (str_contains($controller, '{$') || str_contains($controller, '${') ||
str_contains($method, '{$') || str_contains($method, '${')) {
continue;
}
// Skip if method starts with '#' - indicates unimplemented route
if (str_starts_with($method, '#')) {
continue;
}
@@ -240,10 +273,10 @@ class RouteExists_CodeQualityRule extends CodeQualityRule_Abstract
$suggestions[] = " - Create the controller if it doesn't exist";
$suggestions[] = " - Add the method with a #[Route] attribute";
$suggestions[] = "3. Use '#' prefix for unimplemented routes (recommended):";
$suggestions[] = " - Use Rsx::Route('Controller', '#index') for unimplemented index methods";
$suggestions[] = " - Use Rsx::Route('Controller', '#method_name') for other unimplemented methods";
$suggestions[] = " - Use Rsx::Route('Controller::#index') for unimplemented index methods";
$suggestions[] = " - Use Rsx::Route('Controller::#method_name') for other unimplemented methods";
$suggestions[] = " - Routes with '#' prefix will generate '#' URLs and bypass this validation";
$suggestions[] = " - Example: Rsx::Route('Backend_Users_Controller', '#index')";
$suggestions[] = " - Example: Rsx::Route('Backend_Users_Controller::#index')";
return implode("\n", $suggestions);
}