Commit Graph
65 Commits
Author SHA1 Message Date
Willie 3f4d347e61 fix(ui): honor NO_COLOR in every command's output
The legacy color constants in internal/ui (Red, Gray, Dim, Bold, Reset, …)
were compile-time strings that ignored the theme, so status, doctor, extras
list and about twenty other commands printed ANSI codes even with NO_COLOR
set. Make them variables and blank them at startup when the theme reports
NoColor, so the theme stays the single source of that decision. The two
places that hardcoded escape codes (usage and log --stats) now use the same
variables.
2026-09-28 13:56:59 +08:00
Willie e32f2164c9 fix: suppress update notice in all structured-output modes
UpdateNotification() wrote to stdout via fmt.Printf, corrupting JSON
output when --json was passed to commands like search.  Machine
consumers got invalid JSON with trailing human-readable text.

Three-layer fix:
1. Move UpdateNotification output to os.Stderr (safety net for any
   caller that bypasses the main.go guard).
2. Add isStructuredOutput() that detects all machine-readable modes:
   --json, -j, and --format json/sarif/markdown.
3. Skip the update check and trailing newline entirely in main()
   when structured output is requested, honouring the contract that
   stdout = pure structured data and stderr = empty.

Tests:
- Unit: isStructuredOutput table test (9 cases)
- Unit: UpdateNotification writes only to stderr
- Integration: versioned binary (1.0.0) with seeded cache (9.9.9)
  exercises the real update path for search --json, list -j, and
  audit --format json — asserts valid JSON stdout + empty stderr.

Closes #129
2026-04-13 16:00:18 +08:00
Willie 5b35a0e451 refactor(ui): migrate plain CLI output to theme.ANSI()
Updates Success/Error/Warning/Info/Header/Status/Checkbox/
CheckboxItem/ActionLine/Logo to source their colors from the
new theme.ANSI() set instead of package-level constants.

Package-level constants (Red, Green, White, etc.) are kept with
// Deprecated: comments to preserve compatibility with any
third-party code that imports this package directly.

Colorize() now also honors NO_COLOR via theme.Get().NoColor.
2026-04-10 14:43:07 +08:00
Willie c6564c25f7 fix: remove leading spaces from ui.Status and Extras output 2026-04-08 22:01:56 +08:00
Willie 5afaf57745 feat(tui): add tab switching between skills/agents in list TUI
- Add Tab/Shift+Tab to cycle All/Skills/Agents tabs with count badges
- Tab bar renders at top with bold+underline cyan active, dim inactive
- Tab acts as pre-filter composing with text filter via AND logic
- Cache tab-filtered items in applyFilter() to avoid per-frame recomputation
- Add tabNoun() method to consolidate noun switches across title/filter bar

Agent install --into support:
- Support --into flag for agent install (CLI, server, project mode)
- Support --into=value syntax in addition to --into value
- Server handler_skills uses recursive AgentKind.Discover() for nested agents
- Fix agent metadata read path: use file basename instead of frontmatter name
- Sync --all flag now includes agent sync (not just extras)

Agent content viewer:
- Agents render full-width without sidebar (single .md file, no tree needed)
- Simplified help text and keyboard handling for agent content view

Agent uninstall fixes:
- Use discovery-based resolution instead of hardcoded name+.md path lookup
- Support matching by Name, FlatName, RelPath, or trimmed RelPath
- Compressed confirmation display (list format, max 20 shown)

