@@ -24,7 +24,10 @@ export const startDevelopmentWorkflow = async (context: CLIContext): Promise<Res
2424 const environment = await selectEnvironment ( ) ;
2525 if ( ! environment ) return { success : false , error : "No environment selected" } ;
2626
27- return startShopifyDevelopmentServer ( context , selectedShop , environment ) ;
27+ const themeEditorSync = await selectThemeEditorSync ( ) ;
28+ if ( themeEditorSync === null ) return { success : false , error : "Selection cancelled" } ;
29+
30+ return startShopifyDevelopmentServer ( context , selectedShop , environment , themeEditorSync ) ;
2831} ;
2932
3033const selectShopForDevelopment = async ( shops : string [ ] ) : Promise < string | null > => {
@@ -52,7 +55,20 @@ const selectEnvironment = async (): Promise<'staging' | 'production' | null> =>
5255 return isCancel ( envChoice ) ? null : envChoice as 'staging' | 'production' ;
5356} ;
5457
55- const startShopifyDevelopmentServer = async ( context : CLIContext , shopId : string , environment : 'production' | 'staging' ) : Promise < Result < void > > => {
58+ const selectThemeEditorSync = async ( ) : Promise < boolean | null > => {
59+ const syncChoice = await select ( {
60+ message : "Sync theme editor files to local?" ,
61+ options : [
62+ { value : "yes" , label : "Yes, sync theme editor files" , hint : "Pull changes made in theme editor" } ,
63+ { value : "no" , label : "No, do not sync" , hint : "Ignore theme editor changes" }
64+ ]
65+ } ) ;
66+
67+ if ( isCancel ( syncChoice ) ) return null ;
68+ return syncChoice === "yes" ;
69+ } ;
70+
71+ const startShopifyDevelopmentServer = async ( context : CLIContext , shopId : string , environment : 'production' | 'staging' , themeEditorSync : boolean ) : Promise < Result < void > > => {
5672 // Load shop configuration
5773 const configResult = await context . shopOps . loadConfig ( shopId ) ;
5874 if ( ! configResult . success ) {
@@ -84,10 +100,10 @@ const startShopifyDevelopmentServer = async (context: CLIContext, shopId: string
84100 return { success : false , error : "No theme token available" } ;
85101 }
86102
87- return executeShopifyCLI ( store . domain , token , shopId , environment ) ;
103+ return executeShopifyCLI ( store . domain , token , shopId , environment , themeEditorSync ) ;
88104} ;
89105
90- const executeShopifyCLI = async ( storeDomain : string , themeToken : string , shopId : string , environment : 'staging' | 'production' ) : Promise < Result < void > > => {
106+ const executeShopifyCLI = async ( storeDomain : string , themeToken : string , shopId : string , environment : 'staging' | 'production' , themeEditorSync : boolean ) : Promise < Result < void > > => {
91107 const s = spinner ( ) ;
92108 s . start ( "Starting Shopify CLI..." ) ;
93109
@@ -97,19 +113,23 @@ const executeShopifyCLI = async (storeDomain: string, themeToken: string, shopId
97113
98114 s . stop ( "✅ Starting development server" ) ;
99115
116+ const storeArg = `--store=${ storeDomain . replace ( '.myshopify.com' , '' ) } ` ;
117+ const args = [ 'theme' , 'dev' , storeArg ] ;
118+
119+ if ( themeEditorSync ) {
120+ args . push ( '--theme-editor-sync' ) ;
121+ }
122+
100123 console . log ( `\n🔗 Development Server:` ) ;
101124 console . log ( ` Shop: ${ shopId } (${ environment } )` ) ;
102125 console . log ( ` Store: ${ storeDomain } ` ) ;
103126 console . log ( ` Token: ${ themeToken . substring ( 0 , 8 ) } ...` ) ;
104- console . log ( `\n⚡ Running: shopify theme dev --store=${ storeDomain . replace ( '.myshopify.com' , '' ) } ` ) ;
127+ console . log ( ` Theme Editor Sync: ${ themeEditorSync ? 'Enabled' : 'Disabled' } ` ) ;
128+ console . log ( `\n⚡ Running: shopify ${ args . join ( ' ' ) } ` ) ;
105129 console . log ( `\nPress Ctrl+C to stop\n` ) ;
106130
107131 // Start Shopify CLI with proper signal handling
108- const devProcess = spawn ( 'shopify' , [
109- 'theme' ,
110- 'dev' ,
111- `--store=${ storeDomain . replace ( '.myshopify.com' , '' ) } `
112- ] , {
132+ const devProcess = spawn ( 'shopify' , args , {
113133 env : {
114134 ...process . env ,
115135 SHOPIFY_CLI_THEME_TOKEN : themeToken ,
0 commit comments