Skip to main content
C

dsh-service-check

cndoin/dsh-service-check

Validates a DSH plugin bundle before install: manifest, patch, locale and icon metadata, and whether the injected Host Services and the methods called on them actually exist.

Install

dsh plugin --profile web add github:cndoin/dsh-service-check

README

dsh-service-check

Node License Dependencies

Scaffold and validate DeepSeek Harness (DSH) plugins, and check that the Services a plugin injects actually exist.

DSH has no official plugin marketplace, and community plugin sources disagree on metadata. That makes the boring parts expensive: what exactly goes in package.json, which Loader operations a patch may contain, what makes Plugin Manager show a title instead of a package name. dsh-service-check generates a bundle that already satisfies those rules, then checks the result before you install it.

The part nothing else does: a plugin that declares export const inject = ['tools'] and then calls ctx.tools.registr() loads cleanly and fails at the call site. This tool checks both the injected name and the method against a catalog captured from a running Harness, so the typo surfaces here instead of in production.

Zero dependencies. Node 20+. Nothing to build.

The mistake this catches

This is the one that costs an afternoon:

export const inject = ['tools']

export function apply(ctx) {
  ctx.tools.registr({ /* ... */ })
  //         ^^^^^^^ loads fine, throws here, at runtime, in front of a user
}

ctx.tools.registr() is not a method. The plugin installs, the Host starts, the patch applies, and nothing complains until that line runs. doctor compares every ctx.<service>.<method>() against a catalog of 109 Host Services captured from a running Harness, so the typo is reported before you ever install it:

$ dsh-service-check doctor broken-demo

broken-demo
  ⚠ meta/locale-export  no "./locale/*.json" export
      Plugin Manager reads meta.title and meta.description from exported locale files.
  ⚠ service/unknown-method  ctx.tools.registr() is not a method the catalog records for "tools"
      Recorded methods: register, restrict, get, executable, async resolve, definitions, schemas, setExecutor, …. A typo here fails only when the line runs.

  2 warnings

Nothing else does this check. A linter cannot: the method name is a string the Host resolves at runtime.

Why the rest is also worth checking

A DSH bundle is a package whose package.json declares dsh.bundle.patch, plus a Cordis YAML patch that inserts plugin rows. A misplaced key fails silently at install time, and metadata mistakes surface as a package name where a title belongs — both cheap to check and annoying to debug.

Install

Run it without installing anything. npm resolves a git spec directly, so this works from an empty directory:

npx github:cndoin/dsh-service-check doctor ../my-plugin

Verified from nothing but a clean working directory: npx github:cndoin/dsh-service-check new demo --kind tool creates the bundle and ... doctor demo reports ✔ demo: no problems found.

Below, dsh-service-check stands for whichever form you chose — the same subcommand and flags work in all of them.

As a DSH plugin — from the Plugin Manager, or with any spec pnpm accepts. The installer understands git specs directly, so no npm publication is needed:

github:cndoin/dsh-service-check#v0.28.0

Pin a tag rather than tracking main, so the tool you check with does not change under you. The tag is bumped with every release; v0.19.3 is the current one.

Verified by installing it that way: the installed tree contains index.js, cordis.patch.yml, icon.svg and locale/en.json, and import('dsh-service-check') resolves to apply, inject, name. (Note the bare specifier — the exports map does not expose /index.js as a subpath, so dsh-service-check/index.js fails with ERR_PACKAGE_PATH_NOT_EXPORTED.)

As a local clone — for reading the source or hacking on the check itself. There is nothing to build:

git clone https://github.com/cndoin/dsh-service-check
cd dsh-service-check
npx . doctor ../my-plugin       # or: node bin/dsh-service-check.js doctor ../my-plugin

To get a dsh-service-check command on your PATH, link the clone once:

cd dsh-service-check && npm link     # provides the dsh-service-check and dsc commands

