99import typer .main
1010from typer .core import TyperGroup
1111
12+ from fast_agent .cli .command_support import ensure_context_object
1213from fast_agent .cli .constants import normalize_resume_flag_args
1314from fast_agent .cli .display import print_section_header
1415from fast_agent .cli .env_helpers import resolve_environment_dir_option
1516from fast_agent .cli .terminal import Application
17+ from fast_agent .cli .update_check import check_for_update_notice , should_run_update_check
1618from fast_agent .constants import FAST_AGENT_SHELL_CHILD_ENV
1719from fast_agent .ui .console import console as shared_console
1820
@@ -68,7 +70,7 @@ def get_command(self, ctx: click.Context, cmd_name: str) -> click.Command | None
6870console = shared_console
6971
7072
71- def show_welcome () -> None :
73+ def show_welcome (update_notice : str | None = None ) -> None :
7274 """Show a welcome message with available commands, using new styling."""
7375 from importlib .metadata import version
7476
@@ -102,6 +104,10 @@ def show_welcome() -> None:
102104
103105 console .print (table )
104106
107+ if update_notice :
108+ console .print ()
109+ console .print (update_notice )
110+
105111 console .print (
106112 "\n Visit [cyan][link=https://fast-agent.ai]fast-agent.ai[/link][/cyan] for more information."
107113 )
@@ -114,6 +120,11 @@ def main(
114120 quiet : bool = typer .Option (False , "--quiet" , "-q" , help = "Disable output" ),
115121 color : bool = typer .Option (True , "--color/--no-color" , help = "Enable/disable color output" ),
116122 version : bool = typer .Option (False , "--version" , help = "Show version and exit" ),
123+ no_update_check : bool = typer .Option (
124+ False ,
125+ "--no-update-check" ,
126+ help = "Skip checking PyPI for newer fast-agent releases" ,
127+ ),
117128 env : Path | None = typer .Option (
118129 None , "--env" , help = "Override the base fast-agent environment directory"
119130 ),
@@ -130,7 +141,11 @@ def main(
130141 )
131142 raise typer .Exit (1 )
132143
133- resolve_environment_dir_option (ctx , env )
144+ context_payload = ensure_context_object (ctx )
145+ context_payload ["no_update_check" ] = no_update_check
146+
147+ resolved_env_dir = resolve_environment_dir_option (ctx , env )
148+ context_payload ["env_dir" ] = resolved_env_dir
134149
135150 application .verbosity = 1 if verbose else 0 if not quiet else - 1
136151 if not color :
@@ -141,6 +156,12 @@ def main(
141156 application .console = base_console .__class__ (color_system = None )
142157 application .error_console = base_error_console .__class__ (color_system = None , stderr = True )
143158
159+ update_notice : str | None = None
160+ if not version and ctx .invoked_subcommand is None and should_run_update_check (
161+ disabled = no_update_check ,
162+ ):
163+ update_notice = check_for_update_notice (environment_dir = resolved_env_dir )
164+
144165 # Handle version flag
145166 if version :
146167 from importlib .metadata import version as get_version
@@ -154,4 +175,4 @@ def main(
154175
155176 # Show welcome message if no command was invoked
156177 if ctx .invoked_subcommand is None :
157- show_welcome ()
178+ show_welcome (update_notice = update_notice )
0 commit comments