| 项目 | 要求 |
|---|---|
| 操作系统 | Linux / macOS / Windows |
| 架构 | amd64 / arm64(Windows 仅 x64) |
| Node.js | ≥ 18(仅 npm 安装时需要) |
| Go | ≥ 1.22(仅源码编译时需要) |
无需预先安装 Go 或 Node.js,自动检测平台并下载 GitHub Release 预编译二进制:
Windows 用户请使用下方的 npm 全局安装 或 Go 直接编译。
curl -fsSL https://raw.githubusercontent.com/opentmd/opentmd-cli/master/scripts/install.sh | bash
指定版本或安装目录:
curl -fsSL .../install.sh | bash -s -- --version v0.1.0
OPENTMD_INSTALL_DIR=~/.local/bin ./scripts/install.sh
安装脚本选项:
| 选项 | 说明 |
|---|---|
--version TAG |
安装指定 release(v0.1.0 或 0.1.0 均可) |
--dir DIR |
安装目录(等价 OPENTMD_INSTALL_DIR) |
--source |
跳过 release,直接从当前源码目录编译 |
--skip-verify |
不校验下载文件 sha256(不推荐) |
安装脚本会:
OPENTMD_VERSION 覆盖);
API 不可用时回退解析 releases/latest 重定向curl 或 wget 下载对应平台二进制,有 .sha256 资产时校验完整性/usr/local/bin 或 ~/.local/bin(同目录临时文件 + rename,可安全覆盖运行中的旧版本)~/.bashrc / ~/.zshrc(可用 OPENTMD_NO_PATH_EDIT=1 跳过)opentmd --version 验证安装下载失败时,若在源码目录内运行,会自动回退为 go build 编译安装(版本号取自 git describe)。
npm install -g @opentmd/cli
npm 会根据 process.platform + process.arch 自动下载匹配平台的预编译二进制(通过 optionalDependencies 平台包)。支持 Windows x64、macOS(arm64/x64)、Linux(arm64/x64)。
要求 Node.js ≥ 18。在 Git Bash、PowerShell 或 CMD 中均可使用:
npm install -g @opentmd/cli
安装后直接使用:
opentmd
opentmd --version
git clone https://github.com/opentmd/opentmd-cli.git
cd opentmd-cli
./scripts/install.sh
./scripts/build.sh
# 输出: bin/opentmd
# 或仓库内快捷启动(缺失时自动 build)
./opentmd --help
CGO_ENABLED=0 go build -trimpath -ldflags "-s -w -X main.Version=dev" -o bin/opentmd ./cmd/opentmd/
| 变量 | 说明 | 默认值 |
|---|---|---|
OPENTMD_VERSION |
Release tag | 自动检测 latest |
OPENTMD_REPO |
GitHub 仓库 | opentmd/opentmd-cli |
OPENTMD_INSTALL_DIR |
安装目录 | 自动检测 |
OPENTMD_NO_PATH_EDIT |
设为 1 跳过 shell rc PATH 写入 |
— |
OPENTMD_SKIP_VERIFY |
设为 1 跳过下载文件 sha256 校验 |
— |
OPENTMD_RELEASE_WEB |
覆盖 Release 页面基址(默认 https://github.com/<repo>/releases),内网镜像分发用 |
仓库 releases |
OPENTMD_RELEASE_BASE |
覆盖 Release 资产下载基址(默认 <RELEASE_WEB>/download),内网镜像分发用 |
见左 |
USE_CN_MIRROR |
源码编译时启用国内 Go/npm 代理(0 关闭) |
1 |
opentmd --version
opentmd --help
opentmd config
详见 卸载指南。
# 交互式卸载
curl -fsSL https://raw.githubusercontent.com/opentmd/opentmd-cli/master/scripts/uninstall.sh | bash
# npm 安装的用户
npm uninstall -g @opentmd/cli
opentmd login # 配置 Provider 与 API Key
cd your-project && opentmd # 进入 TUI