Commit Graph
172 Commits
Author SHA1 Message Date
Willie bf5255a6a5 fix(ui): validate top-level mode and audit config fields
Add validation for:
- top-level mode (was only checking legacy sync_mode)
- audit.block_threshold (CRITICAL/HIGH/MEDIUM/LOW/INFO)
- audit.profile (default/strict/permissive)
- audit.dedupe_mode (legacy/global)

Refactored repeated enum validation into a shared helper.
2026-03-20 02:36:50 +08:00
Willie 798d209977 fix(ui): add 'copy' to valid sync modes in config validation
The backend supports merge, symlink, and copy sync modes, but
the frontend validator only allowed merge and symlink.
2026-03-20 02:36:50 +08:00
Willie 1eca08a84d fix(ui): show available fields when config editor is empty
When the YAML editor has no structure to display (empty content),
show a list of available top-level config fields from fieldDocs
as a quick reference instead of a blank "No structure" message.
2026-03-20 02:36:50 +08:00
Willie 3400f14c48 fix(ui): unify editor and panel height with flex stretch
Replace fixed h-[558px] with h-full so the panel Card stretches
to match the editor Card height via flex items-stretch (default).
2026-03-20 02:36:50 +08:00
Willie 2fcb1b7536 fix(ui): don't show sync preview banner after .skillignore save
The sync preview banner is only relevant for config.yaml changes,
not .skillignore saves.
2026-03-20 02:36:50 +08:00
Willie 14a45ea264 fix(ui): move panel toggle into editor header, smooth CSS transition
Move the expand-panel button from floating position into the editor
Card's title bar (next to config.yaml / .skillignore path). Panel
collapse/expand uses CSS transition (flex/opacity/width) instead of
conditional rendering for smooth animation without layout jump.
2026-03-20 02:36:50 +08:00
Willie b8e31cf282 fix(ui): smooth panel collapse/expand with CSS transition
Replace conditional rendering with CSS transition-all on the panel
container (flex-[0]/w-0/opacity-0 ↔ flex-[2]/opacity-100). Editor
Card transitions flex smoothly with duration-300 ease-in-out.
Removes layout jump on toggle.
2026-03-20 02:36:50 +08:00
Willie cb07a6eaea feat(ui): add config editor assistant panel with polished UI
Right-side context-aware panel: errors → field docs → structure
tree (auto-switch by priority), manual lock to Structure or Diff.

Visual design uses project design system: Badge for status/types,
IconButton for collapse (PanelRightClose/Open), dashed separators,
animate-fade-in transitions, card-like error items, border-l-2
indicators on active tree nodes and diff lines, segmented-control
pills for bottom bar, memoized parsing and lookups.

ConfigPage: flex layout, stable CodeMirror extensions via refs,
Cmd+S save keymap, Cmd+B panel toggle, dirty state guard,
.skillignore simplified panel, floating IconButton collapse toggle.
2026-03-20 02:36:50 +08:00
Willie 5a11a5dddc feat(ui): add config editor assistant panel hooks and field docs
Dependencies: yaml (YAML parsing), @codemirror/lint (inline errors).

Hooks:
- useYamlValidation: real-time parse + schema validation + typo
  suggestions via Levenshtein. Source lines shared, debounced 300ms.
- useLineDiff: LCS line-level diff, debounced 500ms. Exports
  computeSimpleChangeCount for external reuse.
- useCursorField: stable CodeMirror extension tracking cursor field
  path. Handles list items (- key: value). Deferred doc.toString().

fieldDocs: 28 entries covering full config.yaml schema (source,
mode, targets, extras, audit, hub, log, tui, gitlab_hosts).
2026-03-20 02:36:50 +08:00
Willie 23224b5467 feat: extras source config in server API and Web UI
Server:
- GET /api/extras returns source_type field
- POST /api/extras accepts optional source field
- extrasSourceDir helper uses ResolveExtrasSourceDir
- Auto-backfill extras_source on create, auto-create dirs on sync
- Fix data race: snapshot ExtrasSource under RLock in handleExtrasDiff

Web UI:
- ExtraCard shows source type badge for non-default sources
- AddExtraModal includes optional source path input
- Comprehensive cache invalidation: config/extras/targets mutations
  invalidate all dependent queries across pages
2026-03-20 02:36:50 +08:00
Willie 0b5eba205d feat(ui): add batch uninstall route, nav entry, and link from SkillsPage
- Add lazy import and route for BatchUninstallPage in App.tsx
  (placed before skills/:name to avoid capturing as dynamic param)
- Add "Batch Uninstall" nav entry with Trash2 icon in Layout.tsx MANAGE group
- Add "Batch Uninstall" secondary button next to "New Skill" in SkillsPage header
2026-03-19 16:33:24 +08:00
Willie b6722ed785 feat(ui): add BatchUninstallPage with filter + multi-select + batch uninstall
Implements a full batch uninstall page with:
- Group dropdown, glob pattern input, and type segmented control filters
- Multi-select with tracked repo auto-grouping (select one skill in a
  repo selects all siblings)
