feat(cli): manage workspace scripts (#1992)

* feat(cli): manage workspace scripts

* docs: document workspace script management

---------

Co-authored-by: Mohamed Boudra <boudra.moha@gmail.com>
This commit is contained in:
Matt Cowger
2026-07-24 21:12:14 +08:00
committed by GitHub
co-authored by Mohamed Boudra
parent 21597bdc1b
commit 21404fbdec
22 changed files with 800 additions and 55 deletions
@@ -622,6 +622,42 @@ describe("workspace message schemas", () => {
expect(parsed.payload.workspace.workspaceKind).toBe("directory");
});
test("parses workspace script management request and response payloads", () => {
expect(
SessionInboundMessageSchema.parse({
type: "workspace.script.stop.request",
requestId: "req-script-stop",
workspaceId: "ws-repo",
scriptName: "web",
}),
).toMatchObject({ type: "workspace.script.stop.request", scriptName: "web" });
expect(
SessionOutboundMessageSchema.parse({
type: "workspace.script.start.response",
payload: {
requestId: "req-script-start",
workspaceId: "ws-repo",
scriptName: "web",
script: {
scriptName: "web",
type: "service",
hostname: "web--repo.localhost",
port: 3000,
proxyUrl: "http://web--repo.localhost:6767",
lifecycle: "running",
health: "healthy",
terminalId: "terminal-1",
},
error: null,
},
}),
).toMatchObject({
type: "workspace.script.start.response",
payload: { script: { terminalId: "terminal-1", lifecycle: "running" } },
});
});
test("parses script_status_update payload", () => {
const parsed = SessionOutboundMessageSchema.parse({
type: "script_status_update",