Bind provider credentials to canonical or explicitly configured HTTPS origins and preserve that policy across remote consumers. Reject cross-site credentialed reads, linked fallback directories, and discovered-agent writes outside the source; audit staged content before rooted atomic publication.
Add boundary regressions, private Git update coverage, stable cross-platform fixtures, and aligned documentation. Verified the integrated main baseline with all executed CI checks passing.
* fix(git): keep a caller's GIT_DIR out of skillshare's git commands
Git exports GIT_DIR, GIT_WORK_TREE, GIT_INDEX_FILE and related variables
to hooks that run in a linked worktree. Every git process skillshare
started inherited them, and those variables override the directory the
command runs in. Run from a post-checkout or post-merge hook, skillshare
therefore acted on the hook's repository instead of its own: install's
sparse clone turned on sparse checkout there (a later merge removed every
file outside the skill's path), the remote tree check's `git init --bare`
made it a bare repository, install's reconcile recorded its origin and
branch, and push staged and committed into it.
internal/gitenv builds git commands without the variables that
`git rev-parse --local-env-vars` lists for choosing a repository, work
tree, index, object store or config file. GIT_CONFIG_COUNT and
GIT_CONFIG_PARAMETERS stay, because users pass credentials through them
and install's token auth appends to the existing count. Every git call in
cmd/skillshare, internal/install, internal/git, internal/check and
internal/config now goes through it, and plugin runCommand starts native
CLIs from the same environment because they run git as well. The hooks
service keeps its own stricter filter.
Closes#852
* test(gitenv): fail on new git commands that bypass gitenv
Each git call site converted for #852 is safe only because it goes
through gitenv.Command, and about half have no test of their own. A
future exec.Command("git", ...) would silently bring the bug back, so a
syntactic guard now rejects one outside gitenv, hooks and testutil,
mirroring the sourcefs and sourcewalk ratchets.
The Environ test also checks a lowercase name, since Windows environment
names are case-insensitive, and compares against literal keys so that
removing one from repoVars fails it. The wiki records the rule.
* fix(update): keep an agent's source when updating it
After the first `update agents`, an agent's recorded source became
`/agents/<name>.md` with type `unknown-subdir` and no repo URL, so
`check agents` stopped looking upstream and later changes never arrived
(#777).
The batch path rebuilt the repository source from the clone URL, subdir
and branch only, leaving Raw and Type empty, and the metadata written
back was built from that empty Raw. The fallback reinstall and the
dashboard update kept the agent's full source as Raw while clearing the
subdir, so the written source repeated the agent path.
AgentRepoSource now rebuilds the repository source once, by cutting the
agent path off the recorded source, and all three paths use it, so the
source written back is the one install recorded.
Agents whose metadata was already rewritten have no repository left in
it and need to be installed again.
* fix(check): compare each agent at its own branch and report unchecked agents
Agent update checks gave wrong answers in several cases next to #777:
- Agents from one repository were compared with the first agent's
version, so an older agent sharing a repo with a current one never
showed its update.
- The installed branch was never sent to the remote, so an agent pinned
to a non-default branch was compared with the default branch head.
- A tracked agent repo records its full commit while the remote hash is
abbreviated, so a fresh clone always read as update_available; its
checked-out branch was also ignored.
- `update agents` printed "All agents are up to date" and exited 0 when
agents could not be checked at all: an unreachable remote, unreadable
metadata, or a source erased by the #777 bug.
Each agent is now compared with its own version at its own branch, and
an agent whose source the old bug erased reports an error asking for a
reinstall, since its metadata no longer names a repository. Update lists
the agents it could not check and exits non-zero, counting them apart
from agents that failed to update. The docs describe the error status
and the reinstall fix.
* fix(update): repair dashboard-doubled agent sources and share the update flow
Review of the previous commits found gaps in recovering agents that
earlier updates broke, and in how the two update handlers report them:
- A dashboard update before the #777 fix appended the agent path to its
source a second time. Those agents keep their repo URL, so check offers
an update, but discovery then failed on the doubled path. Every copy of
the path is now cut, and the update writes the source back correctly.
- On the dashboard, an agent whose source the CLI bug erased failed with
"invalid source: source cannot be empty". AgentRepoSource now returns
the same reinstall error check shows, and both use one detector.
- When every tracked agent was such an erased agent, no remote was asked,
so the "Checking agents" spinner was never stopped and drew over the
error rows. It is now stopped once the check returns.
- The global and project handlers repeated the check-and-update flow,
and the project copy had already drifted (no dry-run log entry, spinner
in --json). Both now run one shared flow.
Tests cover the erased agent next to an updatable one in global, --json,
--dry-run and project mode, and the doubled and erased sources in
AgentRepoSource.
Return nonzero exit status for failed skill and agent checks while preserving JSON results. Propagate agent remote errors and prioritize dashboard check failures over the up-to-date summary.
Add regression coverage and document exit status in all command reference locales. Related to runkids/skillshare-app#85.
* feat(update): flag and protect skills edited since install
A skill installed from a repository and then edited by hand looked
exactly like an untouched one: check said up to date, and update either
reported it current or silently reinstalled it over the edit (#621).
Install already records each file's hash, so check now compares a
remote skill's files with those hashes and reports "modified", and
update skips such a skill until --force (CLI single, --all/--group,
dashboard). --force, the dashboard's Force Retry on the skipped row, or
the confirmation on the skill page discards the edit and reinstalls.
Two hash paths had to be made reliable for this to be trusted: the
dashboard's folder-wide target edit refreshed hashes by basename, so a
nested skill looked edited after skillshare's own change, and a skill
whose files cannot be hashed now counts as modified instead of being
overwritten.
* fix(server): keep earlier local edits when a target change rewrites SKILL.md
Changing a skill's targets in the dashboard rewrites its SKILL.md, and
both the folder-wide and the single-skill handler then re-hashed the
whole directory as the new baseline. An edit the user had already made
to any file in the skill was absorbed into that baseline, so the skill
stopped counting as modified and the next update overwrote the edit
without --force.
Both handlers now move only SKILL.md's recorded hash, and only when the
file still matched it before the rewrite. skillshare's own target edit
no longer reads as a local change, and an earlier edit still does. The
whole-directory refresh helpers lost their last callers and are removed.
* fix(update): stop trusting tree hashes for skills with symlinks
Install copies a file symlink's target, but git stores the link as a blob
holding the target path, so a skill's subtree hash stays the same when a
target outside the folder changes. Batch update skipped such skills as
current and check reported them up to date, leaving stale content installed.
A subdir that holds a symlink now has no usable tree hash: install records
none, update falls back to a reinstall, and check reports the skill as
update_available. Check lists entries with -z so links with non-ASCII names
are not missed behind git's path quoting.
Closes#572
* fix(check): split ls-tree -z output on NUL only
parseLsTreeOutput also split on newlines so the old newline fixtures kept
passing, but with -z a newline belongs to the path. A directory or symlink
whose name holds a newline was cut in two, and a symlink under it was missed.
The fixtures now use NUL-terminated entries like real -z output.
Also writes both shortcut comments in the repo's one-line form and uses
testutil.RunGit in the new update test instead of a raw exec call.
* docs(update): note that skills with symlinks always reinstall
The update page says grouped updates leave skills whose folder did not
change alone. A skill with a symlink no longer has a usable tree hash, so it
is reinstalled whenever the upstream commit moves. State that exception on
the English page and its four translations.
Token auth rewrote the clone URL with url.<user>:<token>@host.insteadOf.
git hands the rewritten URL to git-remote-https as an argument, so any
user on the machine could read the token with ps for as long as a clone
or fetch ran. Every platform token (GitHub, GitLab, Bitbucket, Azure
DevOps, Gitea, CNB) went through the same rewrite.
git now gets the token from a credential helper scoped to the host,
which reads it from SKILLSHARE_GIT_AUTH_PASSWORD; printf is a shell
builtin, so the token never reaches an argv. An empty helper entry
first clears the user's own helpers for that host, so git neither asks
their keychain nor erases from it on a 401, and no longer stores the
skillshare token there as the URL rewrite did.
An http.extraHeader was tried first and dropped: the header goes out
before any 401, so a stale token broke installs from public repos, and
after a rejection git fell back to the user's helper and erased their
stored credentials.
Refs #565
TestGitRemoteHash_DefaultBranchUsesAuth puts an extensionless shell
script named git first on PATH. On Windows exec.LookPath only resolves
names with a PATHEXT extension, so the script is ignored and the real
git.exe probes github.com, which answers "repository not found" for the
made-up repository. The auth env is built without any platform branch,
so the product path is unaffected; only the test double cannot work
there. Skip it for the same reason the fake-git tests in
internal/install/source_fallback_test.go already do.
Refs #444
Resolution.Run started a goroutine for every remote, even without
Parallel. The dashboard handlers run sequentially and rely on net/http
recovering a panic, which it only does on the request's goroutine, so a
panic while resolving a remote would have ended the server process
instead of failing one request, as it did before the resolution moved
into internal/check.
The sequential and the parallel path are now separate loops, so the
invariant is visible instead of being spread over three Parallel checks.
Refs #444
The CLI, GET /api/check and the check stream each wrote out the same
sequence: group skills by URL and branch, ask the remote hash, skip the
tree fetch when every skill matches, otherwise compare tree hashes and
assign a status. A fix such as branch handling had to be made three
times, and the sequence could only be tested against real repositories.
internal/check now owns it as Plan and Resolution.Run, with the remote
hash source injected and a per-remote progress callback. The CLI
progress bar and the SSE counter are adapters on that callback; the JSON
handler passes none.
The callers disagreed in two places, and both behaviours are kept: the
dashboard reports a skill removed upstream as update_available where the
CLI says stale, and gives no source or version for a skill without a
remote. The server adapter narrows the result accordingly.
Refs #444
The CLI, GET /api/check and the check stream each carry their own copy of
the resolution sequence, and only its leaf helpers were tested. Pin what
each caller reports for every outcome, against local bare remotes, so the
copies can be merged without changing output.
Refs #444
* fix(check): compare project-relative local sources and record install layout
Project installs record a local source as typed (./vendor/skill), relative
to the project root, so check skipped them. Resolve them against the project
root in both the CLI and the dashboard.
The copied shape of a local install was inferred from its file hashes, so a
CLI install whose source held only SKILL.md looked like a dashboard
collection-root install: a child skill added at the source later was neither
reported by check nor copied by update. Record the layout (skill-file or
directory) at install time and keep the hash heuristic only for entries
written before the field existed.
* fix(install): let a recorded layout decide the update shape without hashes
An entry whose hashing failed at install time still knows what was copied;
returning false there would turn a SKILL.md-only update into a full copy.
* 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.
* feat(check): detect changes at local install sources
Skills installed from a local path (for example a skill shipped inside an
app bundle) could already be refreshed with `update`, but `check` always
reported them as "local source", so users had no signal that the source
had changed after an app update.
`check` now re-hashes the files at the recorded source path and compares
them with the hashes stored at install/update time. It reports
update_available on a difference, up_to_date on a match, and an error
naming the path when the source is gone. The path is resolved the same
way `update` resolves it before re-copying, so a successful update always
brings the status back to up_to_date. The CLI and both Web API check
handlers share the comparison in internal/check.
Refs #206
* fix(check): avoid false local-source updates and show check errors
Review follow-ups for local-source change detection:
- The dashboard installs the root of a directory that also holds child
skills as its SKILL.md alone, so hashing the whole source reported
update_available right after a clean install. Compare only the files
such an install copies, recognized by recorded hashes that contain none
of the child skills present in the source.
- A relative source path resolves against the cwd of the install, which
is not recorded, so checking from another directory reported a missing
source. Relative sources are no longer compared.
- The dashboard dropped the new check `message`, so a missing source only
showed a generic "Check failed". Carry it into the status tooltip.
* revert: restore video files accidentally removed in 1fb13b75
The review-fix commit picked up unrelated staged deletions under video/. They belong to separate work and are not part of this change.
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
- DiscoveredResource gains RepoRelPath and Targets fields
- AgentKind.Discover populates RepoRelPath via findTrackedRepoRelPath
- AgentCheckResult gains RepoPath and dirty status for tracked repos
- InferTrackedKind auto-detects pure-agent repos for --track install
- TrackedRepoResult reports AgentCount and Agents list
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).
Production code no longer reads or writes .skillshare-meta.json sidecars:
- InstallAgentFromDiscovery: write to centralized store via WriteMetaToStore
- agent_check.go: read from centralized store passed as parameter
- handler_skills.go: read agents from s.agentsStore
- audit.go: readMetaFileHashes reads from parent .metadata.json
- analyzer_metadata.go: extract findMetaEntry to deduplicate walk logic
- uninstall_agents.go: remove entry from centralized store on uninstall
- batchUpdateAgents: pass store to reinstallAgent, remove dead field
- Replace LoadMetadata+nil guard with LoadMetadataOrNew across 6 files
When extras has an entry named 'agents' whose target paths overlap with
the resolved agent target paths from targets.yaml, the extras targets
are skipped with a warning — the agents sync system takes priority.
Detection uses dual conditions: extras name == 'agents' AND resolved
path overlap. Non-'agents' extras targeting agent paths are unaffected.
Agents source must exist with actual files; empty/missing source means
no overlap (extras sync normally).
Also fixes:
- CheckAgents now recurses into subdirectories via resource.AgentKind
- update agents resolves nested agent names via filepath.Base
- filterAgentCheckResults matches both full path and basename
Add RepoURL field to AgentCheckResult. Add EnrichAgentResultsWithRemote()
that batches remote HEAD hash checks via ParallelCheckURLs and marks
agents as 'update_available' when remote has newer commits than the
installed version.
- Set source.Branch in project install path
- Sync branch in project reconcile
- Add Branch to checkRepoResult and RepoCheckOutput for JSON/display
- Read current branch from tracked repos in check
Ref: #90
- Add GetRemoteRefHash/WithAuth/WithEnv to internal/git/info.go:
uses git ls-remote with refs/heads/<branch> when branch is set,
falls back to HEAD when branch is empty
- Add Branch field to URLCheckInput and URLCheckOutput in check/parallel.go;
ParallelCheckURLs dispatches to GetRemoteRefHashWithAuth when Branch is set
- check.go: group skills by RepoURL@branch composite key so skills on
different branches of the same repo are checked against the correct ref;
urlHashMap keyed by same composite key for correct broadcast
- install_config.go (InstallFromConfig): propagate SkillEntryDTO.Branch
into Source.Branch for both plain and tracked skill phases so registry
rebuild (install --from-config) respects the recorded branch
Previously `skillshare check` compared repo-level commit hashes, causing
all skills from a registry repo to show "update_available" whenever any
commit was pushed — even if the individual skill's files were unchanged.
Now each skill records its git tree hash (subdir-level SHA) at install
time. During check, a three-tier comparison is used:
1. Fast path: commit hash matches → up_to_date (zero extra cost)
2. Tree hash path: blobless fetch (~150KB) + batch ls-tree → per-skill
comparison; unchanged subdirs stay up_to_date
3. Fallback: no tree hash (old installs) → commit comparison (unchanged)
Also fixes pterm progress bar printing twice when it auto-stops at 100%.
- Return early with error status when git.IsDirty fails instead of
silently ignoring the error, which could mask real issues
- Add TestParallelCheckRepos_NilCallback for nil callback with real inputs
- Add index alignment assertions to TestParallelCheckRepos_CallbackCount
Introduce internal/check package with ParallelCheckRepos that checks
multiple tracked repos concurrently using an 8-worker semaphore pattern
(matching audit/parallel.go). Each repo is checked for dirty state and
behind count via internal/git. Includes types for future URL-based
remote hash probing.