One caveat up front: this is not published to npm, so a bare npx dsh-service-check will not work — the name is free on the registry but unclaimed. The github: form above does, because npm installs from the repository instead. The reason for the registry gap is in Notes; none of it affects using the tool.

Zero dependencies, so npm install is a no-op; there is nothing to build.

Commands

dsh-service-check new <dir>

Generates a bundle whose patch, manifest, locale file and icon already match what DSH reads.

FlagMeaning
--kind hostHost plugin. Registers Services or Event listeners. No browser half.
--kind toolAdds one callable agent tool, with a Config schema.
--kind uiAdds a client half that registers into the conversation.composer.dock Slot.
--template <name>Start from a ready-made bundle instead of the bare skeleton.
--name <pkg>Package name. Defaults to the directory name.
--description <text>Written to the manifest and to meta.description.
--forceWrite into a directory that already exists.

Templates

--template picks a starting point. Each one is a real, installable bundle, not a stub.

TemplateKindWhat you get
themehostRegisters CSS custom properties (--dsh-accent, --dsh-radius) with a Config schema, and removes them on unload.
mcphostWraps an MCP server behind a Config schema (command, args, transport, url). Inert until configured.
tooltoolOne callable agent tool with a validated parameter schema.
decorationuiA small element rendered into the composer dock.
dsh-service-check new my-theme --template theme --name my-theme
dsh-service-check doctor my-theme

The generated tree:

my-plugin/
├── package.json          dsh.bundle.patch + dsh.client (ui only)
├── cordis.patch.yml      - insert: [{ id, name }]
├── index.js              export function apply(ctx, config)
├── client.js             ui only: window.__ModuleLoader__.load(...)
├── locale/en.json        meta.title / meta.description
├── icon.svg
├── README.md
└── LICENSE

dsh-service-check doctor [dir]

Walks dir (default .), finds every package that declares dsh.bundle, and reports problems. Exits non-zero when any bundle has an error, so it works as a CI gate.

Add --strict to fail on warnings too. That matters more than it sounds: the typo this tool exists to catch — ctx.tools.registr() — is a warning, because the plugin does load and fails only when that line runs. A CI job using plain doctor passes it. Use --strict when "it loads" is not the bar you want.

$ dsh-service-check doctor .

Bad_Bundle
  ✖ row/name-shape  row name "./local-path", not a package specifier
  ✖ row/id-duplicate  row id "bad-row" appears more than once
  ⚠ manifest/name  name "Bad_Bundle" is not a conventional package name
  ⚠ meta/locale-export  no "./locale/*.json" export

  3 errors, 2 warnings
FlagMeaning
--jsonMachine-readable report, for CI and editors.
--quietPrint nothing; rely on the exit code.
--remote <url>Check a repository without cloning it first.

dsh-service-check doctor --remote <url>

Checks a repository you have not cloned. A catalogue lists plugins by URL; this answers "is that entry actually installable?" with one command:

$ dsh-service-check doctor --remote https://github.com/buhuikongpan/dsh-pluginmanager

Checking https://github.com/buhuikongpan/dsh-pluginmanager
dsh-pluginmanager
  ⚠ service/inject-missing  ctx.tools is used but not listed in inject

  1 warning, 1 info

A /tree/<ref>/<path> URL checks only that subdirectory, which is what you want for a monorepo package:

$ dsh-service-check doctor --remote https://github.com/zhiyuanvision-lang/InkMap/tree/main/packages/harness

It shallow-clones into a temporary directory and removes it afterwards, including when the clone fails. What it will not do: --fix needs to edit files, and edits to a throwaway clone would be discarded, so the two flags are refused together. The URL is checked before it reaches git, so a path or an option such as --upload-pack=… is rejected rather than passed through, and a subpath cannot resolve outside the clone.

Checking a bundle the way the Host does

doctor reads a bundle statically. scripts/host-check.mjs runs it: import the module, call apply(), capture what ctx.tools.register() receives, and validate each definition against the Host's own schema validator.

