416 Commits
Author SHA1 Message Date
Willie 44420a8b84 feat(ui): improve analyze display, install picker, and tooltip UX
Analyze page:
- Display skill path (/) instead of flat name (__) in chart, table, dialog
- Widen chart name column from 150px to 220px
- Add skill path as first line in chart tooltip with separator
- Add hover highlight on chart rows

Tooltip component:
- Add followCursor mode that tracks mouse position
- Add viewport boundary detection to prevent clipping
- Measure natural size at (0,0) before clamping position
- Remove break-all to prevent mid-word breaks

Install page:
- Add singleSelect mode to SkillPickerModal (radio UI) when custom name is set
- Add custom name support to batch install API (backend + frontend)
- Remove cross-path duplicate check for batch installs
- Fix: don't show success summary toast when all skills failed
- Fix: keep picker open on install failure
- Preserve source input after install (don't clear on reset)
- Widen SkillPickerModal from md to 2xl
- Align severity badge and description text in warning dialogs

Toast: raise z-index above dialog overlay (z-50 → z-[60])
2026-03-28 02:30:50 +08:00
Willie bb029f7950 fix(analyze): handle null targets array in API response
Go nil slice serializes to JSON null instead of []. When no targets
match, buildGroups() receives null and for...of throws TypeError.

- Backend: use make([]..., 0) so JSON marshal produces []
- Frontend: add ?? [] guard and optional chaining for null safety
2026-03-28 01:55:25 +08:00
Willie dbce8ffa20 fix: update registry.yaml path and clean up formatting
Update registry.yaml path references from ~/.config/skillshare/
to ~/.config/skillshare/skills/ in schema description, quick
reference docs, and migration guide. Fix whitespace alignment
in lint.go constants and remove blank line in skill.go imports.
2026-03-27 02:17:54 +08:00
Willie eabb556cc6 refactor(config): cache SourceRoot in Config.RegistryDir
Eliminates redundant .git/ directory walks on every LoadRegistry call.
SourceRoot() is now computed once in config.Load() and cached in
cfg.RegistryDir. All 11 call sites use the cached value.
2026-03-26 23:32:15 +08:00
Willie a7de6a3a69 feat(registry): move registry.yaml to source dir for git sync (#103)
- Add SourceRoot() helper to find git repo root from cfg.Source
- Add MigrateRegistryToSource() for one-time migration
- Update all 11 global-mode LoadRegistry/Save call sites
- registry.yaml now lives in skills/ dir and is tracked by git
2026-03-26 22:42:00 +08:00
Willie 64ed9b046e feat(analyze): add malformed-frontmatter lint rule and polish UI/TUI
- Surface YAML parse errors from calcContextFromContent as a new
  "malformed-frontmatter" lint issue instead of silently ignoring them
- Fix help text to say "Top 10" (was "Top 5") matching actual constant
- Shorten TUI list title to target name only; move skill count to
  stats line so the header no longer wraps on narrow terminals
- Truncate long skill names in TUI to keep token counts visible
- Change "All Skills" icon block to green (matches Skills summary card)
2026-03-26 19:20:52 +08:00
Willie fe3e72fe38 feat(ui): add GET /api/analyze endpoint
Expose per-target context-window budget analysis via the REST API.
The handler discovers source skills with context metadata (desc/body
char counts, lint issues), applies each target's filter/mode rules,
and returns aggregated always-loaded vs on-demand token estimates.
2026-03-26 19:20:52 +08:00
Willie d377e6bbf6 refactor(analyze): simplify lint engine and fix review findings
- Eliminate double YAML parse: extend calcContextFromContent to return
  name, remove parseFrontmatterName helper
- Pre-compute lint icons (lintIconError/lintIconWarning) to avoid
  lipgloss.NewStyle() allocation per render frame
- Use tc.Red/tc.Yellow for Quality section icons (consistency)
- Extract check type string constants (checkFieldEmpty, etc.)
- Panic on embedded rule load failure instead of silent nil return
- Rename "Targets: all" to "Restricted to" (only shown when set)
- Fix struct field alignment (gofmt)
2026-03-26 19:20:52 +08:00
Willie 57ce3f507f feat(analyze): wire lint into discovery and analyze data flow
Populate LintIssues during skill discovery (collectContext path) and
propagate them through analyzeSkillEntry so JSON output includes lint
findings per skill.
2026-03-26 19:20:52 +08:00
Willie f5e5588290 test(analyze): add unit tests for all 7 lint rules 2026-03-26 19:20:52 +08:00
Willie 2e43e3726c feat(analyze): add lint rules YAML and LintSkill engine 2026-03-26 19:20:52 +08:00
Willie 2811a19fcf feat(analyze): return description from calcContextFromContent for TUI 2026-03-26 19:20:52 +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 dee3fcb1d0 refactor: move version under metadata in built-in SKILL.md
Move version field from top-level frontmatter to metadata block:
  metadata:
    version: v0.17.11

ReadLocalSkillVersion and FetchRemoteSkillVersion now parse
metadata.version with fallback to top-level version for backward
compatibility.
2026-03-25 21:14:16 +08:00
Willie 31ad27e966 test(extras): add FlattenRel and CheckSyncStatus unit tests
FlattenRel: 100% coverage (flatten, no-flatten, collision).
CheckSyncStatus: 0% → 84% (synced, drift, flatten synced, flatten
drift, flatten collision not drift, copy mode).
2026-03-25 21:14:16 +08:00
Willie 2ce1544dd1 docs: add flatten documentation, changelog, and contributor
Extras command docs, config reference, built-in skill, website
changelog, release notes. Add mk-imagine to README contributors.

Ref: #97
2026-03-25 21:14:16 +08:00
Willie 4c83ef71fb feat(ui): add flatten support to Web UI
Server handlers accept/return flatten field. Extras page shows flatten
checkbox per target. Config editor validates flatten+symlink constraint.

Ref: #97
2026-03-25 21:14:16 +08:00
Willie 5d9dd0cdbb feat(extras): add flatten option to extras sync engine
When flatten=true, SyncExtra maps subdirectory files to target root
using filepath.Base(). First file wins on collision, subsequent are
skipped with warnings. Includes config validation, sync-time guard,
CheckSyncStatus collision handling, and CollectExtraFiles support.

Ref: #97
2026-03-25 21:14:16 +08:00
Willie ed8596fc7e fix(server): fix extras sync response key and add read lock
- Change JSON key from 'results' to 'extras' to match frontend type
- Add RLock snapshot pattern matching handleExtras GET handler
- Replace s.extrasSourceDir() with inline resolution using snapshotted values
2026-03-20 18:29:05 +08:00
Willie 76e614c2f6 fix(server): return ignored skills stats even without root .skillignore
Previously the GET /api/skillignore handler returned no stats when
the root .skillignore file didn't exist, hiding tracked repo ignores.
Now always runs DiscoverSourceSkillsWithStats so tracked repos'
.skillignore entries are always reported.
2026-03-20 02:36:50 +08:00
Willie 14823027b5 test: comprehensive extras source config coverage
Unit tests:
- ResolveExtrasSourceDir 3-level priority + empty fallbacks
- ResolveExtrasSourceType per-extra/extras_source/default
- Config Load() tilde expansion for ExtrasSource and per-extra Source

Server tests:
- GET /api/extras includes source_type
- POST /api/extras with/without source field
- Project mode returns default source_type
- Create backfills extras_source

Integration tests:
- extras_source config, per-extra --source flag
- source_type in JSON, priority chain
- sync/collect/doctor/status with custom source
- sync auto-creates missing source dirs
- init backfills extras_source

E2E runbook (24 steps, mdproof verified):
- All three sync modes with content verification
- Tilde expansion, backward compatibility
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 5aa6ee8450 feat: configurable extras source with 3-level priority
Add extras_source (global default) and per-extra source (override)
to config.yaml. Resolution: per-extra > extras_source > default.

- Config: add ExtrasSource and ExtraConfig.Source fields with tilde expansion
- New ResolveExtrasSourceDir() replaces hardcoded ExtrasSourceDir()
- Migrate all 18 caller files to new resolver and sourceFunc signature
- CLI: extras init --source flag, help text
- TUI: source input phase in init wizard, narrower list panel
- extras list: source_type field in JSON, label in TUI detail
- Sync auto-creates missing source dirs instead of skipping
- extras init and server auto-backfill extras_source when missing
- doctor/status/diff/collect all use resolved source path
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 bb04987f75 feat(server): add POST /api/uninstall/batch endpoint
Batch uninstall with skip-and-continue semantics, registry cleanup,
config reconciliation, and gitignore batch removal. Supports both
global and project mode.
2026-03-19 16:33:24 +08:00
Willie 8c0e97ac13 feat: add remove action (R key) to target list TUI
Press R on a selected target to show a confirmation overlay.
Confirming exits the TUI and dispatches the full target remove
flow (backup + unlink + config update), matching the existing
exit-with-action pattern used by the skill list TUI.

Supports both global and project modes.
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 c57391ea39 feat: add Hermes Agent (Nous Research) target support
Hermes Agent is a CLI tool by Nous Research with skills support.
Paths: ~/.hermes/skills (global), .hermes/skills (project).
Ref: https://hermes-agent.nousresearch.com/docs/reference/optional-skills-catalog

Also updates target count from 55+ to 56+ across docs and homepage.
2026-03-19 03:57:08 +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 7b6cb70a0b test(server): add tests for create skill and templates endpoints 2026-03-18 22:35:02 +08:00
Willie 60b416651f feat(server): add POST /api/skills endpoint for skill creation
Handles skill creation from the web UI with full validation:
- Name validation (ValidNameRe)
- Pattern validation (must exist in Patterns list)
- ScaffoldDirs validation (must be allowed by the chosen pattern)
- Conflict detection (409 if skill already exists)

Creates SKILL.md from the template engine and optional scaffold
directories with .gitkeep files. Returns 201 with skill metadata
and list of created files. Logs to ops log as "create-skill".
2026-03-18 22:35:02 +08:00
Willie 6e23f11be7 feat(server): add GET /api/skills/templates endpoint
Expose skill design patterns and categories via API for the upcoming
web UI skill creation wizard. Returns the full Patterns and Categories
lists from internal/skill/.

Route registered before GET /api/skills/{name} to avoid path conflict.
2026-03-18 22:35:02 +08:00
Willie 22efeea924 refactor: extract skill templates to internal/skill package
Move pattern/category definitions and template generation logic from
cmd/skillshare/new_templates.go to internal/skill/ so both the CLI and
the web UI server can import them. The CLI file becomes thin wrappers
with type aliases to keep new_tui.go and new.go unchanged.
2026-03-18 22:35:02 +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 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 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 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 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 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 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 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 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 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 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
Willie b2f5592cdb refactor(discovery): extract shared walk, add DiscoverSourceSkillsWithStats
Unify ~160 lines of duplicated walk logic from DiscoverSourceSkills and
DiscoverSourceSkillsLite into a single discoverSourceSkillsInternal
function controlled by discoverOptions (parseFrontmatter, collectIgnored,
collectTracked).

Add DiscoverSourceSkillsWithStats which returns IgnoreStats populated
with root/repo .skillignore file paths, active patterns, and ignored
skill relPaths. When collectIgnored is true, CanSkipDir is bypassed so
the file-level Match check can record every ignored SKILL.md path.

Add Patterns() method to skillignore.Matcher to expose the original
pattern strings stored during Compile().
2026-03-18 00:19:30 +08:00