refactor: 入口脚本迁移到 bin/

将 4 个入口脚本从根目录迁移到 bin/:
- run_cli.py
- gui_app.py
- webgui_launcher.py
- manage_logs.py

配套修改:
- 修复 bin/*.py 内部 ROOT_DIR 计算(parent.parent)
- bin/run_cli.py 在 sys.path 加入项目根,shim 加载逻辑保持不变
- bin/manage_logs.py 在 sys.path 加入项目根
- path_config.get_run_cli_path() 返回 bin/run_cli.py

启动方式变化:
- 原: python run_cli.py / python gui_app.py
- 新: python bin/run_cli.py / python bin/gui_app.py

GUI 内部通过 path_config.get_run_cli_path() 调用,自动适配。

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
CodexandClaude Opus 4.5 committed 2026-05-21 00:23:14 +08:00
1 parent 309b629e7c
commit e3e399da70
5 files changed
+9 -6

No files matched your search

+1 -1
View File
@@ -9,7 +9,7 @@ import sys
from pathlib import Path
ROOT_DIR = Path(__file__).resolve().parent
ROOT_DIR = Path(__file__).resolve().parent.parent
TARGET = ROOT_DIR / "gui" / "gui_app.py"
VENV_PYTHON = ROOT_DIR / ".venv" / "Scripts" / "python.exe"
+2 -2
View File
@@ -27,8 +27,8 @@ import argparse
from datetime import datetime, timedelta
from typing import Dict, Any
# 添加项目路径
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
# 添加项目根到 sys.path(从 bin/ 目录运行时需要)
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from douyin.logging.douyin_logging import (
cleanup_old_logs,
+4 -1
View File
@@ -47,7 +47,10 @@ except Exception as e:
# 如果需要从外部工作树加载兼容模块,可显式设置 EXTERNAL_DOUYIN_FUDAI_DIR。
# 默认只使用当前仓库内置实现,避免绑定到某台机器的 Cursor worktree 路径。
_BASE_DIR = os.path.dirname(__file__)
_BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# 确保项目根在 sys.path 中(脚本从 bin/ 目录启动时)
if _BASE_DIR not in sys.path:
sys.path.insert(0, _BASE_DIR)
_EXTERNAL_DOUYIN_FUDAI_DIR = os.environ.get("EXTERNAL_DOUYIN_FUDAI_DIR", "").strip()
@@ -9,7 +9,7 @@ import sys
from pathlib import Path
ROOT_DIR = Path(__file__).resolve().parent
ROOT_DIR = Path(__file__).resolve().parent.parent
TARGET = ROOT_DIR / "gui" / "webgui_launcher.py"
VENV_PYTHON = ROOT_DIR / ".venv" / "Scripts" / "python.exe"
+1 -1
View File
@@ -127,7 +127,7 @@ def get_robot_verify_pic_path(save_subdir: bool = False) -> str:
def get_run_cli_path() -> str:
"""返回 run_cli.py 的路径(绝对路径)"""
return os.path.abspath(os.path.join(PROJECT_ROOT, "run_cli.py"))
return os.path.abspath(os.path.join(PROJECT_ROOT, "bin", "run_cli.py"))
def ensure_dir(path: str) -> None: