Commit Graph
32 Commits
Author SHA1 Message Date
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 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 11be808c99 fix(ui): eliminate spinner flicker during install clone
pterm's animation goroutine and UpdateText() race on the same terminal
line — the former appends a timer suffix "(Ns)" while the latter does
not, causing per-frame length differences that manifest as flicker.

Two fixes:
- Disable ShowTimer (our Success/Warn already print elapsed time)
- Pad normalizeGitProgressMessage output to 40 chars so short messages
  overwrite residual characters from previous longer messages
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 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 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 389257817a refactor(ui): overhaul CLI visual language and unify operation paths
standardized the command-line interface to ensure professional visual
consistency, accurate path reporting, and synchronized audit logic across
all modes.

Visual and UX Enhancements:
- Adaptive Skill Cards: Redesigned the bulky summary box into a compact card
  that correctly reports relative installation paths and handles missing
  descriptions with fallback messaging.
- Connected Hierarchical Trees: Implemented a standardized tree layout
  (StepStart, StepContinue, StepResult) for all single-item tasks, integrating
  success status and execution duration as final nodes.
- Intelligent Audit UI: Optimized 'Audit Findings' headers to perfectly align
  with risk results, ensuring no empty sections appear on CLEAN results.
- Ephemeral Progress Tracking: Configured spinners to auto-indent within the
  hierarchical structure and disappear completely upon completion to maintain
  clean terminal logs.

Logic and Reliability Fixes:
- Path Parity: Fixed a bug where the '--into' flag was not accurately
  reflected in the UI cards during installation.
- Audit Completeness: Restored missing security scans for certain Git-based
  installation paths.
- Code Parity: Unified recursive discovery and display logic between Global
  and Project update modes.

Validation:
- Successfully verified with 'make check' (all 150+ unit and integration
  tests passing).
2026-02-25 07:02:54 +08:00
Willie 4c0579172f feat: add progress bar to batch update and show current skill name
Batch update (>1 target) now always uses a progress bar with the
current skill name displayed, replacing per-item spinners that
produced excessive output. Audit results are collected during the
batch and summarised after the progress bar completes.

Also adds UpdateTitle to install's progress bar loop so large
batch installs show which skill is being processed.
2026-02-25 07:02:54 +08:00
Willie 792d236485 feat: optimize tracked subdir installs and devcontainer isolation
Implement remaining Issue 46 optimizations and developer experience fixes.

Install and update optimization:
- optimize install --track for subdirectory sources by attempting sparse checkout first while preserving git metadata
- fallback to existing tracked clone strategy on sparse capability or sparse path errors
- clean sparse created destination before fallback clone to avoid destination already exists failures
- improve tracked install spinner wording for subdir sources
- add tracked subdir unit tests for sparse success and sparse to full clone fallback

Progress user experience:
- normalize git progress lines by stripping volatile transfer rate suffix
- dedupe and throttle spinner and tree spinner update frequency to reduce tty flicker
- add unit tests for spinner progress normalization and throttling behavior

GitHub API messaging:
- improve rate limit guidance to suggest setting token env vars or using gh auth login

Devcontainer isolation:
- make ssenv enter command mode run from isolated environment cwd
- fix setup global init detection to use skillshare status global mode
- add auto mode hint in devcontainer wrapper when workspace project config takes precedence

E2E and tests:
- expand Issue 46 runbook with install, install track, update, no token fallback, sparse paths, and isolation checks
- update compact warning output test expectations to match current grouped warning rendering

Verification:
- go test internal install package
- go test internal install sparse and tracked subdir tests
- go test internal ui package
- go test cmd skillshare package
- go build skillshare binary and run integration TestInstall_Subdir
- run tracked subdir tests inside devcontainer
2026-02-25 07:02:54 +08:00
Willie b014f8c6dc feat: optimize large-repo install and update flows
Implement Issue #46 across install/update paths to reduce perceived hangs and improve subdir installation performance on large repositories.

