Commit Graph
260 Commits
Author SHA1 Message Date
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
Willie 07c2aa6938 feat(list): async TUI loading, status line improvements, parallel metadata
- Move data loading inside TUI with bubbles/spinner to eliminate
  blank screen after entering alt screen
- Thousand separators in status line (108,749 skills)
- Page info in status line (Page 2 of 4,729) replacing raw "1/4944"
- Fix "(showing 1,000)" appearing with empty filter text
- Parallel ReadMeta with bounded worker pool (64 workers)
- Parallel git dirty checks in uninstall (8 workers)
- Use DiscoverSourceSkillsLite for uninstall --all discovery
2026-02-25 19:39:28 +08:00
Willie aeddeb9dfe fix(install): show [dry-run] message for single-skill git install paths
handleGitInstall has two single-skill paths (subdir and non-subdir)
that always printed "✓ Installed: <name>" even in dry-run mode.
Branch on opts.DryRun to show "[dry-run] Would install: <name>" instead,
matching the multi-skill path behavior.

Fixes failing CI tests: TestInstall_Auth_HTTPSPublicWithToken,
TestInstall_RemoteGitHubSubdir_DryRun.
2026-02-25 07:02:54 +08:00
Willie 81315cdf71 style: fix gofmt alignment in checklist_tui.go 2026-02-25 07:02:54 +08:00
Willie 2cb6cc3159 refactor: update all callers to pass Registry to reconcile functions
- install_context: read skills from Registry instead of Config
- project_runtime: load Registry on init
- install/search: pass Registry to ReconcileGlobalSkills
- uninstall: load/save Registry for skill removal
- server: hold registry field, reload on config refresh
2026-02-25 07:02:54 +08:00
Willie cfe709f254 feat(list-tui): expand detail panel with word-wrapped description and license
Grow the detail panel from 12 to 16 reserved lines so more metadata is
visible. Description now word-wraps to terminal width (up to 3 lines
with trailing "..." when truncated) and is followed by a blank line for
visual separation. Also display the license field from SKILL.md
frontmatter when present.
2026-02-25 07:02:54 +08:00
Willie 7fb201da84 refactor(init): replace survey with bubbletea checklist and inline prompts
Remove all survey/v2 dependency (7 call sites) and fuzzy direct usage:
- search.go: survey.Input → bufio.NewReader for simple text prompts
- init.go: survey.Select → inline numbered prompt for sync mode
- init.go: survey.MultiSelect → checklist TUI for target/agent selection
- init_project.go: survey.MultiSelect → checklist TUI for project targets
- install_prompt.go: survey.Select → checklist TUI for orchestrator mode
- install_prompt.go: delete dead promptSearchSelect function
- install_prompt.go: fuzzy → strings.Contains for filterSkillsByName

Add generic checklist_tui.go supporting both multi-select and single-select,
reusing the existing bubbletea/bubbles styling. Sync mode uses a simple
inline prompt (no alt-screen) for smoother init flow, with a copy-mode
hint when non-copy is selected. TUI selections now print confirmation
after exit so users see what they chose.
2026-02-25 07:02:54 +08:00
Willie fc2df38913 feat(check): match single-skill output style with update command
Single-skill check now shows the same tree-structured header (Source,
Items, Skill name, Source URL) and uses a spinner + StepResult instead
of a progress bar, consistent with how `update` renders single targets.
2026-02-25 07:02:54 +08:00
Willie ce8608a6b1 fix(check): normalize leading slash in subdir for tree hash comparison
The // subdir syntax (e.g., repo//skills/foo) stores meta.Subdir with
a leading "/". git rev-parse and ls-tree paths never have leading
slashes, causing tree hash lookups to fail silently.

Strip leading "/" in getSubdirTreeHash(), resolveSkillStatuses(), and
handler_check.go. Add LeadingSlash unit test and E2E runbook.
2026-02-25 07:02:54 +08:00
Willie 82587e9d9f fix(check): show skill count instead of URL count in progress bar
Progress bar total was `len(repoInputs) + len(urlInputs)` which showed
"2/2" for 46K skills from 2 URLs — meaningless to users. Now uses actual
skill count so the bar shows "46321/46321" instead.
2026-02-25 07:02:54 +08:00
Willie 117b319050 feat(check): per-skill tree hash comparison for precise update detection
Previously `skillshare check` compared repo-level commit hashes, causing
all skills from a registry repo to show "update_available" whenever any
commit was pushed — even if the individual skill's files were unchanged.

