Coverage for sources / agentsmgr / maintenance / cli.py: 47%
19 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-04-03 02:32 +0000
« prev ^ index » next coverage.py v7.13.5, created at 2026-04-03 02:32 +0000
1# vim: set filetype=python fileencoding=utf-8:
2# -*- coding: utf-8 -*-
4#============================================================================#
5# #
6# Licensed under the Apache License, Version 2.0 (the "License"); #
7# you may not use this file except in compliance with the License. #
8# You may obtain a copy of the License at #
9# #
10# http://www.apache.org/licenses/LICENSE-2.0 #
11# #
12# Unless required by applicable law or agreed to in writing, software #
13# distributed under the License is distributed on an "AS IS" BASIS, #
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
15# See the License for the specific language governing permissions and #
16# limitations under the License. #
17# #
18#============================================================================#
21''' Maintainer-facing command-line interface. '''
24from . import __
25from . import content as _content
26from . import template as _template
29class MaintainerApplication( __.appcore_cli.Application ):
30 ''' Maintainer-facing agents configuration management CLI. '''
32 display: __.core.DisplayOptions = __.dcls.field(
33 default_factory = __.core.DisplayOptions )
34 command: __.typx.Union[
35 __.typx.Annotated[
36 _content.CommandDispatcher,
37 __.tyro.conf.subcommand( 'content', prefix_name = False ),
38 ],
39 __.typx.Annotated[
40 _template.CommandDispatcher,
41 __.tyro.conf.subcommand( 'template', prefix_name = False ),
42 ],
43 ] = __.dcls.field( default_factory = _content.CommandDispatcher )
45 async def execute( self, auxdata: __.Globals ) -> None: # pyright: ignore[reportIncompatibleMethodOverride]
46 await self.command( auxdata )
48 async def prepare(
49 self, exits: __.ctxl.AsyncExitStack
50 ) -> __.Globals:
51 auxdata_base = await super( ).prepare( exits )
52 nomargs = {
53 field.name: getattr( auxdata_base, field.name )
54 for field in __.dcls.fields( auxdata_base )
55 if not field.name.startswith( '_' ) }
56 return __.Globals( display = self.display, **nomargs )
59def execute( ) -> None:
60 ''' Entrypoint for maintainer-facing CLI execution. '''
61 config = ( __.tyro.conf.HelptextFromCommentsOff, )
62 try:
63 __.asyncio.run(
64 __.tyro.cli( MaintainerApplication, config = config )( ) )
65 except SystemExit: raise
66 except BaseException:
67 # TODO: Log exception.
68 raise SystemExit( 1 ) from None