Commit Graph
326 Commits
Author SHA1 Message Date
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 20411ed89c fix(diff): hide .skillshare-meta.json from file-level diff and make --stat imply --no-tui 2026-03-02 02:23:50 +08:00
Willie 924487b334 feat(diff): add file list, text diff, and time info to TUI detail panel
- Add expand state (Enter key toggle) for file-level diff display
- Show file list with +/-/~ icons for add/delete/modify files
- Show colored unified diff (green/red/cyan) for modified files
- Add source/target mtime rows in detail header
- Replace "Actions" section with "Next Steps" using prominent styling
- Update list item description with sync/local breakdown
- Add stat counts (err/diff/ok) to TUI title bar
- Fix freeze: defer file walk to Enter toggle instead of every render
- Fix gofmt in trash_tui.go and restore.go
2026-03-02 02:23:50 +08:00
Willie c72ab5fed4 feat(diff): add --patch and --stat flags with file stat, time info, and unified diff 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 c59498bc6c feat(diff): extend diff entries with file-level data, source paths, and mtime
- Add files, srcDir, dstDir fields to copyDiffEntry for lazy file diff
- Add srcMtime, dstMtime to targetDiffResult for time display
- Add ensureFiles() lazy loader and latestMtime() helper
- Pass sourceMap through collectMergeDiff for source path resolution
- Use named struct literals throughout collect functions
2026-03-02 02:23:50 +08:00
Willie 398e0bf40c feat(diff): add file-level diff engine for skill content comparison
Implement diffSkillFiles to walk source/destination directories and
detect add/modify/delete changes at the file level. Uses SHA-256 for
content comparison and sergi/go-diff for unified text diffs. Includes
binary detection, git-style stat rendering, and 9 unit tests.
2026-03-02 02:23:50 +08:00
Willie 27e5c3ae82 feat(diff): add interactive bubbletea TUI with left-right panel layout
Left panel shows target list with status icons (✓/!/✗), right panel
displays categorized diff details for the selected target. Supports
filter (/), detail scroll (Ctrl+d/u), and narrow terminal fallback.

Add --no-tui flag for plain text output; non-TTY auto-falls back.
2026-03-02 02:23:50 +08:00
Willie f5a816673f fix(backup,restore): handle -g/-p mode flags correctly
Both commands were missing parseModeArgs(), causing -g to be
misinterpreted as a target name. Now -g is accepted silently
(global is default) and -p returns a clear error.
2026-03-02 02:23:50 +08:00
Willie c5be126f0b feat(install,update,uninstall): add glob pattern matching for skill names
Support glob patterns (*, ?, [...]) in skill name arguments across all
three commands. Matching is case-insensitive.

- install: --skill and --exclude flags support glob (e.g. -s "core-*")
- update: positional names support glob (e.g. update "core-*")
- uninstall: positional names support glob (e.g. uninstall "core-*")

Shared helpers isGlobPattern() and matchGlob() extracted to helpers.go
to avoid duplication. Includes 25 new tests and updated docs.
2026-03-02 02:23:50 +08:00
Willie 6d90481980 feat(tui): add red text to all destructive action confirmations
- trash_tui: delete and empty confirmations now render in red
- list_tui: uninstall confirmation now renders in red
- Consistent with restore_tui delete confirmation pattern
2026-03-02 02:23:50 +08:00
Willie 102b9e3a31 feat(restore): add --help flag and delete backup from TUI
Add --help/-h handling for both backup and restore commands.
Add d key in restore TUI to delete selected backup with red
confirmation prompt and success message.
2026-03-02 02:23:50 +08:00
Willie 995eb114d5 feat(restore): add unified Backup Restore TUI
Interactive two-phase TUI: target picker → version list with left-right
split panel layout. Includes detail panel with skill diffs, descriptions,
and target state. Wires no-args restore to TUI dispatch with --no-tui
fallback.
2026-03-02 02:23:50 +08:00
Willie 3e9453968d feat(trash): add SKILL.md preview to TUI detail panel
Show the first 15 lines of SKILL.md in the trash detail panel so users
can preview skill content before deciding to restore or delete.
2026-03-02 02:23:50 +08:00
Willie b2af4f4929 feat(trash): add interactive TUI for trash list
Add bubbletea-based TUI with multi-select, fuzzy filter, and inline
restore/delete/empty operations. Follows the same dispatch pattern as
list and log: JSON → TUI (TTY + items + !--no-tui) → plain text.
2026-03-02 02:23:50 +08:00
Willie 00f8f38dd8 fix(check): pass custom targets to unknown-target validation in project mode
Follow-up to PR #58: check_project.go now extracts custom target names
from project config and passes them to findUnknownSkillTargets, matching
the global-mode fix. Also surfaces config load errors as warnings instead
of silently ignoring them. Adds integration tests for check and doctor
(global + project mode) verifying no false "unknown target" warnings.
2026-02-28 18:48:51 +08:00
Colin Mason ae500e89ca include user-configured targets in unknown target validation
findUnknownSkillTargets only checked the built-in targets.yaml list,
causing false warnings for custom targets defined in config.yaml.

