@wwkit/opm 1.0.15 → 1.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -103,7 +103,6 @@ pnpm opm <command> [args] [options]
103
103
  | `info <name>` | 查询包详情 |
104
104
  | `versions <name>` | 列出所有可用版本 |
105
105
  | `list` | 列出所有已安装包(仅运行时 node/php/python 与工具组 nvm/phpenv/uv 支持) |
106
- | `outdated` | 列出过期包 |
107
106
  | `install <name> [version]` | 安装包 |
108
107
  | `uninstall <name>` | 卸载包 |
109
108
  | `upgrade <name>` | 升级包 |
@@ -138,7 +137,7 @@ pnpm opm <command> [args] [options]
138
137
  | 选项 | 说明 |
139
138
  |------|------|
140
139
  | `-g, --global` | 全局操作(npm: global node_modules; pip: system Python) |
141
- | `-p, --proxy <url>` | 代理地址(search/info/versions/outdated/install/upgrade);未传时默认使用配置 `proxy.active`(为空则不启用代理) |
140
+ | `-p, --proxy <url>` | 代理地址(search/info/versions/install/upgrade);未传时默认使用配置 `proxy.active`(为空则不启用代理) |
142
141
  | `-h, --help` | 显示帮助 |
143
142
 
144
143
  > 所有命令默认以 JSON 格式输出。
@@ -156,7 +155,6 @@ opm npm search axios 1.7.9 # 查询指定版本
156
155
  opm npm view axios # 查询全局与项目作用域安装信息
157
156
  opm npm info axios # 包详情
158
157
  opm npm versions axios # 所有版本
159
- opm npm outdated # 过期包
160
158
  opm npm install axios # 安装
161
159
  opm npm install axios 1.7.9 # 安装指定版本
162
160
  opm npm install -g typescript # 全局安装
@@ -192,7 +190,6 @@ opm dnf search vim-enhanced # 查询包在源是否可用
192
190
  opm dnf view vim-enhanced # 查询全局作用域安装信息(无项目作用域)
193
191
  opm dnf info vim-enhanced # 包详情
194
192
  opm dnf versions vim-enhanced # 所有可用版本
195
- opm dnf outdated # 过期包
196
193
  opm dnf install htop # 安装
197
194
  opm dnf install vim-enhanced 9.0 # 安装指定版本
198
195
  opm dnf uninstall htop # 卸载
@@ -211,7 +208,6 @@ opm apt search curl # 查询包在源是否可用
211
208
  opm apt view curl # 查询全局作用域安装信息(无项目作用域)
212
209
  opm apt info curl # 包详情
213
210
  opm apt versions curl # 所有可用版本
214
- opm apt outdated # 过期包
215
211
  opm apt install htop # 安装
216
212
  opm apt install curl 7.68.0-1ubuntu2.7 # 安装指定版本
217
213
  opm apt uninstall htop # 卸载
@@ -230,7 +226,6 @@ opm brew search wget # 查询 wget 是否可用
230
226
  opm brew view wget # 查询全局作用域安装信息(无项目作用域)
231
227
  opm brew info wget # 包详情
232
228
  opm brew versions wget # 所有可用版本
233
- opm brew outdated # 过期包
234
229
  opm brew install wget # 安装
235
230
  opm brew install python 3.12 # 安装指定版本(versioned formula)
236
231
  opm brew uninstall wget # 卸载
@@ -250,7 +245,6 @@ opm composer search monolog/monolog 3.9.0 # 查询指定版本
250
245
  opm composer view monolog/monolog # 查询项目作用域安装信息(无全局作用域)
251
246
  opm composer info monolog/monolog # 包详情
252
247
  opm composer versions monolog/monolog # 所有可用版本
253
- opm composer outdated # 过期包
254
248
  opm composer install monolog/monolog # 安装(composer require)
255
249
  opm composer install monolog/monolog ^3.0 # 安装指定版本约束
256
250
  opm composer uninstall monolog/monolog # 卸载(composer remove)
@@ -268,7 +262,6 @@ opm bun search axios # 查询 axios 是否可用
268
262
  opm bun view axios # 查询全局与项目作用域安装信息
269
263
  opm bun info axios # 包详情
270
264
  opm bun versions axios # 所有可用版本
271
- opm bun outdated # 过期包
272
265
  opm bun install axios # 安装(bun add)
273
266
  opm bun uninstall axios # 卸载(bun remove)
274
267
  opm bun upgrade axios # 升级(bun update)
@@ -14,7 +14,6 @@
14
14
  | `opm apt view <name>` | `dpkg -l` / `apt list --installed` | 查询包在全局作用域的安装信息(无项目作用域,project 显示未安装) |
15
15
  | `opm apt info <name>` | `apt-cache show` | 包详情 |
16
16
  | `opm apt versions <name>` | `apt-cache madison` / `policy` | 所有可用版本 |
17
- | `opm apt outdated` | `apt list --upgradable` | 过期包 |
18
17
  | `opm apt install <name>` | `apt install` | 安装 |
19
18
  | `opm apt uninstall <name>` | `apt remove` | 卸载 |
20
19
  | `opm apt upgrade <name>` | `apt upgrade` | 升级 |
@@ -15,7 +15,6 @@
15
15
  | `opm brew view <name>` | `brew list --versions <name>` | 查询包在全局作用域的安装信息(无项目作用域,project 显示未安装) |
16
16
  | `opm brew info <name>` | `brew info --json=v2 <name>` | 查询包详情(描述/主页/许可证/仓库等) |
17
17
  | `opm brew versions <name>` | `brew info --json=v2 <name>` | 列出所有可用版本 |
18
- | `opm brew outdated` | `brew outdated --json=v2` | 列出过期包 |
19
18
  | `opm brew install <name>` | `brew install <name>` | 安装包(formula / cask 均可) |
20
19
  | `opm brew install <name> <version>` | `brew install <name>@<version>` | 安装指定版本(versioned formula) |
21
20
  | `opm brew uninstall <name>` | `brew uninstall <name>` | 卸载包 |
@@ -65,9 +64,6 @@ opm brew info wget
65
64
  # 列出 wget 所有可用版本
66
65
  opm brew versions wget
67
66
 
68
- # 列出过期包
69
- opm brew outdated
70
-
71
67
  # 安装 wget
72
68
  opm brew install wget
73
69
 
@@ -16,7 +16,6 @@ Bun 是全栈 JS 工具链(runtime + 包管理器 + 打包器),包管理
16
16
  | `opm bun view <name>` | 查 `node_modules/<name>/package.json` | 查询包在全局与项目作用域的安装信息 |
17
17
  | `opm bun info <name>` | HTTP 查 npm registry | 显示包详情 |
18
18
  | `opm bun versions <name>` | HTTP 查 npm registry | 列出所有可用版本 |
19
- | `opm bun outdated [-g]` | `bun outdated` | 列出过期包 |
20
19
  | `opm bun install <name> [version]` | `bun add <name>@<version>` | 安装包 |
21
20
  | `opm bun uninstall <name>` | `bun remove <name>` | 卸载包 |
22
21
  | `opm bun upgrade <name>` | `bun update <name>` | 升级包 |
@@ -39,7 +38,6 @@ opm bun version
39
38
  opm bun registry set taobao
40
39
  opm bun search axios
41
40
  opm bun info react
42
- opm bun outdated
43
41
  opm bun install axios
44
42
  opm bun install react@18
45
43
  opm bun upgrade axios
@@ -15,7 +15,6 @@
15
15
  | `opm composer view <name>` | 读 `vendor/composer/installed.json` | 查询包在项目作用域的安装信息(无全局作用域,global 显示未安装) |
16
16
  | `opm composer info <name>` | `{registry}/p2/{name}.json` | 查询包详情(描述/作者/主页/许可证等) |
17
17
  | `opm composer versions <name>` | `{registry}/p2/{name}.json` | 列出所有可用版本 |
18
- | `opm composer outdated` | `composer outdated --format=json` | 列出过期包 |
19
18
  | `opm composer install <name>` | `composer require <name> --no-interaction` | 安装包 |
20
19
  | `opm composer install <name> <version>` | `composer require <name>:<version> --no-interaction` | 安装指定版本约束 |
21
20
  | `opm composer uninstall <name>` | `composer remove <name> --no-interaction` | 卸载包 |
@@ -69,9 +68,6 @@ opm composer info monolog/monolog
69
68
  # 列出 monolog/monolog 所有可用版本
70
69
  opm composer versions monolog/monolog
71
70
 
72
- # 列出过期包
73
- opm composer outdated
74
-
75
71
  # 安装 monolog/monolog
76
72
  opm composer install monolog/monolog
77
73
 
@@ -14,7 +14,6 @@
14
14
  | `opm dnf view <name>` | `dnf list installed` | 查询包在全局作用域的安装信息(无项目作用域,project 显示未安装) |
15
15
  | `opm dnf info <name>` | `dnf info` | 包详情 |
16
16
  | `opm dnf versions <name>` | `dnf list --showduplicates` | 所有可用版本 |
17
- | `opm dnf outdated` | `dnf check-update` | 过期包 |
18
17
  | `opm dnf install <name>` | `dnf install` | 安装 |
19
18
  | `opm dnf uninstall <name>` | `dnf remove` | 卸载 |
20
19
  | `opm dnf upgrade <name>` | `dnf upgrade` | 升级 |
@@ -15,7 +15,6 @@
15
15
  | `opm npm view <name>` | `npm list <name>` / 读 `node_modules/<name>/package.json` | 查询包在全局与项目作用域的安装信息 |
16
16
  | `opm npm info <name>` | `npm view <name>` | 查询包详情(描述/作者/主页/许可证等) |
17
17
  | `opm npm versions <name>` | `npm view <name> versions` | 列出所有可用版本 |
18
- | `opm npm outdated` | `npm outdated` | 列出过期包 |
19
18
  | `opm npm install <name>` | `npm install <name>` | 安装包 |
20
19
  | `opm npm install <name> <version>` | `npm install <name>@<version>` | 安装指定版本 |
21
20
  | `opm npm install -g <name>` | `npm install -g <name>` | 全局安装 |
@@ -70,9 +69,6 @@ opm npm info axios
70
69
  # 列出 axios 所有版本
71
70
  opm npm versions axios
72
71
 
73
- # 列出过期包
74
- opm npm outdated
75
-
76
72
  # 安装 axios
77
73
  opm npm install axios
78
74
 
@@ -15,7 +15,6 @@
15
15
  | `opm pip view <name>` | `pip show <name>` | 查询包在全局与项目作用域的安装信息 |
16
16
  | `opm pip info <name>` | PyPI JSON API / `pip show <name>` | 查询包详情(描述/作者/主页/许可证等) |
17
17
  | `opm pip versions <name>` | PyPI JSON API / simple index | 列出所有可用版本 |
18
- | `opm pip outdated` | `pip list --outdated` | 列出过期包 |
19
18
  | `opm pip install <name>` | `pip install <name>` | 安装包 |
20
19
  | `opm pip install <name> <version>` | `pip install <name>==<version>` | 安装指定版本 |
21
20
  | `opm pip uninstall <name>` | `pip uninstall -y <name>` | 卸载包 |
@@ -66,9 +65,6 @@ opm pip info requests
66
65
  # 列出 requests 所有版本
67
66
  opm pip versions requests
68
67
 
69
- # 列出过期包
70
- opm pip outdated
71
-
72
68
  # 安装 requests
73
69
  opm pip install requests
74
70
 
package/docs/opm.html CHANGED
@@ -119,7 +119,7 @@
119
119
  <div id="managers_apt" class="doc-content" style="display:block;"><h1>apt 命令对照表</h1>
