命令行 tan
tan 负责创建、运行、构建和发布 TanGo 应用。dev、build、run、package、release-manifest 和 applinks 读取当前目录下的项目配置。支持 -C <dir> 的命令可用它指定项目目录。sign、generate bindings 和 doctor 也可独立于项目使用。 tan.json
go install github.com/tangoui/tango/cmd/tan@latest
tan help # 命令列表
tan <command> -h # 某个命令的参数本文对应主分支的 CLI。若已发布版本还没有某项功能,可从源码安装。 安装 tan
命令一览
| 命令 | 作用 |
|---|---|
tan init [dir] | 从模板创建项目;终端里不带目录时逐项询问,-yes 用默认值 |
tan dev | 开发模式:启动前端开发服务器(如有),编译运行应用,Go 改动后重建;自绘窗口热加载 |
tan build | 发布构建,一个或多个平台:桌面、iOS、Android |
tan run | 构建、安装并在 iOS 模拟器或 Android 设备 / 模拟器上运行,日志接到终端 |
tan package | 构建后生成安装包:macOS .dmg,Windows NSIS / MSIX,Linux .tar.gz / AppImage / deb / rpm / Flatpak |
tan sign | macOS 签名与公证;Windows exe / msi / msix 的 Authenticode 签名 |
tan keygen | 生成更新签名用的 Ed25519 密钥对 |
tan release-manifest | 为一次发布生成更新文件、二进制补丁和签名的 latest.json |
tan sign-update | 用 Ed25519 私钥签名更新清单 |
tan applinks | 生成发布到网站 /.well-known/ 的 iOS Universal Links 和 Android App Links 验证文件 |
tan generate bindings | 为 bind.Register 注册的服务生成 TypeScript 客户端 |
tan skills update | 从项目使用的 Tango 模块安装或更新 AI 技能 |
tan doctor | 检查工具链和平台依赖 |
tan mcp | 为 AI 代理提供项目工具和开发构建的界面自动化工具 |
tan version | 打印版本 |
项目 AI 技能
在应用目录运行 tan skills update,也可以用 tan skills update -C <dir> 指定目录。命令通过 Go 解析项目使用的 Tango 模块,支持 go.work 和 replace。模块尚未下载时,先在项目目录运行 go mod download。模块中没有 skills/tango/ 时,先升级 github.com/tangoui/tango。
更新前会列出 .agents/skills/tango/ 内将新增、修改、删除的文件。该目录由 tan 管理,请把自定义技能放在 .agents/skills/ 下的其他目录。
平台目标
tan build 的 -platform 接受以下逗号分隔的目标。tan package 只接受桌面目标。
| 写法 | 含义 |
|---|---|
| (空) | 本机平台 |
darwin/arm64、windows/amd64、linux/arm64 | 桌面 OS/架构;只写 OS 用本机架构 |
darwin/universal | 两种 Mac 架构合成通用二进制(需要 lipo) |
ios-simulator / ios | iOS 模拟器 .app / 真机 .app + .ipa |
android、android/arm64,android/amd64 | Android;只写 android 等于 arm64 + amd64 |
桌面构建产物在 build/<os>-<arch>/,-o 修改输出根目录;-debug 保留符号、允许打开 Web 检查器(Android 上产出 debug APK)。tan build(含 -debug)都是生产构建:GOFLAGS 里已有的 -tags 会合并进去,但去掉 tango_dev(另外仍传一个已无作用的兼容标签 tango_release)。tan dev 的构建(桌面与移动端)加 -tags tango_dev,开启热加载、自动化、前端开发代理等开发功能。
tan build 和 tan package 的 -features 可覆盖项目的桌面后端配置。desktopBuildTags 和 cgo 的应用范围见 tan.json。
MCP 服务器
tan mcp -root . 默认通过 stdio 提供 MCP 服务。-root 默认是当前目录,约束工具参数中的项目路径。需要 HTTP 时加 -http,用 -addr 指定回环监听地址(默认 127.0.0.1:0),用 -token 指定 Bearer 令牌(默认生成随机令牌并写到 stderr)。-addr、-token 只可和 -http 同用,-stdio 和 -http 互斥。界面工具依赖应用的 tango_dev 控制通道。 工具清单和客户端配置
常见流程
tan init -template react-ts notes && cd notes
tan dev
tan generate bindings # Go 服务改了之后重新生成 TS 客户端
tan build -platform darwin/universal
tan package -platform darwin/universal
tan sign -notarize build/darwin-universal/Notes.app
tan run -platform ios-simulator
tan build -platform android/arm64,android/amd64环境变量
| 变量 | 用于 |
|---|---|
TANGO_DEV_URL | tan dev 设置给应用的前端开发服务器地址(只有 -tags tango_dev 构建的 asset.FromEnv 读取,且只接受回环地址) |
TANGO_HOTRELOAD=0 | 关闭自绘窗口热加载 |
TANGO_LAUNCH_BACKGROUND=1 | macOS 应用启动时不激活,窗口排在其他应用之后。tan mcp 启动应用时自动设置 |
TANGO_SIGN_IDENTITY、TANGO_NOTARY_PROFILE、TANGO_APPLE_ID、TANGO_APPLE_TEAM_ID、TANGO_APPLE_PASSWORD | macOS 签名与公证 |
TANGO_WINDOWS_CERT、TANGO_WINDOWS_CERT_PASSWORD | Windows 签名证书与密码 |
TANGO_UPDATE_KEY_FILE、TANGO_UPDATE_KEY | tan release-manifest、tan sign-update 的私钥 |
TANGO_IOS_SIGN_IDENTITY | iOS 真机签名身份 |
TANGO_ANDROID_KEYSTORE_PASSWORD、TANGO_ANDROID_KEY_PASSWORD | Android release 签名 |
JAVA_HOME、ANDROID_HOME、ANDROID_NDK_HOME | Android 构建 |
完整参数
下面的内容在构建文档时由 tan <command> -h 自动生成。
$ tan help
Usage: tan <command> [flags] [args]
Commands:
init create a project from a template
dev run the app in development mode
build build the app for one or more platforms
run build and run the app on the iOS Simulator or Android
package build, then make installers and archives
sign sign a macOS app or disk image (and notarize), or a Windows exe/msi/msix
keygen create an Ed25519 key pair for update signing
release-manifest make the signed update manifest and patches for a release
sign-update sign an update manifest with an Ed25519 key
applinks write the Universal Links / App Links files for /.well-known/
generate generate code (bindings)
skills install or update the project's AI skill
doctor check the toolchain and platform dependencies
mcp run an MCP server for AI agents (project and UI tools)
version print the version
Run "tan <command> -h" for a command's flags.tan init
Usage: tan init [flags] [dir]
Creates a Tango project in dir (which must not exist or be empty). Without
dir, in a terminal, tan init asks for the directory, app name, id, template
and mobile support; -yes skips the questions.
Templates:
vanilla plain HTML/CSS/JS, no npm needed
vanilla-ts TypeScript + Vite
react-ts React + TypeScript + Vite
vue-ts Vue + TypeScript + Vite
shadcn React + TypeScript + Vite with Tailwind CSS and shadcn/ui components
ui self-drawn UI in Go (package ui): no WebView, no npm
hybrid WebView page (TypeScript + Vite) with a self-drawn tool panel on top
tan.json gets "permissions": [] and, unless -mobile=false, "ios" and
"android" sections with only minimum OS versions; signing settings are left
for you to add (docs/mobile.md).
Flags:
-id id
app id, reverse-DNS (default: com.example.<name>)
-local dir
use the Tango checkout in dir through a replace directive
-mobile
write the "ios" and "android" sections of tan.json (safe defaults, no signing) (default true)
-module path
Go module path (default: the directory name)
-name name
app display name (default: the directory name)
-template template
project template: vanilla, vanilla-ts, react-ts, vue-ts, shadcn, ui, hybrid (default "vanilla")
-yes
do not ask questions; use the flags and defaults (directory tango-app when none is given)tan dev
Usage: tan dev [flags] [-- app args]
-C dir
project dir (where tan.json is) (default ".")
-device string
with -platform: the adb serial or the Simulator UDID or name (default: the only/first one running)
-hot
hot-reload self-drawn UI (uihost) windows instead of restarting the app; TANGO_HOTRELOAD=0 turns it off (default true)
-no-restore
do not restore window positions and sizes when the app restarts
-platform string
run on a phone instead of the desktop: android (a connected device or a running emulator; android/<arch> to force the ABI) or ios-simulator
-url url
use the dev server already running at url instead of starting frontend.dev
-watch-framework
restart the dev host when the Tango sources it links change (local checkouts only) (default true)tan build
Usage: tan build [flags]
-C dir
project dir (where tan.json is) (default ".")
-debug
keep symbols and the console window; let the page open the inspector; android: debug APK instead of the signed release
-features value
backend profile: all, webview, canvas or webview,canvas
-o dir
output dir (default "build")
-platform targets
comma-separated targets such as darwin/arm64,windows/amd64,linux/amd64 (default: this machine; darwin/universal joins both Mac architectures); mobile: ios, ios-simulator, android, android/arm64,android/amd64
-xcode
ios: also generate an Xcode project in <out>/xcode for debuggingtan run
Usage: tan run -platform ios-simulator|android [flags]
-C dir
project dir (where tan.json is) (default ".")
-avd string
android: start this emulator (AVD name) when no device is connected (default: the first AVD)
-device string
Simulator name or UDID (ios-simulator), or adb serial (android); default: the booted one
-o dir
output dir (default "build")
-platform platform
platform to run on: ios-simulator or androidtan package
Usage: tan package [flags]
-C dir
project dir (where tan.json is) (default ".")
-features value
backend profile: all, webview, canvas or webview,canvas
-format format
package format: empty for each platform's default (disk image, tarball and AppImage, NSIS installer); msix (Windows targets only); or, for Linux targets, a comma-separated list of tar, appimage, deb, rpm, flatpak
-o dir
output dir (default "build")
-platform targets
comma-separated targets, as for tan buildtan sign
Usage: tan sign [flags] <App.app|image.dmg> [-- notarytool args]
tan sign [flags] <app.exe|setup.msi|app.msix|app.appx>...
-C dir
project dir (where tan.json is) (default ".")
-cert file
Windows: PKCS#12 certificate file (default $TANGO_WINDOWS_CERT, else windows.certificate in tan.json)
-entitlements plist
entitlements plist (default macos.entitlements from tan.json)
-identity identity
macOS: codesign identity, e.g. "Developer ID Application: Name (TEAMID)" (default $TANGO_SIGN_IDENTITY)
-notarize
submit to Apple's notary service and staple the ticket
-password password
Windows: certificate password (prefer $TANGO_WINDOWS_CERT_PASSWORD: flags show up in process lists)
-profile profile
notarytool keychain profile (default $TANGO_NOTARY_PROFILE; else $TANGO_APPLE_ID, $TANGO_APPLE_TEAM_ID, $TANGO_APPLE_PASSWORD)
-timestamp url
Windows: RFC 3161 timestamp url (default windows.timestampURL, else http://timestamp.digicert.com)tan keygen
Usage: tan keygen [flags]
-f overwrite existing key files
-o name
write name.key (private) and name.pub (public) (default "update")tan release-manifest
Usage: tan release-manifest [flags]
-C dir
project dir (where tan.json is) (default ".")
-build dir
dir holding the tan build / tan package output (default "build")
-expires duration
how long the manifest stays valid (its "expires"), e.g. 720h; 0 writes none (default 720h0m0s)
-key file
private update key file from tan keygen (default $TANGO_UPDATE_KEY_FILE, or the key itself in $TANGO_UPDATE_KEY)
-linux format
Linux update format: appimage or dir (default appimage when an AppImage was built, else dir)
-notes notes
release notes, or @file to read them from a file
-o dir
output dir for the update files, patches and latest.json (default "release")
-prev dir
dir of an earlier release (its latest.json and files) to make patches from; repeatable
-url URL
base URL the files are served from (default: next to latest.json, as relative URLs)
-windows format
Windows update format: exe (replace the executable) or nsis (run the installer from tan package) (default "exe")tan sign-update
Usage: tan sign-update [flags] <manifest.json>
-expires duration
set the manifest's "expires" this long from now, e.g. 720h; 0 keeps the manifest's own (default 720h0m0s)
-key file
private key file from tan keygen (default $TANGO_UPDATE_KEY_FILE, or the key itself in $TANGO_UPDATE_KEY)
-o file
write the signed manifest to file (default: replace the input)tan applinks
Usage: tan applinks [flags]
-C dir
project dir (where tan.json is) (default ".")
-debug
android: use the debug keystore's fingerprint (for debug builds only)
-fingerprint fingerprint
SHA-256 signing certificate fingerprint for assetlinks.json; repeat for several keys (Play App Signing: the app signing key from Play Console). Default: android.keystore's key
-o dir
output dir; the files go in <dir>/.well-known (default "build/applinks")
-platform string
which files: ios (apple-app-site-association), android (assetlinks.json) or both (default "ios,android")
-team ID
Apple team ID (default: from ios.provisioningProfile or ios.signIdentity)tan generate bindings
Usage: tan generate bindings [flags]
-C dir
project dir (where tan.json is) (default ".")
-o dir
output dir (default <frontend.dir>/src/bindings, or bindings without tan.json)
-pkg dir
Go package dir with the bind.Register calls, relative to the project (default ".")
-runtime module
module that exports call (default "@tangoui/runtime")tan skills update
Usage: tan skills update [-C dir]
-C dir
project dir (where tan.json is) (default ".")
Install the skill from the project's Tango module. Run go mod download first if needed.
.agents/skills/tango is managed by tan; put your own skills in another directory.tan doctor
Usage: tan doctortan mcp
Usage: tan mcp [-root dir] [-stdio | -http [-addr addr] [-token token]]
-addr address
with -http: loopback address to listen on (127.0.0.1, localhost or [::1]) (default "127.0.0.1:0")
-http
serve MCP over streamable HTTP on a loopback address instead of stdio
-root dir
project dir the tools work in; paths outside it are refused (default ".")
-stdio
serve MCP over standard input and output (the default)
-token token
with -http: bearer token clients must send (default: a random one, printed to stderr)