Commit Graph
422 Commits
Author SHA1 Message Date
Willie 0117161c8b Merge remote-tracking branch 'origin/main' into runkids/436-managed-instruction-block 2026-10-07 01:13:44 +08:00
Willie fe4fcba122 Merge branch 'main' into runkids/arch-442-uninstall 2026-10-07 01:07:38 +08:00
Willie 5f49b00516 Merge branch 'main' into runkids/arch-443-tracked-update 2026-10-07 01:01:32 +08:00
Willie a165bf7cf9 Merge branch 'main' into runkids/arch-444-check-resolution 2026-10-07 00:56:06 +08:00
Willie 2e9f14da49 feat(ui): let the dashboard force a refused tracked-repo uninstall
DELETE /api/repos/{name} now refuses a repo with uncommitted changes or
unreadable git status, and the Dashboard page never sent force, so those
repos could not be removed from it at all.

The two refusals force overrides now carry their own error code. The
page still sends the first request without force; on either code the
confirmation says why and retries with force only when the user
confirms. Other refusals, such as a linked folder that is itself a
skill, keep the plain error because force does not change them.

Refs #442
2026-10-07 00:35:03 +08:00
Willie 764ca7f9c0 fix(uninstall): keep a grouped skill's legacy metadata key on review
Review of the shared uninstall operation found that RemoveByNames still
matched a bare key: removing top-level "foo" pruned the legacy entry
"foo" with Group "frontend", which belongs to the installed
frontend/foo. Entries are now matched by their full path only.

Also from review: a dry run no longer runs git status for tracked
repos (it reports no git state), the unused Outcome.Removed is gone,
the two single-item handlers share one status mapping, and the CLI
reports a single target in one place instead of three flag checks.

Refs #442
2026-10-07 00:20:20 +08:00
Willie 7bc61698ee refactor(update): load metadata only for root-skill repos, report once
The dashboard update of N tracked repos loaded the metadata store 2N times
under the server lock, and each load walks the whole source tree. The refresh
now returns before loading when the repo has no root SKILL.md, reports
whether it saved a change, and the server reloads its store only then,
through the existing reloadSkillsStore.

The CLI single-repo path tracked its output with two flags and a OnceFunc.
The caller hook now runs once for every outcome, so the spinner stop, the
discard warning and the pull summary live in one place and print in the same
order as before.

auditGateFailClosed rebuilt three of its messages by hand; they are
AuditGateError's own wording with another subject, so both now come from one
function.

Refs #443
2026-10-07 00:20:06 +08:00
Willie 2b05eccba3 refactor(memory): flatten the guidance handlers and state the module's preconditions
Review of the guidance move found no defect, but three things made the new
seam harder to read than it has to be:

- The plan and apply handlers nested the success path inside `if err == nil`
  with one shared error write. They return early again, like the handlers
  next to them.
- The handler derived the scope from IsProjectMode() while GuidanceInput
  derived the same value from ProjectRoot. Scope() is exported so the status
  response and the block inspection read one value.
- (*Server).memoryInstructions had become a one-line passthrough with a
  single caller, so it is inlined.

GuidanceReader is now exported, so its doc states what the server always
guaranteed: at least one source, and Dest indexing one of them. The
ApplyGuidance and Config comments say what callers need to know, and the
architecture paragraph is rewrapped.

No behaviour change.

Refs #450
2026-10-07 00:18:02 +08:00
Willie 277b28316e fix(update): keep the tracked-repository wording and log metadata errors
Review of the shared tracked-repo update found two regressions.

`install --track --update` lost "in tracked repository" from its message when
findings blocked and the rollback failed. The CLI builds its summary from
that phrase, so the old sentence is back, with the rollback part still coming
from AuditGateError.RollbackNote.

The dashboard dropped a failed metadata refresh without a trace, while the
CLI prints a warning. It is now logged.

trackedBlockMessage also gets a test: the dashboard offers Force Retry based
on its exact wording, and the server-level tests for the failed-rollback
branches went away with the old gate.

