Commit Graph
339 Commits
Author SHA1 Message Date
Willie 5dfd63d5e9 fix(sync): fail only the target whose config is invalid
Any per-target config problem, such as a skills path that is a file or
an unknown mode, made `skillshare sync`, `sync -p` and the dashboard
refuse to sync anything. That contradicts the policy that sync runs
every target and reports the ones that failed. Sync now validates the
config as a whole first and still stops on global problems (source,
global mode or naming, git_root, extras); a target whose own settings
are invalid is skipped for skills and agents and reported as failed
("invalid config" in CLI output and --json details, part "config" in
the dashboard's failed list). Config validation on save is unchanged.
2026-09-30 03:27:20 +08:00
Willie d6960e46a7 fix(sync): count agent failures in the sync operation log
The log counted only skills targets as failed. The CLI wrote its sync
entry before `sync --all` ran agents, `sync agents` logged empty stats,
and the dashboard left agent failures out of targets_failed, so a run
that lost a target's agents still read "ok" and Last sync could not
say what failed. CLI and dashboard now log once after every part ran:
targets_failed counts each failed target once, the new failed_targets
lists their names, and targets_total is every target in scope.
2026-09-30 03:25:26 +08:00
Willie cf12f33eff feat(ui): list failed sync targets apart from warnings
A dashboard sync that lost a target reported it only as a warning
string, next to backup notes and prune hints, under a "Sync complete"
toast, so a partial failure was easy to miss and nothing said how to fix
it. The sync API now returns a "failed" list (target, part, error, the
matching warning text, and whether a symlink conflict caused it);
"warnings" is unchanged. The Sync page shows failed targets first with
their part and error, offers Turn on Force for a symlink conflict,
marks the target in the change list, and toasts a warning instead of
success.
2026-09-30 03:08:55 +08:00
Willie 36a314442b refactor(server): decode JSON request bodies through one size-limited helper
About 57 handlers decoded request bodies with no size limit, and the few
that had one each picked their own. They now go through decodeJSON with a
1 MiB default; handlers that need more keep their larger limit. An
oversized body gets 413 instead of whatever the handler returned for bad
JSON (MCP and plugin requests used to answer 400). Every other decode
error keeps the handler's existing status and message.
2026-09-30 02:25:42 +08:00
Willie 018bf96dc0 test(server): cover agents-extras overlap skip in project mode
The skip added in b062a113 was only tested in global mode, where agent
target paths are absolute. Project mode resolves relative paths against
the project root, so it gets its own test.
2026-09-30 02:21:11 +08:00
Willie 035ab61859 fix(sync): count extras target failures in sync --all and the Web API log
`sync extras` already exits non-zero and logs "partial" when a target
fails, but `sync --all` only printed a warning and exited 0, and its
--json path ignored extras errors entirely. The Web API always logged
"ok". Both now follow the CLI: `sync --all` exits non-zero on an extras
failure in text and JSON, global and project, without holding back MCP;
the Web API oplog records the error count with status "partial", or
"error" when every target that ran failed. The HTTP status stays 200.
2026-09-30 02:11:01 +08:00
Willie b76375dab5 refactor(sync): share the per-target skills sync step between CLI and server
After the server fixes, the CLI's collect*SyncResult functions and the
Web API loop ran the same merge/copy/symlink and prune logic twice. Both
now call sync.SyncSkillTarget and only render its result: the CLI keeps
its parallel grouping and progress output, the server stays sequential.
The stats helpers this orphaned are removed.

The server's "pruned" list is now always an array; it could be null
when a prune removed nothing.
2026-09-30 02:08:24 +08:00
Willie b062a11322 fix(server): skip extras targets that the agents sync manages
The CLI skips targets of the "agents" extra whose path the agents sync
already writes to, so the two syncs do not fight over the same folder.
The Web API synced them anyway. It now builds the same set of agent
target paths and marks those targets with skipped_by "agents", the CLI's
JSON field name; existing response fields are unchanged.
2026-09-30 02:07:22 +08:00
Willie b62faeed60 fix(sync): skip extras whose source directory is missing
Global sync created a missing extras source, project sync and `sync
--all` skipped it, and the Web API created it while ignoring any
MkdirAll error. Creating an empty source only hides a misconfigured path,
so every caller now skips the extra and tells the user to create the
directory. The Web API reports the hint in a new per-extra "warnings"
field; existing response fields are unchanged.
2026-09-30 02:05:34 +08:00
Willie 57919f1b6c fix(server): refuse to replace a conflicting skills symlink without force
In symlink mode the Web API called SyncTarget directly, so a target
symlink pointing somewhere else was handled differently from `skillshare
sync`: no conflict message, and force had no effect. It now checks the
link first like the CLI. Without force the target fails with "conflict -
symlink points to X (use --force to override)" and counts as a failed
target; with force the link is replaced.
2026-09-30 02:04:46 +08:00
Willie 553e42811a fix(server): report skills prune failures and warnings
The Web API dropped the error from pruning orphaned skills and never
passed on the prune's own warnings, so a dashboard sync could leave stale
entries behind with no sign of it. It now reports them the way the CLI
does: "<target>: prune failed: <err>" followed by the prune warnings.
2026-09-30 02:03:33 +08:00
Willie 191bdec33f fix(server): keep syncing skills targets after one fails
The Web API returned 500 at the first skills target that failed, so
every target after it was left unsynced and agents, extras and MCP never
ran. It now follows the CLI: the failing target becomes a
"<target>: sync failed: <err>" warning, the rest still sync, and the
oplog records the real targets_failed count with status "partial". When
every skills target fails the request is still an error, so single-target
setups keep seeing one.
2026-09-30 02:01:02 +08:00
Willie dc255a6f36 refactor(sync): share the extras per-target loop between CLI and server
Global sync, project sync, `sync --all` and the Web API each carried a
copy of the extras target loop, and the server inlined its own mode
switch. All four now call sync.RunExtraTargets, and the TUI calls the
exported sync.SyncExtraTarget.

This is a pure refactor. The caller differences (missing-source policy,
agent-overlap skip, path resolution, error precedence) are options on
the runner, and characterization tests pin them so the follow-up fixes
show up as deliberate test changes.
2026-09-30 02:00:42 +08:00
Willie 47a6a17a69 refactor(sync): share the agents sync loop between CLI and server
The CLI and the Web API each carried their own filter, sync or transform,
then prune loop for agents, and the copies had started to drift. Both now
call sync.RunAgentSync and render its per-target results as before.

This is a pure refactor: characterization tests pin the server's 200 with
warnings on a per-target failure, the CLI's non-zero exit, the server's
silent skip of targets without an agents path, and the merge of agent
lists into the skills row. Prune errors are now returned in the result
but still ignored by both callers; surfacing them is a separate fix.
2026-09-30 01:56:07 +08:00
Willie 115236a6fb fix(server): use token auth when checking default-branch skill remotes
The dashboard check fetched the remote HEAD without credentials when a
skill had no pinned branch. Private repos therefore reported an error in
the dashboard while the CLI check, which uses
GetRemoteHeadHashWithAuth, succeeded. The pinned-branch path already
used auth, and the default-branch path now matches it.
2026-09-30 01:44:50 +08:00
Willie 6a325037f2 refactor(server): share the skills config reconcile step
Install, batch install, tracked-repo install, uninstall and rehydrate
each repeated the same nine-line block to reconcile the project or
global skills config. reconcileSkillsConfig now holds that block, so a
change to reconcile behavior or logging is made once instead of five
times. Each caller still passes its own source directory, so behavior
is unchanged.
2026-09-30 01:35:10 +08:00
Willie 20ae89a838 fix(server): stop dropping git and metadata errors in check, uninstall and batch targets
The dashboard check reimplemented the CLI's per-repo check but fetched
without the HTTPS token and ignored git status errors. Private tracked
repos could fail in the dashboard while `skillshare check` worked, and a
repo whose status could not be read showed as up to date. Both check
endpoints now call check.ParallelCheckRepos, the same code the CLI uses.
The JSON and SSE response shape does not change.

Batch uninstall treated a failed dirty check as clean and moved the
repo to trash. Without force, that item now fails with the git error
instead. This is stricter than the CLI, which only warns and continues.

Batch target updates ignored metadata save failures and still reported
success, so an override could silently disappear on the next reload.
They now return 500.
2026-09-30 01:34:58 +08:00
Willie 8cfeae1e7c fix(sync): translate the path overlap warning and link to Health Check
The server put a fixed English sentence into the sync warnings, so the
dashboard showed it untranslated in every locale. The sync response now
reports the overlap as a path_overlap count, and the dashboard renders
it from the locale files with a button that opens the Health Check page.
The pull flow keeps the English sentence because it only shows raw
warning strings.
2026-09-30 00:25:01 +08:00
Willie 10466f2d53 fix(server): report one target per tied sync budget warning
When several targets tied for the worst context cost, the warning joined
their names but listed top offenders from whichever target was seen
first, so the offenders could belong to a different target than the
one a reader looks at. Map iteration order also made that choice
random.

Ties now resolve to the alphabetically first target, and the warning
carries that target's own offenders. The test gives each tied target a
different skill so a mismatch between target and offenders shows up.
2026-09-30 00:24:51 +08:00
Willie 8962ed9416 fix(server): name the target in sync budget warnings
Context-cost warnings in the Web API's sync response never carried a
target name: the warning struct tracked the worst token totals across
targets but dropped which target hit them. The CLI's sync --json and
the dashboard's ContextCostWarning both include target, so the
dashboard's i18n string rendered its {target} placeholder verbatim
instead of the target's name.

computeContextCost now records the names behind the worst always-loaded
and on-demand totals, joining ties with a comma, and reports them as
the warning's target. Regression tests cover both the tied case and a
worst-offender that only one target receives.
2026-09-29 23:30:21 +08:00
Willie fd3bc824f3 feat(targets): edit other files a target's tool reads from its page
Pi and OMP read APPEND_SYSTEM.md next to their skills, and editing it
meant leaving the dashboard. A target page now shows extra file tabs:
built-in ones come from targets.yaml `files:` (APPEND_SYSTEM.md for pi
and omp), and users can add their own, including files in subfolders.
Paths stay inside the tool's folder; three tabs show and the rest move
to a menu. "Share with Extras" opens Add extra prefilled with the file's
folder and name, so the same file can be shared across tools.

A single-file extra's name now defaults to its file name without the
extension (APPEND_SYSTEM.md -> APPEND_SYSTEM) until the user types one,
and the hint suggests the file name, as the #300 reporter asked.

Refs #301
Refs #300
2026-09-29 15:25:06 +08:00
Willie e48784f16b feat(sync): name targets that sync one folder with different filters
When two targets sync skills into the same folder with different include
or exclude filters, each sync adds what one wants and prunes what the
other filters out, so the folder never settles and sync keeps showing the
same changes. The only hint was a vague overlap count.

sync, doctor and the dashboard's Sync page now name the targets and the
folder, and suggest turning skills off for all but one (universal when it
is among them) instead of removing a target. The Sync page offers the
existing stop-syncing dialog in place. Targets with identical filters are
not reported.
2026-09-29 11:45:48 +08:00
Willie d757afbb61 feat(extras): let several single-file extras share one source folder
A single-file extra added from the dashboard with the shared source got
<extras dir>/<name> as its folder, so a second file in the same folder
needed the same name and was refused as a duplicate. Project mode had no
source setting at all, so it could never share a folder.

The add dialog now has a source folder field that defaults to the name,
and project extras accept a source relative to the project root, from the
dashboard and from `extras init -p --source`. Paths shown for single-file
extras also keep the folder's own separator, so Windows paths no longer
mix backslashes with a slash before the file name.

Refs #300
2026-09-29 09:43:29 +08:00
Willie e0882217ab feat(targets): list copy-mode copies apart when skills are switched off
Switching skills off keeps copy-mode copies, since they are real folders the
user may have edited, but they were listed as the user's own items. The tool
still loads them next to wherever it now reads skills from, so each skill
shows up twice. The CLI, the preview and the dashboard dialog now list them
separately and say to delete them if the tool reads the same skills
elsewhere, leaving that choice to the user.
2026-09-29 05:13:06 +08:00
Willie 46b23cd2ad feat(targets): let a target keep its instructions with skills switched off
Some tools only need skillshare for AGENTS.md, MCP or agents, while their
skills folder is managed elsewhere or shared through another target.
Syncing skills into those folders duplicated what the tool already reads,
so a target can now turn skills off (`target <name> --no-skills`, the
dashboard switch) and sync, diff, status and doctor skip its skills.
Switching off warns about the other tools that read the same folder.

The target list also gains tools that were missing, with colored vendor
logos where their licenses allow it, and zencoder/replit default paths
follow their current documentation.

The dashboard's target pages get the matching UI: universal is pinned as
the shared folder when adding a target, the add dialog lists what will be
written, and the AGENTS.md tab shows where the file comes from in one card
with an in-place switch between shared files.
2026-09-29 04:51:24 +08:00
Willie 00f51adbda feat(extras): create and manage single-file extras from the CLI and dashboard
Single-file extras (file + per-target as) already worked in the sync
engine, but the only way to create one was editing config.yaml or the
dashboard's AGENTS.md tab, so they looked like an AGENTS.md-only feature.
Syncing a file such as Pi's APPEND_SYSTEM.md required hand-written config.

- extras init gains --file and --as; the init TUI asks Folder or Single
  file. Validation runs before anything is written, and init neither
  creates the source file nor syncs.
- extras list and add-target show the full source and target file paths.
- POST /api/extras accepts file and per-target as, with the same
  connection checks as add-target.
- The dashboard's first Extras tab becomes "Folders & files" and lists
  every extra except AGENTS.md files; Add extra can create a single file
  with a per-target file name.
- Assigning shared AGENTS.md files now only attaches or detaches AGENTS.md
  extras. Before, saving on the AGENTS.md tab restored and removed any
  other single-file extra linked to the same instruction file.

Refs #300
2026-09-29 00:27:48 +08:00
Willie 13a93242f8 feat(ui): redesign the Hubs page around one list with in-place editing
Previewing a hub from the builder landed on an empty "pick a hub" state:
the builder and the browser kept separate copies of the drafts and the
browser's copy went stale. Merging both into one page removes the split,
so your own hub is shown exactly as others will see it and edited in place.

Hub entries can now be added from any repository URL, not only from
installed skills, with a branch or tag picked from the remote. The version
is written into the source URL, the only place the hub format keeps it,
and a new /api/hub/refs endpoint lists refs and rewrites sources so the UI
never builds tree/<ref> URLs itself. Skills added from installed ones keep
the version they were installed from.

Draft reads and saves read refs from the URLs only, so opening a hub never
waits on a remote. Added hubs get unique labels, since the default hub is
stored by label.
2026-09-28 23:39:19 +08:00
a352b8d243 feat(install): pin skills to a tag or commit from their web URL (#293)
* feat(install): pin GitHub tree/blob URLs to their ref

Hub entries only carry a source URL, so a team hub had no way to pin a
third-party skill to a reviewed tag or commit. The parser already read
tree/<ref>/ and blob/<ref>/ URLs but discarded the ref, installing from
the default branch instead of the version the URL names.

Keep that ref as Source.Branch. An explicit --branch (CLI) or branch
(API body) still overrides it; the server handlers now only override
when a branch is given. Batch installs group by repo and ref so two
pinned versions of one repo get separate clones.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* docs(install): describe pinning hub sources to a tag or commit

Explain that a GitHub tree/<ref>/ source URL pins the install, in both
the hub index guide and the install reference.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* feat(install): pin GitLab/Bitbucket URLs and resolve refs containing "/"

Pinning should not depend on the host, so GitLab (-/tree/<ref>/) and
Bitbucket (src/<ref>/) web URLs now keep their ref too.

Taking the first path segment as the ref broke branch names containing
"/": tree/feature/x/skills/foo cloned branch "feature" and failed. When
the first segment is not a branch or tag on the remote, the longest
matching one is used instead. A ref the remote does not have fails
with a hint to use --branch, rather than silently installing the
default branch. A saved branch that covers more of the path (from
--branch or config) moves the subdir without asking the remote.

The grouped-install round-trip test pinned -/tree/main/ against a repo
on master; the ref used to be ignored, so its branch is now renamed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* docs(install): cover GitLab, Bitbucket and "/" branches in URL pinning

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(install): keep web URL refs correct on reinstall, --branch and grouping

Review of the slash-branch resolution found four gaps:

- A saved branch equal to the whole URL tail (tree/feature/x) did not
  move the subdir back, so every reinstall or update looked for "x".
- An unrelated --branch with a slash-branch URL kept the parse-time
  subdir (x/skills/foo) instead of the URL's real one.
- Grouped installs copy the source to a repo root; resolution then put
  the subdir back and discovery looked under a doubled path. Grouping
  also keyed on the unresolved first segment, so tree/feature/x and
  tree/feature/y could share one clone. Web URLs with a ref now install
  on their own, and resolution leaves a repo-root copy at its root.
- A skill named after the parse-time subdir kept that name once the
  path turned out to be all ref (tree/feature/x named the skill "x").

The unknown-ref error now reads as a missing ref first, since a stale
ref (tree/master after a rename) is more common than a slash branch.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(update): keep legacy installs on the default branch

Skills installed before URL refs were honoured got the default branch
and recorded no branch. Single-skill update re-parses the recorded
source, so it moved them to the URL's ref (or failed on a stale one,
with a hint to pass --branch, which update does not accept), while
update --all rebuilds from RepoURL and kept the default branch.

ApplyRecordedBranch treats an empty recorded branch as the remote
default and drops the URL's ref. It replaces the branch handling at
every site that reinstalls from recorded metadata: CLI and server
update for skills and agents, and tracked-repo rehydration.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* perf(search): share one clone across pinned hub skills from a repo

Any web URL with a path after its ref installed on its own, so a hub
listing many tree/<tag>/ skills from one repo cloned it once per skill.

groupByRepo now resolves each URL's ref before grouping, with a
RemoteRefs cache that lists each remote's refs once, and groups by
repo and resolved ref. Only refs containing "/" (whose subdir the
discovery match cannot re-derive) and refs that fail to resolve still
install alone. A resolved source is marked settled so the grouped
clone does not resolve it again, and ApplyRecordedBranch settles the
subdir from a recorded branch without asking the remote.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Willie <egg358358@gmail.com>
2026-09-28 22:08:16 +08:00
Willie d572ba3b32 perf(backup): walk each snapshot once when listing backups
The list endpoint walked every snapshot to size it, then walked all of
them again for the total. With thousands of files and a cold file cache
(right after an upgrade, for example) the Backup page took visibly long
to open.

Each snapshot folder is now walked once for both its size and file
count. Backup and total sizes are sums of those, and the per-folder
counts are returned as `entries` so the dashboard can show what each
folder holds.
2026-09-28 21:51:11 +08:00
Willie 86dca7924f feat(backup): browse and restore file history, delete snapshots
skillshare backs up AGENTS.md, CLAUDE.md and shared-file locations before
rewriting them, but nothing could list or restore those copies, and a
target snapshot could not be deleted on its own. The file backups now
record why they were taken in their name (<time>.<reason>.bak; older ones
have none), and the server and CLI can list them, show a version and
restore it, saving the current content first. A link is only replaced
when the caller asks for it.

Also:
- DELETE /api/backups/{timestamp} and `backup --delete`.
- Agents snapshots (<target>-agents) could not be restored from the
  dashboard: the name was looked up as a target.
- Project mode uses the project's backups folder for snapshots and lists
  only file backups inside the project.
- MCP backups report which servers they changed and when.

Refs #299
2026-09-28 19:23:16 +08:00
Willie 342fac7691 feat(server): serve shared files and their locations in project mode
In a project, single-file extras were only reachable through the folder
extras API, which has no file name, no import mode and no immediate
sync. The dashboard now shows them on the AGENTS.md tab like global
shared files, so the instructions routes it needs must work in project
mode: list, create, content, resolve and the locations routes.

A project location must stay inside the project (absolute, ~ and ..
paths are refused with instructions_location_outside_project) and is
stored relative, so a clone keeps working. A tool's own file is a valid
location in a project, so the is_target check is skipped there.

Refs #299
2026-09-28 18:40:15 +08:00
Willie 0bbcbd7d54 fix(server): settle and roll back instruction locations
A location whose file was edited outside skillshare had no way to collect
or reapply, and a location whose config save failed stayed written on
disk. Resolve now takes a location path, and a failed save restores
what the file held; a failed reload keeps the saved location.

Refs #299
2026-09-28 17:41:33 +08:00
Willie 04485099ed feat(server): add locations API for shared instruction files
The dashboard could only attach a shared AGENTS.md to known tools, while
the CLI's --add-target/--as already writes it to any folder under any
name. Add list/add/mode/remove/restore-preview routes for such locations,
syncing a new location right away and refusing folders in the way, tool
files and files held by another shared file. The extras add-target route
now accepts as and runs the same config validation as the CLI.

Refs #299
2026-09-28 17:30:41 +08:00
Willie 7baf716c63 feat(instructions): translate dashboard warnings and errors
Mode changes, attach and the other AGENTS.md actions returned English
sentences, so a zh-TW dashboard showed "backed up ... before replacing
it" and "... is a directory" untranslated. Warnings are now
{code, params, message} and every instructions error carries a code,
so the dashboard shows them from i18n and falls back to the English
message for unknown codes. CLI output is unchanged.

Also from the Windows re-test:
- replacing a user's junction says so and where it pointed;
- status, doctor and sync agree on identical unowned copies (kept, not
  linked), and an identical copy no longer suggests --force;
- the targets list shows a Developer Mode tooltip when file links are
  unavailable;
- file names are taken from Windows paths too.

Refs #299
2026-09-28 16:12:59 +08:00
Willie 87e6cc9538 fix(extras): guard shared-file ownership and keep user files on restore
Exploratory CLI, dashboard and real-Windows testing of single-file extras
found paths that corrupted another shared file, lost user content, or
reported the wrong state.

- One shared file per link/copy target is now enforced in config
  validation, so the CLI, sync and API all refuse it; an import is never
  written through a link into another shared file (409
  instructions_target_held in the API).
- Restore recreates an original Windows junction as a junction, which
  needs no privilege, and remove restores before saving config so a
  failed restore no longer orphans the record.
- Imports into dotfiles links, damaged managed blocks, repointed links
  and CRLF files keep the user's content; project imports use paths
  relative to the file so a moved repo keeps working.
- Mode and assign responses carry sync warnings; dry-run says when an
  edit would be backed up; invalid modes no longer show as healthy.
- An edited copy reports modified, identical unowned copies count as
  synced without being owned, and relative project links no longer show
  drift.
- sync extras --json exits non-zero on errors; extras <name> --help
  works; --add-target gains --as; detach messages match behavior.

Refs #299
2026-09-28 15:27:02 +08:00
Willie f307c8a114 fix(sync): keep user files safe in copy fallback and mode switches
Review of the file-link fallback found paths that lost or misreported
user data:

- An identical local file was adopted as a skillshare copy and later
  pruned without backup. Only files sync writes are tracked now.
- Clearing all own text in import mode was treated as no record, so
  switching back resurrected the attach-time content.
- The mode API saved the new mode and returned success when a directory
  blocked the sync; it now keeps the old mode and returns 409.
- Restore preview promised a delete for files restore leaves alone; both
  now share one ownership decision.
- Prune forgot ownership even when removing the copy failed.

Refs #299
2026-09-28 14:27:53 +08:00
Willie c6ec545e96 feat(instructions): update copies when a shared file is saved
Saving a shared AGENTS.md in the dashboard only wrote the source, so every
target in copy mode (including the Windows copy fallback) kept the old
content until someone found the sync button. Saving now rewrites that
file's copy targets through the regular extras sync, so an edited copy is
still backed up first, and the toast names the copies it updated. Link and
import targets already read the source and are left alone.

Refs #299
2026-09-28 14:08:46 +08:00
Willie 88f5201911 feat(instructions): choose sync modes, preview restores, and move files
The AGENTS.md tab picked each target's mode for the user (import where
supported, a link elsewhere), which left Windows users without Developer
Mode no way out of a broken link and gave no copy option. Restore replaced
a file without showing what would come back, and only custom tools could
change which file a target reads.

