Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions src/codeproof/gui/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ async function api(path, opts = {}) {
function setView(name) {
$$('.view').forEach(v => v.classList.toggle('active', v.id === `view-${name}`));
$$('.nav-btn').forEach(b => b.classList.toggle('active', b.dataset.view === name));
$('#view-title').textContent = name.charAt(0).toUpperCase() + name.slice(1);
const titles = { dashboard: 'Repository overview', findings: 'Findings', inventory: 'Inventory', policy: 'Policy & tools', history: 'Report history' };
$('#view-title').textContent = titles[name];
$('#breadcrumb').textContent = name === 'dashboard' ? 'OVERVIEW' : name.toUpperCase();
if (name === 'policy') { loadPolicy(); loadDoctor(); }
if (name === 'history') loadHistory();
}

function scoreColor(score) {
Expand Down Expand Up @@ -57,7 +61,7 @@ function renderResults() {
<td>${r.required ? 'Yes' : 'No'}</td>
<td>${fmt(r.duration_seconds, 3)}s</td>
<td>${esc(r.summary)}</td>
</tr>`).join('') || '<tr><td colspan="6" class="muted">No results.</td></tr>';
</tr>`).join('') || `<tr><td colspan="6" class="empty-cell"><strong>No results to show</strong><span>${state.report ? 'Try another status filter.' : 'Run a scan to see your check results here.'}</span></td></tr>`;
}

function renderFindings() {
Expand All @@ -66,7 +70,7 @@ function renderFindings() {
$('#findings-table tbody').innerHTML = rows.map(f => `<tr>
<td>${esc(f.check)}</td><td>${esc(f.level)}</td><td>${esc(f.rule || '')}</td>
<td>${esc(f.path || '')}</td><td>${f.line ?? ''}</td><td>${esc(f.message)}</td>
</tr>`).join('') || '<tr><td colspan="6" class="muted">No findings. Adapters may include structured findings in future scans.</td></tr>';
</tr>`).join('') || `<tr><td colspan="6" class="empty-cell"><strong>No findings to show</strong><span>${q ? 'Try a different search.' : state.report ? 'No structured findings were reported in this scan.' : 'Run a scan to see reported findings.'}</span></td></tr>`;
}

async function runScan() {
Expand All @@ -77,6 +81,7 @@ async function runScan() {
const report = await api('/api/scan', { method: 'POST', body: JSON.stringify({ path: target }) });
renderReport(report);
$('#scan-status').textContent = `Scan complete. Policy ${report.policy_passed ? 'PASS' : 'FAIL'}.`;
loadHistory();
} catch (e) {
$('#scan-status').textContent = `Error: ${e.message}`;
} finally { btn.disabled = false; }
Expand Down Expand Up @@ -115,8 +120,12 @@ async function loadHistory() {
<td><button class="ghost" data-load-report="${esc(r.file)}">Load</button></td>
</tr>`).join('') || '<tr><td colspan="6" class="muted">No saved JSON reports found in .codeproof/reports.</td></tr>';
$$('#history-table [data-load-report]').forEach(btn => btn.addEventListener('click', async () => {
const report = await api(`/api/report?path=${encodeURIComponent(target)}&file=${encodeURIComponent(btn.dataset.loadReport)}`);
renderReport(report); setView('dashboard');
try {
const report = await api(`/api/report?path=${encodeURIComponent(target)}&file=${encodeURIComponent(btn.dataset.loadReport)}`);
renderReport(report); setView('dashboard');
} catch (e) {
$('#history-table tbody').innerHTML = `<tr><td colspan="6" class="muted">Error: ${esc(e.message)}</td></tr>`;
}
}));
} catch (e) { $('#history-table tbody').innerHTML = `<tr><td colspan="6" class="muted">Error: ${esc(e.message)}</td></tr>`; }
}
Expand All @@ -125,7 +134,7 @@ $$('.nav-btn').forEach(b => b.addEventListener('click', () => setView(b.dataset.
$('#run-scan').addEventListener('click', runScan);
$('#status-filter').addEventListener('change', renderResults);
$('#finding-search').addEventListener('input', renderFindings);
$('#refresh-doctor').addEventListener('click', loadDoctor);
$('#refresh-doctor').addEventListener('click', () => setView('policy'));
$('#load-inventory').addEventListener('click', loadInventory);
$('#load-policy').addEventListener('click', () => { loadPolicy(); loadDoctor(); });
$('#load-history').addEventListener('click', loadHistory);
Expand Down
164 changes: 45 additions & 119 deletions src/codeproof/gui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,144 +7,70 @@
<link rel="stylesheet" href="/static/styles.css" />
</head>
<body>
<svg class="icon-defs" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
<symbol id="i-grid" viewBox="0 0 24 24"><rect x="3" y="3" width="7" height="7" rx="1"/><rect x="14" y="3" width="7" height="7" rx="1"/><rect x="3" y="14" width="7" height="7" rx="1"/><rect x="14" y="14" width="7" height="7" rx="1"/></symbol>
<symbol id="i-search" viewBox="0 0 24 24"><circle cx="11" cy="11" r="7"/><path d="m16 16 4 4"/></symbol>
<symbol id="i-box" viewBox="0 0 24 24"><path d="M4 7 12 3l8 4v10l-8 4-8-4zM4 7l8 4 8-4M12 11v10"/></symbol>
<symbol id="i-shield" viewBox="0 0 24 24"><path d="M12 3 20 6v5c0 5-3.3 8.2-8 10-4.7-1.8-8-5-8-10V6z"/><path d="m9 12 2 2 4-4"/></symbol>
<symbol id="i-clock" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/></symbol>
<symbol id="i-arrow" viewBox="0 0 24 24"><path d="M5 12h14M14 7l5 5-5 5"/></symbol>
<symbol id="i-folder" viewBox="0 0 24 24"><path d="M3 6a2 2 0 0 1 2-2h5l2 2h7a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/></symbol>
<symbol id="i-check" viewBox="0 0 24 24"><path d="m5 12 4 4L19 6"/></symbol>
<symbol id="i-spark" viewBox="0 0 24 24"><path d="m12 3 1.7 5.3L19 10l-5.3 1.7L12 17l-1.7-5.3L5 10l5.3-1.7zM19 16l.7 2.3L22 19l-2.3.7L19 22l-.7-2.3L16 19l2.3-.7z"/></symbol>
</svg>
<div class="app">
<aside class="sidebar">
<div class="brand">
<div class="logo">CP</div>
<div>
<h1>CodeProof AI</h1>
<p class="muted">Evidence-backed verification</p>
</div>
<div class="logo"><svg><use href="#i-shield"/></svg></div>
<div><h1>CodeProof<span> AI</span></h1><p>VERIFY WITH CONFIDENCE</p></div>
</div>
<nav>
<button class="nav-btn active" data-view="dashboard">Dashboard</button>
<button class="nav-btn" data-view="findings">Findings</button>
<button class="nav-btn" data-view="inventory">Inventory</button>
<button class="nav-btn" data-view="policy">Policy</button>
<button class="nav-btn" data-view="history">History</button>
<div class="nav-label">WORKSPACE</div>
<nav aria-label="Main navigation">
<button class="nav-btn active" data-view="dashboard"><svg><use href="#i-grid"/></svg>Overview</button>
<button class="nav-btn" data-view="findings"><svg><use href="#i-search"/></svg>Findings</button>
<button class="nav-btn" data-view="inventory"><svg><use href="#i-box"/></svg>Inventory</button>
<button class="nav-btn" data-view="policy"><svg><use href="#i-shield"/></svg>Policy &amp; tools</button>
<button class="nav-btn" data-view="history"><svg><use href="#i-clock"/></svg>History</button>
</nav>
<div class="sidebar-footer">
<div class="field">
<label for="target">Target repository</label>
<input id="target" type="text" spellcheck="false" />
</div>
<button id="run-scan" class="primary">Run Scan</button>
<p id="scan-status" class="muted small"></p>
<div class="local-icon"><svg><use href="#i-shield"/></svg></div>
<strong>Local by design</strong>
<p>Scans run in your workspace. You’re in control of every scan.</p>
<span><i></i> LOCAL WORKSPACE</span>
</div>
<div class="sidebar-bottom">CODEPROOF AI <span>·</span> LOCAL FIRST</div>
</aside>

<main class="content">
<div class="utility-bar"><div>WORKSPACE <span>/</span> <strong id="breadcrumb">OVERVIEW</strong></div><div class="local-pill"><i></i> Local environment</div></div>
<header class="topbar">
<div>
<h2 id="view-title">Dashboard</h2>
<p id="project-meta" class="muted">No scan loaded.</p>
</div>
<div class="topbar-actions">
<button id="refresh-doctor" class="ghost">Check Tools</button>
<button id="open-reports" class="ghost">Open Reports Folder</button>
</div>
<div><div class="eyebrow">YOUR WORKSPACE</div><h2 id="view-title">Repository overview</h2><p id="project-meta" class="muted">A clearer picture of your code starts here.</p></div>
<div class="topbar-actions"><button id="refresh-doctor" class="ghost"><svg><use href="#i-check"/></svg>Check tools</button><button id="open-reports" class="ghost"><svg><use href="#i-folder"/></svg>Open reports</button></div>
</header>

<section id="view-dashboard" class="view active">
<div class="cards">
<div class="card score-card">
<div class="score-ring" id="score-ring"><span id="score-value">—</span></div>
<div>
<div class="kpi-label">Confidence Score</div>
<div id="grade" class="grade">—</div>
<div id="policy-badge" class="badge">No data</div>
</div>
</div>
<div class="card">
<div class="kpi-label">Checks</div>
<div id="kpi-checks" class="kpi">—</div>
<div class="muted small" id="kpi-checks-sub"></div>
</div>
<div class="card">
<div class="kpi-label">Findings</div>
<div id="kpi-findings" class="kpi">—</div>
<div class="muted small">Structured findings reported by adapters</div>
</div>
<div class="card">
<div class="kpi-label">Fail Under</div>
<div id="kpi-threshold" class="kpi">—</div>
<div class="muted small" id="kpi-generated"></div>
<div class="hero">
<div class="hero-copy"><div class="hero-kicker"><span></span> EVIDENCE, NOT GUESSWORK</div><h3>Know where your<br /><em>code stands.</em></h3><p>Run your checks in one place and turn the results into a clearer picture of your repository’s health.</p>
<div class="scan-controls"><div class="field"><label for="target">TARGET REPOSITORY</label><div class="input-wrap"><svg><use href="#i-folder"/></svg><input id="target" type="text" spellcheck="false" placeholder="Path to your repository" /></div></div><button id="run-scan" class="primary">Run scan <svg><use href="#i-arrow"/></svg></button></div>
<p id="scan-status" class="scan-status" role="status" aria-live="polite">Checks run locally in your target repository.</p>
</div>
<div class="hero-score"><div class="score-heading">REPORT CONFIDENCE <span>↗</span></div><div class="score-ring" id="score-ring"><div class="score-inner"><span id="score-value">—</span><small>OUT OF 100</small></div></div><div id="grade" class="grade">No scan yet</div><div id="policy-badge" class="badge">Awaiting results</div></div>
</div>

<div class="panel">
<div class="panel-head">
<h3>Check Results</h3>
<div class="filters">
<select id="status-filter">
<option value="all">All statuses</option>
<option value="passed">Passed</option>
<option value="failed">Failed</option>
<option value="unavailable">Unavailable</option>
<option value="error">Error</option>
</select>
</div>
</div>
<div class="table-wrap">
<table id="results-table">
<thead><tr><th>Check</th><th>Status</th><th>Weight</th><th>Required</th><th>Duration</th><th>Summary</th></tr></thead>
<tbody></tbody>
</table>
</div>
</div>

<div class="panel">
<div class="panel-head"><h3>Limitations</h3></div>
<ul id="limitations" class="limitations"></ul>
</div>
</section>

<section id="view-findings" class="view">
<div class="panel">
<div class="panel-head"><h3>Findings</h3><input id="finding-search" class="search" placeholder="Filter findings..." /></div>
<div class="table-wrap">
<table id="findings-table">
<thead><tr><th>Check</th><th>Level</th><th>Rule</th><th>Path</th><th>Line</th><th>Message</th></tr></thead>
<tbody></tbody>
</table>
</div>
</div>
</section>

<section id="view-inventory" class="view">
<div class="panel">
<div class="panel-head"><h3>Public Symbols</h3><button id="load-inventory" class="ghost">Load Inventory</button></div>
<div class="table-wrap">
<table id="inventory-table">
<thead><tr><th>Symbol</th><th>File</th><th>Line</th></tr></thead>
<tbody></tbody>
</table>
</div>
</div>
</section>

<section id="view-policy" class="view">
<div class="panel">
<div class="panel-head"><h3>Effective Policy</h3><button id="load-policy" class="ghost">Reload</button></div>
<pre id="policy-json" class="codeblock"></pre>
</div>
<div class="panel">
<div class="panel-head"><h3>Tool Availability</h3></div>
<div id="doctor" class="doctor-grid"></div>
<div class="section-heading"><div><div class="eyebrow">AT A GLANCE</div><h3>Scan summary</h3></div><span class="section-note">A snapshot of your loaded report</span></div>
<div class="cards">
<div class="card"><div class="card-top"><span class="kpi-label">CHECKS</span><span class="metric-icon blue"><svg><use href="#i-check"/></svg></span></div><div id="kpi-checks" class="kpi">—</div><div class="muted small" id="kpi-checks-sub">Checks completed</div></div>
<div class="card"><div class="card-top"><span class="kpi-label">FINDINGS</span><span class="metric-icon peach"><svg><use href="#i-search"/></svg></span></div><div id="kpi-findings" class="kpi">—</div><div class="muted small">Structured findings reported</div></div>
<div class="card"><div class="card-top"><span class="kpi-label">PASS THRESHOLD</span><span class="metric-icon green"><svg><use href="#i-shield"/></svg></span></div><div id="kpi-threshold" class="kpi">—</div><div class="muted small" id="kpi-generated">Defined by your policy</div></div>
</div>
</section>

<section id="view-history" class="view">
<div class="panel">
<div class="panel-head"><h3>Report History</h3><button id="load-history" class="ghost">Reload</button></div>
<div class="table-wrap">
<table id="history-table">
<thead><tr><th>Generated</th><th>Project</th><th>Score</th><th>Grade</th><th>Policy</th><th>Action</th></tr></thead>
<tbody></tbody>
</table>
</div>
<div class="dashboard-grid">
<div class="panel results-panel"><div class="panel-head"><div><div class="eyebrow">THE DETAILS</div><h3>Check results</h3><p>See how each check performed.</p></div><div class="filters"><label class="sr-only" for="status-filter">Filter by status</label><select id="status-filter"><option value="all">All statuses</option><option value="passed">Passed</option><option value="failed">Failed</option><option value="unavailable">Unavailable</option><option value="error">Error</option></select></div></div><div class="table-wrap" tabindex="0"><table id="results-table"><thead><tr><th>Check</th><th>Status</th><th>Weight</th><th>Required</th><th>Duration</th><th>Summary</th></tr></thead><tbody><tr><td colspan="6" class="empty-cell"><div class="empty-icon"><svg><use href="#i-check"/></svg></div><strong>Ready when you are</strong><span>Run a scan to see your check results here.</span></td></tr></tbody></table></div></div>
<div class="panel insight-panel"><div class="panel-head"><div><div class="eyebrow">GOOD TO KNOW</div><h3>About your results</h3></div><span class="insight-icon"><svg><use href="#i-spark"/></svg></span></div><div class="insight-body"><p>Confidence is built from the checks in your policy. Each report shows what passed, what didn’t, and what needs a closer look.</p><div class="insight-divider"></div><div class="insight-title">KEEP IN MIND</div><ul id="limitations" class="limitations"><li>A passing report is evidence, not proof that code is correct.</li><li>Scans may execute repository code. Use an isolated environment for untrusted projects.</li></ul></div></div>
</div>
</section>
<section id="view-findings" class="view"><div class="panel"><div class="panel-head"><div><div class="eyebrow">EXPLORE</div><h3>Findings</h3><p>Review the details reported by your checks.</p></div><label class="sr-only" for="finding-search">Filter findings</label><input id="finding-search" class="search" placeholder="Search findings..." /></div><div class="table-wrap" tabindex="0"><table id="findings-table"><thead><tr><th>Check</th><th>Level</th><th>Rule</th><th>Path</th><th>Line</th><th>Message</th></tr></thead><tbody><tr><td colspan="6" class="empty-cell"><strong>No findings to show</strong><span>Run a scan to see reported findings.</span></td></tr></tbody></table></div></div></section>
<section id="view-inventory" class="view"><div class="panel"><div class="panel-head"><div><div class="eyebrow">EXPLORE</div><h3>Public symbols</h3><p>Browse the public symbols in your repository.</p></div><button id="load-inventory" class="ghost">Load inventory</button></div><div class="table-wrap" tabindex="0"><table id="inventory-table"><thead><tr><th>Symbol</th><th>File</th><th>Line</th></tr></thead><tbody><tr><td colspan="3" class="empty-cell"><strong>Inventory is ready to load</strong><span>Load your public symbols to explore them here.</span></td></tr></tbody></table></div></div></section>
<section id="view-policy" class="view"><div class="panel"><div class="panel-head"><div><div class="eyebrow">CONFIGURATION</div><h3>Effective policy</h3><p>The settings used to evaluate your repository.</p></div><button id="load-policy" class="ghost">Reload</button></div><pre id="policy-json" class="codeblock">Select Reload to view your effective policy.</pre></div><div class="panel"><div class="panel-head"><div><div class="eyebrow">ENVIRONMENT</div><h3>Tool availability</h3><p>Check which tools are available locally.</p></div></div><div id="doctor" class="doctor-grid"></div></div></section>
<section id="view-history" class="view"><div class="panel"><div class="panel-head"><div><div class="eyebrow">PREVIOUS RUNS</div><h3>Report history</h3><p>Return to a saved report from this repository.</p></div><button id="load-history" class="ghost">Reload</button></div><div class="table-wrap" tabindex="0"><table id="history-table"><thead><tr><th>Generated</th><th>Project</th><th>Score</th><th>Grade</th><th>Policy</th><th>Action</th></tr></thead><tbody></tbody></table></div></div></section>
</main>
</div>
<script src="/static/app.js"></script>
Expand Down
Loading
Loading