npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

dsh-command-md

v0.1.0

Published

File-driven slash commands for DSH: markdown command files become /commands, opencode-style

Readme

dsh-command-md

文件驱动的全局斜杠命令插件,为 DeepSeek Harness 提供 opencode 风格的 /xxx 快捷指令:

在用户命令目录(~/.dsh/commands/)放一个 Markdown 文件,文件名就是命令名,文件正文就是命令内容。执行 /命令名 时,插件读取文件正文并作为新的用户消息注入当前对话,模型随即开始处理。

命令是全局的:插件启动时注册一次,在任何会话、任何工作区都可用,不区分工作区(如果你需要按工作区区分的项目级命令,本插件不做——那是另一套机制)。

命令文件格式

放在 ~/.dsh/commands/ 下,例如 ~/.dsh/commands/review.md:

---
description: 让模型审查当前工作区的改动
input-hint: 可选提示
---

请审查当前工作区的代码改动,重点关注:
1. 潜在 bug
2. 安全问题

$ARGUMENTS
  • 文件名:review.md → 命令 /review。只接受 ^[a-z][a-z0-9_-]*$(小写字母、数字、_、-)。
  • frontmatter:--- 包裹的 key: value 对。description 用于命令菜单展示(缺省时用 Run the <name> command);input-hint 可选,展示为输入占位符。其余键忽略。
  • 正文:--- 之后的全部内容(首尾空行会被修剪)。$ARGUMENTS 会被替换为用户在命令后输入的参数(去首尾空白)。

执行 /review 重点看安全 时,注入的消息为:

请审查当前工作区的代码改动,重点关注:
1. 潜在 bug
2. 安全问题

重点看安全

安装

从 npm 安装(推荐)

# 在 dsh web profile 中安装
dsh plugin --profile web add dsh-command-md

安装完成后重启 dsh web 即生效。

本插件的挂载由 profile 的 cordis.patch.yml 完成(插入 command-md loader 行),npm 安装后该 loader 行会按包名解析到 registry 版本,无需额外配置。

从本地源码安装(开发调试)

  1. 把插件目录放到你喜欢的位置(当前位于 D:\zxh\deepseek\dsh-command-md)。
  2. 在 ~/.dsh/profiles/web/package.json 的 dependencies 中加入:
    "dsh-command-md": "link:D:/zxh/deepseek/dsh-command-md"
    link: 是 pnpm 的本地目录引用:不拷贝代码,只建一个指向该目录的链接,改插件代码后重启 dsh 即生效。注意:link: 指向绝对路径,换电脑后需把插件目录拷贝过去并更新此路径;要可移植请改用 npm 发布(见下文)。
  3. 在 ~/.dsh/profiles/web/cordis.patch.yml 的 insert 列表追加(与现有 MCP 插件同级):
    - id: command-md
      name: 'dsh-command-md'
      # 可选配置:
      # config:
      #   dshHome: '~/.dsh'      # 用户命令目录的 DSH home(默认 ~/.dsh)
      #   maxBytes: 1048576      # 单文件大小上限
  4. 安装依赖并重启:
    cd ~/.dsh/profiles/web && pnpm install
    然后重启 dsh web。

换电脑 / 可移植性

  • 本地 link(开发方式):配置不随电脑走——每台机器需要 git clone 插件到同一路径(或改 link 路径)后再 pnpm install。
  • 发布 npm:npm version patch && npm publish 推到 registry 后,任何机器 dsh plugin --profile web add dsh-command-md 即装,更新用 dsh plugin --profile web update dsh-command-md。适合插件功能稳定后迁移。

配置

| 字段 | 默认 | 说明 | |---|---|---| | dshHome | ~/.dsh | DSH 主目录,用于推导用户命令目录 | | userDir | <dshHome>/commands | 用户命令目录(全局生效) | | maxBytes | 1048576 | 单个命令文件大小上限(字节) |

开发

node test/parse.test.mjs        # 单元测试(零依赖)
# 集成测试需要能解析 @deepseek-ai/dsh-llm,可临时建 junction:
# New-Item -ItemType Junction -Path node_modules -Target C:\Users\<you>\.dsh\profiles\node_modules
node test/integration.mjs

纯解析逻辑位于 lib/parse.js(零运行时依赖),插件入口位于 lib/index.js。

限制

  • 命令名不支持路径嵌套(commands/foo/bar.md 不会生成 /foo/bar);请使用 foo-bar.md 风格。
  • 每次执行都重新读文件,因此新增/删除命令文件需要重启(或 HMR)后才出现在命令菜单中;修改已存在文件的内容则立即生效。
  • frontmatter 只解析标量键值对,不支持 YAML 列表/嵌套对象。
  • 命令是全局的,不区分工作区;如需项目级命令请另行设计。