From a19fa35a0fad2908e49f0b676017b587676b130b Mon Sep 17 00:00:00 2001 From: Codex Date: Wed, 20 May 2026 23:25:28 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=95=B4=E7=90=86=20tools/=2047=20?= =?UTF-8?q?=E4=B8=AA=E8=84=9A=E6=9C=AC=E6=8C=89=E5=8A=9F=E8=83=BD=E5=88=86?= =?UTF-8?q?=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - diagnostics/ 11 个:环境/配置/依赖诊断 - logs/ 7 个:日志分析与查看 - coords/ 6 个:坐标拾取与区域选择 - cleanup/ 3 个:代码清理工具 - adb/ 2 个:ADB / 输入法相关 - windows/ 4 个:Windows 系统修复(备份) - dev/ 9 个:开发辅助 / 运行时探测 并更新 tools/README.md 描述新结构。 删除 3 个明显的临时调试脚本 (_dump_lines.py / tmp_*.py)。 tools/ 不被业务代码 import,分组仅为人工浏览方便。 Co-Authored-By: Claude Opus 4.5 --- tools/README.md | 43 ++++++++++++------ tools/_dump_lines.py | 7 --- tools/{ => adb}/ADBKeyboard.apk | Bin tools/{ => adb}/auto_connect_wifi_adb.py | 0 tools/{ => cleanup}/cleanup_unused_files.py | 0 .../{ => cleanup}/fix_trailing_whitespace.py | 0 tools/{ => cleanup}/sanitize_cursor_paths.py | 0 tools/{ => coords}/README_Region_Selector.md | 0 tools/{ => coords}/pick_coords.py | 0 tools/{ => coords}/region_selector.py | 0 tools/{ => coords}/scan_coords.py | 0 tools/{ => coords}/simple_region_selector.py | 0 tools/{ => coords}/启动区域选择器.bat | 0 tools/{ => dev}/dump_room_map_test.py | 0 tools/{ => dev}/generate_param_locations.py | 0 tools/{ => dev}/install_dependencies.py | 0 tools/{ => dev}/merge_configs.py | 0 tools/{ => dev}/param_usage_tool.py | 0 tools/{ => dev}/simulate_swipe_trigger.py | 0 tools/{ => dev}/web_gui_config_manifest.json | 0 tools/{ => dev}/使用说明.txt | 0 tools/{ => dev}/生成WPS流程图.py | 0 .../{ => diagnostics}/check_action_logger.py | 0 tools/{ => diagnostics}/check_dependencies.py | 0 .../{ => diagnostics}/check_gpu_available.py | 0 .../check_gui_params_conflicts.py | 0 .../check_screenshot_optimization.py | 0 .../{ => diagnostics}/check_system_config.py | 0 .../check_web_gui_config_sync.py | 0 .../diagnose_runtime_flags.py | 0 .../find_duplicate_excepts.py | 0 .../run_screenshot_diagnostics.py | 0 .../verify_gui_back_method.py | 0 tools/{ => logs}/README_color_log_viewer.md | 0 .../{ => logs}/analyze_optimization_effect.py | 0 tools/{ => logs}/analyze_screenshot_logs.py | 0 tools/{ => logs}/analyze_step_times.py | 0 tools/{ => logs}/color_log_viewer.py | 0 tools/{ => logs}/detailed_time_analysis.py | 0 tools/{ => logs}/log_filter.py | 0 tools/tmp_check_logging.py | 37 --------------- tools/tmp_threshold_check.py | 14 ------ .../dism_restorehealth_from_iso.ps1 | 0 tools/{ => windows}/fix_start_menu_win11.ps1 | 0 .../fix_start_menu_win11_admin.ps1 | 0 .../restore_start_menu_from_recyclebin.ps1 | 0 46 files changed, 30 insertions(+), 71 deletions(-) delete mode 100644 tools/_dump_lines.py rename tools/{ => adb}/ADBKeyboard.apk (100%) rename tools/{ => adb}/auto_connect_wifi_adb.py (100%) rename tools/{ => cleanup}/cleanup_unused_files.py (100%) rename tools/{ => cleanup}/fix_trailing_whitespace.py (100%) rename tools/{ => cleanup}/sanitize_cursor_paths.py (100%) rename tools/{ => coords}/README_Region_Selector.md (100%) rename tools/{ => coords}/pick_coords.py (100%) rename tools/{ => coords}/region_selector.py (100%) rename tools/{ => coords}/scan_coords.py (100%) rename tools/{ => coords}/simple_region_selector.py (100%) rename tools/{ => coords}/启动区域选择器.bat (100%) rename tools/{ => dev}/dump_room_map_test.py (100%) rename tools/{ => dev}/generate_param_locations.py (100%) rename tools/{ => dev}/install_dependencies.py (100%) rename tools/{ => dev}/merge_configs.py (100%) rename tools/{ => dev}/param_usage_tool.py (100%) rename tools/{ => dev}/simulate_swipe_trigger.py (100%) rename tools/{ => dev}/web_gui_config_manifest.json (100%) rename tools/{ => dev}/使用说明.txt (100%) rename tools/{ => dev}/生成WPS流程图.py (100%) rename tools/{ => diagnostics}/check_action_logger.py (100%) rename tools/{ => diagnostics}/check_dependencies.py (100%) rename tools/{ => diagnostics}/check_gpu_available.py (100%) rename tools/{ => diagnostics}/check_gui_params_conflicts.py (100%) rename tools/{ => diagnostics}/check_screenshot_optimization.py (100%) rename tools/{ => diagnostics}/check_system_config.py (100%) rename tools/{ => diagnostics}/check_web_gui_config_sync.py (100%) rename tools/{ => diagnostics}/diagnose_runtime_flags.py (100%) rename tools/{ => diagnostics}/find_duplicate_excepts.py (100%) rename tools/{ => diagnostics}/run_screenshot_diagnostics.py (100%) rename tools/{ => diagnostics}/verify_gui_back_method.py (100%) rename tools/{ => logs}/README_color_log_viewer.md (100%) rename tools/{ => logs}/analyze_optimization_effect.py (100%) rename tools/{ => logs}/analyze_screenshot_logs.py (100%) rename tools/{ => logs}/analyze_step_times.py (100%) rename tools/{ => logs}/color_log_viewer.py (100%) rename tools/{ => logs}/detailed_time_analysis.py (100%) rename tools/{ => logs}/log_filter.py (100%) delete mode 100644 tools/tmp_check_logging.py delete mode 100644 tools/tmp_threshold_check.py rename tools/{ => windows}/dism_restorehealth_from_iso.ps1 (100%) rename tools/{ => windows}/fix_start_menu_win11.ps1 (100%) rename tools/{ => windows}/fix_start_menu_win11_admin.ps1 (100%) rename tools/{ => windows}/restore_start_menu_from_recyclebin.ps1 (100%) diff --git a/tools/README.md b/tools/README.md index e00e2e1..3afee26 100644 --- a/tools/README.md +++ b/tools/README.md @@ -1,21 +1,38 @@ -tools/scan_coords.py — 坐标/ROI 扫描工具 +# tools/ 工具脚本目录 -用途 +按功能分组组织,与主代码分离。tools/ 不被业务代码 import。 -- 扫描仓库中疑似硬编码坐标或裁剪区域(如 `(100, 200)`、`(x1,y1,x2,y2)`)的代码行。 -- 输出 CSV 到 `tools/coords_report.csv`,便于人工或脚本进一步审查。 +## 目录结构 -用法 +| 子目录 | 用途 | 典型脚本 | +|--------|------|----------| +| `diagnostics/` | 环境/配置/依赖诊断 | `check_system_config.py`、`check_dependencies.py`、`diagnose_runtime_flags.py` | +| `logs/` | 日志分析与查看 | `analyze_step_times.py`、`color_log_viewer.py`、`log_filter.py` | +| `coords/` | 坐标拾取与区域选择 | `pick_coords.py`、`region_selector.py`、`scan_coords.py` | +| `cleanup/` | 代码清理工具 | `cleanup_unused_files.py`、`fix_trailing_whitespace.py` | +| `adb/` | ADB / 输入法相关 | `auto_connect_wifi_adb.py`、`ADBKeyboard.apk` | +| `windows/` | Windows 系统修复脚本 | `fix_start_menu_win11.ps1` 等(与本项目无关,仅备份) | +| `dev/` | 开发辅助 / 运行时探测 | `param_usage_tool.py`、`simulate_swipe_trigger.py`、`merge_configs.py` | + +## 常用入口 ```powershell -python tools/scan_coords.py +# 系统/依赖诊断 +python tools/diagnostics/check_system_config.py +python tools/diagnostics/check_dependencies.py + +# 坐标扫描 +python tools/coords/scan_coords.py + +# 日志分析 +python tools/logs/log_filter.py +python tools/logs/color_log_viewer.py + +# 参数使用追踪 +python tools/dev/param_usage_tool.py show --limit 200 ``` -输出 +## 注意 -- `tools/coords_report.csv` 包含字段:`file,line,match,context`。 - -注意 - -- 本脚本使用简单正则匹配,可能存在误报/漏报,建议在生成报告后人工复核。 -- 可根据需要扩展正则或关键词列表以覆盖更多模式。 \ No newline at end of file +- `windows/` 下的脚本是本机环境的修复工具,与抖音挂机功能无关,保留作为环境备份。 +- `coords/scan_coords.py` 输出 `tools/coords/coords_report.csv`(已 gitignore),人工核查用。 diff --git a/tools/_dump_lines.py b/tools/_dump_lines.py deleted file mode 100644 index e87503a..0000000 --- a/tools/_dump_lines.py +++ /dev/null @@ -1,7 +0,0 @@ -import sys - -p = "douyin/other/douyin_yanghao.py" -with open(p, "rb") as f: - lines = f.read().splitlines() -for i in range(959, 979): - print(f"{i+1:4}: {lines[i]!r}") diff --git a/tools/ADBKeyboard.apk b/tools/adb/ADBKeyboard.apk similarity index 100% rename from tools/ADBKeyboard.apk rename to tools/adb/ADBKeyboard.apk diff --git a/tools/auto_connect_wifi_adb.py b/tools/adb/auto_connect_wifi_adb.py similarity index 100% rename from tools/auto_connect_wifi_adb.py rename to tools/adb/auto_connect_wifi_adb.py diff --git a/tools/cleanup_unused_files.py b/tools/cleanup/cleanup_unused_files.py similarity index 100% rename from tools/cleanup_unused_files.py rename to tools/cleanup/cleanup_unused_files.py diff --git a/tools/fix_trailing_whitespace.py b/tools/cleanup/fix_trailing_whitespace.py similarity index 100% rename from tools/fix_trailing_whitespace.py rename to tools/cleanup/fix_trailing_whitespace.py diff --git a/tools/sanitize_cursor_paths.py b/tools/cleanup/sanitize_cursor_paths.py similarity index 100% rename from tools/sanitize_cursor_paths.py rename to tools/cleanup/sanitize_cursor_paths.py diff --git a/tools/README_Region_Selector.md b/tools/coords/README_Region_Selector.md similarity index 100% rename from tools/README_Region_Selector.md rename to tools/coords/README_Region_Selector.md diff --git a/tools/pick_coords.py b/tools/coords/pick_coords.py similarity index 100% rename from tools/pick_coords.py rename to tools/coords/pick_coords.py diff --git a/tools/region_selector.py b/tools/coords/region_selector.py similarity index 100% rename from tools/region_selector.py rename to tools/coords/region_selector.py diff --git a/tools/scan_coords.py b/tools/coords/scan_coords.py similarity index 100% rename from tools/scan_coords.py rename to tools/coords/scan_coords.py diff --git a/tools/simple_region_selector.py b/tools/coords/simple_region_selector.py similarity index 100% rename from tools/simple_region_selector.py rename to tools/coords/simple_region_selector.py diff --git a/tools/启动区域选择器.bat b/tools/coords/启动区域选择器.bat similarity index 100% rename from tools/启动区域选择器.bat rename to tools/coords/启动区域选择器.bat diff --git a/tools/dump_room_map_test.py b/tools/dev/dump_room_map_test.py similarity index 100% rename from tools/dump_room_map_test.py rename to tools/dev/dump_room_map_test.py diff --git a/tools/generate_param_locations.py b/tools/dev/generate_param_locations.py similarity index 100% rename from tools/generate_param_locations.py rename to tools/dev/generate_param_locations.py diff --git a/tools/install_dependencies.py b/tools/dev/install_dependencies.py similarity index 100% rename from tools/install_dependencies.py rename to tools/dev/install_dependencies.py diff --git a/tools/merge_configs.py b/tools/dev/merge_configs.py similarity index 100% rename from tools/merge_configs.py rename to tools/dev/merge_configs.py diff --git a/tools/param_usage_tool.py b/tools/dev/param_usage_tool.py similarity index 100% rename from tools/param_usage_tool.py rename to tools/dev/param_usage_tool.py diff --git a/tools/simulate_swipe_trigger.py b/tools/dev/simulate_swipe_trigger.py similarity index 100% rename from tools/simulate_swipe_trigger.py rename to tools/dev/simulate_swipe_trigger.py diff --git a/tools/web_gui_config_manifest.json b/tools/dev/web_gui_config_manifest.json similarity index 100% rename from tools/web_gui_config_manifest.json rename to tools/dev/web_gui_config_manifest.json diff --git a/tools/使用说明.txt b/tools/dev/使用说明.txt similarity index 100% rename from tools/使用说明.txt rename to tools/dev/使用说明.txt diff --git a/tools/生成WPS流程图.py b/tools/dev/生成WPS流程图.py similarity index 100% rename from tools/生成WPS流程图.py rename to tools/dev/生成WPS流程图.py diff --git a/tools/check_action_logger.py b/tools/diagnostics/check_action_logger.py similarity index 100% rename from tools/check_action_logger.py rename to tools/diagnostics/check_action_logger.py diff --git a/tools/check_dependencies.py b/tools/diagnostics/check_dependencies.py similarity index 100% rename from tools/check_dependencies.py rename to tools/diagnostics/check_dependencies.py diff --git a/tools/check_gpu_available.py b/tools/diagnostics/check_gpu_available.py similarity index 100% rename from tools/check_gpu_available.py rename to tools/diagnostics/check_gpu_available.py diff --git a/tools/check_gui_params_conflicts.py b/tools/diagnostics/check_gui_params_conflicts.py similarity index 100% rename from tools/check_gui_params_conflicts.py rename to tools/diagnostics/check_gui_params_conflicts.py diff --git a/tools/check_screenshot_optimization.py b/tools/diagnostics/check_screenshot_optimization.py similarity index 100% rename from tools/check_screenshot_optimization.py rename to tools/diagnostics/check_screenshot_optimization.py diff --git a/tools/check_system_config.py b/tools/diagnostics/check_system_config.py similarity index 100% rename from tools/check_system_config.py rename to tools/diagnostics/check_system_config.py diff --git a/tools/check_web_gui_config_sync.py b/tools/diagnostics/check_web_gui_config_sync.py similarity index 100% rename from tools/check_web_gui_config_sync.py rename to tools/diagnostics/check_web_gui_config_sync.py diff --git a/tools/diagnose_runtime_flags.py b/tools/diagnostics/diagnose_runtime_flags.py similarity index 100% rename from tools/diagnose_runtime_flags.py rename to tools/diagnostics/diagnose_runtime_flags.py diff --git a/tools/find_duplicate_excepts.py b/tools/diagnostics/find_duplicate_excepts.py similarity index 100% rename from tools/find_duplicate_excepts.py rename to tools/diagnostics/find_duplicate_excepts.py diff --git a/tools/run_screenshot_diagnostics.py b/tools/diagnostics/run_screenshot_diagnostics.py similarity index 100% rename from tools/run_screenshot_diagnostics.py rename to tools/diagnostics/run_screenshot_diagnostics.py diff --git a/tools/verify_gui_back_method.py b/tools/diagnostics/verify_gui_back_method.py similarity index 100% rename from tools/verify_gui_back_method.py rename to tools/diagnostics/verify_gui_back_method.py diff --git a/tools/README_color_log_viewer.md b/tools/logs/README_color_log_viewer.md similarity index 100% rename from tools/README_color_log_viewer.md rename to tools/logs/README_color_log_viewer.md diff --git a/tools/analyze_optimization_effect.py b/tools/logs/analyze_optimization_effect.py similarity index 100% rename from tools/analyze_optimization_effect.py rename to tools/logs/analyze_optimization_effect.py diff --git a/tools/analyze_screenshot_logs.py b/tools/logs/analyze_screenshot_logs.py similarity index 100% rename from tools/analyze_screenshot_logs.py rename to tools/logs/analyze_screenshot_logs.py diff --git a/tools/analyze_step_times.py b/tools/logs/analyze_step_times.py similarity index 100% rename from tools/analyze_step_times.py rename to tools/logs/analyze_step_times.py diff --git a/tools/color_log_viewer.py b/tools/logs/color_log_viewer.py similarity index 100% rename from tools/color_log_viewer.py rename to tools/logs/color_log_viewer.py diff --git a/tools/detailed_time_analysis.py b/tools/logs/detailed_time_analysis.py similarity index 100% rename from tools/detailed_time_analysis.py rename to tools/logs/detailed_time_analysis.py diff --git a/tools/log_filter.py b/tools/logs/log_filter.py similarity index 100% rename from tools/log_filter.py rename to tools/logs/log_filter.py diff --git a/tools/tmp_check_logging.py b/tools/tmp_check_logging.py deleted file mode 100644 index 7d16190..0000000 --- a/tools/tmp_check_logging.py +++ /dev/null @@ -1,37 +0,0 @@ -from douyin.logging import douyin_logging -import logging -import logging.handlers as lh - -# Configure logging using current config -douyin_logging.configure_logging() -root = logging.getLogger() -print("handlers:", [type(h).__name__ for h in root.handlers]) - -for h in root.handlers: - fname = getattr(h, "baseFilename", getattr(h, "filename", None)) - print(type(h).__name__, fname) - # RotatingDatedFileHandler specific - if hasattr(h, "max_bytes"): - print( - " max_bytes =", - getattr(h, "max_bytes", None), - "backup_count =", - getattr(h, "backup_count", None), - ) - # RotatingFileHandler - if isinstance(h, lh.RotatingFileHandler): - print( - " RotatingFileHandler maxBytes =", - getattr(h, "maxBytes", None), - "backupCount =", - getattr(h, "backupCount", None), - ) - if isinstance(h, lh.TimedRotatingFileHandler): - print( - " TimedRotating when =", - getattr(h, "when", None), - "interval =", - getattr(h, "interval", None), - "backupCount =", - getattr(h, "backupCount", None), - ) diff --git a/tools/tmp_threshold_check.py b/tools/tmp_threshold_check.py deleted file mode 100644 index 58745a9..0000000 --- a/tools/tmp_threshold_check.py +++ /dev/null @@ -1,14 +0,0 @@ -from douyin.core.douyin_fudai import fudai_analyse -from path_config import get_like_template_path, get_fav_template_path - -a = fudai_analyse() -print("default threshold", a.yanghao_icon_match_threshold) -like_roi = "pic/roi_test_like_20260104000913_1767456556.png" -fav_roi = "pic/roi_test_fav_20260104000916_1767456559.png" -like_tpl = get_like_template_path() -fav_tpl = get_fav_template_path() -print("Like match (default):", a._match_icon_template(like_roi, like_tpl)) -print("Fav match (default):", a._match_icon_template(fav_roi, fav_tpl)) -a.yanghao_icon_match_threshold = 0.5 -print("Like match (thr=0.5):", a._match_icon_template(like_roi, like_tpl)) -print("Fav match (thr=0.5):", a._match_icon_template(fav_roi, fav_tpl)) diff --git a/tools/dism_restorehealth_from_iso.ps1 b/tools/windows/dism_restorehealth_from_iso.ps1 similarity index 100% rename from tools/dism_restorehealth_from_iso.ps1 rename to tools/windows/dism_restorehealth_from_iso.ps1 diff --git a/tools/fix_start_menu_win11.ps1 b/tools/windows/fix_start_menu_win11.ps1 similarity index 100% rename from tools/fix_start_menu_win11.ps1 rename to tools/windows/fix_start_menu_win11.ps1 diff --git a/tools/fix_start_menu_win11_admin.ps1 b/tools/windows/fix_start_menu_win11_admin.ps1 similarity index 100% rename from tools/fix_start_menu_win11_admin.ps1 rename to tools/windows/fix_start_menu_win11_admin.ps1 diff --git a/tools/restore_start_menu_from_recyclebin.ps1 b/tools/windows/restore_start_menu_from_recyclebin.ps1 similarity index 100% rename from tools/restore_start_menu_from_recyclebin.ps1 rename to tools/windows/restore_start_menu_from_recyclebin.ps1