66
77from codegen .cli .api .client import RestAPI
88from codegen .cli .auth .decorators import requires_auth
9- from codegen .cli .auth .session import CodegenSession
9+ from codegen .cli .auth .token_manager import get_current_token
1010from codegen .cli .rich .codeblocks import format_command
1111from codegen .cli .rich .spinners import create_spinner
1212from codegen .cli .utils .codemod_manager import CodemodManager
1313from codegen .cli .utils .function_finder import DecoratedFunction
1414
1515
16- def deploy_functions (session : CodegenSession , functions : list [DecoratedFunction ], message : str | None = None ) -> None :
16+ def deploy_functions (functions : list [DecoratedFunction ], message : str | None = None ) -> None :
1717 """Deploy a list of functions."""
1818 if not functions :
1919 rich .print ("\n [yellow]No @codegen.function decorators found.[/yellow]\n " )
2020 return
2121
2222 # Deploy each function
23- api_client = RestAPI (session . token )
23+ api_client = RestAPI (get_current_token () )
2424 rich .print () # Add a blank line before deployments
2525
2626 for func in functions :
@@ -47,7 +47,7 @@ def deploy_functions(session: CodegenSession, functions: list[DecoratedFunction]
4747@click .argument ("name" , required = False )
4848@click .option ("-d" , "--directory" , type = click .Path (exists = True , path_type = Path ), help = "Directory to search for functions" )
4949@click .option ("-m" , "--message" , help = "Optional message to include with the deploy" )
50- def deploy_command (session : CodegenSession , name : str | None = None , directory : Path | None = None , message : str | None = None ):
50+ def deploy_command (name : str | None = None , directory : Path | None = None , message : str | None = None ):
5151 """Deploy codegen functions.
5252
5353 If NAME is provided, deploys a specific function by that name.
@@ -70,11 +70,11 @@ def deploy_command(session: CodegenSession, name: str | None = None, directory:
7070 rich .print (f" • { func .filepath } " )
7171 msg = "Please specify the exact directory with --directory"
7272 raise click .ClickException (msg )
73- deploy_functions (session , matching , message = message )
73+ deploy_functions (matching , message = message )
7474 else :
7575 # Deploy all functions in the directory
7676 functions = CodemodManager .get_decorated (search_path )
77- deploy_functions (session , functions )
77+ deploy_functions (functions )
7878 except Exception as e :
7979 msg = f"Failed to deploy: { e !s} "
8080 raise click .ClickException (msg )
0 commit comments