v2.2 - Small improvement Interface change

This commit is contained in:
pporcheret
2026-10-29 11:13:02 +01:00
parent a17c3cb614
commit 7f26f9b015
271 changed files with 6207 additions and 16044 deletions
+36
View File
@@ -0,0 +1,36 @@
#!/usr/bin/env python3
"""Local administrator-only command-line deployment / rollback.
This CLI is NOT exposed via MCP or Flask.
"""
from __future__ import annotations
import argparse
import os
import sys
from pathlib import Path
ROOT=Path(__file__).resolve().parents[1]
sys.path.insert(0,str(ROOT))
from services import alfred_developer_core as dev
def main():
p=argparse.ArgumentParser(description='Alfred Developer: déploiement local contrôlé')
p.add_argument('action',choices=['deploy','rollback'])
p.add_argument('id')
p.add_argument('--apply',action='store_true',help='Appliquer réellement ; sinon simulation')
args=p.parse_args()
if args.apply and os.geteuid()!=0:
p.error('Seul un administrateur root local peut appliquer un changement.')
try:
if args.action=='deploy':out=dev.deploy(args.id,apply=args.apply)
else:out=dev.rollback(args.id,apply=args.apply)
print(out)
if args.apply and out.get('requires_restart'):
print('Fichiers Python modifiés : redémarrer alfred.service puis vérifier la santé du service.')
elif args.apply:
print('Actualise ton navigateur (Ctrl+F5) ; vérifier l’interface avant de conserver le changement.')
return 0
except (ValueError,OSError,RuntimeError) as e:
print('OPÉRATION REFUSÉE :',e,file=sys.stderr);return 1
if __name__=='__main__':raise SystemExit(main())