#!/usr/bin/env python3 # -*- coding: utf-8 -*- """合同到期智能预警与续聘辅助 - CLI 入口。 v1.1.0 实现: - argparse 子命令分发 - jiangchang_skill_core 降级(宿主环境用完整版,本地用自包含实现) - UTF-8 输出兼容(Windows cmd) """ from __future__ import annotations import io import os import sys # UTF-8 输出兼容(Windows) if sys.platform == "win32": if hasattr(sys.stdout, "buffer"): sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8", errors="replace") if hasattr(sys.stderr, "buffer"): sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding="utf-8", errors="replace") # scripts/main.py → scripts/ → 加进 sys.path _scripts_dir = os.path.dirname(os.path.abspath(__file__)) if _scripts_dir not in sys.path: sys.path.insert(0, _scripts_dir) def _apply_host_runtime() -> None: """宿主共享 runtime 集成(本地无 jiangchang_skill_core 时跳过)。""" try: from jiangchang_skill_core.runtime_env import apply_cli_local_defaults apply_cli_local_defaults() except ImportError: pass # 本地环境没有宿主 runtime,跳过 _apply_host_runtime() from cli.app import main if __name__ == "__main__": raise SystemExit(main())