setup-pm

setup-pm is a command for coding agents from xu-xiang/everything-claude-code-zh. It costs 11 tokens per session (493 once invoked), scanned A, original, MIT.

A command for choosing which package manager a project should use, such as npm, pnpm, Yarn, or Bun. A package manager installs project libraries and runs project scripts.

In plain words
What is it for?
Use it to set or detect the package manager through an environment variable, project settings, package.json, or a lock file.
Why use it?
It removes uncertainty when different configuration files or lock files suggest different package managers.

Command

Part of the everything-claude-code-zh plugin — 17 skills, 26 commands, 13 agents shipped together

About the project

everything-claude-code-zh is a Chinese translation of a collection of configurations for Claude Code and other AI coding agents. It provides agents, skills, hooks, commands, rules, and MCP configurations intended to support development workflows such as memory persistence, security scanning, evaluation, and research-first work. The catalogue includes commands, skills, agents, instructions, and a plugin from this configuration set.

xu-xiang/everything-claude-code-zh · 1,929 stars · on GitHub

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/xu-xiang/everything-claude-code-zh/setup-pm
Clone the repo
git clone --depth 1 https://github.com/xu-xiang/everything-claude-code-zh

Or install everything-claude-code-zh, the plugin that ships this one along with the rest of its 17 skills, 26 commands, 13 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for setup-pm

README.md
[![agentmods](https://agentmods.dev/badge/commands/xu-xiang/everything-claude-code-zh/setup-pm.svg)](https://agentmods.dev/commands/xu-xiang/everything-claude-code-zh/setup-pm)
Your own site
<a href="https://agentmods.dev/commands/xu-xiang/everything-claude-code-zh/setup-pm"><img src="https://agentmods.dev/badge/commands/xu-xiang/everything-claude-code-zh/setup-pm.svg" alt="Measured on agentmods" height="20"></a>
Per session 11 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 493 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00011 $0.00493
Opus 5 $0.00005 $0.00246
Sonnet 5 $0.00002 $0.00099
Haiku 4.5 $0.00001 $0.00049

Measured 5d ago against content hash 6f5ed6241869, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

setup-pm scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.opencode/commands/setup-pm.md · 68 lines

What it actually says

设置包管理器(Package Manager)命令

配置你首选的包管理器:$ARGUMENTS

你的任务

为项目或全局设置包管理器(Package Manager)首选项。

检测顺序

  1. 环境变量(Environment variable)CLAUDE_PACKAGE_MANAGER
  2. 项目配置(Project config).claude/package-manager.json
  3. package.jsonpackageManager 字段
  4. 锁定文件(Lock file):从锁定文件中自动检测
  5. 全局配置(Global config)~/.claude/package-manager.json
  6. 备选方案(Fallback):第一个可用的包管理器

配置选项

选项 1:环境变量

export CLAUDE_PACKAGE_MANAGER=pnpm

选项 2:项目配置

# 创建 .claude/package-manager.json
echo '{"packageManager": "pnpm"}' > .claude/package-manager.json

选项 3:package.json

{
  "packageManager": "[email protected]"
}

选项 4:全局配置

# 创建 ~/.claude/package-manager.json
echo '{"packageManager": "yarn"}' > ~/.claude/package-manager.json

支持的包管理器

管理器(Manager) 锁定文件(Lock File) 命令(Commands)
npm package-lock.json npm install, npm run
pnpm pnpm-lock.yaml pnpm install, pnpm run
yarn yarn.lock yarn install, yarn run
bun bun.lockb bun install, bun run

验证

检查当前设置:

node scripts/setup-package-manager.js --detect

提示:为了保持团队内的一致性,请在 package.json 中添加 packageManager 字段。

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 68 lines · 11 tokens per session scan A 6f5ed6241869

Subscribe to this mod's changes

setup-pm is a command published in the GitHub repository xu-xiang/everything-claude-code-zh (1,929 stars, last pushed 6mo ago), licensed MIT. It adds 11 tokens to every session and 493 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.