Main changes:
- Add git progress streaming primitives in internal/install/git_progress.go.
  - runGitCommandWithProgress supports stderr streaming callbacks in TTY mode.
  - scanGitProgress handles both CR and LF progress delimiters.
- Thread InstallOptions.OnProgress through clone/pull/discovery/install/update paths.
  - Keep non-TTY behavior quiet to avoid noisy logs.
  - Add TreeSpinner.Update for live message updates.
- Add progress-aware git update APIs in internal/git/info.go:
  - PullWithProgress and ForcePullWithProgress (keep PullWithEnv/ForcePullWithEnv for compatibility).
- Introduce shared GitHub client utilities in internal/github/client.go.
  - Centralize token lookup, request construction, and rate-limit handling.
  - Refactor internal/search/search.go to use shared client while preserving compatibility aliases.
- Add GitHub/GHE API subdir fast path in internal/install/github_download.go.
  - github.com => api.github.com
  - github-like enterprise hosts => https://<host>/api/v3
  - On API failure, emit warning and fallback to git-based flows.
- Add sparse checkout fallback for non-GitHub subdir sources in internal/install/sparse_checkout.go.
  - Use filter+no-checkout+depth=1 then sparse-checkout set + checkout.
- Extend discovery/install metadata plumbing.
  - DiscoveryResult now includes CommitHash and Warnings.
  - install/discover subdir paths preserve warnings and commit hashes from API/sparse/full-clone flows.
- Preserve compatibility and UX expectations.
  - Keep existing action strings (for tests/UI stability).
  - Keep legacy discover/pull APIs as wrappers around new progress-aware variants.
- Improve --track download efficiency.
  - Track clone now attempts --filter=blob:none --depth 1 --single-branch first.
  - Falls back to full clone only on remote capability mismatch, not on auth/not-found errors.

CLI wiring:
- cmd/skillshare/install.go
  - TTY handlers now pass progress callbacks and use with-progress discover APIs.
  - Subdir handler shows API-vs-clone stage messages and renders discovery fallback warnings.
- cmd/skillshare/update.go and cmd/skillshare/update_project.go
  - Use PullWithProgress/ForcePullWithProgress for tracked repos.
  - Ensure reinstall/update install flows forward progress callbacks.

Tests added/updated:
- internal/install/git_progress_test.go
- internal/install/github_download_test.go
- internal/install/sparse_checkout_test.go
- internal/install/tracked_clone_test.go
- internal/install/source_test.go (GitHubOwner/GitHubRepo coverage)
- internal/git/info_test.go (PullWithProgress/ForcePullWithProgress)
- tests/integration/install_subdir_optimization_test.go
- tests/integration/install_online_test.go (GitHub API subdir case)

Validation performed:
- go test ./internal/install -count=1
- go test ./internal/git -run 'Test.*Pull.*' -count=1
- go build -o bin/skillshare ./cmd/skillshare && SKILLSHARE_TEST_BINARY="/Users/williehung/Developer/Apps/github/skillshare/bin/skillshare" go test ./tests/integration -run 'TestInstall_Subdir|TestUpdate_' -count=1
- go build -o bin/skillshare ./cmd/skillshare && SKILLSHARE_TEST_BINARY="/Users/williehung/Developer/Apps/github/skillshare/bin/skillshare" go test ./tests/integration -run 'TestInstall_Track_|TestUpdate_TrackedRepo' -count=1
- go test -tags online ./tests/integration -run TestInstall_GitHubSubdirViaAPI -count=1
- make lint
- make test
2026-02-25 07:02:54 +08:00
Willie 537e293721 feat(ui): add SectionLabel, fix StepFail ANSI passthrough, skip short elapsed
- SectionLabel(): dim section headers for visual grouping in batch output
- StepFail(): preserve pre-styled ANSI labels instead of double-wrapping
- Spinner Success/Warn: skip elapsed suffix when <50ms (avoids noise in tests)
- InstallOptions.AuditVerbose field for --audit-verbose flag plumbing
- Update install integration test assertions for batch compact format
2026-02-24 01:47:38 +08:00
Willie c59ae5aa19 feat: severity-based color ramp for audit output
Inspired by #39 — batch lines, summary box, severity counts, and
single-skill risk all use a consistent color ramp:
CRITICAL → red, HIGH → orange, MEDIUM → yellow, LOW/INFO → gray.

