Repository navigation
Description
Problem
Reproduced against main at 00d0a5bbf1300b2138b65ce724b325dd4dff77ba (3.33.1) using temporary fixtures on Linux, Bun 1.4.2. Three gaps in the CLI's OpenCode install/reinstall path violate file preservation or prevent updates.
- Nested user symlinks. Install a
workflows:reviewcommand, then replacecommands/workflowswith a symlink to a user directory containingreview.md. Reinstalling with that command removed deletes the user's file; reinstalling with the command retained writes through the link. The store-root guard added in fix(targets): guard writers against ancestor-symlink traversal on install #1100 checkscommands, while the leaf check sees a regularreview.md; neither catches the intervening directory link. The skipped paths should remain untouched and unowned by the new install manifest. - Failed config backup. With malformed
opencode.json, a writable existing file, and a parent directory that cannot create backup files,backupFile()returnsnulland the writer overwrites the original. The operation succeeds and printsuser settings preserved, although there is no backup. If an existing config cannot be backed up, the install should fail before replacing it or removing existing artifacts. Normal config merging and the existing backed-up malformed-config recovery should keep working. - Overlapping component paths. A valid manifest declaring
skills: ["./skills"]loads the default skill directory twice. The second copy treats the just-installed directory as unmanaged, so the manifest recordsskills: []. A subsequent install leaves the oldSKILL.mdunchanged. Collect each source component file once while preserving genuinely distinct default/custom components.
Scope
Preserve user files and correct ownership across OpenCode installs. Reuse the existing realpath-containment and ownership mechanisms, stop on an unavailable config backup, and deduplicate component-file collection at the parser boundary. Add regression coverage through the existing writer/parser tests, including first install followed by update/removal.
This follows the existing preservation work in #1094/#1100 and config-preservation report #125; those changes are already merged/closed. I did not find an open issue or PR covering these specific reproductions. No new platform, CLI flag, manifest format, or release-version changes are proposed. Native OpenCode package loading is a separate path and is not changed here.
Activity