4 Commits
Author SHA1 Message Date
Willie 51a3be1ca6 fix(status): report drift when an extension agent's source changed
Counting an extension output as synced from its output hash alone missed
the common case: the user edits the agent in the source and runs status
to see whether a sync is due. The output still matched the manifest, so
status, doctor and the dashboard reported no drift although the next
sync would regenerate it.

Sync now records a SHA-256 of the source each output was converted from
in the manifest (sources), and status counts an output only when both
the output and that fingerprint are current. Outputs recorded by earlier
releases have no fingerprint and count as current until the next sync
records one, so upgrading does not show the 0/N the report was about.

Refs #391, Codex review on #392.
2026-10-04 19:49:29 +08:00
Willie a2d75300f6 fix(sync): prune only agent copies skillshare wrote in copy mode
Copy and extension modes pruned every unexpected .md (or output-extension)
file in the agents target, so agent files a user kept there were deleted
on the next sync, unlike skills copy mode, which prunes only manifest
entries.

Copy and transform outputs are now tracked with the same checksum
manifest the merge fallback already uses, and prune removes only tracked
copies the user has not edited. Existing copies are adopted while their
agent is still synced, and an untracked pre-transform .md that still
matches its agent is treated as a stale copy, so switching to an
extension keeps cleaning it up. Copies already orphaned before upgrading
are kept and must be removed by hand.

copyTracker.pruneOrphans now continues past a failed removal and joins
the errors, so one locked file no longer leaves the other orphans behind.
2026-10-01 22:10:08 +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 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