@@ -45,6 +45,14 @@ def docs(
4545 raise click .ClickException ("Invalid documentation type: {}" .format (doc_type ))
4646
4747
48+ #: FileGroups whose subcommands are one-per-user-file, except for a few static ones.
49+ _GROUPS_WITH_STATIC_COMMANDS = frozenset ({"TaskFiles" , "AppFiles" })
50+
51+ #: Subcommands of `flyte run` and `flyte serve` that exist regardless of what is in the working
52+ #: directory, and so belong in the docs. Everything else there is one command per user file.
53+ _STATIC_COMMANDS = frozenset ({"deployed-task" , "hello" })
54+
55+
4856def walk_commands (ctx : click .Context ) -> Generator [Tuple [str , click .Command , click .Context ], None , None ]:
4957 """
5058 Recursively walk a Click command tree, starting from the given context.
@@ -59,14 +67,14 @@ def walk_commands(ctx: click.Context) -> Generator[Tuple[str, click.Command, cli
5967 elif isinstance (command , common .FileGroup ):
6068 # If the command is a FileGroup, yield its file path and the command itself
6169 # No need to recurse further into FileGroup as most subcommands are dynamically generated
62- # The exception is TaskFiles which has the special 'deployed-task' subcommand that should be documented
63- if type ( command ). __name__ == "TaskFiles" :
64- # For TaskFiles, we only want the special non-file-based subcommands like 'deployed-task'
65- # Exclude all dynamic file-based commands
70+ # The exception is TaskFiles and AppFiles, which have static subcommands like
71+ # 'deployed-task' and 'hello' that should be documented
72+ if type ( command ). __name__ in _GROUPS_WITH_STATIC_COMMANDS :
73+ # Only the static, non-file-based subcommands. Exclude all dynamic file-based commands.
6674 try :
6775 names = command .list_commands (ctx )
6876 for name in names :
69- if name == "deployed-task" : # Only include the deployed-task command
77+ if name in _STATIC_COMMANDS :
7078 try :
7179 subcommand = command .get_command (ctx , name )
7280 if subcommand is not None :
0 commit comments