ErisPulse 2.1.10__py3-none-any.whl → 2.1.12__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
ErisPulse/Core/logger.py CHANGED
@@ -42,7 +42,7 @@ class Logger:
42
42
  show_time=False,
43
43
  show_level=True,
44
44
  show_path=False,
45
- markup=True
45
+ markup=False
46
46
  )
47
47
  self._logger.addHandler(console_handler)
48
48
  self._setup_config()
ErisPulse/__main__.py CHANGED
@@ -474,20 +474,20 @@ def main():
474
474
 
475
475
  # 列表命令
476
476
  list_parser = subparsers.add_parser('list', help='列出已安装的模块/适配器')
477
- list_parser.add_argument('--type', '-t', choices=['modules', 'adapters', 'all'], default='all',
478
- help='列出类型 (modules: 仅模块, adapters: 仅适配器, all: 全部)')
477
+ list_parser.add_argument('--type', '-t', choices=['modules', 'adapters', 'cli', 'all'], default='all',
478
+ help='列出类型 (modules: 仅模块, adapters: 仅适配器, cli: 仅CLI扩展, all: 全部)')
479
479
 
480
480
  # 远程列表命令
481
481
  list_remote_parser = subparsers.add_parser('list-remote', help='列出远程可用的模块和适配器')
482
- list_remote_parser.add_argument('--type', '-t', choices=['modules', 'adapters', 'all'], default='all',
483
- help='列出类型 (modules: 仅模块, adapters: 仅适配器, all: 全部)')
482
+ list_remote_parser.add_argument('--type', '-t', choices=['modules', 'adapters', 'cli', 'all'], default='all',
483
+ help='列出类型 (modules: 仅模块, adapters: 仅适配器, cli: 仅CLI扩展, all: 全部)')
484
484
  # 升级命令
485
485
  upgrade_parser = subparsers.add_parser('upgrade', help='升级所有模块/适配器')
486
486
  upgrade_parser.add_argument('--force', '-f', action='store_true', help='跳过确认直接升级')
487
487
 
488
488
  # 运行命令
489
- run_parser = subparsers.add_parser('run', help='运行指定主程序')
490
- run_parser.add_argument('script', type=str, help='要运行的主程序路径')
489
+ run_parser = subparsers.add_parser('run', help='运行指定主程序(默认为main.py)')
490
+ run_parser.add_argument('script', type=str, nargs='?', help='要运行的主程序路径(可选,默认为main.py)')
491
491
  run_parser.add_argument('--reload', action='store_true', help='启用热重载模式')
492
492
 
493
493
  args = parser.parse_args()
@@ -567,6 +567,25 @@ def main():
567
567
  elif args.command == "list":
568
568
  installed = PyPIManager.get_installed_packages()
569
569
 
570
+ # 获取已安装的CLI扩展
571
+ cli_extensions = {}
572
+ try:
573
+ entry_points = importlib.metadata.entry_points()
574
+ if hasattr(entry_points, 'select'):
575
+ cli_entries = entry_points.select(group='erispulse.cli')
576
+ else:
577
+ cli_entries = entry_points.get('erispulse.cli', [])
578
+
579
+ for entry in cli_entries:
580
+ dist = entry.dist
581
+ cli_extensions[entry.name] = {
582
+ "package": dist.metadata["Name"],
583
+ "version": dist.version,
584
+ "summary": dist.metadata["Summary"]
585
+ }
586
+ except Exception as e:
587
+ console.print(f"[yellow]获取CLI扩展信息失败: {e}[/]", style="warning")
588
+
570
589
  if args.type in ["modules", "all"] and installed["modules"]:
571
590
  table = Table(title="已安装模块", box=SIMPLE)
572
591
  table.add_column("模块名", style="green")
@@ -591,9 +610,20 @@ def main():
591
610
 
592
611
  console.print(table)
593
612
 
594
- if not installed["modules"] and not installed["adapters"]:
613
+ if cli_extensions and args.type in ["cli", "all"]:
614
+ table = Table(title="已安装CLI扩展", box=SIMPLE)
615
+ table.add_column("命令名", style="magenta")
616
+ table.add_column("包名", style="blue")
617
+ table.add_column("版本")
618
+ table.add_column("描述")
619
+
620
+ for name, info in cli_extensions.items():
621
+ table.add_row(name, info["package"], info["version"], info["summary"])
622
+ console.print(table)
623
+
624
+ if not installed["modules"] and not installed["adapters"] and not cli_extensions:
595
625
  console.print(Panel(
596
- "没有安装任何ErisPulse模块或适配器",
626
+ "没有安装任何ErisPulse模块、适配器或CLI扩展",
597
627
  title="提示",
598
628
  style="info"
599
629
  ))
@@ -603,6 +633,16 @@ def main():
603
633
  PyPIManager.upgrade_all()
604
634
 
605
635
  elif args.command == "run":
636
+ if not hasattr(args, 'script') or not args.script:
637
+ if not os.path.exists("config.toml") or not os.path.isfile("main.py"):
638
+ from ErisPulse import sdk
639
+ sdk.init()
640
+ args.script = "main.py"
641
+ console.print(Panel(
642
+ "未指定主程序,运行入口点为 [bold]main.py[/]",
643
+ title="提示",
644
+ style="info"
645
+ ))
606
646
  start_reloader(args.script, args.reload)
607
647
  elif args.command == "list-remote":
608
648
  import asyncio
@@ -632,10 +672,26 @@ def main():
632
672
  table.add_row(name, info["package"], info["version"], info["description"])
633
673
 
634
674
  console.print(table)
