Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

DeepSeek Harness Publishing Plugins: npm / GitHub / tarball

DeepSeek Harness Publishing Plugins: npm / GitHub / tarball

Local installation is working; we can distribute the plugin to others

Publishing to a registry isn't required; there are three routes: npm, tarball, Git

The three have completely different requirements for build artifacts; choosing wrong will cause pitfalls for users


Comparison of the three distribution methods

The official docs give three distribution methods; the core difference is whether prebuilt artifacts are distributed

Comparison diagram of three release approaches

Method User install command What gets installed Whether build authorization is needed
npm publish dsh plugin add your-package Prebuilt lib/ Code Not required
tarball delivery dsh plugin add ./hello-plugin-0.1.0.tgz pnpm pack the packed package Not required
Git install dsh plugin --profile demo add github:you/hello-plugin Source code (not build artifacts) Required (pnpm >= 10)

Neither npm nor tarball needs any build permission, suitable for scenarios where you don't want users to do extra authorization

Git install is the most flexible, but you must get past the "build script" hurdle


git install: the build script hurdle

Git install pulls source code, not build artifacts

No step runs your build script, so when the TypeScript package arrives it has no lib/ output, and loading fails

Both sides must each do one thing

On the author's side, provide a prepare script

pnpm runs it after git install to build the publish entry from source

It must be self-contained: it cannot assume context that only exists in a dev environment, such as a monorepo checkout next to it

turtle-ui is a usable example: its prepare runs a dedicated tsdown config, directly transpiling src/, without project references and without type checking

Example

{

  "name": "dsh-hello-plugin",

  "scripts": {

    "prepare": "tsdown -c tsdown.publish.ts"

  }

}

The prepare script above must be self-contained: directly transpile src/, without relying on a neighboring monorepo checkout

On the user's side, authorize the build

pnpm >= 10 refuses to run a git dependency's prepare script before getting explicit permission, so the first add fails

dsh will point out the fix: copy the exact package key printed by pnpm into that profile's pnpm-workspace.yaml

dsh plugin --profile demo add github:you/hello-plugin

The first add fails because prepare isn't authorized, and pnpm prints the exact package key

Copy it into the profile's pnpm-workspace.yaml, like the following

Example

File path: $DSH_HOME/profiles/demo/pnpm-workspace.yaml

Copy in the exact package key printed by pnpm to allow it to run prepare

allowBuilds

:

  dsh-hello-plugin

:

true

Then run add again

dsh plugin --profile demo add github:you/hello-plugin   # 第二次通过

Treat this authorization seriously: it allows the package's code to execute on your machine during installation, outside any sandbox in which the agent runs

Only authorize packages with trustworthy source, and pin the commit (github:you/hello-plugin#) so subsequent pushes can't silently change what actually runs

The install syntax for pinning a commit is as follows

dsh plugin --profile demo add github:you/hello-plugin#a1b2c3d   # 锁定到具体 commit


npm and tarball: no build authorization needed

If you don't want users to do authorization, distribute build artifacts instead

Neither of the following two forms needs any build permission

First, publish to npm

Build at pnpm publish time lib/, users dsh plugin add your-package install the prebuilt code

# 作者侧:先构建再发布

pnpm build

pnpm publish



# Client side: installed pre-built code, no authorization needed

dsh plugin add your-package

Second, deliver a tarball

Pack with pnpm pack, and users run dsh plugin add ./hello-plugin-0.1.0.tgz。

# 作者侧:打出 tgz

pnpm pack



# Client side: directly install tarball file

dsh plugin add ./hello-plugin-0.1.0.tgz

Recommendation: if the source is trustworthy and you want to skip the build flow, use git install and pin the commit; for general users, prefer publishing to npm or delivering a tarball so they can install with zero authorization


Summary and self-test

The three distribution methods are distinguished by whether prebuilt artifacts are distributed: npm and tarball need no build authorization, while Git install pulls source and requires the author's self-contained prepare script and the user's allowBuilds authorization

Self-test questions:

  1. Why does git install fail for TypeScript packages? What does the author need to do?
  2. When a pnpm >= 10 user's first add fails, what fix does dsh suggest?
  3. Why is it recommended to pin the commit sha?