Pass configured target names from global/project config into the
validation so user-defined targets are recognized.
2026-02-28 18:35:25 +08:00
Willie 0e488698ff feat(upgrade): show version transition in Homebrew and skill upgrade output
Previously, `skillshare upgrade` via Homebrew only showed "Upgraded" with
no version info, and skill downloads had the same issue. Now all upgrade
paths display clear version transitions:

- Homebrew: "Upgraded  v0.16.3 → v0.16.5" or "Already up to date ✓"
- Direct download: "Upgraded  v0.16.3 → v0.16.5" (was "Upgraded to v0.16.5")
- Skill install: "Installed v0.16.5" (new) or "Upgraded  v0.1.0 → v0.16.5"

Also records toVersion in oplog for Homebrew upgrades.
2026-02-28 18:25:57 +08:00
Willie 5017df2336 perf(status,doctor): eliminate redundant discovery and CheckStatus calls
status: single DiscoverSourceSkills pass shared across printSourceStatus,
printTrackedReposStatus, and printTargetsStatus; extractTrackedRepos
replaces GetTrackedRepos Walk; targetStatusResult carries syncedCount
so drift check reuses getMerge/CopyStatusDetail results.

doctor: single DiscoverSourceSkills pass shared across 5 check functions
(checkSource, checkSkillsValidity, checkSkillTargetsField, checkSyncDrift,
checkDuplicateSkills); cachedTargetStatus map lets checkSyncDrift reuse
checkTargets results; checkForUpdates network request runs in goroutine
overlapping local I/O.

Both commands show a spinner during discovery to avoid appearing frozen
on large skill sets.
2026-02-28 03:44:02 +08:00
Willie d86ee8cc7f fix(ui): align spinner output and skip backup when no skills
Remove 2-space indent from spinner Success/Fail/Warn and
SuccessMsg/ErrorMsg so they align with other ui.Success output.

Move backup after discovery in sync so it is skipped when there
are 0 skills to sync — no point backing up if nothing will change.
2026-02-28 03:44:02 +08:00
Willie 9a7ee1b6f7 fix: address code review findings (3 important + 5 suggestions)
- Fix non-TTY progress bar not incrementing for grouped skills in Phase 2
- Fix Unicode truncation in UpdateTitle using runewidth instead of len()
- Fix IP address regex missing end-of-line bare IPs (add $ anchor)
- Fix gofmt alignment in updateTarget struct comments
- Extract sliceHasName[T] generic helper to deduplicate universal detection
- Add nil meta defensive warning with skipped count in grouped updates
- Replace hand-rolled contains/containsStr with strings.Contains in tests
- Add red team TC-20b for inline code fetch-with-pipe detection
2026-02-28 03:44:02 +08:00
Willie 51d2e3a6c5 perf(update): speed up grouped updates and unstick progress bar
Optimize grouped repo updates by skipping reinstall when installed metadata already matches remote state (commit match, or subdir tree-hash match when HEAD moved).

Emit per-skill grouped progress events so the batch progress bar advances continuously instead of appearing stuck at 0%.

When skipping by tree-hash match, best-effort refresh meta.Version to latest commit to keep status/version output current.

Add unit tests covering commit/tree-hash skip behavior and metadata version refresh.
2026-02-28 03:44:02 +08:00
Willie 0f29dd3abd perf(update): remove per-skill delay in batch update loop
Drop the fixed 50ms sleep in the grouped batch update iteration. On very large update --all runs this sleep dominates runtime (for example ~90 minutes at ~108k skills) without improving correctness.