675
+
676
+ # 展示远程CLI扩展
677
+ if "cli_extensions" in remote_packages and args.type in ["cli", "all"] and remote_packages["cli_extensions"]:
678
+ table = Table(title="远程CLI扩展", box=SIMPLE)
679
+ table.add_column("命令名", style="magenta")
680
+ table.add_column("包名", style="blue")
681
+ table.add_column("版本")
682
+ table.add_column("描述")
683
+
684
+ for name, info in remote_packages["cli_extensions"].items():
685
+ commands = info.get("command", [])
686
+ command_str = ", ".join(commands) if isinstance(commands, list) else str(commands)
687
+ table.add_row(command_str, info["package"], info["version"], info["description"])
635
688
 
636
- if not remote_packages["modules"] and not remote_packages["adapters"]:
689
+ console.print(table)
690
+
691
+ if not remote_packages["modules"] and not remote_packages["adapters"] and \
692
+ (not "cli_extensions" in remote_packages or not remote_packages["cli_extensions"]):
637
693
  console.print(Panel(
638
- "没有找到远程模块或适配器",
694
+ "没有找到远程模块、适配器或CLI扩展",
639
695
  title="提示",
640
696
  style="info"
641
697
  ))
@@ -646,7 +702,14 @@ def main():
646
702
  title="错误",
647
703
  style="error"
648
704
  ))
649
-
705
+ elif args.command == "init":
706
+ from ErisPulse import sdk
707
+ sdk.init()
708
+ console.print(Panel(
709
+ "初始化完成",
710
+ title="成功",
711
+ style="success"
712
+ ))
650
713
  except KeyboardInterrupt as e:
651
714
  pass
652
715
  except Exception as e:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ErisPulse
3
- Version: 2.1.10
3
+ Version: 2.1.12
4
4
  Summary: ErisPulse 是一个模块化、可扩展的异步 Python SDK 框架,主要用于构建高效、可维护的机器人应用程序。
5
5
  Author-email: "艾莉丝·格雷拉特(WSu2059)" <wsu2059@qq.com>, runoneall <runoobsteve@gmail.com>
6
6
  License: MIT License
@@ -1,16 +1,16 @@
1
1
  ErisPulse/__init__.py,sha256=T-N56UQyBmpvlqwH2wGi5ptPzaJpbgF5tKkJt0DlkaM,26099
2
- ErisPulse/__main__.py,sha256=QwHMu8lmWbjS3EyOYV-wea3I0xcGmH_McWNx7JSGwts,24853
2
+ ErisPulse/__main__.py,sha256=A9rh8y7esZEuY8xb8R_N8zqPYSTWO_YZam1Cd6LFhP0,28190
3
3
  ErisPulse/Core/__init__.py,sha256=tBYPahQ7-w7U6M69xy8DW0_ECa9ja-Q0y_SQqVswYBo,409
4
4
  ErisPulse/Core/adapter.py,sha256=ZK81dibJ471FowL0MRXkS113iBcMgj_VzpTw0PzhAEo,18102
5
5
  ErisPulse/Core/config.py,sha256=ZmwGdtHSOE7K5uOGzLYcyl3ZF3sAmeWAntqcdfDzhpM,5027
6
6
  ErisPulse/Core/env.py,sha256=HGkzsdbxh8c1GSDJhnGP9B09Sz2ZeNbRxWieaFmAcug,18870
7
- ErisPulse/Core/logger.py,sha256=3PPwJVcIM_TZerGGK_68vCdxsR0owrhyek3iyugGVg0,8295
7
+ ErisPulse/Core/logger.py,sha256=cJzNXF-EmdWxwgiHg5Itmkwsva2Jhe9l9X4rXKiXHgc,8296
8
8
  ErisPulse/Core/mods.py,sha256=2yIq8t9Ca9CBPRiZU0yr8Lc0XGmmkB7LlH-5FWqXjw4,7023
9
9
  ErisPulse/Core/raiserr.py,sha256=vlyaaiOIYkyqm9dAqSW9E54JBzX-9roHDp5_r6I0yUU,5591
10
10
  ErisPulse/Core/server.py,sha256=FkDTeLuHD5IBnWVxvYU8pHb6yCt8GzyvC1bpOiJ7G7I,9217
11
11
  ErisPulse/Core/util.py,sha256=7rdMmn6sBFqYd4znxBCcJjuv2eyTExdeKyZopgds868,3796
12
- erispulse-2.1.10.dist-info/METADATA,sha256=3J5J1MQYsOgZLgNmtcOwMnlh7AezJmAuaVAPwrQNRaw,6259
13
- erispulse-2.1.10.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
14
- erispulse-2.1.10.dist-info/entry_points.txt,sha256=Jss71M6nEha0TA-DyVZugPYdcL14s9QpiOeIlgWxzOc,182
15
- erispulse-2.1.10.dist-info/licenses/LICENSE,sha256=4jyqikiB0G0n06CEEMMTzTXjE4IShghSlB74skMSPQs,1464
16
- erispulse-2.1.10.dist-info/RECORD,,
12
+ erispulse-2.1.12.dist-info/METADATA,sha256=rfHYXiTX37hUr5YIfzkm6plWIjxUcMqSp80iSnO34VI,6259
13
+ erispulse-2.1.12.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
14
+ erispulse-2.1.12.dist-info/entry_points.txt,sha256=Jss71M6nEha0TA-DyVZugPYdcL14s9QpiOeIlgWxzOc,182
15
+ erispulse-2.1.12.dist-info/licenses/LICENSE,sha256=4jyqikiB0G0n06CEEMMTzTXjE4IShghSlB74skMSPQs,1464
16
+ erispulse-2.1.12.dist-info/RECORD,,