Refactor filename naming system and apply convention-based renames

Standardize settings file naming and relocate documentation files
Fix code quality violations from rsx:check
Reorganize user_management directory into logical subdirectories
Move Quill Bundle to core and align with Tom Select pattern
Simplify Site Settings page to focus on core site information
Complete Phase 5: Multi-tenant authentication with login flow and site selection
Add route query parameter rule and synchronize filename validation logic
Fix critical bug in UpdateNpmCommand causing missing JavaScript stubs
Implement filename convention rule and resolve VS Code auto-rename conflict
Implement js-sanitizer RPC server to eliminate 900+ Node.js process spawns
Implement RPC server architecture for JavaScript parsing
WIP: Add RPC server infrastructure for JS parsing (partial implementation)
Update jqhtml terminology from destroy to stop, fix datagrid DOM preservation
Add JQHTML-CLASS-01 rule and fix redundant class names
Improve code quality rules and resolve violations
Remove legacy fatal error format in favor of unified 'fatal' error type
Filter internal keys from window.rsxapp output
Update button styling and comprehensive form/modal documentation
Add conditional fly-in animation for modals
Fix non-deterministic bundle compilation

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-11-13 19:10:02 +00:00
parent fc494c1e08
commit 77b4d10af8
28155 changed files with 2191860 additions and 12967 deletions

View File

@@ -124,38 +124,66 @@ class DefensiveCoding_CodeQualityRule extends CodeQualityRule_Abstract
$variable = $matches[1];
// Skip common boolean variable patterns
if (!preg_match('/^(is|has|can|should|will|did|was)[A-Z]/', $variable)) {
$fix_message = "DETECTED PATTERN: if ({$variable} && {$variable}.method)\n\n" .
"This pattern has TWO possible meanings:\n" .
"1. DEFENSIVE CODING (violation): Checking for something that MUST exist\n" .
"2. DUCK TYPING (acceptable): Checking for optional capabilities\n\n" .
"FOR LLM AGENTS - YOU MUST NOT DECIDE:\n" .
"This rule requires human judgment. You MUST:\n" .
"1. Analyze the context and determine which scenario applies\n" .
"2. Present BOTH options:\n" .
" - If defensive: Remove check, let it fail loud\n" .
" - If duck typing: Use 'in' operator: if ('method' in {$variable})\n" .
"3. Provide your recommendation with reasoning\n" .
"4. WAIT for user decision\n" .
"5. NEVER apply a fix without user confirmation\n\n" .
"EXAMPLES:\n\n" .
"DEFENSIVE CODING (remove the check):\n" .
" if (Rsx && Rsx.Route(...)) // BAD - Rsx is core, must exist\n" .
" if (component && component.render()) // BAD if render is required method\n\n" .
"DUCK TYPING (use 'in' operator):\n" .
" if (component && component.val) // Change to: if ('val' in component)\n" .
" if (obj && obj.serialize) // Change to: if ('serialize' in obj)\n\n" .
"NOTE: Core guaranteed classes (Rsx, Modal, Jqhtml_Component, etc.) should NEVER be checked - let failures happen loudly during development.";
$this->add_violation(
$file_path,
$line_number,
"Defensive coding violation: Guard clause checking if '{$variable}' exists. All classes and variables must be assumed to exist. Code should fail loudly if something is undefined.",
trim($line),
$fix_message,
'high'
);
if (preg_match('/^(is|has|can|should|will|did|was)[A-Z]/', $variable)) {
continue;
}
// Skip variables that commonly represent optional/polymorphic data (duck typing)
$duck_typing_patterns = [
'result', 'results',
'response',
'data',
'error', 'errors',
'obj', 'object', 'objects',
'item', 'items',
'value', 'values',
'options', 'option',
'config',
'params', 'param',
'args', 'arg',
'settings',
'payload',
'context',
'metadata',
];
if (in_array(strtolower($variable), $duck_typing_patterns)) {
// This is acceptable duck typing - checking for optional capabilities
continue;
}
// Flag potential defensive coding (core classes, components, etc.)
$fix_message = "DETECTED PATTERN: if ({$variable} && {$variable}.method)\n\n" .
"This pattern has TWO possible meanings:\n" .
"1. DEFENSIVE CODING (violation): Checking for something that MUST exist\n" .
"2. DUCK TYPING (acceptable): Checking for optional capabilities\n\n" .
"FOR LLM AGENTS - YOU MUST NOT DECIDE:\n" .
"This rule requires human judgment. You MUST:\n" .
"1. Analyze the context and determine which scenario applies\n" .
"2. Present BOTH options:\n" .
" - If defensive: Remove check, let it fail loud\n" .
" - If duck typing: Use 'in' operator: if ('method' in {$variable})\n" .
"3. Provide your recommendation with reasoning\n" .
"4. WAIT for user decision\n" .
"5. NEVER apply a fix without user confirmation\n\n" .
"EXAMPLES:\n\n" .
"DEFENSIVE CODING (remove the check):\n" .
" if (Rsx && Rsx.Route(...)) // BAD - Rsx is core, must exist\n" .
" if (component && component.render()) // BAD if render is required method\n\n" .
"DUCK TYPING (acceptable with these variable names):\n" .
" if (result && result.redirect) // OK - result may have optional redirect\n" .
" if (error && error.message) // OK - polymorphic error handling\n" .
" if (options && options.callback) // OK - optional configuration\n\n" .
"NOTE: Core guaranteed classes (Rsx, Modal, Jqhtml_Component, etc.) should NEVER be checked - let failures happen loudly during development.";
$this->add_violation(
$file_path,
$line_number,
"Defensive coding violation: Guard clause checking if '{$variable}' exists. All classes and variables must be assumed to exist. Code should fail loudly if something is undefined.",
trim($line),
$fix_message,
'high'
);
}
// Pattern 5: try/catch used for existence checking (simplified detection)

View File

@@ -49,6 +49,11 @@ class DocumentReady_CodeQualityRule extends CodeQualityRule_Abstract
*/
public function on_manifest_file_update(string $file_path, string $contents, array $metadata = []): ?array
{
// Only process .js files
if (pathinfo($file_path, PATHINFO_EXTENSION) !== 'js') {
return null;
}
// Skip vendor and node_modules directories
if (str_contains($file_path, '/vendor/') || str_contains($file_path, '/node_modules/')) {
return null;