Skip to content

feat: add link and unlink for followed source folders - #421

Merged
runkids merged 34 commits into
mainfrom
runkids/419-link-unlink
Oct 5, 2026
Merged

runkids merged 34 commits into
mainfrom
runkids/419-link-unlink

Conversation

@runkids

@runkids runkids commented Oct 5, 2026

Copy link
Copy Markdown
Owner

Closes #419. Stacked on #417 (runkids/274-follow-source-links); merge that first.

What

Adds the two commands that create and remove the link follow_source_links follows, plus the same actions in the dashboard.

  • CLI: skillshare link <path> [--name N] [--enable] [-p|-g] creates a symlink (junction on Windows, no Developer Mode needed) directly under the skills source, named _<folder> by default. It runs the same guards as discovery (source root or parent, overlapping a sync target, unreadable target) and refuses with cannot link <path>: <reason>; --enable turns follow_source_links on. skillshare unlink <name> [-p|-g] moves only the link to the trash, so trash restore <name> undoes it. Both accept -- before a name that starts with -.
  • API: POST /api/source-links ({path, name?, enable?} → {path, target, kind, warning}) and DELETE /api/source-links/{name}; GET /api/resources and the single-skill detail carry linkName/linkTarget, resolved through the follow policy (never by the _ prefix).
  • Dashboard: Link folder on the Skills page (path, optional name with a live preview of the default, and the follow_source_links checkbox while it is off). A linked folder is one group with the link icon, the target path and an icon-only button that turns into Unlink on hover and opens a confirm dialog; the tree detail pane gets a secondary Unlink. Linked groups have no Update repo / Uninstall repo, and the Updates tab leaves them alone (feat: follow first-level source links (follow_source_links) #417).
  • Uninstall / restore inside a linked folder: the single and batch uninstall endpoints and the trash restore endpoint now go through the same follow policy as the CLI, so one skill can be moved out of the user's checkout and back without touching its siblings or the link. Exact flat names win over basename matches, a first-level _repo name is routed as a repo before any basename lookup, and an ambiguous basename is refused.
  • Docs: link, unlink, the dashboard section of ui, configuration, FAQ, quick reference, source-and-targets, the built-in skill, and the four translations.

Verification

  • make check in the devcontainer (unit, integration, UI tests, lint, build) and the five-language website build pass on the rebased head.
  • Replayed against a running dashboard with a fixture checkout: link, unlink + restore, single and batch uninstall of a linked skill, restore of that skill, a root skill sharing a basename with a linked skill (only the root one is trashed), and the detail-page link fields.
  • Windows junction kinds are accepted by the new tests; the Windows runtime path is cross-compiled only, not executed on a Windows machine.

Follow-ups

runkids added 16 commits October 5, 2026 18:27
follow_source_links only follows a link the user made by hand, so the
guards (source or parent, sync target overlap, link chain) surfaced in
doctor only after the link existed, and Windows users had to pick
between a junction and mklink /D themselves.

link checks the prospective target with Follow.Allow, which shares the
guard rules and reason strings with the walk, before creating a junction
on Windows or an absolute symlink elsewhere. It warns when the target is
not a git checkout and leaves follow_source_links alone unless --enable
is given. unlink moves only the link entry to trash, the same way
uninstall removes a first-level link, so the target is never touched and
trash restore undoes it. internal/sourcelink holds both operations so the
dashboard can call them too.

Refs #419
…er action

follow_source_links only follows a link that already exists, and the docs
told users to create it with ln -s or mklink /J. The guards then surfaced
only in doctor, after the link existed. Now that skillshare link checks the
target first and picks a junction on Windows, the docs point at the command
and keep the manual way as a note.

Adds command pages for link and unlink, quick-reference and index rows, the
dashboard Link folder sentence, all four translations, and the built-in
skill guidance.

Refs #419
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.
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.
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.
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.
The unlink icon at rest read as a broken link, not as the linked folder
it marks. Show the link icon and swap to the unlink icon in the danger
color only on hover or keyboard focus, so the row says what it is and
the action appears where the pointer is.
The link icon and the muted target path already say that a group is a
followed link, so the extra `linked` tag only repeated the same fact on
the row. Remove it from the list and card headers, the tree row and the
detail pane, and delete the now unused locale key.
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.
The dashboard section of the ui reference only covered Link folder. Add
the final unlink design so the docs match the shipped UI: the linked
group row, the hover icon button with confirmation, trash restore,
single-skill uninstall inside a link, and the absence of repo actions.
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.
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.
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.
Stop parsing mode and command options after -- so valid link names and relative paths beginning with a hyphen can be addressed. Document the unlink form in every command locale and verify that -g and -p after the terminator remain names.
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.
Replace the removed linked badge description with the link icon, muted target path, and hover or focus unlink icon used by the dashboard. Keep the tree detail-pane behavior explicit.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-05T16:17:28.154261Z 7d5776e Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 53303ebe8a

ℹ️ 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".

Comment thread internal/server/handler_uninstall.go Resolved
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.
The feature map omitted link and unlink, leaving their existing reference pages undiscoverable from the command overview.

List both commands in their workflow groups and derive the displayed total from the current 37 command pages, excluding the reference index.
@runkids

runkids commented Oct 5, 2026

Copy link
Copy Markdown
Owner Author

@codex review

1 similar comment
@runkids

runkids commented Oct 5, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: abbd792299

ℹ️ 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".

Comment thread cmd/skillshare/uninstall_handlers.go Resolved
Comment thread internal/sourcefs/sourcefs.go Resolved
Dry runs returned before the linked-root guard, so text preview claimed a trash move and JSON listed a root-skill link as removed even though real execution refused it.

Run the existing non-mutating move check before either preview and extend the root-link fixture to verify text and JSON refusals without claiming removal.
The linked-root skill guard makes uninstall refuse some first-level links, so generic link-removal instructions could direct users to a command that fails.

Point configuration, FAQ, unlink reference, and built-in skill guidance to unlink or the dashboard Unlink action, preserving target folders for checkout and root-skill links across all five documentation locales.
@runkids

runkids commented Oct 5, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3265259d1a

ℹ️ 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".

Comment thread internal/server/handler_source_links.go Resolved
Comment thread internal/server/handler_skills.go Resolved
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.
… into runkids/419-link-unlink

# Conflicts:
#	internal/sourcewalk/follow_test.go
#	skills/skillshare/references/TROUBLESHOOTING.md
@runkids

runkids commented Oct 5, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a280a20f8c

ℹ️ 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".

Comment thread cmd/skillshare/link.go Resolved
Comment thread ui/src/pages/ResourcesPage.tsx Resolved
@runkids
runkids changed the base branch from runkids/274-follow-source-links to main October 5, 2026 14:48
# 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
@runkids

runkids commented Oct 5, 2026

Copy link
Copy Markdown
Owner Author

@codex review

macOS temp directories live under /var, a symlink to /private/var, so
EvalSymlinks on the created link returns the /private form while the test
compared it with the raw t.TempDir() path. Canonicalize the expected path
as well so the integration test passes on macOS runners.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9db36b472a

ℹ️ 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".

Comment thread internal/server/handler_skills.go Resolved
link --enable created the link, logged success, and only then wrote the
config; a failed config write left a link discovery ignores behind a
logged success, and a retry failed with "already exists". Enable before
logging and remove the fresh link when enabling fails so the command,
the filesystem, and the operation log agree.
Standalone source links were added to every grouping regardless of the
active search or filters, so a query that matched nothing rendered the
links as zero-skill groups instead of the no-match state with its Clear
filters action. Links have no skills to match, so they are shown only
while no filter is active.
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.
@runkids

runkids commented Oct 5, 2026

Copy link
Copy Markdown
Owner Author

@codex review

The write ratchet flags raw os writes below the skills source; the
rollback added for a failed --enable removed the fresh link with
os.Remove. Go through sourcefs.Unlink so only the link entry goes and
the boundary stays enforced.
@runkids

runkids commented Oct 5, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 294c332484

ℹ️ 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".

Comment thread internal/server/handler_source_links.go Resolved
Comment thread wiki/cli-development.md Resolved
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.
The developer rule still equated Remove with uninstall <link>, which is
refused when the linked folder itself is a skill.
@runkids

runkids commented Oct 5, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 294c332484

ℹ️ 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".

Comment thread internal/server/handler_source_links.go Resolved
Comment thread cmd/skillshare/uninstall_handlers.go Resolved
A followed checkout whose root is a skill is classified as a tracked
repository, so a dirty checkout hit the uncommitted-changes preflight and
was told to retry with --force before the linked-root guard ran. Run the
guard right after target validation for every mode so the answer is always
"use unlink".
@runkids

runkids commented Oct 5, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1f4a466eed

ℹ️ 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".

Comment thread cmd/skillshare/link.go Resolved
…ame values

link -h loaded the config first, so it failed with "config not found"
without one and, with --project, could create .skillshare files just to
print help. Detect help among the option arguments before loading the
scope. Pass --name as a value flag to parseModeArgs so "--name -g" no
longer selects global mode (#422).
@runkids

runkids commented Oct 5, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@runkids
runkids merged commit e26dc06 into main Oct 5, 2026
8 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7d5776ef79

ℹ️ 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".

Comment thread cmd/skillshare/link.go

func cmdLink(args []string) error {
start := time.Now()
if wantsHelp(optionArgs(args)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Skip --name values when detecting help

When the requested link name is -h or --help, this pre-scan mistakes the value of --name for an actual help flag and exits successfully without creating the link. Both names pass sourcelink.checkName, and the later parser accepts option-looking --name values (as it now does for -g and -p), so help detection should skip the token following --name while still handling genuine help before loading the scope.

Useful? React with 👍 / 👎.

@runkids
runkids deleted the runkids/419-link-unlink branch October 6, 2026 03:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add skillshare link / unlink to create and remove followed source links

1 participant