from __future__ import annotationsfrom dataclasses import dataclassfrom .commands import get_commandsfrom .models import PortingModule@dataclass(frozen=True)class CommandGraph:builtins: tuple[PortingModule, ...]plugin_like: tuple[PortingModule, ...]skill_like: tuple[PortingModule, ...]def flattened(self) -> tuple[PortingModule, ...]:return self.builtins + self.plugin_like + self.skill_likedef as_markdown(self) -> str:lines = ['# Command Graph','',f'Builtins: {len(self.builtins)}',f'Plugin-like commands: {len(self.plugin_like)}',f'Skill-like commands: {len(self.skill_like)}',]return '\n'.join(lines)def build_command_graph() -> CommandGraph:commands = get_commands()builtins = tuple(module for module in commands if 'plugin' not in module.source_hint.lower() and 'skills' not in module.source_hint.lower())plugin_like = tuple(module for module in commands if 'plugin' in module.source_hint.lower())skill_like = tuple(module for module in commands if 'skills' in module.source_hint.lower())return CommandGraph(builtins=builtins, plugin_like=plugin_like, skill_like=skill_like)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。