跳至主要內容

diff

顯示 source 與 targets 之間的差異。

skillshare diff              # 所有 targets(互動式 TUI)
skillshare diff claude # 特定 target
skillshare diff agents # 僅 agent targets
skillshare diff --stat # 檔案層級變更
skillshare diff --patch # 完整 unified diff

diff demo

互動式 TUI

在 TTY 上,diff 會啟動一個左右面板版面的互動式 TUI:

  • 左側面板 — 帶狀態圖示的 target 清單( 已同步、! 有差異、 錯誤)
  • 右側面板 — 選定 target 的詳細檢視(模式、filters、分類後的 diffs)
  • Enter 展開某個 skill 的檔案層級 diff
  • / 篩選 targets,Ctrl+d/u 捲動詳細內容,q 離開

使用 --no-tui 輸出純文字,或透過 pipe 自動停用 TUI。

使用時機

  • 在同步之前,查看 source 與某個 target 之間確切的差異
  • 找出只存在於 target 中的 skills(本機獨有,尚未收集)
  • 找出可以被 symlink 取代的本機複本
  • --stat 檢視檔案層級變更,或用 --patch 檢視完整文字 diff

輸出範例

claude
+ New 2 skills:
missing-skill
another-skill
! Local Override 1 skill:
local-copy
← Local Only 1 skill:
my-local-skill

2 new, 1 local override, 1 local only

cursor: fully synced

分組後的多 Target 輸出

當多個 targets 有完全相同的 diff 結果時,會合併為單一區塊以減少雜訊:

claude, agents
+ New 2 skills:
skill-1
skill-2

cursor
+ New 1 skill:
skill-1

codex, copilot: fully synced

結果不同的 targets(例如因為 include/exclude filters 而不同)仍會分開顯示。

符號

符號標籤意義動作
+New存在於 source,target 中缺失sync 會新增它
+Restore曾存在於 target,已被刪除sync 會還原它
~Modified內容已變更(copy 模式)sync 會更新它
!Local Override本機複本而非 symlinksync --force 以取代
-Orphan存在於 manifest 但不在 source 中sync 會清除它
Local Only只存在於 target,不在 source 中collect 匯入

檔案層級細節

--stat

顯示每個 skill 中哪些檔案有差異:

skillshare diff --stat
claude
~ Modified 1 skill:
my-skill
+ new-file.md
~ SKILL.md
- old-file.md

--patch

顯示已修改檔案的完整 unified 文字 diff:

skillshare diff --patch
claude
~ Modified 1 skill:
my-skill
--- SKILL.md
- old line
+ new line

--stat--patch 兩者皆隱含 --no-tui(純文字輸出)。

Diff 顯示的內容

Merge 模式的 Targets

對於使用 merge 模式(預設)的 targets:

  • 列出 source 中尚未 symlink 到 target 的 skills
  • 顯示以本機複本存在(而非 symlink)的 skills
  • 找出 target 中僅存在的本機 skills(不在 source 中 — 會被 sync 保留)

Copy 模式的 Targets

對於使用 copy 模式的 targets:

  • 列出 source 中尚未被管理的 skills(manifest 中缺失)
  • 透過檢查碼比對顯示內容變更
  • 顯示不再存在於 source 中的孤立受管理複本(sync 時會被清除)
  • 找出本機獨有的 skills(不在 source 中且未受管理)

對於使用 symlink 模式的 targets:

  • 只是檢查 symlink 是否指向正確的 source
  • 顯示「Fully synced」或警告 symlink 錯誤

使用情境

Sync 之前

檢查會有什麼變更:

skillshare diff
# 查看 sync 會做什麼,然後:
skillshare sync

找出本機 Skills

發現你直接在某個 target 中建立的 skills:

skillshare diff claude
# 顯示:← Local Only 1 skill: my-local-skill

skillshare collect claude # 匯入到 source

檢視變更

在同步前確切查看某個 skill 有什麼變更:

skillshare diff --patch claude   # 完整文字 diff
skillshare diff --stat claude # 檔案層級摘要

疑難排解

當 status 顯示有問題時:

skillshare status          # 顯示「needs sync」
skillshare diff claude # 確切查看差異之處
skillshare sync # 修正它

Agent Diff

使用 agents 關鍵字僅 diff agent targets:

skillshare diff agents             # 所有支援 agent 的 targets
skillshare diff agents claude # 特定 target
skillshare diff agents --json # JSON 輸出

Agent diff 會顯示缺失的 agents(需要 sync)、孤立的 symlinks(需要 prune),以及本機獨有的 agent 檔案。只有設有 agents 路徑的 targets 會被納入。詳見 Agents — Supported Targets 了解完整清單。


選項

Flag說明
--project, -p使用 project 模式
--global, -g使用 global 模式
--stat顯示檔案層級變更(隱含 --no-tui
--patch顯示完整 unified diff(隱含 --no-tui
--no-tui純文字輸出(略過互動式 TUI)
--json以 JSON 輸出(隱含 --no-tui

JSON 輸出

skillshare diff --json
{
"targets": [
{
"name": "claude",
"mode": "merge",
"synced": false,
"items": [
{"action": "link", "name": "missing-skill", "reason": "not in target", "is_sync": true},
{"action": "update", "name": "local-copy", "reason": "local override", "is_sync": true}
],
"include": [],
"exclude": []
}
],
"duration": "0.045s"
}

另請參閱