Commit Graph
143 Commits
Author SHA1 Message Date
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 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 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 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 f313e3c37f fix(sync): report agent prune failures instead of dropping them
Both the CLI and the Web API discarded the error from pruning orphaned
agents, so a target whose directory could not be read looked clean while
stale links stayed behind. The shared runner now turns the error into a
"<target>: agents prune failed: <err>" warning, which both callers
already render. The sync itself still counts, matching how skills treat
prune failures.
2026-09-30 01:57:31 +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 c8faab039f test(integration): consolidate redundant filtering and sync cases
Reduce repeated fixtures while retaining CLI flag, output, pruning,
copy-mode, and combined source/target symlink coverage. Keep manifest
orphan pruning and exercise repeated sync through both symlinked paths.

Removed integration cases and their retained unit coverage:
- TestSync_MergeMode_IncludeFilter -> TestFilterSkills_IncludeOnly.
- TestSync_MergeMode_ExcludeFilter -> TestFilterSkills_ExcludeOnly.
- TestSync_Pruning_PreservesLocalDirectories -> TestPruneOrphanLinks_KeepsLocal.
- TestSync_Agents_IncludeFilter -> TestFilterAgents_IncludeOnly.
- TestSync_Agents_ExcludeFilter -> TestFilterAgents_ExcludeOnly.
- TestSync_Agents_GlobExcludePattern -> TestFilterAgents_ExcludeOnly and
  TestFilterSkills_GlobPatterns (shared flat-name matcher).
- TestSync_SourceDirIsSymlink -> TestSyncTargetMerge_SourceIsSymlink.
- TestSync_TargetDirIsSymlink -> TestSyncTargetMerge_TargetIsSymlink.

For the removed TestInstall_SkillIgnore_* cases, internal/skillignore
retains the following semantic coverage:
- ExcludesMatchedSkills -> TestMatch_ExactMatch and TestMatch_NoMatch.
- GroupPattern -> TestMatch_GroupPrefix and TestMatcherMatch parent
  directory inheritance cases.
- PrecisePathInGroup -> TestMatcherMatch contains / is anchored cases;
  also folded into the retained Git-discovery WildcardPattern test.
- DoubleStarPattern -> TestMatcherMatch double-star cases and
  TestDiscoverSourceSkills_IgnorePatterns/DoubleStarPattern.
- DirOnlyPattern -> TestMatcherMatch directory-only cases,
  TestRegressions/#83_trailing_slash, and
  TestDiscoverSourceSkills_IgnorePatterns/DirOnlyPattern.
- CharClassPattern -> TestMatcherMatch character-class cases and
  TestDiscoverSourceSkills_IgnorePatterns/CharClassPattern.
- CombinedPatterns -> TestMatcherMatch negation cases,
  TestReadPatterns_ParsesFile, and TestRegressions.
Keep Git discovery wildcard and negation tests, including nested paths
and traversal into an ignored parent with a negated child.

Convert five TestDiscoverSourceSkills_*Pattern functions into matching
named subtests of TestDiscoverSourceSkills_IgnorePatterns, preserving
all fixtures and asserting the exact retained skill set. Preserve the
separate Lite traversal and WithStats behavior tests.

Convert all 18 Test{MoveToTrash,MoveAgentToTrash,Restore,RestoreAgent}
_RejectsTraversal_* cases into identically named subtests under their
respective Test*_RejectsTraversal functions. Retain every malicious
input, rejection assertion, and canary check.

Validation (Linux devcontainer):
- make build
- go test ./tests/integration/... ./internal/sync/... ./internal/trash/... -count=1
- make check
- git diff --check (host)
All passed.
2026-09-30 01:46:27 +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 7bc8bd6634 fix(targets): count what a skills-off folder still holds and refuse mixed flags
With skills off, analyze only counted unmanaged folders, yet the tool still
loads the links a target sharing the folder keeps and the copies copy mode
leaves behind, so the report showed fewer skills than the tool reads.