- Each connected target gets a mode picker (import, symlink, copy); symlink
  is unavailable when the machine cannot create file links, and a target
  whose file is a folder link says so.
- Restore opens a preview of the file after restore and its diff.
- Every supported target can change its file location and name in a
  dialog, with reset to default.
- The target file tab is a single column with the read order on one line,
  a tinted managed import block, soft wrap, and an edit/preview switch;
  universal lists the files of the tools that read its skills.
- The convert dialog shows only the methods that apply and a ready preview.

Refs #299
2026-09-28 13:55:51 +08:00
Willie c7eb59a78f fix(sync): stop linking single files with junctions on Windows
createLink always tried `mklink /J` first. mklink does not check the
source type, so agents, single-file extras such as a shared AGENTS.md, and
per-file extras links became directory junctions that point at a file:
Explorer shows a folder and tools cannot read it. Sync then compared only
the link destination and kept the broken junction forever.

Files now get real symlinks only. When the OS cannot create them (Windows
without Developer Mode, non-elevated), file-based link modes fall back to
copies at the mode level, so status, doctor, the API and later syncs all
see an effective `copy` mode. Fallback copies are tracked by hash so they
keep updating and pruning without touching the user's own files, and turn
back into links once links work. Single-file extras remember what they last
wrote, so an unedited copy is replaced silently instead of producing a
drift backup on every source edit, and switching a target back to import
restores the user's attach-time content plus the import block.

