Metadata-Version: 2.5
Name: envxx
Version: 1.9.0
Summary: Portable multi-runtime manager for Python, Node.js and friends
License:                                  Apache License
                                   Version 2.0, January 2004
                                http://www.apache.org/licenses/
        
           TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
        
           1. Definitions.
        
              "License" shall mean the terms and conditions for use, reproduction,
              and distribution as defined by Sections 1 through 9 of this document.
        
              "Licensor" shall mean the copyright owner or entity authorized by
              the copyright owner that is granting the License.
        
              "Legal Entity" shall mean the union of the acting entity and all
              other entities that control, are controlled by, or are under common
              control with that entity. For the purposes of this definition,
              "control" means (i) the power, direct or indirect, to cause the
              direction or management of such entity, whether by contract or
              otherwise, or (ii) ownership of fifty percent (50%) or more of the
              outstanding shares, or (iii) beneficial ownership of such entity.
        
              "You" (or "Your") shall mean an individual or Legal Entity
              exercising permissions granted by this License.
        
              "Source" form shall mean the preferred form for making modifications,
              including but not limited to software source code, documentation
              source, and configuration files.
        
              "Object" form shall mean any form resulting from mechanical
              transformation or translation of a Source form, including but
              not limited to compiled object code, generated documentation,
              and conversions to other media types.
        
              "Work" shall mean the work of authorship, whether in Source or
              Object form, made available under the License, as indicated by a
              copyright notice that is included in or attached to the work
              (an example is provided in the Appendix below).
        
              "Derivative Works" shall mean any work, whether in Source or Object
              form, that is based on (or derived from) the Work and for which the
              editorial revisions, annotations, elaborations, or other modifications
              represent, as a whole, an original work of authorship. For the purposes
              of this License, Derivative Works shall not include works that remain
              separable from, or merely link (or bind by name) to the interfaces of,
              the Work and Derivative Works thereof.
        
              "Contribution" shall mean any work of authorship, including
              the original version of the Work and any modifications or additions
              to that Work or Derivative Works thereof, that is intentionally
              submitted to Licensor for inclusion in the Work by the copyright owner
              or by an individual or Legal Entity authorized to submit on behalf of
              the copyright owner. For the purposes of this definition, "submitted"
              means any form of electronic, verbal, or written communication sent
              to the Licensor or its representatives, including but not limited to
              communication on electronic mailing lists, source code control systems,
              and issue tracking systems that are managed by, or on behalf of, the
              Licensor for the purpose of discussing and improving the Work, but
              excluding communication that is conspicuously marked or otherwise
              designated in writing by the copyright owner as "Not a Contribution."
        
              "Contributor" shall mean Licensor and any individual or Legal Entity
              on behalf of whom a Contribution has been received by Licensor and
              subsequently incorporated within the Work.
        
           2. Grant of Copyright License. Subject to the terms and conditions of
              this License, each Contributor hereby grants to You a perpetual,
              worldwide, non-exclusive, no-charge, royalty-free, irrevocable
              copyright license to reproduce, prepare Derivative Works of,
              publicly display, publicly perform, sublicense, and distribute the
              Work and such Derivative Works in Source or Object form.
        
           3. Grant of Patent License. Subject to the terms and conditions of
              this License, each Contributor hereby grants to You a perpetual,
              worldwide, non-exclusive, no-charge, royalty-free, irrevocable
              (except as stated in this section) patent license to make, have made,
              use, offer to sell, sell, import, and otherwise transfer the Work,
              where such license applies only to those patent claims licensable
              by such Contributor that are necessarily infringed by their
              Contribution(s) alone or by combination of their Contribution(s)
              with the Work to which such Contribution(s) was submitted. If You
              institute patent litigation against any entity (including a
              cross-claim or counterclaim in a lawsuit) alleging that the Work
              or a Contribution incorporated within the Work constitutes direct
              or contributory patent infringement, then any patent licenses
              granted to You under this License for that Work shall terminate
              as of the date such litigation is filed.
        
           4. Redistribution. You may reproduce and distribute copies of the
              Work or Derivative Works thereof in any medium, with or without
              modifications, and in Source or Object form, provided that You
              meet the following conditions:
        
              (a) You must give any other recipients of the Work or
                  Derivative Works a copy of this License; and
        
              (b) You must cause any modified files to carry prominent notices
                  stating that You changed the files; and
        
              (c) You must retain, in the Source form of any Derivative Works
                  that You distribute, all copyright, patent, trademark, and
                  attribution notices from the Source form of the Work,
                  excluding those notices that do not pertain to any part of
                  the Derivative Works; and
        
              (d) If the Work includes a "NOTICE" text file as part of its
                  distribution, then any Derivative Works that You distribute must
                  include a readable copy of the attribution notices contained
                  within such NOTICE file, excluding those notices that do not
                  pertain to any part of the Derivative Works, in at least one
                  of the following places: within a NOTICE text file distributed
                  as part of the Derivative Works; within the Source form or
                  documentation, if provided along with the Derivative Works; or,
                  within a display generated by the Derivative Works, if and
                  wherever such third-party notices normally appear. The contents
                  of the NOTICE file are for informational purposes only and
                  do not modify the License. You may add Your own attribution
                  notices within Derivative Works that You distribute, alongside
                  or as an addendum to the NOTICE text from the Work, provided
                  that such additional attribution notices cannot be construed
                  as modifying the License.
        
              You may add Your own copyright statement to Your modifications and
              may provide additional or different license terms and conditions
              for use, reproduction, or distribution of Your modifications, or
              for any such Derivative Works as a whole, provided Your use,
              reproduction, and distribution of the Work otherwise complies with
              the conditions stated in this License.
        
           5. Submission of Contributions. Unless You explicitly state otherwise,
              any Contribution intentionally submitted for inclusion in the Work
              by You to the Licensor shall be under the terms and conditions of
              this License, without any additional terms or conditions.
              Notwithstanding the above, nothing herein shall supersede or modify
              the terms of any separate license agreement you may have executed
              with Licensor regarding such Contributions.
        
           6. Trademarks. This License does not grant permission to use the trade
              names, trademarks, service marks, or product names of the Licensor,
              except as required for reasonable and customary use in describing the
              origin of the Work and reproducing the content of the NOTICE file.
        
           7. Disclaimer of Warranty. Unless required by applicable law or
              agreed to in writing, Licensor provides the Work (and each
              Contributor provides its Contributions) on an "AS IS" BASIS,
              WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
              implied, including, without limitation, any warranties or conditions
              of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
              PARTICULAR PURPOSE. You are solely responsible for determining the
              appropriateness of using or redistributing the Work and assume any
              risks associated with Your exercise of permissions under this License.
        
           8. Limitation of Liability. In no event and under no legal theory,
              whether in tort (including negligence), contract, or otherwise,
              unless required by applicable law (such as deliberate and grossly
              negligent acts) or agreed to in writing, shall any Contributor be
              liable to You for damages, including any direct, indirect, special,
              incidental, or consequential damages of any character arising as a
              result of this License or out of the use or inability to use the
              Work (including but not limited to damages for loss of goodwill,
              work stoppage, computer failure or malfunction, or any and all
              other commercial damages or losses), even if such Contributor
              has been advised of the possibility of such damages.
        
           9. Accepting Warranty or Additional Liability. While redistributing
              the Work or Derivative Works thereof, You may choose to offer,
              and charge a fee for, acceptance of support, warranty, indemnity,
              or other liability obligations and/or rights consistent with this
              License. However, in accepting such obligations, You may act only
              on Your own behalf and on Your sole responsibility, not on behalf
              of any other Contributor, and only if You agree to indemnify,
              defend, and hold each Contributor harmless for any liability
              incurred by, or claims asserted against, such Contributor by reason
              of your accepting any such warranty or additional liability.
        
           END OF TERMS AND CONDITIONS
        
           APPENDIX: How to apply the Apache License to your work.
        
              To apply the Apache License to your work, attach the following
              boilerplate notice, with the fields enclosed by brackets "[]"
              replaced with your own identifying information. (Don't include
              the brackets!)  The text should be enclosed in the appropriate
              comment syntax for the file format. We also recommend that a
              file or class name and description of purpose be included on the
              same "printed page" as the copyright notice for easier
              identification within third-party archives.
        
           Copyright [yyyy] [name of copyright owner]
        
           Licensed under the Apache License, Version 2.0 (the "License");
           you may not use this file except in compliance with the License.
           You may obtain a copy of the License at
        
               http://www.apache.org/licenses/LICENSE-2.0
        
           Unless required by applicable law or agreed to in writing, software
           distributed under the License is distributed on an "AS IS" BASIS,
           WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
           See the License for the specific language governing permissions and
           limitations under the License.
