Repository navigation
fix(targets): stop installs clobbering user prompts and piling up backups - #1919
Conversation
…p spam, and verify sync outputRoot (EveryInc#1916)
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…-1916 Resolves the conflict with EveryInc#1914 in src/targets/opencode.ts: config is backed up (and a failed backup still throws) only when the merged config differs from the file on disk, and command files are backed up and rewritten only when their content changed.
…ssion tests Prompt, extension, and agent writes in codex.ts and pi.ts now go through one cleanupCurrentManagedFile helper instead of three near-identical ones. Adds tests for symlinked and unmanaged prompts/extensions (Pi, Codex), a symlink left in place of a dropped managed prompt, and an identical OpenCode reinstall leaving no backups. Each fails on main.
|
Thanks for this, Quinn. The symlink fix is a real one, and I wanted to get it in, so I pushed a couple of commits to your branch instead of going another review round. What I changed:
I kept your One thing from #1916 I left out on purpose: the ownership gate on legacy Pi prompt cleanup. Legacy files predate install manifests, so a manifest gate would stop that sweep from running at all, and |
|
Awesome, thanks for merging this and consolidating the helper + adding the 6 writer regression tests, @tmchow! Good call on leaving the legacy Pi prompt sweep ungated too since |
Summary
Reinstalling or syncing to Codex, Pi, or OpenCode no longer damages user files. Before this change, a prompt or Pi extension that the user had symlinked into the install directory had its target file overwritten with plugin content. A same-named file the user wrote by hand was also overwritten and then recorded as plugin-owned. On OpenCode, every reinstall left a new
opencode.json.bak.<timestamp>and a<command>.md.bak.<timestamp>for each command, even when nothing had changed.Fixes #1916
What changed for users
Prompts and extensions now follow the same ownership rule that agents and skills already followed. In
codex.tsandpi.ts, prompt, extension, and agent writes all go through one helper,cleanupCurrentManagedFile.Also:
--permissionshelp text now saysfrom-commands, which is the value the parser accepts.git clonegets--before the source and destination arguments.Behavior to accept
A prompt or extension file that exists but is not listed in the install manifest is now treated as the user's and is never updated. One example is a manifest deleted by hand. Agents and skills already behave this way, and Pi installs have written manifests since #609.
Not changed from #1916
The issue also proposed an ownership gate on legacy Pi prompt cleanup. That gate is left out:
moveLegacyArtifactToBackupalready skips symlinks.legacy-backup/. It is never deleted.Validation
mainand pass on this branch.typecheckandrelease:validateare clean.mainwas merged in, not rebased. The conflict with fix(opencode): preserve user files and skill ownership on reinstall #1914 inopencode.tswas resolved so that fix(opencode): preserve user files and skill ownership on reinstall #1914's backup-or-throw rule still holds.Security Disclosure
This changes converter and writer output and how files are handled during install. Installs no longer follow a symlink at a leaf file when writing prompts or extensions. Cleanup no longer deletes user symlinks in the prompt and extension directories. No new shell execution. With the
git clonechange, a source value that starts with-can no longer be read as a git option. No secrets or dependency changes.Agent Disclosure
Claude Code · claude-opus-5-5.Co-authored-by: Trevin Chow [email protected]