@@ -34,9 +34,11 @@ def install_claude_in_container(container_name):
3434
3535
3636def install_fzf_in_container (container_name ):
37- """Install fzf in the container."""
37+ """Install fzf in the container (non-critical) ."""
3838 console .print ("[cyan]Installing fzf in container...[/cyan]" )
39- docker_exec (container_name , "apt-get update && apt-get install -y fzf" , check = False )
39+ result = docker_exec (container_name , "apt-get update && apt-get install -y fzf" , check = False )
40+ if result .returncode != 0 :
41+ console .print ("[yellow]fzf installation failed (non-critical) — continuing[/yellow]" )
4042
4143
4244def install_python_deps_in_container (container_name ):
@@ -187,7 +189,10 @@ def save_package_list(container_name):
187189 quiet = True ,
188190 )
189191 if result .returncode != 0 :
190- console .print ("[yellow]Could not save package list (colcon list failed)[/yellow]" )
192+ console .print (
193+ "[yellow]Could not save package list (colcon list failed). "
194+ "The 'rerun_tests' helper will not work.[/yellow]"
195+ )
191196
192197
193198def inject_rerun_tests_function (container_name ):
@@ -267,7 +272,7 @@ def get_host_git_config(key):
267272
268273def configure_git_in_container (container_name ):
269274 """Set up git identity, token-based auth, and gh CLI auth in the container."""
270- gh_token = os .environ .get ("GH_TOKEN" , "" )
275+ gh_token = os .environ .get ("GH_TOKEN" ) or os . environ . get ( "ER_SETUP_TOKEN" ) or ""
271276
272277 git_user_name = get_host_git_config ("user.name" )
273278 git_user_email = get_host_git_config ("user.email" )
@@ -276,20 +281,26 @@ def configure_git_in_container(container_name):
276281 docker_exec (container_name , f'git config --global user.name "{ git_user_name } "' )
277282 docker_exec (container_name , f'git config --global user.email "{ git_user_email } "' )
278283
279- if gh_token :
280- docker_exec (
281- container_name ,
282- f'git config --global url."https://{ gh_token } @github.com/"'
283- f'.insteadOf "https://github.com/"' ,
284- quiet = True ,
284+ if not gh_token :
285+ console .print (
286+ "[yellow]No GH_TOKEN or ER_SETUP_TOKEN found — "
287+ "git auth and gh CLI will not be configured in container[/yellow]"
285288 )
286- install_and_auth_gh_cli (container_name , gh_token )
289+ return
290+
291+ docker_exec (
292+ container_name ,
293+ f'git config --global url."https://{ gh_token } @github.com/"'
294+ f'.insteadOf "https://github.com/"' ,
295+ quiet = True ,
296+ )
297+ install_and_auth_gh_cli (container_name , gh_token )
287298
288299
289300def install_and_auth_gh_cli (container_name , gh_token ):
290301 """Install gh CLI and authenticate with the provided token."""
291302 console .print ("[cyan]Installing gh CLI in container...[/cyan]" )
292- docker_exec (container_name , (
303+ install_result = docker_exec (container_name , (
293304 "type gh >/dev/null 2>&1 || ("
294305 "curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg "
295306 "| dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg "
@@ -300,13 +311,25 @@ def install_and_auth_gh_cli(container_name, gh_token):
300311 "| tee /etc/apt/sources.list.d/github-cli-stable.list > /dev/null "
301312 "&& apt-get update && apt-get install -y gh)"
302313 ), check = False )
314+ if install_result .returncode != 0 :
315+ console .print (
316+ "[yellow]gh CLI installation failed — "
317+ "Claude will not be able to interact with GitHub from inside the container[/yellow]"
318+ )
319+ return
320+
303321 console .print ("[cyan]Authenticating gh CLI...[/cyan]" )
304- docker_exec (
322+ auth_result = docker_exec (
305323 container_name ,
306324 f'echo "{ gh_token } " | gh auth login --with-token' ,
307325 check = False ,
308326 quiet = True ,
309327 )
328+ if auth_result .returncode != 0 :
329+ console .print (
330+ "[yellow]gh CLI authentication failed — "
331+ "Claude will not be able to interact with GitHub from inside the container[/yellow]"
332+ )
310333
311334
312335def is_claude_installed_in_container (container_name ):
0 commit comments