120
120
  <p><code>@wwkit/opm</code> 统一命令管理 apt 包(Debian / Ubuntu 等 dpkg 系,系统级)。</p>
121
121
  <h2>命令对照</h2>
122
- <table><thead><tr><th>统一命令</th><th>原始命令</th><th>说明</th></tr></thead><tbody><tr><td><code>opm apt version [name]</code></td><td><code>apt --version</code></td><td>无 name 显示 apt 版本;有 name 显示包在全局作用域的版本(无项目作用域,project 显示未安装)</td></tr><tr><td><code>opm apt registry</code></td><td>读 <code>/etc/apt/sources.list.d/opm.list</code></td><td>查询当前启用源</td></tr><tr><td><code>opm apt registry set &lt;url|preset&gt;</code></td><td>写 <code>/etc/apt/sources.list.d/opm.list</code> + <code>apt update</code></td><td>设置镜像源</td></tr><tr><td><code>opm apt registry presets</code></td><td>—</td><td>列出可用镜像预设</td></tr><tr><td><code>opm apt search &lt;name&gt;</code></td><td><code>apt-cache search</code></td><td>查询包在源是否可用</td></tr><tr><td><code>opm apt view &lt;name&gt;</code></td><td><code>dpkg -l</code> / <code>apt list --installed</code></td><td>查询包在全局作用域的安装信息(无项目作用域,project 显示未安装)</td></tr><tr><td><code>opm apt info &lt;name&gt;</code></td><td><code>apt-cache show</code></td><td>包详情</td></tr><tr><td><code>opm apt versions &lt;name&gt;</code></td><td><code>apt-cache madison</code> / <code>policy</code></td><td>所有可用版本</td></tr><tr><td><code>opm apt outdated</code></td><td><code>apt list --upgradable</code></td><td>过期包</td></tr><tr><td><code>opm apt install &lt;name&gt;</code></td><td><code>apt install</code></td><td>安装</td></tr><tr><td><code>opm apt uninstall &lt;name&gt;</code></td><td><code>apt remove</code></td><td>卸载</td></tr><tr><td><code>opm apt upgrade &lt;name&gt;</code></td><td><code>apt upgrade</code></td><td>升级</td></tr><tr><td><code>opm apt cache clean</code></td><td><code>apt clean</code></td><td>清理缓存</td></tr></tbody></table>
122
+ <table><thead><tr><th>统一命令</th><th>原始命令</th><th>说明</th></tr></thead><tbody><tr><td><code>opm apt version [name]</code></td><td><code>apt --version</code></td><td>无 name 显示 apt 版本;有 name 显示包在全局作用域的版本(无项目作用域,project 显示未安装)</td></tr><tr><td><code>opm apt registry</code></td><td>读 <code>/etc/apt/sources.list.d/opm.list</code></td><td>查询当前启用源</td></tr><tr><td><code>opm apt registry set &lt;url|preset&gt;</code></td><td>写 <code>/etc/apt/sources.list.d/opm.list</code> + <code>apt update</code></td><td>设置镜像源</td></tr><tr><td><code>opm apt registry presets</code></td><td>—</td><td>列出可用镜像预设</td></tr><tr><td><code>opm apt search &lt;name&gt;</code></td><td><code>apt-cache search</code></td><td>查询包在源是否可用</td></tr><tr><td><code>opm apt view &lt;name&gt;</code></td><td><code>dpkg -l</code> / <code>apt list --installed</code></td><td>查询包在全局作用域的安装信息(无项目作用域,project 显示未安装)</td></tr><tr><td><code>opm apt info &lt;name&gt;</code></td><td><code>apt-cache show</code></td><td>包详情</td></tr><tr><td><code>opm apt versions &lt;name&gt;</code></td><td><code>apt-cache madison</code> / <code>policy</code></td><td>所有可用版本</td></tr><tr><td><code>opm apt install &lt;name&gt;</code></td><td><code>apt install</code></td><td>安装</td></tr><tr><td><code>opm apt uninstall &lt;name&gt;</code></td><td><code>apt remove</code></td><td>卸载</td></tr><tr><td><code>opm apt upgrade &lt;name&gt;</code></td><td><code>apt upgrade</code></td><td>升级</td></tr><tr><td><code>opm apt cache clean</code></td><td><code>apt clean</code></td><td>清理缓存</td></tr></tbody></table>
123
123
  <h2>镜像预设</h2>
124
124
  <table><thead><tr><th>预设名</th><th>地址</th></tr></thead><tbody><tr><td><code>ubuntu-tsinghua</code></td><td><code>deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse</code></td></tr><tr><td><code>ubuntu-huawei</code></td><td><code>deb https://mirrors.huaweicloud.com/ubuntu/ focal main restricted universe multiverse</code></td></tr><tr><td><code>ubuntu-aliyun</code></td><td><code>deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse</code></td></tr><tr><td><code>debian-official</code></td><td><code>deb http://deb.debian.org/debian/ bookworm main</code></td></tr><tr><td><code>debian-tsinghua</code></td><td><code>deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main</code></td></tr></tbody></table>
125
125
  <h2>示例</h2>
@@ -134,7 +134,7 @@ opm apt cache clean</code></pre></div>
134
134
  <div id="managers_brew" class="doc-content" style="display:none;"><h1>brew 命令对照表</h1>
135
135
  <p><code>@wwkit/opm</code> 统一命令与 Homebrew 原始命令的映射关系(macOS)。</p>
136
136
  <h2>命令对照</h2>
137
- <table><thead><tr><th>统一命令</th><th>原始命令</th><th>说明</th></tr></thead><tbody><tr><td><code>opm brew version [name]</code></td><td><code>brew --version</code></td><td>无 name 显示 brew 本身版本;有 name 显示包在全局作用域的版本(无项目作用域,project 显示未安装)</td></tr><tr><td><code>opm brew registry</code></td><td>读 <code>~/.config/opm/config.json5</code> 的 <code>brew.registry.active</code></td><td>查询配置中的激活镜像(不读系统配置)</td></tr><tr><td><code>opm brew registry set &lt;url|preset&gt;</code></td><td>写 <code>~/.config/opm/config.json5</code> 的 <code>brew.registry.active</code></td><td>设置激活镜像(支持预设名,install/upgrade 自动传 <code>HOMEBREW_API_DOMAIN</code> / <code>HOMEBREW_BOTTLE_DOMAIN</code>;仅作用于本工具发起的命令,不改系统 brew 配置)</td></tr><tr><td><code>opm brew registry presets</code></td><td>—</td><td>列出可用镜像预设</td></tr><tr><td><code>opm brew search &lt;name&gt;</code></td><td><code>brew info --json=v2 &lt;name&gt;</code></td><td>查询包在源是否可用(返回最新版本 + 版本列表)</td></tr><tr><td><code>opm brew search &lt;name&gt; &lt;version&gt;</code></td><td><code>brew info --json=v2 &lt;name&gt;</code></td><td>查询指定版本是否可用</td></tr><tr><td><code>opm brew view &lt;name&gt;</code></td><td><code>brew list --versions &lt;name&gt;</code></td><td>查询包在全局作用域的安装信息(无项目作用域,project 显示未安装)</td></tr><tr><td><code>opm brew info &lt;name&gt;</code></td><td><code>brew info --json=v2 &lt;name&gt;</code></td><td>查询包详情(描述/主页/许可证/仓库等)</td></tr><tr><td><code>opm brew versions &lt;name&gt;</code></td><td><code>brew info --json=v2 &lt;name&gt;</code></td><td>列出所有可用版本</td></tr><tr><td><code>opm brew outdated</code></td><td><code>brew outdated --json=v2</code></td><td>列出过期包</td></tr><tr><td><code>opm brew install &lt;name&gt;</code></td><td><code>brew install &lt;name&gt;</code></td><td>安装包(formula / cask 均可)</td></tr><tr><td><code>opm brew install &lt;name&gt; &lt;version&gt;</code></td><td><code>brew install &lt;name&gt;@&lt;version&gt;</code></td><td>安装指定版本(versioned formula)</td></tr><tr><td><code>opm brew uninstall &lt;name&gt;</code></td><td><code>brew uninstall &lt;name&gt;</code></td><td>卸载包</td></tr><tr><td><code>opm brew upgrade &lt;name&gt;</code></td><td><code>brew upgrade &lt;name&gt;</code></td><td>升级包到最新版本</td></tr><tr><td><code>opm brew cache clean</code></td><td><code>brew cleanup -s --prune=all</code></td><td>清理缓存</td></tr><tr><td><code>opm brew help</code></td><td>—</td><td>显示 brew 命令清单</td></tr></tbody></table>
137
+ <table><thead><tr><th>统一命令</th><th>原始命令</th><th>说明</th></tr></thead><tbody><tr><td><code>opm brew version [name]</code></td><td><code>brew --version</code></td><td>无 name 显示 brew 本身版本;有 name 显示包在全局作用域的版本(无项目作用域,project 显示未安装)</td></tr><tr><td><code>opm brew registry</code></td><td>读 <code>~/.config/opm/config.json5</code> 的 <code>brew.registry.active</code></td><td>查询配置中的激活镜像(不读系统配置)</td></tr><tr><td><code>opm brew registry set &lt;url|preset&gt;</code></td><td>写 <code>~/.config/opm/config.json5</code> 的 <code>brew.registry.active</code></td><td>设置激活镜像(支持预设名,install/upgrade 自动传 <code>HOMEBREW_API_DOMAIN</code> / <code>HOMEBREW_BOTTLE_DOMAIN</code>;仅作用于本工具发起的命令,不改系统 brew 配置)</td></tr><tr><td><code>opm brew registry presets</code></td><td>—</td><td>列出可用镜像预设</td></tr><tr><td><code>opm brew search &lt;name&gt;</code></td><td><code>brew info --json=v2 &lt;name&gt;</code></td><td>查询包在源是否可用(返回最新版本 + 版本列表)</td></tr><tr><td><code>opm brew search &lt;name&gt; &lt;version&gt;</code></td><td><code>brew info --json=v2 &lt;name&gt;</code></td><td>查询指定版本是否可用</td></tr><tr><td><code>opm brew view &lt;name&gt;</code></td><td><code>brew list --versions &lt;name&gt;</code></td><td>查询包在全局作用域的安装信息(无项目作用域,project 显示未安装)</td></tr><tr><td><code>opm brew info &lt;name&gt;</code></td><td><code>brew info --json=v2 &lt;name&gt;</code></td><td>查询包详情(描述/主页/许可证/仓库等)</td></tr><tr><td><code>opm brew versions &lt;name&gt;</code></td><td><code>brew info --json=v2 &lt;name&gt;</code></td><td>列出所有可用版本</td></tr><tr><td><code>opm brew install &lt;name&gt;</code></td><td><code>brew install &lt;name&gt;</code></td><td>安装包(formula / cask 均可)</td></tr><tr><td><code>opm brew install &lt;name&gt; &lt;version&gt;</code></td><td><code>brew install &lt;name&gt;@&lt;version&gt;</code></td><td>安装指定版本(versioned formula)</td></tr><tr><td><code>opm brew uninstall &lt;name&gt;</code></td><td><code>brew uninstall &lt;name&gt;</code></td><td>卸载包</td></tr><tr><td><code>opm brew upgrade &lt;name&gt;</code></td><td><code>brew upgrade &lt;name&gt;</code></td><td>升级包到最新版本</td></tr><tr><td><code>opm brew cache clean</code></td><td><code>brew cleanup -s --prune=all</code></td><td>清理缓存</td></tr><tr><td><code>opm brew help</code></td><td>—</td><td>显示 brew 命令清单</td></tr></tbody></table>
138
138
  <h2>镜像预设</h2>