npm run host-check -- ../my-plugin

The difference is not academic. doctor passed a scaffolded bundle whose tool registered a property map where the request builder needs a schema document — the manifest, patch and locale were all correct, and the defect was inside the definition the module builds at runtime. Nothing static can see that.

It needs a profile to borrow @deepseek-ai/dsh-tools from; set DSH_PROFILE_NODE_MODULES if yours is not in the default place.

A bundle that declares ./client has a second half, which is not an ES module — it calls window.__ModuleLoader__.load({ id, factory }). That is checked separately:

npm run client-check -- ../my-plugin

It supplies the globals the file expects, runs the factory, and calls apply() against a recording ctx.slots. It reports the module id it registers under, the inject list, and the slot names apply() touches. It does not render anything, so it cannot tell you the decoration looks right — only that the file parses, registers, and hands back an apply that runs.

Auditing a list of repositories

scripts/audit.mjs runs doctor --remote over a file of URLs and summarises the result. A catalogue maintainer can answer "which of these entries are actually installable?" without cloning anything by hand:

npm run audit -- list.txt --json out.json

list.txt is one URL per line, optionally followed by a tab and a label.

Run against a random sample of 100 entries from the public DSH catalogue:

checked        100
no errors      97
with errors    3
crashed        0
clone failed   2
not a bundle   0

error rules:
  tool/parameters-shape        3

All three were confirmed by reading the source: each writes parameters as a JSON Schema document, which the Host rejects at load. Zero false positives and zero crashes across the sample.

Exit codes follow the same rule as doctor: 0 clean, 1 found problems, 2 could not run, and 3 when this tool itself crashed — a crash is a bug here, not a finding about the code under test.

dsh-service-check templates

Lists the available templates with the kind each one produces.

dsh-service-check doctor [dir] --fix

Repairs the mechanical problems, then re-reports. The rule it follows: touch declarations, never logic. A fix may add a missing manifest field, fill in display metadata, or drop a meta.detail that points nowhere. It will not edit a plugin entry module or a patch, because both change what actually loads — those come back as manual with the reason.

$ dsh-service-check doctor ./my-plugin --fix
my-plugin
  fixed  package.json: set "type": "module"
  fixed  package.json: added exports["./locale/*.json"]
  fixed  icon.svg: wrote a placeholder icon
  fixed  locale/en.json: set meta.title to "My plugin"
  manual index.js: Service usage needs a source edit, so it is left to the author

✔ my-plugin: no problems found

It iterates, because repairing one problem can expose the next: adding the locale export is what makes a broken meta.detail reachable. It stops after five passes.

Fixable ruleWhat the fix does
manifest/typeadds "type": "module"
meta/locale-exportexports ./locale/*.json
meta/locale-encreates locale/en.json
meta/titlefills meta.title from the package name
meta/descriptionfills meta.description from the package description
meta/iconexports ./icon and writes a placeholder icon
meta/detail-missingremoves a meta.detail that points at a missing file
meta/detail-escaperemoves a meta.detail that points outside the package

dsh-service-check init [dir]

Answers "which Services does this package need?" from the catalog, before you write a line of apply. It reads the package name and description, matches them against the 109 Host Services, and prints the inject line plus a sketch of the first recorded method for each match.

$ dsh-service-check init .
dsh-service-check in /repo/dsh-service-check
  catalog: 109 Host Services captured from DSH 0.2.1-rc.5 on 2026-12-01
  installed: 0.2.1-rc.5 (from ~/.dsh/profiles/desktop/node_modules/@deepseek-ai/dsh-brand)

This package may need:
  pluginManager      Manage profile files and apply their declared reload lifecycle.
                     matched because "plugin" appears in the name or description

Declare them:
  export const inject = ['pluginManager']

Sketch for apply:
  ctx.pluginManager.readBundleDetail(/* … */)  // Manage profile files, …