Now each skill records its git tree hash (subdir-level SHA) at install
time. During check, a three-tier comparison is used:

1. Fast path: commit hash matches → up_to_date (zero extra cost)
2. Tree hash path: blobless fetch (~150KB) + batch ls-tree → per-skill
   comparison; unchanged subdirs stay up_to_date
3. Fallback: no tree hash (old installs) → commit comparison (unchanged)

Also fixes pterm progress bar printing twice when it auto-stops at 100%.
2026-02-25 07:02:54 +08:00
Willie 9743fa00ac refactor(tui): replace survey Select with bubbletea multi-select in search
Replace the single-select survey.Select prompt in `search` with a
bubbletea-based multi-select TUI, enabling batch installation of
search results. The new TUI supports space/a toggle, `s` for search
again, `/` filter, and esc to cancel — consistent with the existing
skill select TUI pattern from install.

Add batchInstallFromSearch() for sequential multi-skill installation
with per-skill error reporting.
2026-02-25 07:02:54 +08:00
Willie f7bfb56c50 refactor(tui): replace survey MultiSelect with bubbletea skill select TUI
- Replace promptMultiSelect's survey.MultiSelect with a full bubbletea
  TUI (space toggle, a select-all, enter confirm, / filter, esc cancel)
- Unify TUI styling across all screens: brand yellow (#D4D93C) for
  active item border+text, bright white for normal items
- Fix infinite loop when selecting (root) group in dir picker
- Compact single-line items with SetHeight(1) + SetSpacing(0)
- Pre-compute location strings and maintain selCount counter for
  better toggle performance with large skill sets
- Remove inline ANSI from Title() to prevent filter highlighting corruption
- List TUI: single-line items with [tracked]/[local] badges, no description
2026-02-25 07:02:54 +08:00
Willie e6ca4f16f8 refactor(update): unify batch header UI with check command style
Replace redundant "Updating N skill(s)" header + separator with the
same tree layout used by check: Header → StepStart("Source") →
StepContinue("Items") with repo/skill counts. Removes duplicate
"Updating" label that overlapped with the progress bar title.
2026-02-25 07:02:54 +08:00
Willie 7287e6bf81 fix(install): resolve infinite loop in directory picker for large repos
groupSkillsByDirectory() used filepath.Dir() which always returned the
same parent regardless of recursion depth. Add a prefix parameter so
each level strips already-navigated directories before grouping.

Also fix stale assertion in TestCheck_RegularSkill_ShowsMeta to match
the summarized local-skill output introduced in 37f3425.
2026-02-25 07:02:54 +08:00
Willie 0f242307f4 refactor(install): unify duplicated logic between global and project modes
Introduce InstallContext interface to abstract global/project behavioral
differences, push config-based install logic down to internal/install,
and merge the nearly-identical Git discovery/subdir handlers.

- Add InstallContext interface (SourcePath, ConfigSkills, Reconcile,
  PostInstallSkill, Mode) with SkillEntryDTO to avoid circular imports
- Add globalInstallContext and projectInstallContext implementations
- Extract InstallFromConfig() to internal/install/install_config.go,
  replacing the 90%-identical installFromGlobalConfig/installFromProjectConfig
- Merge handleGitDiscovery + handleGitSubdirInstall into handleGitInstall,
  branching on source.HasSubdir() for the few differences
2026-02-25 07:02:54 +08:00
Willie 3fa49a86e4 feat(check): summarize up_to_date/local results instead of listing each
Suppress per-item output for up_to_date repos/skills and local skills,
showing counts in the summary instead. This prevents terminal flooding
when checking hundreds of skills (e.g. 920+).

- Extract shared renderCheckResults() to deduplicate runCheck/runCheckFiltered
- Full check (no args): hide up_to_date + local, show counts in summary
- Filtered check (names/groups): hide up_to_date, still show local individually
- JSON output unchanged
2026-02-25 07:02:54 +08:00
Willie e5c1f64fc3 feat(check): parallelize runCheckFiltered with batch pattern
Replace serial checkTrackedRepo/checkRegularSkill loop in
runCheckFiltered() with the same parallel batch pattern used by
runCheckAll(): partition targets into repo/skill names, call
collectCheckItems for URL deduplication, then fan out via
ParallelCheckRepos and ParallelCheckURLs with a progress bar.

Remove now-dead checkTrackedRepo and checkRegularSkill functions
and the unused git import they required.
2026-02-25 07:02:54 +08:00
Willie a6431e999f feat(check): wire parallel repos + deduped URL checks into runCheck 2026-02-25 07:02:54 +08:00
Willie 45890e784a refactor(check): extract collectCheckItems for RepoURL grouping 2026-02-25 07:02:54 +08:00
Willie c9e10faeb7 feat(log): record update command options in oplog and add dedicated formatters
logUpdateOp now captures mode, all, force, dry_run, skip_audit, threshold,
and diff flags. Dedicated formatUpdateLogPairs/Detail formatters replace the
generic fallback in both the TUI log viewer and the web UI LogPage.
2026-02-25 07:02:54 +08:00
Willie 31bafcef4b refactor(ui): add SeverityColorID table for lipgloss, unify log TUI colors
Add 256-color palette ID constants (SeverityIDCritical, etc.) and
SeverityColorID() to ui package as single source of truth for severity
colors. Refactor log_tui.go colorizeSeverityBreakdown, colorizeThreshold,
and colorizeRiskValue to use shared IDs instead of hardcoded values.
2026-02-25 07:02:54 +08:00
Willie 6df9dddd7e feat(ui): add shared SeverityColor/Colorize and colorize audit severity counts
Add ui.SeverityColor() and ui.Colorize() as shared helpers for consistent
severity coloring across the codebase. Apply colored severity labels to
the batch audit summary line (HIGH=150, MEDIUM=511, etc). Refactor
audit.go to use shared helpers instead of local duplicates.
2026-02-25 07:02:54 +08:00
Willie 8e51423afb style(update): fix gofmt formatting in update_resolve.go 2026-02-25 07:02:54 +08:00
Willie c6d44075b2 refactor(update): simplify updateAllProjectSkills to accept *updateContext
Replace 8 individual params with the shared updateContext struct,
eliminating the redundant inline construction that was already present.
2026-02-25 07:02:54 +08:00
Willie 9fa4828d17 refactor(update): unify verbose handlers, remove project-mode duplicates
Replace cfg *config.Config with sourcePath string in updateTrackedRepo and
updateRegularSkill. Add projectRoot param for mode-aware audit scanning.
Delete updateSingleProjectSkill and updateProjectTrackedRepo from
update_project.go — project mode now uses the same shared handlers.
2026-02-25 07:02:54 +08:00
Willie fadacb8bff refactor(update): replace third batch loop in updateAllProjectSkills with executeBatchUpdate
All three duplicated 3-phase batch loops (tracked repos → grouped skills →
standalone skills) are now unified through executeBatchUpdate(). This
eliminates the local `target` struct in updateAllProjectSkills and ~160
lines of duplicated orchestration code.
2026-02-25 07:02:54 +08:00
Willie 553c0a8bb7 refactor(update): introduce updateContext and unify quick handlers
Add updateContext struct with mode-aware auditScanFn() and makeInstallOpts().
Unify updateTrackedRepoQuick (add scanFn param) and updateSkillFromMeta
(accept InstallOptions) between global/project modes. Delete
updateProjectTrackedRepoQuick and updateProjectSkillFromMeta.
2026-02-25 07:02:54 +08:00
Willie 0f1d9eb7bf refactor(update): unify resolvedMatch and projectTarget into updateTarget
Single updateTarget type with name + path + isRepo fields replaces
both resolvedMatch (global) and projectTarget (project) local types.
2026-02-25 07:02:54 +08:00
Willie 97128a2651 refactor(update): extract handlers to update_handlers.go
Move verbose/quick update handlers, auditGateAfterPull, diff rendering,
isSecurityError, truncateString. update.go now contains only dispatcher
and arg parsing (~518 lines).
2026-02-25 07:02:54 +08:00