百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
D

dotstate

> 开发工具
开源

一个现代、安全且易于使用的 dotfile 管理器,由 Rust 构建

359 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

一个现代、安全且易于使用的 dotfile 管理器,由 Rust 构建

DotState

A modern, secure, and user-friendly dotfile manager built with Rust

DotState is a terminal-based tool that helps you manage your dotfiles effortlessly. Whether you're syncing your configuration across multiple machines or setting up a new development environment, DotState makes it simple, safe, and fast.

Demo

https://github.com/user-attachments/assets/9be0df5e-87ce-4b61-ae0f-1c8ffe94cb36

Why DotState?

Managing dotfiles can be a pain. You want your .zshrc, .vimrc, and other config files synced across machines, but traditional solutions are either too complex, insecure, or require too much manual work.

DotState solves this by being:

  • Built with Rust - Fast, memory-safe, and reliable
  • Secure by design - No shell injection vulnerabilities, safe file operations
  • Beautiful TUI - Intuitive interface that doesn't require learning Git
  • ⚡ Lightning fast - Non-blocking operations, instant feedback
  • ️ Safe - Automatic backups before any file operations
  • Git-powered - Store dotfiles in GitHub, GitLab, Bitbucket, or any git host

What Makes DotState Different?

Traditional Dotfile Managers

  • Require Git knowledge
  • Manual symlink management
  • No built-in backup system
  • Complex setup process

DotState

  • Zero Git knowledge required - We handle everything
  • Automatic symlink management - Files are linked automatically
  • Built-in backups - Your files are safe before any operation
  • One-command setup - Get started in seconds
  • Profile support - Separate configs for work, personal, Mac, Linux, etc.
  • Profile inheritance - Extend a parent profile and override only what differs
  • Package management - Track and install CLI tools per profile
  • Beautiful TUI - Visual interface with mouse support

Features

Core Features

  • Profile Management: Create separate profiles for different contexts (work, personal, Mac, Linux, etc.)
  • Profile Inheritance: Have a profile extend another — child files override parent files, so you only define what's different
  • Common Files Support: Share dotfiles (like .gitconfig or .tmux.conf) across all profiles automatically.
  • Flexible Git Sync: Automatic sync with GitHub, GitLab, Bitbucket, or any git host
  • Two Setup Modes: Let DotState create a GitHub repo for you, or use your own repository
  • Smart File Detection: Automatically finds common dotfiles in your home directory
  • Safe Operations: Automatic backups before any file modification
  • Symlink Management: Automatic creation and management of symlinks
  • Custom Files: Add any file or directory, not just dotfiles

Package Management

  • CLI Tool Tracking: Define and track CLI tools and dependencies per profile
  • Multi-Manager Support: Works with Homebrew, Cargo, npm, pip, and more
  • Installation Flow: Check what's missing and install with one command
  • Custom Packages: Support for custom installation scripts

User Experience

  • Beautiful TUI: Modern terminal interface built with Ratatui
  • Mouse Support: Click to navigate and interact
  • Real-time Feedback: See what's happening as it happens
  • Error Recovery: Clear error messages with actionable guidance
  • CLI & TUI: Full-featured CLI for automation, beautiful TUI for interactive use
  • Customizable Keymaps: Configurable keyboard shortcuts with preset support (Standard, Vim, Emacs) and custom overrides

Security

  • No Shell Injection: Direct command execution, no shell interpretation
  • Safe File Operations: Validates paths, prevents dangerous operations
  • Secure GitHub Integration: Token-based authentication
  • Backup System: Automatic backups before any destructive operation

Installation

Prebuilt from website (Recommended)

Installation Guide

bash
curl -fsSL https://dotstate.serkan.dev/install.sh | bash

Using Cargo

bash
cargo install dotstate

Using Homebrew

bash
brew tap serkanyersen/dotstate
brew install dotstate

Or use the direct install:

bash
brew install serkanyersen/dotstate/dotstate

