Commit Graph
1034 Commits
Author SHA1 Message Date
Willie 935752bfc9 feat(new): add pattern/category definitions and template generators 2026-03-18 22:35:02 +08:00
Willie 6d0ac1bf81 docs: add SKILLSHARE_UI_BASE_PATH to environment variables reference
Ref: #85
2026-03-18 22:35:02 +08:00
Willie 329869f258 docs: add use case context to reverse proxy section
Ref: #85
2026-03-18 22:35:02 +08:00
Willie da7dfd37cc test: add E2E runbook for UI base path reverse proxy
Covers: API routing with prefix, 404 without prefix, bare path redirect,
__BASE_PATH__ injection, SPA fallback, -b flag, env var fallback.

Also fix unused import in SyncPage.tsx (broke tsc).

Ref: #85
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 550f398464 fix(test): update integration tests for target path validation
Tests were failing because config validation now requires target paths
to exist before sync. Updated tests to create target directories
properly and adjusted expected error messages.

- TestExclude_GlobalSymlinkMode_Ignored: use CreateTarget instead of RemoveAll
- TestSync_SymlinkMode_CreatesSingleSymlink: same
- TestSync_SourceNotExist_ReturnsError: use CreateTarget, update error message
- TestLog_SyncPartialStatus: use read-only dir to trigger partial failure
2026-03-18 22:35:02 +08:00
Willie 657adcc8a6 test+docs: add base path integration tests and reverse proxy guide
- Integration tests: --base-path missing value, -b short flag, env var
- Docs: --base-path flag in table, Nginx/Caddy examples, env var usage

Ref: #85
2026-03-18 22:35:02 +08:00
Willie 214c8b993c feat(ui): support base path for reverse proxy deployments
- Vite base: './' for relative asset paths (works from any sub-path)
- API client reads window.__BASE_PATH__ for request prefix
- React Router uses basename for client-side routing

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 768c9f4a67 feat(server): inject __BASE_PATH__ into SPA index.html when base path is set
When spaHandlerFromDisk receives a non-empty basePath, it pre-computes
a modified index.html with a <script> tag injecting window.__BASE_PATH__.
This allows the frontend to discover its base path at runtime without
build-time configuration. The injection applies to both direct index.html
requests and SPA fallback routes.
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 6424bc635e docs: update v0.17.5 changelog to reflect banner-based sync preview
Replace toast action description with inline banner approach.
Remove Toast Action Buttons section (feature was reverted).
2026-03-18 22:35:02 +08:00
Willie a7ecc4010d fix(ui): move sync preview banner above editor to avoid toast overlap 2026-03-18 22:35:02 +08:00
Willie 0ff59638d5 refactor(ui): replace toast action with inline banner for sync preview
- Revert Toast.tsx to original (remove action/persistent/replaceKey)
- Remove detailed prop from SyncResultList (YAGNI, caused overflow)
- ConfigPage: show inline banner card after save instead of toast action
- Banner dismisses on edit or manual dismiss, opens sync preview modal
2026-03-18 22:35:02 +08:00
Willie f6ec0e9565 refactor(ui): extract shared sync helpers to eliminate duplication
- Create ui/src/lib/sync.ts with formatSyncToast(), invalidateAfterSync(),
  and summarizeSyncResults() utilities
- SyncPreviewModal and SyncPage now share the same toast message and
  query invalidation logic instead of duplicating it
- Clear stale results/error when SyncPreviewModal closes
2026-03-18 22:35:02 +08:00
Willie 0446711535 fix(ui): include pruned in hasChanges for SyncResultList
Prune-only targets need to show the detailed skill list and
the change icon in the sync preview modal so users can see
which symlinks will be removed before confirming.
2026-03-18 22:35:02 +08:00
Willie 75f35d2471 feat(ui): wire SyncPreviewModal into ConfigPage save handlers
Both handleConfigSave and handleIgnoreSave now show a persistent toast
with a "Preview Sync" action button that opens SyncPreviewModal. The
replaceKey 'config-save' deduplicates toasts when saving in quick
succession.
2026-03-18 22:35:02 +08:00
Willie 7b99d0f130 feat(ui): add SyncPreviewModal with dry-run preview and confirm 2026-03-18 22:35:02 +08:00
Willie 2dcd756f00 refactor(ui): extract SyncResultList component from SyncPage 2026-03-18 22:35:02 +08:00
Willie 6bd13140eb feat(ui): render Toast action button, hide progress bar when persistent 2026-03-18 22:35:02 +08:00
Willie 033521029c feat(ui): add action, persistent, replaceKey to Toast system 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
v0.17.4
2026-03-18 00:19:30 +08:00
Willie 48a7e40e75 docs: add sync ignored skills and doctor fixes to v0.17.4 changelog
New entries: sync .skillignore visibility (CLI + JSON + UI), doctor
CLI text output for skillignore, doctor output readability, duplicate
names truncation, doctor global mode bug fix.
2026-03-18 00:19:30 +08:00
Willie 7c533f2012 docs: update sync and doctor pages for .skillignore visibility
- sync: add ignored_count/ignored_skills to JSON example, note about
  .skillignore filtering