This keeps progress updates intact while eliminating artificial throttling in TTY mode.
2026-02-28 03:44:02 +08:00
Willie 65402b9491 feat(update): add phase headers and scanning spinner for batch mode
- Add PhaseHeader UI helper for "[1/3] Pulling N tracked repos..." labels
- Show phase headers between batch update phases when 2+ phases exist
- Skip phase headers when only 1 phase (avoids meaningless "[1/1]")
- Lazily start progress bar after first phase header to fix ordering
- Add scanning spinner during filepath.Walk for large skill sets
- Cache metadata in updateTarget to avoid redundant ReadMeta calls
2026-02-28 03:44:02 +08:00
Willie 4c70b7d0af perf(gitignore): batch read/write for install reconcile and uninstall
UpdateGitIgnore/RemoveFromGitIgnore were called per-skill inside loops,
re-reading the entire .gitignore each time. With large files (100K+ lines
in project mode), this caused O(N×M) complexity and process hangs.

- Add UpdateGitIgnoreBatch and RemoveFromGitIgnoreBatch (single read/write)
- ReconcileProjectSkills: collect entries during walk, batch-update once
- uninstall (global + project): batch-remove after loop, not per-iteration
- Fix spinner WithRemoveWhenDone in StartSpinnerWithSteps
- Add E2E runbook for gitignore batch performance validation
2026-02-28 03:44:02 +08:00
Willie 965f06077b fix(pull): force global sync after pull to avoid project mode auto-detection
When pull calls cmdSync with empty args in a directory containing
.skillshare/config.yaml, auto-detection incorrectly switches to
project mode. Pass --global explicitly since pull always operates
on the global source.
2026-02-28 03:44:02 +08:00
Willie 13acc7533d fix(list): add in-TUI confirmation and explicit mode flags for actions
A/U/X shortcuts now show a confirmation overlay (→ skillshare <action>
<flag> <skill>, Proceed? [Y/n]) before executing. This prevents
accidental actions and lets users see the exact command.

Global mode dispatch now passes -g to audit/update/uninstall, fixing
auto-detect misidentifying as project mode when .skillshare/ exists
in cwd. Uninstall adds --force to skip double confirmation since
the TUI already confirmed.
2026-02-28 03:44:02 +08:00
Willie e14ef99641 fix(ui): add trailing blank line after command output
Add visual separation between command output and the shell prompt
for better readability.
2026-02-28 03:44:02 +08:00
Willie 1099ba4a9e feat(ui): unified batch summary and output patterns across commands
Add generic OperationSummary() with Metric struct for consistent
batch output. Refactor SyncSummary/UpdateSummary as thin wrappers.

Apply unified patterns to collect, uninstall, backup:
- Spinner for scanning phases
- StepDone/StepSkip/StepFail semantic indicators
- OperationSummary for batch results
- Header before collect scanning for context
- Spacing before backup "Recent backups" section

Fix pterm spinner RemoveWhenDone bug: Success/Fail/Warn messages
were silently eaten because Stop() clears the line after printing.
Use Stop() + lightweight symbols (✓/✗/!) instead of pterm badges.
Also replace SuccessMsg/ErrorMsg pterm.Success/Error badges.
2026-02-28 03:44:02 +08:00
Willie 5d9a77372d feat(init): label universal as shared agent directory and add coexistence docs
- Change universal description from "(recommended)" to "(shared agent directory)"
  in detect, checklist, and discover flows
- Add FAQ section on using universal alongside npx skills: merge vs copy mode
  differences, name collision caveats, lock file visibility
- Add universal info admonition to supported-targets page
- Add E2E runbook for universal target path verification
- Update CHANGELOG and release notes for v0.16.4
2026-02-28 03:44:02 +08:00
Willie 1a207e6d2c feat(audit): add fetch-with-pipe, ip-address-url, and data-uri rules
Add 5 new audit rules (31 → 36 total) to close detection gaps:

- fetch-with-pipe (HIGH ×3): curl/wget piped to sh/bash/python/node/etc.
  Previously only double-pipe (||) was caught by shell-chain; single
  pipe (|) to interpreters — the classic RCE vector — was undetected.
- ip-address-url (MEDIUM): URLs with raw IP addresses that bypass DNS
  security controls; excludes RFC 1918 and loopback ranges.
