wpm: the package manager built into WinuxCmd
wpm is not a standalone program — it is compiled into winuxcmd.exe
as a subcommand family (C++, no Node/Python/.NET runtime). Have
WinuxCmd and you have wpm: it manages the index, download
verification and command links, plus updates of winuxcmd.exe itself. Tools that
should not be re-implemented get installed as real distributions.
github.com/unixwin/wpm-source ↗ (the official index repo; stars per repo-meta.json, measured 2026-10-19: 0 stars)
Why wpm
Installing CLI tools on Windows usually means adding another package manager and its runtime. wpm trades the other way: the package manager lives inside the command set itself, and the package boundary is the command boundary — single-exe tools install flat; toolchains with DLLs install self-contained.
中文原文 · Chinese original(4 张卡片全文)
- 不是外挂程序——wpm 以 C++ 实现并编译进 winuxcmd.exe 本体——没有 Node.js、Python 或 .NET 运行时依赖。
- 装的是命令,不是软件——winget/scoop/choco 管理「应用程序」;wpm 只收便携命令行工具与可搬迁工具链,装完即在 PATH 上。
- SHA-256 是硬门——索引里每个构件带 sha256/size/urls 三元组;无校验和的远程构件拒绝安装。
- 为 shell 生态而生——niubash 的发行流水线用 wpm 预装 gawk;oh-my-niu 的环境包声明 wpm 包清单。
Core features
Official index of 281 packages; the sha256/size/urls triple contract; flat and shim layouts; hard-link entries (zero launch overhead); a schema:1 --json contract for GUI/TUI/agents; four mirror sources with fallback; two anti-poisoning locks; and self-update with rollback. Full eight-point list (Chinese):
中文原文 · Chinese original(八条特性全文)
- 官方索引 281 包——wpm-source 仓维护的官方索引(schema:1)覆盖 ripgrep、fd、jq、fzf、bat、neovim、curl、wget、make、openssh、goawk、bsdtar 等便携 CLI。
- 三元组契约——每个构件必须带 sha256(64 位小写十六进制)、size(字节数)与 urls(多个则顺序尝试)。
- flat / shim 双布局——flat 单 exe 直接进 usr\bin\;shim 载荷自包含在 opt\<pkg>\,卸载即删目录。
- 硬链接入口——每个命令在 bin\ 下是「指向真二进制的硬链接」,入口零启动开销。
- --json 契约——查询类子命令输出带 schema:1 版本字段的纯 JSON。
- 四源镜像与回退——github-raw / jsdelivr / release-pinned / official-cn 按优先级自动回退。
- 防投毒两道锁——索引文件内声明的 sources 永不并入候选;wpm index update 记录 last_index_sha256。
- 自更新与回滚——wpm update winuxcmd 异步换镜像;.wpm\backup\ 自动保留最新两份回滚。
Install & quick start
wpm has no installer of its own — it lands together with WinuxCmd. First thing after installing WinuxCmd: refresh the index.
wpm ships built into winuxcmd.exe — install WinuxCmd (or niubash) and it is there; nothing separate to install.
The four-command starter (each line's comment says what it does):
wpm index update # refresh the official index
wpm install ripgrep fd jq # install several packages at once (rg / fd / jq land on PATH)
wpm installed # what this machine has installed
wpm info ripgrep --json # the full package record (machine-readable) First-run orientation
wpm --help lists every subcommand (install/uninstall/update/list/search/info/installed/
export/restore/outdated/categories/index/source/links/clean/version). If the index is
unreachable (no reachable index source), switch sources and retry with
wpm index update -s official-jsdelivr; behind a proxy set WPM_HTTPS_PROXY
and friends (WinHTTP auto-detects system proxies and PAC). On Chinese networks, switch straight
to the official mirror:
wpm source use official-cn
To clear caches/staging/rollback directories: wpm clean [cache|staging|backup|all];
to replay a machine's package list: wpm export > profile.txt then
wpm restore profile.txt.
Deep dive: the package model and the index
中文原文 · Chinese original(索引结构 / 三元组 / 双布局 / --json 契约 / wpm-artifacts 全文)
索引结构:索引是一个 JSON 文件(wpm-source/index.json):顶层 schema:1、version(如 official-2026.10.17)、updated、sources[] 与 packages[]。包记录含 name/version/description/kind/category/license/commands[] 与按平台分组的 artifacts(windows-x64 / windows-arm64)。
构件三元组与文件映射:每个构件必须携带 sha256(缺失即拒绝远程安装)、size 与 urls,外加显式 files 映射(from → to)。下载先算校验和再解压;缓存键 <pkg>-<version>-<sha8> 双校验(WinuxCmd#1154/#1157)。写侧同样严格:映射指向构件已不再携带的文件时以「extracted path not found」失败,不猜。
flat 与 shim 双布局:flat(默认)把映射文件直接装入 usr\bin\;shim 把载荷自包含装到 <root>\opt\<pkg>\,usr\bin\<cmd>.exe 是转发入口(winuxcmd-shim.exe 小转发器,分发跳数 24.5 ms → 12.1 ms)。无论哪种布局,bin\<command>.exe 都是指向真二进制的硬链接。
--json 契约:查询类子命令的输出是纯 JSON、不混人类可读文本,顶层带 schema:1 版本字段;完整契约见 wpm-source/docs/index-schema.md。
wpm-artifacts 与工具链层:category: "toolchain" 的语言运行时与 SDK 有四条准入(自包含便携、可搬迁、官方发布或 unixwin/wpm-artifacts 的 CI 构建镜像且 SHA-256 钉死、许可允许再分发)。GUI 应用、MSI/MSIX、服务驱动、生态包管理器本身明确出局。
Mirror mechanism
| Built-in source | Region | Priority | Notes |
|---|---|---|---|
official-github-raw | global | 10 | canonical: index.json on raw.githubusercontent.com |
official-jsdelivr | global | 15 | CDN mirror: cdn.jsdelivr.net/gh/unixwin/wpm-source@main |
official-github-release | global | 20 | release-pinned: releases/latest/download/wpm-index.json |
official-cn | cn | 30 | nginx cache proxy at gh.caomengxuan666.com; artifact URLs proxied, GitHub sources as fallback |
Sources fall back automatically by priority (lower number wins); wpm source use
pins a favorite and wpm source add adds your own. The security boundary is written
down: the candidate-source set = the built-in registry + user-added sources —
sources declared inside the index file are never merged in (a compromised
mirror cannot persistently inject download locations); wpm index update records
last_success_source and last_index_sha256, and warns when a
non-preferred source delivers a different index — a poisoned mirror cannot swap it silently.
Measured numbers
| Metric | Value | Source |
|---|---|---|
| Official index size | 281 packages (wpm-source index.json, version official-2026.10.17) | wpm-source/index.json packages[] counted 2026-10-19 |
| Shim dispatch hops | 12.1 ms (winuxcmd-shim.exe forwarder; the previous hard link to winuxcmd.exe cost 24.5 ms) | WinuxCmd CHANGELOG 1.1.14, measured |
| In-use file upgrades | Forced upgrade succeeded with 28 fsmonitor--daemon processes holding the payload; packages intact | WinuxCmd CHANGELOG 1.1.13, verified on a real install |
| Rollback copy governance | Newest two kept automatically and pruned (one machine had accumulated 61.8 MB) | WinuxCmd CHANGELOG 1.1.14 |
| Cache key | <pkg>-<version>-<sha8> (download pre-check + cache-reuse double verification) | WinuxCmd#1154/#1157 (HIGHLIGHTS #13) |
Release feed
wpm has no version of its own — it ships with winuxcmd.exe, and its entries are recorded in WinuxCmd's changelog. The wpm-related content of the newest three versions (changelogs.json, fetched 2026-10-19; the full feed lives on the changelog):
- Unreleased (the WinuxCmd release line)
WSL interop paths:
/mnt/X/…operands fold in the same shape as/X/…andX:\…(#1172) — every tool crossing the shared argument boundary (ls/du/sed/cp…) benefits at once, including toolchains installed via wpm. - v1.1.14 (2026-10-17)
New
wpm links verify(per-path report of links not running the current winuxcmd.exe) and thewinuxcmd-shim.exeforwarder (24.5 ms → 12.1 ms; older installs switch over smoothly viawpm links rebuild --force); fixedwpm update winuxcmdleaving command links on the old image; rollback copies now keep the newest two and auto-prune (one machine had accumulated 61.8 MB; reclaimed withwpm clean backup). - v1.1.13 (2026-10-17)
Files held by running processes upgrade via rename-aside:
wpm install --forcesucceeded on a real install with 28 fsmonitor--daemon payload holders, packages intact; upgrades either complete or leave everything untouched (failed file names and holding processes reported together);wpm clean staging/allalso clears parked.wpm-old-<pid>directories.
Related links
On this site
- WinuxCmd product page — wpm's host binary
- Niubash product page — the release pipeline preloads gawk via wpm
- Oh My Niu product page — env packages declare wpm package lists
- CLI & flags reference — includes the wpm quick-reference table
- Docs home · Changelog
FAQ
How do I install wpm?
Nothing to install — it is compiled into winuxcmd.exe, so having WinuxCmd/niubash means having wpm: wpm prints help, wpm list browses the index, wpm install <pkg> installs.
How many packages does wpm have? Is it safe?
The official index carries 281 packages, each with a sha256/size/urls triple; the cache key <pkg>-<version>-<sha8> double-checks, and the index tooling refuses to write entries for archives missing files.
Is wpm fast to download from China?
Four mirror sources with gh.caomengxuan666.com accelerating China; sha256 remains the source of truth — mirrors accelerate, never substitute.
How do wpm and WinuxCmd relate?
wpm is compiled straight into winuxcmd.exe (run as winuxcmd wpm) — zero runtime dependencies, no separate install step.
Does wpm have a GUI?
A wpm-gui experiment was evaluated and archived due to CLI contract drift (wpm-gui#1) — the focus is a stable CLI, with --json output for scripts and agents.