Commit Graph
13 Commits
Author SHA1 Message Date
Willie 45854c5b57 fix(sync): count manifest-managed hidden entries in target scans
Flat target naming turns a source skill under a dot directory
(e.g. .system/example) into a hidden target entry (.system__example).
Target scans skipped every hidden name, so diff, doctor, status and the
dashboard reported these synced skills as missing, and prune never
removed them after the source skill was deleted.

Hidden entries are now skipped only when the target manifest does not
record them as managed, so files like .skillshare-manifest.json or
.DS_Store are still ignored.

Refs #294
2026-09-25 22:26:51 +08:00
Willie 13744f89a8 refactor: consolidate duplicated utilities and simplify diff API
- Extract shared applyDetailScroll into tui_helpers.go (was duplicated
  across diff_tui.go, log_tui.go, audit_tui.go)
- Create utils.FileHash and utils.FileHashFormatted, replacing private
  copies in install/meta.go and audit/audit.go
- Export install.MetaFileName constant, use from diff_file.go
- Replace double SHA-256 in fileContentsEqual with streaming byte compare
  for early-exit efficiency
- Add 1MB size cap to generateUnifiedDiff to prevent performance issues
- Move noTUI into diffRenderOpts struct, simplifying function signatures
2026-03-02 02:23:50 +08:00
Willie ada539603e refactor(diff): address code review findings
- Remove dead field diffTUIModel.results (never read)
- Replace hand-rolled countOccurrences with strings.Count
- Skip latestMtime() walk for merge mode (symlinks make it misleading)
- Fix ensureFiles() nil cache miss (return non-nil empty slice)
- Cache sorted items + categories in TUI model (avoid per-render recompute)
2026-03-02 02:23:50 +08:00
Willie 6a904545f4 test(diff): add integration tests for file stat, patch, new labels, summary 2026-03-02 02:23:50 +08:00
Willie 6fea949988 feat(diff): redesign labels with git-style symbols and add statistics summary 2026-03-02 02:23:50 +08:00
Willie ace94c8756 feat(diff): rewrite output with action-oriented labels and overall summary
Replace cryptic internal terminology (+/~/- source only, local copy, etc.)
with action-oriented messages that tell users what to do next (→ sync will
add, ⚠ local copies, ← collect will import). Add overall summary line at
top ("N targets need sync, N fully synced"). Show conditional hints that
only mention --force when local copies actually exist. Use full command
names (skillshare sync) in hints.
2026-02-26 22:27:23 +08:00
Willie 0e2e18dca0 feat(diff): group targets with identical diff results
When multiple targets produce the same diff output (e.g. all missing
the same skills), they are now merged into a single block with a
combined header like "claude, agents" instead of repeating the full
list for each target. Fully synced targets are also consolidated
into one line (e.g. "codex, copilot: fully synced").

Refactored show*Diff → collect*Diff to separate data collection
from rendering, enabling cross-target fingerprint grouping via
renderGroupedDiffs().
2026-02-26 22:27:23 +08:00
Willie 179d02ba0d perf(sync): mtime fast-path for copy mode + diff UX improvements
Copy mode previously computed DirChecksum (Walk + ReadFile + SHA256)
for every skill on every sync, even when nothing changed. Add mtime-
based short-circuit: if source dir max mtime matches the manifest
record, skip checksum entirely.

Changes:
- Add DirMaxMtime() — Walk + lstat only, no file reads
- Extend Manifest with Mtimes map (omitempty, backward-compatible)
- SyncTargetCopyWithSkills: mtime fast-path with target validity check
- diff: two-phase scan-then-display with spinner (no more interleaved
  spinner + diff output), discovery spinner for both global/project
- Clearer diff reasons: "missing" → "source only",
  "missing (deleted from target)" → "deleted from target"
- Server handleDiff: same mtime fast-path for copy mode
- Prune cleans up orphan mtime entries
2026-02-26 22:27:23 +08:00
Willie d7d4804312 fix(sync): handle non-directory entries in copy mode
- SyncTargetCopy replaces non-directory managed entries with proper
  skill directories; skips local non-directory entries unless --force
- CheckStatusCopy only counts managed entries that are actual
  directories on disk
- diff and server diff handlers report "target entry is not a
  directory" for both managed and unmanaged non-directory entries
- Add tests for non-directory edge cases in sync, diff, and target info
2026-02-21 06:07:35 +08:00
Willie eb6b4cb650 fix(sync): verify target directory exists before trusting manifest
- P1: diff now checks target skill directory exists before comparing
  checksums; deleted directories are reported as "missing" instead of
  being silently treated as synced
- P2: CheckStatusCopy counts only managed entries that exist on disk,
  so target info shows accurate managed count
- Add tests for deleted target dir detection and manifest/disk mismatch
2026-02-21 06:07:35 +08:00
Willie 854b90e1b0 fix(sync): fix copy mode diff, target info, and project remove bugs
- P1: diff now compares checksums to detect content drift in copy mode
- P2: diff routes on config mode instead of manifest presence
- P2: project target remove cleans up manifest file
- P3: target info uses mode-appropriate status check (copy/merge/symlink)
- Export DirChecksum for use by diff and server handlers
- Add 4 integration tests covering all fixed scenarios
2026-02-21 06:07:35 +08:00
Willie 98db20a9a0 test: add !online build tag to offline integration tests
Prevent test-docker and test-docker-online from running the same 36
offline integration tests. Each offline test file now has
`//go:build !online` so the two sets are mutually exclusive:
- default (no tag): 36 offline tests only
- -tags online: online tests only
2026-02-11 03:40:54 +08:00
Willie f55e056fa4 feat: add comprehensive sandbox integration tests
Add complete integration test coverage for all CLI commands with
isolated sandbox environments that run on every change.

Changes:
- Add testutil package for sandbox test infrastructure
- Add 77 integration tests covering all commands (init, sync, status,
  diff, backup, restore, pull, doctor, target, version, help)
- Update CI workflow to run integration tests on Ubuntu and macOS
- Add SKILLSHARE_CONFIG env var support for test isolation
- Add mise.toml for task management
- Move scripts to scripts/ directory
2026-01-14 22:35:33 +08:00