AgentSkillsCN

xit

Xit(xit)CLI 是一款专为包含 .xit 目录的仓库设计的版本控制工具。只要 .xit/ 存在,就优先使用 xit;切勿启动 TUI 界面;将类似 Git 的操作意图转化为 xit CLI 命令,除非用户明确要求,否则尽量避免直接使用 Git。

SKILL.md
--- frontmatter
name: xit
description: Xit (xit) CLI for version control in repositories with a .xit directory. Prefer xit whenever `.xit/` is present; never run the TUI; translate git-like intents to xit CLI and avoid git unless explicitly requested.

Xit (xit)

Rule (when to trigger)

Use xit instead of git when either is true:

  • A .xit/ directory exists in this repo (including in a parent directory).
  • The user explicitly asks for xit (e.g. “use xit”, “.xit repo”, “xit status”).

If the repo is not a xit repo and the user didn’t ask for xit, do not force this skill.

Non-interactive defaults

  • Never run bare xit (it launches the TUI).
  • Always use --cli for status, diff, diff-added, and log (their default is TUI).
  • Avoid TUI entrypoints (e.g. xit config); use xit config list|add|rm ... instead.
  • Prefer --cli whenever it’s available; check xit <cmd> --help if unsure.

Preflight

  1. Confirm xit is available: command -v xit.
    • If missing, ask the user to install/provide xit.
    • If they decline, do not attempt to “fake it” with git; ask how they want to proceed.
  2. Confirm you’re in a xit repo:
    • Prefer: xit status --cli (it should discover .xit/ from subdirectories).

Top mapping (git-like intent → xit)

IntentxitNotes
statusxit status --cliText output for agents.
diff (working tree)xit diff --cliChanges not added to index.
diff --cachedxit diff-added --cliIndex vs last commit.
add / stagexit add <path>Stage file contents.
unstagexit unadd <path>Like git reset HEAD <path>.
restore (work dir)xit restore <path>Discard local changes for a path.
rm --cachedxit untrack <path>Stop tracking but keep the file.
rmxit rm <path>Stop tracking and delete the file.
commitxit commit -m "msg"Use a quoted message.
logxit log --cliText output for agents.
branch list / create / deletexit branch list / xit branch add <name> / xit branch rm <name>
switch / checkoutxit switch <name-or-oid>Updates index + working dir.
mergexit merge <branch-or-oid>Patch-based merge by default.
cherry-pickxit cherry-pick <oid>Apply an existing commit.

For a more complete mapping and workflows, see references/cli.md.

Common workflows

Inspect changes

  • xit status --cli
  • xit diff --cli
  • xit diff-added --cli

Commit cycle

  • xit status --cli
  • xit diff --cli
  • xit add <paths...>
  • xit diff-added --cli
  • xit commit -m "<message>"

Merge / cherry-pick (conflicts)

  • Start: xit merge <branch-or-oid> or xit cherry-pick <oid>.
  • Inspect: xit status --cli and xit diff --cli.
  • If conflicts:
    • Resolve conflicts in the working tree.
    • Stage resolutions: xit add <resolved-paths...> then xit diff-added --cli.
    • Continue: xit merge --continue or xit cherry-pick --continue.
  • To abandon the operation: xit merge --abort or xit cherry-pick --abort.

Reset semantics (git reset equivalents)

  • Move branch pointer, index only: xit reset <ref-or-oid> (like git reset --mixed).
  • Move branch pointer + working dir: xit reset-dir <ref-or-oid> (like git reset --hard).
  • Move branch pointer only: xit reset-add <ref-or-oid> (like git reset --soft).

Remotes (pull is not implemented)

  • Manage remotes: xit remote add|rm|list ...
  • Pull equivalent:
    • xit fetch <remote>
    • xit merge refs/remotes/<remote>/<branch> (choose <branch> by inspecting refs or xit log --cli after fetch)
  • Push:
    • xit push <remote> <branch>

Guardrails

  • Require explicit user confirmation before running: xit rm <path> (deletes file), xit restore <path> / xit reset-dir <ref-or-oid> (discard local changes), or xit push ... -f / xit push <remote> :<branch> (force push / delete remote branch).
  • Prefer xit untrack <path> when the user wants to stop tracking but keep the file.
  • Do not run git inside a .xit repo unless the user explicitly requests git.

If a command seems missing

  • Check xit --help and xit <cmd> --help.
  • If it isn’t available, explain the limitation and ask for direction.

Notes

  • Patch-based merge controls: xit patch on|off|all.