Commit Graph
427 Commits
Author SHA1 Message Date
Willie 9b0146ab77 fix(extras): resolve lint warnings in extras list TUI
Replace WriteString(fmt.Sprintf(...)) with fmt.Fprintf for QF1012,
and use min/max builtins for tree scroll clamping.
2026-03-12 16:45:02 +08:00
Willie 947a5d33b3 feat(extras): add interactive TUI for extras list with browse, remove, sync, collect, and content viewer 2026-03-12 16:45:02 +08:00
Willie 2a9ddb0cf6 feat(extras): add TUI list item and delegate for extras list 2026-03-12 16:45:02 +08:00
Willie 4526b5a493 refactor(extras): extract buildExtrasListEntries for TUI reuse 2026-03-12 16:45:02 +08:00
Willie 9738e5238e refactor(extras): extract remove helpers for TUI reuse 2026-03-12 16:45:02 +08:00
Willie ee38d34513 refactor(diff): show extras by default, remove --extras/--all flags
Extras diff is now automatically included when extras are configured.
No need for explicit --extras or --all flags — simpler UX.

- Remove showExtras/showAll from diffRenderOpts
- Replace flag check with len(cfg.Extras) > 0
- Update integration test, built-in skill refs, website docs, changelog
2026-03-12 16:45:02 +08:00
Willie d756004e56 feat(extras): add extras reference docs, fix diff project mode, improve TUI
- Add references/extras.md covering all 4 subcommands (init, list,
  remove, collect) plus sync extras and diff --extras
- Update SKILL.md with dedicated Extras recipes section and reference link
- Update status.md with diff --extras/--all flags
- Fix sync.md: extras supports project mode (not global only), correct
  source path to include extras/ subdirectory
- Fix diff --extras not working in project mode (diff_project.go was
  missing collectExtrasDiff integration)
- Replace DefaultDelegate with custom diffItemDelegate so Extras
  separator renders as non-selectable group header (matching list TUI)
- Add skipDiffSeparator to prevent cursor landing on separator items
- Add Next Steps hints to extras detail panel in diff TUI
- Group Backup/Trash under "Storage" header in doctor output
- Remove extra leading spaces from doctor extras status lines
2026-03-12 16:45:02 +08:00
Willie cc93c4f0a4 fix(extras): add y/N confirm prompt to remove, clean up empty dirs
- extras remove: replace silent-exit warning with interactive [y/N]
  prompt; --force skips the prompt as before
- extras remove: after removing config entry, delete the source
  directory if empty and the parent extras/ directory if empty
- sync extras: clean up empty extras/ directory when no extras are
  configured (both global and project mode)
- Add removeEmptyDir helper and ExtrasParentDirProject path function
2026-03-12 16:45:02 +08:00
Willie 09ccd14266 fix(extras): resolve tilde expansion, unify headers, add doctor target warnings
Extras commands had multiple issues with tilde (~) path handling — Go
doesn't expand ~ (that's shell behavior), so paths like ~/.claude/rules
were treated as literal relative paths, creating bogus ~/  directories.

Key fixes:
- Export config.ExpandPath() and call it before os.Stat / sync operations
  in extras_list, sync_extras, extras_collect, and doctor
- Unify extras output headers to match target list style (single "Extras"
  header instead of per-extra headers, fix double-icon bug in list)
- Add per-target reachability warning in doctor for unreachable extras
  targets with expanded path display

Update all 3 E2E runbooks to use extras/<name>/ path layout, add /tmp
cleanup for idempotent re-runs, add migration test step, and create new
comprehensive extras_commands_runbook (18 steps covering init/list/remove/
collect/doctor/tilde/project-mode).

Improve cli-e2e-test skill with 4 new checklist items and 2 rules learned
from test friction (/tmp isolation, symlink write-through, cat>>
idempotency, extras path layout).
2026-03-12 16:45:02 +08:00
Willie 990b4dc160 feat(extras): add TUI wizard for extras init, improve status display
Wire up the existing extras init TUI wizard so `extras init` without
arguments launches the interactive 5-phase flow. Add --no-tui flag for
scripting. Guard against silently swallowing --mode when launching TUI.

Redesign extras status output to match Targets section style using
ui.Status with per-target rows showing [mode] path (N files). Extract
shared printExtrasStatus helper to eliminate duplication between global
and project status. Add (project) label to project-mode header.

