@@ -466,6 +466,7 @@ export async function pullResourceType(
466466 resourceType : ResourceType ,
467467 state : StateFile ,
468468 changedFiles ?: Set < string > ,
469+ force ?: boolean ,
469470) : Promise < PullStats > {
470471 console . log ( `\n📥 Pulling ${ resourceType } ...` ) ;
471472
@@ -497,7 +498,7 @@ export async function pullResourceType(
497498 ?? generateResourceId ( resource ) ;
498499 }
499500
500- // Skip files that have been locally modified or deleted (default mode )
501+ // Skip files that have been locally modified (git detection )
501502 if ( changedFiles ) {
502503 const folderPath = FOLDER_MAP [ resourceType ] ;
503504 const mdPath = join ( "resources" , folderPath , `${ resourceId } .md` ) ;
@@ -509,6 +510,22 @@ export async function pullResourceType(
509510 continue ;
510511 }
511512 }
513+
514+ // Skip resources whose local file was deleted (works without git)
515+ // A resource that was previously tracked (in state) but has no local file = intentional deletion
516+ if ( ! force && ! isNew ) {
517+ const folderPath = FOLDER_MAP [ resourceType ] ;
518+ const dir = join ( RESOURCES_DIR , folderPath ) ;
519+ const fileExists = existsSync ( join ( dir , `${ resourceId } .md` ) )
520+ || existsSync ( join ( dir , `${ resourceId } .yml` ) )
521+ || existsSync ( join ( dir , `${ resourceId } .yaml` ) ) ;
522+ if ( ! fileExists ) {
523+ console . log ( ` ⏭️ ${ resourceId } (locally deleted, skipping)` ) ;
524+ newStateSection [ resourceId ] = resource . id ;
525+ skipped ++ ;
526+ continue ;
527+ }
528+ }
512529
513530 // Detect platform defaults (orgId is null/missing — read-only, immutable)
514531 const isPlatformDefault = resource . orgId === null || resource . orgId === undefined ;
@@ -600,14 +617,14 @@ async function main(): Promise<void> {
600617 // e.g. structuredOutputs reference assistants, so assistants must be pulled first.
601618 const shouldPull = ( type : ResourceType ) => ! typeFilter ?. length || typeFilter . includes ( type ) ;
602619
603- if ( shouldPull ( "tools" ) ) stats . tools = await pullResourceType ( "tools" , state , changedFiles ) ;
604- if ( shouldPull ( "assistants" ) ) stats . assistants = await pullResourceType ( "assistants" , state , changedFiles ) ;
605- if ( shouldPull ( "structuredOutputs" ) ) stats . structuredOutputs = await pullResourceType ( "structuredOutputs" , state , changedFiles ) ;
606- if ( shouldPull ( "squads" ) ) stats . squads = await pullResourceType ( "squads" , state , changedFiles ) ;
607- if ( shouldPull ( "personalities" ) ) stats . personalities = await pullResourceType ( "personalities" , state , changedFiles ) ;
608- if ( shouldPull ( "scenarios" ) ) stats . scenarios = await pullResourceType ( "scenarios" , state , changedFiles ) ;
609- if ( shouldPull ( "simulations" ) ) stats . simulations = await pullResourceType ( "simulations" , state , changedFiles ) ;
610- if ( shouldPull ( "simulationSuites" ) ) stats . simulationSuites = await pullResourceType ( "simulationSuites" , state , changedFiles ) ;
620+ if ( shouldPull ( "tools" ) ) stats . tools = await pullResourceType ( "tools" , state , changedFiles , force ) ;
621+ if ( shouldPull ( "assistants" ) ) stats . assistants = await pullResourceType ( "assistants" , state , changedFiles , force ) ;
622+ if ( shouldPull ( "structuredOutputs" ) ) stats . structuredOutputs = await pullResourceType ( "structuredOutputs" , state , changedFiles , force ) ;
623+ if ( shouldPull ( "squads" ) ) stats . squads = await pullResourceType ( "squads" , state , changedFiles , force ) ;
624+ if ( shouldPull ( "personalities" ) ) stats . personalities = await pullResourceType ( "personalities" , state , changedFiles , force ) ;
625+ if ( shouldPull ( "scenarios" ) ) stats . scenarios = await pullResourceType ( "scenarios" , state , changedFiles , force ) ;
626+ if ( shouldPull ( "simulations" ) ) stats . simulations = await pullResourceType ( "simulations" , state , changedFiles , force ) ;
627+ if ( shouldPull ( "simulationSuites" ) ) stats . simulationSuites = await pullResourceType ( "simulationSuites" , state , changedFiles , force ) ;
611628
612629 await saveState ( state ) ;
613630
0 commit comments