Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit 421f763

Browse files
committed
new site blog, main page, and model hub added
1 parent 1a94074 commit 421f763

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+9735
-168
lines changed

new-docs/astro.config.mjs

Lines changed: 161 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// @ts-check
22
import { defineConfig } from "astro/config";
33
import starlight from "@astrojs/starlight";
4+
import starlightUtils from "@lorenzo_lewis/starlight-utils";
45

56
// https://astro.build/config
67
export default defineConfig({
@@ -17,45 +18,193 @@ export default defineConfig({
1718
linkedin: "https://github.com/menloresearch/cortex.cpp",
1819
},
1920
sidebar: [
21+
{
22+
label: "Title Bar",
23+
items: [
24+
{ label: "Docs", link: "overview" },
25+
{ label: "Model Hub", link: "../pages/index" },
26+
],
27+
},
2028
{ label: "Welcome", slug: "overview" },
2129
{
2230
label: "Get Started",
2331
items: [
24-
// Each item here is one entry in the navigation menu.
25-
2632
{ label: "Quickstart", slug: "getting-started/quickstart" },
2733
{
2834
label: "Installation",
2935
items: [
3036
{
31-
label: "Install",
37+
label: "Overview",
3238
slug: "getting-started/installation/installation",
3339
},
3440
{
3541
label: "Docker",
3642
slug: "getting-started/installation/docker",
3743
},
44+
{ label: "Linux", slug: "getting-started/installation/linux" },
45+
{ label: "macOS", slug: "getting-started/installation/mac" },
46+
{
47+
label: "Windows",
48+
slug: "getting-started/installation/windows",
49+
},
50+
],
51+
},
52+
{ label: "Requirements", slug: "requirements" },
53+
{ label: "Basic Usage", slug: "basic-usage" },
54+
{ label: "Using Models", slug: "using-models" },
55+
{ label: "Troubleshooting", slug: "troubleshooting" },
56+
],
57+
},
58+
{
59+
label: "Features",
60+
items: [
61+
{ label: "Chat Completions", slug: "chat-completions" },
62+
{
63+
label: "Capabilities",
64+
items: [
65+
{
66+
label: "Text Generation",
67+
slug: "capabilities/text-generation",
68+
},
69+
{ label: "Embeddings", slug: "capabilities/embeddings" },
70+
],
71+
},
72+
{
73+
label: "Assistants",
74+
slug: "assistants",
75+
items: [{ label: "Tools", slug: "assistants/tools" }],
76+
},
77+
],
78+
},
79+
{
80+
label: "Models",
81+
items: [
82+
{ label: "Overview", slug: "capabilities/models" },
83+
{ label: "Model YAML", slug: "capabilities/models/model-yaml" },
84+
{
85+
label: "Model Sources",
86+
items: [
87+
{ label: "Overview", slug: "capabilities/models/sources" },
88+
{
89+
label: "Cortex Hub",
90+
slug: "capabilities/models/sources/cortex-hub",
91+
},
92+
{
93+
label: "Hugging Face",
94+
slug: "capabilities/models/sources/hugging-face",
95+
},
96+
{
97+
label: "NVIDIA NGC",
98+
slug: "capabilities/models/sources/nvidia-ngc",
99+
},
38100
],
39101
},
40-
// { label: "Docker", slug: "getting-started/installation/docker" },
41-
// { label: "Overview", slug: "overview" },
42-
// { label: "Overview", slug: "overview" },
43-
// { label: "Overview", slug: "overview" },
44-
// { label: "Overview", slug: "overview" },
102+
{ label: "Hardware", slug: "capabilities/hardware" },
103+
],
104+
},
105+
{
106+
label: "CLI",
107+
items: [
108+
{ label: "Overview", slug: "cli/cortex" },
109+
{ label: "Run", slug: "cli/run" },
110+
{ label: "Start", slug: "cli/start" },
111+
{ label: "Stop", slug: "cli/stop" },
112+
{ label: "PS", slug: "cli/ps" },
113+
{ label: "Serve", slug: "cli/serve" },
114+
{ label: "Pull", slug: "cli/pull" },
115+
{ label: "Update", slug: "cli/update" },
116+
{ label: "Benchmark", slug: "cli/benchmark" },
117+
// { label: "Embeddings", slug: "cli/embeddings" },
118+
{ label: "Presets", slug: "cli/presets" },
119+
{ label: "Config", slug: "cli/config" },
120+
{ label: "Telemetry", slug: "cli/telemetry" },
121+
{
122+
label: "Models",
123+
items: [
124+
{ label: "Overview", slug: "cli/models" },
125+
{ label: "List", slug: "cli/models/list" },
126+
{ label: "Get", slug: "cli/models/get" },
127+
{ label: "Download", slug: "cli/models/download" },
128+
{ label: "Start", slug: "cli/models/start" },
129+
{ label: "Stop", slug: "cli/models/stop" },
130+
{ label: "Update", slug: "cli/models/update" },
131+
{ label: "Remove", slug: "cli/models/remove" },
132+
],
133+
},
134+
{
135+
label: "Configs",
136+
items: [
137+
{ label: "Overview", slug: "cli/configs" },
138+
{ label: "List", slug: "cli/configs/list" },
139+
{ label: "Get", slug: "cli/configs/get" },
140+
{ label: "Set", slug: "cli/configs/set" },
141+
],
142+
},
143+
{
144+
label: "Engines",
145+
items: [
146+
{ label: "Overview", slug: "cli/engines" },
147+
{ label: "List", slug: "cli/engines/list" },
148+
{ label: "Get", slug: "cli/engines/get" },
149+
{ label: "Init", slug: "cli/engines/init" },
150+
],
151+
},
152+
{
153+
label: "Hardware",
154+
slug: "cli/hardware",
155+
},
156+
],
157+
},
158+
{
159+
label: "Configurations",
160+
items: [
161+
{ label: "Overview", slug: "configurations" },
162+
{ label: "CORS", slug: "configurations/cors" },
163+
{ label: "Proxy", slug: "configurations/proxy" },
164+
{ label: "Token", slug: "configurations/token" },
165+
],
166+
},
167+
{
168+
label: "Engines",
169+
items: [
170+
{ label: "Overview", slug: "engines" },
171+
{ label: "LlamaCpp", slug: "engines/llamacpp" },
45172
],
46173
},
47174
{
48175
label: "Guides",
49176
items: [
50-
// Each item here is one entry in the navigation menu.
51-
{ label: "Example Guide", slug: "guides/example" },
177+
{ label: "Function Calling", slug: "guides/function-calling" },
178+
{ label: "Structured Outputs", slug: "guides/structured-outputs" },
179+
],
180+
},
181+
{
182+
label: "Architecture",
183+
items: [
184+
{ label: "Overview", slug: "architecture" },
185+
{ label: "Cortex DB", slug: "architecture/cortex-db" },
186+
{ label: "Cortex RC", slug: "architecture/cortexrc" },
187+
{ label: "Data Folder", slug: "architecture/data-folder" },
188+
{ label: "Updater", slug: "architecture/updater" },
189+
{ label: "Benchmarking", slug: "benchmarking-architecture" },
190+
{ label: "Telemetry", slug: "telemetry-architecture" },
52191
],
53192
},
54193
{
55-
label: "Reference",
56-
autogenerate: { directory: "reference" },
194+
label: "Cortex Platform",
195+
items: [
196+
{ label: "About", slug: "cortex-platform/about" },
197+
{ label: "Benchmarking", slug: "cortex-platform/benchmarking" },
198+
],
57199
},
58200
],
201+
plugins: [
202+
starlightUtils({
203+
navLinks: {
204+
leading: { useSidebarLabelled: "Title Bar" },
205+
},
206+
}),
207+
],
59208
}),
60209
],
61210
});