Clean up: delete duplicate extrasEffectiveMode in favor of
sync.EffectiveMode, remove redundant os.Stat TOCTOU in doctor.go
checkExtras, handle zero-targets edge case with a warning.
2026-03-12 16:45:02 +08:00
Willie 314d6a3dff fix(sync): show duplicate skill names in collision message, fix vertical spacing
Display the actual duplicate skill name(s) in the "isolated by target
filters" info message so users can identify which skills collide.

Remove the extra fmt.Println() before backup section — ui.Header()
already includes a leading newline, so the previous blank line created
a double gap.

Also replace VirtualizedGroupedView with native DOM GroupedView using
sticky sub-headers that respect the toolbar height offset.
2026-03-12 16:45:02 +08:00
Willie 5369595bc1 fix(install): skip target dotdirs during skill discovery
Repos like pbakaus/impeccable commit .claude/skills/ alongside their
source skills, causing discoverSkills to find every skill twice (36
instead of 18). Fix by deriving known target dotdir names (.claude,
.cursor, .skillshare, etc.) from targets.yaml project_path values and
skipping them during filepath.Walk.

Non-target hidden dirs (.curated, .system — used by openai/skills) are
still discovered as before. Injection pattern avoids circular import
between config and install packages.
2026-03-12 16:45:02 +08:00
Willie d97e5a7c33 refactor(extras): consolidate duplicate logic and fix sync --all --json output
- Move checkExtrasSyncStatus to sync.CheckSyncStatus (shared)
- Add sync.EffectiveMode helper to replace inline mode defaults
- Add config.ValidateExtraMode to centralize mode validation
- Fix sync --all --json outputting two separate JSON objects
  by merging extras into the skills JSON output
- Fix swallowed JSON decode error in handleExtrasSync
- Remove dead symlink check in CollectExtraFiles (filepath.Walk
  follows symlinks so the check was unreachable)
- Fix integration test extras paths to use extras/<name>/ layout
2026-03-12 16:45:02 +08:00
Willie a786c1fe79 feat(extras): add init TUI wizard, collect command, and sync --json
- extras init TUI: multi-step bubbletea wizard (name → target → mode → confirm)
- extras collect: reverse-sync local files from target back to extras source
  with --from, --dry-run flags and dual-mode (global/project) support
- sync extras --json: structured JSON output for sync extras command
- CollectExtraFiles in internal/sync with tests
2026-03-12 16:45:02 +08:00
Willie 163548a6ee feat(diff): integrate extras into diff TUI with separator and detail panel 2026-03-12 16:45:02 +08:00
Willie 18ee11037d feat(diff): add --extras and --all flags for extras diff
Adds extras diff collection, plain text rendering, and JSON output.
--all implies --extras. Project mode supported via ExtrasSourceDirProject.
2026-03-12 16:45:02 +08:00
Willie 4af609e318 feat(doctor): add extras source/target health checks
Check each configured extra's source directory exists and count its
files; warn when one or more target parent directories are unreachable.
Runs in both global and project mode after the main doctor checks.
2026-03-12 16:45:02 +08:00
Willie d8cc25abd3 feat(status): show extras sync status in status output 2026-03-12 16:45:02 +08:00
Willie c02b918057 feat(sync): add project mode support for sync extras and sync --all -p
cmdSyncExtras now parses mode args and auto-detects project mode via
projectConfigExists. Global logic is extracted into cmdSyncExtrasGlobal;
new cmdSyncExtrasProject handles project-scoped extras using
config.LoadProject and config.ExtrasSourceDirProject, with relative
target paths resolved against the project root.

sync --all in project mode now defers a cmdSyncExtras("-p", ...) call
instead of printing a warning, so extras are also synced.
2026-03-12 16:45:02 +08:00
Willie 18d54bd293 feat: implement extras init, list, and remove commands
- extras init: create new extra with --target/--mode flags, global + project mode
- extras list: show all extras with sync status detection, --json support
- extras remove: remove extra from config with --force confirmation
2026-03-12 16:45:02 +08:00
Willie f275435d6f feat(schema): add extras definition to config and project-config JSON schemas 2026-03-12 16:45:02 +08:00
Willie 0fcf6d1ee3 feat(sync): update extras source path to extras/<name>/ with auto-migration 2026-03-12 16:45:02 +08:00
Willie 0890fb3015 fix(config): prevent env var gitlab_hosts from leaking into persisted config
Move SKILLSHARE_GITLAB_HOSTS merge from Load()/LoadProject() to new
EffectiveGitLabHosts() methods so the GitLabHosts field stays config-file-only
and Save() never writes env-only hosts to disk.