Also hide elapsed time when < 1s for cleaner batch output.
2026-02-23 04:18:01 +08:00
Willie a972a0c943 feat(install): add HTTPS token auth for private repos
Automatically detect GITHUB_TOKEN, GITLAB_TOKEN, BITBUCKET_TOKEN, or
SKILLSHARE_GIT_TOKEN and inject credentials via transient GIT_CONFIG_*
env vars during clone and pull. Tokens are never persisted to disk.

Key changes:
- Platform detection (GitHub/GitLab/Bitbucket) with per-platform
  username conventions (x-access-token, oauth2, x-token-auth)
- GIT_CONFIG_COUNT safe append — reads existing count to avoid
  overriding CI pipeline git config entries
- Token-aware error messages: "no token" shows 3 options (SSH, env
  var, credential helper); "token rejected" suggests checking
  permissions and expiry
- sanitizeTokens redacts all credential values (including
  BITBUCKET_USERNAME) from stderr before surfacing errors
- gitPull also injects auth via getRemoteURL(), fixing the previous
  limitation where update failed after HTTPS+token install
2026-02-21 06:07:35 +08:00
Willie 84ba16802d feat: add log filtering, improve log UX, and custom dropdown
- Add --cmd, --status, --since, --json flags to CLI log command
- Auto-skip irrelevant log section when --cmd narrows to one file
- Add blank line separator between log entries for readability
- API returns totalAll and commands for smarter frontend filtering
- Custom HandSelect dropdown matching hand-drawn design system
- Empty state distinguishes "no matching entries" from "no entries"
- Update website docs and built-in skill reference with new flags
2026-02-11 03:40:54 +08:00
Willie 0c49860d63 feat: add project mode labels, privacy-first messaging, and UI polish
- Add (project) labels to status, sync, collect, target, and uninstall
  headers for clear mode distinction (matching list/target list pattern)
- Add ui.WithModeLabel() helper for shared functions that run in both modes
- Update uninstall confirmation prompt: "from the project?" in project mode
- Add "Privacy-first" to README Why section and website homepage
- Replace "Unified Source" card with "Privacy-First" card on website
- Unify Quick Actions card heights with h-full in DashboardPage
- Add frontend rebuild note to Docker sandbox docs
2026-02-09 21:08:03 +08:00
Willie 0162bddfde feat: add per-target sync mode support for project mode
Allow project targets to set mode individually (merge or symlink),
mirroring global behavior. Default remains merge.

- Add Mode field to ProjectTargetEntry with YAML marshal/unmarshal
- Add mode branching in project sync (reuses syncMergeMode/syncSymlinkMode)
- Support --mode flag in target info for project targets
- Mode-aware unlink in target remove
- Unify project sync UI with global sync output format
- Update docs to reflect per-target mode support
2026-02-05 13:20:12 +08:00
Willie Hung 3bb6edc12a feat(ui): redesign install command with tree-style output
- Add tree structure UI (▸ → ├─ → └─) for install progress
- Add SkillBox component for displaying skill details
- Customize survey multi-select with cleaner icons (✓, ▸)
- Unify UI across all install modes (discovery, track, subdir, direct)
- Show version number in logo for install commands
- Add logo to doctor and status commands
- Quiet git clone output for cleaner experience
2026-01-31 02:51:00 +08:00
Willie Hung 6f8b6768c3 feat(ui): redesign help output with ASCII art and color grouping
- Add figlet-style ASCII art logo with brand yellow color
- Group commands into logical sections (Core, Skill, Target, Sync, Utilities)
- Apply color scheme: yellow commands, cyan arguments, gray examples
- Implement ANSI-aware padding for proper column alignment
2026-01-30 13:37:49 +08:00
Willie Hung 4ce9992ff0 fix(ui): use ASCII arrow to prevent box misalignment
Unicode arrow (→) has ambiguous width in East Asian terminals,
causing pterm box rendering to misalign. Use ASCII (->) instead.
2026-01-30 10:09:03 +08:00
Willie Hung 3de857b382 feat(update): support skills with metadata in --all
- `update --all` now updates both tracked repos and skills with
  .skillshare-meta.json
