@@ -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