139
139
  <table><thead><tr><th>预设名</th><th>地址</th></tr></thead><tbody><tr><td><code>official</code></td><td><code>https://ghcr.io/v2/homebrew</code></td></tr><tr><td><code>tsinghua</code></td><td><code>https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles</code></td></tr><tr><td><code>ustc</code></td><td><code>https://mirrors.ustc.edu.cn/homebrew-bottles</code></td></tr></tbody></table>
140
140
  <blockquote>镜像预设记录的是 bottle 域名;使用非 official 镜像时,<code>HOMEBREW_API_DOMAIN</code> 取 <code>${bottle}/api</code>,<code>HOMEBREW_BOTTLE_DOMAIN</code> 取 bottle 域名本身。</blockquote>
@@ -163,9 +163,6 @@ opm brew info wget
163
163
  # 列出 wget 所有可用版本
164
164
  opm brew versions wget
165
165
 
166
- # 列出过期包
167
- opm brew outdated
168
-
169
166
  # 安装 wget
170
167
  opm brew install wget
171
168
 
@@ -187,7 +184,7 @@ opm brew help</code></pre></div>
187
184
  <p><code>@wwkit/opm</code> 统一命令管理 Bun 包。</p>
188
185
  <p>Bun 是全栈 JS 工具链(runtime + 包管理器 + 打包器),包管理与 npm 兼容。</p>
189
186
  <h2>命令对照</h2>
190
- <table><thead><tr><th>统一命令</th><th>原始命令</th><th>说明</th></tr></thead><tbody><tr><td><code>opm bun version [name]</code></td><td><code>bun --version</code></td><td>无 name 显示 bun 版本;有 name 显示包在全局与项目作用域的版本</td></tr><tr><td><code>opm bun registry</code></td><td>读 <code>~/.config/opm/config.json5</code> 的 <code>bun.registry.active</code></td><td>查询 bun registry 镜像</td></tr><tr><td><code>opm bun registry set &lt;url|preset&gt;</code></td><td>写 <code>~/.config/opm/config.json5</code></td><td>设置 bun registry 镜像(传给 <code>BUN_CONFIG_REGISTRY</code>)</td></tr><tr><td><code>opm bun registry presets</code></td><td>—</td><td>列出可用镜像预设</td></tr><tr><td><code>opm bun search &lt;name&gt; [version]</code></td><td>HTTP 查 npm registry</td><td>查询包是否可用</td></tr><tr><td><code>opm bun view &lt;name&gt;</code></td><td>查 <code>node_modules/&lt;name&gt;/package.json</code></td><td>查询包在全局与项目作用域的安装信息</td></tr><tr><td><code>opm bun info &lt;name&gt;</code></td><td>HTTP 查 npm registry</td><td>显示包详情</td></tr><tr><td><code>opm bun versions &lt;name&gt;</code></td><td>HTTP 查 npm registry</td><td>列出所有可用版本</td></tr><tr><td><code>opm bun outdated [-g]</code></td><td><code>bun outdated</code></td><td>列出过期包</td></tr><tr><td><code>opm bun install &lt;name&gt; [version]</code></td><td><code>bun add &lt;name&gt;@&lt;version&gt;</code></td><td>安装包</td></tr><tr><td><code>opm bun uninstall &lt;name&gt;</code></td><td><code>bun remove &lt;name&gt;</code></td><td>卸载包</td></tr><tr><td><code>opm bun upgrade &lt;name&gt;</code></td><td><code>bun update &lt;name&gt;</code></td><td>升级包</td></tr><tr><td><code>opm bun cache clean</code></td><td><code>bun pm cache rm</code></td><td>清理缓存</td></tr></tbody></table>
187
+ <table><thead><tr><th>统一命令</th><th>原始命令</th><th>说明</th></tr></thead><tbody><tr><td><code>opm bun version [name]</code></td><td><code>bun --version</code></td><td>无 name 显示 bun 版本;有 name 显示包在全局与项目作用域的版本</td></tr><tr><td><code>opm bun registry</code></td><td>读 <code>~/.config/opm/config.json5</code> 的 <code>bun.registry.active</code></td><td>查询 bun registry 镜像</td></tr><tr><td><code>opm bun registry set &lt;url|preset&gt;</code></td><td>写 <code>~/.config/opm/config.json5</code></td><td>设置 bun registry 镜像(传给 <code>BUN_CONFIG_REGISTRY</code>)</td></tr><tr><td><code>opm bun registry presets</code></td><td>—</td><td>列出可用镜像预设</td></tr><tr><td><code>opm bun search &lt;name&gt; [version]</code></td><td>HTTP 查 npm registry</td><td>查询包是否可用</td></tr><tr><td><code>opm bun view &lt;name&gt;</code></td><td>查 <code>node_modules/&lt;name&gt;/package.json</code></td><td>查询包在全局与项目作用域的安装信息</td></tr><tr><td><code>opm bun info &lt;name&gt;</code></td><td>HTTP 查 npm registry</td><td>显示包详情</td></tr><tr><td><code>opm bun versions &lt;name&gt;</code></td><td>HTTP 查 npm registry</td><td>列出所有可用版本</td></tr><tr><td><code>opm bun install &lt;name&gt; [version]</code></td><td><code>bun add &lt;name&gt;@&lt;version&gt;</code></td><td>安装包</td></tr><tr><td><code>opm bun uninstall &lt;name&gt;</code></td><td><code>bun remove &lt;name&gt;</code></td><td>卸载包</td></tr><tr><td><code>opm bun upgrade &lt;name&gt;</code></td><td><code>bun update &lt;name&gt;</code></td><td>升级包</td></tr><tr><td><code>opm bun cache clean</code></td><td><code>bun pm cache rm</code></td><td>清理缓存</td></tr></tbody></table>
191
188
  <h2>镜像预设</h2>
192
189
  <table><thead><tr><th>预设名</th><th>地址</th></tr></thead><tbody><tr><td><code>official</code></td><td><code>https://registry.npmjs.org/</code></td></tr><tr><td><code>taobao</code></td><td><code>https://registry.npmmirror.com/</code></td></tr><tr><td><code>huawei</code></td><td><code>https://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-central-repo/</code></td></tr></tbody></table>
193
190
  <blockquote>镜像通过 <code>BUN_CONFIG_REGISTRY</code> 环境变量传递给 bun 命令。</blockquote>
@@ -196,7 +193,6 @@ opm brew help</code></pre></div>
196
193
  opm bun registry set taobao
197
194
  opm bun search axios
198
195
  opm bun info react
199
- opm bun outdated
200
196
  opm bun install axios
201
197
  opm bun install react@18
202
198
  opm bun upgrade axios
@@ -232,7 +228,7 @@ opm cft registry set official</code></pre></div>
232
228
  <div id="managers_composer" class="doc-content" style="display:none;"><h1>composer 命令对照表</h1>
233
229
  <p><code>@wwkit/opm</code> 统一命令与 Composer(PHP)原始命令的映射关系。</p>
234
230
  <h2>命令对照</h2>
235
- <table><thead><tr><th>统一命令</th><th>原始命令</th><th>说明</th></tr></thead><tbody><tr><td><code>opm composer version [name]</code></td><td><code>composer --version</code></td><td>无 name 显示 composer 本身版本;有 name 显示包在项目作用域的版本(无全局作用域,global 显示未安装)</td></tr><tr><td><code>opm composer registry</code></td><td>读 <code>~/.config/opm/config.json5</code> 的 <code>composer.registry.active</code></td><td>查询配置中的激活镜像(不读系统配置)</td></tr><tr><td><code>opm composer registry set &lt;url|preset&gt;</code></td><td>写 <code>~/.config/opm/config.json5</code> 的 <code>composer.registry.active</code></td><td>设置激活镜像(支持预设名;镜像作用于 search/info/versions 的 P2 元数据拉取)</td></tr><tr><td><code>opm composer registry presets</code></td><td>—</td><td>列出可用镜像预设</td></tr><tr><td><code>opm composer search &lt;name&gt;</code></td><td><code>{registry}/p2/{name}.json</code></td><td>查询包在源是否可用(返回最新版本 + 版本列表)</td></tr><tr><td><code>opm composer search &lt;name&gt; &lt;version&gt;</code></td><td><code>{registry}/p2/{name}.json</code></td><td>查询指定版本是否可用</td></tr><tr><td><code>opm composer view &lt;name&gt;</code></td><td>读 <code>vendor/composer/installed.json</code></td><td>查询包在项目作用域的安装信息(无全局作用域,global 显示未安装)</td></tr><tr><td><code>opm composer info &lt;name&gt;</code></td><td><code>{registry}/p2/{name}.json</code></td><td>查询包详情(描述/作者/主页/许可证等)</td></tr><tr><td><code>opm composer versions &lt;name&gt;</code></td><td><code>{registry}/p2/{name}.json</code></td><td>列出所有可用版本</td></tr><tr><td><code>opm composer outdated</code></td><td><code>composer outdated --format=json</code></td><td>列出过期包</td></tr><tr><td><code>opm composer install &lt;name&gt;</code></td><td><code>composer require &lt;name&gt; --no-interaction</code></td><td>安装包</td></tr><tr><td><code>opm composer install &lt;name&gt; &lt;version&gt;</code></td><td><code>composer require &lt;name&gt;:&lt;version&gt; --no-interaction</code></td><td>安装指定版本约束</td></tr><tr><td><code>opm composer uninstall &lt;name&gt;</code></td><td><code>composer remove &lt;name&gt; --no-interaction</code></td><td>卸载包</td></tr><tr><td><code>opm composer upgrade &lt;name&gt;</code></td><td><code>composer update &lt;name&gt; --no-interaction</code></td><td>升级包</td></tr><tr><td><code>opm composer cache clean</code></td><td><code>composer clear-cache</code></td><td>清理缓存</td></tr><tr><td><code>opm composer help</code></td><td>—</td><td>显示 composer 命令清单</td></tr></tbody></table>
231
+ <table><thead><tr><th>统一命令</th><th>原始命令</th><th>说明</th></tr></thead><tbody><tr><td><code>opm composer version [name]</code></td><td><code>composer --version</code></td><td>无 name 显示 composer 本身版本;有 name 显示包在项目作用域的版本(无全局作用域,global 显示未安装)</td></tr><tr><td><code>opm composer registry</code></td><td>读 <code>~/.config/opm/config.json5</code> 的 <code>composer.registry.active</code></td><td>查询配置中的激活镜像(不读系统配置)</td></tr><tr><td><code>opm composer registry set &lt;url|preset&gt;</code></td><td>写 <code>~/.config/opm/config.json5</code> 的 <code>composer.registry.active</code></td><td>设置激活镜像(支持预设名;镜像作用于 search/info/versions 的 P2 元数据拉取)</td></tr><tr><td><code>opm composer registry presets</code></td><td>—</td><td>列出可用镜像预设</td></tr><tr><td><code>opm composer search &lt;name&gt;</code></td><td><code>{registry}/p2/{name}.json</code></td><td>查询包在源是否可用(返回最新版本 + 版本列表)</td></tr><tr><td><code>opm composer search &lt;name&gt; &lt;version&gt;</code></td><td><code>{registry}/p2/{name}.json</code></td><td>查询指定版本是否可用</td></tr><tr><td><code>opm composer view &lt;name&gt;</code></td><td>读 <code>vendor/composer/installed.json</code></td><td>查询包在项目作用域的安装信息(无全局作用域,global 显示未安装)</td></tr><tr><td><code>opm composer info &lt;name&gt;</code></td><td><code>{registry}/p2/{name}.json</code></td><td>查询包详情(描述/作者/主页/许可证等)</td></tr><tr><td><code>opm composer versions &lt;name&gt;</code></td><td><code>{registry}/p2/{name}.json</code></td><td>列出所有可用版本</td></tr><tr><td><code>opm composer install &lt;name&gt;</code></td><td><code>composer require &lt;name&gt; --no-interaction</code></td><td>安装包</td></tr><tr><td><code>opm composer install &lt;name&gt; &lt;version&gt;</code></td><td><code>composer require &lt;name&gt;:&lt;version&gt; --no-interaction</code></td><td>安装指定版本约束</td></tr><tr><td><code>opm composer uninstall &lt;name&gt;</code></td><td><code>composer remove &lt;name&gt; --no-interaction</code></td><td>卸载包</td></tr><tr><td><code>opm composer upgrade &lt;name&gt;</code></td><td><code>composer update &lt;name&gt; --no-interaction</code></td><td>升级包</td></tr><tr><td><code>opm composer cache clean</code></td><td><code>composer clear-cache</code></td><td>清理缓存</td></tr><tr><td><code>opm composer help</code></td><td>—</td><td>显示 composer 命令清单</td></tr></tbody></table>
236
232
  <h2>镜像预设</h2>