new-docs/fix-frontmatter.js

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#!/usr/bin/env bun
2+
3+
import { readdir, readFile, writeFile } from 'fs/promises';
4+
import { join, basename } from 'path';
5+
6+
const contentDir = './src/content/docs';
7+
8+
function toTitleCase(str) {
9+
// Convert kebab or snake case to space-separated title case
10+
return str
11+
.replace(/[-_]/g, ' ')
12+
.split(' ')
13+
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
14+
.join(' ');
15+
}
16+
17+
async function fixFrontmatter(filePath) {
18+
try {
19+
const content = await readFile(filePath, 'utf8');
20+
21+
if (content.startsWith('---\nunlisted: true\n---')) {
22+
// Extract the base filename without extension
23+
const fileName = basename(filePath).replace(/\.(md|mdx)$/, '');
24+
25+
// Create title from filename (convert hyphen to space and capitalize)
26+
const title = toTitleCase(fileName);
27+
28+
// Replace frontmatter with title
29+
const updatedContent = content.replace(
30+
'---\nunlisted: true\n---',
31+
`---\ntitle: ${title}\nunlisted: true\n---`
32+
);
33+
34+
await writeFile(filePath, updatedContent);
35+
console.log(`Updated frontmatter in ${filePath}`);
36+
return true;
37+
}
38+
39+
return false;
40+
} catch (error) {
41+
console.error(`Error processing ${filePath}:`, error);
42+
return false;
43+
}
44+
}
45+
46+
async function processDirectory(dir) {
47+
const entries = await readdir(dir, { withFileTypes: true });
48+
let totalUpdated = 0;
49+
50+
for (const entry of entries) {
51+
const entryPath = join(dir, entry.name);
52+
53+
if (entry.isDirectory()) {
54+
totalUpdated += await processDirectory(entryPath);
55+
} else if ((entry.name.endsWith('.md') || entry.name.endsWith('.mdx'))) {
56+
const updated = await fixFrontmatter(entryPath);
57+
if (updated) totalUpdated++;
58+
}
59+
}
60+
61+
return totalUpdated;
62+
}
63+
64+
async function main() {
65+
try {
66+
console.log('Starting frontmatter fix...');
67+
const updatedCount = await processDirectory(contentDir);
68+
console.log(`Done! Updated ${updatedCount} files.`);
69+
} catch (error) {
70+
console.error('Error:', error);
71+
}
72+
}
73+
74+
main();