`target <name> --skills=false` combined with include/exclude flags applied
the filters and silently dropped the switch, because filter updates return
first. The switch removes links, so the mix is now refused instead.
2026-09-29 05:03:49 +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 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 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 faa5186818 fix(sync): keep import-mode edits when switching back to import
Switching a target from import to copy or symlink and back rebuilt the
file from the attach-time restore point, so lines the user wrote while in
import mode vanished (they survived only as a drift backup). Save the
file's own content when leaving import and rebuild from that on the way
back; the attach-time restore point itself is never re-recorded.

Refs #299
2026-09-28 14:04:15 +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 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 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
Willie 45854c5b57 fix(sync): count manifest-managed hidden entries in target scans
Flat target naming turns a source skill under a dot directory
(e.g. .system/example) into a hidden target entry (.system__example).
Target scans skipped every hidden name, so diff, doctor, status and the
dashboard reported these synced skills as missing, and prune never
removed them after the source skill was deleted.

Hidden entries are now skipped only when the target manifest does not
record them as managed, so files like .skillshare-manifest.json or
.DS_Store are still ignored.

Refs #294
2026-09-25 22:26:51 +08:00
Willie 188193d12d feat(extras): let collect overwrite source files with --force
In copy mode, sync --force can push source over target, but collect
skipped every file already in source, so edits made directly in a
copy-mode target could not be pulled back. collect --force now
overwrites those files; identical ones are still skipped.

Collect also replaced collected files with symlinks regardless of mode,
turning copy-mode targets into symlinks. Copy-mode targets now keep
their files, in the CLI and the extras TUI.

With flatten, two target files sharing a basename map to one source
file; the second is now reported instead of overwriting the first under
--force. --from paths are matched after expanding ~ and cleaning, so a
spelling that differs from config no longer drops the target's mode.

Refs #291
2026-09-24 00:05:55 +08:00
Willie cb2bcec948 feat(agents): convert agents with a target extension
Tools disagree on agent frontmatter and some need another format entirely,
so an agent written for Claude is misread elsewhere. An `extension` on a
target's agents block reuses the extras transform mechanism to convert each
agent during sync.

Converted targets hold transformed output, so collect never pulls them back
into the source. Leftover symlinks from merge or symlink mode are removed
rather than written through, and a failed conversion drops the old output
so an unconverted agent never stays active.

The bundled opencode-agents extension keeps only fields OpenCode documents
and refuses agents that restrict their tools, since dropping those fields
would widen the agent's access.

Refs #267
Refs #241
2026-09-21 13:31:38 +08:00
Willie 1fb23f1e59 feat(analyze): measure what each target actually loads
The analyze numbers were drifting from what tools really see. Symlink-mode
targets expose the whole source folder, so .skillignore'd skills still load
but were left out; merge/copy targets often hold skills the user dropped in
by hand that skillshare never counted; and chars/4 undercounted CJK text by
roughly four times.

Route the CLI, TUI, web handler and sync summary through one
sync.TargetSkills so the three copies of the filter logic cannot disagree
again. Disabled skills stay in the discovery with Disabled=true and are
priced for symlink targets; unmanaged folders in a target are reported as
Local. Token estimates now charge one token per wide rune.

The dashboard keeps the chosen target in the URL so target and project
pages can deep-link into the analysis, lists project targets after own
targets with their tool icon, and tags local/disabled rows. Select gives
single-select icons a key to silence a React warning.
2026-09-21 04:17:26 +08:00
Willie 449fe40d6f fix(targets): move goose and openhands to .agents/skills
Both tools now document ~/.agents/skills and <project>/.agents/skills as
their skills locations and keep the old directories only for backward
compatibility. Writing to the old path next to `universal` makes them read
every skill from two places.

Global configs pin absolute paths, so they are unaffected and keep their
overlap warning. Project configs store target names only, so an existing
project follows the new default on its next sync while the links it created
in .goose/skills or .openhands/skills would stay behind and show up as
duplicates. Project sync now removes those leftovers from also_scans
directories that no configured target writes to.