- Add spinner with progress indicator [1/7] for each item
- Safe update: install to temp dir first, then swap (prevents data
  loss on failure)
- Show warning (yellow) instead of error (red) for update failures
- Add Spinner.Warn() method for warning state
2026-01-30 09:43:04 +08:00
Willie Hung 683d22573d fix: use runewidth for correct Unicode character width calculation
The arrow character (→) takes 2 columns in terminal but was counted as 1,
causing box misalignment. Now using go-runewidth for accurate width calculation.
2026-01-25 02:58:46 +08:00
Willie Hung 9fbfe0e88a fix: resolve box rendering issues and improve list UI
- Add displayWidth() to calculate visible string width excluding ANSI codes
- Fix box padding calculation in Box, WarningBox, SummaryBox, UpdateNotification
- Disable git color output in GetCommitsBetween to prevent ANSI codes in commit hashes
- Improve list command: dynamic name alignment, add icons, remove duplicate separators
2026-01-25 02:49:54 +08:00
Willie Hung 3a3f0ef6f2 fix: remove ANSI codes from update notification content
ANSI color codes in box content caused pterm to miscalculate width,
resulting in misaligned right border. Use plain text content and
let pterm handle the box styling.
2026-01-24 01:55:03 +08:00
Willie Hung f9f4e595e0 fix: add padding to SummaryBox for consistent border width 2026-01-23 21:14:09 +08:00
Willie Hung 6fad4335d2 fix: Box padding and semver comparison
- Add padding to Box function for consistent border width
- Fix version comparison to handle semver properly (0.6.10 > 0.6.8)
2026-01-23 21:13:22 +08:00
Willie Hung 6dfe1c0c1f fix: pad WarningBox lines for consistent border width 2026-01-23 21:03:03 +08:00
Willie Hung fb077539da feat: add version check notification after commands
- Check GitHub releases API for new versions (24h cache)
- Display colorful update notification when update available
- Skip check for dev builds
- Cache stored at ~/.skillshare/version-check.json
2026-01-23 14:03:53 +08:00
Willie Hung 936a200198 feat: upgrade install/update UI with PTerm
- Add PTerm library for modern CLI output
- Add internal/ui/pterm.go with spinner, box, progress bar utilities
- Add internal/git/info.go for git diff/commit info retrieval
- Update install.go with header boxes, spinners, progress bars
- Update update.go with header boxes, spinners, change summaries
- Fallback to plain text for non-TTY environments
2026-01-23 13:50:57 +08:00
Willie Hung d43afa5269 feat: add discover mode for init command
- Add --discover flag to detect new agents
- Add --select flag for non-interactive mode (AI use)
- Use survey.MultiSelect for interactive target selection
- Update init.md with discover flags documentation
- Add 8 test cases for discover functionality
2026-01-21 00:42:05 +08:00
Willie b3b7bcf0fc feat: initial release of skillshare
Share skills across AI CLI tools (Claude Code, Codex, Cursor, Gemini, OpenCode)
with a single source directory and symlinks.

Commands:
- init: Initialize with source directory, auto-detect CLI tools
- sync: Migrate existing skills and create symlinks
- status: Show target status
- target: Manage targets (add/remove/list)
2026-01-14 18:09:36 +08:00