Skip to content

Commit abe4c5c

Browse files
committed
feat: amélioration de la visibilité de l'exécution BCASL dans la CLI
- Mise à jour de l'exécuteur BCASL pour supporter un callback de log. - Notification systématique du démarrage de BCASL, même en mode non-verbose. - Affichage dynamique du plugin actif et de la phase en cours dans la barre de statut via Rich. - Harmonisation des messages d'état ("Exécution de BCASL") entre les modes.
1 parent 5a201d0 commit abe4c5c

3 files changed

Lines changed: 47 additions & 11 deletions

File tree

Ui/Cli/helpers.py

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ def run_bcasl_before_compile_sync(workspace: Path, verbose: bool = False) -> boo
484484
console = get_console()
485485
status = None
486486
if not verbose and console:
487-
status = console.status("[cyan]Verification BCASL...[/cyan]", spinner="dots")
487+
status = console.status("[cyan]Exécution de BCASL...[/cyan]", spinner="dots")
488488
status.start()
489489

490490
class CliBcaslHost:
@@ -503,15 +503,23 @@ def append(self, msg: str):
503503
elif self.host_ptr.status_obj:
504504
clean = msg.strip()
505505
if clean and not clean.startswith("["):
506-
if len(clean) < 100:
507-
self.host_ptr.status_obj.update(f"[cyan]BCASL: {clean}[/cyan]")
506+
display = clean
507+
if clean.startswith("Plugin: "):
508+
# Utilisation de markup Rich au lieu d'icônes
509+
plugin_name = clean[8:].strip()
510+
display = f"Plugin: [bold white]{plugin_name}[/bold white]"
511+
elif clean.startswith("Phase: "):
512+
phase_name = clean[7:].strip()
513+
display = f"Phase: [bold yellow]{phase_name}[/bold yellow]"
514+
515+
if len(display) < 120:
516+
self.host_ptr.status_obj.update(f"[cyan]BCASL[/cyan] [white]»[/white] {display}")
508517

509518
self.log = Logger(self)
510519

511520
host = CliBcaslHost(workspace, status)
512521

513-
if verbose:
514-
info("Running BCASL pre-compile checks...")
522+
info("Running BCASL pre-compile checks...")
515523

516524
# Register SIGINT handler
517525
_CLI_CANCEL_EVENT.clear()
@@ -570,7 +578,7 @@ def run_bcasl_headless(args: list[str], verbose: bool = False) -> int:
570578
console = get_console()
571579
status = None
572580
if not verbose and console:
573-
status = console.status("[cyan]Verification BCASL (headless)...[/cyan]", spinner="dots")
581+
status = console.status("[cyan]Exécution de BCASL (headless)...[/cyan]", spinner="dots")
574582
status.start()
575583

576584
class CliBcaslHost:
@@ -588,15 +596,23 @@ def append(self, msg: str):
588596
elif self.host_ptr.status_obj:
589597
clean = msg.strip()
590598
if clean and not clean.startswith("["):
591-
if len(clean) < 100:
592-
self.host_ptr.status_obj.update(f"[cyan]BCASL: {clean}[/cyan]")
599+
display = clean
600+
if clean.startswith("Plugin: "):
601+
# Utilisation de markup Rich au lieu d'icônes
602+
plugin_name = clean[8:].strip()
603+
display = f"Plugin: [bold white]{plugin_name}[/bold white]"
604+
elif clean.startswith("Phase: "):
605+
phase_name = clean[7:].strip()
606+
display = f"Phase: [bold yellow]{phase_name}[/bold yellow]"
607+
608+
if len(display) < 120:
609+
self.host_ptr.status_obj.update(f"[cyan]BCASL[/cyan] [white]»[/white] {display}")
593610

594611
self.log = Logger(self)
595612

596613
host = CliBcaslHost(workspace, status)
597614

598-
if verbose:
599-
info(f"Running BCASL headless in {workspace}...")
615+
info(f"Running BCASL headless in {workspace}...")
600616

601617
# Register SIGINT handler
602618
_CLI_CANCEL_EVENT.clear()

bcasl/Loader.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ def _run_bcasl_sync(
325325
workspace_root, config=cfg, workspace_metadata=workspace_meta
326326
),
327327
stop_requested=stop_requested,
328+
log_cb=log_cb,
328329
)
329330

330331

bcasl/executor.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,10 @@ def load_plugins_from_directory(
849849
return count, errors
850850

851851
def run_pre_compile(
852-
self, ctx: Optional[PreCompileContext] = None, stop_requested=None
852+
self,
853+
ctx: Optional[PreCompileContext] = None,
854+
stop_requested: Optional[callable] = None,
855+
log_cb: Optional[callable] = None,
853856
) -> ExecutionReport:
854857
"""Execute le hook 'on_pre_compile' de tous les plugins actifs.
855858
@@ -874,6 +877,11 @@ def run_pre_compile(
874877
# 1. Identifier les plugins actifs
875878
active_items = {pid: rec for pid, rec in self._registry.items() if rec.active}
876879
if not active_items:
880+
if log_cb:
881+
try:
882+
log_cb("Aucun plugin BCASL actif")
883+
except Exception:
884+
pass
877885
_logger.info("Aucun plugin Bcasl actif")
878886
return report
879887

@@ -902,6 +910,11 @@ def run_pre_compile(
902910
continue
903911

904912
_logger.info("--- Phase: %s ---", pname)
913+
if log_cb:
914+
try:
915+
log_cb(f"Phase: {pname}")
916+
except Exception:
917+
pass
905918

906919
# Sous-ensemble d'items pour cette phase
907920
p_items = {pid: active_items[pid] for pid in p_ids}
@@ -913,6 +926,12 @@ def run_pre_compile(
913926
failed_seq: set[str] = set()
914927
for pid in order:
915928
rec = p_items[pid]
929+
if log_cb:
930+
try:
931+
log_cb(f"Plugin: {rec.plugin.meta.name}")
932+
except Exception:
933+
pass
934+
916935
if skip_dependents_on_failure:
917936
failed_dep = next(
918937
(d for d in rec.requires if d in failed_seq), None

0 commit comments

Comments
 (0)