That directory belongs to another tool, so the cleanup runs the prune with
ManagedOnly: only symlinks into the source and manifest-tracked folders are
removed. The flat-name heuristic would otherwise delete hand-made folders
such as `_drafts`. Targets with an explicit path are skipped, and --dry-run
only previews.

Refs #135
2026-09-21 02:55:18 +08:00
Willie e780fbf1ab fix(sync): honour agent frontmatter targets when syncing agents
The agent discovery already parsed the `targets` frontmatter list into
DiscoveredResource.Targets, but no agent sync path ever applied it, so an
agent declared for one tool was still delivered to every agent-capable
target. Agents have no shared schema across harnesses, so this gives authors
a way to keep a per-tool variant of the same agent without cross-polluting
targets. Applied in CLI sync (global and project), the dashboard sync
handler, doctor's expected count and the target summary so all views agree.

Refs #267
2026-09-02 13:36:30 +08:00
Willie 3743a1ef3f fix(sync): honor file ignore patterns in copy mode
Apply config ignore patterns to copy-mode file traversal, checksum, mtime, CLI diff, and server sync/diff paths.

Add default ignores for .DS_Store, .git, and __pycache__ in global and project init configs.

Tests: go test ./... -count=1
2026-06-29 10:30:11 +08:00
Willie 5d684393f1 fix: propagate lint rule load errors 2026-06-14 13:44:36 +08:00
britz 1bcd02a3d9 fix: cache lint load error in package state to persist across Once calls 2026-06-14 13:37:24 +08:00
britz 4439d118fe fix: replace panic with error returns in loadLintRules and LintSkill 2026-06-14 13:37:24 +08:00
Willie 51656e9cb3 fix(sync): keep project agent symlinks stable across syncs on symlinked paths
Project-mode agent sync re-reported every agent as updated on the second
sync when the project lived under a symlinked ancestor (e.g. macOS temp
dirs under /var -> /private/var), failing idempotency on macOS CI.

Two interacting causes:

- shouldUseRelative was unstable: on the first sync the target directory
  does not exist yet, so evalOrClean fell back to a non-resolved path and
  the under-project-root check failed, producing an absolute link; on the
  second sync the directory existed and resolved, so it wanted a relative
  link and reformatted the existing one. evalOrClean now resolves the
  deepest existing ancestor and re-appends the missing tail, so the answer
  is the same whether or not the leaf exists.
- The existing-symlink comparison only did a direct string compare, so a
  stable relative link whose resolved target carried the unresolved alias
  prefix looked like it pointed elsewhere. It now canonicalizes both sides
  via EvalSymlinks on the slow path, mirroring isSymlinkToSource.

Adds a regression test that reproduces the symlinked-ancestor case on any
platform.
2026-06-11 01:18:05 +08:00
Willie 2b08bdf400 fix: use relative project symlinks for agents 2026-06-10 23:39:45 +08:00
Willie 86b91efe95 feat(extras): refine per-target management UI and path resolution
UI (Extras page):
- Label per-target flatten/extension/mode controls with column headers
- Render flatten as a dropdown so it matches the adjacent selects
- Collapse the add-target form behind a button and widen the path input
- Confirm before removing a target
- Polish layout: tinted icon, inset source chip, hover rows, aligned columns

Components:
- Select: bound the dropdown width so long option descriptions wrap instead
  of stretching the popup across the page
- Toast: render messages multi-line, widen the container, and give
  error/warning toasts more time to read

Sync feedback:
- Restructure extras sync-failure toasts into readable lines and fix the
  contradictory "N more errors" count (new nMoreErrors translation)

CLI/server:
- Match extra target paths by resolved absolute path (handles ~ vs /home)
  when adding, removing, or updating targets
