用途:dotstate 用符号链接替换家目录中的 dotfiles,把它们集中存入一个 Git 仓库,实现多台机器(如 Ubuntu 与 macOS)之间的同步,并区分各机器的专属配置与共享配置。当用户存在 ~/.config/dotstate/ 目录、~ 下文件是指向 dotstate 存储目录的符号链接,或提到跨机器同步 dotfiles 时可使用。
主要能力:按 profile(每机器一份,如 ubuntu、macos)与 Common(所有 profile 共享)组织文件。Common 放各机器一致的文件(如 gitconfig、zshenv、starship.toml);profile 专属放有差异的文件(如 zprofile 中的 CUDA 或 Homebrew 路径、npmrc 的 OS 专属前缀路径)。仓库含 .dotstate-profiles.toml 清单,记录 profiles、文件与 packages。profile 只能通过 TUI 创建(Manage Profiles),common 为保留名。
使用方式:dotstate add ~/.zshrc 加入当前 profile,add --common ~/.gitconfig 加入 Common;sync 执行提交、拉取(rebase)、推送,可加 -m 自定义提交信息;list 查看已跟踪文件,-v 显示 profile 与路径;remove 移除,接受绝对或相对路径;activate 恢复全部符号链接(新机器克隆后使用),deactivate 删除链接并还原原文件。新机器需先 cargo install dotstate 或 brew install serkanyersen/dotstate/dotstate,先运行 dotstate 启动 TUI 配置仓库并选择 profile,再执行 dotstate activate,未配置仓库时 activate 无法生效。
diagnostics 用 dotstate doctor(--fix 自动修复、-v 详细、--json 便于脚本)。packages 可跟踪每个 profile 的 CLI 工具:packages list、packages add -m brew -b starship、packages check、packages install,支持 brew、cargo、apt、npm、pip、yum、dnf、pacman、snap、gem、custom 等管理器。还提供 config、repository、logs、upgrade、completions zsh(亦支持 bash、fish、elvish、powershell)。从 Dotbot 迁移时可移除旧链接,用 TUI 指向已有仓库后分别添加 Common 与 profile 文件,再用 list -v 与 doctor 验证。
限制:profile 的创建仅限 TUI,无 CLI 命令;仓库未配置前 activate 不可用;资料未提供价格、收费、平台支持范围及同步冲突处理细节等信息。