- doctor: add Skillignore to environment checks table, update example
  output with skillignore line and visual spacing
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 cc68453eb1 feat(sync): pass .skillignore source files in API for accurate UI hints
Add ignore_root and ignore_repos fields to sync/diff/diff-stream API
responses from IgnoreStats. UI now uses real file paths instead of
heuristic (skill name starts with _) to determine ignore 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 9e90b9c30c fix(ui): show correct .skillignore source hint for repo-level ignores
Skills prefixed with _ are from tracked repos and excluded by
repo-level .skillignore (inside the repo), not the root-level one
editable in Config. Show distinct hints for each source.
2026-03-18 00:19:30 +08:00
Willie f17e5c5a9f style(ui): redesign ignored skills section on SyncPage
Replace bare text disclosure with a Card-based collapsible matching
DiffTargetCard style: EyeOff icon, ChevronDown/Right toggle, Badge
count, per-skill rows with icons, and a hint footer linking to Config.
2026-03-18 00:19:30 +08:00
Willie 6d66823f10 feat(ui): show ignored skills badge and collapsible section on SyncPage 2026-03-18 00:19:30 +08:00
Willie 78a4abc9be test(sync): add integration tests for .skillignore ignored skills output
Verify that sync command correctly reports ignored skills in text output,
includes ignored_count and ignored_skills in JSON output, and produces
no ignored output when .skillignore does not exist.
2026-03-18 00:19:30 +08:00
Willie 2b2e119eb2 feat(ui): add ignored skills types to sync and diff API client 2026-03-18 00:19:30 +08:00
Willie 8c7b93eec9 feat(server): include ignored skills in sync and diff API responses
Switch from DiscoverSourceSkills to DiscoverSourceSkillsWithStats so
the sync, diff, and diff-stream endpoints can surface .skillignore
stats (ignored_count, ignored_skills) in their JSON responses.
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 6698b5f69f style(ui): improve skillignore check details with grouped tag layout
Replace flat bullet list with two labeled sections:
- Patterns: monospace code badges with muted background
- Ignored Skills: warning-tinted tags for visual distinction
Other checks keep the default bullet list rendering.
2026-03-18 00:19:30 +08:00
Willie 4857135550 fix(ui): render --- separator as visual divider in Doctor check details
The skillignore check uses --- to separate patterns from ignored skills
in the details array. Render it as a labeled section divider instead
of a raw bullet point.
2026-03-18 00:19:30 +08:00
Willie 1c15f8baaa fix(ui): invalidate doctor query after saving .skillignore
Without this, the Doctor page shows stale skillignore check data
until its 1-minute staleTime expires or the user refreshes.
2026-03-18 00:19:30 +08:00
Willie 1fca4ce0e4 fix(ui+server): lazy-fetch skillignore tab, use typed response struct
- ConfigPage: add enabled: tab === 'skillignore' to skip unnecessary
  filesystem walk when Config page opens on the config.yaml tab
- handler_skillignore: replace map[string]any with typed structs
  (skillignoreResponse, skillignoreStats) for compile-time safety
2026-03-18 00:19:30 +08:00
Willie 02a5ace7f9 docs: add skillignore visibility features to v0.17.4 changelog
Add .skillignore Visibility section covering status/doctor CLI output,
Config page editor tab, Doctor page SegmentedControl unification,
and new API endpoints.
2026-03-18 00:19:30 +08:00
Willie 6852b0ee14 docs: update doctor/status/ui docs for skillignore visibility
- doctor.md: add skillignore check to JSON example, document info status
- status.md: add skillignore field to JSON schema
- ui.md: update Config page description, add skillignore/doctor API endpoints
2026-03-18 00:19:30 +08:00
Willie fc1b7aa0e3 fix(ui): guard against null ignored_skills in skillignore response
Go nil slices serialize to JSON null. Add null guard in both the
server handler (emit empty arrays) and the UI (null check before
.length access) to prevent crash after editing .skillignore.
2026-03-18 00:19:30 +08:00
Willie c1dc988744 feat(ui): add .skillignore tab to Config page with CodeMirror editor
Add SegmentedControl tabs to switch between config.yaml and .skillignore
editing. The .skillignore tab shows file path, ignored skills count badge,
CodeMirror editor (without YAML extensions), and a summary card listing
all ignored skills. Save button behavior adapts to the active tab.
2026-03-18 00:19:30 +08:00
Willie 9d09e52ea8 feat(ui): unify Doctor filter with SegmentedControl, add info status 2026-03-18 00:19:30 +08:00
Willie 81cb684fb6 feat(server): add GET/PUT /api/skillignore endpoints
GET returns file existence, raw content, and ignore stats (patterns,
ignored skills). PUT accepts raw content to write or deletes the file
when raw is empty. Both endpoints are mode-aware via s.cfg.Source.
2026-03-18 00:19:30 +08:00