2026-06-02 18:40:00 +08:00
Willie c47785abd9 feat(sync): add PruneExtraTarget wrapper for per-target cleanup 2026-06-02 17:06:12 +08:00
Willie 1183e0a366 fix: improve codex agent extension validation 2026-05-31 13:39:41 +08:00
Letiancheng Lee 0ae4e11376 reject blank codex agent descriptions 2026-05-31 13:07:25 +08:00
Letiancheng Lee ad9ffde242 fix codex agent extension validation 2026-05-31 13:07:25 +08:00
Willie 4d08690d36 fix(review): address PR #174 review feedback
- handler_git: dashboard Pull auto-sync now uses EffectiveSkillsSource()
  instead of the git_root scope dir, so it no longer mangles skill rel
  paths (skills/foo -> skills__foo) when git_root is root/agents/extras
- extension: run the transform subprocess via CommandContext with a 30s
  timeout so a hung extension can't block sync indefinitely
- md-toml.js (codex-agents, gemini-commands): escape values via
  JSON.stringify so control characters produce valid TOML basic strings
- gitroot: quote paths in the commit/push mv guidance so paths with spaces
  can be pasted safely
- extras list + extras server handlers: warn when an extension fails to
  resolve instead of silently falling back and reporting false drift

Lock-contention suggestions on handleSetGitRoot/handleAbsorbNested are not
applied: this is a single-user localhost dashboard, and dropping the write
lock around .git-mutating operations trades safety for negligible throughput.
2026-05-30 19:23:12 +08:00
Willie e1c4761333 fix(extras): apply output_ext when computing diff target filenames
The /api/extras/diff path resolved the copy mode but ignored a transform
extension's output_ext, so buildExtrasDiffItems compared source relative
paths against the target directory. After a .md -> .toml transform sync,
the diff looked for the original .md name and reported false drift, even
though the status path already handled this.

Export ApplyOutputExt as the single source of truth for source->target
filename mapping (previously unexported applyOutputExt) and use it in the
diff path so sync, status, and diff all agree on the transformed name.
2026-05-30 19:23:12 +08:00
Willie 4435429ada fix(extras): detect target conflicts in transform sync dry-run
A transform-mode dry-run counted every file as synced without inspecting the target, so it claimed it would sync files that a real non-force sync would skip. Report an existing real file (under the transformed name) as a skip needing --force, mirroring the non-dry-run path. The dry-run still never spawns the extension subprocess, so content is compared conservatively by existence rather than by output.
2026-05-30 19:23:12 +08:00
Willie 7419bc74d2 fix(extras): resolve extension target mode consistently in CLI and server
The dashboard computed extension target status with EffectiveMode, which defaults an empty mode to merge, so a valid transform extension target (extension set, no explicit mode) was always reported as drift. Introduce sync.ResolveExtensionMode as the single source of truth (empty/copy resolve to copy, anything else errors) and use it across the CLI, sync, status, and diff paths.
2026-05-30 19:23:12 +08:00
Willie 403b51f380 fix(extras): never destroy a target directory in transform sync without --force
The previous conflict guard lumped symlinks and directories together and
os.RemoveAll'd both unconditionally, so a real directory sitting at a
generated output path (e.g. a.toml/keep.txt) was silently deleted during
`sync extras` even without --force — more destructive than the copy/merge
path, where syncOneExtraFile only auto-replaces symlinks.

Transform conflict handling now mirrors copy semantics exactly:
- symlink  → auto-replace (os.Remove, link only)
- directory→ skip unless --force; with --force, replace wholesale (os.RemoveAll)
- file     → idempotent if identical, else skip unless --force

Also fix the real deleter: pruneExtraOrphans descended into a skipped
conflict directory and pruned its contents as orphans. It now SkipDirs any
directory occupying a claimed output path, leaving it fully untouched.

