dsh-launch-json
Verifieddsh-launch-json · v0.2.0 · MIT · Web UI
用于启动 launch.json 配置的项目。暂支持 Python 和 JavaScript 配置,依赖 dsh-better-sidebar 插件。
Install
dsh plugin add dsh-launch-json Confirm the layer applied with dsh --profile default --dump-config — see the install guide.
Source
Published to npm without a public repository. Inspect the package contents before installing.
Tags
Creators
Readme
dsh-launch-json
从项目的 .vscode/launch.json 启动项目——列出工作区的调试/启动配置,然后像
VSCode 调试器一样精确启动其中一项:解释器、程序、参数、环境变量与工作目录,
并支持后台运行常驻服务。
功能
插件向 dsh-better-sidebar 注册一个**「启动配置」tab**:
- 列出当前会话的 launch.json 配置及将执行的命令
- 点击直接启动,支持后台运行(带停止按钮与实时状态)
- 提供「打开 launch.json」动作在侧边栏编辑器中打开该文件
安装
# 从本仓库的 git checkout 安装(会执行 prepare 构建)
dsh plugin --profile <name> add github:you/dsh-launch-json
# 或从本地 checkout / tarball 安装
dsh plugin --profile <name> add ./dsh-launch-json
dsh plugin --profile <name> add ./dsh-launch-json-0.1.0.tgz
然后启动该 profile(dsh --profile <name>)。git 安装时 pnpm 可能要求你授权
prepare 构建脚本——allowBuilds 的写法见发布协议文档。
配置
插件接受 cordis.patch.yml 中的 config 块:
- insert:
- id: launch-json
name: dsh-launch-json
config:
launchJsonPath: '.vscode/launch.json' # 默认值;相对工作区根目录或绝对路径
配置解析规则
遵循常见场景下的 VSCode 启动约定:
node/pwa-node→node [runtimeArgs] <program> [args](设置了runtimeExecutable时优先)python→python <program> [args]go→go run <program> [args]chrome/pwa-chrome/msedge→ 需要runtimeExecutable(浏览器可执行文件)+url- 无
type→ 直接运行<program> [args] commandLine(少见)→ 原样执行
Python 调试配置
对于 Python 调试,Cursor/VSCode 使用 debugpy 来支持断点调试。launch.json 中可以使用以下配置:
{
"name": "Python: FastAPI (Debug)",
"type": "python",
"request": "launch",
"module": "uvicorn",
"args": ["app.main:app", "--reload", "--host", "0.0.0.0", "--port", "8000"],
"python": "${workspaceFolder}/.venv/bin/python",
"console": "integratedTerminal",
"justMyCode": false
}
关键配置项:
| 字段 | 说明 |
|---|---|
type: "python" |
Python 调试类型 |
module |
要运行的 Python 模块(如 uvicorn) |
args |
模块的参数 |
python |
Python 解释器路径(可选) |
justMyCode |
是否只调试自己的代码(可选) |
注意: 由于 DSH 的终端环境限制,当前版本使用简化的命令执行方式。如果需要断点调试功能,可以在 args 中添加调试参数或使用其他调试方案。
变量替换支持:${workspaceFolder} / ${workspaceRoot}、
${workspaceFolderBasename}、${userHome}、${cwd}、${execPath}、
${env:NAME};\${…} 转义为字面量 ${…}。无法解析的变量会原样保留。
request: "attach" 配置与 compounds 组合会被列出但无法启动。
安全说明
Harness 的 shell 服务在启动子进程前会清除凭据形态的环境变量(*KEY*、
*PASSWORD*、*SECRET*、*TOKEN*)与 DSH_* 变量,再合并配置中的 env
覆盖。若启动的项目需要 API key,请在配置的 env 中显式声明。
开发
npm install
npm run check # typecheck(服务端 + 客户端)+ 测试 + 构建
npm test # vitest
npm run build # tsc → lib/ + esbuild → lib/client.js(web tab 产物)
web tab 产物是面向客户端模块加载器的闭包工厂产物
(window.__ModuleLoader__.load({ id, factory }),外部依赖经注入的 require
解析),由 scripts/build-client.mjs 用 esbuild 构建,不依赖 harness 的构建管线。
兼容性
- 依赖 harness 的 web server(
@deepseek-ai/dsh-host-webserver,web profile 自带); headless profile 会直接跳过。 - 侧边栏 tab 需要 profile 中组合 dsh-better-sidebar ≥ 0.12。
- peer 依赖
@deepseek-ai/cordis、@deepseek-ai/dsh-shell—— 均由 dsh 安装本身提供。
License
MIT