fix(debugger): extract MarteController into an importable controller package

Client/debugger was entirely package main, which Go forbids importing from
another module ("is a program, not an importable package") -- discovered
while wiring the new debugclient E2E tool against NewHeadlessMarteController.
Move martecontrol.go and its test into a new marte2debugger/controller
subpackage (package controller) and update Client/debugger/main.go to call
controller.NewMarteController/controller.DangerousCommandsEnabled. No
behavioral change to the browser-facing server.
This commit is contained in:
Martino Ferrari
2026-07-01 19:18:08 +02:00
parent 269b2c4d97
commit f0f83110a4
3 changed files with 14 additions and 7 deletions
+4 -2
View File
@@ -10,6 +10,8 @@ import (
"net/http"
"os"
"marte2debugger/controller"
"marte2/common/wshub"
)
@@ -21,7 +23,7 @@ var staticFiles embed.FS
func main() {
addr := flag.String("addr", ":7777", "HTTP listen address")
sourcesFile := flag.String("sources-file", "", "JSON file for persistent source list")
flag.BoolVar(&dangerousCommandsEnabled, "enable-dangerous-commands", false,
flag.BoolVar(&controller.DangerousCommandsEnabled, "enable-dangerous-commands", false,
"Allow FORCE/PAUSE/RESUME/STEP/BREAK/MSG commands from the browser (CR-4 safety gate)")
flag.Parse()
@@ -29,7 +31,7 @@ func main() {
sm := wshub.NewSourceManager(hub, *sourcesFile)
hub.SetSourceManager(sm)
ctrl := NewMarteController(hub)
ctrl := controller.NewMarteController(hub)
go hub.Run()