Fix bin/publish: copy docs.dist from project root

Fix bin/publish: use correct .env path for rspade_system
Fix bin/publish script: prevent grep exit code 1 from terminating script

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-10-21 02:08:33 +00:00
commit f6fac6c4bc
79758 changed files with 10547827 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
<?php
namespace App\RSpade\Commands\Framework;
use Illuminate\Console\Command;
/**
* Framework Update Command - STUB ONLY
*
* This command should NEVER execute under normal circumstances.
* The artisan script intercepts 'rsx:framework:pull' before Laravel loads
* and directly executes bin/framework-pull-upstream.sh to avoid running
* the framework update on potentially outdated framework code.
*
* This stub exists only for:
* - Command registration (so 'php artisan list' shows the command)
* - Help text display
* - Edge cases where artisan interception fails
*/
class Framework_Pull_Command extends Command
{
protected $signature = 'rsx:framework:pull {--no-rebuild : Skip manifest and bundle rebuild after update}';
protected $description = 'Pull RSpade framework updates from upstream (preserves ./rsx in project mode)';
public function handle()
{
// This should NEVER execute - artisan intercepts before Laravel loads
$this->error('CRITICAL ERROR: Framework update command executed via Laravel.');
$this->line('');
$this->line('This indicates the artisan interception failed.');
$this->line('The framework update script should run BEFORE Laravel loads.');
$this->line('');
$this->line('Please report this issue to framework developers.');
return 1;
}
}

View File

@@ -0,0 +1,147 @@
<?php
namespace App\RSpade\Commands\Framework;
use Illuminate\Console\Command;
class Framework_Status_Command extends Command
{
protected $signature = 'rsx:framework:status';
protected $description = 'Check framework update status and configuration';
public function handle()
{
// Initialize variables for \exec_safe() calls
$remote_output = [];
$remote_return = 0;
$driver_output = [];
$driver_return = 0;
$status_output = [];
$fetch_output = [];
$fetch_return = 0;
$current_head = [];
$upstream_head = [];
$diff_output = [];
$base_path = base_path();
$rsx_path = base_path('rsx');
$marker_file = base_path('.rspade-dev-environment');
$this->line('');
$this->info('=== RSpade Framework Status ===');
$this->line('');
// Determine mode
$is_project_mode = file_exists($marker_file) || is_dir($rsx_path . '/.git');
if ($is_project_mode) {
$this->line('<fg=green>Mode:</> Project (application development)');
} else {
$this->line('<fg=yellow>Mode:</> Framework development');
}
$this->line('');
// Check if rspade_upstream remote exists
chdir($base_path);
\exec_safe('git remote get-url rspade_upstream 2>&1', $remote_output, $remote_return);
if ($remote_return === 0) {
$this->line('<fg=green>✓</> Upstream remote configured: ' . trim($remote_output[0]));
} else {
$this->line('<fg=red>✗</> Upstream remote NOT configured');
$this->line(' Run: git remote add rspade_upstream <upstream-url>');
$this->line('');
return 1;
}
// Check merge protection (project mode only)
if ($is_project_mode) {
$gitattributes_path = base_path('.gitattributes');
$has_gitattributes = file_exists($gitattributes_path) &&
strpos(file_get_contents($gitattributes_path), '/rsx/**') !== false;
\exec_safe('git config --get merge.ours.driver 2>&1', $driver_output, $driver_return);
$has_merge_driver = $driver_return === 0 && trim($driver_output[0] ?? '') === 'true';
if ($has_gitattributes && $has_merge_driver) {
$this->line('<fg=green>✓</> Merge protection configured');
} else {
$this->line('<fg=red>✗</> Merge protection NOT configured');
if (!$has_gitattributes) {
$this->line(' Missing: /rsx/** merge=ours in .gitattributes');
}
if (!$has_merge_driver) {
$this->line(' Missing: git config merge.ours.driver true');
}
$this->line(' Configure manually if needed for framework updates');
}
}
$this->line('');
// Check local modifications
\exec_safe('git status --porcelain 2>&1', $status_output);
$has_modifications = !empty($status_output);
if ($has_modifications) {
$this->line('<fg=yellow>⚠</> Local modifications detected:');
$this->line('');
foreach ($status_output as $line) {
$this->line(' ' . $line);
}
$this->line('');
} else {
$this->line('<fg=green>✓</> No local modifications');
$this->line('');
}
// Fetch and compare versions
$this->line('Fetching upstream...');
\exec_safe('git fetch rspade_upstream 2>&1', $fetch_output, $fetch_return);
if ($fetch_return !== 0) {
$this->error('Failed to fetch upstream');
return 1;
}
// Get current and upstream commit hashes
\exec_safe('git rev-parse HEAD 2>&1', $current_head);
\exec_safe('git rev-parse rspade_upstream/master 2>&1', $upstream_head);
$current = trim($current_head[0] ?? '');
$upstream = trim($upstream_head[0] ?? '');
if ($current === $upstream) {
$this->line('<fg=green>✓</> Framework is up to date');
$this->line(' Current: ' . substr($current, 0, 12));
$this->line(' Upstream: ' . substr($upstream, 0, 12));
} else {
$this->line('<fg=yellow>⚠</> Updates available');
$this->line(' Current: ' . substr($current, 0, 12));
$this->line(' Upstream: ' . substr($upstream, 0, 12));
$this->line('');
// Show what will change (exclude ./rsx if in project mode)
$exclude_rsx = $is_project_mode ? ' ":(exclude)rsx"' : '';
\exec_safe('git diff --stat HEAD..rspade_upstream/master -- .' . $exclude_rsx . ' 2>&1', $diff_output);
if (!empty($diff_output)) {
$this->line(' Files that will be updated:');
$this->line('');
foreach (array_slice($diff_output, 0, 15) as $line) {
$this->line(' ' . $line);
}
if (count($diff_output) > 15) {
$this->line(' ... and ' . (count($diff_output) - 15) . ' more files');
}
}
}
$this->line('');
$this->line('To update: php artisan rsx:framework:pull');
$this->line('');
return 0;
}
}