Includes a Windows runbook and script, verified on a Windows 11 ARM64 VM
with and without symlink rights.

Refs #299
2026-09-28 13:54:52 +08:00
Willie 97499ebcc4 fix: recognise Windows junctions wherever links are detected
Since Go 1.23, os.Lstat reports NTFS junctions as irregular files instead
of symlinks (winsymlink, active for go 1.25 in go.mod). Every check that
looked only at os.ModeSymlink therefore missed the junctions skillshare
itself creates on Windows: linked skills could be treated as local folders,
backed up, copied through, or left behind on prune.

Detect links through utils.IsLinkMode, which also asks the OS about the
reparse tag of irregular entries, and count only real symlinks and
junctions as links so OneDrive placeholders and deduplicated files stay
regular files. restore.go also used os.Stat for its link check, which
follows the link and never matched.

Refs #299
2026-09-28 13:53:16 +08:00
Willie daf77b037f fix(target): keep skills another target still syncs when removing one
Codex and universal both write to ~/.agents/skills. Removing one of them
unlinked that folder, turning the other's synced skills into local
copies it no longer managed. Removal now leaves the folder alone while
another remaining target uses it, in the dashboard, the CLI, the TUI and
the dry-run preview.
2026-09-28 01:58:29 +08:00
Willie ad3d84b76a feat(instructions): manage the files of tools that read universal's skills
With only universal configured, tools such as Codex, Gemini CLI and Pi
still read skills from ~/.agents/skills, but none of them reads
~/.agents/AGENTS.md, and their own instruction files had no page and
could not take a shared AGENTS.md. Universal's AGENTS.md tab now offers
the installed ones in a dropdown, and the shared AGENTS.md list includes
them. A tool is listed once per file and disappears when it becomes a
target of its own.

