refactor(diff): show extras by default, remove --extras/--all flags

Extras diff is now automatically included when extras are configured.
No need for explicit --extras or --all flags — simpler UX.

- Remove showExtras/showAll from diffRenderOpts
- Replace flag check with len(cfg.Extras) > 0
- Update integration test, built-in skill refs, website docs, changelog
This commit is contained in:
Willie
2026-03-12 16:45:02 +08:00
parent d756004e56
commit ee38d34513
8 changed files with 13 additions and 27 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ Extras (non-skill resources like rules, prompts, commands) are now a first-class
- **`status`** — shows extras file count and target count per extra
- **`doctor`** — checks that extras source directories exist and target parent directories are reachable
- **`diff --extras`** — per-file diff for extras targets; `diff --all` shows combined skills + extras diff
- **`diff`** — automatically includes per-file diff for extras targets when configured
- **`sync extras --json`** — structured JSON output for programmatic consumption
- **`sync --all -p`** — project-mode `--all` now includes extras sync
+2 -9
View File
@@ -24,8 +24,6 @@ type diffRenderOpts struct {
showPatch bool
showStat bool
jsonOutput bool
showExtras bool // show extras diff
showAll bool // show all (skills + extras)
}
// diffJSONOutput is the JSON representation for diff --json output.
@@ -99,11 +97,6 @@ func cmdDiff(args []string) error {
case "--json":
opts.jsonOutput = true
opts.noTUI = true // --json implies no TUI
case "--extras":
opts.showExtras = true
case "--all":
opts.showAll = true
opts.showExtras = true // --all implies --extras
default:
targetName = rest[i]
}
@@ -466,9 +459,9 @@ func cmdDiffGlobal(targetName string, opts diffRenderOpts, start time.Time) erro
progress.stop()
}
// Extras diff
// Extras diff (always included when extras are configured)
var extrasResults []extraDiffResult
if opts.showExtras || opts.showAll {
if len(cfg.Extras) > 0 {
extrasResults = collectExtrasDiff(cfg.Extras, func(name string) string {
return config.ExtrasSourceDir(cfg.Source, name)
})
+2 -2
View File
@@ -112,9 +112,9 @@ func cmdDiffProject(root, targetName string, opts diffRenderOpts, start time.Tim
progress.stop()
// Extras diff
// Extras diff (always included when extras are configured)
var extrasResults []extraDiffResult
if opts.showExtras || opts.showAll {
if len(runtime.config.Extras) > 0 {
extrasResults = collectExtrasDiff(runtime.config.Extras, func(name string) string {
return config.ExtrasSourceDirProject(root, name)
})
-1
View File
@@ -51,7 +51,6 @@ skillshare extras remove rules # Remove from config (sourc
skillshare sync extras # Sync all extras to targets
skillshare sync extras --dry-run --force # Preview / overwrite conflicts
skillshare sync --all # Sync skills + extras together
skillshare diff --extras # Show extras diff
```
See [extras.md](references/extras.md) for details.
### Creating & Discovering Skills
+5 -6
View File
@@ -9,7 +9,7 @@ Manage non-skill resources (rules, commands, prompts) that sync to arbitrary dir
| `extras remove <name>` | Remove an extra from config | ✓ (auto) | ✗ |
| `extras collect <name>` | Collect target files into source | ✓ (auto) | ✗ |
| `sync extras` | Sync all extras to targets | ✓ (auto) | ✓ |
| `diff --extras` | Show extras diff | ✓ (auto) | ✓ |
| `diff` | Includes extras diff automatically | ✓ (auto) | ✓ |
**Source directories:**
- Global: `~/.config/skillshare/extras/<name>/`
@@ -107,14 +107,13 @@ Sync modes (per-target):
- `copy`: real-file copies
- `symlink`: entire directory symlinked
## diff --extras
## diff (extras included)
Show what would change if you ran `sync extras`.
`skillshare diff` automatically includes extras when configured — no extra flags needed.
```bash
skillshare diff --extras # Extras only
skillshare diff --all # Skills + extras
skillshare diff --extras --json # JSON output
skillshare diff # Skills + extras (if configured)
skillshare diff --json # JSON output includes extras
```
## Config format
-2
View File
@@ -25,8 +25,6 @@ skillshare diff # Interactive TUI (default on TTY)
skillshare diff claude # Specific target
skillshare diff --stat # File-level changes (plain text)
skillshare diff --patch # Full unified diff (plain text)
skillshare diff --extras # Include extras diff
skillshare diff --all # Skills + extras
skillshare diff --no-tui # Plain text, skip TUI
skillshare diff --json # JSON output (implies --no-tui)
skillshare diff -p # Project mode
+2 -2
View File
@@ -374,7 +374,7 @@ extras:
result.AssertAnyOutputContains(t, rulesTarget)
}
// TestExtras_DiffExtras verifies that "diff --extras" shows files that need syncing.
// TestExtras_DiffExtras verifies that "diff" automatically shows extras that need syncing.
func TestExtras_DiffExtras(t *testing.T) {
sb := testutil.NewSandbox(t)
defer sb.Cleanup()
@@ -399,7 +399,7 @@ extras:
- path: ` + rulesTarget + `
`)
result := sb.RunCLI("diff", "--extras", "--no-tui", "-g")
result := sb.RunCLI("diff", "--no-tui", "-g")
result.AssertSuccess(t)
// Output should show the extras diff section.
+1 -4
View File
@@ -11,8 +11,7 @@ skillshare diff # All targets (interactive TUI)
skillshare diff claude # Specific target
skillshare diff --stat # File-level changes
skillshare diff --patch # Full unified diff
skillshare diff --extras # Extras diff only
skillshare diff --all # Skills + extras diff
skillshare diff # Includes extras automatically
```
![diff demo](/img/diff-demo.png)
@@ -191,8 +190,6 @@ skillshare sync # Fix it
|------|-------------|
| `--project, -p` | Use project mode |
| `--global, -g` | Use global mode |
| `--extras` | Show extras diff (non-skill resources like rules, commands) |
| `--all` | Show both skills and extras diff (implies `--extras`) |
| `--stat` | Show file-level changes (implies `--no-tui`) |
| `--patch` | Show full unified diff (implies `--no-tui`) |
| `--no-tui` | Plain text output (skip interactive TUI) |