- data-uri (HIGH): data: URIs in markdown links that may embed
  executable content.

fetch-with-pipe is suppressed inside markdown code fences (tutorial
context), matching existing behavior for destructive-commands et al.

Includes unit tests (25 cases), code fence suppression test, red team
TC-18 through TC-21, and audit.md documentation updates.
2026-02-28 03:44:02 +08:00
Willie 8997196593 fix(init): correct universal target path and auto-include in init
The universal target pointed to ~/.config/agents/skills (wrong) instead
of ~/.agents/skills, causing `npx skills list` to miss synced skills.

Also auto-recommend universal as a target whenever any CLI is detected
during `init` and `init --discover`, since ~/.agents/ won't exist on
disk until skillshare creates it.

Closes #54
2026-02-28 03:44:02 +08:00
Willie 79f26f2e98 fix(docs): correct broken anchor link in docker-sandbox page
#interactive-playground → #playground to match the actual heading ID.
2026-02-28 03:44:02 +08:00
Willie 666091a453 feat(install): add cross-path duplicate detection and same-repo skip
Prevent accidental duplicate installs when the same repo is already
installed at a different path (e.g., --into vs root). Same-repo
reinstalls now show a friendly skip indicator instead of an error.

- Add CheckCrossPathDuplicate() with URL normalization (HTTPS/SSH)
- Add ErrSkipSameRepo sentinel for graceful skip flow control
- Add checkExistingConflict() with repo URL comparison
- Fix --force hint to use repo URL (not per-skill subpath) and
  include --into when applicable
- Add dedup check to Web UI install endpoints (HTTP 409)
- Group skipped skills by directory with repo label in summary
2026-02-28 03:44:02 +08:00
Willie 0f2d66e18a refactor(update): align batch summary with sync-style single-line format
Replace verbose SuccessMsg summary with UpdateSummary() matching
SyncSummary's clean single-line stats format with color coding.
2026-02-28 03:44:02 +08:00
Willie 41fe18b3be fix(update): normalize empty Subdir to "." for root-level skill repos
Root-level skills (SKILL.md at repo root) have meta.Subdir="" but
discoverSkills() returns Path=".". The mismatch caused lookup failure
in batch update, falsely reporting these skills as stale/deleted.
2026-02-28 03:44:02 +08:00
Willie dc62efdb40 fix(list,log): skip TUI when async load returns empty results
When list or log TUI loads zero items asynchronously, exit the TUI
immediately and print a plain-text hint instead of showing an empty
interactive screen. Uses an emptyResult flag on the TUI model to
signal the caller after tea.Quit.
2026-02-27 05:39:49 +08:00
Willie cfbcaaff9e fix(uninstall): fix stale summary, skip message, and pluralization UX
After pre-flight filters out dirty tracked repos, recalculate summary
so spinner and confirm prompt use correct noun type. Print skip count
when repos are skipped. Replace all "(s)" patterns with pluralS() for
natural English output ("2 groups" not "2 group(s)"). Add isMixed()
method to avoid magic string comparison on noun().
2026-02-27 05:39:49 +08:00
Willie 87abb6e049 feat(install): replace spinner with tree-style progress and summary output
Switch config install and search install UI from plain spinner to
TreeSpinner with StepResult summary showing installed/skipped/failed
counts and elapsed time. Add git clone progress callback to spinners
so users see real-time cloning status.

- Add Quiet field to InstallOptions for suppressing per-skill output
- Add Skipped field to ConfigInstallResult for accurate summary
- Update integration test assertion to match new summary format
2026-02-27 05:39:49 +08:00
Willie 0a28fcdbdb fix(search): preserve canonical repo source in grouped installs
Use a repo-root source in grouped search installs by normalizing from CloneURL instead of carrying subdir Raw values. This prevents malformed metadata sources (for example duplicated subdir paths) and keeps provider-agnostic behavior for GitHub/GitLab/Bitbucket/Azure and SSH URLs.

Also centralize discovery source formatting for metadata so whole-repo SSH installs use //subdir syntax consistently.

