Files
html/api/wevia-enterprise-fleet.php
2026-04-12 22:57:03 +02:00

78 lines
4.2 KiB
PHP

<?php
header("Content-Type: application/json");
$action = $_GET["action"] ?? "status";
$DEPTS = [
"DIRECTION" => ["head"=>"CEO","agents"=>["CTO","COO","CFO","CISO"],"squad"=>null],
"PRODUCT" => ["head"=>"CPO","agents"=>["PO-WEVIA","PO-WEVADS","PO-ETHICA","PO-L99","Scrum Master","UX Lead"],"squad"=>"SL-PROD"],
"ENGINEERING" => ["head"=>"VP Engineering","agents"=>["Architecte","DevOps","Backend Lead","Frontend Lead","AI/ML Engineer","DBA"],"squad"=>"SL-ENG"],
"QUALITE" => ["head"=>"Directeur Qualite","agents"=>["QA Lead","QA Automation","QA Performance","QA Security","BPO"],"squad"=>"SL-QA"],
"COMMERCIAL" => ["head"=>"Directeur Commercial","agents"=>["Business Dev","CSM","Consultant SAP","Pre-Sales"],"squad"=>"SL-SALES"],
"OPERATIONS" => ["head"=>"Directeur Ops","agents"=>["SRE","Sysadmin","Network Ops","MTA Ops"],"squad"=>"SL-OPS"],
"DATA" => ["head"=>"CDO","agents"=>["Data Engineer","Data Scientist","Data Analyst"],"squad"=>"SL-DATA"],
"MARKETING" => ["head"=>"CMO","agents"=>["SEO","CRM Manager","Content Manager"],"squad"=>"SL-MKT"],
"ACHATS" => ["head"=>"Dir Achats","agents"=>["Acheteur IT","Vendor Manager"],"squad"=>null],
"RH" => ["head"=>"DRH","agents"=>["Recruteur Tech","Resp Formation"],"squad"=>null],
"LEGAL" => ["head"=>"Dir Juridique","agents"=>["DPO","Legal Ops"],"squad"=>null],
];
$MEETINGS = [
["id"=>"ops-review","name"=>"Ops Review","freq"=>"daily 08:30","dur"=>10],
["id"=>"daily-standup","name"=>"Daily Standup","freq"=>"daily 09:00","dur"=>15],
["id"=>"sales-pipeline","name"=>"Sales Pipeline","freq"=>"weekly mon 11:00","dur"=>30],
["id"=>"tech-sync","name"=>"Tech Sync","freq"=>"weekly wed 14:00","dur"=>30],
["id"=>"data-sync","name"=>"Data Sync","freq"=>"weekly thu 14:00","dur"=>30],
["id"=>"quality-review","name"=>"Quality Review","freq"=>"weekly fri 11:00","dur"=>30],
["id"=>"security-audit","name"=>"Security Audit","freq"=>"weekly tue 10:00","dur"=>30],
["id"=>"sprint-planning","name"=>"Sprint Planning","freq"=>"biweekly mon 10:00","dur"=>60],
["id"=>"retrospective","name"=>"Retrospective","freq"=>"biweekly fri 16:00","dur"=>45],
["id"=>"exec-steering","name"=>"Exec Steering","freq"=>"monthly 1st-mon 15:00","dur"=>60],
];
$total = 0;
$depts_out = [];
foreach ($DEPTS as $name => $info) {
$cnt = 1 + count($info["agents"]);
if ($info["squad"]) $cnt++;
$total += $cnt;
$depts_out[$name] = ["count"=>$cnt,"head"=>$info["head"],"squad"=>$info["squad"]];
}
if ($action === "org") { echo json_encode($DEPTS, JSON_PRETTY_PRINT); exit; }
if ($action === "meetings") { echo json_encode($MEETINGS, JSON_PRETTY_PRINT); exit; }
if ($action === "standup") {
$q = @json_decode(@file_get_contents("/var/www/html/api/wevia-quality-status.json"),true);
$ar = @json_decode(@file_get_contents("/var/www/html/api/wevia-antiregression-status.json"),true);
$l99 = @json_decode(@file_get_contents("/var/www/html/api/l99-ux-results.json"),true);
$nr = @json_decode(@file_get_contents("/var/www/html/api/nonreg-latest.json"),true);
$auth = @json_decode(@file_get_contents("/var/www/html/api/wevia-auth-status.json"),true);
$reports = [
["agent"=>"SL-QA","report"=>"Quality: ".($q["global_rate"]??0)."% | ".($q["issues_count"]??0)." issues"],
["agent"=>"SL-OPS","report"=>"AntiReg: ".(($ar["healthy"]??false)?"HEALTHY":"ISSUES")],
["agent"=>"SL-ENG","report"=>"NonReg: ".($nr["pass"]??0)."/".($nr["total"]??0)],
["agent"=>"SL-PROD","report"=>"L99: ".($l99["pass"]??0)." pass"],
["agent"=>"CISO","report"=>"Auth: ".($auth["flow_ok"]??0)."/9 flows"],
];
$blockers = [];
if (($q["issues_count"]??0) > 3) $blockers[] = "Quality below target";
if (!($ar["healthy"]??false)) $blockers[] = "Anti-regression issues";
$standup = ["date"=>date("Y-m-d"),"time"=>date("H:i"),"reports"=>$reports,"blockers"=>$blockers];
file_put_contents("/var/www/html/api/wevia-standup-latest.json", json_encode($standup, JSON_PRETTY_PRINT));
echo json_encode($standup, JSON_PRETTY_PRINT);
exit;
}
// Default: status
echo json_encode([
"fleet" => "WEVAL Enterprise Fleet v1.0",
"total_agents" => $total,
"departments" => count($DEPTS),
"departments_detail" => $depts_out,
"meetings" => count($MEETINGS),
"meeting_list" => $MEETINGS,
"timestamp" => date("Y-m-d H:i:s"),
], JSON_PRETTY_PRINT);