Skip to content

Run commands: open a URL in the default browser after command completes #55

@AThraen

Description

@AThraen

This was generated by AI during triage.

Summary

Add an optional post-run URL field to RunCommandItem. When set and the command exits with code 0, CodeShellManager opens the URL in the user's default browser automatically.

Motivation

A very common dev workflow is: run a build/dev-server command → wait for it to be ready → open http://localhost:5173 (or similar). Today the user has to manually switch to a browser after the run completes. Automating this mirrors what IDEs like Rider and VS Code do with "open browser on start".

Useful examples:

  • dotnet run → open http://localhost:5000
  • npm run dev → open http://localhost:5173
  • mkdocs serve → open http://localhost:8000
  • A deploy script → open a staging URL

Proposed behaviour

Data model

Add PostRunUrl: string? to RunCommandItem. null / empty = no browser launch (default, backwards-compatible).

Runtime

After a run completes (exit code 0 only, unless a future option adds "open even on failure"):

  1. If PostRunUrl is set and non-empty, call Process.Start(new ProcessStartInfo(url) { UseShellExecute = true }) to hand it to the OS default browser.
  2. Show a brief toast: "Opened [url] in browser".
  3. If the process fails to launch, show a warning toast instead of silently failing.

Editor UI (SessionRunCommandsDialog)

  • Add an optional "Open URL" text field below (or beside) the command-line field for each row.
  • Placeholder text: https://localhost:5000 or similar.
  • No URL validation beyond "non-empty string" — the OS will handle invalid URLs.

Persistence

PostRunUrl serialises to state.json alongside other RunCommandItem fields.

Out of scope

  • Waiting for the server to be ready before opening (health-check polling). That is a separate, more complex feature.
  • Opening a URL on non-zero exit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions