extractGitFatal kept only git's "fatal:" line, so SSH clone/fetch failures
(install from git@host:..., hub indexes over SSH, updates) reported just
"Could not read from remote repository." and dropped the ssh line that says
why: publickey denied, host key verification, unresolved hostname, or a
refused/timed-out connection.
For that generic message, append the preceding transport line (skipping
"Cloning into" and warning chatter). When the reason is a publickey denial,
WrapGitError adds an "ssh -T user@host" hint. Other errors are unchanged.
Previewing a hub from the builder landed on an empty "pick a hub" state:
the builder and the browser kept separate copies of the drafts and the
browser's copy went stale. Merging both into one page removes the split,
so your own hub is shown exactly as others will see it and edited in place.
Hub entries can now be added from any repository URL, not only from
installed skills, with a branch or tag picked from the remote. The version
is written into the source URL, the only place the hub format keeps it,
and a new /api/hub/refs endpoint lists refs and rewrites sources so the UI
never builds tree/<ref> URLs itself. Skills added from installed ones keep
the version they were installed from.
Draft reads and saves read refs from the URLs only, so opening a hub never
waits on a remote. Added hubs get unique labels, since the default hub is
stored by label.
Installing from config set the branch only when one was recorded, so a
legacy entry with a tree/<tag>/... source and no branch was pinned to
that tag, while update kept it on the default branch. Use
ApplyRecordedBranch like the update paths do. Settling the ref up front
also lets web URL entries from one repo share a single clone again.
Refs #293
GitHub links to tree/HEAD/... when it means the default branch. Since
URL refs became clone refs, HEAD was taken as a branch name: with a
subdir the ref lookup failed, without one git clone --branch HEAD
failed. These URLs installed fine before, so keep them on the default
branch.
Refs #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>
Since Go 1.23, os.Lstat reports NTFS junctions as irregular files instead
of symlinks (winsymlink, active for go 1.25 in go.mod). Every check that
looked only at os.ModeSymlink therefore missed the junctions skillshare
itself creates on Windows: linked skills could be treated as local folders,
backed up, copied through, or left behind on prune.
Detect links through utils.IsLinkMode, which also asks the OS about the
reparse tag of irregular entries, and count only real symlinks and
junctions as links so OneDrive placeholders and deduplicated files stay
regular files. restore.go also used os.Stat for its link check, which
follows the link and never matched.
Refs #299
Every API request reloads the skills and agents metadata stores and
swaps the server's pointers under s.mu, but several handlers read or
wrote the stores outside that lock: listing, skill detail, check, the
update stream, and the hash refresh after setting targets. Concurrent
requests could race on the pointer or on the stores' maps, which the
race detector reported hundreds of times under load and which can
crash the server with a concurrent map access.
Store access now always happens under s.mu. Reads return a copy of
the entry so it can be used after unlocking, and target handlers hash
files outside the lock and only write the result under it.
Setting targets on a skill inside a tracked repo used to be refused,
because writing its SKILL.md leaves the clone dirty and `update` then
skips the repo (or `--force` throws the setting away).
Store those targets in the source's .metadata.json instead, keyed by
the skill's path, and apply them at discovery over the frontmatter.
The clone stays clean, `update` keeps working, and the setting survives
it. Uninstalling a repo or skill drops its entries.
Overrides are saved in the same lock section that writes them: every
API request reloads the store from disk, so saving after unlocking
could lose them, and saving outside the lock raced with other writers.
Refs #295
Two machines sharing a source repo kept stopping at the same two places.
The Git page had no way to know the remote moved until a push bounced, so
it now fetches once on open and labels Pull with the commit count (status
itself stays offline because the sidebar polls it). And both machines
rewrite .metadata.json on every install or update, so nearly every
diverged pull conflicted there; those conflicts are now merged per entry,
keeping the later installed_at, while any other conflict still stops the
pull and names the files.
Tools disagree on agent frontmatter and some need another format entirely,
so an agent written for Claude is misread elsewhere. An `extension` on a
target's agents block reuses the extras transform mechanism to convert each
agent during sync.
Converted targets hold transformed output, so collect never pulls them back
into the source. Leftover symlinks from merge or symlink mode are removed
rather than written through, and a failed conversion drops the old output
so an unconverted agent never stays active.
The bundled opencode-agents extension keeps only fields OpenCode documents
and refuses agents that restrict their tools, since dropping those fields
would widen the agent's access.
Refs #267
Refs #241
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.
A skill installed into a group had its metadata written to the group
folder instead of the skills root, so it never reached config.yaml and
teammates running `install -p` did not get it.
Two paths left the skills root unset and fell back to the parent of the
skill: `install <git source> --into <group>`, because only Install
derived the root and InstallFromDiscovery did not, and config installs
of an entry with `group:`, in both project and global mode. Both now
resolve the root the same way.
- Fallback fetch pulled only the default branch because a depth-1 clone
is single-branch; fetch all heads and tags so an abbreviated SHA off
the default branch resolves.
- Move the --track guard from CLI flag parsing into InstallTrackedRepo
so the Web UI is covered too, and reject tags as well as SHAs: both
leave HEAD detached with nothing for `git pull` to follow.
- An all-hex branch or tag name (e.g. 20240915) was treated as a SHA in
check and never queried; look the ref up first and fall back to the
literal SHA only when the remote has no such ref. Full 40-char SHAs
still skip the network.
- Rename the git package's 7-char shortHash to abbrevHash to avoid
clashing with install's 12-char helper.
Refs #281
Teams with supply-chain review need reproducible installs, but --branch
only worked for branch names because git clone --branch rejects SHAs.
Clone the default branch and detach at the pinned commit (targeted
depth-1 fetch, falling back to --unshallow for abbreviated SHAs or
servers that refuse arbitrary wants). Resolve tags in check via
refs/tags and the peeled ^{} commit, and short-circuit SHA pins without
a network round-trip since they can never move. Reject --track with a
SHA: a tracked repo must follow a branch to pull.
Closes#281
The Contents API names a download_url for every file and the downloader
sent the token to it unchecked, so a hostile or compromised server could
point it at another host and collect GITEA_TOKEN or the generic git token.
A URL on another origin is now refused, which falls back to a git clone.
Adds the missing tests for the Gitea and CNB download paths.
Overriding the audit gate with --force was per-invocation, so skills that
legitimately quote attack strings (security scanners, red-team docs) had to
be forced on every `update --all`. The only alternative, disabling the rule,
was global and turned it off for every skill.
Record the accepted findings (rule + file + matched text, no line number) in
.metadata.json under `audit_accepted`, keyed by skill relPath so it survives
entry rewrites and works for tracked repos. Later updates mark matching
findings as acknowledged and exclude them from the block decision; any new
finding, or the same rule matching different text, still blocks.
Staged installs audit a temp directory, so InstallOptions gains an
AuditAcceptRoot/AuditAcceptPath override pointing at the final destination.
Refs #279
Avoid discarding all file hashes when a directory symlink cannot be read as a file. Preserve file symlink hashing and error propagation for broken links and other hash failures.
Add regression coverage for directory symlinks, file symlinks, and broken links. Verified with make check in the devcontainer.
Refs #272
Source parsing only treated inputs starting with /, ~, ./ or ../ as local
paths, so Windows paths such as D:\folder fell through to git URL parsing
and failed with "unrecognized source format" (or were expanded into a
bogus GitHub shorthand when written with forward slashes).
Refs #269
Skills installed from a non-default branch record that branch in metadata,
but the grouped update path (update --all) cloned the remote default branch,
so the skills were either downgraded or reported as removed upstream and
pruned. The web UI update and check handlers had the same gap, comparing
against the remote HEAD instead of the installed branch.
Group batch updates and web UI checks by URL+branch, pass the branch through
to the clone, and resolve remote tree hashes for that branch as well.
Refs #268
The grouped update path (update --all) removed the existing skill directory
before copying the new content, and the audit-block cleanup then removed the
freshly copied content as well. A rejected update therefore deleted the
previously installed, already-audited version and left a stale metadata
entry that update --all could no longer discover.
Stage the new content in a temp directory when updating, audit it there, and
only swap it into place once the audit passes, matching the single-skill
update path.
Refs #271
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.
Discovery skips well-known target dot-dirs (.claude, .cursor, ...) so that
target-synced copies are not mistaken for source skills. filepath.Walk visits
the walk root first, so pointing an install directly at such a directory —
`skillshare install user/repo/.claude` — matched the guard on the root itself
and returned SkipDir before scanning anything, yielding zero skills.
Exempt the walk root from the dot-dir filter in discoverSkills and
scanAgentDir: it was requested explicitly, so filtering it can only discover
nothing. .git stays unconditionally skipped, and repo-root walks are
unchanged, preserving the original guard.
Batch update looks up each skill's subdir in the discovery map, but
discovery deliberately skips target dot-dirs (.claude, .codex, ...) to
avoid counting target-synced copies as source skills. A skill installed
from such a subdir therefore never appears in the map and is falsely
reported as stale (deleted upstream), steering users toward --prune on a
healthy skill. Fall back to a direct SKILL.md stat in the cloned repo --
mirroring the single-skill update path -- before declaring the path
missing.
Fixes#261
Retry generic HTTPS clone failures by progressively treating additional path segments as part of a nested GitLab repository. Limit retry to repo-boundary errors and preserve the final fallback error for debugging.
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.
Reject project-mode installs that target the current project root and add a copy-layer guard that skips destination subtrees during recursive copies. This prevents install ./ -p from recursively copying .skillshare/skills into itself on Windows.
A corrupt or unreadable .metadata.json caused LoadMetadataWithMigration
to return a nil store whose error was discarded, so update --all
dereferenced a nil MetadataStore in GetByPath and crashed with a raw
stack trace. Guard GetByPath against a nil receiver and surface the
load failure as a resolve warning instead.
Trim SKILL.md suffixes without filepath.Dir so traversal segments remain visible to SEC003 subdir validation. Add regression coverage for GitHub, GitLab, and Bitbucket blob-style skill URLs.
Reject unsafe subdirs that contain path traversal (..), NUL bytes,
control characters, backslashes, absolute paths, and URL-encoded
traversal (single, double, or overly deep encoding). Validate derived
source names and CloneURLs for NUL and control characters.
SEC003: github.com/owner/repo/../../etc/passwd previously produced a
Source with Subdir containing traversal segments. Now rejected.
Route temp clone cleanup through a shared helper that logs cleanup failures with path and error while preserving existing best-effort cleanup semantics.
Cover cleanup failure logging with a deterministic unit test.
When tracked repo metadata is committed but the gitignored clone dirs are
absent on a fresh machine, `update --all` silently reported zero work: the
batch path skipped missing repos with no message, and the web UI's
update-all paths only listed repos present on disk.
Missing tracked repos are now detected and surfaced everywhere:
- CLI: a warning block (human output) plus an aggregated
`missing_tracked_repos` summary (names + one-shot rehydrate hint) in JSON;
the per-item error is concise. Fixed for both global and project modes,
and batch and single-target paths.
- Server: GET /api/update/missing-tracked-repos and the update-all/stream
summaries report them; POST /api/update/rehydrate re-clones them from
metadata (mirrors bare `skillshare install`).
- UI: the Update page shows a warning banner listing missing repos with a
Rehydrate button; strings added to all 11 locales.
Closes#212
The web UI skill preview always fetched SKILL.md via api.github.com, so skills from GHE or other non-github.com hubs showed only index metadata (name, description, tags) instead of the full rendered content.
FetchPreview now resolves the source platform: github.com and GHE use the host's REST Contents API, while other platforms (GitLab, Bitbucket, Azure, SSH) fall back to a shallow clone. Sources whose content can't be retrieved degrade gracefully with a clear notice in the modal.
Fixes#193
Hub index fetch previously handled only unauthenticated HTTP(S) GET or
local file paths, leaving private and GitHub Enterprise repos out of
reach — raw HTTPS URLs redirect to login before token headers apply, and
SSH-style hub URLs were unrecognized.
Resolve SSH hub sources by shallow-cloning the repo with the user's SSH
keys and reading the index from it. The in-repo index path uses the
existing //path subdir convention (consistent with `install`), defaulting
to skillshare-hub.json at the repo root. Both scp-style and ssh:// URLs
are accepted. In the web dashboard, SSH clones are restricted to saved
hubs so a request-supplied URL can't drive an arbitrary clone.
Ref #185
md2codex / md2gemini named the *input* (markdown) and read poorly. Rename
the bundled extensions after what they produce: codex-agents and
gemini-commands. Turn the BuiltinExtensions catalog into structs carrying
a human-readable description so the dashboard can explain each one before
install, and propagate the new names across tests and docs.
Add an "Extensions" tab to the Config page for managing transform
extensions in the active mode (global or project):
- GET /api/extensions lists installed extensions with their manifest
descriptions, merged with the built-in catalog so users can see what
is available to download.
- POST /api/extensions/install downloads a whitelisted built-in
extension into the active mode's extensions directory.
- POST /api/extensions/open opens that directory in the user's editor,
mirroring the skill "open in editor" affordance.
ExtensionSpec now carries the manifest description so the list can
surface it. The UI shows installed extensions with a built-in badge,
available built-ins with a Download button, and an Open-directory
action. Strings are translated across all 11 locales.
- fix(gitea): use shortHash instead of undefined shortCommitHash
- fix(gitea): use strings.LastIndex for robust SSH URL parsing
- fix(discovery): preserve warnings in Gitea API discovery fast path
- feat(auth): add detectPlatformFromHost with configured host support
Replace url.PathEscape(path) with escapeGiteaPath() that escapes each
path segment individually, preserving directory separators. The previous
approach would encode slashes as %2F, breaking nested subdirectory
downloads via the Gitea Contents API.
Support Gitea (gitea.com and self-hosted instances) as a git hosting
platform for installing skills. Includes both core platform integration
and a Gitea Contents API fast path for direct file downloads without
full git clone.
Platform support (P0):
- auth.go: add PlatformGitea, detect gitea hosts, resolve GITEA_TOKEN
- config.go / project.go: add gitea_hosts config field with normalization,
env var merge (SKILLSHARE_GITEA_HOSTS), and EffectiveGiteaHosts()
- source.go: add isGiteaHost() and GiteaHosts to ParseOptions
- install.go: pass GiteaHosts from config to source parsing
- install_git.go: include GITEA_TOKEN in auth error hints
API fast path (P1):
- gitea_download.go: Gitea Contents API recursive directory download
(GET /api/v1/repos/{owner}/{repo}/contents/{path}), matching the
GitHub Contents API pattern
- install_apply.go / install_discovery.go: hook Gitea API fallback
after sparse checkout, before full clone