Skip to content

Commit 66a1739

Browse files
committed
feat(cli): brancher la commande prog-engine et le lanceur dédié
1 parent eae9a5c commit 66a1739

4 files changed

Lines changed: 54 additions & 0 deletions

File tree

cli/click_app.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
launch_bcasl_gui,
5151
launch_engines_gui,
5252
launch_main_gui,
53+
launch_prog_engine_gui,
5354
unload_all_engines,
5455
)
5556
from .output import error, info, plain, success, warn
@@ -280,6 +281,7 @@ def cli(
280281
plain("\nCommand Groups:")
281282
plain(" gui Launch graphical interfaces")
282283
plain(" engine Inspect and run engines headlessly")
284+
plain(" prog-engine Launch Engines GUI focused on one engine")
283285
plain(" bcasl BCASL plugin actions")
284286
plain(" workspace Inspect workspace state")
285287
plain(" doctor Global diagnostics")
@@ -334,6 +336,18 @@ def gui_engines(workspace):
334336
)
335337
)
336338

339+
@cli.command("prog-engine")
340+
@click.argument("engine_id")
341+
@click.argument("workspace", required=False, type=click.Path(exists=False))
342+
def prog_engine_cmd(engine_id, workspace):
343+
"""Launch dedicated single-engine config GUI with live JSON editor."""
344+
sys.exit(
345+
launch_prog_engine_gui(
346+
engine_id=engine_id,
347+
workspace_dir=_ensure_workspace_exists(_resolve_workspace_path(workspace)),
348+
)
349+
)
350+
337351
# Commandes moteur headless et d'inspection.
338352
@cli.group()
339353
def engine():

cli/fallback.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
launch_bcasl_gui,
2828
launch_engines_gui,
2929
launch_main_gui,
30+
launch_prog_engine_gui,
3031
unload_all_engines,
3132
)
3233
from .output import error, info, plain
@@ -48,6 +49,7 @@
4849
python -m pycompiler_ark bcasl /path/to/ws # Launch BCASL with workspace
4950
python -m pycompiler_ark engines # Launch Engines standalone GUI
5051
python -m pycompiler_ark engines --dry-run # List available engines
52+
python -m pycompiler_ark prog-engine <engine_id> [workspace] # Launch focused engine GUI
5153
python -m pycompiler_ark unload # Unload all engines
5254
python -m pycompiler_ark check [workspace] # CI/CD strict checks
5355
python -m pycompiler_ark init [workspace] # Init workspace config
@@ -139,6 +141,13 @@ def run(argv: list[str] | None, app_version: str) -> int:
139141
return launch_bcasl_gui(normalize_path(first_positional(rest)))
140142
if cmd == "engines":
141143
return _run_engines(rest)
144+
if cmd == "prog-engine":
145+
if not rest:
146+
error("Usage: prog-engine <engine_id> [workspace]")
147+
return EXIT_USAGE_ERROR
148+
engine_id = rest[0]
149+
workspace = normalize_path(first_positional(rest[1:]))
150+
return launch_prog_engine_gui(engine_id=engine_id, workspace_dir=workspace)
142151
if cmd == "check":
143152
return run_check(rest)
144153
if cmd == "init":

cli/launchers.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,31 @@ def launch_engines_only_standalone(workspace_dir: Optional[str] = None) -> int:
111111
return 1
112112

113113

114+
def launch_prog_engine_standalone(
115+
engine_id: str, workspace_dir: Optional[str] = None
116+
) -> int:
117+
try:
118+
from OnlyMod.EngineOnlyMod.gui import launch_prog_engine_gui
119+
120+
if workspace_dir:
121+
try:
122+
workspace_dir = str(Path(workspace_dir).expanduser())
123+
except Exception:
124+
pass
125+
126+
return launch_prog_engine_gui(
127+
engine_id=str(engine_id),
128+
workspace_dir=workspace_dir,
129+
)
130+
except ImportError as exc:
131+
error(f"Failed to import Prog Engine GUI module: {exc}")
132+
warn("Make sure OnlyMod.EngineOnlyMod is properly installed.")
133+
return 1
134+
except Exception as exc:
135+
error(f"Failed to launch Prog Engine GUI: {exc}")
136+
return 1
137+
138+
114139
def launch_main_application(
115140
no_splash: bool = False, ide_gui: bool = False, classic_gui: bool = False
116141
) -> int:

cli/lazy_ops.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ def launch_engines_gui(workspace_dir: str | None = None) -> int:
2828
return launch_engines_only_standalone(workspace_dir)
2929

3030

31+
def launch_prog_engine_gui(engine_id: str, workspace_dir: str | None = None) -> int:
32+
from .launchers import launch_prog_engine_standalone
33+
34+
return launch_prog_engine_standalone(engine_id, workspace_dir)
35+
36+
3137
def launch_main_gui(
3238
no_splash: bool = False, ide_gui: bool = False, classic_gui: bool = False
3339
) -> int:

0 commit comments

Comments
 (0)