License-File: LICENSE
Requires-Python: >=3.10
Requires-Dist: httpx>=0.27.0
Requires-Dist: rich>=13.7.0
Requires-Dist: typer>=0.12.0
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == 'dev'
Description-Content-Type: text/markdown

# EnvXX

[![release](https://img.shields.io/github/v/release/mikigo/EnvXX?include_prereleases&sort=semver)](https://github.com/mikigo/EnvXX/releases)
[![license](https://img.shields.io/github/license/mikigo/EnvXX)](LICENSE)
[![python](https://img.shields.io/badge/python-3.10%2B-blue)](pyproject.toml)

跨 Windows、Linux、macOS 的免安装运行时管理器。把官方发布的绿色版下载到同一个目录，按需调用，删掉目录就等于卸载。

```bash
envxx python3.11 -m pip install requests
envxx node22 -v
envxx go1.27 version
envxx claude
```

没有安装向导，不写注册表，卸载后不留残留目录。

## 为什么做这个

配一台新机器意味着一件事：下载 Python、Node、Go 和 JDK，每个都认准架构，解压到某个地方，再把 PATH 配好。换下一台机器，同样的活再来一遍。

EnvXX 把这件事做一次，产物放在 `~/.envxx`。每个工具都是上游官方构建，没有二次打包；每个版本独占一个目录，多个版本可以并存。

```bash
rm -rf ~/.envxx   # 卸载完成
```

## 安装

从 [Releases](https://github.com/mikigo/EnvXX/releases/latest) 下载对应平台的压缩包，解压后把二进制放进 PATH。

| 系统 | 压缩包 | 二进制 |
| --- | --- | --- |
| Windows x64 | `<版本>-windows-x64.zip` | `<版本>-windows-x64/envxx.exe` |
| Windows arm64 | `<版本>-windows-arm64.zip` | `<版本>-windows-arm64/envxx.exe` |
| Linux x64 | `<版本>-linux-x64.zip` | `<版本>-linux-x64/envxx` |
| Linux arm64 | `<版本>-linux-arm64.zip` | `<版本>-linux-arm64/envxx` |
| macOS Apple Silicon | `<版本>-macos-arm64.zip` | `<版本>-macos-arm64/envxx` |
| macOS Intel | `<版本>-macos-x64.zip` | `<版本>-macos-x64/envxx` |

`<版本>` 是 tag 去掉 `v`：tag `v1.8.0` 对应 `1.8.0-linux-x64.zip`。文件名带版本，所以 `releases/latest/download/...` 这种固定路径用不了，得先问 API：

```bash
version=$(curl -s https://api.github.com/repos/mikigo/EnvXX/releases/latest \
  | grep -o '"tag_name": *"v[^"]*"' | cut -d'"' -f4); version=${version#v}
curl -L -o envxx.zip "https://github.com/mikigo/EnvXX/releases/latest/download/${version}-linux-x64.zip"
unzip envxx.zip
chmod +x "${version}-linux-x64/envxx" && sudo mv "${version}-linux-x64/envxx" /usr/local/bin/
```

二进制是自包含的：typer、rich、httpx 都打在里面，目标机器不需要装 Python。

从源码安装：

```bash
pip install -e .
```

## 快速上手

```bash
envxx python3.11 -m pip install requests   # 本地没有 3.11 会先下载
envxx node22 -v
envxx go1.27 version
envxx jdk21 --version
```

工具名和版本连在一起写：`python3.11`、`node22`、`go1.27`、`jdk21`。别名也认：`golang1.27`、`java21`、`temurin21`、`nodejs22`。

## 支持的工具

### 运行时

多个版本可以并存，`python3.11` 和 `python3.12` 各占一个目录。

| 工具 | 版本写法 | 入口 | 来源 |
| --- | --- | --- | --- |
| Python | `python3.11`、`python3.11.9` | `python`、`pip` | python-build-standalone |
| Node.js | `node22`、`node22.14.0` | `node`、`npm`、`npx` | nodejs.org LTS |
| Go | `go1.27`、`go1.27.4` | `go`、`gofmt` | go.dev |
| JDK | `jdk21`、`java21` | `java`、`javac`、`jar` | Adoptium Temurin |

### 便携应用

解包即用，留最新版就够。

| 工具 | 版本写法 | 入口 | 来源 |
| --- | --- | --- | --- |
| Claude Code | `claude` | `claude` | Open VSX |
| opencode | `opencode` | `opencode` | GitHub Release |
| CC Switch | `cc-switch` | `cc-switch` | GitHub Release |
| MobaXterm | `xterm` | `xterm` | mobatek.net |
| Windows Terminal | `wt` | `wt`、`WindowsTerminal` | GitHub Release |
| Notepad-- | `notepad--3.9`、`ndd3.9` | `notepad--` | GitHub Release |
| MarkText | `marktext0.23`、`mt0.23` | `marktext` | GitHub Release |
| DBeaver | `dbeaver` | `dbeaver` | GitHub Release |
| dufs | `dufs` | `dufs` | GitHub Release |

### 安装器应用

只下载并打开安装程序，装不装由你决定。EnvXX 不代劳，因为这类软件会往 Program Files 里写东西，做不到"删目录即卸载"。

| 工具 | 版本写法 | 来源 |
| --- | --- | --- |
| Git for Windows | `git` | git-scm.com |
| VS Code | `vscode`、`code` | update.code.visualstudio.com |
| 7-Zip | `7zip`、`7z` | 7-zip.org |
| 微信 | `wechat`、`weixin` | pc.weixin.qq.com |
| 企业微信 | `wecom`、`wechatwork` | work.weixin.qq.com |

## 用法

### 管理版本

```bash
envxx <tool> search            # 远端有哪些版本
envxx <tool> search --all      # 完整历史（默认每个版本线只显示最新补丁）
envxx <tool> list              # 本地已下载
envxx <tool> install 3.11.9    # 只下载不运行
envxx <tool> update            # 升到最新（应用类）
envxx <tool> where             # 入口的绝对路径
envxx <tool> uninstall 3.11.18 # 删除某个版本（应用类可简写 rm）
```

版本号也可以直接跟在工具名后面：

```bash
envxx python3.12 install       # 等同 envxx python install 3.12
envxx python3.12 where         # 等同 envxx python where 3.12
envxx python3.12 list          # 版本无意义，等同 envxx python list
```

所有列表都是新版本在前。`search` 每个版本线只显示最新补丁，`--all` 才是全部。

### 运行工具

没装的版本会在第一次调用时自动下载：

```bash
envxx python3.11 script.py     # 需要时先装 3.11，再执行
```

应用直接写名字：

```bash
envxx claude
envxx node -v                  # 参数会真的传给 node
```

裸的工具名（`envxx node`）显示子命令帮助，不会执行。

### 其他入口

Python 带 `pip`，Node 带 `npm`、`npx`，Go 带 `gofmt`：

```bash
envxx python3.11 pip install requests
envxx node22 npm run dev
envxx node22 npx create-vite
envxx go1.27 gofmt -l .
```

默认入口不需要重复写。JDK 的默认入口是 `java`，所以 `envxx jdk21 --version` 是对的，`envxx jdk21 java --version` 不是。

`envxx run` 是脚本里拼命令用的等价写法：

```bash
envxx run python@3.11:pip --version
envxx run node@22:npm --version
```

### 不用每次写 envxx

```bash
envxx python3.10 set-path      # 生成 ~/.envxx/bin/python3.10.exe
envxx set-path ~/.envxx/bin    # 把这个目录放进 PATH
```

之后新开的终端里直接 `python3.10 script.py`。`envxx bin` 列出已生成的所有命令。

目录默认加在**最前面**，刚加进去的应该优先；放末尾用 `--append`。已经存在的条目不动，重复执行是幂等的。

启动器永远指向全局 store。PATH 是机器级的，指向项目里的副本会在项目删除后失效，所以项目内执行 `set-path` 会直接报错。`--remove` 用来删除。

### 环境变量

```bash
envxx set-env FOO bar          # 用户级：Windows 写注册表，其他平台写 shell rc
envxx set-env FOO --unset      # 删除
envxx set-env --list           # 看 envxx 设过哪些
```

`PATH` 会被拒绝——整条替换会丢掉其他所有条目，请用 `set-path`。每次写入前旧值备份到 `~/.envxx/.backup/`。

改动对新终端生效，已开的终端保留旧环境；命令会打印免重开的刷新方法。

### 项目级运行时

```bash
cd my-project
envxx init
```

在当前目录建 `.envxx/runtime/`，并把 `.envxx/` 追加进 `.gitignore`。从这个目录及其子目录运行 `envxx python3.11`，用的都是项目内那一份。

只有运行时能项目级。应用是机器级的——没有理由每个仓库带一份自己的文本编辑器。

```
my-project/.envxx/
├── runtime/
└── .project
```

`downloads/` 和 `cache/` 也不进项目目录：同一个 20 MB 的 CPython 包不该每个仓库下一遍。

查找顺序：`ENVXX_HOME` → 向上找到的 `.envxx`（仅运行时）→ `~/.envxx`。`ENVXX_HOME` 排最前是因为它每次调用都显式指定；CI 里设了它就不会被仓库里的 `.envxx` 带偏。

只有带 `.project` 标记的目录才算项目 store，一个碰巧叫 `.envxx` 的目录会被忽略。`envxx init` 发现目录不是它建的会报错退出，不会覆盖。

`runtime/` 里放的是可执行文件。`init` 写 `.gitignore` 是为了防止误提交，但挡不住刻意提交二进制的仓库——在 clone 下来的项目里跑 `envxx` 之前，先看一眼 `.envxx/` 里有什么。

老版本用平铺的 `tools/` 目录，第一次运行新版本时自动迁移：运行时进 `runtime/`，应用进 `app/`。

## 存储

```
~/.envxx/
├── runtime/      python、node、go、jdk
├── app/          claude、dufs、git、vscode……
├── downloads/    下载缓存，支持断点续传，跨项目共用
├── cache/        远端版本列表，缓存一天
└── .locks/       并发安装时的锁
```

`ENVXX_HOME` 可以改位置。

## 行为说明

### Python

版本目录来自 Astral 的官方索引（`releases.astral.sh`，uv 用的也是这个源）。一次请求返回全部 500 多个构建，从 3.8 到 3.16——GitHub release API 只列还在维护的版本线，3.8/3.9/3.10 在那里查不到。索引 20 MB，缓存一天。每个构建都带 sha256，下载时校验。

### JDK

只列 17 以上的 LTS 线加上最新特性版本；Adoptium 还在发 Java 8 和 11，但默认摆出来只是噪音。默认版本是最新那个，要 LTS 得写 `jdk21`。macOS 上的包是 bundle，入口在 `Contents/Home/bin/java`，EnvXX 会自己找对。

### 版本显示

版本多的工具（Go、JDK、Node）默认每个版本线只显示一行——`1.27.4` 而不是 1.27 的每个补丁。`search --all` 列出全部。

### Git for Windows

用官方安装器（`Git-*.exe`），和下载页一致。安装器会配好 shell 集成和凭据管理器，那是安装器自己的决定，不是 EnvXX 的。

版本号带重打包序号——`2.56.0.windows.1` 到 `.4` 是同一个上游版本的四个不同构建，所以保留完整 tag。`search` 每个上游版本只显示最新一次重打包，`--all` 全部列出。

### 安装器应用

```bash
envxx wechat install
```

下载到 `downloads/`，打印绝对路径，然后打开安装程序。装不装、怎么装都是你的事。关掉窗口不会丢什么——文件还在，随时能再打开。

stdio 不是终端时（脚本、CI）不会弹窗，只打印路径，否则流水线会卡在那里等人点。

`list` 报告的是 `downloads/` 里有什么，不是解包内容，因为这类工具根本不会创建 `runtime/` 或 `app/` 条目。`where` 打印安装包路径。重复 `install` 不会重新下载。

微信和企业微信没有版本历史——页面上只挂当前这一版，所以 `search` 只有一行。VS Code 和 7-Zip 能列版本。

### pip 安装的控制台脚本

装进运行时 `Scripts/`（或 `bin/`）的脚本可以按名字调用：

```bash
envxx python3.11 pip install black
envxx python3.11 black .
```

找不到的名字会当作普通参数透传，所以 `envxx python3.11 script.py` 行为不变。

## 配置

### 镜像

网络慢可以指向镜像：

| 变量 | 覆盖范围 |
| --- | --- |
| `ENVXX_GITHUB_MIRROR` | github.com 页面和 Release 下载 |
| `ENVXX_GITHUB_API` | api.github.com |
| `ENVXX_GITHUB_RAW` | raw.githubusercontent.com |
| `ENVXX_NODE_DIST` | nodejs.org/dist |
| `ENVXX_CCSWITCH_MIRROR` | CC Switch 自己的 CDN，默认 `dl.ccswitch.io` |

Go 从 `dl.google.com` 下载，JDK 走 Adoptium 的 API，两者都不在镜像变量覆盖范围内。

### 限流

GitHub API 未登录每小时 60 次，设 `GITHUB_TOKEN` 提到 5000。大文件支持断点续传，中断的安装会在下次运行时检测到并重做。

## 各工具的细节

**CC Switch** —— 官方 CDN 只放 v4.0.29 之后的文件，老版本还是从 GitHub 取：先试镜像，404 再回落。版本列表走 tags 接口（每页几十 KB）而不是 releases（每页几 MB）。

**MobaXterm** —— 没有 API。下载地址里的构建号无法从版本号推出，所以列表是抓下载页得到的。changelog 有完整历史，但只有最新两个稳定版挂链接；旧版本标记为 `archived`，安装会明确报错而不是给一个死链。仅 Windows。

**Windows Terminal** —— 只收稳定通道。预览版靠 `prerelease` 标记和 `WindowsTerminalPreview` 资产前缀双重过滤，所以即使某个预览版忘了打标记也会被排除。版本号四段（`1.25.3131.0`）。两个入口：`wt` 是命令行（分屏、开新标签），`WindowsTerminal` 是 GUI。

**Notepad--** —— 只收 Windows 便携包。它的 macOS 资产是 `.dmg` 安装镜像，Linux 资产停在 v3.8 且命名不统一，都不适合便携 store。arm64 包只有部分版本附带，所以 arm64 上 `search` 只列真正有对应资产的版本。

**MarkText** —— Electron 应用，Windows 和 macOS 有 zip，Linux 有 tar.gz。压缩包是扁平的：`marktext.exe` 和 Electron 运行时文件直接在根目录，没有外层文件夹，所以不剥层。发布候选（`v0.24.0-rc.*`）会被过滤掉。它提供 `SHA256SUMS.txt`，下载会校验。

**DBeaver** —— Windows 有 zip，Linux 有 tar.gz，macOS 只有 dmg；dmg 是安装镜像，所以 macOS 上明确报不支持。压缩包解开是单个 `dbeaver/` 目录，里面自带 JRE（约 194 MB），装的时候剥掉这层。

**dufs** —— 默认用 [mikigo/dufs-shadcn-assets](https://github.com/mikigo/dufs-shadcn-assets) 替换自带界面。资源包第一次运行时下到 `~/.envxx/tools/dufs/.assets`。你自己写了 `--assets` 就以你的为准；其他参数原样透传给 dufs。资源包拿不到时静默退回自带界面，而不是让命令失败。

**Claude Code** —— 走 Open VSX 而不是官方 VS Code 市场。两边是同一批构建（大文件字节一致），但 Open VSX 有不需要登录的 REST API。opencode 和 CC Switch 直接用 GitHub Release 里的官方压缩包。

## 开发

需要 Python 3.10+。

```bash
pip install -e ".[dev]"
python -m pytest -q
```

加工具只需写一个 provider 并注册，命令行解析是注册表驱动的，不用改。步骤见 `skills/envxx/references/adding-a-provider.md`。

Windows 的启动器 shim 是一个编译好的二进制，提交在 `envxx/data/` 下。改动 `scripts/shim/shim.c` 后需要重新编译：

```bash
cmd //c scripts/shim/build.bat
```

## 发布

版本号只写在一处：`envxx/__init__.py`。`envxx --version` 读它，`pyproject.toml` 通过 `dynamic = ["version"]` 读它，发布包名来自 tag。

tag 是同一个数字的第二份拷贝，两者会漂移。两道保险：

```bash
scripts/release.sh --dry-run   # 读 __version__，显示将要打的 tag
scripts/release.sh --push      # 打 tag 并推送，剩下交给 CI
```

脚本要求工作区干净、tag 不重复，版本号从代码里读而不是手敲。CI 在 tag 触发时还会比对 tag 和 `__version__`，不一致直接失败，版本号对不上的包发不出去。手动触发（`workflow_dispatch`）没有 tag 可比，会跳过这项检查。

## 许可证

[Apache-2.0](LICENSE)
