@@ -114,20 +114,29 @@ def _should_skip_config_value(value: Any) -> bool:
114114 return value is None or value is False or str (value ).lower () in ("none" , "skip" , "" )
115115
116116
117- def build_args_from_config (project_config : dict [str , Any ]) -> list [str ]:
117+ def build_args_from_config (
118+ project_config : dict [str , Any ],
119+ auto_approve : bool = False ,
120+ cli_overrides : dict [str , str ] | None = None ,
121+ ) -> list [str ]:
118122 """Build CLI arguments from project config.
119123
120124 Args:
121125 project_config: The [tool.agent-starter-pack] config dict
126+ auto_approve: If True, add --auto-approve to args
127+ cli_overrides: Additional CLI args to merge (e.g., from original command)
122128
123129 Returns:
124130 List of CLI arguments to pass to enhance command
125131 """
126132 # --skip-deps is added because dependencies were already installed on first run
127133 # --skip-welcome avoids showing the banner twice
128- # Note: we don't add --auto-approve so user still gets interactive prompts for CI/CD etc.
129134 args = ["enhance" , "--skip-deps" , "--skip-welcome" ]
130135
136+ # Pass through auto-approve if it was set on the original command
137+ if auto_approve :
138+ args .append ("--auto-approve" )
139+
131140 # Add base template from metadata
132141 base_template = project_config .get ("base_template" )
133142 if base_template :
@@ -151,6 +160,29 @@ def build_args_from_config(project_config: dict[str, Any]) -> list[str]:
151160 else :
152161 args .extend ([arg_name , str (value )])
153162
163+ # Merge CLI overrides (these take precedence over saved config)
164+ # This ensures user-provided args like --cicd-runner are passed through
165+ if cli_overrides :
166+ for arg_name , value in cli_overrides .items ():
167+ # Convert to CLI format
168+ cli_arg = f"--{ arg_name .replace ('_' , '-' )} "
169+ # Remove existing arg if present (to override)
170+ # Find and remove any existing occurrence
171+ i = 0
172+ while i < len (args ):
173+ if args [i ] == cli_arg :
174+ # Remove the arg and its value if present
175+ args .pop (i )
176+ if i < len (args ) and not args [i ].startswith ("--" ):
177+ args .pop (i )
178+ else :
179+ i += 1
180+ # Add the override
181+ if value is True :
182+ args .append (cli_arg )
183+ elif value is not False and value is not None :
184+ args .extend ([cli_arg , str (value )])
185+
154186 return args
155187
156188
@@ -291,7 +323,9 @@ def _execute_with_saved_config(
291323
292324
293325def check_and_execute_with_saved_config (
294- project_dir : pathlib .Path , auto_approve : bool = False
326+ project_dir : pathlib .Path ,
327+ auto_approve : bool = False ,
328+ cli_overrides : dict [str , Any ] | None = None ,
295329) -> bool :
296330 """Check for saved config and offer to reuse it.
297331
@@ -301,6 +335,7 @@ def check_and_execute_with_saved_config(
301335 Args:
302336 project_dir: Path to the project directory
303337 auto_approve: If True, skip confirmation prompt and use saved config
338+ cli_overrides: CLI args to pass through (e.g., cicd_runner from original command)
304339
305340 Returns:
306341 True if config was used and executed, False otherwise
@@ -338,7 +373,7 @@ def check_and_execute_with_saved_config(
338373 return False
339374
340375 # Build and execute the command
341- args = build_args_from_config (project_config )
376+ args = build_args_from_config (project_config , auto_approve , cli_overrides )
342377 return _execute_with_saved_config (args , project_version , use_different_version )
343378
344379
@@ -589,7 +624,29 @@ def enhance(
589624 # Check for saved config and offer to reuse it
590625 # This handles both version locking AND reusing previous settings
591626 current_dir = pathlib .Path .cwd ()
592- if check_and_execute_with_saved_config (current_dir , auto_approve = auto_approve ):
627+
628+ # Build CLI overrides from explicitly provided args to pass through
629+ cli_override_args : dict [str , Any ] = {}
630+ if cicd_runner :
631+ cli_override_args ["cicd_runner" ] = cicd_runner
632+ if deployment_target :
633+ cli_override_args ["deployment_target" ] = deployment_target
634+ if session_type :
635+ cli_override_args ["session_type" ] = session_type
636+ if datastore :
637+ cli_override_args ["datastore" ] = datastore
638+ if base_template :
639+ cli_override_args ["base_template" ] = base_template
640+ if agent_directory :
641+ cli_override_args ["agent_directory" ] = agent_directory
642+ if include_data_ingestion :
643+ cli_override_args ["include_data_ingestion" ] = include_data_ingestion
644+ if prototype :
645+ cli_override_args ["prototype" ] = prototype
646+
647+ if check_and_execute_with_saved_config (
648+ current_dir , auto_approve = auto_approve , cli_overrides = cli_override_args
649+ ):
593650 # Successfully executed with saved config, exit this process
594651 return
595652
0 commit comments