64 lines
3.1 KiB
Python
64 lines
3.1 KiB
Python
#!/usr/bin/env python3
|
|
"""V139 - Truth Registry mini-strip under breadcrumb in Hub
|
|
Shows key counts (agents/intents/skills/brains/doctrines/dashboards) from source of truth.
|
|
Click → opens /wevia-unified-hub.html (HEXA-PIVOT 6th).
|
|
"""
|
|
import sys
|
|
src, dst = sys.argv[1], sys.argv[2]
|
|
with open(src, "r", encoding="utf-8") as f:
|
|
c = f.read()
|
|
|
|
if "V139-TRUTH-STRIP" in c:
|
|
print("ALREADY", file=sys.stderr)
|
|
sys.exit(0)
|
|
|
|
# Insert mini strip right AFTER the v130-xnav closing div and BEFORE modal + tabs
|
|
# Find the v130-xnav block end: </div> right before <!-- V136-HEALTH-MODAL...
|
|
marker = '<!-- V136-HEALTH-MODAL: in-page modal for broken URLs drill-down -->'
|
|
|
|
strip_html = '''<!-- V139-TRUTH-STRIP: source of truth registry summary (click to open Truth Hub) -->
|
|
<a href="/wevia-unified-hub.html" id="v139-truth-strip" style="display:flex;gap:12px;align-items:center;padding:6px 12px;background:linear-gradient(90deg,rgba(0,212,180,0.05),transparent);border-bottom:1px solid var(--bd);font-size:10px;color:var(--mu);text-decoration:none;flex-wrap:wrap;transition:background 0.15s" onmouseover="this.style.background='linear-gradient(90deg,rgba(0,212,180,0.1),transparent)'" onmouseout="this.style.background='linear-gradient(90deg,rgba(0,212,180,0.05),transparent)'" title="Truth Registry - source de vérité unique (click: open Truth Hub)">
|
|
<span style="color:#00d4b4;font-weight:600">🧠 Truth Registry</span>
|
|
<span id="v139-agents">· ... agents</span>
|
|
<span id="v139-intents">· ... intents</span>
|
|
<span id="v139-skills">· ... skills</span>
|
|
<span id="v139-brains">· ... brains</span>
|
|
<span id="v139-doctrines">· ... doctrines</span>
|
|
<span id="v139-dashboards">· ... dashboards</span>
|
|
<span style="margin-left:auto;color:#00d4b4;font-size:9px">open Truth Hub →</span>
|
|
</a>
|
|
''' + marker
|
|
|
|
if marker not in c:
|
|
print("marker missing", file=sys.stderr)
|
|
sys.exit(1)
|
|
c = c.replace(marker, strip_html, 1)
|
|
|
|
# Add JS fetcher (once, on load). Insert before __v135UpdateHealthBanner
|
|
js_marker = 'async function __v135UpdateHealthBanner('
|
|
js_add = '''/* V139-TRUTH-STRIP: load source of truth registry (fire once on load) */
|
|
async function __v139LoadTruthStrip(){
|
|
try {
|
|
const r = await fetch('/api/wevia-truth-registry.json', {cache: 'no-store'});
|
|
if (!r.ok) return;
|
|
const d = await r.json();
|
|
const setN = (id, n) => { const el = document.getElementById(id); if (el && n !== undefined) el.innerHTML = '· <strong style="color:var(--ac)">' + Number(n).toLocaleString('fr-FR') + '</strong> ' + id.replace('v139-',''); };
|
|
setN('v139-agents', d.agents?.count_unique);
|
|
setN('v139-intents', d.intents?.count);
|
|
setN('v139-skills', d.skills?.TOTAL);
|
|
setN('v139-brains', d.brains?.count);
|
|
setN('v139-doctrines', d.doctrines?.count);
|
|
setN('v139-dashboards', d.dashboards?.count);
|
|
} catch (_) {}
|
|
}
|
|
__v139LoadTruthStrip();
|
|
|
|
''' + js_marker
|
|
|
|
if js_marker in c:
|
|
c = c.replace(js_marker, js_add, 1)
|
|
|
|
with open(dst, "w", encoding="utf-8") as f:
|
|
f.write(c)
|
|
print(f"OK size={len(c)}", file=sys.stderr)
|