Files
xiaoli-cli/xiaoli/__main__.py
T
Xiaoli Dev bfedee5616 release: v3.6.0-release 发行版
- 默认 TUI 模式,--cli 切换命令行
- TUI 不可用时自动降级到 CLI
- 新增 CHANGELOG.md
- 更新版本号和 about.txt

本次更新由 mimo 自动化执行,与开发者无关。
2026-04-25 11:06:53 +08:00

94 lines
9.0 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""入口点 - python -m xiaoli"""
import sys
import os
import argparse
import time
from colorama import init
# 确保项目根目录在 sys.path 中
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
def main():
parser = argparse.ArgumentParser(description="小狸 Pro-CLI - 智能编程助手")
parser.add_argument('--cli', action='store_true', help='使用传统 CLI 模式(默认 TUI)')
parser.add_argument('--engine', type=str, help='指定 AI 引擎')
parser.add_argument('--version', action='store_true', help='显示版本')
args = parser.parse_args()
init(autoreset=True)
if args.version:
from xiaoli import __version__
print(f"小狸 Pro-CLI v{__version__}")
return
# 启动动画
_show_art()
# 检查 Textual 可用性
if not args.cli:
try:
from textual.app import App
except ImportError:
if not args.cli:
print("⚠️ Textual 未安装,自动切换到命令行模式")
print(" 安装 TUI: pip install textual")
args.cli = True
from xiaoli.app import App
app = App()
if args.engine:
app._switch_model(args.engine)
if args.cli:
app.run()
else:
app._run_tui()
def _show_art():
"""启动艺术字"""
art = [
"█████████████████████████████████████████████████████████████████████████████████████████████████████",
"██████████ ▒████████████████████████████████████████████████████",
"██████████ ░██████████████████████████████████████████████████████",
"██████████ ████████████████████████████████████████████████████████",
"██████████ ▓█████████████████████████████████████████████████████████",
"██████████ ▒███████████████████████████████████████████████████████████",
"██████████ █████████████████████████████████████████████████████████████",
"██████████ ███████████████████████████████████████████████████████████████",
"██████████ ▓███████████████████████████████████████████████████████████████",
"██████████ ░████████████████████████████████████████████████████████████████",
"██████████ ██████████████████████████████████████████████████████████████████",
"██████████ ████████████████████████████████████████████████████████████████████",
"██████████ ▓████████████████████████████████████████████████████████████████████",
"██████████ ░██████████████████████████████████████████████████████████████████████",
"██████████ ████████████████████████████████████████████████████████████████████████",
"██████████ ██████████████████████████████████████████████████████████████████████████",
"██████████ ░██████████████████████████████████████████████████████████████████████████",
"██████████ ████████████████████████████████████████████████████████████████████████████",
"██████████ ████████████████████████████████████████████████████████████████████████████",
"██████████ ▓██████████████████████████████████████████████████████████████████████████",
"██████████ ████████████████████████████████████████████████████████████████████████████",
"██████████ ████████████████████████████████████████████████████████████████████████████",
"███████████ ████████████████████████████████████████████████████████████████████████████",
"█████████████▓ ████████████████████████████████████████████████████████████████████████████",
"█████████████████ ▓██████████████████████████████████████████████████████████████████████████",
"███████████████████▒ ████████████████████████████████████████████████████████████████████████████",
"█████████████████████████████████████████████████████████████████████████████████████████████████████",
"█████████████████████████████████████████████████████████████████████████████████████████████████████",
]
for line in art:
try:
print(line, flush=True)
except UnicodeEncodeError:
pass
time.sleep(0.03)
if __name__ == "__main__":
main()