Introduction¶
When using agents in DeepSeek Harness (DSH) to modify dependencies, models often habitually type npm install or pip install, even when the repository actually uses pnpm, uv, etc. This results in an extra set of lockfiles, dependencies not being written into the project manifest, and lost changes during the next sync. While manually correcting this in the conversation works, monitoring the shell every time is costly.
Here we introduce the community plugin dsh-enforce-package-manager (maintainer acus9345). It operates at the tool invocation layer to identify the package manager actually used by the project. If a command does not match, it intercepts it and returns the equivalent, executable correct command to the model. Categorized as a workflow; you can find the source code and documentation in the SkillHub Directory and on GitHub (the community directory is not officially affiliated with DeepSeek / High-Flyer).
What is this¶
In short: A DeepSeek Harness plugin that prevents agents from using the wrong package manager (e.g., running npm in a pnpm project, or pip in a uv project) and provides the correct, translated command.
Typical interception feedback looks like this:
dsh-enforce-package-manager blocked `npm install zod --save-dev`: this project uses pnpm,
not npm ("packageManager": "pnpm@…" in /work/app/package.json). Mixing package managers
creates a second lockfile, ignores the existing one, and can install different versions.
Run this instead:
pnpm add -D zod
In most cases, the model will directly execute the line suggested in the feedback.
Core Features¶
How it determines the project’s manager¶
Starting from the directory where the command is to be executed (preceding cd commands on the same line are effective), it traverses upward and stops at the first directory that can answer “who is used”. It will not traverse beyond the git root directory; if there is no git repository, it will not traverse beyond the directory where you started DSH, to avoid misinterpretation caused by stray lockfiles in the home directory.
JavaScript
- The
packageManagerfield inpackage.jsontakes precedence. - Otherwise, look for a single lockfile:
pnpm-lock.yaml,yarn.lock,bun.lock/bun.lockb,package-lock.json. - If lockfiles for two different managers exist simultaneously, the plugin does not guess and will not intervene.
Python
Looks for uv.lock, poetry.lock, pdm.lock, Pipfile, or [tool.poetry] / [tool.uv] / [tool.pdm] in pyproject.toml. If only requirements.txt exists, it is not enforced, and pip can be used as usual.
Which commands are translated¶
It only concerns commands that modify project dependencies; npm run build, npm test, npx vitest, global installs (npm i -g ...), etc. are not intercepted. On the Python side, pip install --user ... and upgrading the installer itself (e.g., pip install -U pip) are also allowed.
Partial mapping (see README for the full matrix):
| Agent executes | pnpm project | uv project |
|---|---|---|
npm install |
pnpm install |
|
npm ci |
pnpm install --frozen-lockfile |
|
npm i -D vitest |
pnpm add -D vitest |
|
pip install httpx |
uv add httpx |
|
python -m pip install -e . |
uv sync |
Translations between yarn, bun, and npm projects follow the same logic, as do poetry (poetry add), pipenv (pipenv install), pdm (pdm add), etc. Workspace / directory arguments are preserved, for example, npm i -w web react → pnpm --filter web add react, npm install --prefix api → pnpm -C api install.
On Windows, when DSH executes via PowerShell, the same checks are applied to npm.cmd, pip.exe, full program paths, and Set-Location.
Configuration¶
You can turn on dsh-enforce-package-manager in the Plugins sidebar of DSH. After modifying, click Save; it will take effect on the next tool call without needing a restart.
Alternatively, add the following to ~/.dsh/profiles/<profile>/cordis.patch.yml (current profile only) or ~/.dsh/cordis.patch.yml (all profiles):
- id: enforce-package-manager
config:
mode: deny # or ask: prompts you for confirmation on mismatch
javascript: true # false means no constraints on npm/pnpm/yarn/bun
python: true # false means no constraints on pip
shellTools: [bash, pwsh] # DSH uses pwsh on Windows
Keys not written will retain their default values.
Installation and Activation¶
Official installation command (the example uses the web profile, i.e., the browser interface used by dsh web):
dsh plugin --profile web add dsh-enforce-package-manager
If running DSH via scripts / CI, replace web with headless; for editor integration, use acp. Each profile maintains an independent plugin list, so you need to add it separately for each profile you actually use. It works without additional configuration.
Uninstallation:
dsh plugin --profile web remove dsh-enforce-package-manager
Typical Usage¶
- Execute the
addcommand above in the corresponding profile. - In a project already using pnpm (or uv, etc.), ask the agent to “install a certain dependency”; if it still issues
npm install/pip install, you should see the interception explanation and the command underRun this instead:. - If manual oversight is needed, set
modetoask; to only constrain a specific language stack, setjavascriptorpythontofalse.
Use Cases and Notes¶
Suitable for: Monorepos mixing multiple package managers, or teams standardizing on pnpm / uv where models still default to npm / pip. Useful for reducing lockfile pollution and the operational cost of “installed but not in manifest” issues.
Notes:
- The plugin intercepts and rewrites shell tool calls based on the permissions of the current DSH process; please read the repository source code and the MIT license before installation to ensure it meets your security and compliance requirements.
- In cases of ambiguity like dual lockfiles, the plugin intentionally does not guess; manual organization of project conventions is still required.
- The DSH ecosystem emphasizes “everything is a plugin”; this plugin is a community contribution, and the star count and evolution pace are subject to GitHub.
Conclusion¶
dsh-enforce-package-manager transforms “using the wrong package manager” from repeated corrections in conversation into deterministic interception and command translation at the tool layer, making the workflow of using DSH to drive dependency changes more hassle-free in the long run.
- Directory Page: https://www.skillhub.cn/plugins/acus9345/dsh-enforce-package-manager
- Source Code & README: https://github.com/acus9345/dsh-enforce-package-manager