fix: install.sh pipe-mode, add .gitignore, robust error handling, resume state check

This commit is contained in:
2026-05-22 20:08:41 +04:00
parent ddb2ae9501
commit 13a1583df1
17 changed files with 210 additions and 76 deletions
+40 -9
View File
@@ -7,12 +7,11 @@ import sys
import os
import argparse
# Добавляем корень проекта в PATH
_PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if _PROJECT_ROOT not in sys.path:
sys.path.insert(0, _PROJECT_ROOT)
from core.color import banner, menu, prompt, info, error, warn
from core.color import banner, menu, prompt, info, error as cerror, warn
from core import state
@@ -55,16 +54,42 @@ def main():
# Интерактивный режим
banner()
while True:
menu()
choice = prompt("Ваш выбор").strip()
st = state.load_state()
has_resume = bool(st.get("mode") and st.get("stage") and st.get("stage") != "INIT")
menu(has_resume=has_resume)
try:
choice = prompt("Ваш выбор", default="0").strip()
except SystemExit:
break
if choice == "1":
from source.source import run_source_mode
run_source_mode()
try:
run_source_mode()
except KeyboardInterrupt:
warn("Прервано")
except Exception as e:
cerror(f"Ошибка: {e}")
sys.exit(1)
break
elif choice == "2":
from target.target import run_target_mode
run_target_mode()
try:
run_target_mode()
except KeyboardInterrupt:
warn("Прервано")
except Exception as e:
cerror(f"Ошибка: {e}")
sys.exit(1)
break
elif choice == "3":
_do_resume()
if not has_resume:
warn("Нет сохранённого состояния для продолжения")
continue
try:
_do_resume()
except KeyboardInterrupt:
warn("Прервано")
break
elif choice == "4":
_do_status_logs()
elif choice == "0":
@@ -83,7 +108,10 @@ def _do_resume():
info("Нет сохранённого состояния для продолжения")
return
fsm = FSM(mode=mode)
fsm.resume_from(stage)
try:
fsm.resume_from(stage)
except Exception as e:
cerror(f"Ошибка при resume: {e}")
def _do_status_logs():
@@ -93,7 +121,10 @@ def _do_status_logs():
print(" 1 Показать статус")
print(" 2 Показать лог последней ошибки")
print(" 0 Назад")
c = prompt("Выбор").strip()
try:
c = prompt("Выбор", default="0").strip()
except SystemExit:
break
if c == "1":
stmod.show_status()
elif c == "2":