setup-pm

A command for detecting and choosing the package manager used by a project. A package manager installs and manages JavaScript dependencies, such as npm, yarn, pnpm, or bun.

In plain words
What is it for?
Use it to detect the current choice, list available package managers, or set a global or project-specific preference.
Why use it?
It avoids inconsistent dependency commands by recording a preferred package manager globally or for one project.

Command

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/codelably/harmony-claude-code/setup-pm
Clone the repo
git clone --depth 1 https://github.com/codelably/harmony-claude-code
Per session 16 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 479 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.00016 $0.00479
Opus 5 $0.00008 $0.00239
Sonnet 5 $0.00003 $0.00096
Haiku 4.5 $0.00002 $0.00048

Measured yesterday against content hash 42e68fa5507c, 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 yesterday.

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.

commands/setup-pm.md · 81 lines

What it actually says

包管理器设置 (Package Manager Setup)

为本项目或全局配置你偏好的包管理器。

用法 (Usage)

# 检测当前包管理器
node scripts/setup-package-manager.js --detect

# 设置全局偏好
node scripts/setup-package-manager.js --global pnpm

# 设置项目偏好
node scripts/setup-package-manager.js --project bun

# 列出可用的包管理器
node scripts/setup-package-manager.js --list

检测优先级 (Detection Priority)

在确定使用哪个包管理器时,将按以下顺序进行检查:

  1. 环境变量 (Environment variable): CLAUDE_PACKAGE_MANAGER
  2. 项目配置 (Project config): .claude/package-manager.json
  3. package.json: packageManager 字段
  4. 锁定文件 (Lock file): 是否存在 package-lock.json、yarn.lock、pnpm-lock.yaml 或 bun.lockb
  5. 全局配置 (Global config): ~/.claude/package-manager.json
  6. 后备方案 (Fallback): 第一个可用的包管理器 (pnpm > bun > yarn > npm)

配置文件 (Configuration Files)

全局配置

// ~/.claude/package-manager.json
{
  "packageManager": "pnpm"
}

项目配置

// .claude/package-manager.json
{
  "packageManager": "bun"
}

package.json

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

环境变量 (Environment Variable)

设置 CLAUDE_PACKAGE_MANAGER 以覆盖所有其他检测方法:

# Windows (PowerShell)
$env:CLAUDE_PACKAGE_MANAGER = "pnpm"

# macOS/Linux
export CLAUDE_PACKAGE_MANAGER=pnpm

运行检测 (Run the Detection)

若要查看当前的包管理器检测结果,请运行:

node scripts/setup-package-manager.js --detect
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. yesterday First seen · 81 lines · 16 tokens per session scan A 42e68fa5507c

Subscribe to this mod's changes

setup-pm is a command published in the GitHub repository codelably/harmony-claude-code (42 stars, last pushed 6mo ago), licensed MIT. It adds 16 tokens to every session and 479 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.