Cline and the Warp Agent CLI read ~/.agents/AGENTS.md itself, per their
docs, so they now share universal's file.
2026-09-28 01:36:42 +08:00
Willie c25eb4f708 fix(plugins): open managed plugins from their snapshot and explain slow reads
Opening a plugin cloned its whole source again to learn which Agents
can take it, which took tens of seconds per row. A managed plugin
already has a reviewed snapshot; it answers when its digest still
matches, and the network is used only otherwise.

A failed clone said only that git failed. Git's output is sorted into
an unreachable source or a missing one without passing it on, since it
can hold credentials. The dashboard translates those, notes when a read
or an Agent's CLI is slow, and says when the browser is offline.
2026-09-27 23:03:21 +08:00
Willie ad34dbde2d fix(server): load the dashboard when opened at a nested route
The build links its files as ./assets/..., so a page reloaded at
/targets/claude asked for /targets/assets/... and got index.html back.
The browser refused the chunks as text/html and the page stayed on its
skeleton. The server now injects a <base> for the base path.
2026-09-27 23:03:21 +08:00
Willie 86fb63fd4b docs: document sharing AGENTS.md from the dashboard
The shared AGENTS.md workflow is dashboard-only, so users had no written
reference for how shared files attach, what restore puts back, or where
drift backups go. Adds a how-to page in every locale, documents
single-file extras and the target `instructions` key, and brings the
translated extras collect section up to date with English.
2026-09-27 04:17:41 +08:00
Willie b8291895e1 feat(ui): share one AGENTS.md across tools from the dashboard
Claude Code now reads AGENTS.md, but every tool still keeps its standing
instructions in its own file (CLAUDE.md, GEMINI.md, AGENTS.md), and Claude
has no user-level AGENTS.md at all. Keeping several tools on the same
instructions meant copying text between those files by hand.

