Commit Graph
490 Commits
Author SHA1 Message Date
Willie 6b3858620f feat(skillignore): add .skillignore.local for local pattern overrides
Allow users to override shared .skillignore patterns without modifying
the committed file. ReadMatcher transparently merges .skillignore +
.skillignore.local (local appended last so !negation rules win).

- Matcher.HasLocal flag tracks .local presence for CLI reporting
- IgnoreStats gains RootLocalFile, RepoLocalFiles, HasLocal() method
- sync/status/doctor show ".local active" indicator
- 6 unit tests + 2 integration tests
- Docs: file-structure, sync, status, doctor, best-practices, creating-skills, org-sharing
2026-03-18 22:35:02 +08:00
Willie 93a3067c76 refactor(tui): move wizard breadcrumbs to help bar footer
Compact single-line format: "✓ reviewer → quality" appended to
the help bar instead of a multi-line header above the list.
2026-03-18 22:35:02 +08:00
Willie c9624df637 feat(tui): add header field to checklist for wizard breadcrumbs
Breadcrumbs now render as a dedicated header area above the list,
separate from the title. This prevents title truncation and keeps
the layout clean.
2026-03-18 22:35:02 +08:00
Willie efdd6366de fix(new): show wizard breadcrumbs inside TUI title instead of terminal 2026-03-18 22:35:02 +08:00
Willie 650065393e feat(new): show breadcrumbs of previous selections in wizard steps 2026-03-18 22:35:02 +08:00
Willie 4f6ae5ad33 feat(new): add wizard back-navigation (Esc returns to previous step) 2026-03-18 22:35:02 +08:00
Willie 6fa73ae91b fix(new): handle .gitkeep write error instead of ignoring it 2026-03-18 22:35:02 +08:00
Willie ffa5dba66b feat(new): add TUI prompts and integrate -P flag into new command 2026-03-18 22:35:02 +08:00
Willie 935752bfc9 feat(new): add pattern/category definitions and template generators 2026-03-18 22:35:02 +08:00
Willie f0e164ce9c refactor: simplify base path code after review
- Export NormalizeBasePath and reuse in ui.go (eliminate duplication)
- Use json.Marshal for safe __BASE_PATH__ injection (prevent XSS)
- Always cache index.html at startup (avoid per-request disk reads)
- Extract shared BASE_PATH module in frontend (single source of truth)

