Implemented three core frontend pages using Tailwind CSS:
1. Homepage (index.html):
- Hero section explaining framework value proposition
- Three audience paths: Researcher, Implementer, Advocate
- Framework capabilities showcase (6 core capabilities)
- Te Tiriti acknowledgment in footer
- Links to demos, documentation, and API
2. Documentation Viewer (docs.html):
- Sidebar navigation with document list from /api/documents
- Main content area with prose styling for technical docs
- Automatic table of contents generation
- Responsive grid layout (4-column on desktop)
3. Interactive Tractatus Demo (demos/tractatus-demo.html):
- Four interactive demonstration tabs:
* 27027 incident prevention (side-by-side comparison)
* Live instruction classification (STR/OPS/TAC/SYS/STO)
* Boundary enforcement examples (Tractatus 12.1-12.7)
* Context pressure monitoring with interactive sliders
- Real-time API integration with governance services
- Visual comparison of WITH/WITHOUT framework behavior
All pages tested and operational with governance API endpoints.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
181 lines
6.5 KiB
HTML
181 lines
6.5 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Framework Documentation | Tractatus AI Safety</title>
|
|
<script src="https://cdn.tailwindcss.com"></script>
|
|
<style>
|
|
.prose { max-width: none; }
|
|
.prose h1 { @apply text-3xl font-bold text-gray-900 mb-4 mt-8; }
|
|
.prose h2 { @apply text-2xl font-semibold text-gray-900 mb-3 mt-6; }
|
|
.prose h3 { @apply text-xl font-semibold text-gray-900 mb-2 mt-4; }
|
|
.prose p { @apply text-gray-700 mb-4 leading-relaxed; }
|
|
.prose code { @apply bg-gray-100 px-2 py-1 rounded text-sm font-mono text-gray-800; }
|
|
.prose pre { @apply bg-gray-900 text-gray-100 p-4 rounded-lg mb-4 overflow-x-auto; }
|
|
.prose ul { @apply list-disc pl-6 mb-4 text-gray-700; }
|
|
.prose ol { @apply list-decimal pl-6 mb-4 text-gray-700; }
|
|
.prose table { @apply w-full border-collapse mb-4; }
|
|
.prose th { @apply bg-gray-100 border border-gray-300 px-4 py-2 text-left font-semibold; }
|
|
.prose td { @apply border border-gray-300 px-4 py-2; }
|
|
.doc-link:hover { @apply bg-blue-50; }
|
|
#toc a:hover { @apply text-blue-700 underline; }
|
|
</style>
|
|
</head>
|
|
<body class="bg-gray-50">
|
|
|
|
<!-- Header -->
|
|
<header class="bg-white border-b border-gray-200 sticky top-0 z-10">
|
|
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-4">
|
|
<div class="flex items-center justify-between">
|
|
<div>
|
|
<h1 class="text-2xl font-bold text-gray-900">Framework Documentation</h1>
|
|
</div>
|
|
<a href="/" class="text-blue-600 hover:text-blue-700 font-medium">← Home</a>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
|
|
<!-- Main Layout -->
|
|
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
|
|
<div class="grid grid-cols-1 lg:grid-cols-4 gap-8">
|
|
|
|
<!-- Sidebar -->
|
|
<aside class="lg:col-span-1">
|
|
<div class="bg-white rounded-lg shadow-sm border border-gray-200 p-4 sticky top-24">
|
|
<h3 class="font-semibold text-gray-900 mb-3">Documents</h3>
|
|
<div id="document-list" class="space-y-1">
|
|
<div class="text-sm text-gray-500">Loading...</div>
|
|
</div>
|
|
|
|
<div class="mt-6 pt-4 border-t border-gray-200">
|
|
<h4 class="font-semibold text-gray-900 mb-3 text-sm">Table of Contents</h4>
|
|
<div id="toc" class="text-sm space-y-1">
|
|
<div class="text-gray-500">Select a document</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</aside>
|
|
|
|
<!-- Main Content -->
|
|
<main class="lg:col-span-3">
|
|
<div id="document-content" class="bg-white rounded-lg shadow-sm border border-gray-200 p-8">
|
|
<div class="text-center py-12">
|
|
<svg class="mx-auto h-12 w-12 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
|
|
</svg>
|
|
<h3 class="mt-2 text-lg font-medium text-gray-900">Select a Document</h3>
|
|
<p class="mt-1 text-sm text-gray-500">Choose a document from the sidebar to begin reading</p>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
let documents = [];
|
|
let currentDocument = null;
|
|
|
|
// Load document list
|
|
async function loadDocuments() {
|
|
try {
|
|
const response = await fetch('/api/documents');
|
|
const data = await response.json();
|
|
documents = data.documents || [];
|
|
|
|
const listEl = document.getElementById('document-list');
|
|
if (documents.length === 0) {
|
|
listEl.innerHTML = '<div class="text-sm text-gray-500">No documents available</div>';
|
|
return;
|
|
}
|
|
|
|
listEl.innerHTML = documents.map(doc => `
|
|
<button onclick="loadDocument('${doc.slug}')"
|
|
class="doc-link w-full text-left px-3 py-2 rounded text-sm hover:bg-blue-50 transition"
|
|
data-slug="${doc.slug}">
|
|
<div class="font-medium text-gray-900 truncate">${doc.title}</div>
|
|
${doc.quadrant ? `<div class="text-xs text-gray-500 mt-1">${doc.quadrant}</div>` : ''}
|
|
</button>
|
|
`).join('');
|
|
|
|
// Auto-load first document
|
|
if (documents.length > 0) {
|
|
loadDocument(documents[0].slug);
|
|
}
|
|
} catch (error) {
|
|
console.error('Error loading documents:', error);
|
|
document.getElementById('document-list').innerHTML =
|
|
'<div class="text-sm text-red-600">Error loading documents</div>';
|
|
}
|
|
}
|
|
|
|
// Load specific document
|
|
async function loadDocument(slug) {
|
|
try {
|
|
const response = await fetch(`/api/documents/${slug}`);
|
|
const data = await response.json();
|
|
currentDocument = data.document;
|
|
|
|
// Update active state
|
|
document.querySelectorAll('.doc-link').forEach(el => {
|
|
if (el.dataset.slug === slug) {
|
|
el.classList.add('bg-blue-100', 'text-blue-900');
|
|
} else {
|
|
el.classList.remove('bg-blue-100', 'text-blue-900');
|
|
}
|
|
});
|
|
|
|
// Render content
|
|
const contentEl = document.getElementById('document-content');
|
|
contentEl.innerHTML = `
|
|
<div class="prose max-w-none">
|
|
${currentDocument.content_html}
|
|
</div>
|
|
`;
|
|
|
|
// Render table of contents
|
|
renderTOC(currentDocument.toc || []);
|
|
|
|
// Scroll to top
|
|
window.scrollTo(0, 0);
|
|
|
|
} catch (error) {
|
|
console.error('Error loading document:', error);
|
|
document.getElementById('document-content').innerHTML = `
|
|
<div class="text-center py-12">
|
|
<div class="text-red-600">Error loading document</div>
|
|
</div>
|
|
`;
|
|
}
|
|
}
|
|
|
|
// Render table of contents
|
|
function renderTOC(toc) {
|
|
const tocEl = document.getElementById('toc');
|
|
|
|
if (!toc || toc.length === 0) {
|
|
tocEl.innerHTML = '<div class="text-gray-500">No table of contents</div>';
|
|
return;
|
|
}
|
|
|
|
tocEl.innerHTML = toc
|
|
.filter(item => item.level <= 3) // Only show H1, H2, H3
|
|
.map(item => {
|
|
const indent = (item.level - 1) * 12;
|
|
return `
|
|
<a href="#${item.slug}"
|
|
class="block text-gray-600 hover:text-blue-600 transition"
|
|
style="padding-left: ${indent}px">
|
|
${item.title}
|
|
</a>
|
|
`;
|
|
}).join('');
|
|
}
|
|
|
|
// Initialize
|
|
loadDocuments();
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|