@@ -52,14 +52,22 @@ const ZOD_FILE_TITLES: Record<string, string> = {
5252 'datasource' : 'Datasources' ,
5353 'driver' : 'Drivers' ,
5454 'auth' : 'Authentication' ,
55+ 'identity' : 'Identity' ,
56+ 'role' : 'Roles' ,
57+ 'policy' : 'Policies' ,
58+ 'organization' : 'Organizations' ,
59+ 'tenant' : 'Tenants' ,
5560 'webhook' : 'Webhooks' ,
56- 'api' : 'API Configuration' ,
61+ 'events' : 'Events' ,
62+ 'job' : 'Jobs' ,
63+ 'realtime' : 'Real-time Communication' ,
64+ 'discovery' : 'Service Discovery' ,
65+ 'plugin' : 'Plugins' ,
5766 'translation' : 'Translations' ,
5867 'audit' : 'Audit' ,
5968 'territory' : 'Territories' ,
6069 'license' : 'Licenses' ,
6170 'plan' : 'Plans' ,
62- 'rbac' : 'Role-Based Access Control' ,
6371 // API
6472 'contract' : 'API Contracts'
6573} ;
@@ -171,7 +179,9 @@ function generateMarkdown(schemaName: string, schema: any) {
171179}
172180
173181// 2. Clean up old documentation structure
174- // Remove old .mdx files and subdirectories from category roots
182+ // IMPORTANT: This removes old .mdx files and subdirectories to ensure a clean state.
183+ // Only category roots are cleaned (data/, ui/, system/, ai/, api/). The root meta.json is preserved.
184+ // All necessary directories and files are regenerated in step 3, so this is safe.
175185Object . keys ( CATEGORIES ) . forEach ( category => {
176186 const dir = path . join ( DOCS_ROOT , category ) ;
177187 if ( fs . existsSync ( dir ) ) {
@@ -180,14 +190,14 @@ Object.keys(CATEGORIES).forEach(category => {
180190 const entryPath = path . join ( dir , entry ) ;
181191 const stat = fs . statSync ( entryPath ) ;
182192
183- // Remove old .mdx files from category root
193+ // Remove old .mdx files from category root (these will be moved to subfolders)
184194 if ( stat . isFile ( ) && entry . endsWith ( '.mdx' ) ) {
185195 fs . unlinkSync ( entryPath ) ;
186196 console . log ( `Removed old file: ${ category } /${ entry } ` ) ;
187197 }
188- // Remove old subdirectories (but keep meta.json)
198+ // Remove old subdirectories (will be recreated with correct structure in step 3)
199+ // Note: meta.json is preserved as it's not a directory
189200 else if ( stat . isDirectory ( ) ) {
190- // We'll recreate the directories we need, so remove all existing ones
191201 fs . rmSync ( entryPath , { recursive : true , force : true } ) ;
192202 console . log ( `Removed old directory: ${ category } /${ entry } ` ) ;
193203 }
0 commit comments