UI polish:
- Help bar keys highlighted in dim cyan, descriptions in dim gray
- Align 'No items.' text with list title via PaddingLeft(2)
2026-04-07 21:55:05 +08:00
Willie 23e43fc976 style: apply gofmt formatting 2026-03-17 04:48:42 +08:00
Willie 7284d38d79 fix(ui): cap progress counter and guard RenderInlineBar against zero total
Increment() now clamps p.current to p.total so concurrent callers
cannot produce a "11/10" display. RenderInlineBar() returns a safe
empty bar when total <= 0 instead of panicking on division by zero.
2026-03-09 12:47:03 +08:00
Willie ad713bc669 fix(ui): render phase headers inline with progress bar to prevent visual duplication
Phase transitions during batch update (e.g. pull repos → update skills) were
printing separate PhaseHeader lines that created a second visible progress bar.
Now phases use ProgressBar.SetHeader() which overwrites the header line in place
via ANSI cursor-up, keeping a single continuous bar from start to finish.
2026-03-09 12:47:03 +08:00
Willie 404ad0afde fix(tui): replace 256-color gray gradient with SGR dim in skill path rendering
colorSkillPath() and colorSkillPathBold() used Color("241")~Color("249")
gradient for subdirectory segments — fixed palette grays that render
inconsistently across terminal themes. Replace with tc.Dim (SGR faint).
2026-03-09 12:47:03 +08:00
Willie ae80756b9a feat(ui): replace bright-black gray with SGR dim for consistent terminal rendering
\033[90m (bright black) renders too dark on many terminals and themes.
Replace with \x1b[0;2m (SGR dim attribute) which adapts to any foreground.

Changes:
- Add Dim constant and DimText() helper in internal/ui
- Replace all pterm.Gray() calls with DimText() in pterm.go
- Replace all ui.Gray references with ui.Dim across cmd/skillshare/
- Replace fixed 256-color grays (Color("247"/"242")) with lipgloss
  .Faint(true) in TUI styles (tui_colors.go, list_tui.go, log_tui.go)
- Fix progress bar layout: put count after % at fixed position,
  title last (truncated) — prevents count from being pushed off-screen
- Extract duplicate renderBar() from diff.go and search_batch.go
  into shared ui.RenderInlineBar() helper
2026-03-09 12:47:03 +08:00
Willie cca896dd91 feat(ui): replace pterm progress bar with custom fixed-width bar
Replace pterm's ProgressbarPrinter with a custom implementation using
\r overwrite for flicker-free rendering. The new bar uses block chars
(■/・), orange color with dim text for labels, and dynamic title width
based on terminal size.

Key improvements:
- Render throttling (50ms) prevents I/O overload on large skill counts
- Git progress messages auto-normalized in UpdateTitle
- Final 100% frame preserved on screen after Stop()
- Cursor hidden during progress, restored on completion
2026-03-09 12:47:03 +08:00
Willie 65c7d75c41 style: fix gofmt alignment in extras_test.go and ui.go 2026-03-04 12:16:32 +08:00
Willie 53fdf0b59d feat(audit): add semantic coloring to CLI summary box Threats line
Apply per-category ANSI colors to the Threats breakdown in the CLI
summary box, matching the TUI footer palette. Add Purple, BrightRed,
OrangeAlt, BrightBlue color constants to internal/ui. Non-TTY output
remains plain text.
2026-03-03 16:08:11 +08:00
Willie 6aac91776b refactor(audit): simplify registry, dedupe, colorize, and API signatures
- Make DefaultRegistry() a singleton (stateless analyzers, safe to share)
- Consolidate duplicate ANSI regex into ui.StripANSI(); broaden pattern
  to match all CSI sequences ([a-zA-Z] terminator, not just 'm')
- Extract shared policyProfileLabel/policyDedupeLabel/policyAnalyzersLabel
  helpers; unify formatPolicyLine and formatPolicyLineFromPolicy
- Remove redundant applyPolicyToSummary calls inside auditInstalled and
  auditFiltered (cmdAudit already applies it centrally)
- Fix double isMarkdown check in scanSkillImpl walk loop
- Convert variadic ...*Registry to regular *Registry parameter across
  scanSkillImpl, ParallelScan, scanSkillPath, and scanPathTarget
- Pre-compute registry.Has() before walk loop to avoid per-file O(n) scan
2026-03-03 16:08:11 +08:00
Willie ae60c52d4d fix(ui): add missing WithWriter to TreeSpinner to eliminate ghost cursor
TreeSpinner was the only spinner missing WithWriter(ProgressWriter),
causing pterm's animation goroutine to write directly to stdout and
conflict with git clone progress \r updates during install.
2026-03-03 16:08:11 +08:00
Willie 07f70abf02 fix(audit): let profile presets set threshold when config has no explicit block_threshold
config.Load() normalized empty block_threshold to "CRITICAL", preventing
ResolvePolicy from applying profile-based thresholds (e.g. strict → HIGH).

Change: normalizeAuditBlockThreshold("") now returns "" instead of "CRITICAL".
All downstream callers (install, update, server) already use
audit.NormalizeThreshold() which handles empty → CRITICAL independently.

Also adds 4 integration tests for --profile, --dedupe, and config-based
profile resolution. Includes gofmt formatting fixes.
2026-03-03 16:08:11 +08:00
Willie 1676d7d064 fix(audit): suppress pterm cursor codes leaking into structured stdout
pterm's cursor package writes hide/show ANSI codes (\x1b[?25l/h)
directly to os.Stdout, bypassing WithWriter(). The previous fix
(SetProgressWriter to stderr) was insufficient because pterm still
created progress bar objects that triggered cursor.Hide()/Show().

Add SuppressProgressToStderr() which both redirects ProgressWriter
and forces isProgressTTY() to return false, preventing pterm
components from being instantiated at all. Extract assertNoANSI
test helper and cover all three structured formats (JSON, SARIF,
Markdown).

Also update pre-commit E2E runbook with steps 10-11 (framework
integration tests) and add pre-commit-hook recipe to sidebar.
2026-03-03 16:08:11 +08:00
Willie 89c3586da6 feat(audit): add markdown output format and improve terminal layout
- Add --format markdown for self-contained audit reports (GitHub Issues/PRs)
- Simplify pterm box rendering: replace DefaultBox with separator-line style
- Remove unused SkillBox, SummaryBox, SkillDisplay, wrapText helpers
- Color Box titles cyan (consistent with HeaderBox)
- Add breathing room: blank lines around progress bar and after summary
- Show "skillshare audit (project)" header title in project mode
- Append elapsed time to cross-skill synthetic results to fix slice mismatch
2026-03-02 23:01:30 +08:00
Willie afb8951359 fix(audit): show spinner/progress on stderr for structured output formats
Previously --format json/sarif completely suppressed spinner and progress
bar, making the CLI appear frozen during long scans.

Now spinner/progress output is redirected to stderr via ProgressWriter,
so progress indicators remain visible while structured data stays clean
on stdout. This follows the Unix convention: data → stdout, diagnostics
→ stderr.

Also:
- Extract fileTTY() shared helper (DRY IsTTY + isProgressTTY)
- Add format constants (formatText/JSON/SARIF) and isStructured()
- Capture/restore previous ProgressWriter in defer (defensive)
2026-03-02 23:01:30 +08:00
Willie 32a29c8e91 fix(upgrade): clear prompt lines to preserve tree layout
Upgrade prompts ("Install built-in skill?" and "Upgrade to vX?")
left their input lines visible after the user responded, breaking
the tree-drawing structure. Add ui.ClearLines() to erase prompt
lines via ANSI cursor-up + clear-line, so StepEnd connects cleanly
to the preceding tree node. No-op on non-TTY.
2026-03-02 10:05:57 +08:00
Willie 8a377481cb feat(version): Homebrew-aware version check
Homebrew formula updates lag GitHub Releases by hours/days, causing
Homebrew users to see "update available" when `brew upgrade` says
already up-to-date. Now detect install method from executable path
and query `brew info --json=v2` for Homebrew installs instead of
the GitHub Release API.

- Add InstallMethod type with DetectInstallMethod() and
  FetchBrewLatestVersion() in internal/version/homebrew.go
- Check() accepts InstallMethod to branch fetch strategy
- UpdateNotification() accepts upgradeCmd (shows correct command)
- UpgradeCommand() method on InstallMethod centralizes the mapping
- doctor.go reuses versioncheck.Check() (fixes semver string
  comparison bug in old fetchUpdateMessage)
- Remove duplicated isHomebrewInstall() from upgrade.go
- Skip post-command version check for doctor (has its own)
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 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 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 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 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 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 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 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 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 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