Skip to content

feat: add pullMode option so pull can keep local-only files - #103

Open
Rahulsharma0810 wants to merge 1 commit into
iHildy:mainfrom
Rahulsharma0810:feat/pull-merge-mode
Open

Rahulsharma0810 wants to merge 1 commit into
iHildy:mainfrom
Rahulsharma0810:feat/pull-merge-mode

Conversation

@Rahulsharma0810

Copy link
Copy Markdown

Closes #99

What

Adds a pullMode option to opencode-synced.jsonc:

  • "replace" (default, unchanged behaviour): a synced directory is replaced by the repo copy, so local-only files inside it are deleted.
  • "merge": repo files are copied over local ones, and local-only files are left in place.

merge applies to the default directory items and to directory entries in extraConfigPaths/extraSecretPaths. It is passed from the three places that call syncRepoToLocal (link, pull, startup pull). Session items that use chunked or preserveWhenMissing handling are not affected.

Why

copyItem() removes the destination directory before copying it, so any file that exists only locally inside agents/, commands/, plugins/, scripts/, skills/ and so on is lost on pull. Machines that keep a few local-only files next to the synced ones had no way to avoid that.

Compatibility

Default is replace, so existing setups behave exactly as before. An unknown value falls back to replace.

Not included

Deletions made in the repo are not propagated in merge mode. A manifest-based "delete only what we wrote" mode and a pre-replace backup were also suggested in #99; I left them out to keep this change small.

Tests

  • apply.test.ts: default mode still removes local-only files, merge mode keeps them and still updates shared files.
  • config.test.ts: pullMode normalization (default, merge, invalid value).
  • bun run check, bun run test (209 passing) and bun run build pass.

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.

pull replaces synced directories wholesale, deleting local-only files (add merge mode / backup)

1 participant