Also fix project-mode direct install dropping gitlab_hosts from the
synthetic Config, and server project-mode parseOpts() falling back to
global config when project had no hosts configured.
2026-03-12 16:45:02 +08:00
Willie 8f16a90e5f feat(config): add SKILLSHARE_GITLAB_HOSTS env var and cleanup
Support CI/CD pipelines that need gitlab_hosts without a config file.
The env var is comma-separated and merged (deduplicated) with config
file values in both global and project modes.

Also cleans up from review:
- Extract isValidGitLabHostname to share validation logic
- Remove redundant ToLower before EqualFold in isGitLabHost
- Revert 3 no-opts call sites back to ParseSource()
- Add parseOptsFromProjectConfig helper to reduce inline duplication
- Fix project mode LoadProject missing env var merge
- Add install.md tip about custom GitLab domains
2026-03-12 16:45:02 +08:00
Willie a4d52615f7 feat(config): add gitlab_hosts for custom GitLab domain support
Self-managed GitLab instances on custom domains (e.g., git.company.com)
without "gitlab" in the hostname were parsed with 2-segment owner/repo
split instead of full-path repo. Users can now declare extra GitLab
hostnames in config so the parser treats them like gitlab.com (nested
subgroup support).

- Add `gitlab_hosts` field to both global and project Config structs
- Validate entries at load time (reject scheme, path, port, empty)
- Add `ParseOptions` / `ParseSourceWithOptions` to thread hosts into parser
- Add `isGitLabHost()` helper combining built-in + custom host detection
- Extend `InstallContext` interface with `GitLabHosts()` method
- Update all ParseSource call sites (install, search, update, server)
- Add JSON schemas for both config files
- Add unit tests for config validation and source parsing
- Add E2E runbook for devcontainer verification
- Document in configuration reference and URL formats appendix
2026-03-12 16:45:02 +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 7c582cbe21 docs: update v0.16.13 changelog to match project style
Expand bug fix descriptions, add grouped layout ASCII example,
and sync website changelog.
2026-03-06 23:10:48 +08:00
Willie 657b833569 fix: suppress devcontainer redirect for -j flag and show tracked badge in filter mode
- Add -j short flag to wants_machine_output() in devcontainer wrapper,
  preventing stderr banner noise for `skillshare list -j` etc.
- Show tracked repo name badge on skill items so filtered results remain
  distinguishable when group headers are absent. Two tracked skills from
  different repos now render with their repo origin visible.
2026-03-06 23:10:48 +08:00
Willie 0e7bfea8ee feat(tui): add structured filter tags to list TUI
Support key:value tag syntax in the `/` filter input for precise
skill filtering by type, group directory, and repo name:

  t:tracked g:security audit
  → type=tracked AND group contains "security" AND free text "audit"

Tags: t:/type: (tracked/remote/local/github), g:/group: (substring),
r:/repo: (substring). Multiple tags use AND logic. Unknown tags
gracefully degrade to free text. Optional `_` prefix on type values
(e.g. t:_tracked) and short alias t:track are accepted.

Filter input placeholder and help line update to show available tags
when filtering mode is active.
2026-03-06 23:10:48 +08:00
Willie 7015aaf611 refactor(tui): unify duplicated group/render logic between list and audit TUIs
- Extract renderPrefixRow shared helper (was duplicated in renderSkillRow
  and auditDelegate.Render)
- Remove auditGroupItem type, reuse groupItem from list_tui_item.go
- Remove skipAuditGroupItem, reuse skipGroupItem
- Simplify buildGroupedItems multi-group check to match audit's
  map-based approach; delete countRepoGroups
- Fix auditFooterLines hot-path: check len(ByCategory) instead of
  calling formatCategoryBreakdownTUI on every render
- Simplify baseSkillPath redundant branch
2026-03-06 23:10:48 +08:00
Willie c085f10a1f fix(tui): skip group separators when single group and fix row truncation
- Skip group separator lines when all items belong to one group
- Fix row truncation: use ANSI-aware xansi.Truncate instead of
  stripping ANSI codes then counting runes (lost color + wrong width)