- Confirmation dialog with force option for dirty tracked repos
- Result summary with per-item success/failure details
- Navigation to Skills and Sync pages after completion
2026-03-19 16:33:24 +08:00
Willie 4f628c5d82 feat(ui): add batchUninstall API client method and types
Add BatchUninstallRequest, BatchUninstallItemResult, and
BatchUninstallResult interfaces plus the batchUninstall() method
on the api object to call POST /uninstall/batch.
2026-03-19 16:33:24 +08:00
Willie f9e4666fef fix: prevent sidebar layout shift when scrolling to bottom of Skills page
Sidebar used `position: sticky` inside a flex container, which broke
when main content exceeded viewport height — the flex container grew
and sticky lost its anchor. Switch to `position: fixed` for all
screen sizes so the sidebar never participates in document flow.
Main content uses `margin-left` to offset for the sidebar width.

This preserves window scroll, keeping Virtuoso virtual scrolling,
sticky toolbar, and ScrollToTop all working correctly.
2026-03-19 16:33:24 +08:00
Willie dc82b93d05 fix: address code review findings for auto-create target dirs
- Remove early return in dry-run so linked/copied counts are populated
  correctly (P1: UI preview no longer hides Sync Now button)
- Use local quietDryRun flag instead of mutating global DiagOutput
  to suppress per-skill messages (P2: safe under parallel sync)
- Use "Will create" for dry-run, "Created" for actual sync (P3)
- Include dir_created in allUpToDate check so empty source + missing
  dir still shows Sync Now in the preview modal
2026-03-19 04:16:36 +08:00
Willie 643e3c5c07 fix: auto-create missing target directories with notification (#87)
v0.17.5 blocked sync when target directories didn't exist, which
prevented first-time users on fresh CLI installs from syncing.

Sync now auto-creates missing directories and reports what it did
in CLI output, dry-run preview, and the Web UI. Init also creates
target directories when it detects an installed CLI tool.

Web UI: Sync Preview modal stays open after sync with a success
banner instead of immediately closing, so users can review results.

Closes #87
2026-03-19 03:57:08 +08:00
Willie d9acaf23f3 fix(ui): remove plus icon from NewSkillPage header 2026-03-18 22:35:02 +08:00
Willie bc4658ea8e fix(ui): use bold border only for active card selection
Drop blue background — selected state is just border-pencil (thick
dark border) + shadow-md, unselected stays border-muted (light).
Clean and minimal.
2026-03-18 22:35:02 +08:00
Willie 02009b8168 fix(ui): use blue accent for active card selection in wizard
Previous border-pencil + bg-paper-warm was nearly invisible against
the light theme. Switch to border-blue + bg-info-light to match
the dashboard's established selected-state convention (TargetsPage,
CollectPage, AuditPage).
2026-03-18 22:35:02 +08:00
Willie 2eb6a79670 fix: address code review findings from simplify pass
- Add cleanup (os.RemoveAll) on scaffold dir creation failure
- Use skill.ValidNameRe in isValidSkillName (remove duplicate regex)
- Derive canAdvance from nameError instead of re-calling validateName
- Remove redundant total param from ProgressBar (derive from steps.length)
- Fix popstate handler to read event.state.step directly
- Use Plus icon for PageHeader (icon prop is required)
2026-03-18 22:35:02 +08:00
Willie 0e2b3237a1 fix(ui): remove icon from NewSkillPage header
Sub-pages with backTo arrow don't use title icons — matches
FilterStudioPage and AuditRulesPage convention.
2026-03-18 22:35:02 +08:00
Willie 1d03eead66 fix(ui): remove subtitle from NewSkillPage header
Pages with backTo arrow should be single-line (title only),
matching SkillDetailPage convention. The subtitle caused an
inconsistent two-line header layout.
2026-03-18 22:35:02 +08:00
Willie 7b3844bd2d fix(ui): align NewSkillPage layout with dashboard conventions
- Add space-y-5 to root container (matches all other pages)
- Remove redundant mt-6/mt-8 margins
- Redesign scaffold step from cramped inline checkboxes to
  card grid with folder icons (matches pattern/category style)
- Remove unused Checkbox import
2026-03-18 22:35:02 +08:00
Willie 0ed219bff7 fix(ui): normalize scaffoldDirs in getTemplates response
Go's omitempty serializes nil slices as absent, causing
undefined.length crash in the pattern card grid. Normalize
to empty array in the API client layer.
2026-03-18 22:35:02 +08:00
Willie bca6c641c5 fix(ui): use spec-compliant mode label in new skill wizard
Change subtitle from generic text to "Creating in: Global/Project"
to match the spec's mode badge requirement.
2026-03-18 22:35:02 +08:00
Willie fa6ad43f4a feat(ui): wire up NewSkillPage routing and add entry button
Add /skills/new route (before /:name to avoid param conflict),
lazy-import NewSkillPage, and add "+ New Skill" button to SkillsPage
header. Clean up unused imports and variables in NewSkillPage.
2026-03-18 22:35:02 +08:00
Willie 87bc3d35c4 feat(ui): add NewSkillPage wizard for creating skills from templates
Multi-step wizard with: name validation (regex + duplicate check),
pattern selection from API, optional category, scaffold dir checkboxes,
and confirmation summary. Uses browser history for back-navigation.
2026-03-18 22:35:02 +08:00
Willie d6be8057ed feat(ui): add API client types and methods for skill creation
Add SkillPattern, SkillCategory, TemplatesResponse, CreateSkillRequest,
and CreateSkillResponse types. Wire up getTemplates() and createSkill()
API methods. Add 'templates' query key for caching.
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 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 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 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
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 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 2b2e119eb2 feat(ui): add ignored skills types to sync and diff API client 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