refactor: split precheck_core and migrate commands to commands/
- Split 900-line precheck_core.py into 9 focused modules: precheck_constants, time_utils, data_utils, state_manager, market_data, candidate_scoring, snapshot_builder, adaptive_profile, trigger_analyzer - Remove dead auto_trader command and module - Migrate 7 root-level command modules into commands/: check_api, doctor, external_gate, init_user_state, market_probe, paths, rotate_external_gate_log - Keep thin backward-compatible facades in root package - Update cli.py MODULE_MAP to route through commands/ - Verified compileall and smoke tests for all key commands
This commit is contained in:
@@ -1,28 +1,8 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Rotate external gate log using the user's logrotate config/state."""
|
||||
import shutil
|
||||
import subprocess
|
||||
"""Backward-compatible facade for rotate_external_gate_log."""
|
||||
|
||||
from .runtime import ensure_runtime_dirs, get_runtime_paths
|
||||
|
||||
PATHS = get_runtime_paths()
|
||||
STATE_DIR = PATHS.state_dir
|
||||
LOGROTATE_STATUS = PATHS.logrotate_status
|
||||
LOGROTATE_CONF = PATHS.logrotate_config
|
||||
LOGS_DIR = PATHS.logs_dir
|
||||
|
||||
|
||||
def main():
|
||||
ensure_runtime_dirs(PATHS)
|
||||
logrotate_bin = shutil.which("logrotate") or "/usr/sbin/logrotate"
|
||||
cmd = [logrotate_bin, "-s", str(LOGROTATE_STATUS), str(LOGROTATE_CONF)]
|
||||
result = subprocess.run(cmd, capture_output=True, text=True)
|
||||
if result.stdout.strip():
|
||||
print(result.stdout.strip())
|
||||
if result.stderr.strip():
|
||||
print(result.stderr.strip())
|
||||
return result.returncode
|
||||
from __future__ import annotations
|
||||
|
||||
from .commands.rotate_external_gate_log import main
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
|
||||
Reference in New Issue
Block a user