237
233
  <table><thead><tr><th>预设名</th><th>地址</th></tr></thead><tbody><tr><td><code>official</code></td><td><code>https://repo.packagist.org</code></td></tr><tr><td><code>aliyun</code></td><td><code>https://mirrors.aliyun.com/composer</code></td></tr><tr><td><code>tencent</code></td><td><code>https://mirrors.cloud.tencent.com/composer</code></td></tr></tbody></table>
238
234
  <blockquote>镜像作用于 search/info/versions 的 Packagist P2 元数据拉取(<code>{base}/p2/{vendor}/{package}.json</code>)。<br>install/upgrade 使用 composer CLI 自身的仓库配置(项目 composer.json / 全局 config)。</blockquote>
@@ -264,9 +260,6 @@ opm composer info monolog/monolog
264
260
  # 列出 monolog/monolog 所有可用版本
265
261
  opm composer versions monolog/monolog
266
262
 
267
- # 列出过期包
268
- opm composer outdated
269
-
270
263
  # 安装 monolog/monolog
271
264
  opm composer install monolog/monolog
272
265
 
@@ -303,7 +296,7 @@ opm config python.registry</code></pre></div>
303
296
  <div id="managers_dnf" class="doc-content" style="display:none;"><h1>dnf 命令对照表</h1>
304
297
  <p><code>@wwkit/opm</code> 统一命令管理 dnf 包(Fedora / RHEL / EulerOS 等 rpm 系,系统级)。</p>
305
298
  <h2>命令对照</h2>
306
- <table><thead><tr><th>统一命令</th><th>原始命令</th><th>说明</th></tr></thead><tbody><tr><td><code>opm dnf version [name]</code></td><td><code>dnf --version</code></td><td>无 name 显示 dnf 版本;有 name 显示包在全局作用域的版本(无项目作用域,project 显示未安装)</td></tr><tr><td><code>opm dnf registry</code></td><td>读 <code>/etc/yum.repos.d/opm.repo</code></td><td>查询当前启用仓库</td></tr><tr><td><code>opm dnf registry set &lt;url|preset&gt;</code></td><td>写 <code>/etc/yum.repos.d/opm.repo</code> + <code>dnf clean</code></td><td>设置镜像仓库</td></tr><tr><td><code>opm dnf registry presets</code></td><td>—</td><td>列出可用镜像预设</td></tr><tr><td><code>opm dnf search &lt;name&gt;</code></td><td><code>dnf search</code></td><td>查询包在源是否可用</td></tr><tr><td><code>opm dnf view &lt;name&gt;</code></td><td><code>dnf list installed</code></td><td>查询包在全局作用域的安装信息(无项目作用域,project 显示未安装)</td></tr><tr><td><code>opm dnf info &lt;name&gt;</code></td><td><code>dnf info</code></td><td>包详情</td></tr><tr><td><code>opm dnf versions &lt;name&gt;</code></td><td><code>dnf list --showduplicates</code></td><td>所有可用版本</td></tr><tr><td><code>opm dnf outdated</code></td><td><code>dnf check-update</code></td><td>过期包</td></tr><tr><td><code>opm dnf install &lt;name&gt;</code></td><td><code>dnf install</code></td><td>安装</td></tr><tr><td><code>opm dnf uninstall &lt;name&gt;</code></td><td><code>dnf remove</code></td><td>卸载</td></tr><tr><td><code>opm dnf upgrade &lt;name&gt;</code></td><td><code>dnf upgrade</code></td><td>升级</td></tr><tr><td><code>opm dnf cache clean</code></td><td><code>dnf clean all</code></td><td>清理缓存</td></tr></tbody></table>
299
+ <table><thead><tr><th>统一命令</th><th>原始命令</th><th>说明</th></tr></thead><tbody><tr><td><code>opm dnf version [name]</code></td><td><code>dnf --version</code></td><td>无 name 显示 dnf 版本;有 name 显示包在全局作用域的版本(无项目作用域,project 显示未安装)</td></tr><tr><td><code>opm dnf registry</code></td><td>读 <code>/etc/yum.repos.d/opm.repo</code></td><td>查询当前启用仓库</td></tr><tr><td><code>opm dnf registry set &lt;url|preset&gt;</code></td><td>写 <code>/etc/yum.repos.d/opm.repo</code> + <code>dnf clean</code></td><td>设置镜像仓库</td></tr><tr><td><code>opm dnf registry presets</code></td><td>—</td><td>列出可用镜像预设</td></tr><tr><td><code>opm dnf search &lt;name&gt;</code></td><td><code>dnf search</code></td><td>查询包在源是否可用</td></tr><tr><td><code>opm dnf view &lt;name&gt;</code></td><td><code>dnf list installed</code></td><td>查询包在全局作用域的安装信息(无项目作用域,project 显示未安装)</td></tr><tr><td><code>opm dnf info &lt;name&gt;</code></td><td><code>dnf info</code></td><td>包详情</td></tr><tr><td><code>opm dnf versions &lt;name&gt;</code></td><td><code>dnf list --showduplicates</code></td><td>所有可用版本</td></tr><tr><td><code>opm dnf install &lt;name&gt;</code></td><td><code>dnf install</code></td><td>安装</td></tr><tr><td><code>opm dnf uninstall &lt;name&gt;</code></td><td><code>dnf remove</code></td><td>卸载</td></tr><tr><td><code>opm dnf upgrade &lt;name&gt;</code></td><td><code>dnf upgrade</code></td><td>升级</td></tr><tr><td><code>opm dnf cache clean</code></td><td><code>dnf clean all</code></td><td>清理缓存</td></tr></tbody></table>
307
300
  <h2>镜像预设</h2>
308
301
  <table><thead><tr><th>预设名</th><th>地址</th></tr></thead><tbody><tr><td><code>hce</code></td><td><code>http://his-mirrors.huawei.com/install/hce/2.0/os/x86_64/</code></td></tr><tr><td><code>hce-updates</code></td><td><code>http://his-mirrors.huawei.com/install/hce/2.0/updates/x86_64/</code></td></tr><tr><td><code>fedora</code></td><td><code>https://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/</code></td></tr><tr><td><code>fedora-updates</code></td><td><code>https://download.fedoraproject.org/pub/fedora/linux/updates/$releasever/Everything/$basearch/</code></td></tr><tr><td><code>epel</code></td><td><code>https://dl.fedoraproject.org/pub/epel/$releasever/Everything/$basearch/</code></td></tr><tr><td><code>epel-testing</code></td><td><code>https://dl.fedoraproject.org/pub/epel/testing/$releasever/Everything/$basearch/</code></td></tr></tbody></table>
309
302
  <h2>示例</h2>
@@ -393,7 +386,7 @@ opm node upgrade</code></pre></div>
393
386
  <div id="managers_npm" class="doc-content" style="display:none;"><h1>npm 命令对照表</h1>
394
387
  <p><code>@wwkit/opm</code> 统一命令与 npm 原始命令的映射关系。</p>
395
388
  <h2>命令对照</h2>
396
- <table><thead><tr><th>统一命令</th><th>原始命令</th><th>说明</th></tr></thead><tbody><tr><td><code>opm npm version [name]</code></td><td><code>npm --version</code></td><td>无 name 显示 npm 本身版本;有 name 显示包在全局与项目作用域的版本</td></tr><tr><td><code>opm npm registry</code></td><td>读 <code>~/.config/opm/config.json5</code> 的 <code>npm.registry.active</code></td><td>查询配置中的激活镜像(不读系统配置)</td></tr><tr><td><code>opm npm registry set &lt;url|preset&gt;</code></td><td>写 <code>~/.config/opm/config.json5</code> 的 <code>npm.registry.active</code></td><td>设置激活镜像(支持预设名,install/upgrade 自动带 <code>--registry</code>)</td></tr><tr><td><code>opm npm registry presets</code></td><td>—</td><td>列出可用镜像预设</td></tr><tr><td><code>opm npm search &lt;name&gt;</code></td><td><code>npm view &lt;name&gt;</code></td><td>查询包在源是否可用(返回最新版本 + 版本列表)</td></tr><tr><td><code>opm npm search &lt;name&gt; &lt;version&gt;</code></td><td><code>npm view &lt;name&gt;@&lt;version&gt;</code></td><td>查询指定版本是否可用</td></tr><tr><td><code>opm npm view &lt;name&gt;</code></td><td><code>npm list &lt;name&gt;</code> / 读 <code>node_modules/&lt;name&gt;/package.json</code></td><td>查询包在全局与项目作用域的安装信息</td></tr><tr><td><code>opm npm info &lt;name&gt;</code></td><td><code>npm view &lt;name&gt;</code></td><td>查询包详情(描述/作者/主页/许可证等)</td></tr><tr><td><code>opm npm versions &lt;name&gt;</code></td><td><code>npm view &lt;name&gt; versions</code></td><td>列出所有可用版本</td></tr><tr><td><code>opm npm outdated</code></td><td><code>npm outdated</code></td><td>列出过期包</td></tr><tr><td><code>opm npm install &lt;name&gt;</code></td><td><code>npm install &lt;name&gt;</code></td><td>安装包</td></tr><tr><td><code>opm npm install &lt;name&gt; &lt;version&gt;</code></td><td><code>npm install &lt;name&gt;@&lt;version&gt;</code></td><td>安装指定版本</td></tr><tr><td><code>opm npm install -g &lt;name&gt;</code></td><td><code>npm install -g &lt;name&gt;</code></td><td>全局安装</td></tr><tr><td><code>opm npm uninstall &lt;name&gt;</code></td><td><code>npm uninstall &lt;name&gt;</code></td><td>卸载包</td></tr><tr><td><code>opm npm uninstall -g &lt;name&gt;</code></td><td><code>npm uninstall -g &lt;name&gt;</code></td><td>全局卸载</td></tr><tr><td><code>opm npm upgrade &lt;name&gt;</code></td><td><code>npm install &lt;name&gt;@latest</code></td><td>升级包到最新版本</td></tr><tr><td><code>opm npm upgrade -g &lt;name&gt;</code></td><td><code>npm install -g &lt;name&gt;@latest</code></td><td>全局升级</td></tr><tr><td><code>opm npm cache clean</code></td><td><code>npm cache clean --force</code></td><td>清理缓存</td></tr><tr><td><code>opm npm help</code></td><td>—</td><td>显示 npm 命令清单</td></tr></tbody></table>
389
+ <table><thead><tr><th>统一命令</th><th>原始命令</th><th>说明</th></tr></thead><tbody><tr><td><code>opm npm version [name]</code></td><td><code>npm --version</code></td><td>无 name 显示 npm 本身版本;有 name 显示包在全局与项目作用域的版本</td></tr><tr><td><code>opm npm registry</code></td><td>读 <code>~/.config/opm/config.json5</code> 的 <code>npm.registry.active</code></td><td>查询配置中的激活镜像(不读系统配置)</td></tr><tr><td><code>opm npm registry set &lt;url|preset&gt;</code></td><td>写 <code>~/.config/opm/config.json5</code> 的 <code>npm.registry.active</code></td><td>设置激活镜像(支持预设名,install/upgrade 自动带 <code>--registry</code>)</td></tr><tr><td><code>opm npm registry presets</code></td><td>—</td><td>列出可用镜像预设</td></tr><tr><td><code>opm npm search &lt;name&gt;</code></td><td><code>npm view &lt;name&gt;</code></td><td>查询包在源是否可用(返回最新版本 + 版本列表)</td></tr><tr><td><code>opm npm search &lt;name&gt; &lt;version&gt;</code></td><td><code>npm view &lt;name&gt;@&lt;version&gt;</code></td><td>查询指定版本是否可用</td></tr><tr><td><code>opm npm view &lt;name&gt;</code></td><td><code>npm list &lt;name&gt;</code> / 读 <code>node_modules/&lt;name&gt;/package.json</code></td><td>查询包在全局与项目作用域的安装信息</td></tr><tr><td><code>opm npm info &lt;name&gt;</code></td><td><code>npm view &lt;name&gt;</code></td><td>查询包详情(描述/作者/主页/许可证等)</td></tr><tr><td><code>opm npm versions &lt;name&gt;</code></td><td><code>npm view &lt;name&gt; versions</code></td><td>列出所有可用版本</td></tr><tr><td><code>opm npm install &lt;name&gt;</code></td><td><code>npm install &lt;name&gt;</code></td><td>安装包</td></tr><tr><td><code>opm npm install &lt;name&gt; &lt;version&gt;</code></td><td><code>npm install &lt;name&gt;@&lt;version&gt;</code></td><td>安装指定版本</td></tr><tr><td><code>opm npm install -g &lt;name&gt;</code></td><td><code>npm install -g &lt;name&gt;</code></td><td>全局安装</td></tr><tr><td><code>opm npm uninstall &lt;name&gt;</code></td><td><code>npm uninstall &lt;name&gt;</code></td><td>卸载包</td></tr><tr><td><code>opm npm uninstall -g &lt;name&gt;</code></td><td><code>npm uninstall -g &lt;name&gt;</code></td><td>全局卸载</td></tr><tr><td><code>opm npm upgrade &lt;name&gt;</code></td><td><code>npm install &lt;name&gt;@latest</code></td><td>升级包到最新版本</td></tr><tr><td><code>opm npm upgrade -g &lt;name&gt;</code></td><td><code>npm install -g &lt;name&gt;@latest</code></td><td>全局升级</td></tr><tr><td><code>opm npm cache clean</code></td><td><code>npm cache clean --force</code></td><td>清理缓存</td></tr><tr><td><code>opm npm help</code></td><td>—</td><td>显示 npm 命令清单</td></tr></tbody></table>
397
390
  <h2>镜像预设</h2>