It is a hint generator, not an oracle. Every suggestion states why it matched, and the sketches use method names recorded in the catalog rather than invented ones. When nothing matches it says so instead of padding the list.

dsh-service-check services [query]

Browses the catalog. No argument lists all 109 with their descriptions and method names; a positional argument filters by Service name or description.

dsh-service-check services          # everything
dsh-service-check services tool     # 6 matches
dsh-service-check services --json   # machine readable

Use it in CI

The repository also ships a GitHub Action, so a plugin repository can refuse a broken bundle before anyone installs it. Because this project is not on npm, check the action out first and point uses: at that checkout:

- uses: actions/checkout@v4
- uses: actions/checkout@v4
  with:
    repository: cndoin/dsh-service-check
    path: .dsh-service-check
- uses: ./.dsh-service-check/action
  with:
    path: .

It writes a job summary table, annotates every diagnostic inline on the diff, and exposes errors and warnings as outputs:

InputDefaultMeaning
path.Directory to scan
fail-on-warningfalseTreat warnings as failures too
jsonfalseAlso print the machine-readable report

Checks the github.com/owner/repo links in a curated list and reports which ones no longer work. Written after finding 24 dead entries across five DSH awesome-lists, none of which re-check the entries already in them.

$ dsh-service-check links README.md
README.md
  354 repository link(s), 354 checked in 41.2s

Dead (8):
  ✖ Degurechaff57/dsh-openapi  HTTP 404
  ✖ JasonJin2006/dsh-sound-effects-plugin  HTTP 404
  ...

Archived (10):
  ! Qintsg/dsh-safe-delete
  ...

Suggested annotations:
  Degurechaff57/dsh-openapi  (仓库已删除,链接失效)
  Qintsg/dsh-safe-delete  (已归档)

The classification is the HTTP status, not a guess:

StatusReported as
200, not archivedok
200, archived: truearchived
404 / 451dead — fails the run
403 / 429, or a transport errorunknown — never counted as broken

That last row matters: a rate-limited check must not tell a maintainer their list is broken. A repository that redirects to a different slug is reported as moved, but is still ok.

--limit N bounds the work, --json prints the full result set, and --write rewrites the file in place:

$ dsh-service-check links README.md --write
Updated README.md:
  + PerryLink/dsh-plugin-kit
  + Noob-stupid/example-gone

--write only touches the line that holds the link, so list structure, indentation and surrounding prose survive. It is idempotent: an entry that already carries the note is left alone, and an archived note is removed again if that repository comes back. A dead note is never removed, because a deleted repository does not return. The note goes inside a trailing sentence period rather than after it, in both English and Chinese.

There is also action-link/, which runs the link check on a schedule. It is a separate action because the two have different failure semantics: a bundle that fails validation is the author's bug, while a dead link in a curated list is rot the maintainer did not cause. Sharing one action would force one exit-code policy on both.

- uses: actions/checkout@v4
- uses: actions/checkout@v4
  with:
    repository: cndoin/dsh-service-check
    path: .dsh-service-check
- uses: ./.dsh-service-check/action-link
  with:
    path: README.md
    fail-on-dead: 'true'

It writes a per-file summary table, annotates each dead or archived link on the diff, and exposes dead, archived and unknown as outputs. unknown covers rate limits and transport failures and never fails the job — a throttled run must not be reported as a broken list.

--baseline <file> changes what a failure means. A curated list rots slowly, so without a baseline every run reports the same historical dead links and the signal is lost on a pull request:

$ dsh-service-check links README.md --baseline .dsh-links-baseline.json
Compared with .dsh-links-baseline.json:
  1 new, 7 known, 1 fixed
  + someone/newly-deleted-repo
  - old/dead-repo resolves again

Only new fails the run, so a list with known rot can still be protected against new rot. --update-baseline rewrites the file. An archived entry that becomes gone counts as new because the link now 404s; an entry that resolves again is reported as fixed and dropped, so the file shrinks instead of accumulating stale entries. A malformed baseline is an error rather than an empty baseline — treating it as empty would report every known link as newly broken.

