Commit Graph
289 Commits
Author SHA1 Message Date
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
Willie fe9f40b1b9 fix(tui): account for PaddingLeft in content panel width calculation
contentPanelWidth() returned the lipgloss panel Width which includes
padding, but renderMarkdown used it as the text wrap width. Lines
rendered 1 char too wide would wrap inside the panel, causing the
bottom content to be clipped by MaxHeight — making it impossible to
scroll to the end. Also fixes visual artifacts on table pipe chars
caused by mid-character line wrapping.
2026-02-26 22:27:23 +08:00
Willie 5186d86a3f fix(log): --stats --cmd audit now reads audit.log instead of operations.log
runLogStats() only checked the --audit flag to pick the log file,
ignoring filter.Cmd. This caused `log --stats --cmd audit` to read
operations.log and report "No log entries" even when audit data existed.

Align with runLog() by also checking f.Cmd == "audit".
2026-02-26 22:27:23 +08:00
Willie c0b3f878da fix(sync,log): canonicalize group key to prevent race; honor max_entries: 0
P1: sync_parallel grouped targets by raw path string, so the same
physical directory with different representations (trailing slash,
relative segments, symlink aliases) could be placed in separate groups
and written concurrently. Resolve paths via filepath.Clean → Abs →
EvalSymlinks (walking up to the nearest existing ancestor when the
leaf doesn't exist yet) before using them as group keys.

P2: LogConfig.MaxEntries was int, making 0 (explicit unlimited)
indistinguishable from "not set". Changed to *int so nil = default
(1000), 0 = unlimited, >0 = user value, <0 = fall back to default.
2026-02-26 22:27:23 +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 0afab5cb7b fix(sync): resolve race condition for targets sharing the same path
Multiple targets (e.g. universal/amp/kimi/replit) share ~/.config/agents/skills.
Parallel sync caused concurrent goroutines to race on os.Symlink for the same
destination, producing "file exists" errors.

Fix: group entries by resolved target path so same-path targets run sequentially
within one goroutine. Different-path targets remain fully parallel.

Also addresses PR #52 review feedback:
- audit: replace O(N²) findElapsed with O(1) index-aligned elapsed slice
- test-brew-upgrade: explicit go check + mktemp -d (replaces || true and /tmp)

Add 6 integration tests covering shared-path race condition, idempotency,
--force mode, mixed paths, filters, and output verification.
2026-02-26 22:27:23 +08:00
Willie e80d921b3b docs: update v0.16.2 changelog with diff command, audit TUI, and performance improvements
Add missing entries for all user-facing changes since v0.16.1:
diff command, interactive audit TUI, list tree sidebar, log delete/stats,
parallel sync, mtime fast-path, cached discovery, batch search progress,
website revamp, and unified TUI palette.
2026-02-26 22:27:23 +08:00
Willie 2a015865fd refactor(tui): unify color palette via shared tc struct and configureDelegate
Consolidate 30+ scattered lipgloss.NewStyle() calls across 6 TUI files
into a single tc (TUI colors) struct in tui_colors.go. Add configureDelegate()
helper to replace repetitive ~8-line delegate setup blocks with one call.

- ac/lc structs now reference tc base colors (Title, Dim, Green, Yellow, Red)
- list_tui detail panel: tracked repo and source URL now use tc.Cyan
- skillItem.Title(): inline color for name (bright white) and badge (green/gray)
- search_tui: enable description row (source + tags visible in list)
- Remove unused lipgloss imports from 4 files
2026-02-26 22:27:23 +08:00
Willie defff26147 feat(audit): add interactive TUI, progress bar, and large-scan UX improvements
- Add bubbletea TUI for multi-skill audit results (side-by-side layout
  with skill list + detail panel, severity sorting, fuzzy filter)
- Add progress bar during parallel scan via onDone callback
- Add --quiet/-q flag to suppress clean skill lines
- Add --yes/-y flag to skip large-scan confirmation prompt (>1000 skills)
- Add --no-tui flag to force plain text output
- Scale parallel workers to NumCPU (bounded 2–32) instead of fixed 8
- Use file cache in content-integrity check to avoid redundant disk reads
- Replace line splitting with streaming scan (avoid full []string alloc)
- Remove snippet truncation (preserve full trimmed line)
- Differentiate LOW (bright blue) and INFO (medium gray) severity colors
- Centralize log TUI color styles into `lc` struct
- Export DisplayWidth and add BoxWithMinWidth/HeaderBoxWithMinWidth for
  aligned header + summary box widths
- Update docs with TUI controls, new flags, and CI/CD auto-skip behavior
2026-02-26 22:27:23 +08:00
Willie 68945493aa fix(test): sync unit test assertions with current output formats
- list_tui_item_test: Title() now includes [local] badge, Description()
  returns "" for local skills (badge moved to Title)
- log_stats_test: renderStatsCLI wraps empty message with ANSI color codes
- install_subdir_license_test: license shown via StepContinue (spaced)
  instead of colon-delimited format
2026-02-26 22:27:23 +08:00
Willie ebda635ec7 feat(search): add batch progress display for multi-skill hub install
When selecting 2+ skills from `search --hub`, replace verbose per-skill
output with a pterm AreaPrinter progress display and final summary.

Single-skill selection retains the existing verbose path (StepStart +
TreeSpinner). The progress display follows the syncProgress/diffProgress
pattern: animated spinner, per-skill status, progress bar, and a
StepResult tree closure.

New file: search_batch.go (collect functions, progress driver, summary)
Modified: search.go (routing), search_tui.go (compact list for batch)
2026-02-26 22:27:23 +08:00
Willie 2b7ff5fa18 style: fix whitespace alignment in list_tui, log_tui, manifest 2026-02-26 22:27:23 +08:00
Willie ebdacd5b1b perf(sync): parallelize project-mode target syncing
Refactor cmdSyncProject to use runParallelSync (bounded semaphore)
instead of sequential per-target loop, matching global-mode behavior.
2026-02-26 22:27:23 +08:00
Willie 93858c1555 feat(diff): group output by (action, reason) for compact summary
When skill count is large (thousands), per-skill diff lines are
unreadable. Group items by (action, reason) instead:
- "local copy" shows count only (too numerous to list)
- Other reasons (content changed, source only, etc.) show count + names
- Sort: add → modify → remove
- Action hints (Run 'sync'...) printed once after all groups

Also:
- Hide progress bar for merge/symlink-only targets (instant diffs)
- Collapse isolated duplicate skill names to single summary line in sync
2026-02-26 22:27:23 +08:00
Willie 6f3a0a8a11 perf(diff): parallelize target scanning with bounded semaphore
Targets are now scanned concurrently (up to 8 workers) instead of
sequentially, reducing diff time from sum-of-all to max-of-slowest.
2026-02-26 22:27:23 +08:00
Willie 0fa1ef3a06 style(diff): add blank line between target list and progress bar 2026-02-26 22:27:23 +08:00
Willie f71d78ed92 feat(diff): combine target list with overall progress bar
Show all targets at once (spinner for active, queued for waiting,
checkmark for done) with an overall progress bar at the bottom
tracking total skills across all targets. Uses AreaPrinter for
the combined display, matching the pterm progress bar visual style.
2026-02-26 22:27:23 +08:00
Willie 223bb0b2f7 refactor(diff): use ui.ProgressBar for scanning progress
Replace custom AreaPrinter + goroutine spinner with the same
ui.StartProgress/Increment progress bar used by install, update,
and check commands. Bar tracks total skills across all targets,
with UpdateTitle showing the current target and skill name.
2026-02-26 22:27:23 +08:00
Willie 341132e7fe feat(diff): replace per-target progress bar with overall progress
Show an overall target progress bar (━━━──── 1/3 targets) at the
bottom of the multi-target progress display instead of per-target
progress bars. Only shown when there are multiple targets.
2026-02-26 22:27:23 +08:00
Willie ab80048efd feat(diff): add progress bar for copy mode targets
Copy mode targets now show a visual progress bar (████░░░░ 33%)
alongside the spinner during scanning. Merge/symlink mode targets
continue showing spinner-only since they complete instantly.
2026-02-26 22:27:23 +08:00
Willie 956d836df7 feat(diff): add multi-target progress display with spinner
Show all targets at once during diff scanning using pterm AreaPrinter.
Active target displays animated spinner with detail text, waiting
targets show "queued", completed targets show checkmark with summary.
Progress area is cleared after scanning, followed by grouped results.
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 daa1ed152b feat(log): add delete functionality to log TUI
Enable selecting and deleting log entries directly from the interactive
TUI without exiting. Uses space-toggle multi-select with two-step
confirmation (d → y) to prevent accidental deletion.

Backend: oplog.DeleteEntries() matches entries by content (timestamp,
command, status, duration) rather than index, since Read() and
readAllEntries() use opposite sort orders. Atomic rewrite via tmp+rename.

TUI keys: space (toggle), a (select all/none), d (delete), y/n (confirm).
Entries grouped by source file (operations vs audit) before deletion.
Async reload after delete reuses the original loadFn to preserve filters.
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 2f6dd42695 perf(sync): cache discovery + add progress UI for sync operations
DiscoverSourceSkills was called 1+2N times (N = number of targets),
each doing a full filepath.Walk + SKILL.md frontmatter parsing.
Now discovered once and passed to all targets via WithSkills variants.

Changes:
- Add SyncTargetMergeWithSkills, PruneOrphanLinksWithSkills (PruneOptions struct)
- Add SyncTargetCopyWithSkills with onProgress callback, PruneOrphanCopiesWithSkills
- Discovery spinner + per-target reporting + summary line in CLI
- Copy mode shows per-skill spinner progress during slow checksum+copy
- Collision report uses dim gray text to avoid confusion with sync results
- Server handlers (handleSync, handlePull) use single discovery pass
- Fix pre-existing TestLog_StatsOutput assertion ("Success rate" → "OK:")
2026-02-26 22:27:23 +08:00
Willie 4f656aeca6 refactor(list): replace focus-based dual-pane with fixed keyboard roles
Keyboard always controls left tree (j/k navigate with auto-preview,
h/l collapse/expand). Ctrl+d/u/g/G always scroll right content panel.
No focus switching needed — eliminates sidebarFocused/viewingFile state.
2026-02-26 22:27:23 +08:00
Willie da0b24ad25 feat(list): add tree sidebar content viewer with glamour markdown rendering
Dual-pane content viewer for list TUI: left sidebar shows recursive file
tree (depth≤3), right panel renders Markdown via glamour with custom style.
Vim-like navigation: h/l expand/collapse dirs, j/k auto-preview, Tab to
switch panels. Mouse wheel scroll and click supported.
2026-02-26 22:27:23 +08:00
Willie 5f1521c3fd feat(log): comprehensive log improvements — partial status, instrumentation, retention, stats
- Report "partial" status for sync/install/update/uninstall when some
  items succeed and others fail
- Instrument 6 new commands: check, diff, trash, init, upgrade, and
  all mutating commands now log to operations.log
- Auto-truncation via WriteWithLimit with configurable log.max_entries
  (default 1000) and 20% hysteresis to avoid truncating every write
- Stats engine: computeLogStats with per-command breakdown
- CLI --stats flag with colored output and ✓ok/total ratios
- TUI stats panel (toggle with 's'): bar charts, status distribution,
  last operation timestamp
- TUI stats footer: compact always-visible summary line
- TUI detail panel: j/k scrolling for long entries, proportional
  list/detail layout (40%/60%)
- Web API: GET /api/log/stats endpoint
- Updated website docs for log command
2026-02-26 22:27:23 +08:00
Willie 40152f974e fix(log): improve TUI detail panel readability and filter flags from oplog names
- Render list fields as multi-line bullets instead of comma-joined single line
- Condense lists >5 items to "... and N more" to prevent panel overflow
- Increase detail panel reserved height (Height-24) for bullet expansion
- Extract uninstallOpNames() to filter behavioral flags (--force, --dry-run)
  from oplog entries — fixes --force appearing as a skill name in log
2026-02-26 22:27:23 +08:00
Willie a88bb101c5 feat(auth): add AZURE_DEVOPS_TOKEN for Azure DevOps HTTPS authentication
Add PlatformAzureDevOps detection (dev.azure.com, ssh.dev.azure.com,
visualstudio.com) and AZURE_DEVOPS_TOKEN env var support. Token is
auto-injected via git config insteadOf rewrite, same pattern as
GITHUB_TOKEN/GITLAB_TOKEN/BITBUCKET_TOKEN.

Update error messages, sanitizeTokens redaction, environment-variables
docs with PAT creation guide and official Microsoft docs link, and
url-formats docs with Azure DevOps auth section.
2026-02-26 22:27:23 +08:00
Willie 02b663ec58 feat(update): add --prune for stale skills, stale detection in check, refactor update handlers
- update --prune: detect skills deleted upstream and move them to trash
  (batch + single-target paths), clean registry entries after prune
- update without --prune: warn about stale skills with suggestion
- check: report "stale" status for skills whose subdir no longer exists
  in the remote repo (previously misreported as update_available)
- Refactor updateTrackedRepo, updateRegularSkill, updateTrackedRepoQuick,
  updateSkillFromMeta to accept *updateContext instead of 7-10 individual
  params; delete dead updateSkillOrRepo function
- Add integration tests for prune (standalone, nested, all-stale,
  registry cleanup) and project-mode prune
- Update website docs for update --prune and check stale status
2026-02-26 22:27:23 +08:00
Willie 3710969f9d fix(upgrade): contain brew output in tree spinners, fix GitHub release tree structure
Homebrew path: replace direct stdout pipe with TreeSpinner + bytes.Buffer
so brew output no longer breaks the tree layout. Captured output is only
shown on failure for debugging.

GitHub release path: switch download/UI-asset spinners from StartSpinner
to StartTreeSpinner with correct isLast flags, add tree-line prefix to
confirmation prompt, use StepEnd for cancel.

Add TreeSpinner.Warn() and TreeLine() helper to internal/ui.
Add devcontainer test-brew-upgrade script to simulate Homebrew path.
2026-02-26 22:27:23 +08:00
Willie 153464afd1 tweak(install): increase desc truncation to 100 chars, use visible ellipsis 2026-02-25 19:39:28 +08:00
Willie c8535663eb feat(audit): colorize severity counts, risk label, and finding details
- Summary line: CRITICAL/HIGH/MEDIUM/LOW/INFO colored by severity
- Risk label: colored by severity (e.g. red for CRITICAL)
- Finding groups: severity-colored prefix, locations on separate
  indented gray line (maxLocs reduced from 5 to 3)
- Add visual gap between summary block and finding details
2026-02-25 19:39:28 +08:00
Willie 910b8d6dc4 feat(install): inline tree output and unified filter for install TUI
- Replace SkillBox with inline tree steps (Desc, License, Location)
  for single-skill and tracked-repo install output
- Add custom application-level filter to dir picker and skill select
  TUIs, replacing bubbles built-in filter for consistency with
  list/search/log TUI pattern
- Add renderSkillMeta/renderTrackedRepoMeta/truncateDesc helpers
2026-02-25 19:39:28 +08:00
Willie 70b40fab52 fix(ui): show output before blocking work in check/update
Move Header + StepStart before filesystem scan and metadata reads so
users see immediate feedback instead of a frozen terminal.

- check: Header printed before GetTrackedRepos/GetUpdatableSkills
- check filtered: Header printed before resolve phase
- Add spinners during blocking scan/resolve phases
- Unify tree structure: Repo/Skill use StepContinue (not StepStart)
- Add "(tracked)" label to tracked repo in update output
2026-02-25 19:39:28 +08:00
Willie 9b3d0d0b23 feat(install): show skill description in SkillBox
Enrich the single-skill install SkillBox with the SKILL.md frontmatter
description field, giving users useful context instead of repeating the
skill name. License line appended when present.

- Add Description field to SkillInfo struct
- Use ParseFrontmatterFields to read description + license in one pass
- Extract buildSkillBoxDesc helper for the two single-skill call sites
2026-02-25 19:39:28 +08:00
Willie b6517c9e93 feat(tui): unify filter, status line, and spinner across all TUIs
- Extract renderTUIFilterBar() shared by list, log, and search TUIs
- Extract renderPageInfoFromPaginator() for shared page info rendering
- Replace built-in bubbles filter with custom textinput filter in log
  and search TUIs (matches list_tui pattern: / enter, esc clear, enter lock)
- search_tui: filter mode suppresses action keys (space/a/enter/s) to
  avoid accidental checkbox toggles while typing
- Align status line left (remove extra indentation) across all TUIs
- Add ←→ page hint to all TUI help lines
- Unify pterm spinner to braille dot pattern (⣾⣽⣻⢿⡿⣟⣯⣷) with cyan
  style, matching bubbletea spinner.Dot used in list_tui
2026-02-25 19:39:28 +08:00