@@ -38,7 +38,7 @@ pub fn build_nargo_args(cfg: &Config, base_args: &[&str]) -> Result<Vec<String>>
3838/// - Building arguments with global flags via `build_nargo_args`
3939/// - Verbose logging (when enabled and not quiet)
4040/// - Dry-run mode (prints command without executing)
41- /// - Backend execution via `backends::nargo::run`
41+ /// - Command execution via the configured runner
4242///
4343/// # Arguments
4444/// * `cfg` - The global configuration containing all flags
@@ -66,10 +66,83 @@ pub fn run_nargo_command(cfg: &Config, base_args: &[&str]) -> Result<()> {
6666 cfg. runner . run ( & spec)
6767
6868 // TODO: Migrate remaining shell-outs to use runner abstraction:
69- // - backends::nargo::run calls in other modules
70- // - scarb command executions
71- // - garaga command executions
69+ // - scarb command executions (currently empty module)
7270 // - starknet CLI integrations
71+ //
72+ // Completed migrations:
73+ // ✅ bb command executions
74+ // ✅ garaga command executions
75+ // ✅ foundry command executions
76+ // ✅ nargo command executions
77+ }
78+
79+ /// Run a garaga command with consolidated argument building, logging, and dry-run handling
80+ ///
81+ /// This is the primary helper for executing garaga commands consistently across all
82+ /// command modules. It handles:
83+ /// - Verbose logging (when enabled and not quiet)
84+ /// - Dry-run mode (prints command without executing)
85+ /// - Command execution via the configured runner
86+ ///
87+ /// # Arguments
88+ /// * `cfg` - The global configuration containing all flags and runner
89+ /// * `args` - Arguments to pass to garaga
90+ ///
91+ /// # Returns
92+ /// * `Result<()>` - Success or error from command execution
93+ ///
94+ /// # Example
95+ /// ```ignore
96+ /// // Execute "garaga gen --system ultra_starknet_zk_honk --vk ./target/starknet/vk"
97+ /// run_garaga_command(&config, &["gen", "--system", "ultra_starknet_zk_honk", "--vk", "./target/starknet/vk"])?;
98+ /// ```
99+ pub fn run_garaga_command ( cfg : & Config , args : & [ & str ] ) -> Result < ( ) > {
100+ let args_vec: Vec < String > = args. iter ( ) . map ( |s| s. to_string ( ) ) . collect ( ) ;
101+
102+ if cfg. verbose && !cfg. quiet {
103+ info ! ( "Running: garaga {}" , args_vec. join( " " ) ) ;
104+ }
105+
106+ // Create command specification for garaga
107+ let spec = CmdSpec :: new ( "garaga" . to_string ( ) , args_vec) ;
108+
109+ // Use the runner to execute the command (handles dry-run automatically)
110+ cfg. runner . run ( & spec)
111+ }
112+
113+ /// Run a foundry command with consolidated argument building, logging, and dry-run handling
114+ ///
115+ /// This is the primary helper for executing foundry commands consistently across all
116+ /// command modules. It handles:
117+ /// - Verbose logging (when enabled and not quiet)
118+ /// - Dry-run mode (prints command without executing)
119+ /// - Command execution via the configured runner
120+ ///
121+ /// # Arguments
122+ /// * `cfg` - The global configuration containing all flags and runner
123+ /// * `command` - The foundry command to run (forge, cast, anvil)
124+ /// * `args` - Arguments to pass to the foundry command
125+ ///
126+ /// # Returns
127+ /// * `Result<()>` - Success or error from command execution
128+ ///
129+ /// # Example
130+ /// ```ignore
131+ /// // Execute "forge init --force contracts/evm"
132+ /// run_foundry_command(&config, "forge", &["init", "--force", "contracts/evm"])?;
133+ /// ```
134+ pub fn run_foundry_command ( cfg : & Config , command : & str , args : & [ & str ] ) -> Result < ( ) > {
135+ let args_vec: Vec < String > = args. iter ( ) . map ( |s| s. to_string ( ) ) . collect ( ) ;
136+
137+ if cfg. verbose && !cfg. quiet {
138+ info ! ( "Running: {} {}" , command, args_vec. join( " " ) ) ;
139+ }
140+
141+ // Create command specification for foundry command
142+ let spec = CmdSpec :: new ( command. to_string ( ) , args_vec) ;
143+
144+ // Use the runner to execute the command (handles dry-run automatically)
145+ cfg. runner . run ( & spec)
73146}
74147
75148/// Run a bb command with consolidated argument building, logging, and dry-run handling
0 commit comments