398
391
  <table><thead><tr><th>预设名</th><th>地址</th></tr></thead><tbody><tr><td><code>official</code></td><td><code>https://registry.npmjs.org/</code></td></tr><tr><td><code>taobao</code></td><td><code>https://registry.npmmirror.com/</code></td></tr><tr><td><code>huawei</code></td><td><code>https://cmc.centralrepo.rnd.huawei.com/artifactory/api/npm/npm-central-repo/</code></td></tr></tbody></table>
399
392
  <h2>选项</h2>
@@ -424,9 +417,6 @@ opm npm info axios
424
417
  # 列出 axios 所有版本
425
418
  opm npm versions axios
426
419
 
427
- # 列出过期包
428
- opm npm outdated
429
-
430
420
  # 安装 axios
431
421
  opm npm install axios
432
422
 
@@ -497,7 +487,7 @@ opm phpenv uninstall</code></pre></div>
497
487
  <div id="managers_pip" class="doc-content" style="display:none;"><h1>pip 命令对照表</h1>
498
488
  <p><code>@wwkit/opm</code> 统一命令与 pip 原始命令的映射关系。</p>
499
489
  <h2>命令对照</h2>
500
- <table><thead><tr><th>统一命令</th><th>原始命令</th><th>说明</th></tr></thead><tbody><tr><td><code>opm pip version [name]</code></td><td><code>pip --version</code></td><td>无 name 显示 pip 本身版本;有 name 显示包在全局与项目作用域的版本</td></tr><tr><td><code>opm pip registry</code></td><td>读 <code>~/.config/opm/config.json5</code> 的 <code>pip.registry.active</code></td><td>查询配置中的激活镜像(不读系统配置)</td></tr><tr><td><code>opm pip registry set &lt;url|preset&gt;</code></td><td>写 <code>~/.config/opm/config.json5</code> 的 <code>pip.registry.active</code></td><td>设置激活镜像(支持预设名,install/upgrade 自动带 <code>--index-url</code>)</td></tr><tr><td><code>opm pip registry presets</code></td><td>—</td><td>列出可用镜像预设</td></tr><tr><td><code>opm pip search &lt;name&gt;</code></td><td>PyPI JSON API / simple index</td><td>查询包在源是否可用(返回最新版本 + 版本列表)</td></tr><tr><td><code>opm pip search &lt;name&gt; &lt;version&gt;</code></td><td>PyPI JSON API / simple index</td><td>查询指定版本是否可用</td></tr><tr><td><code>opm pip view &lt;name&gt;</code></td><td><code>pip show &lt;name&gt;</code></td><td>查询包在全局与项目作用域的安装信息</td></tr><tr><td><code>opm pip info &lt;name&gt;</code></td><td>PyPI JSON API / <code>pip show &lt;name&gt;</code></td><td>查询包详情(描述/作者/主页/许可证等)</td></tr><tr><td><code>opm pip versions &lt;name&gt;</code></td><td>PyPI JSON API / simple index</td><td>列出所有可用版本</td></tr><tr><td><code>opm pip outdated</code></td><td><code>pip list --outdated</code></td><td>列出过期包</td></tr><tr><td><code>opm pip install &lt;name&gt;</code></td><td><code>pip install &lt;name&gt;</code></td><td>安装包</td></tr><tr><td><code>opm pip install &lt;name&gt; &lt;version&gt;</code></td><td><code>pip install &lt;name&gt;==&lt;version&gt;</code></td><td>安装指定版本</td></tr><tr><td><code>opm pip uninstall &lt;name&gt;</code></td><td><code>pip uninstall -y &lt;name&gt;</code></td><td>卸载包</td></tr><tr><td><code>opm pip upgrade &lt;name&gt;</code></td><td><code>pip install --upgrade &lt;name&gt;</code></td><td>升级包到最新版本</td></tr><tr><td><code>opm pip cache clean</code></td><td><code>pip cache purge</code></td><td>清理缓存</td></tr><tr><td><code>opm pip help</code></td><td>—</td><td>显示 pip 命令清单</td></tr></tbody></table>
490
+ <table><thead><tr><th>统一命令</th><th>原始命令</th><th>说明</th></tr></thead><tbody><tr><td><code>opm pip version [name]</code></td><td><code>pip --version</code></td><td>无 name 显示 pip 本身版本;有 name 显示包在全局与项目作用域的版本</td></tr><tr><td><code>opm pip registry</code></td><td>读 <code>~/.config/opm/config.json5</code> 的 <code>pip.registry.active</code></td><td>查询配置中的激活镜像(不读系统配置)</td></tr><tr><td><code>opm pip registry set &lt;url|preset&gt;</code></td><td>写 <code>~/.config/opm/config.json5</code> 的 <code>pip.registry.active</code></td><td>设置激活镜像(支持预设名,install/upgrade 自动带 <code>--index-url</code>)</td></tr><tr><td><code>opm pip registry presets</code></td><td>—</td><td>列出可用镜像预设</td></tr><tr><td><code>opm pip search &lt;name&gt;</code></td><td>PyPI JSON API / simple index</td><td>查询包在源是否可用(返回最新版本 + 版本列表)</td></tr><tr><td><code>opm pip search &lt;name&gt; &lt;version&gt;</code></td><td>PyPI JSON API / simple index</td><td>查询指定版本是否可用</td></tr><tr><td><code>opm pip view &lt;name&gt;</code></td><td><code>pip show &lt;name&gt;</code></td><td>查询包在全局与项目作用域的安装信息</td></tr><tr><td><code>opm pip info &lt;name&gt;</code></td><td>PyPI JSON API / <code>pip show &lt;name&gt;</code></td><td>查询包详情(描述/作者/主页/许可证等)</td></tr><tr><td><code>opm pip versions &lt;name&gt;</code></td><td>PyPI JSON API / simple index</td><td>列出所有可用版本</td></tr><tr><td><code>opm pip install &lt;name&gt;</code></td><td><code>pip install &lt;name&gt;</code></td><td>安装包</td></tr><tr><td><code>opm pip install &lt;name&gt; &lt;version&gt;</code></td><td><code>pip install &lt;name&gt;==&lt;version&gt;</code></td><td>安装指定版本</td></tr><tr><td><code>opm pip uninstall &lt;name&gt;</code></td><td><code>pip uninstall -y &lt;name&gt;</code></td><td>卸载包</td></tr><tr><td><code>opm pip upgrade &lt;name&gt;</code></td><td><code>pip install --upgrade &lt;name&gt;</code></td><td>升级包到最新版本</td></tr><tr><td><code>opm pip cache clean</code></td><td><code>pip cache purge</code></td><td>清理缓存</td></tr><tr><td><code>opm pip help</code></td><td>—</td><td>显示 pip 命令清单</td></tr></tbody></table>
501
491
  <h2>镜像预设</h2>
502
492
  <table><thead><tr><th>预设名</th><th>地址</th></tr></thead><tbody><tr><td><code>official</code></td><td><code>https://pypi.org/simple</code></td></tr><tr><td><code>tsinghua</code></td><td><code>https://pypi.tuna.tsinghua.edu.cn/simple</code></td></tr><tr><td><code>huawei</code></td><td><code>https://cmc.centralrepo.rnd.huawei.com/artifactory/api/pypi/pypi-repo/simple</code></td></tr></tbody></table>
503
493
  <h2>选项</h2>
@@ -528,9 +518,6 @@ opm pip info requests
528
518
  # 列出 requests 所有版本
529
519
  opm pip versions requests
530
520
 
531
- # 列出过期包
532
- opm pip outdated
533
-
534
521
  # 安装 requests
535
522
  opm pip install requests
536
523
 
@@ -661,7 +648,7 @@ opm opencode clear --backup # 删除前备份数据库</code></pre></div
661
648
  <ul><li><strong>通过</strong>: 225</li><li><strong>失败</strong>: 3(均为 pip 网络测试,依赖 pypi.org 直连,非本次改动引入)</li><li><strong>修复</strong>: cft.test.js 配置 active 不匹配(<code>npmmirror</code> → 动态断言)</li></ul>
662
649
  <h2>二、真实环境命令测试</h2>
663
650
  <h3>已安装命令(9 个)</h3>