Each target page gets a tab named after the file it reads, with its read
order, an editor, and a convert flow from CLAUDE.md to AGENTS.md. In global
mode the Extras page gets an AGENTS.md tab where several shared files can
coexist and each target picks one or keeps its own. Shared files are
single-file extras: tools that follow @imports get a managed import block
and keep their own lines, others get a link in place of their file.
Projects get small shims instead, since every tool there reads ./AGENTS.md.
Custom targets can declare which file they read.

Restore records the target's state when it is first attached (file,
symlink, or no file) and always returns to it. Edits made after attaching
are kept as drift backups instead of becoming the restore point, so sync,
reapply and mode switches can no longer lose the user's original file.
2026-09-27 03:02:51 +08:00
Willie 9dab28fc19 fix(git): undo a pull's partial checkout and explain permission errors
When git cannot finish a pull's checkout (for example, it may not unlink
a root-owned file), it stops without undoing the files it already wrote,
and with no MERGE_HEAD there is nothing for merge --abort to undo. The
remote's copies then showed up as local changes: the dashboard blocked
the next pull and suggested committing them, which would push the stale
remote content back as a new commit.

A failed pull now restores paths that were clean before it started and
now hold exactly the upstream version, leaving the user's own edits
alone. The dashboard reports permission failures with a
permission_denied code and shows the chown command that gives the
source folder back to the current user.
2026-09-27 02:10:12 +08:00
Willie 779ec26ff5 fix(upgrade): elevate only the binary replacement with sudo
When the binary lived in a root-owned directory, upgrade re-ran the whole
command under sudo. The built-in skill download, UI asset cache, and oplog
then landed in the user's home as root-owned files, and a later git pull
of the skills source failed with "unable to unlink old
'skillshare/SKILL.md': Permission denied".

