mirror of
https://github.com/runkids/skillshare.git
synced 2026-11-18 18:04:17 +00:00
main
30
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
5b249b60fe |
refactor(sync): share one orphan-link rule between prune and the dashboard (#937)
The Sync page predicted which orphan links sync would remove with its own copy of prune's rule. The copy had already drifted once (#914), and it still disagreed in two cases: prune treats a link it cannot follow, such as a loop, as broken, while the page only counted a missing destination; and prune keeps a link whose target it cannot read. The decision now lives in sync.OrphanLink. Prune and the dashboard diff both call it, so a later change to the rule reaches both. Prune's results, warnings and dry-run text are unchanged. LinksIntoSource, added for the dashboard's copy, is no longer needed and is removed. |
||
|
|
1419b62499 |
fix(sync): never delete or re-point entries skillshare did not create (#914)
* fix(sync): never delete or re-point entries skillshare did not create On Windows, a plain `init` followed by `sync` deleted things in ~/.claude/skills that skillshare never created, with no backup and no prompt. It also re-pointed another tool's junction. Seen in a sandbox run of v0.30.7: - prune removed real folders whose names only look like skillshare's flat naming (team__shared, _drafts), via the name heuristic - prune removed a broken link that another tool or the user made - merge sync deleted and re-created a same-name link that pointed into another manager's store - init's import deleted original folders that matched the source byte for byte The manifest already records what skillshare made, so use it: - prune keeps a look-alike folder that is not in the manifest and warns once per sync; --force still removes it - prune removes a broken external link only if the manifest records it (e.g. after the source moved); otherwise it keeps the link and warns - merge sync re-points a link only if the manifest records it or it already points into the source; otherwise it reports the entry as kept local, as it already does for a real folder; --force replaces it - init's import moves identical copies to the trash under replaced-by-init/<target>/ instead of deleting them Tests: ownership_test.go adds regression tests that use createLink, so they run on Windows without Developer Mode (junctions). The 4 keep tests fail without this change. TestSyncTargetMerge_FixesBrokenLink now records the link in the manifest first, since a same-name link that skillshare did not make is no longer re-pointed. Existing tests in internal/sync, internal/trash and cmd/skillshare show the same failures on a Windows host with and without the change (symlink privilege). The devcontainer suite has not been run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: say what sync and init keep when skillshare did not create it The previous commit makes sync and init leave alone entries skillshare did not create. Update the pages that describe that behaviour: - sync-modes: merge mode keeps a same-name link from another tool and reports it as local; orphan cleanup keeps folders that only look like skillshare's flat names, and broken links outside the source that the manifest does not record. sync --force still removes them. - init: identical folders replaced with links during the first sync go to the trash first (replaced-by-init/<tool>/, cleaned after 7 days). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(sourcefs): drop the raw-write allowance replaceIdenticalCopies no longer needs replaceIdenticalCopies now moves an identical copy to the trash instead of calling os.RemoveAll, so TestRawWriteRatchet reports its allowance as stale. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(sync): apply the ownership rule at every consumer Review of the first commit found places that still did, or predicted, the old behaviour. One rule now decides whether a link is skillshare's: Manifest.OwnsLink (the manifest records a link there, or it points into the source). It compares canonical paths, so a source reached through an alias and a relative project link still count as skillshare's. - copy mode kept re-pointing: it removed any same-name link and wrote a copy. It now keeps a link it does not own, like merge mode. - the dashboard diff predicted a prune for a folder that is only named like skillshare's, and an update for another tool's link. It now reports them as local and kept. The orphan-link prediction uses the same rule as prune. - `diff` reported a target as in sync while sync printed "kept local" for another tool's link. It lists the link as a local override. - doctor reported a broken link skillshare did not create as an error and suggested `skillshare sync`, which now keeps it. It is a warning with its own row, and `broken_symlinks` is `warning` in --json. - `trash restore` put a folder init had replaced into the source as a new nested skill. Restore refuses entries under replaced-by-init/ and names the trash folder to copy from. - init reported a folder it could not move to the trash as one that differs from the source, and dropped the error. It is reported separately, with the error. - the PruneOptions.ManagedOnly comment still said broken external links are skipped; manifest-recorded ones are removed. Tests cover the states the review listed: a source behind an alias, a relative project link, ManagedOnly, standard naming, dry run with --force, and a recorded copy the user replaced with a link. TestSync_Pruning_RemovesBrokenExternalSymlinks passed without testing anything, because FileExists follows links; it is now two tests that use Lstat, one per owner. Agent merge is unchanged: agents have no link manifest. * fix(diff): list another tool's link as kept in copy mode too Copy mode now keeps a same-name link skillshare did not create, but both diffs read the entry with os.Stat. A broken link showed as a skill to add on every run, and a live one as a plain local copy, while sync kept both and said "kept local". `diff` and the dashboard diff check the link first and report it the way merge mode does: a local override, kept until --force. * test(sync): make the aliased-source link while its folder exists TestSyncMergeRepointsUnrecordedLinkIntoAliasedSource failed on Windows: it linked straight to a missing folder, and a junction cannot be made to one. It now links first and removes the folder after, like the other broken-link tests in this file. * fix(sync): compare a broken link by where it would point linksIntoSource resolved both paths with EvalSymlinks, which gives up on a path that does not exist. A broken link is exactly that, so a link into a source reached through an alias (a symlinked config folder, or a short 8.3 path on Windows) compared an unresolved path with a resolved one and was taken for another tool's link. Sync then kept it instead of repairing or pruning it. It now uses sourcewalk.Canonical, which resolves the nearest folder that exists and keeps the missing tail. The test covers both spellings: the alias in the link, and the alias in the configured source. * fix(init): report what the first sync kept, and match prune in the diff Two previews said less, or more, than sync does. init ran its first sync quietly and printed only "Synced". Sync now keeps a link another tool put on a skill's name, a folder that is only named like skillshare's, and a broken link it did not create, so the skill was reported as synced while the tool still loaded the other copy. firstSync returns the warnings a plain sync prints, and init shows them. They already name the folders that differ from the source, so the separate list of those is gone. The dashboard diff counted an orphan link as a removal whenever the manifest recorded it. Prune keeps a recorded link that still resolves outside the source (the source moved and the old checkout stayed), so the Sync page showed a removal that never happened. The diff now uses prune's own rule: a link into the source goes when broken or recorded; any other link only when broken and recorded. --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Willie <egg358358@gmail.com> |
||
|
|
85bcf589a7 |
feat(sync): recognize and route agent-specific skill variants (#649)
* docs(proposals): propose agent-specific skill variants Tracked repositories can ship different files for the same skill across agents. Counting and syncing each copy independently sends incompatible instructions to every target unless users maintain routing filters. Propose repository-scoped logical identity and exact variant routing while preserving source files, explicit controls, and existing naming behavior. Leave activation and compatibility decisions for maintainer review. Refs #648 * docs(proposals): clarify variant routing compatibility Explain how recognition affects universal-only targets and how existing per-variant overrides preserve the desired routing. Fix the precedence between variant identity and generic host-style path inference. Include analyze, move, and catalog consumers while preserving physical identifiers and actual context-cost accounting. Refs #648 * docs(proposals): clarify activation assumptions and scope Make acceptance cases conditional on maintainer-approved recognition being enabled for the tracked source. Separate the provisional implementation estimate from this proposal-only PR so its size is clear. Refs #648 * docs(proposals): qualify naming and opt-in assumptions State that the reproduced routing behavior uses default flat target naming. Leave any opt-in surface with the maintainer's activation decision without ruling out future CLI or config fields. Refs #648 * feat: recognize and route tracked agent skill variants Count tracked variants as logical skills in source and repository summaries, while preserving physical paths, sync operations, and context costs. Select matching canonical agent variants, including account targets, through shared discovery and selection with existing explicit routing precedence. Refs #648 * fix: count logical skills in sync inventory summaries Use shared logical and physical inventory counts in global and project sync closing lines while preserving each target's operation totals. Refs #648 * fix: preserve variant routing diagnostics across previews Resolve target selections once so CLI and server previews keep ambiguity reasons and physical skip counts. Explain managed variants removed by automatic agent routing, and report logical inventory in doctor. Keep warning rows read-only, document upgrade recovery in translated filtering references, and remove the optional README-only addition. Refs #648 * fix: align sync matrix previews with shared variant selection Classify the full source selection once per target so matrix previews honor canonical aliases, account identity, exact-agent routing, and ambiguous variant skips. Preserve each rejected physical path's existing diagnostic and draft filter disambiguation; skipped preview rows remain read-only. Refs #648 * test: expect singular skill wording in doctor source checks Keep the undiscovered-link count assertion aligned with logical source inventory formatting for one skill in global and project mode. Refs #648 * fix: retain selection diagnostics in catalog and diff verdicts Report warning-only diff targets as requiring attention while preserving local-only folder semantics. Reuse shared per-path selection diagnostics in target-scoped catalogs without applying target naming to served paths. Compute source counts once in summary callers and require variant counts in the source status formatter. Refs #648 * test: tighten tracked variant preview fixtures Use a real committed tracked repository for status counts, verify sync preview banners retain server warnings, and use emitted ambiguity reason text in target preview fixtures. Refs #648 * fix(sync): keep agent variants in shared target folders Compatible targets sharing a skills folder need a combined selection so Codex and universal do not prune one another in merge or copy mode. Carry every shared reader through selection, pruning and previews, including project targets, account identities and path aliases. Require a matching skill suffix under two distinct agents before inferring variants, keeping ordinary agent-named categories unrestricted. Separate naming warnings from ambiguous selection in diff and explain ambiguous removals. Add global/project regression coverage for repeated sync, target-only sync, status JSON, diff and API consumers. * fix(variants): align consumer counts, hints and diagnostics Use logical source counts in list, tracked install and init summaries while matching audit caches against physical variants. Restore localized dashboard skip hints and explain symlink routing limits in status and doctor, including project and JSON output. Document paired-agent detection and compatible shared-folder selection in the proposal, built-in skill and English plus translated command pages. Add focused regressions for the affected consumers. * fix(sync): cover initial sync and ignored variant diagnostics Init syncs a fresh in-memory config, so resolve shared target identities before its first sync as well as when loading saved configuration. A whole-directory symlink exposes ignored skills too. Diagnose agent variants using physical inventory when active discovery has none, while keeping logical counts and merge/copy selection restricted to enabled skills. Cover global/project JSON status and doctor with regressions. Reuse sourcewalk directory and canonical-path helpers so traversal guards remain enforced and path resolution has a single existing owner. * fix(variants): address conversion, counts and selection diagnostics Ignore runtime agent identities when comparing convertible project targets and count logical skills during init. Keep selection warnings separate from naming warnings and preserve agent-named parent skills as ordinary skills. Cover account sync/prune, project ambiguity and overrides in merge/copy modes, and init/status agreement. Focused verification ran in an isolated Linux Codex container, not the devcontainer, as authorized. * refactor(variants): remove obsolete selection helpers Remove the unused FilterSkillsByTarget wrapper and prune agent parameter, cache canonical target aliases once, and restore catalog skip ordering to avoid an unrelated behavior change. Completes the optional cleanup from PR 649 review. * fix(ui): expose localized variant selection diagnostics Show target warnings with source paths, localize ambiguity across preview and detail consumers, and let skipped preview rows add a physical exclude pattern. Show tracked repository variant counts alongside logical skills. Drop display-only rendered cases while retaining mutation protection and plain TypeScript logic coverage. Inspect target states in Clean/Playful light/dark and Traditional Chinese. * docs(variants): explain diagnostics and add sync runbook Document doctor variant_routing and logical/physical counts, diff selection skips, and the nested parent-skill boundary. Keep all four command translations aligned and add isolated account/project E2E scenarios. Both runbook steps passed in the authorized Linux Codex container with separate HOME/XDG/TMPDIR fixtures. Website typecheck and all five locale builds passed. * test(config): use native paths in project conversion fixture The shared-agent regression fixture appended slash-separated suffixes to Windows temporary paths, so project path matching returned no candidates. Build each path with filepath.Join and preserve all conversion assertions. Focused project configuration tests passed in the authorized isolated Linux Codex container, not the devcontainer. Windows CI verifies the platform-specific fixture correction. * fix(ui): recompute shared skill routing for filter previews Evaluate edited include/exclude settings in the complete target map before classifying the draft, so a formerly shared folder no longer keeps its old union when the filters differ. Preserve the saved target configuration. * fix(mcp): keep parent skills when peer variants route elsewhere Do not treat an otherwise eligible variant for another agent as an unserved nested skill. Continue blocking parent publication for explicitly filtered, disabled, ambiguous, or invalid children so filters still hide their files. * fix(ui): distinguish agent selection from naming skips Expose separate naming and selection skip counts on target summaries. Show each applicable remedy in target details and sync previews so ambiguity keeps its filter/override guidance alongside naming and collision hints. * fix(list): include disabled rows in tracked repository counts Count the complete inventory that list displays, including ignored skills and physical variants, without changing the enabled counts used by status, install, or sync. Clone rows before counting to preserve disabled state. * docs: align variant counts and routing recovery guidance Show logical skill and physical variant counts in list/install documentation and keep the four translations aligned with the filtering examples. Explain that agent-named skill parents keep ordinary nested skills and retain the devcontainer-only runbook environment. Removal warnings now recommend a source-local override, since include filters cannot undo agent routing. * fix(mcp): preserve explicit target restrictions on nested variants Limit the differently routed child exemption to automatic layout inference. Frontmatter targets and dashboard source-local overrides must still prevent a parent from publishing files explicitly restricted to another target. * fix(ui): fill target name in naming warning guidance Pass the current target name when rendering localized warning hints so the same naming guidance shown beside the controls does not expose a placeholder in the warning banner. Verified in the populated target preview. --------- Co-authored-by: Willie <egg358358@gmail.com> |
||
|
|
111dd71a53 |
fix(sync): let prefixed naming keep skills whose name differs from their folder (#531)
Prefixed naming rewrites name: in every copy to the entry name, so the target folder and name: always agree. Requiring name: to equal the source folder only skipped skills it could sync: a tracked repo that is itself a skill lives in _<repo>, so its root SKILL.md could never pass. Only standard naming now requires the match; name format rules still apply to both. Sync lists the skills named this way, so a user looking for _ooux in the target finds ooux. The dashboard's skipped-skills hint always blamed folders that end in the same name, even when skills were skipped for their name. The diff API now reports naming skips apart from collisions and the hint names the cause. Refs #530 |
||
|
|
c638b46096 |
fix(sync): replace copy-mode copies with links when switching back to merge (#506)
* fix(sync): replace copy-mode copies with links when switching back to merge Switching a target from copy back to merge left every copy whose entry name did not change as a real folder. Merge sync treated it as the user's own folder, so status and doctor kept saying "run skillshare sync" while sync changed nothing, and only `sync --force` turned it into a link. Copy mode already replaces merge-mode links with copies on its own, so merge sync now replaces a folder the manifest records with a checksum (a copy-mode copy) with a link, without --force. Folders the manifest does not record, or records as a link, stay untouched. The pre-sync target backup is unchanged. The CLI and dashboard diffs name these entries as copies sync replaces instead of suggesting --force, and the sync-modes docs describe the switch. * fix(sync): keep copy-mode copies the user edited when switching to merge The first version replaced any folder the manifest recorded as a copy-mode copy. The manifest checksum is only a record, so a copy edited since copy mode made it was deleted too, and `sync --json` and project-mode dashboard sync take no pre-sync backup to restore it from. Replace the folder only while it still hashes to the recorded checksum (Manifest.OwnsCopy). An edited copy is kept and `sync --force` still replaces it; diff keeps suggesting --force for it. A copy whose name: was rewritten by prefixed naming, or that was made with custom ignore patterns, no longer hashes to the source checksum and is kept the same way. * fix(ui): say a copy-mode copy in a merge target is replaced by a link The Sync page picks a row's text from the diff item's action alone. The copy-mode copy that merge sync now replaces comes from the server as an update, which the page worded as "Link is broken or points elsewhere. Will be relinked" even though no link exists yet. Match the server's reason and show "Copy made by copy mode. Will be replaced by a link" instead, in all eleven dashboard languages. * docs(sync): say only unedited copy-mode copies are replaced on merge sync The sync-modes paragraph promised that copies copy mode made are replaced with links without --force. Merge sync keeps a copy that no longer hashes to the checksum copy mode recorded, so an edited copy, or one whose name: copy mode rewrote for prefixed naming, still needs --force. State the three cases in sync-modes and qualify the diff Modified and Local override labels, in English and the ja, ko, zh-Hans and zh-Hant copies. * fix(sync): keep the copy until its replacement link exists Replacing a copy-mode copy removed the folder first and then created the link. If creating the link failed (no symlink or junction rights on a Windows or network filesystem), sync returned an error with the skill gone from the target. This path now also runs on a plain sync, not only on --force. Park the folder beside the entry, create the link, then delete the parked folder; on failure the folder is moved back. A parked folder left by a run that died mid-way may be the only copy, so the next sync stops with a message instead of deleting it. The manifest also forgets the copy-mode mtime and naming records of an entry that is now a link. * test(sourcefs): register replaceWithLink's target writes in the raw-write ratchet The previous commit moved the merge-mode folder replacement into replaceWithLink, which the ratchet reports as new raw os calls and the old os.RemoveAll allowance as stale. All of them act on the sync target, not the skills source, like the neighbouring entries. * fix(sync): bound the parked copy's name and document the naming exception The folder parked while a link is created was named after the entry, so an entry near the 255-byte filename limit (a long flattened nested skill) could not be moved aside and its replacement failed. The parked name is now a fixed-length hash of the entry name. sync-modes also says what happens when `target_naming` changes in the same sync: the copy gets a new entry name and the prune pass removes it as an orphan whether or not it was edited, as it did before this change. |
||
|
|
ec2a8ab3aa |
fix(sync): close gaps found while simulating the prefixed naming switch (#504)
* fix(sync): close gaps found while simulating the prefixed naming switch Simulating the #497 reporter's switch from merge + flat to copy + prefixed turned up four problems: - `target X --mode copy --target-naming prefixed` applied only --mode, since the setter dispatch returned after the first flag. Both flags given together now check the final pair, then apply in an order that keeps the saved pair valid (copy mode first, any other mode last). - Skipped skills were only counted, so a prefixed name over 64 characters vanished with "1 skill(s) skipped". Sync now names the first five with their reason; the cap keeps huge sources from flooding the output. - In copy mode a merge-mode link to the skill was not a managed entry, so when a local folder held the new name the old link was pruned and the skill left the target, contrary to the documented "old managed entry is preserved". Copy mode now migrates such links like managed copies. - PATCH /api/targets validated the mode/naming pair against the current skills state, so disabling skills while changing mode was rejected. It now checks the state the request leaves the target in. * docs(target): drop stray space in the Japanese mode+naming sentence * fix(diff): save paired target settings once and report kept legacy entries - `target X --mode M --target-naming N` ran the two setters, each saving the config, so a failed second save left half the change behind (Codex on #504). Both fields are now set and saved once, after the final pair is checked. - When a local folder holds the name a skill's naming now gives it, sync keeps the skill under its old entry and leaves the folder alone, even with --force. diff still called the folder a "local copy" and suggested `sync --force`, which does nothing for it. CLI and Web API diff, copy and merge mode, now report the folder and the entry the skill stays at. * fix(sync): migrate only links the manifest records as merge-made Copy mode treated any link to the skill's source at an old naming's name as the entry merge mode left behind, so a user's own link was renamed and replaced with a copy (Codex on #504). A link now migrates only when the manifest records it as "symlink", which merge mode writes for links it makes; other links stay as the user left them. The value is now a named constant. * fix(diff): mark kept legacy entries as unaffected by force Two problems Codex found on #504: - The Web API diff sent a local folder on a skill's new name as a "skip", which the dashboard shows as an edited entry that Force replaces. Sync keeps that folder and the legacy entry even with force, so the preview promised a change that never happens. It is now its own "kept" action, shown with its reason and not counted. - `target X --mode M --target-naming N` printed the target's own naming as the old value, so a target inheriting standard or prefixed showed "flat -> ...". It now prints the naming the target had in effect. * fix(diff): keep kept-name conflicts out of the sync count Two problems Codex found on #504: - A local folder on a skill's new name counted toward "N to sync" and fell through to the plain `skillshare sync` hint, though sync changes nothing there until the folder is renamed or removed. Such rows now carry a kept flag, count as neither sync nor local, and print their own hint; a target whose only row is kept still shows that row. - The dashboard grouped targets by row name and icon only, so two targets keeping the same skill at different old entries merged and showed one target's old location for both. The row detail is now part of the key. * fix(diff): do not list a kept local folder's files as deletions A kept row (a local folder on a skill's new name) still pointed at that folder, so `diff --stat` and `--patch` listed each of its files as removed, though sync never touches the folder (Codex on #504). Kept rows no longer point at a target directory, so no file-level diff is built for them in the CLI or the TUI. * fix(diff): report kept skills consistently in every diff view An exhaustive review of the kept-row change (prompted by two Codex findings on #504) found the same gap in several places: - A target whose only rows were kept was summarized as "in sync", and mixed summaries left it out of every count. Such targets now count as "N kept under old name" with a warning mark, and the scan progress counts them. - Plain output and the TUI hid where the skill stays; rows now read "name (stays at old-name)". The TUI also lacked the kept Next hint and called kept-only targets "differs"; it now matches the plain output. - `diff --json` emitted kept rows as "remove", indistinguishable from local-only folders; it now emits "kept", as the Web API does. The diff docs' JSON example also showed actions the CLI never emits. - Renamed rows whose old entry is a merge-made link showed a bogus file stat, because the link was walked as a file; a link now stands for the folder it points to. - A dry-run migration printed "Would copy" to the old path; it now names the new one. * fix(sync): stop reporting kept folders and skipped skills as pending work (#509) Three reports told users to do something sync cannot do, or hid what it did: - Copy and merge sync kept a folder the user made on a skill's name but counted it as "up to date" with no hint. Sync now counts it as local and adds one capped line per target naming the folders and saying that `sync --force` replaces them. The line is added in SyncSkillTarget, so the dashboard gets it too. - status and doctor counted skills that sync skips on purpose (invalid names under standard or prefixed naming, name collisions) as "not synced — run skillshare sync". Running sync can never add them, so the advice looped. They now compare against the skills sync places. - diff marked a target whose only items were local-only folders as "to sync" and `synced: false`. Those items are still listed, but they no longer make the target pending. * fix(target): apply every setting flag, require flag values, report no-ops as unchanged (#507) * fix(target): apply every setting flag, require flag values, report no-ops as unchanged `skillshare target <name>` dispatched --mode, --agent-mode and --target-naming through an if-chain that returned after the first match, so `--agent-mode copy --target-naming prefixed` applied one setting and silently dropped the other. Filters, --skills and --dry-run had the same early-return problem. - Check --mode, --agent-mode and --target-naming as a whole and save once, in global and project mode (one targetSettingsUpdate replaces six per-flag functions). - Reject --mode/--agent-mode/--target-naming combined with filters or --skills, and --dry-run without --skills, instead of dropping them. - A value flag followed by another flag (or an empty string) now reports "<flag> requires a value"; `--target-naming -p` used to report an invalid naming '-p'. - A value the target already has is reported as unchanged and the config is not rewritten. * fix(target): leave the skills pair alone on agents-only changes A target with skills off may keep target_naming prefixed with a merge mode it cannot sync; validateGlobalTarget and validateProjectTarget only check that pair for enabled skills. The combined settings update ran the pair check for every setting, so `target claude --agent-mode copy` was refused on such a target although the old agent-mode handler never looked at skills settings. Check the pair only when --mode or --target-naming is given. * docs(target): show combined settings in --help and the built-in skill The combined --mode/--agent-mode/--target-naming form is now the way to move a target to copy + prefixed in one step, but neither the help examples nor the built-in skill's target reference showed it. |
||
|
|
2ff8bdeb59 |
fix(diff): report a copy recorded under another naming as modified
Sync re-copies a managed copy whose recorded naming differs from the current one, for example after a migration stopped between the rename and the re-copy. Diff skipped it on the mtime fast path and reported the target in sync while its SKILL.md kept the old name. Check the recorded naming first in both the CLI and the dashboard diff. |
||
|
|
0477f1e837 |
fix(diff): report a target naming migration as a rename
After target_naming changes, sync renames the managed entry in place, but diff looked only under the new name, so the CLI and the dashboard showed the skill as new while hiding the old entry. Resolve the legacy entry and report it as a rename instead. |
||
|
|
35f3bb0e28 |
feat(sync): add target_naming: prefixed for copy-mode targets
Two tracked repos that ship a skill with the same name cannot both reach a tool today: standard drops both, flat keeps both folders but tools list skills by name:. Prefixed gives a skill inside a tracked repo the folder and name: <repo>-<name> in the copy, so both stay usable and the name shows where the skill came from. It is copy-only because a merge symlink points at the source, where name: must not change; config validation rejects it elsewhere, per target, like extension does. Switching naming used to know only the flat name as the old one, so standard <-> prefixed would orphan entries. The migration now checks the skill's name under every naming, and the copy manifest records the naming that produced each entry: a switch finds the exact old entry, and a renamed copy is re-copied so its name: matches even when the source is unchanged. Manifests without the record fall back to flat, standard, prefixed in turn. A rename is written to the manifest at once, so a later failure cannot leave the renamed folder looking user-owned. |
||
|
|
5e02ef7ef0 |
refactor(sync): select a target's skills through SelectTargetSkills
Status, doctor, diff, the dashboard's target and diff handlers and analyze each repeated FilterSkills followed by FilterSkillsByTarget, and only some dropped disabled skills first. Routing them through SelectTargetSkills keeps their answers identical to sync and mcp serve when a selection rule changes. The callers that did not drop disabled skills get discoveries without them, so their output does not change. |
||
|
|
89fc4fbdf1 |
feat(sourcewalk): follow first-level source links when enabled
Users link a checkout directly under the skills source (e.g. skills/_dev-skills -> ~/code/dev-skills) and expect it to behave like any other first-level entry. sourcewalk resolved only the root, so these links were invisible to discovery, sync, update, and the dashboard. follow_source_links (global and project config, default false) enables a per-operation sourcewalk.Follow policy. Walk, WalkDir, and ReadDir report a followed link under its own name as a directory and descend into its target, so names, RelPath, FlatName, SourcePath, tracked-repo detection, and metadata keys stay logical. Only entries directly under the source root are followed. The policy is built from config and passed explicitly to every discovery caller in the CLI, server, and reconcile, so counts agree; the server keeps a per-instance snapshot refreshed on config load and save instead of a process-global flag. A link is skipped, with one warning per operation, when its target is missing or unreadable, is the source or a parent of it, or overlaps an active skills target. A missing or unreadable target marks the operation incomplete: sync then skips pruning and copy-orphan deletion, and reconcile keeps metadata, so an unmounted drive or a re-clone in progress cannot erase target entries or install records. A link to an existing file is not a directory link and stays an ordinary entry; treating it as incomplete would disable pruning for anyone sharing a file such as .skillignore. doctor keeps raw link identity: with the key off it still says the link is not followed and names follow_source_links: true; with it on it reports followed links and skipped links with the reason. The raw-walk allowlist gains entries for the policy path in Walk and WalkDir: the source root walk with a policy, and the walk of a validated link target whose paths are remapped to the logical link path. Both live in sourcewalk itself, the package that owns source traversal. Refs #274 |
||
|
|
46b23cd2ad |
feat(targets): let a target keep its instructions with skills switched off
Some tools only need skillshare for AGENTS.md, MCP or agents, while their skills folder is managed elsewhere or shared through another target. Syncing skills into those folders duplicated what the tool already reads, so a target can now turn skills off (`target <name> --no-skills`, the dashboard switch) and sync, diff, status and doctor skip its skills. Switching off warns about the other tools that read the same folder. The target list also gains tools that were missing, with colored vendor logos where their licenses allow it, and zencoder/replit default paths follow their current documentation. The dashboard's target pages get the matching UI: universal is pinned as the shared folder when adding a target, the add dialog lists what will be written, and the AGENTS.md tab shows where the file comes from in one card with an in-place switch between shared files. |
||
|
|
45854c5b57 |
fix(sync): count manifest-managed hidden entries in target scans
Flat target naming turns a source skill under a dot directory (e.g. .system/example) into a hidden target entry (.system__example). Target scans skipped every hidden name, so diff, doctor, status and the dashboard reported these synced skills as missing, and prune never removed them after the source skill was deleted. Hidden entries are now skipped only when the target manifest does not record them as managed, so files like .skillshare-manifest.json or .DS_Store are still ignored. Refs #294 |
||
|
|
3743a1ef3f |
fix(sync): honor file ignore patterns in copy mode
Apply config ignore patterns to copy-mode file traversal, checksum, mtime, CLI diff, and server sync/diff paths. Add default ignores for .DS_Store, .git, and __pycache__ in global and project init configs. Tests: go test ./... -count=1 |
||
|
|
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. |
||
|
|
3c4d057950 |
refactor(ui): centralize display name formatting via resourceNames utilities
Replace 25+ inline .replace(/__/g, '/') calls with shared utilities: - formatSkillDisplayName() for flat name → path conversion - formatTrackedRepoName() for tracked repo name display (strip _ + unflatten) - formatAgentDisplayName() for agent names (.md removal + unflatten) Consolidate error toasts into single summary in DashboardPage update-all. Remove duplicate displayPath() in BatchUninstallPage (was reimplementing formatSkillDisplayName). Backend: refactor agentIgnorePayload to accept pre-discovered agents, eliminating duplicate filesystem traversal in sync/diff handlers. |
||
|
|
92d5fc66ba |
fix(agents): exclude convention files and respect agents/ subdir in tracked repos
Agent discovery was treating non-agent files (CLAUDE.md, AGENTS.md, etc.) as agent resources when they appeared in tracked repos. Two fixes: - Expand ConventionalExcludes with 7 well-known convention filenames (CLAUDE.md, AGENTS.md, GEMINI.md, COPILOT.md, CONTRIBUTING.md, CODE_OF_CONDUCT.md, SUPPORT.md) - For tracked repos with an agents/ subdirectory, only discover files inside agents/ — skip repo root files and other subdirs (docs/, etc.) Also includes UI polish: - Display flat names (__ separator) as path separators in toasts/labels - Consolidate batch install errors into single toast - Show .agentignore state in sync diff/preview responses - Track badge + friendly repo name in resource list/folder tree |
||
|
|
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 |
||
|
|
a73d55dc26 |
refactor: extract agent helpers and simplify duplicated patterns
- Extract agent_helpers.go: kind constants, discoverActiveAgents(), resolveAgentPath(), builtinAgentTargets(), mergeAgentDiffItems() - Replace 3 inline agent path resolution blocks with resolveAgentPath() - Replace 3 inline agent discovery blocks with discoverActiveAgents() - Replace 2 inline diff merge blocks with mergeAgentDiffItems() - Fix handleSync prune triple-scan: capture index from merge pass - Frontend: replace 10 filter() calls with single useMemo reduce pass - Use kind constants instead of raw strings across all server files |
||
|
|
568d2b7f64 |
fix: address code review findings
- Fix data race: read agentsSource inside RLock in handleDiffStream - Validate kind param in handleSync (reject invalid values) - Add test for symlink-points-elsewhere agent diff case - Always show KindBadge on DiffItemRow (default to 'skill') |
||
|
|
55e2e0e5b3 |
feat(server): include agent diffs in handleDiff and handleDiffStream
- Discover agents from agentsSource() and compute per-target diffs - Merge agent diff items into existing target results - Set Kind='skill' on all existing skill diff items - Set Kind='agent' on all agent diff items - Targets without agentPath are skipped (matches CLI behavior) |
||
|
|
6f70e76758 |
fix(sync): accurate expectedSkillCount and surface skipped skills
Problem: Sync page showed 'in sync' but Targets page showed 39032/64075 — ~25000 skills silently dropped by name collisions and SKILL.md validation in standard naming mode. Root cause: expectedSkillCount used raw filtered count (pre-resolution) while diff used post-resolution count. The gap was invisible. Fix: 1. handler_targets.go: expectedSkillCount now uses resolution.Skills count (post-collision/validation), matching what sync actually does 2. handler_diff_stream.go: surfaces skippedCount and collisionCount in diff response so UI can explain why skills were dropped 3. handler_sync.go: diffTarget struct gains SkippedCount/CollisionCount 4. TargetsPage: shows warning when skills are skipped with collision count 5. SyncPage: shows naming conflict notice in 'in sync' cards 6. API client: Target and DiffTarget types gain optional fields |
||
|
|
ccdafd3293 |
feat(sync): add target_naming config option (flat/standard)
Add per-target target_naming setting that controls how skill directories are named in sync targets. 'flat' (default) preserves the existing flattened __ separator behavior. 'standard' uses the SKILL.md name field directly, following the Agent Skills specification. Standard mode: - Validates SKILL.md names match directory basenames - Detects and skips name collisions with warnings - Auto-migrates managed entries when switching from flat to standard - Preserves legacy entries when bare name is already occupied Also includes: - Per-target toggle via CLI (--target-naming), TUI (N key), and Web UI - Collision output redesigned as deduplicated compact summary - Config inheritance: global target_naming → per-target override - JSON schema + UI validation for the new field Closes #110 |
||
|
|
1016a155db |
fix(diff): filter out skills with SKILL.md targets mismatch
diff (CLI, TUI, Web UI) now applies FilterSkillsByTarget before computing differences, matching the behavior of sync/status/doctor. Previously, skills with unsupported targets values (e.g. targets: ["*"]) appeared as false 'source only' pending items that sync could never resolve. |
||
|
|
41dd81b7f2 |
refactor: migrate all callers to SkillsConfig() / EnsureSkills()
44 files across CLI commands, sync engine, and server handlers now use SkillsConfig() for reads and EnsureSkills() for writes instead of accessing flat TargetConfig fields directly. Key changes: - sync engine (SyncTargetMerge/Copy/Symlink): reads sc := target.SkillsConfig() - target commands: filter add/remove and mode set use EnsureSkills() - target TUI: mode picker, filter ops, detail panel all via SkillsConfig() - server handlers: backup, restore, targets, sync, diff, collect, analyze - init/init_project: new target creation uses Skills sub-key - doctor, status, diff: target display reads from SkillsConfig() - computeTargetDiff: accepts config.TargetConfig directly (was anon struct) |
||
|
|
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 |
||
|
|
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. |
||
|
|
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. |
||
|
|
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 |
||
|
|
344b067806 |
feat(ui): add SSE streaming for update, check, and diff pages
Replace sequential POST loops and blocking useQuery calls with Server-Sent Events for real-time progress feedback on Update, Check, and Diff operations. Extract shared helpers to reduce duplication: - initSSE() in middleware.go consolidates SSE preamble across 4 handlers - createSSEStream() in client.ts unifies EventSource lifecycle management - StreamProgressBar component replaces 3 near-identical progress bars - handleDiff now delegates to computeTargetDiff (eliminates ~150 lines) - Paginate audit results (20 cards + 10 findings per card) to prevent DOM overload with large skill counts |