Adds regression tests for the directory-conflict skip and the forced
replacement.
2026-05-30 19:23:12 +08:00
Willie 372dd65768 fix(extras): enforce --force contract and consistent status for transform extensions
Transform-extension sync previously wrote each generated file via
runExtensionFile unconditionally, so a regular local target file (e.g. a
hand-edited hello.toml) could be overwritten from hello.md without --force,
violating the same conflict contract that copy/merge modes honor.

- Split runExtension (subprocess → bytes) from runExtensionFile (writes),
  and have syncExtraTransform apply the conflict/force rules: idempotent
  when identical, skipped on conflict without --force, overwrite with
  --force, and auto-replace leftover symlinks.
- Centralize the copy-only mode rule in SyncExtra so the API and CLI reject
  extension+merge/symlink identically; align the server sync handler's mode
  normalization (EffectiveMode's "merge" default no longer leaks through).
- CLI `extras list` no longer short-circuits to an "extension" status before
  existence/drift checks. Status is now computed via output_ext-aware
  CheckSyncStatus; a new Extension field carries the display label, decoupled
  from sync status (plain-text + TUI rendering updated).
- Roll back the optimistic cache update in the UI mode-change handler on
  failure (fixes the unused-var build break).

Adds regression tests covering conflict skip/force/idempotent/symlink-replace
and non-copy mode rejection.
2026-05-30 19:23:12 +08:00
Willie 157eddc3d9 fix(extras): never sync skillshare's .metadata.json store
Installed-skill source dirs carry a .metadata.json tracking store. Extras
discovery walked it like user content, so a transform extension renamed it
to .metadata.toml in the target. Skip the reserved file in
DiscoverExtraFiles so it is never synced or transformed in any mode.
2026-05-30 19:23:12 +08:00
Willie f88044e2cc fix(extras): report synced status for transform targets
CheckSyncStatus compared each source file against targetDir/<source-name>,
but a transform extension renames output (foo.md -> foo.toml), so the
.toml file was never found and the target was always reported as drift —
even right after a successful sync. Thread the extension's output_ext
through CheckSyncStatus so the expected target filename matches the
transformed output. The web list now resolves the spec to pass it.
2026-05-30 19:23:12 +08:00
Willie fcbfd39be2 refactor(extensions): describe and rename built-ins by output
md2codex / md2gemini named the *input* (markdown) and read poorly. Rename
the bundled extensions after what they produce: codex-agents and
gemini-commands. Turn the BuiltinExtensions catalog into structs carrying
a human-readable description so the dashboard can explain each one before
install, and propagate the new names across tests and docs.
2026-05-30 19:23:12 +08:00
Willie f6eca1fc7d feat(ui): add extensions management to Config page
Add an "Extensions" tab to the Config page for managing transform
extensions in the active mode (global or project):

- GET /api/extensions lists installed extensions with their manifest
  descriptions, merged with the built-in catalog so users can see what
  is available to download.
- POST /api/extensions/install downloads a whitelisted built-in
  extension into the active mode's extensions directory.
- POST /api/extensions/open opens that directory in the user's editor,
  mirroring the skill "open in editor" affordance.

ExtensionSpec now carries the manifest description so the list can
surface it. The UI shows installed extensions with a built-in badge,
available built-ins with a Download button, and an Open-directory
action. Strings are translated across all 11 locales.
2026-05-30 19:23:12 +08:00
Willie f6c9b98562 feat(ui): add per-target extension picker to Extras page
Surface the per-target extension transform in the dashboard. A new
GET /api/extras/extensions endpoint lists extensions available in the
current mode's directory (global or project), and the Extras page renders
a picker per target. Selecting an extension forces copy mode (transforms
are copy-only) and locks the mode control; changes apply optimistically
via the query cache. Adds i18n keys across all locales.
2026-05-30 19:23:12 +08:00
Willie 1b9d25de7a feat(sync): implement per-file transform with output rename and prune 2026-05-30 19:23:12 +08:00
Willie 425c32d489 refactor(sync): thread extension spec param through SyncExtra 2026-05-30 19:23:12 +08:00