Files
html/api/ambre-scan-v30.php

57 lines
2.5 KiB
PHP

<?php
header("Content-Type: application/json");
$out = [];
// Recent git activity
chdir("/var/www/html");
$out["git_commits_last_30m"] = array_filter(array_map("trim", explode("\n", @shell_exec("git log --since='30 minutes ago' --oneline 2>&1 | head -20"))));
$out["git_tags_today"] = array_filter(array_map("trim", explode("\n", @shell_exec("git tag -l | while read t; do d=$(git log -1 --format=%at \"$t\" 2>/dev/null); if [ -n \"$d\" ] && [ \"$d\" -gt $(($(date +%s)-86400)) ]; then echo \"$t\"; fi; done 2>&1 | head -20"))));
// Recent ambre-* files
$recent_ambre = array_map("basename", array_filter(glob("/var/www/html/api/ambre-*.php"), function($f){ return filemtime($f) > (time()-3600); }));
$out["ambre_files_last_hour"] = $recent_ambre;
// oss-catalog state
$oss = "/var/www/html/oss-catalog.html";
$out["oss_catalog"] = file_exists($oss) ? [
"size" => filesize($oss),
"mtime" => date("Y-m-d H:i", filemtime($oss)),
"tool_count_preg" => preg_match_all("/data-cat=/", @file_get_contents($oss) ?: ""),
] : "NOT FOUND";
// Wiki/vault doctrines
$out["doctrines"] = array_map("basename", glob("/opt/obsidian-vault/doctrines/*.md") ?: []);
$out["doctrines_count"] = count(glob("/opt/obsidian-vault/doctrines/*.md") ?: []);
// Recent wave-* tags
$out["recent_wave_tags"] = array_filter(array_map("trim", explode("\n", @shell_exec("git tag -l 'wave-*' --sort=-creatordate 2>&1 | head -10"))));
// V30 video + screenshots still live
$out["v30_artifacts"] = [
"video" => glob("/var/www/html/generated/wevia-v30-showcase*.webm"),
"screenshots" => count(glob("/var/www/html/generated/v30-*.png") ?: []),
];
// Mermaid KB
$mkb = "/var/www/html/generated/mermaid-learn-kb.json";
$out["mermaid_kb"] = file_exists($mkb) ? [
"size" => filesize($mkb),
"entries" => count(json_decode(@file_get_contents($mkb), true) ?: []),
] : "NOT FOUND";
// PDF Premium endpoint
$out["pdf_premium"] = file_exists("/var/www/html/api/ambre-tool-pdf-premium.php") ? "LIVE" : "MISSING";
// What's in wevia.html now
$w = @file_get_contents("/var/www/html/wevia.html");
$out["wevia_state"] = [
"size" => strlen($w),
"v5_memory" => strpos($w, "AMBRE-V5-MEMORY") !== false,
"v6_tools" => strpos($w, "AMBRE-V6-TOOLS") !== false,
"v7_premium" => strpos($w, "AMBRE-V7-PREMIUM") !== false,
"v9_pdf_premium" => strpos($w, "AMBRE-V9-PDF-PREMIUM") !== false,
"ambre_gen_pat_hoisted" => strpos($w, "HOISTED") !== false,
];
echo json_encode($out, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);