Implement application developer CLAUDE.md system and symlink automation

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-10-22 02:50:34 +00:00
parent 7ebe35f207
commit 7798dd02d0

View File

@@ -102,6 +102,52 @@ class Rsx_Framework_Provider extends ServiceProvider
}
}
}
} else {
// In application developer mode (not framework developer mode), create symlink to distributed CLAUDE.md
// Only run if all conditions are met:
// - Not in production mode
// - /var/www/html/system/artisan exists
// - /var/www/html/rsx exists
// - Running as root
// - Running in Docker container
// - ~/.claude/CLAUDE.md doesn't exist or is already a symlink
$artisan_path = '/var/www/html/system/artisan';
$rsx_path = '/var/www/html/rsx';
$claude_dir = $_SERVER['HOME'] . '/.claude';
$claude_symlink = $claude_dir . '/CLAUDE.md';
$dist_claude = '/var/www/html/system/docs/CLAUDE.dist.md';
// Check if running in Docker
$is_docker = file_exists('/.dockerenv') || file_exists('/run/.containerenv');
// Check if running as root
$is_root = posix_getuid() === 0;
// Check all conditions
if (
!app()->environment('production') &&
file_exists($artisan_path) &&
is_dir($rsx_path) &&
$is_root &&
$is_docker &&
(!file_exists($claude_symlink) || is_link($claude_symlink))
) {
// Create ~/.claude directory if it doesn't exist
if (!is_dir($claude_dir)) {
mkdir($claude_dir, 0755, true);
}
// Remove existing symlink if present
if (is_link($claude_symlink)) {
unlink($claude_symlink);
}
// Create symlink to distributed CLAUDE.md
symlink($dist_claude, $claude_symlink);
// Make it read-only (remove write permissions)
chmod($claude_symlink, 0444);
}
}
// Register ManifestKernel as singleton