Skip to content

Commit 54ccfbd

Browse files
committed
Copy schemas to public directory for SchemaStore compatibility
- Add copySchemasToPubic() to sync-docs.ts - Schemas now served at /schemas/v1/*.schema.json - Add public/schemas/ to .gitignore (generated at build)
1 parent a8fd1f1 commit 54ccfbd

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ build/
1212
# Generated documentation (synced from acp-spec)
1313
apps/web/content/docs/
1414

15+
# Generated schemas for public access (synced from acp-spec)
16+
apps/web/public/schemas/
17+
1518
# Cache
1619
*.tsbuildinfo
1720
.eslintcache

apps/web/next-env.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/// <reference types="next" />
22
/// <reference types="next/image-types/global" />
3-
import "./.next/dev/types/routes.d.ts";
3+
import "./.next/types/routes.d.ts";
44

55
// NOTE: This file should not be edited
66
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

apps/web/scripts/sync-docs.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,34 @@ function generateMetaFiles(): void {
547547
}
548548
}
549549

550+
/**
551+
* Copy schema files to public directory for direct access
552+
* This ensures https://acp-protocol.dev/schemas/v1/*.schema.json works
553+
*/
554+
function copySchemasToPubic(): void {
555+
console.log("\n📦 Copying schemas to public directory...");
556+
557+
const sourceDir = path.join(resolvePath(CONFIG.schemasDir), "v1");
558+
const publicDir = path.join(resolvePath("."), "public", "schemas", "v1");
559+
560+
if (!fs.existsSync(sourceDir)) {
561+
console.log(" ⚠ Schemas source directory not found");
562+
return;
563+
}
564+
565+
// Create public schemas directory
566+
fs.mkdirSync(publicDir, { recursive: true });
567+
568+
// Copy all schema files
569+
const files = fs.readdirSync(sourceDir).filter((f) => f.endsWith(".json"));
570+
for (const file of files) {
571+
const sourcePath = path.join(sourceDir, file);
572+
const destPath = path.join(publicDir, file);
573+
fs.copyFileSync(sourcePath, destPath);
574+
console.log(` ✓ schemas/v1/${file}`);
575+
}
576+
}
577+
550578
/**
551579
* Clean output directory
552580
*/
@@ -578,6 +606,9 @@ async function main(): Promise<void> {
578606
// Generate navigation metadata
579607
generateMetaFiles();
580608

609+
// Copy schemas to public for direct URL access
610+
copySchemasToPubic();
611+
581612
const elapsed = ((Date.now() - startTime) / 1000).toFixed(2);
582613
console.log(`\n✅ Documentation sync complete in ${elapsed}s`);
583614
}

0 commit comments

Comments
 (0)