SIMON Master Console Rebuild
True command center for SIMON + WEB360
This rebuild gives you a cleaner production spine: interactive tree, live viewer, guarded editor, dynamic graphics, architecture map, and note storage. It is designed to sit beside your existing
console.php
and become the stronger replacement path.
Dashboard
Tree
Viewer
System Map
File Registry
Notes
Files
15,338
Folders
408
Scanned Size
3.84 GB
PHP Files
890
Editable Text Files
12,599
File viewer
guarded to /htdocs
/simon/old/rscan.php
<?php declare(strict_types=1); /** * SIMON Intelligence — File Registry UI * Suggested path: /htdocs/simon/file_registry.php * * Reads scanner JSON outputs from /simon/data/scans/ and renders: * - summary cards * - module / risk / purpose breakdowns * - searchable file registry * - 5W1H detail panel * - dependency review * - security review items * - skipped-path visibility * * Compatible with PHP 7.4+ */ date_default_timezone_set('America/Chicago'); error_reporting(E_ALL); ini_set('display_errors', '1'); header('Content-Type: text/html; charset=utf-8'); function h($value): string { return htmlspecialchars((string)$value, ENT_QUOTES, 'UTF-8'); } function path_join(string ...$parts): string { $out = array_shift($parts); foreach ($parts as $part) { $out = rtrim((string)$out, '/\\') . '/' . ltrim($part, '/\\'); } return $out; } $scanRoot = realpath($_SERVER['DOCUMENT_ROOT'] ?? dirname(__DIR__, 1)); if ($scanRoot === false) { $scanRoot = dirname(__DIR__, 1); } $dataDir = path_join($scanRoot, 'simon', 'data', 'scans'); function load_json_file(string $path, $default = []) { if (!is_file($path) || !is_readable($path)) { return $default; } $raw = @file_get_contents($path); if (!is_string($raw) || trim($raw) === '') { return $default; } $decoded = json_decode($raw, true); return is_array($decoded) ? $decoded : $default; } function normalize_skipped($raw): array { if (!is_array($raw)) return []; $out = []; foreach ($raw as $row) { if (is_string($row)) { $out[] = ['path' => $row, 'reason' => 'skipped']; continue; } if (is_array($row)) { $out[] = [ 'path' => (string)($row['path'] ?? $row['relative'] ?? 'unknown'), 'reason' => (string)($row['reason'] ?? 'skipped'), ]; } } return $out; } $summary = load_json_file(path_join($dataDir, 'scan_summary.json'), []); $registry = load_json_file(path_join($dataDir, 'master_registry.json'), []); $fiveMap = load_json_file(path_join($dataDir, 'five_w_one_h_master.json'), []); $dependencyMap = load_json_file(path_join($dataDir, 'dependency_map.json'), []); $securityEvents = load_json_file(path_join($dataDir, 'security_events.json'), []); $fileReviews = load_json_file(path_join($dataDir, 'file_reviews.json'), []); $quickRef = load_json_file(path_join($dataDir, 'quick_ref.json'), []); $skipped = normalize_skipped(load_json_file(path_join($dataDir, 'skipped_paths.json'), [])); $files = isset($registry['files']) && is_array($registry['files']) ? $registry['files'] : []; $directories = isset($registry['directories']) && is_array($registry['directories']) ? $registry['directories'] : []; // Build lookup maps. $fiveByPath = []; foreach ($fiveMap as $row) { if (is_array($row) && isset($row['path'])) { $fiveByPath[(string)$row['path']] = isset($row['5w1h']) && is_array($row['5w1h']) ? $row['5w1h'] : []; } } $depsByPath = []; foreach ($dependencyMap as $row) { if (is_array($row) && isset($row['path'])) { $depsByPath[(string)$row['path']] = $row; } } $reviewByPath = []; foreach ($fileReviews as $row) { if (is_array($row) && isset($row['path'])) { $reviewByPath[(string)$row['path']] = $row; } } $quickByPath = []; foreach ($quickRef as $row) { if (is_array($row) && isset($row['path'])) { $quickByPath[(string)$row['path']] = $row; } } $securityByPath = []; foreach ($securityEvents as $row) { if (is_array($row) && isset($row['path'])) { $securityByPath[(string)$row['path']] = $row; } } // Filters. $view = isset($_GET['view']) ? (string)$_GET['view'] : 'overview'; $q = isset($_GET['q']) ? trim((string)$_GET['q']) : ''; $riskFilter = isset($_GET['risk']) ? trim((string)$_GET['risk']) : ''; $moduleFilter = isset($_GET['module']) ? trim((string)$_GET['module']) : ''; $purposeFilter = isset($_GET['purpose']) ? trim((string)$_GET['purpose']) : ''; $eventFilter = isset($_GET['event']) ? trim((string)$_GET['event']) : ''; $limit = isset($_GET['limit']) ? max(25, min(1000, (int)$_GET['limit'])) : 250; $selectedPath = isset($_GET['path']) ? (string)$_GET['path'] : ''; $moduleOptions = []; $purposeOptions = []; $eventOptions = []; $riskCounts = ['ok' => 0, 'warn' => 0, 'critical' => 0]; $moduleCounts = []; $purposeCounts = []; $eventCounts = []; foreach ($files as $file) { $module = (string)($file['module'] ?? 'UNKNOWN'); $purpose = (string)($file['purpose'] ?? 'unknown'); $risk = (string)($file['risk'] ?? 'ok'); $event = (string)($file['five_w_one_h']['event'] ?? ($fiveByPath[$file['path']]['event'] ?? 'unknown')); $moduleOptions[$module] = true; $purposeOptions[$purpose] = true; $eventOptions[$event] = true; $moduleCounts[$module] = ($moduleCounts[$module] ?? 0) + 1; $purposeCounts[$purpose] = ($purposeCounts[$purpose] ?? 0) + 1; $eventCounts[$event] = ($eventCounts[$event] ?? 0) + 1; $riskCounts[$risk] = ($riskCounts[$risk] ?? 0) + 1; } ksort($moduleOptions); ksort($purposeOptions); ksort($eventOptions); arsort($moduleCounts); arsort($purposeCounts); arsort($eventCounts); $filteredFiles = []; foreach ($files as $file) { $path = (string)($file['path'] ?? ''); $module = (string)($file['module'] ?? ''); $purpose = (string)($file['purpose'] ?? ''); $risk = (string)($file['risk'] ?? ''); $five = isset($file['five_w_one_h']) && is_array($file['five_w_one_h']) ? $file['five_w_one_h'] : ($fiveByPath[$path] ?? []); $event = (string)($five['event'] ?? ''); $searchHaystack = strtolower(implode(' | ', [ $path, (string)($file['name'] ?? ''), $module, $purpose, $risk, (string)($file['quick_ref']['one_line'] ?? ($quickByPath[$path]['summary'] ?? '')), implode(' ', isset($file['functions']) && is_array($file['functions']) ? $file['functions'] : []), implode(' ', isset($file['secret_flags']) && is_array($file['secret_flags']) ? $file['secret_flags'] : []), (string)($five['what'] ?? ''), (string)($five['why'] ?? ''), ])); if ($q !== '' && strpos($searchHaystack, strtolower($q)) === false) continue; if ($riskFilter !== '' && $risk !== $riskFilter) continue; if ($moduleFilter !== '' && $module !== $moduleFilter) continue; if ($purposeFilter !== '' && $purpose !== $purposeFilter) continue; if ($eventFilter !== '' && $event !== $eventFilter) continue; $filteredFiles[] = $file; } usort($filteredFiles, static function (array $a, array $b): int { $riskOrder = ['critical' => 0, 'warn' => 1, 'ok' => 2]; $ra = $riskOrder[(string)($a['risk'] ?? 'ok')] ?? 9; $rb = $riskOrder[(string)($b['risk'] ?? 'ok')] ?? 9; if ($ra !== $rb) return $ra <=> $rb; $ma = strtotime((string)($a['modified_at'] ?? '')) ?: 0; $mb = strtotime((string)($b['modified_at'] ?? '')) ?: 0; if ($ma !== $mb) return $mb <=> $ma; return strcmp((string)($a['path'] ?? ''), (string)($b['path'] ?? '')); }); if ($selectedPath === '' && !empty($filteredFiles)) { $selectedPath = (string)$filteredFiles[0]['path']; } $selectedFile = null; foreach ($files as $file) { if ((string)($file['path'] ?? '') === $selectedPath) { $selectedFile = $file; break; } } function badge_class(string $risk): string { if ($risk === 'critical') return 'critical'; if ($risk === 'warn') return 'warn'; return 'ok'; } function build_query(array $overrides = []): string { $params = array_merge($_GET, $overrides); foreach ($params as $k => $v) { if ($v === '' || $v === null) unset($params[$k]); } return '?' . http_build_query($params); } function render_nav(string $current): string { $items = [ 'overview' => 'Overview', 'registry' => 'Registry', 'security' => 'Security', 'dependencies' => 'Dependencies', 'skipped' => 'Skipped Paths', ]; $html = ''; foreach ($items as $key => $label) { $html .= '<a class="' . ($current === $key ? 'active' : '') . '" href="' . h(build_query(['view' => $key])) . '">' . h($label) . '</a>'; } return $html; } ?><!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover"> <title>SIMON Intelligence — File Registry</title> <meta name="theme-color" content="#07111d"> <style> :root{ --bg:#06111d;--bg2:#08182a;--panel:rgba(10,20,38,.84);--panel2:rgba(12,24,44,.92);--line:rgba(120,190,255,.15); --text:#edf6ff;--muted:#97afca;--cyan:#6fe7ff;--blue:#74a8ff;--vio:#a287ff;--green:#61f0ae;--gold:#ffd36f;--red:#ff7a93; --shadow:0 20px 70px rgba(0,0,0,.42);--radius:22px; } *{box-sizing:border-box}html,body{margin:0;padding:0}body{font:14px/1.55 Inter,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;color:var(--text);min-height:100vh;background:radial-gradient(circle at top, rgba(111,231,255,.12), transparent 28%),radial-gradient(circle at 85% 15%, rgba(162,135,255,.10), transparent 26%),linear-gradient(180deg,var(--bg),#030811)} body:before{content:"";position:fixed;inset:0;pointer-events:none;background-image:linear-gradient(rgba(255,255,255,.02) 1px, transparent 1px),linear-gradient(90deg, rgba(255,255,255,.02) 1px, transparent 1px);background-size:34px 34px;mask-image:linear-gradient(to bottom, rgba(255,255,255,.7), rgba(255,255,255,.08));} a{color:var(--cyan);text-decoration:none}a:hover{text-decoration:underline}.wrap{max-width:1660px;margin:auto;padding:22px;position:relative;z-index:1} .panel{background:linear-gradient(180deg,var(--panel),var(--panel2));border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow)} .hero{padding:26px;position:relative;overflow:hidden;margin-bottom:18px}.hero:before{content:"";position:absolute;right:-90px;top:-90px;width:320px;height:320px;border-radius:50%;background:radial-gradient(circle, rgba(111,231,255,.20), transparent 65%);filter:blur(8px)} .top{display:grid;grid-template-columns:110px 1fr 360px;gap:18px;align-items:center;position:relative;z-index:2}.orb{width:100px;height:100px;border-radius:50%;background:radial-gradient(circle at 35% 35%, rgba(255,255,255,.95), rgba(111,231,255,.65) 18%, rgba(116,168,255,.30) 42%, rgba(162,135,255,.14) 58%, transparent 70%);box-shadow:0 0 34px rgba(111,231,255,.35),0 0 80px rgba(116,168,255,.18);position:relative}.orb:before,.orb:after{content:"";position:absolute;inset:-12px;border-radius:50%;border:1px solid rgba(111,231,255,.18);animation:spin 14s linear infinite}.orb:after{inset:-24px;border-color:rgba(162,135,255,.16);animation-direction:reverse;animation-duration:18s}@keyframes spin{to{transform:rotate(360deg)}} .kicker{display:inline-flex;padding:7px 12px;border-radius:999px;border:1px solid var(--line);color:var(--muted);text-transform:uppercase;letter-spacing:.12em;font-size:12px} h1{font-size:clamp(28px,4vw,48px);margin:12px 0 8px;line-height:1.02}.sub{color:#d7e7fb;max-width:980px} .stats{display:grid;gap:12px}.stat{padding:14px;border-radius:18px;background:rgba(255,255,255,.04);border:1px solid rgba(255,255,255,.07)}.stat .k{font-size:12px;color:var(--muted);text-transform:uppercase;letter-spacing:.08em}.stat .v{font-size:26px;font-weight:800;margin-top:8px} .menu{display:flex;gap:10px;flex-wrap:wrap;margin-top:18px}.menu a{display:inline-flex;align-items:center;justify-content:center;padding:11px 14px;border-radius:14px;background:rgba(255,255,255,.04);border:1px solid rgba(255,255,255,.08);color:var(--text);font-weight:700;text-decoration:none}.menu a.active{background:linear-gradient(135deg, rgba(111,231,255,.16), rgba(162,135,255,.16));border-color:rgba(111,231,255,.30)} .grid{display:grid;gap:18px}.grid4{grid-template-columns:repeat(4,1fr)}.grid3{grid-template-columns:repeat(3,1fr)}.grid2{grid-template-columns:1.15fr .85fr}.shell{display:grid;grid-template-columns:minmax(420px,1.12fr) minmax(380px,.88fr);gap:18px}.card{padding:18px}.head{display:flex;justify-content:space-between;gap:10px;align-items:center;margin-bottom:12px}.head h2{margin:0;font-size:20px}.note{font-size:13px;color:var(--muted)} .metric{padding:16px;border-radius:18px;background:rgba(255,255,255,.03);border:1px solid rgba(255,255,255,.07)}.metric .k{font-size:12px;color:var(--muted);text-transform:uppercase;letter-spacing:.08em}.metric .v{font-size:30px;font-weight:900;margin-top:8px}.metric .hint{margin-top:8px;color:var(--muted);font-size:13px} .table-wrap{overflow:auto;border-radius:16px;border:1px solid var(--line)} table{width:100%;border-collapse:collapse;min-width:920px} th,td{padding:12px 14px;border-bottom:1px solid rgba(255,255,255,.08);text-align:left;vertical-align:top} th{font-size:12px;color:var(--muted);text-transform:uppercase;letter-spacing:.08em;background:rgba(255,255,255,.03)} .code{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace}.muted{color:var(--muted)} .badge{display:inline-flex;align-items:center;padding:5px 9px;border-radius:999px;font-size:11px;font-weight:700;border:1px solid transparent;margin:2px 5px 2px 0}.ok{background:rgba(97,240,174,.1);color:#dfffee;border-color:rgba(97,240,174,.18)}.warn{background:rgba(255,211,111,.1);color:#fff0cd;border-color:rgba(255,211,111,.18)}.critical{background:rgba(255,122,147,.1);color:#ffd9e1;border-color:rgba(255,122,147,.18)}.listed{background:rgba(111,231,255,.1);color:#dff9ff;border-color:rgba(111,231,255,.18)} form.filters{display:grid;grid-template-columns:2fr 1fr 1fr 1fr 1fr auto;gap:10px;align-items:end}input,select,button{width:100%;background:rgba(255,255,255,.04);color:var(--text);border:1px solid rgba(255,255,255,.12);border-radius:12px;padding:12px 14px;font:inherit}button{cursor:pointer;background:linear-gradient(135deg, rgba(111,231,255,.14), rgba(116,168,255,.18));font-weight:700} .list{display:grid;gap:12px}.item{padding:14px;border-radius:16px;background:rgba(255,255,255,.03);border:1px solid rgba(255,255,255,.06)}.item h3{margin:0 0 8px;font-size:16px}.kv{display:grid;grid-template-columns:140px 1fr;gap:10px;border-bottom:1px solid rgba(255,255,255,.08);padding:10px 0}.kv:last-child{border-bottom:none}.kv .label{color:var(--muted);font-weight:700;text-transform:uppercase;font-size:12px;letter-spacing:.06em} .sidebar-list{max-height:980px;overflow:auto;display:grid;gap:10px}.file-card{display:block;padding:14px;border-radius:16px;background:rgba(255,255,255,.03);border:1px solid rgba(255,255,255,.06);text-decoration:none;color:var(--text)}.file-card.active{border-color:rgba(111,231,255,.35);background:linear-gradient(135deg, rgba(111,231,255,.10), rgba(162,135,255,.08))}.file-card:hover{text-decoration:none}.file-card .path{font-weight:700;word-break:break-word}.file-card .meta{margin-top:8px;color:var(--muted);font-size:12px} .footer{margin-top:18px;text-align:center;color:var(--muted);font-size:12px}.empty{padding:18px;border-radius:16px;background:rgba(255,255,255,.03);border:1px dashed rgba(255,255,255,.10);color:var(--muted)} @media (max-width:1280px){.top,.grid4,.grid3,.grid2,.shell,form.filters{grid-template-columns:1fr}} </style> </head> <body> <div class="wrap"> <section class="panel hero"> <div class="top"> <div class="orb" aria-hidden="true"></div> <div> <div class="kicker">SIMON Intelligence • File Registry • 5W1H • Scanner Review</div> <h1>Live Registry UI + System Map</h1> <div class="sub"> Reads the scanner JSON outputs in <span class="code">/simon/data/scans/</span>, visualizes the live file system map, exposes 5W1H file intelligence, highlights risks, and gives SIMON an operator-ready control surface before Phase 2 AI recommendations. </div> <nav class="menu"><?php echo render_nav($view); ?></nav> </div> <div class="stats"> <div class="stat"><div class="k">Registry files</div><div class="v"><?php echo (int)count($files); ?></div></div> <div class="stat"><div class="k">Directories</div><div class="v"><?php echo (int)count($directories); ?></div></div> <div class="stat"><div class="k">Critical / Warn</div><div class="v"><?php echo (int)($riskCounts['critical'] ?? 0); ?> / <?php echo (int)($riskCounts['warn'] ?? 0); ?></div></div> <div class="stat"><div class="k">Skipped paths</div><div class="v"><?php echo (int)count($skipped); ?></div></div> </div> </div> </section> <?php if (empty($files)): ?> <section class="panel card"> <div class="head"><h2>No scan data found</h2></div> <div class="empty"> Put your scanner outputs into <span class="code"><?php echo h($dataDir); ?></span> first.<br> Expected files include <span class="code">master_registry.json</span>, <span class="code">scan_summary.json</span>, <span class="code">five_w_one_h_master.json</span>, <span class="code">dependency_map.json</span>, and <span class="code">security_events.json</span>. </div> </section> <?php else: ?> <section class="grid grid4" style="margin-bottom:18px;"> <div class="panel card metric"><div class="k">Scan root</div><div class="v" style="font-size:20px;word-break:break-word"><?php echo h((string)($summary['root'] ?? $scanRoot)); ?></div><div class="hint">Current live base path</div></div> <div class="panel card metric"><div class="k">Modules</div><div class="v"><?php echo (int)count($moduleCounts); ?></div><div class="hint">Distinct system zones detected</div></div> <div class="panel card metric"><div class="k">Purposes</div><div class="v"><?php echo (int)count($purposeCounts); ?></div><div class="hint">Behavior classes identified</div></div> <div class="panel card metric"><div class="k">Filtered results</div><div class="v"><?php echo (int)count($filteredFiles); ?></div><div class="hint">Current file result set</div></div> </section> <section class="panel card" style="margin-bottom:18px;"> <div class="head"><h2>Registry Filters</h2><span class="note">Search path, function, purpose, summary, flags, or 5W1H text</span></div> <form class="filters" method="get"> <input type="hidden" name="view" value="<?php echo h($view); ?>"> <div><label class="note">Search</label><input type="text" name="q" value="<?php echo h($q); ?>" placeholder="search path, module, summary, function, flags"></div> <div><label class="note">Risk</label><select name="risk"><option value="">All risk</option><option value="ok"<?php echo $riskFilter === 'ok' ? ' selected' : ''; ?>>OK</option><option value="warn"<?php echo $riskFilter === 'warn' ? ' selected' : ''; ?>>Warn</option><option value="critical"<?php echo $riskFilter === 'critical' ? ' selected' : ''; ?>>Critical</option></select></div> <div><label class="note">Module</label><select name="module"><option value="">All modules</option><?php foreach (array_keys($moduleOptions) as $module): ?><option value="<?php echo h($module); ?>"<?php echo $moduleFilter === $module ? ' selected' : ''; ?>><?php echo h($module); ?></option><?php endforeach; ?></select></div> <div><label class="note">Purpose</label><select name="purpose"><option value="">All purposes</option><?php foreach (array_keys($purposeOptions) as $purpose): ?><option value="<?php echo h($purpose); ?>"<?php echo $purposeFilter === $purpose ? ' selected' : ''; ?>><?php echo h($purpose); ?></option><?php endforeach; ?></select></div> <div><label class="note">Event</label><select name="event"><option value="">All events</option><?php foreach (array_keys($eventOptions) as $event): ?><option value="<?php echo h($event); ?>"<?php echo $eventFilter === $event ? ' selected' : ''; ?>><?php echo h($event); ?></option><?php endforeach; ?></select></div> <div><label class="note">Apply</label><button type="submit">Filter Registry</button></div> </form> </section> <?php if ($view === 'overview'): ?> <section class="grid grid3" style="margin-bottom:18px;"> <div class="panel card"> <div class="head"><h2>Top Modules</h2><span class="note">Most populated areas</span></div> <div class="list"> <?php foreach (array_slice($moduleCounts, 0, 8, true) as $module => $count): ?> <div class="item"><strong><?php echo h($module); ?></strong><br><span class="muted"><?php echo (int)$count; ?> files</span></div> <?php endforeach; ?> </div> </div> <div class="panel card"> <div class="head"><h2>Top Purposes</h2><span class="note">Detected behavior classes</span></div> <div class="list"> <?php foreach (array_slice($purposeCounts, 0, 8, true) as $purpose => $count): ?> <div class="item"><strong><?php echo h($purpose); ?></strong><br><span class="muted"><?php echo (int)$count; ?> files</span></div> <?php endforeach; ?> </div> </div> <div class="panel card"> <div class="head"><h2>Top Events</h2><span class="note">5W1H event tags</span></div> <div class="list"> <?php foreach (array_slice($eventCounts, 0, 8, true) as $event => $count): ?> <div class="item"><strong><?php echo h($event); ?></strong><br><span class="muted"><?php echo (int)$count; ?> files</span></div> <?php endforeach; ?> </div> </div> </section> <section class="panel card"> <div class="head"><h2>Highest-Risk Files</h2><span class="note">Top registry items that need review first</span></div> <div class="table-wrap"><table> <thead><tr><th>Risk</th><th>Path</th><th>Module</th><th>Purpose</th><th>Summary</th><th>Event</th></tr></thead> <tbody> <?php foreach (array_slice($filteredFiles, 0, 25) as $file): $path = (string)$file['path']; $five = isset($file['five_w_one_h']) && is_array($file['five_w_one_h']) ? $file['five_w_one_h'] : ($fiveByPath[$path] ?? []); ?> <tr> <td><span class="badge <?php echo h(badge_class((string)$file['risk'])); ?>"><?php echo h(strtoupper((string)$file['risk'])); ?></span></td> <td class="code"><a href="<?php echo h(build_query(['view' => 'registry', 'path' => $path])); ?>"><?php echo h($path); ?></a></td> <td><?php echo h((string)$file['module']); ?></td> <td><?php echo h((string)$file['purpose']); ?></td> <td><?php echo h((string)($file['quick_ref']['one_line'] ?? ($quickByPath[$path]['summary'] ?? ''))); ?></td> <td><?php echo h((string)($five['event'] ?? '')); ?></td> </tr> <?php endforeach; ?> </tbody> </table></div> </section> <?php endif; ?> <?php if ($view === 'registry'): ?> <section class="shell"> <div class="panel card"> <div class="head"><h2>Registry Results</h2><span class="note"><?php echo (int)count($filteredFiles); ?> matching files</span></div> <div class="sidebar-list"> <?php foreach (array_slice($filteredFiles, 0, $limit) as $file): $path = (string)$file['path']; $five = isset($file['five_w_one_h']) && is_array($file['five_w_one_h']) ? $file['five_w_one_h'] : ($fiveByPath[$path] ?? []); ?> <a class="file-card <?php echo $selectedPath === $path ? 'active' : ''; ?>" href="<?php echo h(build_query(['path' => $path])); ?>"> <div> <span class="badge <?php echo h(badge_class((string)$file['risk'])); ?>"><?php echo h(strtoupper((string)$file['risk'])); ?></span> <span class="badge listed"><?php echo h((string)$file['module']); ?></span> </div> <div class="path"><?php echo h($path); ?></div> <div class="meta"><?php echo h((string)$file['purpose']); ?> • <?php echo h((string)($five['event'] ?? '')); ?> • <?php echo (int)($file['line_count'] ?? 0); ?> lines</div> </a> <?php endforeach; ?> </div> </div> <div class="panel card"> <div class="head"><h2>File Detail</h2><span class="note"><?php echo $selectedFile ? '5W1H + dependencies + review' : 'Select a file'; ?></span></div> <?php if (!$selectedFile): ?> <div class="empty">No matching file selected.</div> <?php else: $path = (string)$selectedFile['path']; $five = isset($selectedFile['five_w_one_h']) && is_array($selectedFile['five_w_one_h']) ? $selectedFile['five_w_one_h'] : ($fiveByPath[$path] ?? []); $depRow = $depsByPath[$path] ?? ['depends_on' => [], 'forms' => []]; $review = $reviewByPath[$path] ?? []; $security = $securityByPath[$path] ?? []; ?> <div class="kv"><div class="label">Path</div><div class="code"><?php echo h($path); ?></div></div> <div class="kv"><div class="label">Module</div><div><?php echo h((string)$selectedFile['module']); ?></div></div> <div class="kv"><div class="label">Purpose</div><div><?php echo h((string)$selectedFile['purpose']); ?></div></div> <div class="kv"><div class="label">Risk</div><div><span class="badge <?php echo h(badge_class((string)$selectedFile['risk'])); ?>"><?php echo h(strtoupper((string)$selectedFile['risk'])); ?></span></div></div> <div class="kv"><div class="label">Modified</div><div><?php echo h((string)($selectedFile['modified_at'] ?? '')); ?></div></div> <div class="kv"><div class="label">Quick Ref</div><div><?php echo h((string)($selectedFile['quick_ref']['one_line'] ?? ($quickByPath[$path]['summary'] ?? ''))); ?></div></div> <div class="kv"><div class="label">What</div><div><?php echo h((string)($five['what'] ?? '')); ?></div></div> <div class="kv"><div class="label">Why</div><div><?php echo h((string)($five['why'] ?? '')); ?></div></div> <div class="kv"><div class="label">Where</div><div class="code"><?php echo h((string)($five['where'] ?? $path)); ?></div></div> <div class="kv"><div class="label">When</div><div><?php echo h((string)($five['when'] ?? '')); ?></div></div> <div class="kv"><div class="label">Who</div><div><?php echo h((string)($five['who'] ?? '')); ?></div></div> <div class="kv"><div class="label">How</div><div><?php echo h((string)($five['how'] ?? '')); ?></div></div> <div class="kv"><div class="label">Event</div><div><span class="badge listed"><?php echo h((string)($five['event'] ?? '')); ?></span></div></div> <div class="kv"><div class="label">Functions</div><div><?php echo !empty($selectedFile['functions']) ? h(implode(', ', $selectedFile['functions'])) : '<span class="muted">None detected</span>'; ?></div></div> <div class="kv"><div class="label">Dependencies</div><div><?php echo !empty($depRow['depends_on']) ? h(implode("\n", $depRow['depends_on'])) : '<span class="muted">None detected</span>'; ?></div></div> <div class="kv"><div class="label">Forms</div><div><?php echo !empty($depRow['forms']) ? h(json_encode($depRow['forms'], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)) : '<span class="muted">None detected</span>'; ?></div></div> <div class="kv"><div class="label">Flags</div><div><?php echo !empty($selectedFile['secret_flags']) ? h(implode(', ', $selectedFile['secret_flags'])) : '<span class="muted">None detected</span>'; ?></div></div> <div class="kv"><div class="label">Review</div><div><?php echo h((string)($review['review'] ?? 'No review text')); ?></div></div> <div class="kv"><div class="label">Action</div><div><?php echo h((string)($review['recommended_action'] ?? 'No action yet')); ?></div></div> <div class="kv"><div class="label">Security Notes</div><div><?php echo h((string)($security['notes'] ?? 'No extra security notes')); ?></div></div> <div class="kv"><div class="label">Preview</div><div class="code"><?php echo !empty($selectedFile['preview']) ? nl2br(h(implode("\n", $selectedFile['preview']))) : '<span class="muted">No preview captured</span>'; ?></div></div> <?php endif; ?> </div> </section> <?php endif; ?> <?php if ($view === 'security'): ?> <section class="panel card"> <div class="head"><h2>Security Review Queue</h2><span class="note">Files flagged by scanner risk logic or secret-pattern review</span></div> <div class="table-wrap"><table> <thead><tr><th>Risk</th><th>Path</th><th>Flags</th><th>Recommended Action</th><th>Notes</th></tr></thead> <tbody> <?php foreach ($securityEvents as $row): $path = (string)($row['path'] ?? ''); $review = $reviewByPath[$path] ?? []; ?> <tr> <td><span class="badge <?php echo h(badge_class((string)($row['risk'] ?? 'ok'))); ?>"><?php echo h(strtoupper((string)($row['risk'] ?? 'ok'))); ?></span></td> <td class="code"><a href="<?php echo h(build_query(['view' => 'registry', 'path' => $path])); ?>"><?php echo h($path); ?></a></td> <td><?php echo h(implode(', ', isset($row['secret_flags']) && is_array($row['secret_flags']) ? $row['secret_flags'] : [])); ?></td> <td><?php echo h((string)($review['recommended_action'] ?? 'Review access, secrets, and execution behavior')); ?></td> <td><?php echo h((string)($row['notes'] ?? '')); ?></td> </tr> <?php endforeach; ?> </tbody> </table></div> </section> <?php endif; ?> <?php if ($view === 'dependencies'): ?> <section class="panel card"> <div class="head"><h2>Dependency + Form Map</h2><span class="note">Internal links, includes, actions, and form paths</span></div> <div class="table-wrap"><table> <thead><tr><th>Path</th><th>Dependencies</th><th>Forms</th><th>Module</th><th>Purpose</th></tr></thead> <tbody> <?php foreach (array_slice($filteredFiles, 0, $limit) as $file): $path = (string)$file['path']; $depRow = $depsByPath[$path] ?? ['depends_on' => [], 'forms' => []]; ?> <tr> <td class="code"><a href="<?php echo h(build_query(['view' => 'registry', 'path' => $path])); ?>"><?php echo h($path); ?></a></td> <td class="code"><?php echo !empty($depRow['depends_on']) ? nl2br(h(implode("\n", $depRow['depends_on']))) : '<span class="muted">None detected</span>'; ?></td> <td class="code"><?php echo !empty($depRow['forms']) ? nl2br(h(json_encode($depRow['forms'], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES))) : '<span class="muted">None detected</span>'; ?></td> <td><?php echo h((string)$file['module']); ?></td> <td><?php echo h((string)$file['purpose']); ?></td> </tr> <?php endforeach; ?> </tbody> </table></div> </section> <?php endif; ?> <?php if ($view === 'skipped'): ?> <section class="grid grid2"> <div class="panel card"> <div class="head"><h2>Skipped Paths</h2><span class="note">Protected, unreadable, or intentionally excluded areas</span></div> <?php if (empty($skipped)): ?> <div class="empty">No skipped path log found yet.</div> <?php else: ?> <div class="table-wrap"><table> <thead><tr><th>Path</th><th>Reason</th></tr></thead> <tbody> <?php foreach ($skipped as $row): ?> <tr><td class="code"><?php echo h((string)$row['path']); ?></td><td><?php echo h((string)$row['reason']); ?></td></tr> <?php endforeach; ?> </tbody> </table></div> <?php endif; ?> </div> <div class="panel card"> <div class="head"><h2>Why this matters</h2><span class="note">SIMON control-plane logic</span></div> <div class="list"> <div class="item"><strong>Protected zones stay protected.</strong><br><span class="muted">The registry should record them, not break because of them.</span></div> <div class="item"><strong>Blind spots become explicit.</strong><br><span class="muted">Unreadable areas can be tagged for manual review, not hidden.</span></div> <div class="item"><strong>Phase 2 AI gets cleaner inputs.</strong><br><span class="muted">Recommendations should distinguish scanned files from protected zones.</span></div> </div> </div> </section> <?php endif; ?> <?php endif; ?> <div class="footer"> SIMON Intelligence • File Registry UI • Data source: <span class="code"><?php echo h($dataDir); ?></span> </div> </div> </body> </html>
Save file
Quick jump
open a path
Open