The sudo child now only receives an internal --replace-binary=<version>
flag that downloads and swaps the binary. The parent waits for it and
does everything else as the invoking user. The needs-password hint shown
by the CLI and dashboard drops its sudo prefix, since a fully root
upgrade reproduces the same breakage.
2026-09-27 02:10:00 +08:00
Willie 5dd83a8412 fix(server): guard metadata store access against concurrent requests
Every API request reloads the skills and agents metadata stores and
swaps the server's pointers under s.mu, but several handlers read or
wrote the stores outside that lock: listing, skill detail, check, the
update stream, and the hash refresh after setting targets. Concurrent
requests could race on the pointer or on the stores' maps, which the
race detector reported hundreds of times under load and which can
crash the server with a concurrent map access.

Store access now always happens under s.mu. Reads return a copy of
the entry so it can be used after unlocking, and target handlers hash
files outside the lock and only write the result under it.
2026-09-26 21:12:57 +08:00
Willie bc01ff1b3e feat(server): let tracked-repo skills take dashboard targets
Setting targets on a skill inside a tracked repo used to be refused,
because writing its SKILL.md leaves the clone dirty and `update` then
skips the repo (or `--force` throws the setting away).

Store those targets in the source's .metadata.json instead, keyed by
the skill's path, and apply them at discovery over the frontmatter.
The clone stays clean, `update` keeps working, and the setting survives
it. Uninstalling a repo or skill drops its entries.

Overrides are saved in the same lock section that writes them: every
API request reloads the store from disk, so saving after unlocking
could lose them, and saving outside the lock raced with other writers.

Refs #295
2026-09-26 21:02:28 +08:00