@@ -1664,6 +1664,18 @@ def export_cmd( |
| 1664 | 1664 | bool, |
| 1665 | 1665 | typer.Option("--verbose", help="Log each subprocess command as it launches."), |
| 1666 | 1666 | ] = False, |
| 1667 | + emit_sway_json: Annotated[ |
| 1668 | + bool, |
| 1669 | + typer.Option( |
| 1670 | + "--emit-sway-json", |
| 1671 | + help=( |
| 1672 | + "After the export, also write a ready-to-run sway.yaml " |
| 1673 | + "(via dlm-sway autogen) into the export dir. Requires the " |
| 1674 | + "[sway] extra: pip install 'dlm[sway]'. Closes the " |
| 1675 | + "training-then-evaluating gap from sway Sprint 26 X1." |
| 1676 | + ), |
| 1677 | + ), |
| 1678 | + ] = False, |
| 1667 | 1679 | ) -> None: |
| 1668 | 1680 | """Export the adapter to a runtime target.""" |
| 1669 | 1681 | |
@@ -2147,6 +2159,20 @@ def export_cmd( |
| 2147 | 2159 | console.print(f"[green]exported:[/green] {result.export_dir}{cached_tag}") |
| 2148 | 2160 | for artifact in result.artifacts: |
| 2149 | 2161 | console.print(f" {artifact.name}") |
| 2162 | + |
| 2163 | + # S26 X1 — also emit a sway.yaml next to the GGUF when the user |
| 2164 | + # asks for it. Done AFTER the regular export so a sway-side |
| 2165 | + # failure can never roll back a working GGUF deployment. |
| 2166 | + if emit_sway_json: |
| 2167 | + from dlm.export.sway_json import SwayJsonExportError, write_sway_json |
| 2168 | + |
| 2169 | + try: |
| 2170 | + sway_yaml_path = write_sway_json(path, result.export_dir) |
| 2171 | + except SwayJsonExportError as exc: |
| 2172 | + console.print(f"[red]sway-json:[/red] {exc}") |
| 2173 | + raise typer.Exit(code=1) from exc |
| 2174 | + console.print(f"[green]sway.yaml:[/green] {sway_yaml_path}") |
| 2175 | + console.print(" next: sway run " + str(sway_yaml_path)) |
| 2150 | 2176 | if resolved_target.name == "llama-server": |
| 2151 | 2177 | assert llama_server_result.launch_script_path is not None |
| 2152 | 2178 | assert llama_server_result.config_path is not None |