Skip to content

dor ensure: add --restart to interrupt and re-run a matching surface#158

Open
nedtwigg wants to merge 2 commits into
mainfrom
ensure-fixup
Open

dor ensure: add --restart to interrupt and re-run a matching surface#158
nedtwigg wants to merge 2 commits into
mainfrom
ensure-fixup

Conversation

@nedtwigg

Copy link
Copy Markdown
Member

Summary

Adds a --restart flag to dor ensure. When a surface is already running the target command, --restart interrupts it (Ctrl+C), waits for the shell to return to its prompt, re-runs the command in place, and blocks until it's live again. If no surface matches, it behaves like a plain ensure and creates one.

  • --restart drives the live PTY directly, so it works for minimized doors too (their PTY keeps running). A restarted surface keeps its minimized/visible state.
  • The host blocks while interrupting/respawning, so the client request timeout is bumped to 60s for this one command; everything else keeps the snappy default.
  • Restart progress is tracked by polling the integration-derived terminal state (currentCommand clears on prompt, then reports the command live again) rather than guessing at timings.
  • New restarted status surfaces in text and JSON output, with help text and snapshots updated.

Test plan

  • dor/test/cli-output.test.mjs covers --restart plumbing (sends restart: true, renders restarted surface:3).
  • Help snapshots regenerated for the new flag.
  • tsc --noEmit passes in lib.

🤖 Generated with Claude Code

nedtwigg and others added 2 commits June 19, 2026 12:49
`dor ensure --restart -- <command>` now restarts a surface that is already
running the command instead of no-opping. The host interrupts the live
command (Ctrl+C), waits for the shell to return to its prompt, types the
command again, and waits for it to go live — driving the PTY directly so it
works for minimized doors too. The CLI blocks until the restart completes
(with a bumped 60s request timeout for that one command). With no matching
surface, --restart behaves like a plain ensure and creates one.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying mouseterm with  Cloudflare Pages  Cloudflare Pages

Latest commit: c9fdaad
Status: ✅  Deploy successful!
Preview URL: https://49a95b05.mouseterm.pages.dev
Branch Preview URL: https://ensure-fixup.mouseterm.pages.dev

View logs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants