47 Commits
Author SHA1 Message Date
Willie cfe235a84d fix(install): report reinstalls from the same repo as skipped (#887)
* fix(install): report reinstalls from the same repo as skipped

checkExistingConflict read only the legacy .skillshare-meta.json
sidecar, which installs no longer write, so reinstalling a skill from
the same repo was reported as "already exists" and counted as failed,
contrary to the documented skip. It now reads the skill's record in
.metadata.json, falling back to the sidecar, and skips only the same
skill of that repo: another skill installed under the same name stays
a conflict instead of being reported as installed.

The dashboard logged an existing agent as installed and a same-repo
skill as failed. Batch installs now return those as skipped and log
them as skipped_skills, passing --into so a reinstall into a group
folder finds its record; the install dialog warns that they are
already installed. A same-repo tracked reinstall returns 409 and is
logged as skipped instead of a 500 logged as failed.

ss search installs, batch and single, log the names they skip, and
the Herdr panel reports skipped names like failed ones. The install
docs and their translations say that only the same skill is skipped.

* fix(install): install requested agents when the only skill is skipped

Reinstalling a single-skill repo with `-s alpha -a helper` returned as
soon as the skill was skipped as already installed, so the requested
agent was never installed while the command reported success. Both
single-skill branches now continue to the agent phase, as the
multi-skill path already does.
2026-11-14 00:03:17 +08:00
Willie 769087b882 fix(project): keep config.yaml true after reinstall, uninstall and fresh-clone installs (#860)
In project mode the committed config.yaml is what teammates install from, but
it could disagree with what a machine actually has (#858):

- `uninstall -p` and the dashboard's single-skill and tracked-repo removal
  left the skill's entry in config.yaml, so a later `install -p` brought it
  back. They now drop the entry and the lock pin through one shared
  config.ForgetProjectSkills, as the uninstall docs already promised.
- Installing a skill again from another source or branch (after an uninstall,
  or over the copy with --force) updated only the gitignored .metadata.json.
  config.yaml kept the old source and skills.lock.json ended with the old
  source and the new commit. Installs from a named source (CLI install,
  search, dashboard) now compare the records from before and after the
  command and let the config entry follow the skills it actually reinstalled.
  Install from config never rewrites an entry from local records, so a
  teammate's edit survives on a machine that has not updated yet.
- Reconcile removed every config entry that had no folder and no record. On a
  fresh clone nothing is installed yet, so `install <source> -p` deleted all
  the other declared skills. An entry now goes only when the skill was
  installed here and its folder is gone, when it was moved, or when a command
  removed it; `move` passes the old paths and `update --prune` cleans the
  config itself.
2026-11-11 22:42:03 +08:00
Willie 89f4b9425a refactor(reconcile): share the lock pin mover, skip adoption when no record is gone (#524)
Cleanup after #523: install.MoveLockPins shared by skillmove and the project reconcile; one server store reload and reconcile dispatcher; adoption skips the source walk when no plain record's directory is missing.
2026-10-11 04:19:32 +08:00
Willie 3a5da6b529 feat(sync): adopt the install record of a skill moved by hand (#523)
After a plain mv, only install or Install missing moved an installed skill's record; sync now adopts it too (CLI global, CLI project, dashboard), never prunes, and skips on --dry-run. A hand-moved project skill keeps its lock pin; a same-name nested skill never takes a live record; metadata load failures are sync warnings.
2026-10-11 03:50:58 +08:00
Willie bf1731dec4 feat(move): move installed skills and folders without losing their records (#520)
Add skillshare move and POST /api/resources/batch/move so skills and
whole folders can change folder inside the source while keeping their
.metadata.json entry, accepted audit findings, lockfile pin, config
group, .gitignore and literal .skillignore lines. Moving by hand lost
the record and made the next install start over. install --into now
refuses a folder inside a skill or a tracked checkout.

Refs #510
2026-10-11 00:43:47 +08:00
Willie cdac248e96 fix(install): strip secrets from any submodule URL and show warnings in the dashboard
Redact query, fragment and userinfo from relative, scp-style and malformed .gitmodules URLs too, clean the subdir before matching gitlinks so vendor//up is caught, and return discovery warnings from /api/discover so the install dialog shows skipped submodules.
2026-10-07 02:10:03 +08:00
Willie a502e9316b feat(sourcefs): write through followed first-level source links
With follow_source_links on, discovery reports <source>/_dev-skills/foo,
but every write to it was refused: sourcefs rejects a link in the path, and
its source-root os.Root refuses descendants outside the source. Dashboard
edits, nested uninstall, regular skill replacement, and tracked installs
under such a link all failed, although writing through a link the user
placed is the agreed behavior (#410).

sourcefs.Open, Create, MkdirAllIn, and CheckMoveOut take the operation's
optional sourcewalk.Follow. A clean name <link>/<rest> whose first
component the policy follows is handled by a second os.Root opened at the
link's canonical target, with the same per-component link check on <rest>,
so a nested link or ".." still cannot escape the target. Names with ".."
keep the source root, which refuses them through the link. Without a
policy nothing changes.

The link entry itself stays a link: RemoveAll, Rename, and writes on it are
refused, install --track --force still refuses to replace it, and
CheckMoveOut still lets trash rename the link without following it.
MkdirAll on a followed link is a no-op, since it already is that directory;
install --into needs that. A rename across the link boundary is refused.

The install, update, uninstall, and server callers pass the same policy
their discovery uses, through InstallOptions.SourceFollow and the update
context. No raw-write allowance was needed.

Refs #274
2026-10-05 14:42:09 +08:00
Willie 8c60f51b9f feat(source): add the sourcewalk walker and sourcefs write boundary for proposal 274 (#385)
Implements rollout steps 1 and 2 of proposals/274-skillfollow.md. Nothing follows a link or parses .skillfollow yet.

Step 1: doctor reports first-level symlinks and junctions in the skills source as info, in text and JSON, without following them.

Step 2a: internal/sourcewalk owns traversal of the skills source. Thirteen raw walks move onto it with identical behavior, and a go/parser ratchet fails the tests on any new unclassified walk.

Step 2b: internal/sourcefs wraps an os.Root opened at the skills source and refuses any write whose path has a link component. The six write sites the proposal found in review move onto it, including the cross-device copy fallback, and a second ratchet covers raw os write calls. The only behavior change is that an explicit path crossing a link inside the source is refused instead of written through.

Refs #274

Release-As: 0.24.3
2026-10-04 15:15:43 +08:00
Willie f28e5e23f4 fix(install): keep local installs updatable from any directory and in shape (#336)
* fix(install): keep local installs updatable from any directory and in shape

Follow-ups to local-source change detection (#334):

- Global installs recorded a relative local path as typed, so `update`
  and `check` resolved it against whatever directory they ran in and
  failed with "source path does not exist". Global CLI and dashboard
  installs now record the absolute path. Project mode keeps the path as
  written, because .skillshare/config.yaml is shared across machines.
- The dashboard installs the root of a directory that also holds child
  skills as its SKILL.md alone, but `update` re-copied the whole
  directory, pulling in child skills and unrelated files. Updates now
  keep that shape. The detection is shared with `check` so both agree on
  which files belong to the install.

* fix(install): never narrow a whole-directory update to SKILL.md alone

The SKILL.md-only shape was inferred from a child skill in the source that
the recorded hashes lack. A whole-directory install whose source gained a
child skill later matched that too, so `update` replaced it with SKILL.md
alone and deleted its other files. Decide from the recorded files instead:
only an install that recorded SKILL.md alone keeps that shape.
2026-10-02 20:30:27 +08:00
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 6a325037f2 refactor(server): share the skills config reconcile step
Install, batch install, tracked-repo install, uninstall and rehydrate
each repeated the same nine-line block to reconcile the project or
global skills config. reconcileSkillsConfig now holds that block, so a
change to reconcile behavior or logging is made once instead of five
times. Each caller still passes its own source directory, so behavior
is unchanged.
2026-09-30 01:35:10 +08:00
a352b8d243 feat(install): pin skills to a tag or commit from their web URL (#293)
* feat(install): pin GitHub tree/blob URLs to their ref

Hub entries only carry a source URL, so a team hub had no way to pin a
third-party skill to a reviewed tag or commit. The parser already read
tree/<ref>/ and blob/<ref>/ URLs but discarded the ref, installing from
the default branch instead of the version the URL names.

Keep that ref as Source.Branch. An explicit --branch (CLI) or branch
(API body) still overrides it; the server handlers now only override
when a branch is given. Batch installs group by repo and ref so two
pinned versions of one repo get separate clones.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* docs(install): describe pinning hub sources to a tag or commit

Explain that a GitHub tree/<ref>/ source URL pins the install, in both
the hub index guide and the install reference.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* feat(install): pin GitLab/Bitbucket URLs and resolve refs containing "/"

Pinning should not depend on the host, so GitLab (-/tree/<ref>/) and
Bitbucket (src/<ref>/) web URLs now keep their ref too.

Taking the first path segment as the ref broke branch names containing
"/": tree/feature/x/skills/foo cloned branch "feature" and failed. When
the first segment is not a branch or tag on the remote, the longest
matching one is used instead. A ref the remote does not have fails
with a hint to use --branch, rather than silently installing the
default branch. A saved branch that covers more of the path (from
--branch or config) moves the subdir without asking the remote.

The grouped-install round-trip test pinned -/tree/main/ against a repo
on master; the ref used to be ignored, so its branch is now renamed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* docs(install): cover GitLab, Bitbucket and "/" branches in URL pinning

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(install): keep web URL refs correct on reinstall, --branch and grouping

Review of the slash-branch resolution found four gaps:

- A saved branch equal to the whole URL tail (tree/feature/x) did not
  move the subdir back, so every reinstall or update looked for "x".
- An unrelated --branch with a slash-branch URL kept the parse-time
  subdir (x/skills/foo) instead of the URL's real one.
- Grouped installs copy the source to a repo root; resolution then put
  the subdir back and discovery looked under a doubled path. Grouping
  also keyed on the unresolved first segment, so tree/feature/x and
  tree/feature/y could share one clone. Web URLs with a ref now install
  on their own, and resolution leaves a repo-root copy at its root.
- A skill named after the parse-time subdir kept that name once the
  path turned out to be all ref (tree/feature/x named the skill "x").

The unknown-ref error now reads as a missing ref first, since a stale
ref (tree/master after a rename) is more common than a slash branch.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(update): keep legacy installs on the default branch

Skills installed before URL refs were honoured got the default branch
and recorded no branch. Single-skill update re-parses the recorded
source, so it moved them to the URL's ref (or failed on a stale one,
with a hint to pass --branch, which update does not accept), while
update --all rebuilds from RepoURL and kept the default branch.

ApplyRecordedBranch treats an empty recorded branch as the remote
default and drops the URL's ref. It replaces the branch handling at
every site that reinstalls from recorded metadata: CLI and server
update for skills and agents, and tracked-repo rehydration.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* perf(search): share one clone across pinned hub skills from a repo

Any web URL with a path after its ref installed on its own, so a hub
listing many tree/<tag>/ skills from one repo cloned it once per skill.

groupByRepo now resolves each URL's ref before grouping, with a
RemoteRefs cache that lists each remote's refs once, and groups by
repo and resolved ref. Only refs containing "/" (whose subdir the
discovery match cannot re-derive) and refs that fail to resolve still
install alone. A resolved source is marked settled so the grouped
clone does not resolve it again, and ApplyRecordedBranch settles the
subdir from a recorded branch without asking the remote.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Willie <egg358358@gmail.com>
2026-09-28 22:08:16 +08:00
Willie de1abd4b33 feat(install): pin project skills to a commit with a lockfile
config.yaml records which skills a project wants, but not which commit
each one resolved to, so two teammates running `install -p` a week apart
could end up with different skill contents.

Project mode now writes .skillshare/skills.lock.json next to the config.
`install -p` checks out the locked commit for skills and tracked repos,
and brings an already installed skill to the lock when they differ.
`update -p` and the dashboard move a pin only for skills whose commit
actually changed, so a stale local copy cannot roll the team back, and
uninstall drops the pin. A locked value is only honoured when it is a
full SHA for the same source, since it ends up as a git argument.
2026-09-21 04:31:22 +08:00
Willie 0a3e669b09 fix(audit): decouple audit override from Force so --force reaches the gate
InstallOptions.Force carried two meanings: "overwrite what is already
there" and "proceed despite audit findings". Update paths set Force
unconditionally to overwrite a staged temp dir, so they had to leave it
off to keep the audit gate alive -- which swallowed the caller's --force
and made the gate impossible to override from either the CLI or the web
UI.

Split the audit intent into InstallOptions.AuditOverride and route every
gate through it alone. Entry points translate --force explicitly, so a
missed one degrades to "force has no effect" rather than "audit is
bypassed". Scan failures stay fail-closed regardless: accepting known
findings is not the same as being unable to learn any.

This also closes two paths that bypassed the gate outright, since both
inherited Force for overwrite reasons alone: install --json and grouped
batch updates.

In the web UI, Force Retry now appears only on failures force can
actually resolve -- a permission-denied unlink previously offered a
button that could never succeed -- and CLI-only flag hints are stripped
from messages rendered there.

Behaviour change: a --force at install time no longer exempts later
updates from the audit gate; it is a one-off decision per command.
2026-08-27 17:10:29 +08:00
Willie 51af05ce6b fix(server): reload skills metadata store after install
install.Install persists metadata through its own store instance, leaving
the server's cached skillsStore stale. Freshly installed skills resolved
to a nil metadata entry and rendered with an empty source/type (shown as
"Local" in the UI) until restart. The agent path already reloaded
agentsStore; mirror it for skills across all three install completion
points (batch, tracked repo, single install).
2026-07-21 00:31:37 +08:00
Willie 54ae7b04e2 fix(install): reject project-root self-install via web UI
The project-root self-install guard lived only in the CLI handler, so the
web UI could still copy the project root into its own .skillshare/skills/
subtree in project mode. Extract the check into a shared
install.RejectProjectRootLocalInstall and apply it in handleInstall and
handleInstallBatch, returning 400 with the same guidance.

Also restructure the rejection message into a cause line plus an
actionable "Run '...'" hint, matching the project's error convention.
2026-06-16 10:04:57 +08:00
Willie 89080cf4f1 refactor(install): typed ambiguity error with counts, save one clone
The mixed-tracked-repo recovery path used a fragile substring match on
the error message and re-cloned the repo via /discover to count skills
and agents. Both problems share one root cause: the counts InferTrackedKind
already computed during the failed first install were thrown away.

- Add install.TrackKindAmbiguousError carrying the discovered Skills /
  Agents counts. InferTrackedKind returns it on the ambiguous branch.
  Error() preserves the legacy message verbatim so CLI output is unchanged.
- Server handleInstall track branch uses errors.As to detect it and emits
  writeCodedError with stable code 'install.track_kind_ambiguous' plus
  skills/agents counts in error_params.
- UI replaces the substring match with an ApiError.code check and reads
  counts straight from err.params, skipping the second /discover clone.
- Add unit tests asserting errors.As, count fidelity, and explicit-kind
  short-circuit (no clone).

Net result: 2 clones instead of 3 on the mixed-track recovery path, and a
stable cross-language contract instead of a brittle English substring.
2026-05-26 11:05:32 +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 da000c4d07 feat(server): agent tracked repo install, prune-on-empty, audit guards
- appendAgentDiffs helper deduplicates diff/stream agent logic
- handler_agent_diff: skip local copies, junction-aware checks
- handler_sync: prune orphan agents even when source is empty
- handler_install: tracked agent repo auto-detection and routing
- handler_skills: expose RepoRelPath and Targets for agents
- handler_skills_batch: agent target assignment via frontmatter
- handler_sync_matrix: pass agent Targets to ClassifySkillForTarget
- handler_update: tracked agent repo git pull update
- handler_audit: guard empty/missing source dirs gracefully
- Tests for all of the above
2026-04-10 02:05:13 +08:00
Willie b8a189ba58 Improve resource install agent support
Add local-path resource discovery so install flows can detect agents as well as skills. Preserve nested agent paths and suffixless agent metadata keys during batch install and update, and refresh the UI copy to use resource-aware wording on the install surface.
2026-04-10 01:26:40 +08:00
Willie d16c4f3812 fix: correct metadata store routing, corruption handling, and lookup depth
Three bugs introduced during centralized metadata migration:

1. Batch agent installs via UI wrote metadata to skills/.metadata.json
   instead of agents/.metadata.json because handleInstallBatch hard-coded
   SourceDir to s.cfg.Source. Override SourceDir with agentsSource() when
   body.Kind is agent.

2. CheckAgents used LoadMetadataOrNew which silently converts parse
   failures into an empty store, making all tracked agents appear local
   and suppressing drift/update diagnostics. Switch to LoadMetadata and
   surface corruption as status=error with the parse error message.

3. findMetaEntry only climbed 3 parent directories when searching for
   .metadata.json, but --into supports arbitrary nesting depth. Raise
   the ceiling to 10 (root sentinel still terminates early).
2026-04-08 18:06:20 +08:00
Willie 2acfec82ec refactor: simplify metadata — extract helpers, remove dual-write, add kind constants
Code quality fixes from review:
- Extract RemoveByNames() to eliminate copy-paste in uninstall Phase 7
- Add MetadataKindSkill/MetadataKindAgent constants
- Remove dual-write shim (findSkillsRoot + writeMetaToCentralized)
- install_apply.go uses WriteMetaToStore with SourceDir (no sidecar)
- Move LoadMetadata out of walk loops (P0 efficiency fix)
- isGroupDir accepts store parameter to avoid redundant loads
- Add SourceDir to InstallOptions for --into group support
2026-04-08 15:00:22 +08:00
Willie 1f1790b6be refactor: replace Registry with MetadataStore in reconcile, server, install context
Phase 1 of caller migration:
- projectRuntime: registry → skillsStore + agentsStore
- globalInstallContext: reg → store
- ReconcileGlobalSkills/ProjectSkills/ProjectAgents: take *MetadataStore
- Server struct: registry → skillsStore + agentsStore
- handler_install, handler_skills, handler_uninstall: use MetadataStore
- install.go, search.go: post-install reconciliation via MetadataStore
2026-04-08 10:59:13 +08:00
Willie 5afaf57745 feat(tui): add tab switching between skills/agents in list TUI
- Add Tab/Shift+Tab to cycle All/Skills/Agents tabs with count badges
- Tab bar renders at top with bold+underline cyan active, dim inactive
- Tab acts as pre-filter composing with text filter via AND logic
- Cache tab-filtered items in applyFilter() to avoid per-frame recomputation
- Add tabNoun() method to consolidate noun switches across title/filter bar

Agent install --into support:
- Support --into flag for agent install (CLI, server, project mode)
- Support --into=value syntax in addition to --into value
- Server handler_skills uses recursive AgentKind.Discover() for nested agents
- Fix agent metadata read path: use file basename instead of frontmatter name
- Sync --all flag now includes agent sync (not just extras)

Agent content viewer:
- Agents render full-width without sidebar (single .md file, no tree needed)
- Simplified help text and keyboard handling for agent content view

Agent uninstall fixes:
- Use discovery-based resolution instead of hardcoded name+.md path lookup
- Support matching by Name, FlatName, RelPath, or trimmed RelPath
- Compressed confirmation display (list format, max 20 shown)

UI polish:
- Help bar keys highlighted in dim cyan, descriptions in dim gray
- Align 'No items.' text with list title via PaddingLeft(2)
2026-04-07 21:55:05 +08:00
Willie ca73b40e0f feat: warn when agents installed/synced but no targets support agents
Add Config.HasAgentTarget() helper that checks if any configured target
has an agents path set.

handler_install: append warning to install summary when agents are
installed but no targets support them.

handler_sync: after sync completes, check if agents exist in source
but no targets have agent paths — add warning to response.
2026-04-07 18:05:40 +08:00
Willie 6c339da80d fix(ui): align checkbox with first text line and fix install summary label
SkillPickerModal: use items-start + mt-1.5 on checkbox/radio to align
with first line of multi-line content (name + path).

handler_install: summary message uses 'agents' when kind is agent,
instead of always saying 'skills'.
2026-04-07 18:05:40 +08:00
Willie 60489b3a0d fix(install): route agent installs to agents source directory
Backend (handler_install.go):
- handleInstallBatch checks body.Kind field; when 'agent', uses
  InstallAgentFromDiscovery() writing to agentsSource() instead of
  skills source directory.

Frontend (client.ts):
- installBatch accepts optional kind param.

Frontend (InstallForm.tsx):
- handleBatchInstall detects kind from selected items and passes
  kind='agent' to the API when installing agents.
2026-04-07 18:05:40 +08:00
Willie e4301f5781 feat(ui,api): kind-first install flow for mixed repos + discover agents
Backend (handler_install.go):
- handleDiscover now returns agents[] alongside skills[] with kind field
- needsSelection true when agents are present

Frontend (client.ts):
- Add DiscoveredAgent type and agents field to DiscoverResult

Frontend (InstallForm.tsx):
- Mixed repo: show kind selector dialog (Skills/Agents buttons)
- Pure agent repo: map agents to skill picker format directly
- After kind selection, open existing SkillPickerModal with filtered items

Spec/design/tasks updated with kind-first selection decision.
2026-04-07 18:05:40 +08:00
Willie c176d89405 feat(api): add kind field to sync, audit, check, update, and install handlers
handler_sync: add Kind field to diff stream item struct.
handler_audit: add Kind field to audit stream result.
handler_check: add Kind field to check stream result.
handler_update: add Kind field to update stream result.
handler_install: add Kind field to install request for agent support.
2026-04-07 18:05:40 +08:00
Willie 903df9f446 feat(server): add branch to skills API and install handlers
- skillItem struct gains Branch field (json: branch,omitempty)
- handleListSkills and handleGetSkill populate Branch from SkillMeta;
  fall back to git.GetCurrentBranch for tracked repos with empty metadata branch
- handleDiscover, handleInstallBatch, handleInstall all accept Branch in
  request body and propagate it to Source.Branch and InstallOptions.Branch
2026-04-01 00:32:49 +08:00
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 5307b3276e fix(server): use snapshot pattern to eliminate map races and narrow lock scope
Addresses P1 and P2 from code review on the RWMutex commit:

P1 — Stream handlers now snapshot config under RLock before streaming:
- handleDiffStream: clone Targets map to prevent concurrent map panic
- handleCheckStream, handleAuditStream: snapshot source/projectRoot
- handleUpdateStream: snapshot source (per-item Lock already correct)

P2 — All read handlers now use narrow snapshot instead of defer RUnlock:
- RLock → copy needed fields to locals → RUnlock → do work with locals
- Prevents slow I/O (git fetch, version check, audit scan) from blocking
  the auto-reload middleware's exclusive Lock on concurrent requests

Other changes:
- computeTargetDiff takes source parameter (no more s.cfg.Source access)
- Add cloneTargets() helper for safe map copying
- Add writeOpsLogTo/writeAuditLogTo for lock-free oplog writes
2026-03-17 04:48:42 +08:00
Willie 11f696cffe fix(server): upgrade Mutex to RWMutex for concurrent read safety
Addresses PR #82 review: read-only handlers accessed s.cfg without
synchronization, risking data races with concurrent config reloads.

- Upgrade sync.Mutex → sync.RWMutex (drop-in compatible)
- Add RLock to 26 non-streaming read handlers
- Keep exclusive Lock for write handlers (unchanged)
- Skip SSE streaming handlers to avoid blocking writes during streams
- Fix isConfigGitignored to propagate GitignoreContains errors
2026-03-17 04:48:42 +08:00
Willie a4d52615f7 feat(config): add gitlab_hosts for custom GitLab domain support
Self-managed GitLab instances on custom domains (e.g., git.company.com)
without "gitlab" in the hostname were parsed with 2-segment owner/repo
split instead of full-path repo. Users can now declare extra GitLab
hostnames in config so the parser treats them like gitlab.com (nested
subgroup support).

- Add `gitlab_hosts` field to both global and project Config structs
- Validate entries at load time (reject scheme, path, port, empty)
- Add `ParseOptions` / `ParseSourceWithOptions` to thread hosts into parser
- Add `isGitLabHost()` helper combining built-in + custom host detection
- Extend `InstallContext` interface with `GitLabHosts()` method
- Update all ParseSource call sites (install, search, update, server)
- Add JSON schemas for both config files
- Add unit tests for config validation and source parsing
- Add E2E runbook for devcontainer verification
- Document in configuration reference and URL formats appendix
2026-03-12 16:45:02 +08:00
Willie ba7752f85d feat(ui): enhance install skill picker with descriptions and into-dir field
Include skill description from SKILL.md frontmatter in the discover API
response, add the optional description field to the DiscoveredSkill
TypeScript interface, and render it inline in the SkillPickerModal.
Filter search also matches against descriptions. The --into directory
input already existed in InstallForm, so no change was needed there.
2026-02-28 20:56:34 +08:00
Willie a37c458740 fix(ui): support subdir URL discovery and fix modal scroll-away bug
handleDiscover and handleInstallBatch now use DiscoverFromGitSubdir
when the source URL contains a subdirectory path, enabling the skill
picker modal to appear for multi-skill subdirectories.

Fix SkillPickerModal content disappearing on checkbox click caused by
Card's overflow-hidden creating a scroll container — browser's
scrollIntoView on the sr-only input would scroll content out of view.
Use overflow-clip instead to preserve border-radius clipping without
creating a scroll context.

Issue #56 (workaround)
2026-02-28 18:26:48 +08:00
Willie 666091a453 feat(install): add cross-path duplicate detection and same-repo skip
Prevent accidental duplicate installs when the same repo is already
installed at a different path (e.g., --into vs root). Same-repo
reinstalls now show a friendly skip indicator instead of an error.

- Add CheckCrossPathDuplicate() with URL normalization (HTTPS/SSH)
- Add ErrSkipSameRepo sentinel for graceful skip flow control
- Add checkExistingConflict() with repo URL comparison
- Fix --force hint to use repo URL (not per-skill subpath) and
  include --into when applicable
- Add dedup check to Web UI install endpoints (HTTP 409)
- Group skipped skills by directory with repo label in summary
2026-02-28 03:44:02 +08:00
Willie 2cb6cc3159 refactor: update all callers to pass Registry to reconcile functions
- install_context: read skills from Registry instead of Config
- project_runtime: load Registry on init
- install/search: pass Registry to ReconcileGlobalSkills
- uninstall: load/save Registry for skill removal
- server: hold registry field, reload on config refresh
2026-02-25 07:02:54 +08:00
Willie b1ede8d918 fix: handle errors from ReconcileGlobalSkills, filepath.Walk, and remove redundant applyExclude
Address PR #29 review feedback:
- Log warnings on ReconcileGlobalSkills/ReconcileProjectSkills failures
  instead of silently discarding errors
- Propagate filepath.Walk callback errors in uninstall group/nested resolution
- Remove redundant applyExclude call in selectSkills (callers already filter)
2026-02-18 22:23:50 +08:00
Willie 7abe17cc2c feat: add declarative skill manifest for global mode
Port the project-mode skill manifest pattern to global mode so
`config.yaml` supports a `skills:` section and `skillshare install`
(no args) installs all listed remote skills.

- Rename ProjectSkill → SkillEntry (shared by both modes)
- Add Skills []SkillEntry to global Config with validation
- Add ReconcileGlobalSkills() to auto-sync manifest after install
- Wire no-arg install, auto-reconcile on all install paths
  (including search → install), and uninstall cleanup
- Update server handlers for global reconciliation
- Update docs, tests, and CHANGELOG
2026-02-18 22:23:50 +08:00
Willie 9ee5324689 feat: enhance security audit thresholds, logging, and UI 2026-02-13 14:21:36 +08:00
Willie aa43f94892 feat: add --into flag for skill install command
Allow installing skills into subdirectories for organized folder
structures. Works with all install modes (direct, discovery, tracked)
in both global and project mode.

- Add Into field to InstallOptions and IntoPath() validation
- Update 4 dest-path construction points in CLI with destWithInto()
- Update InstallTrackedRepo for --into prefix in dest and gitignore
- Rewrite ReconcileProjectSkills to use filepath.WalkDir (recursive)
- Add --into to Web UI install handler, API client, and form
- Add 5 integration tests covering local, multi-level, validation,
  project mode, and no-source rejection
2026-02-13 14:21:36 +08:00
Willie f49b3999bc feat: enrich install and audit logs with mode/path and installed skills 2026-02-10 11:51:09 +08:00
Willie e5813cc7e0 feat: add oplog instrumentation to all API handlers, improve audit/log/sync CLI
- Add oplog write helpers to server (oplog_helper.go) and instrument
  all handler_*.go endpoints with ops/audit logging
- Improve audit CLI with structured auditRunSummary and severity counts
- Enhance log CLI with richer filtering and detail display
- Improve sync CLI with drift detection summaries in oplog
- Reorder web UI sidebar nav by user workflow (core → acquire → distribute → maintain → monitor)
- Enhance LogPage with better formatting and filtering
- Add server oplog unit tests (logging_test.go, log_test.go)
- Update docs for log command and quick-reference
2026-02-10 03:50:03 +08:00
Willie 5a65993304 feat: add operation log — JSONL-based persistent audit trail for CLI, API, and web UI
Add oplog package (internal/oplog) that records every mutating command
(install, uninstall, sync, push, pull, collect, backup, restore, update,
audit) as a JSONL entry with timestamp, status, duration, and args.

- CLI: `skillshare log` with --audit, --tail, --clear, --project flags
- API: GET/DELETE /api/log endpoints with type and limit params
- Web UI: LogPage with ops/audit tabs, table view, clear and refresh
- Instrumentation across 12 command handlers (CLI + server)
2026-02-10 02:56:59 +08:00
Willie 14bd568b9a feat: add project mode support to web dashboard (skillshare ui -p)
The web dashboard now fully supports project-level skills. When launched
with `-p` or when `.skillshare/config.yaml` is auto-detected, the UI
adapts: Git Sync and Backup pages are hidden, Config edits the project
config, Install reconciles ProjectConfig.Skills[], and targets resolve
from project-level definitions.

Server: add NewProject constructor, IsProjectMode/configPath/saveConfig/
reloadConfig helpers, branch all handlers for project mode.

Frontend: AppContext propagates isProjectMode, Layout filters nav items,
Git/Backup pages show unavailable message, Config/Dashboard adapt.

Extract ReconcileProjectSkills to internal/config for reuse by both CLI
and server. Add unit tests and integration tests for project UI.

Update docs, README, and Docker playground with project mode demo project
and skillshare-ui-p alias.
2026-02-08 17:15:59 +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