Jesse-njx/dsh-plugin-manager--packages-cli0

@dsh-pm/cli

@dsh-pm/cli — the `dsh pm` command group: search, install, remove, list, update, and doctor for dsh plugins, wiring the registry, installer, and core contract together

AI 分析

核心用途是为 DSH 提供一键式插件生命周期管理命令行工具。适合需要频繁搜索、安装、更新和诊断 DSH 插件的用户。支持 Web UI 斜杠命令。

パッケージ
@dsh-pm/cli
バージョン
0.1.0
最終更新
2026/08/14

インストール

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:Jesse-njx/dsh-plugin-manager#2da969ab638d8cef21e592e7a3159c6b784ae46b&path:packages/cli

ドキュメント

README 全文を読む ↗

dsh pm — the plugin manager DSH should have shipped with

dsh pm is the command group for DeepSeek Harness that closes the discovery → install → manage loop around the official dsh plugin flow: search the awesome list / GitHub topic / npm keyword, install from npm or GitHub with one command, list what's installed per profile, check for updates, and audit everything with doctor.

It is deliberately a thin, honest layer over the documented install mechanism: it never hand-edits a profile's cordis.yml. It drives dsh plugin --profile add|remove through the installer and records its own side-band state (a plain JSON file), so it can list, update, and audit — and if the official flow changes, one adapter changes, not four packages.

dsh pm search memory     →  discover
dsh pm install dsh-memory →  install into the configured profiles
dsh pm list               →  what pm installed, per profile
dsh pm update dsh-memory  →  reinstall if a newer version exists
dsh pm doctor             →  audit manifests, patches, sources, drift

Install

This package is the pm command group itself. Install it into the profile you run dsh pm … from:

dsh plugin --profile default add @dsh-pm/cli          # npm (when published)
dsh plugin --profile default add github:Jesse-njx/dsh-plugin-manager  # or: from the monorepo

Then invoke it:

dsh --profile default pm search memory
dsh --profile default pm install dsh-memory

The bundle patch also registers pm as a web-UI slash command (/pm search memory), so it works from the chat input as well.

Config

The config block is the PmConfig shape (spec §5.1), validated by the schemastery schema exported as Config. All fields have defaults; the block below shows the documented values:

# in the profile's cordis.patch.yml
- id: dsh-plugin-manager
  config:
    registry:
      awesomeUrl: https://raw.githubusercontent.com/awesome-dsh-plugin/awesome-dsh-plugin/main/README.md
      npmKeyword: dsh
    profiles: [default]        # which profiles install targets go into
    stateFile: ~/.dsh/pm/plugins.json
    gitInstall: { depth: 1, build: true }
FieldDefaultMeaning
registry.awesomeUrlthe awesome-dsh-plugin README URLdiscovery source 1
registry.npmKeyworddshnpm keyword search term
profiles['default']target profiles for install
stateFile~/.dsh/pm/plugins.jsonpm's own side-band state
gitInstall.depth / build1 / truepassed to the installer for GitHub refs

Commands

CommandBehavior
dsh pm search search the merged registry; table of name, source, stars, category, description
dsh pm install resolve and install into the configured profiles; prints resulting rows
dsh pm remove uninstall from every profile the state mentions
dsh pm liststate rows grouped per profile: version, source, enabled, last checked
dsh pm update [name|all]check latest (npm dist-tag or GitHub HEAD); reinstall when newer
dsh pm doctorread-only audit; exits non-zero when any finding is an error

Doctor

dsh pm doctor audits every installed plugin:

  • (a) the manifest still parses (ManifestParser),
  • (b) its dsh.bundle.patch file resolves on disk,
  • (c) its repo/npm source is still reachable,
  • (d) version drift (installed vs latest),
  • (e) duplicates / conflicting entries across profiles,
  • (f) unmanaged plugins present in a profile but absent from the state store,
  • (g) registry reachability overall.

Doctor is read-only: it reports ok / warn / error findings with a one-line fix hint and tells you the exact dsh pm command to run — it never repairs.

How it works

dsh pm install 
  → @dsh-pm/installer resolves the source (npm / github / registry)
  → run seam shells: dsh plugin --profile 
 add 
  → @dsh-pm/core StateStore records the row (atomic temp+rename JSON)
dsh pm list
  → installer.list() reads the state store

@dsh-pm/cli is the only package that imports all three siblings (core, registry, installer); it wires them together per the frozen cross-package contract in spec §5.

Development

pnpm install
pnpm --filter @dsh-pm/cli build      # tsc → lib/
pnpm --filter @dsh-pm/cli typecheck  # tsc --noEmit (src + tests)
pnpm --filter @dsh-pm/cli test       # node --test test/*.test.ts

Unit tests cover command registration on a real Cordis ctx.commands (register/dispose restores the stock surface), output-rendering goldens, and doctor exit-code behavior over fake store + registry. The cross-package flow (real installer + real dsh CLI against a temp DSH_HOME) lives in the integration-test package.

License

MIT