new-docs/migrate-docs.js

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#!/usr/bin/env bun
2+
3+
import { readdir, stat, mkdir, readFile, writeFile, copyFile as fsCopyFile } from 'fs/promises';
4+
import { join, dirname, resolve } from 'path';
5+
6+
// Source and destination directories
7+
const sourceDir = resolve(import.meta.dir, '../docs/docs');
8+
const destDir = resolve(import.meta.dir, './src/content/docs');
9+
10+
// Function to ensure directories exist
11+
async function ensureDir(dir) {
12+
try {
13+
await stat(dir);
14+
} catch (e) {
15+
await mkdir(dir, { recursive: true });
16+
console.log(`Created directory: ${dir}`);
17+
}
18+
}
19+
20+
// Function to convert frontmatter if needed (Docusaurus to Astro)
21+
function convertFrontmatter(content) {
22+
// Docusaurus uses --- for frontmatter, which is compatible with Astro
23+
// Just checking if there are any specific conversions needed
24+
return content;
25+
}
26+
27+
// Function to copy and transform a file
28+
async function copyFile(sourcePath, destPath) {
29+
// Read the source file
30+
const content = await readFile(sourcePath, 'utf8');
31+
32+
// Transform content if needed
33+
const transformedContent = convertFrontmatter(content);
34+
35+
// Ensure the destination directory exists
36+
await ensureDir(dirname(destPath));
37+
38+
// Write the transformed content to the destination file
39+
await writeFile(destPath, transformedContent);
40+
console.log(`Copied: ${sourcePath} -> ${destPath}`);
41+
}
42+
43+
// Function to recursively copy files
44+
async function copyFiles(source, dest) {
45+
const entries = await readdir(source, { withFileTypes: true });
46+
47+
await ensureDir(dest);
48+
49+
for (const entry of entries) {
50+
const sourcePath = join(source, entry.name);
51+
const destPath = join(dest, entry.name);
52+
53+
if (entry.isDirectory()) {
54+
await copyFiles(sourcePath, destPath);
55+
} else if (entry.name.endsWith('.md') || entry.name.endsWith('.mdx')) {
56+
await copyFile(sourcePath, destPath);
57+
} else {
58+
// Copy other files directly
59+
await fsCopyFile(sourcePath, destPath);
60+
console.log(`Copied file: ${sourcePath} -> ${destPath}`);
61+
}
62+
}
63+
}
64+
65+
// Main function
66+
async function main() {
67+
try {
68+
console.log('Starting migration from Docusaurus to Astro...');
69+
console.log(`Source: ${sourceDir}`);
70+
console.log(`Destination: ${destDir}`);
71+
72+
await copyFiles(sourceDir, destDir);
73+
74+
console.log('Migration completed successfully!');
75+
} catch (error) {
76+
console.error('Error during migration:', error);
77+
process.exit(1);
78+
}
79+
}
80+
81+
main();

new-docs/package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,13 @@
1111
},
1212
"dependencies": {
1313
"@astrojs/starlight": "^0.32.2",
14+
"@fontsource/press-start-2p": "^5.2.5",
15+
"@fontsource/vt323": "^5.2.5",
16+
"@lorenzo_lewis/starlight-utils": "^0.3.2",
1417
"astro": "^5.1.5",
18+
"fontsource": "^0.0.1-security",
1519
"sharp": "^0.32.5",
16-
"starlight-blog": "^0.18.0"
20+
"starlight-blog": "^0.18.0",
21+
"starlight-versions": "^0.5.2"
1722
}
1823
}

new-docs/public/menlo.png

30.2 KB
Loading

0 commit comments

Comments
 (0)