Refs #443
2026-10-07 00:16:36 +08:00
Willie 4c6d152abf refactor(uninstall): run the CLI and dashboard through one operation
The uninstall sequence (move-out check, dirty check, move to trash,
.gitignore cleanup, metadata prune) lived in the CLI and in three
dashboard handlers, and the copies had drifted: three different prune
rule sets, no dirty check on DELETE /api/repos, and no metadata prune
at all on DELETE /api/resources, which left the removed skill's entry
and target overrides in .metadata.json.

internal/uninstall now owns the sequence for resolved items. Callers
keep name resolution, prompts, output, HTTP status and oplog.
MetadataStore.RemoveByNames is the single prune rule set: an entry goes
when it is a removed path or lies below one, by key or by Group, plus
the tracked legacy group of a top-level repo.

Behaviour changes, all intended:
- DELETE /api/repos/{name} refuses a dirty tracked repo, or one whose
  git status cannot be read, with 409 unless ?force=true.
- DELETE /api/repos/{name} refuses a followed link whose folder is
  itself a skill, like every other uninstall path.
- DELETE /api/resources/{name} prunes the skill's metadata.
- Removing top-level "foo" no longer prunes "frontend/foo" (CLI), and
  removing repo "_team" no longer prunes the untracked group "team"
  (dashboard batch); both dropped metadata of skills still installed.

Refs #442
2026-10-07 00:13:47 +08:00
Willie 2edf7649fd refactor(update): update tracked repos through one shared operation
Updating a tracked repo is a fail-closed sequence: check for uncommitted
changes, pull, audit what was pulled, reset to the pre-pull commit when the
audit blocks. The CLI had two copies of the pull flow, the dashboard a third,
and the audit gate existed four times (CLI, dashboard, and two in install).
The copies had drifted: the dashboard ignored a failed git status and never
refreshed root-skill metadata, and each copy worded a failed rollback on its
own.

update.TrackedRepo now owns the sequence and returns a structured result;
install.AuditGate is the only gate. internal/update is a new package because
internal/git already imports internal/install. The CLI keeps its spinner,
rows and the "Apply anyway?" prompt, passed in as one Confirm callback; the
dashboard turns the result into its JSON item.

Behaviour changes, all towards the stricter copy:
- the dashboard reports a failed git status as an error instead of pulling;
- the dashboard refreshes root-skill metadata after an update, like the CLI;
- a prompt that fails rolls the update back instead of leaving it applied;
- the rollback-failed and rollback-unavailable texts come from one place.

Accepted findings stay as they were (CLI honours and records them, the
dashboard does neither), now as the explicit AcceptedFindings input. The
"blocked and rolled back" texts are unchanged per caller because the
dashboard matches on them.

Refs #443
2026-10-07 00:10:54 +08:00
Willie ea83840bae test(update): pin tracked-repo update behaviour of the dashboard and CLI
The dashboard's pull flow for tracked repos had no tests of its own, and the
CLI had none for uncommitted changes. Both flows are about to be replaced by
one shared operation, so their current results are pinned first: clean
update, blocked and rolled back, skip-audit, force not remembering findings,
dirty repos, and the pull error hint.

Refs #443
2026-10-07 00:10:54 +08:00
Willie e8145fb6cf feat(instructions): offer prepend and append for shared files in the dashboard
The AGENTS.md tab and the instructions API only knew import, symlink
and copy, so a tool without @import could hold one shared file and had
to give up its own instruction file to do it.

The mode picker now lists prepend and append first among the modes that
keep the tool's own file, with import; symlink and copy stay blocked
once a target holds another shared file in a managed part. A target
whose file already holds a block defaults the next shared file to
prepend; the first connection keeps the link default the existing
tests and the memory guidance rely on. The row hint says the target
also uses the other files instead of claiming one replaces the other,
and the modified-state note, Collect and Reapply name the block rather
than the whole file, since only the block is read back or rewritten.
The connect and restore previews describe what a block does to the
target file.

Refs #436
2026-10-07 00:04:00 +08:00
Willie 05ff8c675a feat(extras): prepend and append modes for single-file extras
Tools without an @import directive (codex, gemini, cursor) could only
take a shared instruction file as a symlink or copy, which replaces the
target's own file. Teams that want one shared AGENTS.md plus the user's
own notes in the same file had no way to express that.

prepend and append write the source into the target file as a managed
block fenced by skillshare:extra markers that carry the source path and
a content hash. Sync inserts the block once and then rewrites it in
place, status reports modified when the block body no longer matches
its hash, Collect copies the edited body back to the source, Reapply
rewrites the block from the source, and restore removes only the
block. Lines outside the block, and markers inside code fences, are
never touched. Several managed blocks (and an import line) may share
one target file; the connection validator only rejects a file when a
replacing mode (symlink, copy, merge) is involved.

Refs #436
2026-10-07 00:04:00 +08:00
Willie c23daf8ccc refactor(memory): move guidance plan and apply out of the dashboard handler
The guidance rules (status ranking, mixed_modes, multiple_blocks, the plan
token, and check -> backup -> recheck -> write) were methods on *Server, so
they could only be exercised over HTTP with a configured server, and the
recheck after backup depended on callers using the right helper.

internal/memory now owns status, plan, and apply behind GuidanceStatus,
PlanGuidance, and ApplyGuidance. The server resolves targets, assignments,
shared extras, and project reach into a GuidanceInput, syncs shared copies
through a callback after each written file, and maps results to JSON. Only
ApplyGuidance reaches the write steps, so the recheck cannot be skipped.

Note creation and guidance creation shared a copied O_EXCL create with
delete-on-failure; both now use createExclusive. Each keeps its own
behaviour: notes still chmod to 0644, guidance still creates parents.

HTTP routes, shapes, status codes, and error codes are unchanged. The raw
write allowances follow the calls to their new functions.

Refs #450
2026-10-07 00:03:50 +08:00
Willie 1bc009c668 refactor(check): resolve update status in internal/check
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
2026-10-07 00:03:34 +08:00
Willie 1f3e61b830 test(check): pin update-status resolution for the CLI and dashboard
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
2026-10-07 00:03:34 +08:00
Willie 627eecd5e7 fix(dashboard): detect a visible project directory
Two handlers checked for a project's own config by statting
.skillshare/config.yaml directly, so a project created with
init -p --visible (directory skillshare/) was reported as not having
one, and the MCP page missed its override conflict. Both now ask
projectdir.Find, which the CLI already uses.

Refs #437
2026-10-06 22:34:27 +08:00
Willie 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.
2026-10-06 14:18:20 +08:00
Willie 6c9c3f5fce fix(server): roll back the dashboard link when enabling fails
POST /api/source-links with enable: true left the new link in the source
when the config could not be saved, so the dialog reported a failure the
filesystem did not match and a retry failed with "already exists". Share
one sourcelink.Discard rollback between the CLI and the handler.
2026-10-05 23:16:58 +08:00
Willie d6a533d1b6 fix(server): reflect traversal failures on standalone source links
sourceLinks were built before discovery ran, so a target readable at its
root whose subtree failed during traversal stayed available: true with
no warning while sourceLinkWarnings already reported it as incomplete.
Build the items after discovery and treat a recorded skip as unavailable.
2026-10-05 23:01:50 +08:00
Willie 9db36b472a Merge remote-tracking branch 'origin/main' into runkids/419-link-unlink
# Conflicts:
#	internal/server/handler_skills.go
#	skills/skillshare/references/TROUBLESHOOTING.md
#	website/docs/reference/commands/ui.md
#	website/docs/reference/targets/configuration.md
#	website/i18n/ja/docusaurus-plugin-content-docs/current/reference/commands/ui.md
#	website/i18n/ja/docusaurus-plugin-content-docs/current/reference/targets/configuration.md
#	website/i18n/ko/docusaurus-plugin-content-docs/current/reference/commands/ui.md
#	website/i18n/ko/docusaurus-plugin-content-docs/current/reference/targets/configuration.md
#	website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/commands/ui.md
#	website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/targets/configuration.md
#	website/i18n/zh-Hant/docusaurus-plugin-content-docs/current/reference/commands/ui.md
#	website/i18n/zh-Hant/docusaurus-plugin-content-docs/current/reference/targets/configuration.md
#	website/src/data/featureMap.ts
2026-10-05 22:49:25 +08:00
Willie 891c687a47 fix(server): anchor target frontmatter writes to the source
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.
2026-10-05 22:35:00 +08:00
Willie 113d410da7 fix(hub): apply the source follow policy to local discovery
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.
2026-10-05 22:03:47 +08:00
Willie 98300a2eec fix(install): recognize gitdir files as checkouts
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.
2026-10-05 21:53:12 +08:00
Willie e7eecffeab Merge remote-tracking branch 'origin/main' into runkids/274-follow-source-links 2026-10-05 21:32:38 +08:00
Willie 064048da89 fix(server): list files from followed skill roots
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.
2026-10-05 21:31:29 +08:00
Willie e8242affc3 fix(update): exclude followed checkouts from missing repo recovery
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.
2026-10-05 21:22:47 +08:00
Willie 1e7e23f587 fix(ui): keep empty source links available to unlink
Source links disappeared from the dashboard when discovery found no skills, leaving empty or unavailable folders without an Unlink action. Return first-level links independently with their follow-policy availability and preserve their groups in every skills view, including empty unlink confirmations.

