dsh-run: Running an npm Script in the DeepSeek Harness Session Header

In local development environments, it is a common practice to frequently open multiple terminal windows to run different npm scripts. DeepSeek Harness provides a plugin mechanism to extend functionality, and the dsh-run plugin is designed specifically for this purpose: it allows invoking workspace npm scripts directly from the session header, avoiding the need to switch windows.

Features

This plugin adds a composite button to the session header (next to the “Open in…” button) for controlling workspace npm scripts.

  1. Reading & Display
    Reads the workspace’s package.json. The button only appears if the workspace contains a package.json with defined scripts.

  2. Composite Button Interaction

    • Play Icon (▶): Click to run the default script.
    • Arrow Icon (▾): Click to expand a list showing all npm run scripts; select one to execute it and set it as the new default script.
  3. Default Script Logic
    The default script is selected based on the following priority:

    • dev
    • start
    • The first declared script
  4. Runtime State

    • When running, the button changes to a stop icon; clicking it again terminates the process group (including npm and its child processes).
    • If the script fails, the button turns red and displays an error message.
  5. Persistence
    The default script selection for each project is saved in the browser’s localStorage.

Installation & Activation

Install the plugin using the following command:

dsh plugin --profile web add github:albertgranados/dsh-run

After installation, restart the Harness and refresh the browser page.

Notes

  • Dependency Requirement: The button only displays if the workspace contains a package.json with scripts.
  • Permission Restrictions: Runs using the Harness subprocess service; process management is subject to Host/Origin restrictions.
  • Concurrency Limits: Supports up to 8 concurrent executions, with an in-memory queue limit of 32 KiB and a disk spill limit of 4 MiB.
  • Configuration Simplification: The plugin declares dsh.bundle.patch, automatically handling configuration. Manual editing of package.json or cordis.patch.yml is not required.

Summary

The dsh-run plugin simplifies the development workflow by integrating npm script execution capabilities into the session header. It provides intuitive button interactions and basic process management, making it suitable for workflows that require frequent running of builds or development servers.

GitHub: albertgranados/dsh-run

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye