Copy staged directory links as concrete content through the source root, skip dangling links, and reject directory cycles. Preserve the existing skill under a sibling name and restore it if moving or copying the replacement fails so followed checkout updates cannot discard the old content.
A root skill discovered through a followed source link occupies the link entry itself. Moving that entry to trash silently unlinks every nested skill instead of removing one skill.
Share the root-skill guard across single and batch API handlers and CLI uninstall, report the unlink action clearly, and preserve explicit unlink and nested skill removal.
MoveIn below a followed link ended in a pathname os.Rename against the
link target's directory. That pathname can be renamed away and replaced
by a link to another directory after through() cached the second root,
so the move landed outside the checkout the root was opened on.
The followed route now copies the staged tree through the root handle to
a temporary name, renames it into place through the handle, and removes
the staged source only after that. The primary root keeps its rename, so
behavior without a follow policy is unchanged.
With follow_source_links on, discovery reports <source>/_dev-skills/foo,
but every write to it was refused: sourcefs rejects a link in the path, and
its source-root os.Root refuses descendants outside the source. Dashboard
edits, nested uninstall, regular skill replacement, and tracked installs
under such a link all failed, although writing through a link the user
placed is the agreed behavior (#410).
sourcefs.Open, Create, MkdirAllIn, and CheckMoveOut take the operation's
optional sourcewalk.Follow. A clean name <link>/<rest> whose first
component the policy follows is handled by a second os.Root opened at the
link's canonical target, with the same per-component link check on <rest>,
so a nested link or ".." still cannot escape the target. Names with ".."
keep the source root, which refuses them through the link. Without a
policy nothing changes.
The link entry itself stays a link: RemoveAll, Rename, and writes on it are
refused, install --track --force still refuses to replace it, and
CheckMoveOut still lets trash rename the link without following it.
MkdirAll on a followed link is a no-op, since it already is that directory;
install --into needs that. A rename across the link boundary is refused.
The install, update, uninstall, and server callers pass the same policy
their discovery uses, through InstallOptions.SourceFollow and the update
context. No raw-write allowance was needed.
Refs #274
Implements rollout steps 1 and 2 of proposals/274-skillfollow.md. Nothing follows a link or parses .skillfollow yet.
Step 1: doctor reports first-level symlinks and junctions in the skills source as info, in text and JSON, without following them.
Step 2a: internal/sourcewalk owns traversal of the skills source. Thirteen raw walks move onto it with identical behavior, and a go/parser ratchet fails the tests on any new unclassified walk.
Step 2b: internal/sourcefs wraps an os.Root opened at the skills source and refuses any write whose path has a link component. The six write sites the proposal found in review move onto it, including the cross-device copy fallback, and a second ratchet covers raw os write calls. The only behavior change is that an explicit path crossing a link inside the source is refused instead of written through.
Refs #274
Release-As: 0.24.3