Introduction

DSH is currently in developer preview, and official documentation explicitly states that breaking changes may occur. During development and debugging, checking command execution progress usually requires pausing the conversation. The dsh-cmdwatch plugin solves this problem through a real-time streaming mechanism, allowing the panel to display the execution output of foreground commands and background tasks in real time.

Plugin Positioning

dsh-cmdwatch is a client plugin maintained by GavinQiEr under the MIT license. It provides a “Command Watch” panel for the dsh web profile, supporting real-time output display for foreground commands and background tasks.

Installation and Enablement

After installation, restart the web profile (dsh web), and a “Command Watch” panel will appear above the input field.

  1. Run the installation command recommended by the official documentation:
dsh plugin --profile web add github:GavinQiEr/dsh-cmdwatch

If dsh is not in your PATH, you can use npx '@deepseek-ai/dsh' plugin --profile web add github:GavinQiEr/dsh-cmdwatch instead.

  1. After installation is complete, restart the web profile to apply the changes.

Core Features

The plugin primarily provides the following capabilities:

  • Real-time background task progress: After enabling run_in_background: true, the command line, progress, status, and time are displayed with line-by-line scrolling.
  • Real-time foreground command streaming: Once a command is issued, it immediately appears in the panel and streams in real time during execution.
  • Session isolation: Panels for different sessions display their own commands separately, without interfering with one another.
  • Automatic scrolling: The output area automatically scrolls to the latest line.
  • Long command abbreviation: Overly long commands are compressed for display (first 60% + … + last 40%), and hovering reveals the full text.
  • Command sanitization: Automatically detects and inserts Tee and PYTHONUNBUFFERED, ensuring real-time output display while preserving the original pipeline semantics (for example, Select-Object -Last or tail still returns only the last N lines).

Typical Usage

  • Foreground command: The plugin automatically inserts Tee to capture output.
    python -m pytest tests/... -q
  • Background task: Set the execution mode.
    run_in_background: true
  • Disable automatic rewriting: If you do not want the plugin to wrap the command, configure the option.
    config: { rewrite: false }

Configuration

Add the config option to the plugin line in cordis.patch.yml.

Option Default Description
rewrite true Whether to insert Tee for real-time output when a background command contains collection or redirection segments
pythonUnbuffered true Whether to inject PYTHONUNBUFFERED when Python is detected
foregroundStream true Whether to insert Tee for foreground commands to persist output and display it in real time
warn true Whether to display a warning for pipelines that cannot be processed (such as -First)
debug false Whether to output [cmdmon] diagnostic logs to the host terminal

Notes

  • Output stream conflict: When the real-time stream is enabled, incremental output from background tasks is consumed by the plugin, and the dsh job_output tool reads an empty increment ((no new output)). If dsh needs to read the output itself, disable the “real-time stream” on the panel first.
  • Non-persistent logs: Records are stored in the host process memory and are cleared after the process restarts.
  • Background task display: A background task displays two records: one is the tool call line (labeled “tool”), and the other is the task line (labeled “task”). Real-time output appears only in the task line.
  • Log files: Log files are located in the workspace or temporary directory, and the file name is typically .cmdmon-<callId>.log.