664
- <table><thead><tr><th>命令</th><th>动作</th><th>结果</th><th>备注</th></tr></thead><tbody><tr><td><code>opm npm</code></td><td>version</td><td>PASS</td><td>10.8.2</td></tr><tr><td>registry</td><td>PASS</td><td>npmmirror</td></tr><tr><td>installed</td><td>PASS</td></tr><tr><td>search</td><td>PASS</td><td>通过代理查询 axios</td></tr><tr><td>info</td><td>PASS</td></tr><tr><td>list</td><td>PASS</td></tr><tr><td>outdated -g</td><td>PASS</td></tr><tr><td>registry set</td><td>PASS</td><td>切换 huawei 后恢复</td></tr><tr><td><code>opm pip</code></td><td>version</td><td>PASS</td><td>21.3.1</td></tr><tr><td>registry</td><td>PASS</td><td>tsinghua</td></tr><tr><td>search</td><td>PASS</td><td>通过代理查询 requests</td></tr><tr><td>list</td><td>PASS</td></tr><tr><td>registry set</td><td>PASS</td></tr><tr><td><code>opm dnf</code></td><td>version</td><td>PASS</td><td>4.10.0</td></tr><tr><td>registry</td><td>PASS</td><td>hce</td></tr><tr><td>search</td><td>PASS</td><td>curl 返回 exists:false(HCE 源无此包,预期行为)</td></tr><tr><td><code>opm node</code></td><td>version</td><td>PASS</td><td>20.20.2</td></tr><tr><td>current</td><td>PASS</td><td>v20.20.2</td></tr><tr><td>list</td><td>PASS</td></tr><tr><td>versions</td><td>PASS</td><td>通过代理获取远程版本列表</td></tr><tr><td>use</td><td>PASS</td></tr><tr><td><code>opm nvm</code></td><td>version</td><td>PASS</td><td>0.40.4</td></tr><tr><td>installed</td><td>PASS</td></tr><tr><td>registry</td><td>PASS</td><td>huawei</td></tr><tr><td>dir</td><td>PASS</td><td>/root/.nvm</td></tr><tr><td>upgrade</td><td><strong>FAIL</strong></td><td><code>/root/.nvm</code> 非 git 仓库(git clone 安装的才支持 upgrade)</td></tr><tr><td>uninstall</td><td><strong>WARN</strong></td><td>实际执行了卸载,删除了 <code>/root/.nvm</code>,导致 node 不可用</td></tr><tr><td><code>opm config</code></td><td>(full)</td><td>PASS</td></tr><tr><td>proxy</td><td>PASS</td><td>显示 huawei 代理 + active</td></tr><tr><td><code>opm ping</code></td><td>host</td><td>PASS</td></tr><tr><td>proxy</td><td>PASS</td><td>通过代理访问 npm registry 验证可用性</td></tr><tr><td>registry</td><td>PASS</td><td>16/16 全部 reachable:true</td></tr><tr><td>source</td><td>PASS</td><td>打印 curl 示例命令</td></tr><tr><td><code>opm cft</code></td><td>version</td><td>PASS</td><td>未安装,输出空</td></tr><tr><td>dir</td><td>PASS</td></tr><tr><td>list</td><td>PASS</td></tr><tr><td>status</td><td>PASS</td></tr><tr><td>versions</td><td><strong>FAIL</strong></td><td>deepbluenet 镜像无 versions JSON 文件</td></tr><tr><td><code>opm ensure</code></td><td>node</td><td>PASS</td><td>已安装,satisfied:true</td></tr><tr><td>help</td><td>PASS</td></tr></tbody></table>
651
+ <table><thead><tr><th>命令</th><th>动作</th><th>结果</th><th>备注</th></tr></thead><tbody><tr><td><code>opm npm</code></td><td>version</td><td>PASS</td><td>10.8.2</td></tr><tr><td>registry</td><td>PASS</td><td>npmmirror</td></tr><tr><td>installed</td><td>PASS</td></tr><tr><td>search</td><td>PASS</td><td>通过代理查询 axios</td></tr><tr><td>info</td><td>PASS</td></tr><tr><td>list</td><td>PASS</td></tr><tr><td>registry set</td><td>PASS</td><td>切换 huawei 后恢复</td></tr><tr><td><code>opm pip</code></td><td>version</td><td>PASS</td><td>21.3.1</td></tr><tr><td>registry</td><td>PASS</td><td>tsinghua</td></tr><tr><td>search</td><td>PASS</td><td>通过代理查询 requests</td></tr><tr><td>list</td><td>PASS</td></tr><tr><td>registry set</td><td>PASS</td></tr><tr><td><code>opm dnf</code></td><td>version</td><td>PASS</td><td>4.10.0</td></tr><tr><td>registry</td><td>PASS</td><td>hce</td></tr><tr><td>search</td><td>PASS</td><td>curl 返回 exists:false(HCE 源无此包,预期行为)</td></tr><tr><td><code>opm node</code></td><td>version</td><td>PASS</td><td>20.20.2</td></tr><tr><td>current</td><td>PASS</td><td>v20.20.2</td></tr><tr><td>list</td><td>PASS</td></tr><tr><td>versions</td><td>PASS</td><td>通过代理获取远程版本列表</td></tr><tr><td>use</td><td>PASS</td></tr><tr><td><code>opm nvm</code></td><td>version</td><td>PASS</td><td>0.40.4</td></tr><tr><td>installed</td><td>PASS</td></tr><tr><td>registry</td><td>PASS</td><td>huawei</td></tr><tr><td>dir</td><td>PASS</td><td>/root/.nvm</td></tr><tr><td>upgrade</td><td><strong>FAIL</strong></td><td><code>/root/.nvm</code> 非 git 仓库(git clone 安装的才支持 upgrade)</td></tr><tr><td>uninstall</td><td><strong>WARN</strong></td><td>实际执行了卸载,删除了 <code>/root/.nvm</code>,导致 node 不可用</td></tr><tr><td><code>opm config</code></td><td>(full)</td><td>PASS</td></tr><tr><td>proxy</td><td>PASS</td><td>显示 huawei 代理 + active</td></tr><tr><td><code>opm ping</code></td><td>host</td><td>PASS</td></tr><tr><td>proxy</td><td>PASS</td><td>通过代理访问 npm registry 验证可用性</td></tr><tr><td>registry</td><td>PASS</td><td>16/16 全部 reachable:true</td></tr><tr><td>source</td><td>PASS</td><td>打印 curl 示例命令</td></tr><tr><td><code>opm cft</code></td><td>version</td><td>PASS</td><td>未安装,输出空</td></tr><tr><td>dir</td><td>PASS</td></tr><tr><td>list</td><td>PASS</td></tr><tr><td>status</td><td>PASS</td></tr><tr><td>versions</td><td><strong>FAIL</strong></td><td>deepbluenet 镜像无 versions JSON 文件</td></tr><tr><td><code>opm ensure</code></td><td>node</td><td>PASS</td><td>已安装,satisfied:true</td></tr><tr><td>help</td><td>PASS</td></tr></tbody></table>
665
652
  <h3>未安装命令(7 个)</h3>
666
653
  <table><thead><tr><th>命令</th><th>动作</th><th>结果</th><th>备注</th></tr></thead><tbody><tr><td><code>opm uv</code></td><td>version</td><td>PASS</td><td>未安装,输出空</td></tr><tr><td>installed</td><td>PASS</td><td>false</td></tr><tr><td>registry</td><td>PASS</td><td>ghproxy</td></tr><tr><td>install</td><td><strong>FAIL</strong></td><td>超时——curl 未走代理,无法访问 ghproxy.com</td></tr><tr><td><code>opm python</code></td><td>version</td><td>PASS</td><td>3.9.9(系统 python)</td></tr><tr><td>current</td><td>PASS</td></tr><tr><td>versions</td><td><strong>FAIL</strong></td><td>uv 未安装,预期行为</td></tr><tr><td><code>opm phpenv</code></td><td>version</td><td>PASS</td><td>未安装,输出空</td></tr><tr><td>installed</td><td>PASS</td><td>false</td></tr><tr><td><code>opm php</code></td><td>version</td><td>PASS</td><td>未安装,输出空</td></tr><tr><td>versions</td><td><strong>FAIL</strong></td><td>phpenv 未安装,预期行为</td></tr><tr><td><code>opm composer</code></td><td>version</td><td>PASS</td><td>未安装,输出空</td></tr><tr><td>registry</td><td>PASS</td><td>aliyun</td></tr><tr><td><code>opm bun</code></td><td>version</td><td>PASS</td><td>未安装,输出空</td></tr><tr><td>registry</td><td>PASS</td><td>npmmirror</td></tr><tr><td><code>opm docker</code></td><td>version</td><td>PASS</td><td>未安装,输出空</td></tr><tr><td>installed</td><td>PASS</td><td>false</td></tr><tr><td>registry</td><td>PASS</td><td>huawei</td></tr><tr><td>status</td><td>PASS</td><td>installed:false</td></tr><tr><td>dir</td><td>PASS</td></tr><tr><td>install</td><td><strong>SKIP</strong></td><td>需要网络下载便捷脚本,未测(避免修改系统)</td></tr></tbody></table>
667
654
  <h2>三、发现的问题</h2>
@@ -30,7 +30,6 @@ node --test tests/
30
30
  | | search | PASS | 通过代理查询 axios |
31
31
  | | info | PASS | |
32
32
  | | list | PASS | |
33
- | | outdated -g | PASS | |
34
33
  | | registry set | PASS | 切换 huawei 后恢复 |
35
34
  | `opm pip` | version | PASS | 21.3.1 |
36
35
  | | registry | PASS | tsinghua |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wwkit/opm",
3
- "version": "1.0.15",
3
+ "version": "1.0.17",
4
4
  "author": "bluesliu <langcai163@163.com>",
5
5
  "description": "Unified CLI — package management (npm/pip/dnf/apt) + config view + opencode maintenance",
6
6
  "type": "module",
@@ -35,7 +35,7 @@
35
35
  "basic-ftp": "^6.2.1",
36
36
  "extract-zip": "^2.0.1",
37
37
  "systeminformation": "^5.23.0",
38
- "@wwkit/shared": "1.0.20"
38
+ "@wwkit/shared": "1.0.22"
39
39
  },