- Account for bodyStyle padding when calculating text truncation width
- Add MaxWidth to prevent lipgloss from wrapping long rows
2026-03-06 23:10:48 +08:00
Willie 8ddf886921 feat(tui): add grouped layout and dynamic panel height to audit TUI
- Add repo-grouped layout with separator lines (matching list TUI)
- Use custom auditDelegate with compact single-line rows and truncation
- Sort by repo key (tracked first) then severity within each group
- Widen left panel from 25%/[25,45] to 36%/[30,46] to prevent wrapping
- Dynamically calculate panel height based on actual footer line count
  instead of hardcoded overhead, maximizing list space
- Auto-skip group separator items on navigation
2026-03-06 23:10:48 +08:00
Willie a217e40e2b fix(audit): reduce color noise in CLI and TUI output
The audit summary used 10+ distinct colors on a single screen,
making it hard to focus on actionable information.

Changes:
- Threats line: remove per-category rainbow colors (8 colors → dim/bold)
- Severity c/h/m/l/i: zero values now gray, only non-zero get color
- Policy line: dim metadata (only STRICT/LEGACY get warning yellow)
- Passed count: no longer green (normal state needs no emphasis)
- Remove unused categoryStyle() and categoryColorCLI() functions

Design principle: quiet gray baseline with color only for items
that require user attention (failed count, aggregate risk).
2026-03-06 23:10:48 +08:00
Willie 0a0ac2ee57 feat(tui): redesign list panel with grouped layout and compact paths
- Add group separators: tracked repos and standalone skills are visually
  grouped with dim header lines showing repo name and count
- Compact skill paths: strip tracked repo prefix, show at most last 2
  path segments in list rows (full path in detail panel)
- Auto-skip group headers on navigation (up/down/page)
- Replace split Source/Sync sections with unified Details section,
  removing duplicate info already shown in header
- Narrow left panel ratio (42% → 36%) for more detail space
- Separator "/" without spaces for tighter list rows
- Rename local group to "standalone" to avoid confusion with local badge
- Adjust renderFactRow label width (9 → 12) for longer labels
2026-03-06 23:10:48 +08:00
Willie 5ae4c7ab93 fix(tui): improve detail panel readability
- Bold skill name in header for better distinction from list items
- Add spacing between name and metadata line
- Show full source URL instead of truncating at 50 chars
- Rename "Overview" section to "Description" to match frontmatter field
2026-03-06 23:10:48 +08:00
Willie f115ab5e0e fix(tui): show skill name and group in list detail panel
The detail panel header was rendered on L00 (same row as the list title),
making the skill name invisible. Push content to L01 with a leading newline
and use colorSkillPath for consistent group/name coloring matching the left
panel. Compress status/date/targets into a single metadata line to save
vertical space. Show full source URL and synced targets in Quick Facts.

Also suppress devcontainer stderr redirect message in --json/--format modes
and fix audit summary field name (analyzerCount → activeAnalyzers).
2026-03-06 23:10:48 +08:00
Willie 7223ac52f4 fix(sync): preserve non-json dry-run output stream
Keep sync dry-run diagnostics on stdout by default to avoid non-JSON behavior regressions. Introduce sync.DiagOutput so JSON mode can silence diagnostics via io.Discard at command entry and restore after execution. Update search JSON integration assertion to match fully silent progress behavior.
2026-03-06 02:15:36 +08:00
Willie d707fc619b fix(cli): suppress stderr progress messages in --json mode
JSON mode stdout was already pure JSON, but stderr still emitted
progress lines (e.g. "Discovering skills...", "Found N local skill(s)")
which broke `2>&1 | jq .` pipelines. Remove the else-branch stderr
writes so --json mode is fully silent except for stdout JSON output.
2026-03-06 02:15:36 +08:00
Willie 6ad930f71d perf(cli): parallelize git dirty checks in status --json
Extract buildTrackedRepoJSON() that runs git.IsDirty concurrently via
goroutines + WaitGroup instead of sequential subprocess spawns per repo.
Also deduplicates the tracked-repo JSON loop between global and project
status paths, and optimizes skill counting to a single pass with a map.
2026-03-06 02:15:36 +08:00
Willie 0d59f15db4 refactor(cli): deduplicate JSON output helpers and fix ResolvePolicy semantics
- Extract writeJSONResult() to replace 5 identical write+silent-error trailers
- Replace local isRepoDirty() with existing git.IsDirty() (8 call sites)
- Use defer for suppressUIToDevnull restore instead of manual calls at each
  return site in install.go and update.go (prevents stdout leak on new paths)
