Commit Graph
247 Commits
Author SHA1 Message Date
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
Willie 30d5baf6d9 refactor(update): extract audit rendering to update_audit_render.go
Move updateResult, batchAuditEntry, batchBlockedEntry types and all
display/formatting functions for batch audit results. Pure code move.
2026-02-25 07:02:54 +08:00
Willie 5b5475df28 refactor(update): extract target resolution to update_resolve.go
Move resolvedMatch, resolveByBasename, resolveGroupUpdatable, isGroupDir
to dedicated file. Pure code move, no logic changes.
2026-02-25 07:02:54 +08:00
Willie 37a5e68ecb refactor(install): unify duplicated parseInstallArgs between global and project modes
Delete parseProjectInstallArgs (identical copy) and projectInstallArgs type
from install_project.go. Both modes now share parseInstallArgs. The "no source
→ reject flags" check moved from parser to cmdInstall caller. Project mode
gains --audit-verbose support for free.
2026-02-25 07:02:54 +08:00
Willie 6e15e50e95 refactor(install): extract install handlers to install_handlers.go 2026-02-25 07:02:54 +08:00
Willie 0f7d7d8cf5 refactor(install): extract interactive prompts to install_prompt.go
Move ~360 lines of skill selection UI functions (promptMultiSelect,
promptLargeRepoSelection, fuzzy filtering, etc.) to a dedicated file.
Pure structural move with no behavior changes.
2026-02-25 07:02:54 +08:00
Willie 5b4f1c31cd refactor(install): extract audit rendering to install_audit_render.go
Move ~820 lines of audit-related types, vars, and 30 functions from the
2608-line install.go monolith into a dedicated file. Pure structural move
with no behavior changes — same package, identical signatures.
2026-02-25 07:02:54 +08:00
Willie a0ebbde1de refactor(ui): use raw bytes in backup API and extract shared formatSize
Return sizeBytes (int64) instead of sizeMB (float64) from backup API
so the frontend controls display formatting. CLI backup commands now
use the existing formatBytes() helper for human-friendly output.

Extract duplicate formatSize() from CollectPage and TrashPage into
shared ui/src/lib/format.ts utility.
2026-02-25 07:02:54 +08:00
Willie 76ef4ff07e feat(log): add interactive TUI with fuzzy filter and detail panel
On TTY, `skillshare log` now launches a bubbletea TUI (same pattern as
`list`) with fuzzy filtering by timestamp/command/status/source/detail,
keyboard navigation, and a colorized detail panel showing structured
args per entry. Operations and audit entries are merged and sorted by
time in the combined view.

Also refactors the 979-line log.go into three focused files:
- log.go (303) — entry, dispatch, help
- log_format.go (495) — data→string conversion, logArg* helpers
- log_render.go (189) — TTY/non-TTY terminal output

Other changes:
- --no-tui flag to skip TUI and print plain text
- Shared applyTUIFilterStyle() for cyan filter cursor in both TUIs
- Update website docs and built-in skill references
2026-02-25 07:02:54 +08:00
Willie cff3fc45e8 feat(list): add skill actions (audit/update/uninstall) to TUI
Allow users to trigger audit, update, or uninstall directly from
the interactive list TUI via Shift-key shortcuts (A/U/X), avoiding
the need to exit and manually type commands.
2026-02-25 07:02:54 +08:00
Willie 1fb5219cd2 feat(list): add interactive TUI with search, filter, sort, and detail panel
Replace basic text output with bubbletea-based interactive TUI for the
list command. Falls back to plain text with --no-tui or non-TTY output.

- Bubbletea TUI: fuzzy filtering, keyboard navigation, detail panel
- Detail panel: description (SKILL.md), disk path, files, synced targets
- Search: `skillshare list <pattern>` filters by name/path/source
- Filter: `--type git|local` to filter by installation type
- Sort: `--sort name|date|type` with mode-specific defaults
- JSON: `--json` for CI/scripting consumption
- Pager: less/more wrapper for --no-tui plain text output
- 29 integration tests covering all new functionality
2026-02-25 07:02:54 +08:00
Willie 3012061649 fix(update): use caller-provided dest paths in batch update to prevent path duplication
UpdateSkillsFromRepo was using filepath.Join(sourceDir, meta.Subdir) to
derive the local destination, but meta.Subdir is the repo-internal path
(e.g. "skills/foo") which may differ from the local install path ("foo/").
This created leaked copies at sourceDir/skills/foo/ alongside the correct
sourceDir/foo/, doubling the skill count on subsequent scans.

Change skillTargets from []string to map[string]string where key is the
repo subdir (for discovery lookup) and value is the local absolute path
(provided by the caller who already knows where the skill is installed).
2026-02-25 07:02:54 +08:00
Willie bcc88ba1b0 fix(update): wire git clone progress into batch update progress bar
Grouped skills batch path calls UpdateSkillsFromRepo which clones the
repo via DiscoverFromGitWithProgress — but OnProgress was nil so the
progress bar froze during clone then jumped on completion.

Wire OnProgress callback to forward git transfer lines into the
progress bar title, and add a 50ms render delay in the inner per-skill
loop so pterm can flush each step to the terminal. Both guarded by
IsTTY() to avoid overhead in CI/pipe contexts.
2026-02-25 07:02:54 +08:00
Willie 3bfad952e5 refactor(sync): remove symlink compat hint from sync output
Doctor is the right place for diagnostic hints. Sync runs frequently
and the repeated notice would be noisy.
2026-02-25 07:02:54 +08:00