Commit Graph
6 Commits
Author SHA1 Message Date
Willie 36a314442b refactor(server): decode JSON request bodies through one size-limited helper
About 57 handlers decoded request bodies with no size limit, and the few
that had one each picked their own. They now go through decodeJSON with a
1 MiB default; handlers that need more keep their larger limit. An
oversized body gets 413 instead of whatever the handler returned for bad
JSON (MCP and plugin requests used to answer 400). Every other decode
error keeps the handler's existing status and message.
2026-09-30 02:25:42 +08:00
Willie 996d00e342 feat(config): migrate consumers to Effective*Source helpers (Phase 3+5)
Make the v0.19.16 sources map actually do something: route all path
reads through Config.EffectiveSkillsSource() / EffectiveAgentsSource() /
EffectiveExtrasSource() so users who set sources.skills / sources.agents /
sources.extras get the configured paths everywhere.

Mechanical changes (~50 files):
- cmd/skillshare/**: replace cfg.Source / cfg.ExtrasSource reads with
  cfg.EffectiveSkillsSource() / cfg.EffectiveExtrasSource()
- internal/server/**: replace s.cfg.Source / s.cfg.ExtrasSource reads
  with the same helpers; server.skillsSource() / gitignoreDir() use the
  global-mode helper
- internal/config/config_validate.go: validate using EffectiveSkillsSource
  while still rejecting configs that set neither field explicitly
- internal/config/reconcile.go, registry.go: read via helpers

Behavioral fixes (paired with the migration):
- extras init / extras source / POST /api/extras no longer silently
  backfill the legacy extras_source field — the runtime fallback inside
  EffectiveExtrasSource() handles it. This stops surprise diffs in users'
  config.yaml after running extras commands.
- extras source command writes back to whichever field the user already
  configured (sources.extras if set, otherwise legacy extras_source) so
  the update is not shadowed.
- source_type in /api/extras and extras list correctly reports "default"
  vs "extras_source" by inspecting the raw (unresolved) configured value;
  sources.extras counts as configured for this purpose.

UI:
- ui/src/lib/fieldDocs.ts: neutralize sources / sources.* descriptions
  so they describe both project and global modes (Phase 5).

Preserved (intentional):
- Direct writes to cfg.Source / cfg.AgentsSource / cfg.ExtrasSource in
  init, migrate.go, cloneForSave, and server.reloadConfig — these are
  raw-field writes, not path reads.
- Updated test expectations for the removed backfills.
2026-05-21 14:49:11 +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 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