Quick Start

  1. Launch DotState:

    bash
    dotstate
  2. First-time Setup:

    • Choose how to set up your repository:
      • Option A: Create for me (GitHub) - DotState creates a repo on GitHub
        • Enter your GitHub token (create one at github.com/settings/tokens)
        • Tip: You can also set the DOTSTATE_GITHUB_TOKEN environment variable
        • Choose repository name and visibility (private/public)
      • Option B: Use my own repository - Bring your own git repo
        • Create a repo on any git host (GitHub, GitLab, Bitbucket, etc.)
        • Clone it locally and set up your credentials
        • Point DotState to your local repo path
  3. Add Your Files:

    • Navigate to "Manage Files"
    • Select files to sync (they're automatically added)
    • Files are moved to the repo and symlinked automatically
  4. Sync with Remote:

    • Go to "Sync with Remote"
    • Your files are committed, pulled, and pushed automatically

That's it! Your dotfiles are now synced and ready to use on any machine.

CLI Usage

DotState also provides a powerful CLI for automation:

…

Shell Completions

Generate completions for your shell:

bash
# Bash
source  ~/.zsh/completions/_dotstate

Then add fpath=(~/.zsh/completions $fpath) to your .zshrc before your framework loads.

How It Works

  1. Storage: Your dotfiles are stored in a Git repository (default: ~/.config/dotstate/storage)
  2. Symlinks: Original files are replaced with symlinks pointing to the repo
  3. Profiles: Different profiles can have different sets of files
  4. Inheritance: Profiles can inherit from a parent — child files override parent files, common files have the lowest priority
  5. Common Files: Files that are shared across all profiles are stored in the common section and linked regardless of the active profile
  6. Sync: Changes are committed and synced with GitHub automatically

Working with Profiles

Profiles are how DotState organizes your dotfiles for different machines or contexts. Each profile has its own set of files, while Common Files are shared across all profiles automatically.

…

Creating Profiles

In the TUI, go to Manage Profiles and press C to create a new profile. You can:

  • Start blank for a completely new setup
  • Inherit from an existing profile to create a live link — the child automatically gets all parent files and packages, and you only override what's different
  • Copy from an existing profile to carry over files and packages as a one-time snapshot — great for setting up a similar machine quickly

Inherit vs Copy: Inheritance is a live relationship — changes to the parent are reflected in the child. Copy is a one-time fork — after creation, the two profiles are independent.

Profile Inheritance

A profile can inherit from one parent. When activated, DotState resolves files from the full chain:

  1. Child's own files (highest priority)
  2. Parent's files (inherited unless overridden)
  3. Grandparent's files, etc.
  4. Common files (lowest priority)
          base
           │  .zshrc, .vimrc, .tmux.conf
           │
         work (inherits base)
           │  .zshrc (overrides base's)
           │  .ssh/config (own)
           │
       work-laptop (inherits work)
              .ssh/config (overrides work's)

In this example, work-laptop gets: its own .ssh/config, work's .zshrc, and base's .vimrc and .tmux.conf.

Cycles are detected and rejected. Profiles that are inherited by others cannot be deleted until the inheritance is removed.

Switching Profiles

Select a profile and press Enter to switch. DotState will remove symlinks for the old profile and create symlinks for the new one automatically (including inherited files). Common files stay linked regardless of which profile is active. If activation fails, the old profile is automatically restored.

Common Files

You decide which files are shared. Move any file to Common and it will be symlinked in every profile. Common files stay linked when you switch profiles. To move a file between profile-specific and common:

  1. Go to Manage Files
  2. Select a file
  3. Press M to move it to Common (or back to the active profile)

Use Cases

  • Multi-machine: Use a Personal profile on your laptop, Work on your work machine, and Server for headless setups. Keep shared configs (.gitconfig, .tmux.conf) in Common.
  • Same computer, different contexts: Create profiles like day, night, or focus with different terminal themes and defaults, and switch between them instantly.
  • Layered configs with inheritance: Create a base profile with your core setup, then have work and personal inherit from it — each only overrides what's different (like .zshrc or .ssh/config). Changes to base automatically flow to all children.
  • Quick duplication: When setting up a second machine, create a new profile by copying from an existing one, then tweak what's different.

Configuration

Repository Setup Modes

DotState supports two repository setup modes:

GitHub Mode (Automatic)

Let DotState create and manage a GitHub repository for you. Requires a GitHub Personal Access Token.

GitHub Token Options:

DotState supports both Classic tokens and Fine-grained tokens (recommended).

Option 1: Fine-grained Token (Recommended)

Fine-grained tokens offer better security through granular permissions. Create one at github.com/settings/personal-access-tokens.

Required permissions:

Permission Access Level Purpose
Administration Read & write Create your dotstate-storage repository
Contents Read & write Sync your dotfiles to/from the repository

Note: Metadata (read-only) is automatically included by GitHub for all fine-grained tokens.

Repository access:

  • For initial setup, select "All repositories" so DotState can create and find your storage repo
  • After setup, you can regenerate a token restricted to only your dotstate-storage repository

Option 2: Classic Token

Create a classic token at github.com/settings/tokens.

Required scope: repo (Full control of private repositories)

Token Configuration:

  1. Environment Variable (Recommended for automation):

    bash
    export DOTSTATE_GITHUB_TOKEN=ghp_your_token_here
    # or for fine-grained tokens:
    export DOTSTATE_GITHUB_TOKEN=github_pat_your_token_here

    The environment variable takes precedence over the config file token.

  2. Config File: The token can be stored in the config file (set during first-time setup).

Local Mode (Bring Your Own Repo)

Use any existing git repository from any host (GitHub, GitLab, Bitbucket, self-hosted, etc.).

Setup:

  1. Create a repository on your preferred git host
  2. Clone it locally: git clone ~/.config/dotstate/storage
  3. Ensure you can push: git push origin main
  4. In DotState, choose "Use my own repository" and enter the path

Benefits of Local Mode:

  • Works with any git host
  • Uses your existing SSH keys or git credentials
  • No GitHub token required

Update Notifications

DotState automatically checks for updates and shows a notification in the main menu when a new version is available. You can also check manually:

bash
# Check for updates interactively
dotstate upgrade

# Just check without prompting
dotstate upgrade --check

**Conf

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rustbrewclicrates-iodotfiles

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类开发工具
定价开源

> 相关工具

V
VS Code
流行的开源代码编辑器
G
Git
分布式版本控制系统
V
Vite
下一代前端构建工具