- Fix ResolvePolicy always filling EnabledAnalyzers, which broke the
  nil-means-all contract for ForPolicy; add EffectiveAnalyzers() for display
- Simplify collectOutputJSON double map allocation
- Remove unnecessary string conversion in writeJSONError
2026-03-06 02:15:36 +08:00
Willie b366f619cb chore: formatting alignment and changelog jq example fix
- diff.go: align JSON struct field tags
- CHANGELOG: fix jq example (.errors → .details)
- analyzer_metadata: align map literal and test struct formatting
2026-03-06 02:15:36 +08:00
Willie 8ddf685aae fix(cli): wrap collect/sync JSON errors with jsonSilentError
collect --json and sync --json returned the raw error after writing
JSON, causing main() to print a duplicate plain-text error. Wrap with
jsonSilentError so main() exits non-zero silently.

Also fix sync --json skipping backup output that would corrupt stdout.
2026-03-06 02:15:36 +08:00
Willie 4535da1d01 refactor(cli): return updateResult from single-target update handlers
updateTrackedRepo and updateRegularSkill now return (updateResult, error)
instead of just error, so callers (including project mode and JSON output)
can accurately report updated/skipped/securityFailed/pruned counts.

Adapt cmdUpdateProject, cmdUpdateProjectBatch, updateAllProjectSkills,
and list_project.go TUI action to the new signatures.
2026-03-06 02:15:36 +08:00
Willie 4b09d2ee3d fix(cli): redirect JSON-mode UI to /dev/null and add status --project --json
suppressUIToStderr was redirecting UI to stderr, but in environments
where stdout and stderr share the same terminal (e.g. docker exec),
all the spinner/progress/header output was still visible alongside
the JSON. Replace with suppressUIToDevnull which opens os.DevNull
for both os.Stdout and ui.ProgressWriter, producing zero visible
noise in --json mode.

Also add status --json support for project mode, reusing the same
JSON schema as global mode (source, skill_count, tracked_repos,
targets, audit, version).
2026-03-06 02:15:36 +08:00
Willie b5430e094b fix(cli): suppress UI output in --json mode for install, diff, uninstall
install --json: logo, spinners, and step output leaked to stdout,
corrupting machine-parseable JSON. Add suppressUIToStderr() around the
entire install flow, restoring stdout before writing JSON.

diff --project --json: spinner and progress display polluted stdout.
Skip spinner and progress creation in JSON mode, matching the existing
cmdDiffGlobal pattern.

uninstall --json: five error paths (discovery failure, no skills found,
glob detection, validation, preflight) returned plain-text errors instead
of JSON error envelopes. Wrap each with writeJSONError().

Add 8 integration tests (5 new failure cases + 3 confirming existing
behavior) with an assertPureJSON helper that validates stdout contains
only valid JSON with no leading/trailing noise.
2026-03-06 02:15:36 +08:00
Willie 9a12df02b4 fix(cli): restore argument validation for status --project mode
The --json addition accidentally removed the guard that rejects
unexpected positional arguments in project mode. Restore it so
`skillshare status --project foo` correctly returns an error
instead of silently ignoring the extra argument.
2026-03-06 02:15:36 +08:00
Willie 1a4de5ddd1 fix(cli): use errors.As for jsonSilentError check in main
Type assertion would break if the error gets wrapped via fmt.Errorf
with %w. errors.As handles wrapped errors correctly.
2026-03-06 02:15:36 +08:00
Willie 18cd0ecc94 fix(cli): preserve non-zero exit code for --json error paths
writeJSONError now returns a jsonSilentError sentinel that main()
recognises — it exits with code 1 without printing plain-text output
to stdout. This fixes a regression where --json errors (config load
failure, missing source dir, discovery failure) returned exit 0.

All writeJSONError call sites changed from the broken pattern:
  writeJSONError(err); return nil   // exit 0, wrong
to:
  return writeJSONError(err)        // exit 1, correct

Also applied the same fix to update.go error paths which had the
older pattern of writeJSONError(err) followed by return err (which
would print both JSON and plain text).

Added regression tests for sync and install error paths verifying
both non-zero exit code and valid JSON error output on stdout.
2026-03-06 02:15:36 +08:00