Skip to content

Commit 923957b

Browse files
authored
Merge pull request #12 from theokeist/codex/update-documentation-with-types-and-arguments-bx0gvr
Refactor TUI panels into shared renderer and add Chevron/Operations panels
2 parents 48434c7 + 9ff08f9 commit 923957b

2 files changed

Lines changed: 52 additions & 0 deletions

File tree

pipeflow

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ use PipeFlow\Console\Commands\MigrateRollbackCommand;
1919
use PipeFlow\Console\Commands\RouteListCommand;
2020
use PipeFlow\Console\Commands\ServeCommand;
2121

22+
$autoload = __DIR__ . '/vendor/autoload.php';
23+
if (!is_file($autoload)) {
24+
fwrite(STDERR, "PipeFlow CLI error: vendor/autoload.php not found.\n");
25+
fwrite(STDERR, "Run: composer install\n");
26+
exit(1);
27+
}
28+
2229
$app = require __DIR__ . '/bootstrap/app.php';
2330

2431
$cli = new ConsoleApplication($app);

src/Console/Commands/ServeCommand.php

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ private function renderGate(string $host, string $port, string $docroot, string
6767
} elseif ($view === 'tui') {
6868
echo $this->colorize("╔════════════════════════════════════════════╗\n", 'cyan');
6969
echo $this->colorize("║ PIPEFLOW TUI GATE PANEL ║\n", 'bold_cyan');
70+
echo $this->colorize("║ MODERN ERA CONTROL // STARGATE ║\n", 'cyan');
7071
echo $this->colorize("╚════════════════════════════════════════════╝\n\n", 'cyan');
7172
} else {
7273
echo $this->colorize("╔════════════════════════════════╗\n", 'cyan');
@@ -156,6 +157,38 @@ private function renderTui(string $host, string $port, string $docroot, array $s
156157
}
157158
echo $this->colorize("╚═════════════════════════╩═════════════════════════╝\n\n", 'cyan');
158159

160+
$analysisLines = [
161+
$this->colorize("Gate TUI (modern era)", 'purple'),
162+
$this->colorize("Sections " . ($sections ? implode(', ', $sections) : 'none'), 'cyan'),
163+
$this->colorize("Theme Stargate fan", 'green'),
164+
];
165+
166+
$this->renderTuiPanel('CENTRAL ANALYSIS', $analysisLines, $width);
167+
168+
$runningLines = [
169+
$this->colorize("Server http://{$host}:{$port}", 'green'),
170+
$this->colorize("PID " . getmypid(), 'cyan'),
171+
$this->colorize("Command php -S {$host}:{$port}", 'blue'),
172+
];
173+
174+
$this->renderTuiPanel('RUNNING', $runningLines, $width);
175+
176+
$chevronLines = [
177+
$this->colorize("Chevrons 7/7 locked", 'green'),
178+
$this->colorize("Iris open (dev)", 'cyan'),
179+
$this->colorize("Gate stable", 'purple'),
180+
];
181+
182+
$this->renderTuiPanel('CHEVRON STATUS', $chevronLines, $width);
183+
184+
$opsLines = [
185+
$this->colorize("Docs docs/CLI.md", 'cyan'),
186+
$this->colorize("Routes php pipeflow route:list", 'blue'),
187+
$this->colorize("Reload php pipeflow serve --gate=tui", 'blue'),
188+
];
189+
190+
$this->renderTuiPanel('OPERATIONS', $opsLines, $width);
191+
159192
if (in_array('tips', $sections, true)) {
160193
echo $this->title('TUI CONTROLS');
161194
echo $this->colorize(" ▸ serve --gate=tui --gate-filter=portal,paths\n", 'blue');
@@ -170,6 +203,18 @@ private function padStrip(string $text, int $width): string
170203
return $text . str_repeat(' ', $pad);
171204
}
172205

206+
private function renderTuiPanel(string $title, array $lines, int $width): void
207+
{
208+
echo $this->colorize("╔════════════════════════════════════════════╗\n", 'cyan');
209+
echo $this->colorize("" . str_pad($title, $width) . "\n", 'bold');
210+
echo $this->colorize("╠════════════════════════════════════════════╣\n", 'cyan');
211+
foreach ($lines as $line) {
212+
$line = $this->padStrip($line, $width);
213+
echo $this->colorize("{$line}\n", 'cyan');
214+
}
215+
echo $this->colorize("╚════════════════════════════════════════════╝\n\n", 'cyan');
216+
}
217+
173218
private function stripColors(string $text): string
174219
{
175220
return preg_replace('/\033\\[[0-9;]*m/', '', $text) ?? $text;

0 commit comments

Comments
 (0)