Commit Graph
3 Commits
Author SHA1 Message Date
Willie 86d989035b fix(server): stop skill-source edit from hijacking source-root git remote
findRepoRoot walked up to and including the skills source root when
resolving a skill's tracked repo. When the source root is itself a git
repo (e.g. GitSync-backed), editing any nested skill's source rewrote
that repo's origin URL via SetRemoteURL. Bound the search strictly below
the source root — a tracked skill's .git always lives in a subdirectory —
and match the root prefix with a trailing separator to avoid sibling-dir
false positives.
2026-07-21 00:31:37 +08:00
Willie 224607af81 fix(server): fail source updates when remote update fails
Update tracked repo remotes before persisting source metadata so the API cannot report success while the on-disk git remote remains unchanged.

Cover both remote update failure and successful remote plus metadata updates.
2026-06-14 15:01:51 +08:00
Willie 5fc5ee4fe5 feat(ui): add web-based skill editor with metadata, live preview, and diff review
Introduces a full in-browser skill editor reachable from the skill detail
page, replacing the previous read-only detail view for edits.

Editor
- Two-pane layout with Markdown textarea, live preview, and synced scroll
- Edit / Split / Preview mode toggle in the status bar (⌘P to cycle)
- Keyboard shortcuts: ⌘S save (with diff review), Esc cancel
- Outline drawer with jump-to-heading
- Token / word / line / file count in status bar, 5K budget warning

Frontmatter
- Grouped field editor (Identity / Invocation / Execution / Metadata)
  matching the 13 official SKILL.md fields
- Shared 1,536-char budget enforced across description + when_to_use
- Switch toggles for booleans, segmented control for enums, chip array
  inputs for list-valued fields
- Metadata group edits nested metadata.* keys directly, with stable row
  ids so typing key → clicking value no longer remounts the inputs
- Special handling for metadata.targets so values serialize as a YAML
  list (backend ParseFrontmatterList requires arrays)
- YAML mode for raw editing; Fields ↔ YAML round-trips cleanly
- Legacy root-level 'targets:' migrated to metadata.targets on load

Diff review
- Save triggers a side-by-side diff modal built on the shared DialogShell
  with focus trap and backdrop, using the Button component for actions
- YAML serializer emits plain scalars when safe instead of wrapping every
  value containing ':', '*', '#', or '"', eliminating spurious churn in
  the save diff

Misc
- DialogShell gains 4xl–7xl maxWidth presets
- Resource detail sidebar shows a Targets row when metadata.targets is set

Backend additions (server handlers):
- POST /api/resources/:name/content   save SKILL.md content
- POST /api/resources/:name/open      open in local editor
2026-04-19 09:29:18 +08:00