Commit Graph
449 Commits
Author SHA1 Message Date
Willie 4a8563f85b feat(tui): target list View and Update with split layout, filter, and navigation 2026-03-17 04:48:42 +08:00
Willie 81b05b975a feat(tui): wire target list TUI dispatch with --no-tui fallback 2026-03-17 04:48:42 +08:00
Willie 177ebe0bb8 feat(tui): scaffold target list TUI model, constructor, and runner 2026-03-17 04:48:42 +08:00
Willie 5204ff9bad feat(tui): add target list item delegate 2026-03-17 04:48:42 +08:00
David StotijnandClaude Opus 4.6 b7f9185f0b fix(cli): reorder init --help flags to match docs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 21:55:46 +08:00
David StotijnandClaude Opus 4.6 bfacb81331 fix(cli): show --subdir flag in init --help output
The --subdir flag was parsed and functional but missing from the
help text printed by `skillshare init --help`.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 21:55:46 +08:00
Willie 4cbaa5f3ab perf(tui): async dirSize and lazy loading in restore TUI
dirSize() was called synchronously for every backup version during list
population and on each cursor move, blocking the entire TUI event loop.

- Add ListBackupVersionsLite() that skips dirSize (TotalSize = -1)
- Compute size asynchronously via tea.Cmd, cache in versionSizeCache
- Replace redundant ListBackupVersions() in renderTargetDetail() with
  direct os.ReadDir() on the latest backup directory
- Cap per-skill I/O (readSkillDescription + listSkillFiles) to 20 items
  in both renderTargetDetail() and renderVersionDetail()
2026-03-14 04:01:10 +08:00
Willie f9a49c1a91 refactor(tui): unify all list delegates to prefix bar style
Replace list.DefaultDelegate + configureDelegate() with a new
prefixItemDelegate that renders the "▌" prefix bar consistently
across all 11 TUI list views (log, trash, search, install prompt,
checklist, restore, audit rules, diff).

- Add prefixItemDelegate (1-line) and renderPrefixRowWithDesc (2-line)
- Remove configureDelegate(), NormalTitle/Desc, SelectedTitle/Desc styles
- Remove hardcoded "  " indent from restore item Title() methods
- Fix AuditPage overflow handling with overflow prop and !overflow-clip
2026-03-14 04:01:10 +08:00
Willie 04b248ab92 feat(tui): convert trash TUI to left-right split panel layout
Replace vertical stack layout with horizontal split panel matching
list_tui and log_tui patterns. Reuses renderHorizontalSplit,
wrapAndScroll, and appendScrollInfo from tui_helpers.go.

Key changes:
- Add termHeight tracking and syncTrashListSize() for responsive layout
- Add detailScroll with Ctrl+d/u and mouse wheel support on right panel
- Split View() into viewTrashSplit() (≥80 cols) and viewTrashVertical()
- Render detail panel with bold header, metadata rows, path truncation
- Add renderTrashSummaryFooter with item count and total size
- Remove cachedDetailStr/cachedDetailIdx in favor of direct rendering
- Enable tea.WithMouseCellMotion() for mouse wheel scrolling
2026-03-14 04:01:10 +08:00
Willie ad34a5b384 fix(cli): add spinner to backup command and remove list indent
Backup operations had no loading indicator, making it appear frozen
during slow backups. Added a spinner that shows progress per target.

Also removed the 2-space left indent from "Recent backups" list items
by using direct formatting instead of the shared ListItem helper.
2026-03-14 04:01:10 +08:00
Willie 894b1b3793 fix(init): improve subdir prompt with TTY check, --subdir flag, and ui helpers
Follow-up to #78. Adding:
- TTY guard so the prompt is skipped in non-interactive/CI environments
- --subdir CLI flag for scriptable usage
- Consistent use of bufio.Reader (no mixed fmt.Scanln)
- ui.Info / ui.Success for prompt output aligned with other init steps
2026-03-13 14:02:26 +08:00
Willie 0a3305f617 fix(update): capture git stderr and show actionable error messages
The update handler used internal/git which ran git commands without
capturing stderr, so failures like divergent branches only showed
"exit status 128". Now runGitWithProgress captures stderr and pipes
it through install.WrapGitError for meaningful messages.

Also adds:
- extractGitFatal() strips verbose hint: lines from git output
- Force checkbox and per-item Force retry button in Update UI
- "(try force update)" / "(try --force)" hint on pull failures
2026-03-13 09:45:56 +08:00
Daylam Tayari 4a8814ffcf Switched dir name reading to bufio for space sup 2026-03-12 13:15:15 -05:00
Daylam Tayari 06dae1c34f Added new line for spacing in prompts 2026-03-12 12:53:17 -05:00
Daylam Tayari 4fc7b4b885 Implemented source subdir specification 2026-03-12 12:46:37 -05:00
Daylam Tayari e23bea133f Switched existing usage of cmd.Output to cmd.Run 2026-03-12 23:22:35 +08:00
Daylam Tayari c08ed7f96c Switched git repo check to git rev-parse 2026-03-12 23:22:35 +08:00
Daylam Tayari 156e428baf Updated git initialization check in doctor cmd 2026-03-12 23:22:35 +08:00
Daylam Tayari f8ce3387d3 Integrated checkGitRepo in pull cmd 2026-03-12 23:22:35 +08:00
Daylam Tayari 57419a51b8 Updated checkGitRepo to use git status
Using git status as it will handle nested directories and git commands
are ultimately what is used throughout the code
2026-03-12 23:22:35 +08:00
Willie 405a2f907a feat(extras): add mode command for CLI, TUI, and Web UI
Add ability to change sync mode of an extra's target across all three
interfaces: CLI (`extras mode`/shorthand `extras <name> --mode`),
TUI (`M` key with mode picker overlay), and Web UI (inline Select
dropdown per target with PATCH /api/extras/{name}/mode endpoint).

Fix sync behavior so symlinks from a previous mode are auto-replaced
without --force, while regular files still require explicit --force.

Consolidate sync mode list into config.ExtraSyncModes single source
of truth. Fix Select component missing disabled prop and add viewport
collision detection with useLayoutEffect.

Includes 8 integration tests covering mode command happy path, error
cases, shorthand syntax, and mode-switch sync behavior.
2026-03-12 16:45:02 +08:00
Willie 5b224a1f87 fix(extras): remove unused width params, load fresh config in doRemove
Address code review findings:
- Remove unused width parameter from renderExtrasDetail and
  renderExtrasContentPanelStr to eliminate dead code
- Load fresh config in doRemove to avoid mutating the TUI model's
  config copy in a background goroutine (prevents potential data race)
2026-03-12 16:45:02 +08:00
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