66import datetime
77import json
88import os
9- import platform
109import pprint
1110import shutil
1211import subprocess
@@ -153,6 +152,7 @@ def notify_envrc() -> None:
153152
154153def notify_dockerhub_secrets () -> None :
155154 """Notify user about required Docker Hub secrets for releases."""
155+ # We no longer need this once https://github.com/docker/roadmap/issues/314 is available
156156 print ("\n " + "=" * 70 )
157157 print ("IMPORTANT: Docker Hub Publishing Enabled" )
158158 print ("=" * 70 )
@@ -169,92 +169,44 @@ def notify_dockerhub_secrets() -> None:
169169 print ("=" * 70 + "\n " )
170170
171171
172- def ensure_uv_installed () -> None :
173- """Opportunistically ensure uv is installed on the system."""
174- try :
175- # Check if uvx is already available
176- if shutil .which ("uvx" ):
177- LOG .info ("uvx is already available in PATH" )
178- return
179-
180- # Check if uv is installed but uvx might not be in PATH
181- if shutil .which ("uv" ):
182- LOG .info ("uv is available but uvx might not be in PATH" )
183- return
184-
172+ def opportunistically_install_zenable_tools () -> None :
173+ """Opportunistically install zenable-mcp if uvx is available."""
174+ # Check if uvx is not available
175+ if not shutil .which ("uvx" ):
176+ # uvx is not available, notify the user
185177 print ("\n " + "=" * 70 )
186- print ("Installing uv package manager... " )
178+ print ("NOTE: Skipped configuring the Zenable AI coding guardrails " )
187179 print ("=" * 70 )
188-
189- system = platform .system ()
190-
191- if system in ["Linux" , "Darwin" ]: # Unix-like systems (Linux and macOS)
192- # Use the standalone installer for Unix-like systems
193- install_cmd = "curl -LsSf https://astral.sh/uv/install.sh | sh"
194- subprocess .run (install_cmd , shell = True , check = True , capture_output = True , timeout = 30 )
195-
196- # Add to PATH for current session
197- home = Path .home ()
198- uv_bin = home / ".local" / "bin"
199- if uv_bin .exists ():
200- os .environ ["PATH" ] = f"{ uv_bin } :{ os .environ .get ('PATH' , '' )} "
201-
202- elif system == "Windows" :
203- # Use PowerShell for Windows
204- install_cmd = [
205- "powershell" ,
206- "-ExecutionPolicy" ,
207- "ByPass" ,
208- "-c" ,
209- "irm https://astral.sh/uv/install.ps1 | iex" ,
210- ]
211- subprocess .run (install_cmd , check = True , capture_output = True , timeout = 30 )
212-
213- # Add to PATH for current session on Windows
214- home = Path .home ()
215- uv_bin = home / ".local" / "bin"
216- if uv_bin .exists ():
217- os .environ ["PATH" ] = f"{ uv_bin } ;{ os .environ .get ('PATH' , '' )} "
218- else :
219- LOG .info (f"Unsupported platform for automatic uv installation: { system } " )
220- return
221-
222- print ("uv has been successfully installed" )
180+ print ("\n Configuring the Zenable AI coding guardrails requires the uv package manager." )
181+ print ("To set this up later:" )
182+ print ("\n 1. Install uv via https://docs.astral.sh/uv/getting-started/installation/" )
183+ print ("2. Run: uvx zenable-mcp@latest install" )
223184 print ("=" * 70 + "\n " )
224185
225- except Exception as e :
226- # Log the error but don't fail - this is opportunistic
227- LOG .info (f"Could not install uv automatically (this is optional): { e } " )
228- # Don't print anything to the user - this is an optional step
229-
186+ LOG .warning ("uvx was not found in PATH, so the Zenable integrations were not installed." )
187+ return
230188
231- def install_zenable_mcp () -> None :
232- """Opportunistically install zenable-mcp using uvx."""
189+ # uvx is available, attempt to install zenable-mcp
190+ LOG . debug ( "uvx is available in PATH, attempting to install the Zenable tools..." )
233191 try :
234- # Try to use uvx first
235- if shutil .which ("uvx" ):
236- print ("\n " + "=" * 70 )
237- print ("Installing zenable-mcp..." )
238- print ("=" * 70 )
239- subprocess .run (["uvx" , "zenable-mcp@latest" , "install" , "--all" ], check = True , timeout = 60 )
240- print ("zenable-mcp has been successfully installed" )
241- print ("=" * 70 + "\n " )
242- # Fallback to uv run if uvx is not available but uv is
243- elif shutil .which ("uv" ):
244- print ("\n " + "=" * 70 )
245- print ("Installing zenable-mcp..." )
246- print ("=" * 70 )
247- subprocess .run (["uv" , "run" , "--with" , "zenable-mcp" , "zenable-mcp" , "install" ], check = True , timeout = 60 )
248- print ("zenable-mcp has been successfully installed" )
249- print ("=" * 70 + "\n " )
250- else :
251- # No uv/uvx available, silently skip
252- LOG .info ("Neither uvx nor uv found in PATH. Skipping zenable-mcp installation." )
253-
254- except Exception as e :
192+ subprocess .run (["uvx" , "zenable-mcp@latest" , "install" ], check = True , timeout = 60 )
193+ print ("\n " + "=" * 70 )
194+ print ("Successfully configured the Zenable AI coding guardrails 🚀" )
195+ print ("To start using it, just open the IDE of your choice, login to the MCP server, and you're all set 🤖" )
196+ print ("Learn more at https://docs.zenable.io" )
197+ print ("=" * 70 + "\n " )
198+ except Exception :
255199 # Log the error but don't fail - this is opportunistic
256- LOG .info (f"Could not install zenable-mcp automatically (this is optional): { e } " )
257- # Don't print error messages to the user - this is an optional step
200+ LOG .warning ("Failed to configure the Zenable AI coding guardrails" )
201+ print ("\n " + "=" * 70 )
202+ print ("WARNING: Failed to configure the Zenable AI coding guardrails" )
203+ print ("=" * 70 )
204+ print ("You can retry it later by running:" )
205+ print ("\n uvx zenable-mcp@latest install" )
206+ print ("\n To report issues, please contact:" )
207+ print (" • https://zenable.io/feedback" )
208+ print (" • support@zenable.io" )
209+ print ("=" * 70 + "\n " )
258210
259211
260212def run_post_gen_hook ():
@@ -274,9 +226,7 @@ def run_post_gen_hook():
274226
275227 subprocess .run (["git" , "init" , "--initial-branch=main" ], capture_output = True , check = True )
276228
277- # Ensure uv is installed and install zenable-mcp
278- ensure_uv_installed ()
279- install_zenable_mcp ()
229+ opportunistically_install_zenable_tools ()
280230
281231 # This is important for testing project generation for CI
282232 if (
0 commit comments