What it checks

Errors — DSH cannot load the bundle as written.

  • package.json is missing or is not valid JSON
  • no name, no version, or type other than module
  • dsh.bundle.patch is absent, or names a file that does not exist
  • the patch is not valid YAML, is not a sequence, or is malformed enough to abort composition
  • a row has no id, or two rows share one
  • a row has no name, or its name is an absolute path rather than a specifier
  • a relative row name (./lib/plugin.js) that resolves to no file in the package
  • a row that points at this package does not resolve to a module exporting apply or a default
  • dsh.client is declared without exports["./client"], or that file is missing
  • meta.detail escapes the package, is missing, or exceeds 1 MiB
  • a locale file is not valid JSON
  • ctx.tools.register() without an output declaration — the registry throws at load
  • parameters written as a JSON Schema document instead of a property map — also throws

Warnings — it loads, but not the way you expect.

  • unconventional package name
  • a patch that inserts no rows
  • no ./locale/*.json export, or no meta.title / meta.description
  • no exported icon (Plugin Manager falls back to generic artwork)
  • a client half with no host row
  • a ctx.<service> used but missing from export const inject
  • an injected name that is not a Host Service in the bundled catalog
  • ctx.<service>.<method>() where the catalog does not record that method

Rule names

Every diagnostic carries the rule that produced it, so a CI annotation says what to look at rather than only that something is wrong.

ruleseverityfires when
manifest/readerrorpackage.json is absent or is not valid JSON
manifest/nameerrorno name, or not a usable package name
manifest/versionerrorno version
manifest/typeinfotype is not module — a hint, not a requirement: the Cordis loader normalizes ESM/CJS/default export shapes
bundle/patcherrordsh.bundle.patch missing or malformed as a declaration
bundle/patch-missingerrorthe declared patch file is not in the package
bundle/patch-generatedinfothe patch lives under a build directory, so it is produced by the build
bundle/patch-syntaxerrorthe patch is not parseable YAML
bundle/patch-shapeerrorthe patch is not a top-level sequence
bundle/patch-emptywarningthe patch inserts no rows
bundle/patch-layersinfodsh.bundle.patch is a list; says how many layers
bundle/patch-rowerrora patch entry is not a row or a known operation
bundle/patch-operationwarningan operation is none of insert / override / remove
row/iderrora row has no id
row/id-duplicateerrortwo rows share one id
row/nameerrora row has no name
row/name-shapeerrorthe name is an absolute path rather than a specifier
row/name-relativeerrora relative name resolves to no file in the package
row/name-generatedinfothe relative name is build output, absent until the package is built
row/entryerrorthe entry module is missing
row/entry-builtinfothe entry is build output that is not in the checkout
row/entry-esmerrorthe entry exports neither apply nor a default
client/platformerrordsh.client.platform is not web
client/exporterrordsh.client is declared without exports["./client"]
client/fileerrorthe client file is missing
client/file-builtinfothe client file is build output absent from a checkout
client/no-host-rowwarninga client half without a host row
meta/titlewarningno meta.title
meta/descriptionwarningno meta.description
meta/locale-exportwarningno ./locale/*.json export
meta/locale-enwarningno English locale file
meta/locale-jsonerrora locale file is not valid JSON
meta/iconwarningno exported icon
meta/icon-missingerrorexports["./icon"] is declared but the file is absent
meta/icon-unpublishedwarningthe icon exists but files would not publish it
meta/detail-missingerrormeta.detail points at nothing
meta/detail-escapeerrormeta.detail escapes the package
meta/detail-sizeerrormeta.detail exceeds 1 MiB
service/readerrorthe entry module cannot be read
service/inject-missingwarningctx.<service> used but not in export const inject
service/catalogwarningan injected name is not a Host Service
service/inject-unknownwarningexport const inject names something the catalog does not know
service/catalog-staleinfothe bundled catalog predates the installed Harness
service/unknown-methodwarning<method> is not recorded for that Service
tool/output-missingerrorctx.tools.register() without an output declaration
tool/parameters-shapeerrorparameters is a JSON Schema document, not a property map

The two built rules are info, not errors. They say a path resolves to build output that is not in the checkout, which is normal for a package that compiles before publishing. Reporting them as missing files was a false positive on three real plugins in this catalogue.

The two tool/ rules are errors because the registry throws on both, so the plugin never mounts. They were added after this project's own tools hit them.

Service checks

doctor reads the entry module and compares every ctx.<service> and ctx.<service>.<method>() against a catalog of 109 Host Services captured from a live Harness (src/catalog/dsh-host-services.json). The example in The mistake this catches shows the output. This is the check that catches mistakes which fail only at runtime, after the plugin has installed and the Host has started.

The catalog is a snapshot, so an injected name that is absent is a warning, not an error: the user may be running a DSH release newer than the snapshot.

doctor also reports when the snapshot no longer matches the release you are running:

theme-minimal
  ℹ service/catalog-stale  DSH 0.3.0 is newer than the catalog (captured from 0.2.1-rc.5);
                           a Service reported as unknown may exist in your release
      Regenerate the catalog with cordis_inspect_query host/Service.listService.

The installed version is read from $DSH_INSTALL_DIR, falling back to a sibling @deepseek-ai package under $DSH_PROFILE_DIR/node_modules. When neither is available the check says it could not determine a version rather than assuming the catalog is right.

Using it as a library

import { checkBundle, findBundles, parseYaml, scaffold } from 'dsh-service-check/lib'

for (const { dir } of await findBundles('.')) {
  const result = await checkBundle(dir, { parseYaml })
  console.log(result.name, result.ok)
}

parseYaml understands the subset a bundle patch can contain, plus flow collections, block scalars and comments. Unsupported constructs raise YamlError with a line number instead of producing a half-parsed patch.

Limits

  • The YAML parser is a deliberate subset. !!js tags, anchors and aliases are not supported. !!js is rejected with an error; anchors and aliases are not — they come back as the literal text &n value and *n, which is worse than a refusal, because a patch that relies on them parses into something plausible and wrong. Multi-document streams are merged rather than rejected. If your patch uses any of the four, run doctor against the generated bundle on a Host rather than trusting the parse here.
  • doctor checks structure and metadata. It does not activate the plugin. Its Service and method checks run against a captured catalog rather than your installed Harness, so a match confirms nothing and a mismatch may only mean your release is newer. Confirm real behavior by running the plugin.
  • Slot ids other than conversation.composer.dock are not validated against a live page.

See docs/BLOCKERS.md for what this project has deliberately not solved yet and the reason for each.

Notes

Corrections about this project itself, kept rather than tidied away. None of them changes how the tool behaves, and all of them are here instead of in the first screen above.

The name. This repository was dsh-plugin-kit until a collision was found: that name belongs to an npm package by another maintainer, and to a GitHub repository that has since moved to dsh-scaffold. The old URL redirects. See docs/NAME-HISTORY.md and docs/BLOCKED-npm-name.md.

Not on npm. dsh-service-check is free on the registry but unclaimed — publishing needs an npm account and token this project does not have. So npx dsh-service-check fails to install rather than installing something else. An earlier version of this README claimed the opposite, carrying over a warning that had been true of the previous name; it was wrong for the new one.

What doctor does not prove. It reads structure and metadata against a snapshot; it does not activate the plugin. A catalog match confirms nothing, and a mismatch may only mean your release is newer than the snapshot. Run the plugin to know how it behaves.

The ecosystem report. docs/ECOSYSTEM-HEALTH.md surveys 830 linked repositories. Its first version reported a star total that counted the Harness host itself; that figure is corrected in place, with the original left visible next to it.

License

MIT

Related plugins