Add regression coverage:
- cmd unit tests for grouped clone source normalization across providers
- install unit tests for discovery source formatting (including SSH)
- integration test in tests/integration that verifies grouped install metadata source round-trips through ParseSource.
2026-02-27 05:39:49 +08:00
Willie 5a111ce8f6 fix(search): use provider-agnostic source for repo-grouped cloning
Replace GitHub-specific GitHubOwner()/GitHubRepo() calls with a
value copy of the parsed source, clearing only Subdir. Fixes empty
Raw/Name for GitLab, Bitbucket, and Azure DevOps batch installs.
2026-02-27 05:39:49 +08:00
Willie 76482a5c09 feat(search): colorize risk badges in hub TUI with lipgloss
Replace plain-text risk badges with lipgloss-styled colored versions
in the search TUI list and detail panel, matching the severity color
palette used elsewhere. Add CHANGELOG entry for v0.16.3.
2026-02-27 05:39:49 +08:00
Willie 48b670220d fix(search): improve batch install failure output readability
Classify failure details by type (security/ambiguous/not found) with
distinct icons and colors. Truncate long ambiguous path lists and audit
findings to 3 lines + "(+N more)" to prevent screen flooding. Add
breathing room between multi-line entries. Highlight skill names in
bright white for better scanability.

Also includes repo-grouping refactor: skills from the same git repo
are cloned once and installed from the shared clone, with extracted
helpers (groupByRepo, installFromDiscoveryResult, logSkillInstallOp).
2026-02-27 05:39:49 +08:00
Willie dec449a898 fix(search): show git progress detail and reconcile once after batch install
- Show detailed git clone status (cloning 45%, resolving 67%) instead of
  static "installing..." by wiring up install.OnProgress callback
- Only show actively installing skills in progress area (skip queued/done)
- Move per-skill reconcile to single batch-level reconcile at end, fixing
  O(n²) directory walks that caused batch installs to appear stuck
2026-02-27 05:39:49 +08:00
Willie 9ef63572f3 revert(ui): switch progress bar back to pterm ProgressbarPrinter
The custom thread-safe progress bar (progress.go) had width overflow
issues. Revert to pterm's built-in ProgressbarPrinter which handles
terminal width calculation internally. Remove StartProgressWithMaxWidth
in favor of the simpler StartProgress API.
2026-02-27 05:39:49 +08:00
Willie 3a522c7ca9 fix(tui): add breathing room in list and log TUI footers
Add vertical spacing between panels, stats, and help bar in list and
log TUIs to match the audit TUI layout. Adjust panel heights to
compensate for the added lines.
2026-02-27 05:39:49 +08:00
Willie 044a0226aa refactor(ui): replace pterm progress bar with thread-safe implementation
pterm's ProgressbarPrinter has no internal mutex, causing race conditions
when multiple goroutines call Increment() concurrently — the final render
could show a stale count (e.g. 954/955 instead of 955/955). Additionally,
pterm's auto-stop (triggered when Current >= Total) made external Stop()
a no-op, preventing us from controlling the final display.

New progress.go implementation:
- Uses sync/atomic for thread-safe counter updates
- Stop() forces current=total and renders a final frame
- Adds StartProgressWithMaxWidth() to constrain bar width

Also in this commit:
- audit: hide per-skill scan list when TUI is active (summary only)
- audit: extract presentAuditResults() to deduplicate output logic
- audit: align progress bar width with header/summary box
- audit TUI: add breathing room between panels, stats, and help bar
2026-02-27 05:39:49 +08:00
Willie e4956c3ff1 fix(tui): unify layout and visual consistency across TUI panels
- Add colorSkillPath() for progressive luminance on nested skill paths
  (cyan group → gray sub-dirs → white skill name) in list and audit TUIs
- Move filter bar below panels in audit and log TUIs for consistent layout
- Align log TUI left panel width (25%, max 45) with audit TUI proportions
- Show elapsed time on pull/push completion messages
- Use relative paths in audit results for group hierarchy display
- Render license field in green, adjust content overlay spacing
2026-02-27 05:39:49 +08:00
Willie 61f413da2d fix(tui): hard-wrap content to prevent scroll clipping
Glamour tables and long lines can exceed the panel's text width.
Scroll calculations are based on logical line count, but lipgloss
wraps overflowing lines into extra visual rows, clipping the bottom.

Hard-wrap all content with ansi.Hardwrap before storing it, so
logical lines = visual lines and scrolling reaches the end.
Also bump contentViewHeight to termHeight-5 for breathing room.
2026-02-26 22:27:23 +08:00