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
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.
TestSyncAgents_MergeMode_NestedSameBasename_IsStable compared raw
symlink targets against t.TempDir() paths without EvalSymlinks, causing
false failures on macOS where /var is a symlink to /private/var.
Align agent target naming with the skills-style __ flattening so nested agents do not collide by basename in flat agent directories. Add unit and project-mode integration coverage to verify repeated syncs stay stable and no longer report false updates.
Add SyncAgents() dispatcher supporting all three sync modes:
- merge: per-file symlinks with local file preservation
- symlink: whole directory symlink to agent source
- copy: file copy with content-diff detection
Add CheckAgentCollisions() to detect agents that flatten to the same
filename from different subdirectories.
Add PruneOrphanAgentLinks() for merge mode and PruneOrphanAgentCopies()
for copy mode to clean up stale agent files in targets.
Add CollectAgents() to copy non-symlinked .md files from target back
to agent source directory.
18 tests covering all modes, collision detection, pruning, and collect.