Website build error (#1136)

* Fixing model names

* handling arrays of models for agent frontmatter

* Cleaning up some warnings on website build

* adding a workflow to run and perform CI of the website
This commit is contained in:
Aaron Powell
2026-03-23 16:04:46 +11:00
committed by GitHub
parent 165d601f2a
commit 562185066e
6 changed files with 87 additions and 11 deletions

View File

@@ -115,7 +115,12 @@ export default defineConfig({
trailingSlash: "always",
vite: {
build: {
sourcemap: true,
// Production sourcemaps trigger a known warning in the expressive-code Vite plugin.
// The docs site does not need emitted JS sourcemaps for its validation build.
sourcemap: false,
// Starlight ships large syntax-highlighting chunks that are expected for this site.
// Raise the threshold so Vite only warns on materially larger regressions.
chunkSizeWarningLimit: 900,
},
css: {
devSourcemap: true,

View File

@@ -10,7 +10,7 @@ export interface RenderableAgent {
title: string;
description?: string;
path: string;
model?: string;
model?: string | string[];
tools?: string[];
hasHandoffs?: boolean;
lastUpdated?: string | null;

View File

@@ -8,7 +8,7 @@ import { setupModal, openFileModal } from '../modal';
import { renderAgentsHtml, sortAgents, type AgentSortOption, type RenderableAgent } from './agents-render';
interface Agent extends SearchItem, RenderableAgent {
model?: string;
model?: string | string[];
tools?: string[];
hasHandoffs?: boolean;
lastUpdated?: string | null;
@@ -51,7 +51,7 @@ function applyFiltersAndRender(): void {
if (currentFilters.models.includes('(none)') && !item.model) {
return true;
}
return item.model && currentFilters.models.includes(item.model);
return item.model && (Array.isArray(item.model) ? item.model.some(m => currentFilters.models.includes(m)) : currentFilters.models.includes(item.model));
});
}

View File

@@ -276,7 +276,11 @@ export function debounce<T extends (...args: unknown[]) => void>(
/**
* Escape HTML to prevent XSS
*/
export function escapeHtml(text: string): string {
export function escapeHtml(text: string | string[]): string {
if (Array.isArray(text)) {
return text.map(escapeHtml).join(", ");
}
return text
.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
@@ -290,17 +294,17 @@ export function escapeHtml(text: string): string {
* Only allows http/https protocols, returns '#' for invalid URLs
*/
export function sanitizeUrl(url: string | null | undefined): string {
if (!url) return '#';
if (!url) return "#";
try {
const parsed = new URL(url);
// Only allow http and https protocols
if (parsed.protocol === 'http:' || parsed.protocol === 'https:') {
if (parsed.protocol === "http:" || parsed.protocol === "https:") {
return url;
}
} catch {
// Invalid URL
}
return '#';
return "#";
}
/**