Repository navigation
feat: follow first-level source links (follow_source_links) - #417
Conversation
Explain follow_source_links in global and project configuration and distinguish linked source roots from first-level discovery. Document real-checkout update risks, cleanup guards, source write limits, Git staging warnings, and unverified Windows junction support.
Source links can record machine-local paths in Git. Share advisory indexed and ignored checks across CLI, init, and dashboard staging and previews, with scope-correct ignore patterns and manual untracking instructions, without changing staging behavior.
Use sourcewalk with zero options to preserve first-level link identity without adding a raw-walk allowance. Keep Git paths relative to the logical skills source.
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
…inks Operations that write or scan below a followed first-level link need the real location of a logical path (<source>/_dev-skills/foo). Resolve maps such a path onto the link's canonical target, reusing the same guards as traversal, so sourcefs, group walks, trash, and audit roots can share one answer instead of each re-deriving link identity. Refs #274
The doctor message for an unfollowed first-level link now names the config key that enables following, so the integration expectation must carry the hint too.
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
…roots Trash moves and restores the link entry without copying or removing its target, including when rename fails. Relative link text is stored as an absolute target so relocation cannot change its meaning; list and TUI expose the link target without inventorying its contents. Pass the operation-scoped Follow policy into audit and hash operations, resolving their physical root while keeping logical result and metadata keys. Calls without a policy keep their existing behavior and ScanSkill retains its original function signature. Update six stale trash raw-write allowances for the injected rename test seam and classify moveLink creation/removal: it moves a checked source entry to trash or restores an entry into source, never writes through its target. Raw sourcewalk calls and allowances are unchanged.
Keep the canonical skills source root and logical relative tail when creating or reformatting project links, including Windows relative links and junction fallback. Shared agent and extra links retain full canonicalization, and global Unix link text stays unchanged. Allow group walks outside the source only for an enabled first-level link validated by Follow.Resolve, remapping children to logical paths and metadata keys while retaining nested-link guards and root-skipping semantics. Resolve copy and checksum operation roots before walking to avoid false cycles, and preserve followed source links during forced collect with per-item warnings. Regression coverage verifies second-sync ownership, status, prune, unlink, format changes, linked-root copying, group guards, and forced collect preservation. Linux build, vet, sync and command tests, sourcewalk ratchet, server collect tests, context validation, and Windows cross-build passed; Windows runtime was not verified. No new raw-walk allowance was needed.
update audited a skill below a followed source link with a scanner that did not follow the link, and uninstall --group resolved a followed group without the operation's policy. Both now use the same policy as the rest of the operation: the update context's follow for the audit scan, and the uninstall mode's walk for group resolution. Refs #274
Keep the analyzer metadata context logical while walking the resolved root, so integrity and publisher checks still find the source metadata store. Add global/project command regressions for linked repo roots and single skills, plus linked install-audit and trash sibling-list checks. Pass the existing optional Follow policy through install audit gates and final metadata hashing, preserving default-off behavior. Absolute link text remains unchanged on trash rename fallback; relative links continue to store their absolute target.
Wave 2 made writes behind a followed first-level link land in the real checkout, so the "current limits" paragraph written for the discovery-only version was no longer true. Replace it with the actual write semantics, add the walker decision flowchart the design discussion settled on, and record the sourcefs/sourcewalk policy contract in the CLI development topic. Refs #274
The unmounted-drive case is the main reason the incomplete-inventory guard exists, so spell out what each command does while the drive is away, what the AI tools see in symlink versus copy mode, and why the mount path must stay stable.
filepath.EvalSymlinks leaves a Windows junction unresolved since Go 1.23 reports mount points as irregular rather than symlinks, so the follow policy walked the junction entry itself and discovered no skills behind it, while doctor and tracked-repo detection (which only Stat the entry) reported it as followed. Resolve the link text first, then canonicalize the target. Add the Windows E2E script that found this: a junction under the skills source pointing at a checkout, with the drive-away, write-through, and trash round-trip steps. Refs #274
Record how the junction case is verified through the UTM guest and point the testing topic and the config reference at it, replacing the 'not yet verified' caveat now that the ARM64 run passed.
…m suggesting prune A link into a sync target that is not created yet was reported as a missing target, which marked the inventory incomplete and held back pruning for a link that would never be followed. The where-it-points guards now run on the link text before the does-it-exist check, so such a link is an overlap and the run prunes as usual. doctor reported the dangling target links behind an unmounted source link as broken symlinks and suggested `skillshare sync` to prune them, while sync deliberately keeps them. Those links are now a warning that names the waiting source link and carries no prune suggestion.
…inks Covers directory symlinks instead of junctions and project mode, where the per-skill target links are relative symlinks that must keep the logical <source>/_dev-skills/<name> tail rather than the checkout path. Verified on a Windows 11 ARM64 guest with Developer Mode on.
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.
An audit run with follow_source_links whose linked checkout was missing finished as a clean success, so a partial scan looked complete. Audit now warns once per skipped link in human output and adds warnings plus incomplete: true to JSON output, including when no skills were found. Also cover project mode: reconcile keeps config and metadata entries of an unavailable link, and sync -p warns once and keeps target entries.
…eep Windows link text logical The project dashboard builds a synthetic global config without follow_source_links, so the collect handler read a zero policy and a forced collect could replace a followed source link with the target copy. The per-instance snapshot already knows the project setting. On Windows the absolute link fallback (junctions, or symlinks without Developer Mode) canonicalized the source root even with the key off. A source root that is itself a directory symlink then no longer matched the logical path that status, prune and merge ownership compare against, so every sync reported a conflict or recreated every link. Store the logical path as main did; only relative links need the canonical root.
canonicalPath relied on filepath.EvalSymlinks, which since Go 1.23 leaves a Windows junction component in place. A link whose target is itself a junction, or sits below one, was followed as the unresolved junction: the walk saw no descendants while the inventory counted as complete, so target entries from that link could be pruned, and a sync target spelled through a junction could evade the overlap guard. Every existing path component is now resolved hop by hop, and a target that still ends in a link marks the link unavailable instead of being followed. The policy also kept the source root as spelled, so a relative global source was discovered but never resolved for writes or audit. Root, first-level and Resolve comparisons now use the same canonical absolute form. Copy and checksum roots get the same one-hop resolution so a followed junction that is itself a skill no longer trips the cycle guard.
update --all treated a followed source link as a managed tracked repo: with --force it ran git reset --hard inside the user's own checkout and silently discarded their local edits, and an audit-gate rollback would do the same. --all now skips any tracked repo behind a followed link with a warning that names the by-name form, which keeps its documented behavior.
Refuse install update pulls when a followed checkout has local changes or its Git status cannot be read, so audit rollback cannot discard unrelated user edits. Preserve ordinary and nil-policy behavior and cover both install routes and clean audit rollback.
Use one skills traversal policy for dashboard update discovery, post-pull audits, and staged regular-skill writes so linked repositories are audited and child updates preserve their source links. Keep agent updates and disabled follow behavior on the nil-policy path. Cover global and project modes through HTTP and SSE handlers, including audit rollback and disabled-follow parity.
Restore skills through sourcefs with the active global or project follow policy so nested links and disabled following cannot redirect writes or consume the trash copy. Preserve relative link traversal when relocating links, and keep link rows in the trash TUI on their detail view.
…uninstall --group on a link sync --json showed pruned: 0 and success while a link was unavailable, so automation could not tell a held-back prune from nothing to prune. The run's source link warnings now ride along as warnings. uninstall --group <followed link> moved every skill out of the user's checkout, while uninstall <link> removes only the link entry. The group form is refused with a pointer to the by-name forms.
Covers the guard order, file links, update --all and dirty checkouts, --group forms, restore through the link, what Git stages for a link, the sync and audit JSON warnings, and the junction-chain case in the Windows runbook.
…eview fixes uninstall --group on a followed link is now refused, and restore no longer creates parents with a raw MkdirAll, so the ratchet allowance for it is stale.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: aafb7e7e96
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Discovery callbacks may ignore filesystem errors after a followed target passes its availability probe. Record these failures in the shared Follow policy before dispatching callbacks so sync and reconciliation preserve entries missing from an incomplete inventory. Keep ordinary vanished-child races tolerated, while treating loss of the target itself as unavailable. Cover both walkers and merge/copy pruning, and document read failures in the English and translated configuration guidance.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: df7a6ad73d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Missing-repo discovery ignored the operation follow policy, so tracked metadata added a skipped checkout back to update --all and allowed --force to reset it. Thread the policy through missing-repo detection and its CLI/server callers, including rehydration, so existing followed checkouts remain excluded. Cover global and project updates with dirty tracked checkouts and force, as well as shared and dashboard rehydration. Document that --force does not override the batch skip.
Filtered checks dropped the follow policy when resolving a basename, so a linked checkout visible in an unfiltered check was reported as not found by its name. Forward the operation policy to the resolver and cover both global and project checks against a local Git remote. Document checking followed checkouts by link name in the command reference and built-in guidance.
A symlink passed as a filepath.Walk root is listed as a single file, so root-of-link skills returned files containing only a dot. Reuse the discovery follow policy to resolve the walk root and compute relative file names from it while retaining logical resource paths. Cover global/project responses and disabled following, update the existing traversal inventory, and document root-of-link file browsing in all website locales and troubleshooting guidance.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e7eecffeab
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Followed worktrees and submodules were discovered as tracked repos but bypassed guards that required a .git directory. Widen IsGitRepo to accept a directory or regular gitdir file and reuse it in discovery and reconciliation. All existing callers classify checkouts or run Git commands; none requires the directory layout, so a separate predicate would retain inconsistent decisions. Exercise actual followed worktrees in CLI and dashboard update fixtures, including project mode and force retries, and document that they receive the same checkout guards.
Standard target naming uses frontmatter names, so matching target entry names misclassified unavailable source skills as broken and suggested pruning. Read the stored link destination, resolve relative paths, and compare it with unavailable source roots; retain name matching only when the link target cannot be read. Cover absolute and relative destinations and an unrelated broken link whose name resembles a followed skill. Document that standard target names receive the same waiting classification.
Hub index, built-in search, and draft candidates discovered only the source path, dropping the follow policy used by the inventory. Add optional walk options to the shared Hub functions and pass the operation policy from dashboard handlers and CLI indexing. Explicit CLI sources use the active config policy while retaining configuration-free indexing. Cover global/project modes, enabled/disabled following, all three handlers, and CLI source overrides; document the behavior in all website locales and built-in guidance.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 56a34f7fce
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Recreate nested links with their stored target text instead of dropping them before removing the original skill. Reuse the junction target resolution and symlink fallback used by moveLink without traversing link contents.
Register link recreation alongside the existing trash and agent recovery copy operations. Keep translated trash guidance separate from the existing group paragraph.
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.
Keep the existing non-source traversal allowance attached to the recursive staged-copy helper. The walk still reads only incoming content outside the skills source and all destination writes remain anchored by sourcefs.
Rewrite frontmatter as bytes and read and write target assignments through sourcefs with the discovery follow policy. Refuse nested SKILL.md links with per-skill batch errors or HTTP 400 while regular followed skills remain editable and outside files stay unchanged.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 891c687a47
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @@ -228,6 +230,12 @@ func cmdUpdate(args []string) error { | |||
|
|
|||
| // Tracked repo | |||
| if info.IsDir() && strings.HasPrefix(info.Name(), "_") { | |||
There was a problem hiding this comment.
Skip followed checkouts regardless of directory prefix
When a followed Git checkout has a non-underscore name such as dev-skills and contains a root SKILL.md, this prefix condition prevents followedRepoSkipped from running. Reconciliation records metadata for the root skill, so the later SKILL.md branch schedules it as a regular update and handleUpdate performs git pull against the user-owned checkout during update --all, contrary to the documented promise that followed checkouts are skipped; the project loop has the same condition. Fresh evidence beyond the earlier fixed update findings is that the guard remains nested under the underscore naming convention even though followed links themselves have no such requirement. Run the followed-checkout guard before applying tracked-repository naming rules.
AGENTS.md reference: AGENTS.md:L15-L15
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Confirmed: followedRepoSkipped only runs for _-prefixed directories in both update.go and update_project.go, so a followed checkout linked under a plain name whose root is a skill can be scheduled as a regular metadata update. #417 is already merged; this will be fixed in a follow-up (run the guard for any directory before the tracked-repo naming rule).
There was a problem hiding this comment.
Fixed in #426: the followed-checkout guard now runs for every directory before the _-prefix tracked-repo rules, in both the global and project loops. Regression test TestUpdateAllSkipsFollowedCheckoutWithoutPrefix (a dev-skills link with a root SKILL.md and metadata stays untouched under --all --force).
`update --all` only consulted the follow policy for `_`-prefixed directories, so a followed checkout linked under another name (for example via `link --name dev-skills`) whose root holds a SKILL.md with recorded metadata was scheduled as a regular skill and `git pull`ed, and reset under `--force`, against the user's own checkout. Followed links carry no naming requirement, so run the guard for every directory before the tracked-repository naming rules apply, in both the global and project update loops. Follow-up to the Codex review on runkids#417.
ref #274.
What
Adds
follow_source_links(global and project config, defaultfalse). When on, a symlink or junction placed directly under the skills source is followed one hop under its link name, so a checkout kept elsewhere (another folder, an external drive) shows up as_dev-skills/fooinlist,sync,status,update,audit,doctorand the dashboard.internal/sourcewalk) with a per-operation policy. A link whose target is missing or unreadable marks the inventory incomplete, and that run performs no pruning, orphan-copy deletion or metadata removal, so an unmounted drive never causes a prune.internal/sourcefs, rebased onto the link target with the same escape checks.uninstall _dev-skills/foomoves the child out of the real checkout;uninstall _dev-skillsand the trash handle only the link entry;restorerecreates it.<source>/_dev-skills/<name>tail (relative symlinks when both sides are in the project).commit,pushandinitprint an advisory warning when a first-level link would be staged.false, behavior is unchanged: discovery ignores first-level links anddoctorpoints at the setting.Review round
Three independent read-only reviews ran against the branch before this PR; every P1 and P2 finding was fixed on the branch with a regression test:
update --all --forcecouldgit reset --hardthe user's own checkout behind a followed link;--allnow skips followed links with a warning.install --track --updateand the dashboard refuse to pull a dirty followed checkout, because a blocking audit finding rolls the checkout back.sourcefs.MoveInthrough a followed link is anchored in the opened root (no raw rename after the target could be rebound).EvalSymlinksleaves junctions in place since Go 1.23); the absolute link fallback keeps the logical source path as onmain.sourcefswith the policy and refuses nested links; relative link relocation keepsalias/../checkouttraversal; the trash TUI no longer browses a live checkout through a trashed link.uninstall --group <link>is refused in favor of the by-name forms;sync --jsonandaudit --format jsonreport unfollowed links (warnings,incomplete).doctorreports dangling target links behind an unavailable source link as waiting, without the prune suggestion.Verification
make checkin the devcontainer: pass./Volumes/X10 Pro), isolatedHOME: 17/17 stepsrc=0, including unmount simulation, writes through the link, trash and restore of the link.rc=0. Runbook:ai_docs/tests/windows_follow_source_links_runbook.md.Docs
website/docs/reference/targets/configuration.md#follow_source_links(guards, decision flowchart, external drive, writes through the link, Windows), FAQ, source-and-targets,sync.mdJSONwarnings, wikicli-developmentandtesting.