Ref: #85
2026-03-18 22:35:02 +08:00
Willie 04f65e5320 feat(cli): add --base-path flag and SKILLSHARE_UI_BASE_PATH env var to ui command
Allows serving the UI under a URL prefix (e.g., skillshare ui --base-path /app).
The flag value is passed through to the server constructors and used for
browser URL construction. Falls back to SKILLSHARE_UI_BASE_PATH env var
when the flag is not provided.
2026-03-18 22:35:02 +08:00
Willie 10444eef3f feat(server): add basePath support for reverse-proxy sub-path hosting (#85)
Add normalizeBasePath + wrapBasePath to Server so the UI and API can be
served under a URL prefix (e.g. /app). StripPrefix wraps outside
withConfigAutoReload; bare-path requests redirect to path + "/".
Dev mode (no uiDistDir) prints a warning and skips wrapping.

Includes HTTP routing tests for prefix routing, 404 without prefix,
bare-path redirect, multi-level paths, and empty basePath passthrough.
2026-03-18 22:35:02 +08:00
Willie 92603f5be6 feat: add config save validation and sync safety checks
Validate config semantics (source path, sync modes, target paths) at
save time (API + CLI) instead of failing at sync time with cryptic
errors. Sync no longer auto-creates missing target directories — fails
fast to catch typos like ~/.cusor/skills. Dry-run also validates paths.

- ValidateConfig / ValidateProjectConfig with warnings + errors
- handlePutConfig returns 400 for invalid configs, 200 + warnings
- handleSync pre-checks via ValidateConfig
- ensureRealTargetDir shared helper (replaces duplicated blocks)
- UI: warning toast on config save, warning banners on sync/preview
- Dashboard shows full absolute source path
2026-03-18 22:35:02 +08:00
Willie 4d2d540127 refactor: simplify ignore payload and deduplicate formatting
- Remove dead nil check in ignorePayload() (repoFiles already initialized)
- Replace manual map merge loops with maps.Copy in 3 handler sites
- Deduplicate fmt.Sprintf + ui.Success in doctor checkSkillignore
- Extract extractIgnoreSources() helper in SyncPage to DRY two identical
  state-setting blocks
2026-03-18 00:19:30 +08:00
Willie 33cc974210 style(doctor): add blank line after config directory info
Visually separate config paths from source/skillignore/git checks
for better readability in the Checking environment section.
2026-03-18 00:19:30 +08:00
Willie e54d469d63 style(doctor): add visual break before skill validation checks
Separate the environment checks (config, source, skillignore, git)
from the skill validation checks (integrity, targets) with a blank
line for better readability.
2026-03-18 00:19:30 +08:00
Willie af143a3330 fix(doctor): add CLI text output for skillignore check
checkSkillignore only wrote to the JSON result but never printed
to the terminal, so skillignore status was invisible in CLI output.
2026-03-18 00:19:30 +08:00
Willie 49cd7c8433 fix(sync): truncate duplicate skill names to first 5 + count
The collision report dumped all 14000+ duplicate names on a single
line, making the sync output unreadable. Show the first 5 names
with "... and N more" so users can see examples without the flood.
2026-03-18 00:19:30 +08:00
Willie 8f19fb098a fix(server): force -g flag on doctor subprocess in global mode
The doctor handler shells out to the CLI binary. In global mode it
did not pass -g, so the subprocess auto-detected project mode when
the server's cwd contained .skillshare/config.yaml. This caused
the doctor to check the project source instead of the global source.
2026-03-18 00:19:30 +08:00
Willie d8b1323123 fix(sync): use correct plural for repo-level .skillignore file count 2026-03-18 00:19:30 +08:00
Willie a8dc4972ac fix(sync): show .skillignore source hint in CLI output
Extract printIgnoredSkills helper that shows whether ignores come from
root-level, repo-level, or both .skillignore files. Helps users
understand why skills are excluded when they haven't configured the
root .skillignore.
2026-03-18 00:19:30 +08:00
Willie 071731485e feat(sync): show .skillignore ignored skills in CLI text and JSON output
Switch DiscoverSourceSkills → DiscoverSourceSkillsWithStats at both
global and project sync entry points. Thread IgnoreStats through to
text output (dim-styled list) and JSON output (ignored_count +
ignored_skills fields).
2026-03-18 00:19:30 +08:00
Willie f64fffef08 feat(status): show .skillignore info in text and JSON output
Surface .skillignore visibility in the status command so users can
see active patterns and how many skills are being ignored without
needing to run doctor.

Text output shows an indented line under Source when .skillignore
exists; JSON output adds a skillignore object inside source with
active flag, file paths, patterns, and ignored skill details.
2026-03-18 00:19:30 +08:00
Willie 13a82e335e feat(doctor): add info status and skillignore check
Add checkInfo status constant for informational (non-pass/warn/error)
doctor checks. Info checks count toward total but are tracked separately
in the summary.

Add checkSkillignore to doctor: reports .skillignore state as either
info (no .skillignore found) or pass (active with pattern/ignored counts
and details). Switches discovery from DiscoverSourceSkills to
DiscoverSourceSkillsWithStats to collect .skillignore statistics in the
same walk.
2026-03-18 00:19:30 +08:00
Willie 9c0a13734c fix(doctor): skip local skills silently, only warn on incomplete meta
Skills without .skillshare-meta.json are local/manual — silently skip
instead of warning. Only warn when meta exists but file_hashes is
missing (old installs). List affected skill names in the warning.
2026-03-18 00:19:30 +08:00
Willie 63370dfdea refactor(doctor): extract finalizeDoctorJSON helper and add status constants
- Extract 14-line duplicated JSON output block from cmdDoctorGlobal and
  cmdDoctorProject into shared finalizeDoctorJSON() function
- Define checkPass/checkWarning/checkError constants replacing 42 string
  literals across all addCheck() call sites
- Add TODO comment in server handler noting intent to move check logic
  into internal/ package
2026-03-18 00:19:30 +08:00
Willie ce707455fa feat(doctor): add --json structured output for CI pipeline consumption
Add `--json` flag to `skillshare doctor` that outputs structured JSON with
per-check results, summary counts, and version info. Errors produce exit 1,
warnings exit 0. Uses suppressUIToDevnull() to silence text output in JSON mode.
2026-03-18 00:19:30 +08:00
Willie 11f696cffe fix(server): upgrade Mutex to RWMutex for concurrent read safety
Addresses PR #82 review: read-only handlers accessed s.cfg without
synchronization, risking data races with concurrent config reloads.

- Upgrade sync.Mutex → sync.RWMutex (drop-in compatible)
- Add RLock to 26 non-streaming read handlers
- Keep exclusive Lock for write handlers (unchanged)
- Skip SSE streaming handlers to avoid blocking writes during streams
- Fix isConfigGitignored to propagate GitignoreContains errors
2026-03-17 04:48:42 +08:00
Willie f7866b44ef fix(tui): reorder help bar to match convention — navigate, filter, scroll, actions, quit 2026-03-17 04:48:42 +08:00
Willie 0b04d6d2fe fix(tui): use 'Ctrl+d/u' format matching other TUIs (was ^d/^u) 2026-03-17 04:48:42 +08:00
Willie 0f44ad7174 fix(tui): show ^d/^u scroll hint in target list help bar 2026-03-17 04:48:42 +08:00
Willie 145191098f fix(init): auto-select detected targets during partial repair without prompting
partialInitRepair was falling through to the interactive prompt path,
which returns empty in non-TTY (CI). Add explicit branch that auto-selects
all detected CLI directories, restoring the pre-v0.17.3 behavior.

Fixes TestListProject_PartialInit_RepairsMissingConfig.
2026-03-17 04:48:42 +08:00
Willie 03ecf716e4 fix(init): route --subdir to global mode when project config exists
Without this fix, running `init --subdir` in a directory with
.skillshare/config.yaml would auto-detect project mode and fail
with "unknown option: --subdir" because the project parser doesn't
support it. Adding --subdir to hasGlobalOnlyInitFlags() ensures
correct routing to global mode.

Also adds 5 integration tests covering --subdir end-to-end:
config path, list discovery, sync symlinks, mode routing, dry-run.
2026-03-17 04:48:42 +08:00
Willie 41e3f6ae2b feat(init): add interactive source path prompt during init -g
Previously, `init` silently defaulted source to ~/.config/skillshare/skills/
with no way for users to discover customization without reading docs. Now
interactive mode asks whether to customize the source path (Y/N gate + text
input), with tilde expansion and filepath.Abs normalization. The success
message also hints at --source and config path for future changes.

- promptSourcePath() follows same Y/N pattern as useSourceSubdir()
- TTY guard ensures non-interactive (piped stdin, --source flag) is unaffected
- Integration test verifies success message contains source hint
- Updated init.md flowchart, --source option note, and first-sync.md steps
2026-03-17 04:48:42 +08:00
Willie 0c2d700fb9 feat(project): add --config local for centralized skills repo workflow
Enable teams to use one project as a shared skills repo where each
developer manages their own targets independently.

- Add `--config local` flag to `init -p` that gitignores config.yaml
- Auto-detect shared repo on clone via .gitignore check (no flag needed)
- Fix partialInitRepair to run interactive prompt instead of auto-select
- Export GitignoreContains, add UpdateGitIgnoreFiles for file-mode entries
- Refactor gitignore helpers to share addGitIgnoreEntries private helper
- Add 5 integration tests covering all new flows
- Add recipe docs page, update init reference, changelogs, release notes
2026-03-17 04:48:42 +08:00
Willie 23e43fc976 style: apply gofmt formatting 2026-03-17 04:48:42 +08:00
Willie 90c096b8e9 fix(project): add trash/ to .skillshare/.gitignore
Project mode uninstall moves skills to .skillshare/trash/, but this
directory was not gitignored — soft-deleted skills could be accidentally
committed.

- ensureProjectGitignore now adds both logs/ and trash/ via a single
  UpdateGitIgnoreBatch call (replaces two separate UpdateGitIgnore calls)
- uninstall_project.go calls ensureProjectGitignore for backward compat,
  patching projects created before this fix on next uninstall run
2026-03-17 04:48:42 +08:00
Willie e40d6a89fd refactor(tui): simplify target list TUI after code review
- Remove unused configPath field from model
- Replace capitalizeFilterType with existing capitalize() helper
- Remove unused width/height params from renderFilterEditPanel
- Only clear detailScroll/lastActionMsg on selection change (match extras)
- Extract shared buildTargetTUIItems() to deduplicate loadTargets/reloadTargetItems
- Change Spacing() from 1 to 0 for compact list display
2026-03-17 04:48:42 +08:00
Willie c69fd6ea67 fix(tui): align target list TUI with extras/skill TUI patterns
- Add help footer with full keybinding hints (match extras)
- Move filterBar above detail in vertical layout (match extras)
- Add "\n" prefix to detail panel in split view (match extras)
- Use rightWidth-1 for wrapAndScroll (match extras)
- Use "\n\n" after split body (match extras)
- Esc clears filter text (match extras)
- "/" returns textinput.Blink for cursor animation
- Add loading guard for key/mouse events
- Add ResetSelected after filter
- Use tc.Title for detail name (not inline style)
- Store lastActionMsg as plain text, render at display time
- Add renderTargetActionMsg with ✓/✗ color logic
- ctrl+d/u scroll step 5→8 (match extras/skill)
- Add width guard in delegate Render
2026-03-17 04:48:42 +08:00
Willie a4e21c1a60 docs(cli): add --no-tui to target list help text
Also gofmt the new TUI files.
2026-03-17 04:48:42 +08:00
Willie c7d96cf1e0 feat(tui): target list mode picker and include/exclude edit sub-panel 2026-03-17 04:48:42 +08:00
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