Cover empty and dangling inventory, disabled following, and empty-link removal in list, cards, and tree views; document the API field and rendering.
2026-10-05 21:17:30 +08:00
Willie 97446744ff feat(omp): add native Oh My Pi support (#423)
* feat(omp): add native Oh My Pi support

Support OMP skills, instructions, MCP, code hooks and guarded extension selection using its verified native contracts rather than Pi aliases.

Add reviewed marketplace plugin installation, cache-preserving scoped removal and fresh-cache reinstall. Align Pi/OMP extension cards and localize inventory guidance while keeping native ownership and read-only constraints.

Include regression coverage, isolated E2E runbooks, documentation and verification policies. Native plugin updates and unverified runtime platforms remain guarded.

Refs #409

* fix(omp): guard runtime ownership and localize inventory guidance

Native install recursively replaces its runtime destination, and a missing cache manifest could leave the real runtime link installed after removal. Bind and recheck an absent reviewed destination, and recover removal names only from verified scope-local links.

Localize fixed backend reasons and warnings across dashboard locales while preserving paths and external diagnostics. Restore the reviewed source in the existing reinstall fixture and record real native verification.

* fix(omp): allow forgetting natively removed plugins

A different plugin can retain node_modules after native uninstall deletes this installation. When its cache, registration and known runtime state are absent, forget only the stale Skillshare binding instead of demanding runtime-name proof for unrelated files.

Extend the existing removal recovery test with a failing-before-fix case that verifies the binding is dropped and unrelated native lock bytes and plugin files are preserved. make check passes.
2026-10-05 20:36:39 +08:00
Willie cd6e0165dd fix(uninstall): refuse skills at followed link roots
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.
2026-10-05 20:02:58 +08:00
Willie 98ab6eb832 test(source-links): accept Windows junctions in link assertions
Use the existing link detection and target resolution helpers so correct directory junctions pass the source-link core, API, and CLI tests. Accept the Windows junction kind while retaining symlink coverage and target identity checks without platform skips.
2026-10-05 18:27:12 +08:00
Willie 680506b4ff fix(ui): uninstall linked skills individually from detail pages
Share policy-based link identity enrichment between skill list and detail responses. Use that identity in the detail action menu and shared uninstall dialog so followed checkout members keep single-skill confirmation and submit their own flat name.
2026-10-05 18:27:12 +08:00
Willie 3ad3af713f fix(server): resolve uninstall names without basename collisions
Prefer exact skill flat names and reject ambiguous basename fallbacks in both uninstall handlers. Route explicit managed repositories before basename lookup so a followed checkout cannot hijack removal of a root skill or repository.
2026-10-05 18:27:12 +08:00
Willie 6e641dca14 fix(server): restore skills through followed source links
Pass the current global or project follow policy to skill trash restore so the dashboard matches CLI behavior and can restore into followed link targets. Keep disabled-link refusals and agent restores unchanged, and cover both scopes and link naming styles with handler regression tests.
2026-10-05 18:27:12 +08:00
Willie db45b0db06 fix(server): uninstall individual skills from followed links
Resolve followed skills with the discovery policy before applying tracked-repo restrictions or prefix-based batch routing. This lets dashboard uninstall move only the selected skill from a followed checkout while retaining managed-repo protection and logical trash restore paths.

Add single and batch handler regressions for global and project modes, skipped links, and tracked-repo members; document the API behavior.
2026-10-05 18:27:12 +08:00
Willie 370b612f33 fix(ui): simplify followed-folder actions
Keep followed checkout updates in the Updates tab and expose unlink as a single quiet icon in group headers. Remove unused checkout metadata and linked-group menus while preserving the confirmation and single-skill uninstall flows.
2026-10-05 18:27:12 +08:00
Willie 6a358b73a7 fix(ui): move source-link unlink into group menus
Match tracked repository affordances without offering whole-repo uninstall for followed user checkouts. Resolve checkout identity for Update repo, keep linked skill uninstall scoped to the selected skill, and explain target preservation, sync impact, and trash recovery before destructive requests.
2026-10-05 18:27:12 +08:00
Willie 46fd8ef355 feat(ui): unlink followed source folders from the dashboard
Expose policy-resolved first-level link identity on listed skills so linked groups can be distinguished from ordinary folders without another request. Add a confirmation that preserves the target folder and explains trash recovery, then refresh the dashboard after unlinking.
2026-10-05 18:27:12 +08:00
Willie c1ea7e3445 feat(ui): link folders from the skills dashboard
Let dashboard users add local skill folders through the shared source-link guards without creating links by hand. Keep follow_source_links opt-in in the current mode and expose link removal through the API with recoverable trash semantics.

Cover handler behavior, request shapes, dialog errors, and all dashboard locales, and document the endpoints in the API audit topic.
2026-10-05 18:27:12 +08:00
Willie aafb7e7e96 fix(ui): keep followed checkouts out of dashboard updates
Separate user-owned followed Git checkouts into linked_repos in check and resources responses so the Updates tab renders information instead of tracked errors or retry actions. Refuse dashboard updates before Git runs, including force retries and descendant skills, while leaving managed repositories unchanged.
2026-10-05 18:26:12 +08:00
Willie c5c9289781 fix(discovery): surface skipped source link warnings
Keep one follow policy per list and status operation and report its skipped links without hiding healthy inventory. Send JSON diagnostics to stderr and expose sourceLinkWarnings in the dashboard resources response, reusing the sync warning formatter.
2026-10-05 18:26:12 +08:00
Willie 3b898f3730 Merge branch 'main' into runkids/274-follow-source-links 2026-10-05 16:11:45 +08:00
Willie d2b322ed87 fix(server): carry follow policy through skill updates
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.
2026-10-05 15:46:04 +08:00
Willie c9e532a66f fix(source-links): use the server's follow snapshot for collect and keep 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.
2026-10-05 15:40:51 +08:00
Willie 72ed5ba0fb fix(diff): compare extension agent outputs and apply target filters (#414)
* fix(diff): compare extension agent outputs and apply target filters

#392 taught status and doctor to recognise converted extension outputs,
but diff (CLI) and the Sync tab (/api/diff) still compared the target
directory's *.md files against the source name. A target whose extension
renames the output (codex -> .toml) therefore listed every agent as
pending after a sync.

Both diff paths now use the same manifest-based check as status, and
report tracked outputs whose source is gone as prune items. They also
apply the target's include/exclude and the agents' frontmatter targets,
so an agent that sync would skip is no longer shown as pending.

Refs #391

* chore(release): request 0.24.6

The pending feat commits would make Release Please propose 0.25.0. This
batch is meant to ship as the 0.24.6 patch, so ask for that version.

Release-As: 0.24.6
2026-10-05 15:40:19 +08:00
Willie 6bc41d29ec fix(sync): preserve logical identity of followed source links
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.
2026-10-05 14:45:58 +08:00
Willie c0e66720ce fix(source-links): preserve trashed links and resolve audit and hash 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.
2026-10-05 14:45:41 +08:00
Willie a502e9316b feat(sourcefs): write through followed first-level source links
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
2026-10-05 14:42:09 +08:00
Willie 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
2026-10-05 14:26:09 +08:00