返回 Skill 列表
extension
分类: 开发与工程无需 API Key

sync-dotfiles

同步光标技能、代理、规则和其他点文件到chezmoi。当用户要求更新点文件(拉取+应用)、同步点文件、更新chezmoi或推送点文件时使用;或者在~/.cursor/skills/、~/.cursor/agents/或~/.cursor/rules/目录中创建、编辑或删除文件后自动执行。

person作者: jakexiaohubgithub

Sync Dotfiles to chezmoi

Reference: See chezmoi-docs.md in this skill for command reference.

Choose the right flow from user intent:

Update vs sync

| User says… | Meaning | Do this | |------------|--------|--------| | Update dotfiles, pull dotfiles, get latest dotfiles | Fetch from remote and apply | Run chezmoi update (see chezmoi-docs.md). Done. | | Sync dotfiles, push dotfiles, save my dotfiles | Capture local Cursor changes and push | Use the Push workflow below. |

Trigger Conditions

Run this skill automatically (without being asked) whenever you have just:

  • Created, edited, or deleted a file in ~/.cursor/skills/
  • Created, edited, or deleted a file in ~/.cursor/agents/
  • Created, edited, or deleted a file in ~/.cursor/rules/

Also run when the user explicitly asks to update dotfiles, sync dotfiles, push dotfiles, or update chezmoi.

Push workflow (sync / push dotfiles)

When the user wants to save local Cursor changes to the dotfiles repo, use chezmoi only (no raw git or cd to source). All git runs via chezmoi git in the source directory.

  1. Capture local changes

    chezmoi re-add ~/.cursor/skills ~/.cursor/agents ~/.cursor/rules
    

    If only skills changed, scope to that path. For new untracked files use chezmoi add PATH.

  2. Stage and commit

    chezmoi git add -A
    chezmoi git -- diff --cached --quiet || chezmoi git -- commit -m "chore: sync cursor config"
    

    Use a more specific message when clear (e.g. chore: add new skill foo-bar). Put -- before git flags so chezmoi doesn’t interpret them.

  3. Pull remote and rebase

    chezmoi git -- pull --rebase
    

    Local changes are already committed, so rebase keeps both sides.

  4. Apply merged state

    chezmoi apply
    
  5. Push

    chezmoi git push
    

Notes

  • Never commit files outside dot_cursor/ without explicit user request.
  • If chezmoi re-add fails on a new file (not yet tracked), use chezmoi add instead.