Commit Graph
16 Commits
Author SHA1 Message Date
Willie ce76f58393 fix(doctor): read metadata.version + harden frontmatter delimiter parsing
- doctor: replace inline frontmatter parser with version.ReadLocalSkillVersion
  which correctly reads nested metadata.version (fixes #119)
- frontmatter_write: use TrimRight instead of TrimSpace for --- delimiter
  so indented --- inside YAML block scalars is not mistaken for end marker
- Update changelog and website changelog for v0.18.7
2026-04-04 17:05:22 +08:00
Willie 9abd9af71f feat(server): add SetFrontmatterList utility + batch/single target endpoints
New utility: SetFrontmatterList() writes/removes YAML list fields
in SKILL.md frontmatter with dot-notation support (metadata.targets).
Normalizes legacy top-level targets field. Preserves body content.

New endpoints:
- POST /api/skills/batch/targets — set targets for all skills in folder
- PATCH /api/skills/{name}/targets — set target for single skill
Both use s.mu.Lock() for safe concurrent access.

Includes 15 unit tests covering set/remove/traverse/root-only/not-found.
Part of issue #115.
2026-04-04 17:05:22 +08:00
Willie 620141af2b feat(analyze): add context analysis command
Analyze context window usage per target, showing always-loaded
(description) vs on-demand (body) token costs.

- Single-pass discovery with frontmatter-aware char/token counting
- Per-target filtering (include/exclude/symlink mode)
- Unified output when all targets have identical skills
- Verbose mode shows top 10 largest descriptions
- Project mode (-p) support
- JSON output (--json)
- Integration tests
2026-03-26 19:20:52 +08:00
Willie 3bedd8a7ea docs: note that ParseFrontmatterFields does not resolve metadata fields 2026-03-18 22:35:02 +08:00
Willie 3c3974cab3 feat: support metadata.targets in SKILL.md frontmatter
Align with the emerging agent skill ecosystem convention where
deployment/behavioral fields live under a metadata: YAML block.

ParseFrontmatterList() now checks metadata.<field> first, then
falls back to the top-level field. Backward compatible — existing
SKILL.md files without metadata: continue to work unchanged.
2026-03-18 22:35:02 +08:00
Willie 38f8f1c796 fix(symlink): resolve symlinked source/target dirs across all Walk callsites
filepath.Walk/WalkDir silently skip symlinked root directories because
os.Lstat sees the root as a non-directory symlink and never enters it.
This affected update, uninstall, reconcile, and server handlers when
the source directory was a symlink (common with dotfiles managers).

Extract ResolveSymlink() from sync.go into internal/utils/path.go and
apply it at every filepath.Walk/WalkDir callsite on source/target dirs.

Also add containment guards to resolveGroupSkills (uninstall) and
resolveGroupUpdatable (update) to reject group directories that are
symlinks pointing outside the source tree.
2026-03-02 10:05:57 +08:00
Willie 13744f89a8 refactor: consolidate duplicated utilities and simplify diff API
- Extract shared applyDetailScroll into tui_helpers.go (was duplicated
  across diff_tui.go, log_tui.go, audit_tui.go)
- Create utils.FileHash and utils.FileHashFormatted, replacing private
  copies in install/meta.go and audit/audit.go
- Export install.MetaFileName constant, use from diff_file.go
- Replace double SHA-256 in fileContentsEqual with streaming byte compare
  for early-exit efficiency
- Add 1MB size cap to generateUnifiedDiff to prevent performance issues
- Move noTUI into diffRenderOpts struct, simplifying function signatures
2026-03-02 02:23:50 +08:00
Willie da0b24ad25 feat(list): add tree sidebar content viewer with glamour markdown rendering
Dual-pane content viewer for list TUI: left sidebar shows recursive file
tree (depth≤3), right panel renders Markdown via glamour with custom style.
Vim-like navigation: h/l expand/collapse dirs, j/k auto-preview, Tab to
switch panels. Mouse wheel scroll and click supported.
2026-02-26 22:27:23 +08:00
Willie 7079a705f3 feat(sync): add DiscoverSourceSkillsLite and ParseFrontmatterFields
DiscoverSourceSkillsLite skips frontmatter parsing during directory
walk and collects tracked repos in a single pass — significantly
faster for large skill collections.

ParseFrontmatterFields extracts specific YAML fields from SKILL.md
without parsing the full document, used by the TUI detail panel.
2026-02-25 19:39:28 +08:00
Willie a29e198725 feat: add target filter CLI, skill-level targets field, and Web UI support
- CLI: `target <name> --add-include/--add-exclude/--remove-include/--remove-exclude`
- SKILL.md `targets` frontmatter restricts sync to specified targets
- Cross-mode matching (e.g. "claude" matches "claude-code" project target)
- Web UI: inline filter editor on Targets page, target badges on Skills pages
- API: PATCH /api/targets/{name} for filter updates
- Fix drift detection in doctor/status/handler to account for skill-level targets
- `check` warns about unknown target names in skill-level targets field
- Docs: update skill-format, target command, configuration, creating-skills
2026-02-15 23:29:30 +08:00
Willie e0c9499c14 fix: parse YAML block scalars in frontmatter and use CodeMirror for all file types
Two related UI fixes for the skill detail page:

1. YAML block scalar parsing: description fields using >-, >, |, |-
   syntax showed the raw indicator instead of the parsed value. Fix
   both frontend (parseScalarValue) and backend (ParseFrontmatterField)
   to recognize block indicators and read indented continuation lines.

2. File viewer: non-markdown files (.py, .sh, etc.) rendered as plain
   <pre> without line numbers or highlighting. Now all non-markdown
   files use CodeMirror, with Python syntax highlighting via
   @codemirror/lang-python.
2026-02-13 14:21:36 +08:00
Willie 6185849328 fix: handle Windows junctions in sync and diff 2026-02-08 15:14:16 +08:00
Willie 092fb14f8a feat: add web dashboard with embedded React SPA (skillshare ui)
Single-binary web UI for visual skill management — React 19 + Vite
frontend embedded via go:embed, Go net/http REST API backend (30+
endpoints). Includes dashboard, skills browser, targets, sync, collect,
search, install, config editor, backup/restore, and git sync pages.

Also adds Bitbucket/GitLab URL parsing for install, git operations
library, skill version checking, CI frontend build steps, Docker
sandbox support, and website docs for the ui command.
2026-02-08 05:08:30 +08:00
Willie Hung 0f7ba6ff8d fix(windows): improve junction error messages and path comparison
- Add detailed error messages when junction/symlink creation fails
  - Pre-flight checks for source existence and target conflicts
  - Capture mklink /J stderr output
  - Show both junction and symlink failure reasons

- Add case-insensitive path comparison for Windows (NTFS)
  - New PathsEqual() and PathHasPrefix() in utils/path.go
  - Fix 8 path comparisons that could fail due to case differences
  - Affects sync, pull, target remove, diff, and doctor commands
2026-01-31 16:50:39 +08:00
Willie Hung fd4387460a feat: Team Edition - tracked repos, nested skills, collision detection
## New Features
- Tracked repositories: `install --track` to clone team skill repos
- Nested skills: organize in folders, auto-flatten on sync (work/api → work__api)
- Name collision detection: warns when multiple skills share same SKILL.md name
- Auto-pruning: orphaned symlinks cleaned on sync
- Custom naming: `--name` flag for tracked repos

## Changes
- Require target path to exist when adding targets
- Add sync reminder after adding target
- Improve pruning messages (broken vs orphan symlinks)
- Add `{team}:{name}` naming convention recommendation

## Files
- New: update.go, gitignore.go, frontmatter.go
- Updated: sync.go, install.go, uninstall.go, validate.go
- Docs: README.md, SKILL.md
2026-01-20 01:56:07 +08:00
Willie f5e9d9644e docs: improve README with better structure and content
- Add badges (License, Go version, Release)
- Add ASCII flow diagram showing architecture
- Add Table of Contents for navigation
- Add "Why skillshare?" comparison table
- Add Use Cases section (Individual, Team, Open Source)
- Add FAQ section with common questions
- Add Contributing guide with development setup
- Reorganize sections for better readability
2026-01-14 22:12:56 +08:00