40
40
  "devDependencies": {
41
41
  "jest": "^29.7.0"
@@ -57,7 +57,6 @@ const ACTIONS = {
57
57
  view: { desc: 'Check package in global and project scopes' },
58
58
  info: { desc: 'Show package details' },
59
59
  versions: { desc: 'List all available versions of a package' },
60
- outdated: { desc: 'List outdated packages' },
61
60
  install: { desc: 'Install a package' },
62
61
  uninstall: { desc: 'Uninstall a package' },
63
62
  upgrade: { desc: 'Upgrade a package' },
@@ -99,6 +98,27 @@ export class PackageGroup {
99
98
  await this._dispatch(manager, action, parsed, { global, proxy })
100
99
  }
101
100
 
101
+ /**
102
+ * 打印当前 registry 和 proxy(诊断信息,输出到 stderr)
103
+ * 在涉及网络请求的命令执行前调用,便于连接失败时定位。
104
+ * 输出到 stderr 不污染 JSON stdout。
105
+ * registry 通过 getEffectiveRegistry() 解析,含管理器自身配置回退(opm 配置 → 管理器全局配置 → 官方源)
106
+ * @param {PackageManager} manager
107
+ * @param {string} [proxy]
108
+ * @private
109
+ */
110
+ async _printEndpoint(manager, proxy) {
111
+ try {
112
+ const { registry } = await manager.getEffectiveRegistry()
113
+ if (registry) {
114
+ console.error(`[opm] registry: ${registry}`)
115
+ }
116
+ } catch {}
117
+ if (proxy) {
118
+ console.error(`[opm] proxy: ${proxy}`)
119
+ }
120
+ }
121
+
102
122
  async _dispatch(manager, action, parsed, opts) {
103
123
  const { positional } = parsed
104
124
 
@@ -152,6 +172,7 @@ export class PackageGroup {
152
172
  console.error(`Usage: opm ${this.name} search <name> [version]`)
153
173
  process.exit(1)
154
174
  }
175
+ await this._printEndpoint(manager, opts.proxy)
155
176
  const result = await manager.searchPackage(name, version, { proxy: opts.proxy })
156
177
  output(result)
157
178
  break
@@ -174,6 +195,7 @@ export class PackageGroup {
174
195
  console.error(`Usage: opm ${this.name} info <name>`)
175
196
  process.exit(1)
176
197
  }
198
+ await this._printEndpoint(manager, opts.proxy)
177
199
  const result = await manager.packageInfo(name, { proxy: opts.proxy })
178
200
  output(result)
179
201
  break
@@ -185,17 +207,12 @@ export class PackageGroup {
185
207
  console.error(`Usage: opm ${this.name} versions <name>`)
186
208
  process.exit(1)
187
209
  }
210
+ await this._printEndpoint(manager, opts.proxy)
188
211
  const result = await manager.packageVersions(name, { proxy: opts.proxy })
189
212
  output(result)
190
213
  break
191
214
  }
192
215
 
193
- case 'outdated': {
194
- const result = await manager.listOutdated({ global: !!opts.global, proxy: opts.proxy })
195
- output(result)
196
- break
197
- }
198
-
199
216
  case 'install': {
200
217
  const name = positional[0]
201
218
  const version = positional[1]
@@ -203,6 +220,7 @@ export class PackageGroup {
203
220
  console.error(`Usage: opm ${this.name} install <name> [version]`)
204
221
  process.exit(1)
205
222
  }
223
+ await this._printEndpoint(manager, opts.proxy)
206
224
  const result = await manager.install(name, version, { global: !!opts.global, proxy: opts.proxy })
207
225
  output(result)
208
226
  break
@@ -225,6 +243,7 @@ export class PackageGroup {
225
243
  console.error(`Usage: opm ${this.name} upgrade <name>`)
226
244
  process.exit(1)
227
245
  }
246
+ await this._printEndpoint(manager, opts.proxy)
228
247
  const result = await manager.upgrade(name, { global: !!opts.global, proxy: opts.proxy })
229
248
  output(result)
230
249
  break
@@ -266,7 +285,6 @@ Actions:
266
285
  view <name> Show package in global and project scopes
267
286
  info <name> Show package details
268
287
  versions <name> List all available versions
269
- outdated [-g] List outdated packages
270
288
  install <name> [version] Install a package
271
289
  uninstall <name> Uninstall a package
272
290
  upgrade <name> Upgrade a package to latest
@@ -276,7 +294,7 @@ Actions:
276
294
 
277
295
  Options:
278
296
  -g, --global Global operation (npm: global node_modules; pip: system Python)
279
- -p, --proxy <url> Proxy address (search/info/versions/outdated/install/upgrade);
297
+ -p, --proxy <url> Proxy address (search/info/versions/install/upgrade);
280
298
  overrides config proxy.active when provided
281
299
  -h, --help Show this help
282
300
 
@@ -287,7 +305,6 @@ Examples:
287
305
  opm ${this.name} view <name>
288
306
  opm ${this.name} info <name>
289
307
  opm ${this.name} versions <name>
290
- opm ${this.name} outdated
291
308
  opm ${this.name} install <name>
292
309
  opm ${this.name} uninstall <name>
293
310
  opm ${this.name} upgrade <name>
@@ -438,12 +455,14 @@ export class RuntimeGroup extends PackageGroup {
438
455
  console.error(`Usage: opm ${this.name} install <version>`)
439
456
  process.exit(1)
440
457
  }
458
+ await this._printEndpoint(manager, opts.proxy)
441
459
  const result = await manager.install(this.name, version, { proxy: opts.proxy })
442
460
  output(result)
443
461
  break
444
462
  }
445
463
 
446
464
  case 'upgrade': {
465
+ await this._printEndpoint(manager, opts.proxy)
447
466
  const result = await manager.upgrade(this.name, { proxy: opts.proxy })
448
467
  output(result)
449
468
  break
@@ -455,12 +474,14 @@ export class RuntimeGroup extends PackageGroup {
455
474
  console.error(`Usage: opm ${this.name} search <version>`)
456
475
  process.exit(1)
457
476
  }
477
+ await this._printEndpoint(manager, opts.proxy)
458
478
  const result = await manager.searchPackage(this.name, version, { proxy: opts.proxy })
459
479
  output(result)
460
480
  break
461
481
  }
462
482
 
463
483
  case 'versions': {
484
+ await this._printEndpoint(manager, opts.proxy)
464
485
  const result = await manager.packageVersions(this.name, { proxy: opts.proxy })
465
486
  output(result)
466
487
  break
package/src/cli/index.js CHANGED
@@ -132,7 +132,7 @@ ${groupLines}
132
132
 
133
133
  Options:
134
134
  -g, --global Global operation (npm: global node_modules; pip: system Python)
135
- -p, --proxy <url> Proxy address (search/info/versions/outdated/install/upgrade)
135
+ -p, --proxy <url> Proxy address (search/info/versions/install/upgrade)
136
136
  -h, --help Show help
137
137
 
138
138
  Run "opm <command> help" for command details.
package/src/config.json5 CHANGED
@@ -30,8 +30,8 @@
30
30
  registry: {
31
31
  official: "https://pypi.org/simple",
32
32
  tsinghua: "https://pypi.tuna.tsinghua.edu.cn/simple",
33
- huawei: "https://cmc.centralrepo.rnd.huawei.com/artifactory/api/pypi/pypi-repo/simple",
34
- active: "tsinghua",
33
+ huawei: "https://mirrors.huaweicloud.com/repository/pypi/simple/",
34
+ active: "huawei",
35
35
  },
36
36
  },
37
37
 
@@ -326,23 +326,6 @@ export class AptManager extends PackageManager {
326
326
  return { name, versions, registry }
327
327
  }
328
328
 
329
- async listOutdated(opts = {}) {
330
- const out = this._exec(['list', '--upgradable', ...this._proxyArgs(opts.proxy)], { allowNonZero: true })
331
- const items = []
332
- for (const line of this._parseLines(out)) {
333
- const m = line.match(/^(\S+?)\/(\S+)\s+(\S+)\s+(\S+)\s+\[(.*?)\]$/)
334
- if (m) {
335
- const from = m[5].match(/upgradable from:\s*(\S+)/)
336
- items.push({
337
- name: m[1],
338
- current: from ? from[1] : '',
339
- latest: m[3]
340
- })
341
- }
342
- }
343
- return items
344
- }
345
-
346
329
  async install(name, version, opts = {}) {
347
330
  const spec = version ? `${name}=${version}` : name
348
331
  const args = ['get', 'install', '-y', spec, ...this._proxyArgs(opts.proxy)]
@@ -30,12 +30,6 @@
30
30
  * @typedef {Object} InstalledItem
31
31
  * @property {string} name - 包名
32
32
  * @property {string} version - 版本
33
- *
34
- * @typedef {Object} OutdatedItem
35
- * @property {string} name - 包名
36
- * @property {string} current - 当前版本
37
- * @property {string} [wanted] - 期望版本
38
- * @property {string} latest - 最新版本
39
33
  */
40
34
  export class PackageManager {
41
35
  constructor() {
@@ -58,6 +52,16 @@ export class PackageManager {
58
52
  throw new Error(`${this.name}: getRegistry not implemented`)
59
53
  }
60
54
 
55
+ /**
56
+ * 查询生效的 registry 地址(打印诊断用)
57
+ * 默认委托 getRegistry();子类可覆写以增加管理器自身配置回退。
58
+ * 仅用于 _printEndpoint 打印,不影响实际 install/upgrade 的 registry 传参。
59
+ * @returns {Promise<{ registry: string }>}
60
+ */
61
+ async getEffectiveRegistry() {
62
+ return this.getRegistry()
63
+ }
64
+
61
65
  /**
62
66
  * 设置镜像地址
63
67
  * @param {string} url - 镜像 URL 或预设名
@@ -132,15 +136,6 @@ export class PackageManager {
132
136
  throw new Error(`${this.name}: listInstalled not implemented`)
133
137
  }
134
138
 
135
- /**
136
- * 列出过期包
137
- * @param {{ global?: boolean, proxy?: string }} [opts] - 选项
138
- * @returns {Promise<OutdatedItem[]>}
139
- */
140
- async listOutdated(opts) {
141
- throw new Error(`${this.name}: listOutdated not implemented`)
142
- }
143
-
144
139
  /**
145
140
  * 安装包
146
141
  * @param {string} name - 包名
@@ -214,33 +214,6 @@ export class BrewManager extends PackageManager {
214
214
  return items
215
215
  }
216
216
 
217
- /**
218
- * 解析 brew outdated --json=v2 输出为过期项数组(formulae + casks)
219
- * @param {string} text
220
- * @returns {{ name: string, current: string, latest: string }[]}
221
- * @private
222
- */
223
- _parseOutdatedJson(text) {
224
- let data
225
- try {
226
- data = JSON.parse(text)
227
- } catch {
228
- return []
229
- }
230
- const items = []
231
- for (const group of ['formulae', 'casks']) {
232
- const list = Array.isArray(data[group]) ? data[group] : []
233
- for (const item of list) {
234
- items.push({
235
- name: item.name,
236
- current: (Array.isArray(item.installed_versions) ? item.installed_versions : []).join(', '),
237
- latest: item.current_version || '',
238
- })
239
- }
240
- }
241
- return items
242
- }
243
-
244
217
  async getVersion() {
245
218
  try {
246
219
  const out = this._exec(['--version'], { allowNonZero: true })
@@ -341,11 +314,6 @@ export class BrewManager extends PackageManager {
341
314
  return { name, versions, registry }
342
315
  }
343
316
 
344
- async listOutdated(opts = {}) {
345
- const out = this._exec(['outdated', '--json=v2'], { allowNonZero: true, proxy: opts.proxy })
346
- return this._parseOutdatedJson(out)
347
- }
348
-
349
317
  async install(name, version, opts = {}) {
350
318
  if (!isHomebrewInstalled()) {
351
319
  console.log('[opm] Homebrew not installed, auto-installing...')
@@ -242,30 +242,6 @@ export class BunManager extends PackageManager {
242
242
  return { name, versions, registry }
243
243
  }
244
244
 
245
- async listOutdated(opts = {}) {
246
- const args = ['outdated']
247
- if (opts.global) args.push('-g')
248
- try {
249
- const out = this._exec(args, { allowNonZero: true, proxy: opts.proxy })
250
- const items = []
251
- const lines = out.split('\n')
252
- for (const line of lines) {
253
- const parts = line.trim().split(/\s+/)
254
- if (parts.length >= 3 && parts[0] !== 'package' && parts[0] !== 'name') {
255
- items.push({
256
- name: parts[0],
257
- current: parts[1] || 'unknown',
258
- wanted: parts[1] || '',
259
- latest: parts[2] || 'unknown',
260
- })
261
- }
262
- }
263
- return items
264
- } catch {
265
- return []
266
- }
267
- }
268
-
269
245
  async install(name, version, opts = {}) {
270
246
  const spec = version ? `${name}@${version}` : name
271
247
  const args = ['add', spec]
@@ -162,6 +162,31 @@ export class ComposerManager extends PackageManager {
162
162
  return { registry: getActiveRegistry('composer') }
163
163
  }
164
164
 
165
+ /**
166
+ * 查询生效的 registry(打印诊断用)
167
+ * 回退链:opm 配置 → composer config --global repo.packagist → 官方源
168
+ * 仅用于 _printEndpoint 打印,不影响实际 install/upgrade 的仓库配置
169
+ * @returns {Promise<{ registry: string }>}
170
+ */
171
+ async getEffectiveRegistry() {
172
+ let registry = getActiveRegistry('composer')
173
+ if (!registry) {
174
+ try {
175
+ const out = this._exec(['config', '--global', 'repo.packagist'], { allowNonZero: true }).trim()
176
+ try {
177
+ const data = JSON.parse(out)
178
+ registry = data.url || ''
179
+ } catch {
180
+ if (out) registry = out
181
+ }
182
+ } catch {}
183
+ }
184
+ if (!registry) {
185
+ registry = 'https://repo.packagist.org'
186
+ }
187
+ return { registry }
188
+ }
189
+
165
190
  async setRegistry(url) {
166
191
  const resolved = setActiveRegistry('composer', url)
167
192
  return { registry: resolved }
@@ -298,21 +323,6 @@ export class ComposerManager extends PackageManager {
298
323
  return { name, versions, registry }
299
324
  }
300
325
 
301
- async listOutdated(opts = {}) {
302
- const out = this._exec(['outdated', '--format=json'], { allowNonZero: true, proxy: opts.proxy })
303
- try {
304
- const data = JSON.parse(out)
305
- const installed = Array.isArray(data.installed) ? data.installed : []
306
- return installed.map((item) => ({
307
- name: item.name,
308
- current: item.version || '',
309
- latest: item.latest || '',
310
- }))
311
- } catch {
312
- return []
313
- }
314
- }
315
-
316
326
  async install(name, version, opts = {}) {
317
327
  const spec = version ? `${name}:${version}` : name
318
328
  this._execInherit(['require', spec, '--no-interaction'], { proxy: opts.proxy })
@@ -319,23 +319,6 @@ export class DnfManager extends PackageManager {
319
319
  return { name, versions, registry }
320
320
  }
321
321
 
322
- async listOutdated(opts = {}) {
323
- const args = ['list', '--upgrades', ...this._proxyArgs(opts.proxy)]
324
- const out = this._exec(args, { allowNonZero: true })
325
- const items = []
326
- for (const line of this._parseLines(out)) {
327
- const parts = line.split(/\s+/)
328
- if (parts.length >= 3 && parts[1].includes('-')) {
329
- items.push({
330
- name: parts[0].replace(ARCH_SUFFIX, ''),
331
- current: parts[1],
332
- latest: parts[2]
333
- })
334
- }
335
- }
336
- return items
337
- }
338
-
339
322
  async install(name, version, opts = {}) {
340
323
  const spec = version ? `${name}-${version}` : name
341
324
  const args = ['install', '-y', spec, ...this._proxyArgs(opts.proxy)]
@@ -96,6 +96,25 @@ export class NpmManager extends PackageManager {
96
96
  return { registry: getActiveRegistry('npm') }
97
97
  }
98
98
 
99
+ /**
100
+ * 查询生效的 registry(打印诊断用)
101
+ * 回退链:opm 配置 → npm config get registry → 官方源
102
+ * 仅用于 _printEndpoint 打印,不影响实际 install/upgrade 的 --registry 传参
103
+ * @returns {Promise<{ registry: string }>}
104
+ */
105
+ async getEffectiveRegistry() {
106
+ let registry = getActiveRegistry('npm')
107
+ if (!registry) {
108
+ try {
109
+ registry = this._exec(['config', 'get', 'registry'], { allowNonZero: true }).trim()
110
+ } catch {}
111
+ }
112
+ if (!registry) {
113
+ registry = 'https://registry.npmjs.org/'
114
+ }
115
+ return { registry }
116
+ }
117
+
99
118
  async getVersion() {
100
119
  try {
101
120
  const version = this._exec(['--version'], { allowNonZero: true }).trim()
@@ -422,26 +441,6 @@ export class NpmManager extends PackageManager {
422
441
  return { name, versions: [], registry }
423
442
  }
424
443
 
425
- async listOutdated(opts = {}) {
426
- try {
427
- const args = ['outdated']
428
- if (opts.global) args.push('-g')
429
- args.push(...this._proxyArgs(opts.proxy))
430
- args.push(...this._registryArgs())
431
- const data = this._execJson(args)
432
- if (!data) return []
433
- const items = Object.entries(data).map(([name, info]) => ({
434
- name,
435
- current: info.current || 'missing',
436
- wanted: info.wanted || '',
437
- latest: info.latest || ''
438
- }))
439
- return items
440
- } catch (err) {
441
- throw new Error(`npm outdated failed: ${err.message}`)
442
- }
443
- }
444
-
445
444
  /**
446
445
  * 查询 npm 主版本号(缓存),用于判断是否支持 --allow-scripts(npm >= 11)
447
446
  * @returns {number}
@@ -277,6 +277,25 @@ export class PipManager extends PackageManager {
277
277
  return { registry }
278
278
  }
279
279
 
280
+ /**
281
+ * 查询生效的 registry(打印诊断用)
282
+ * 回退链:opm 配置 → pip config get global.index-url → 官方源
283
+ * 仅用于 _printEndpoint 打印,不影响实际 install/upgrade 的 --index-url 传参
284
+ * @returns {Promise<{ registry: string }>}
285
+ */
286
+ async getEffectiveRegistry() {
287
+ let registry = getActiveRegistry('pip')
288
+ if (!registry) {
289
+ try {
290
+ registry = this._exec(['config', 'get', 'global.index-url'], { allowNonZero: true }).trim()
291
+ } catch {}
292
+ }
293
+ if (!registry) {
294
+ registry = 'https://pypi.org/simple'
295
+ }
296
+ return { registry }
297
+ }
298
+
280
299
  async getVersion() {
281
300
  try {
282
301
  const out = this._exec(['--version'], { allowNonZero: true }).trim()
@@ -511,27 +530,6 @@ export class PipManager extends PackageManager {
511
530
  return { name, versions: [], registry }
512
531
  }
513
532
 
514
- async listOutdated(opts = {}) {
515
- try {
516
- const args = ['list', '--outdated', '--format=json']
517
- if (opts.proxy) args.push('--proxy', opts.proxy)
518
- const jsonOut = this._execPip(args, { ...opts, allowNonZero: true })
519
- const parsed = JSON.parse(jsonOut)
520
- if (!Array.isArray(parsed)) return []
521
- return parsed.map((item) => ({
522
- name: item.name || '',
523
- current: item.version || '',
524
- latest: item.latest_version || '',
525
- ...(opts.global ? { global: true } : {})
526
- }))
527
- } catch (err) {
528
- if (err.message.includes('No packages') || err.message.includes('No broken')) {
529
- return []
530
- }
531
- throw new Error(`pip list --outdated failed: ${err.message}`)
532
- }
533
- }
534
-
535
533
  async install(name, version, opts = {}) {
536
534
  const spec = version ? `${name}==${version}` : name
537
535
  const args = ['install', spec]
@@ -237,10 +237,6 @@ export class RuntimeManager extends PackageManager {
237
237
  return this._parseInstalled(out)
238
238
  }
239
239
 
240
- async listOutdated(opts = {}) {
241
- return []
242
- }
243
-
244
240
  async install(name, version, opts = {}) {
245
241
  if (!version) {
246
242
  throw new Error(this.cfg.installUsage)
@@ -221,20 +221,6 @@ export class WingetManager extends PackageManager {
221
221
  }
222
222
  }
223
223
 
224
- async listOutdated(opts = {}) {
225
- const out = this._exec(
226
- ['list', '--upgrade-available', '--accept-source-agreements', '--disable-interactivity'],
227
- { allowNonZero: true }
228
- )
229
- return this._parseTable(out).map((r) => ({
230
- name: r.Name || r.Id,
231
- id: r.Id,
232
- current: r.Version || '',
233
- latest: r.Available || '',
234
- source: r.Source || '',
235
- }))
236
- }
237
-
238
224
  async install(name, version, opts = {}) {
239
225
  const args = ['install', name, '--accept-package-agreements', '--accept-source-agreements']
240
226
  if (version) args.push('--version', version)
@@ -6,8 +6,8 @@
6
6
  *
7
7
  * install 流程(5 步):
8
8
  * 镜像检查(必查 npm/pip + 按需 nvm/node/uv) → ensure node/python → 写 NPM/PIP_REGISTRY/REGISTRY_PROXY → 装 blues-lib → ww init
9
- * upgrade 流程(4 步):
10
- * 镜像检查(必查 npm/pip) → 写 NPM/PIP_REGISTRY/REGISTRY_PROXY → pip 升级 blues-lib → ww init -u
9
+ * upgrade 流程(3 步):
10
+ * 镜像检查(必查 npm/pip) → 写 NPM/PIP_REGISTRY/REGISTRY_PROXY → ww upgrade
11
11
  *
12
12
  * 命令: version / versions / installed / install / uninstall / upgrade / help
13
13
  */
@@ -37,7 +37,7 @@ const ACTIONS = {
37
37
  installed: { desc: 'Show install status (true/false) of each component' },
38
38
  install: { desc: 'Mirror check + ensure runtime + write registry env + blues-lib + ww init' },
39
39
  uninstall: { desc: 'Uninstall all components in reverse order' },
40
- upgrade: { desc: 'Upgrade blues-lib + ww init -u' },
40
+ upgrade: { desc: 'Mirror check + write registry env + ww upgrade' },
41
41
  help: { desc: 'Show this help' },
42
42
  }
43
43
 
@@ -204,26 +204,22 @@ export class WebworkGroup {
204
204
  async _upgrade(parsed) {
205
205
  const proxy = this._resolveProxy(parsed)
206
206
 
207
- console.log('\n========== 步骤 1/4: 镜像可达检查 ==========')
207
+ console.log('\n========== 步骤 1/3: 镜像可达检查 ==========')
208
208
  await this._checkMirrors(proxy, null)
209
209
 
210
- console.log('\n========== 步骤 2/4: 写入 NPM_REGISTRY / PIP_REGISTRY / REGISTRY_PROXY ==========')
210
+ console.log('\n========== 步骤 2/3: 写入 NPM_REGISTRY / PIP_REGISTRY / REGISTRY_PROXY ==========')
211
211
  this._writeRegistryEnv(proxy)
212
212
 
213
- console.log('\n========== 步骤 3/4: 升级 blues-lib ==========')
214
- const blue = await this._upgradePipPackage('blues-lib', proxy)
215
- console.log(` ✓ blues-lib 升级完成`)
213
+ console.log('\n========== 步骤 3/3: ww upgrade ==========')
214
+ this._runWwInit('upgrade')
216
215
 
217
- console.log('\n========== 步骤 4/4: ww init -u ==========')
218
- this._runWwInit('init -u')
219
-
220
- output({ action: 'upgrade', bluesLib: blue, init: 'ww init -u' })
216
+ output({ action: 'upgrade', upgrade: 'ww upgrade' })
221
217
  }
222
218
 
223
219
  /**
224
- * 执行 ww init/init -u
220
+ * 执行 ww init / init -u / upgrade
225
221
  * 镜像与代理配置通过 NPM_REGISTRY/PIP_REGISTRY/REGISTRY_PROXY 环境变量传递(见 _writeRegistryEnv)
226
- * @param {string} action - 'init' 或 'init -u'
222
+ * @param {string} action - 'init' / 'init -u' / 'upgrade'
227
223
  * @private
228
224
  */
229
225
  _runWwInit(action) {
@@ -539,7 +535,7 @@ Examples:
539
535
  opm webwork installed Show install status of all components
540
536
  opm webwork install Mirror check + ensure runtime + registry env + blues-lib + ww init
541
537
  opm webwork uninstall Uninstall all components in reverse order
542
- opm webwork upgrade Upgrade blues-lib + ww init -u
538
+ opm webwork upgrade Mirror check + write registry env + ww upgrade
543
539
  `)
544
540
  }
545
541
  }