Skip to content

Commit a12fd9f

Browse files
authored
Update category titles and descriptions (#97)
1 parent d252013 commit a12fd9f

File tree

1 file changed

+61
-28
lines changed

1 file changed

+61
-28
lines changed

scripts/generate-api-docs.ts

Lines changed: 61 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -837,22 +837,7 @@ ${streamingEventsDocs}
837837
}
838838

839839
function getCategoryTitle(category: string): string {
840-
const titles: Record<string, string> = {
841-
sprites: 'Sprites',
842-
exec: 'Exec',
843-
checkpoints: 'Checkpoints',
844-
services: 'Services',
845-
proxy: 'HTTP Proxy',
846-
policy: 'Policy',
847-
organization: 'Organization',
848-
tokens: 'Tokens',
849-
files: 'Files',
850-
filesystem: 'Filesystem',
851-
attach: 'Attach',
852-
};
853-
return (
854-
titles[category] || category.charAt(0).toUpperCase() + category.slice(1)
855-
);
840+
return category.charAt(0).toUpperCase() + category.slice(1);
856841
}
857842

858843
// Manual pages that are not generated from schema but should be included
@@ -883,25 +868,62 @@ const MANUAL_PAGES: ManualPage[] = [
883868
},
884869
];
885870

871+
// Short descriptions for YAML frontmatter and meta tags (must be single-line)
886872
function getCategoryDescription(category: string): string {
887873
const descriptions: Record<string, string> = {
888-
sprites: 'Create, list, update, and delete Sprites',
889-
exec: 'Execute commands in Sprites via WebSocket',
890-
checkpoints: 'Create, list, and restore environment snapshots',
891-
services: 'Manage background services running in Sprites',
892-
proxy: 'Forward HTTP requests to services inside Sprites',
893-
policy: 'Manage access control policies',
894-
organization: 'Organization settings and information',
895-
tokens: 'Create and manage API tokens',
896-
files: 'Upload and download files',
897-
filesystem: 'Browse and manage the filesystem',
898-
attach: 'Interactive terminal sessions via WebSocket',
874+
sprites:
875+
'Persistent environments that hibernate when idle and wake automatically on demand.',
876+
exec: 'Run commands inside Sprites over WebSocket connections.',
877+
checkpoints:
878+
"Capture your Sprite's complete filesystem state for instant rollback.",
879+
services: 'Manage background services running in your Sprite environment.',
880+
proxy:
881+
'Tunnel TCP connections directly to services running inside your Sprite.',
882+
policy: 'Control outbound network access using DNS-based filtering.',
883+
organization: 'Organization settings and information.',
884+
tokens: 'Create and manage API tokens.',
885+
files: 'Upload and download files.',
886+
filesystem: 'Browse and manage the filesystem.',
887+
attach: 'Interactive terminal sessions via WebSocket.',
899888
};
900889
return (
901890
descriptions[category] || `${getCategoryTitle(category)} API endpoints`
902891
);
903892
}
904893

894+
// Full descriptions for page content (can be multi-paragraph)
895+
function getCategoryFullDescription(category: string): string[] {
896+
const descriptions: Record<string, string[]> = {
897+
sprites: [
898+
'Sprites are persistent environments that hibernate when idle and wake automatically on demand. You only pay for compute while actively using them—storage persists indefinitely.',
899+
'Create Sprites for development environments, CI runners, code execution sandboxes, or any workload that benefits from fast startup with preserved state. Each Sprite gets a unique URL for HTTP access, configurable as public or authenticated.',
900+
],
901+
exec: [
902+
'Run commands inside Sprites over WebSocket connections. The exec API is designed for both one-shot commands and long-running interactive sessions.',
903+
'Sessions persist across disconnections—start a dev server or build, disconnect, and reconnect later to resume streaming output. The binary protocol efficiently multiplexes stdin, stdout, and stderr over a single connection.',
904+
],
905+
checkpoints: [
906+
"Checkpoints capture your Sprite's complete filesystem state for instant rollback. They're live snapshots—creation takes milliseconds with no interruption to running processes.",
907+
'Use checkpoints before risky operations, to create reproducible environments, or to share known-good states across a team. Copy-on-write storage keeps incremental checkpoints small; you only store what changed.',
908+
],
909+
services: [],
910+
proxy: [
911+
'Tunnel TCP connections directly to services running inside your Sprite. After a brief WebSocket handshake, the connection becomes a transparent relay to any port.',
912+
'Use this to access dev servers, databases, or any TCP service as if it were running locally. The proxy handles connection setup; your client speaks directly to the target service.',
913+
],
914+
policy: [
915+
'Control outbound network access using DNS-based filtering. Policies define which domains sprites can reach, with support for exact matches, wildcard subdomains, and preset rule bundles.',
916+
'Changes apply immediately—existing connections to newly-blocked domains are terminated. Failed DNS lookups return REFUSED for fast failure.',
917+
],
918+
organization: [],
919+
tokens: [],
920+
files: [],
921+
filesystem: [],
922+
attach: [],
923+
};
924+
return descriptions[category] || [];
925+
}
926+
905927
async function generateCategoryPage(
906928
category: string,
907929
endpoints: APIEndpoint[],
@@ -916,9 +938,20 @@ async function generateCategoryPage(
916938
): Promise<string> {
917939
const title = getCategoryTitle(category);
918940
const description = getCategoryDescription(category);
941+
const fullDescription = getCategoryFullDescription(category);
919942

920943
const hasWebSocket = endpoints.some((e) => e.protocol === 'websocket');
921944

945+
// Render full description paragraphs (only if there are any)
946+
const descriptionHtml =
947+
fullDescription.length > 0
948+
? `<div style={{ marginBottom: '2rem' }}>
949+
${fullDescription.map((para) => `<p className="sl-text-lg" style={{ marginBottom: '1rem', color: 'var(--sl-color-gray-2)' }}>${para}</p>`).join('\n')}
950+
</div>
951+
952+
`
953+
: '';
954+
922955
let content = `---
923956
title: ${title} API
924957
description: ${description}
@@ -937,7 +970,7 @@ import CodeSnippets from '@/components/CodeSnippets.astro';
937970
938971
<div className="api-full-width">
939972
940-
`;
973+
${descriptionHtml}`;
941974

942975
if (hasWebSocket) {
943976
content += `<Callout type="info" client:load>

0 commit comments

Comments
 (0)