Skip to content

setup: Replace directory-level install with per-asset merge-aware install - #180

Open
davidabram wants to merge 2 commits into
mainfrom
non-desctructive-setup
Open

setup: Replace directory-level install with per-asset merge-aware install#180
davidabram wants to merge 2 commits into
mainfrom
non-desctructive-setup

Conversation

@davidabram

Copy link
Copy Markdown
Member

No description provided.

@davidabram
davidabram force-pushed the non-desctructive-setup branch from b08af36 to 1c043e9 Compare August 4, 2026 08:58
Base automatically changed from normalize-skills to main August 4, 2026 10:47
@davidabram
davidabram force-pushed the non-desctructive-setup branch 2 times, most recently from 1c043e9 to c4efb12 Compare August 4, 2026 14:08
@davidabram
davidabram force-pushed the non-desctructive-setup branch from 0e7c843 to cb7da31 Compare August 7, 2026 17:51
@vercel

vercel Bot commented Aug 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
sce-config-json Ready Ready Preview Aug 8, 2026 8:46am

Request Review

davidabram and others added 2 commits August 8, 2026 10:45
…tall

sce setup previously staged the full catalog into a temp directory and
swapped it over the whole .claude/, .opencode/, or .pi/ target directory,
destroying any user-owned files (skills, settings.local.json, CLAUDE.md,
etc.) living alongside SCE's own assets. The two generated JSON configs
(.claude/settings.json, .opencode/opencode.json) had the same problem one
level down: written whole, they clobbered a user's permissions, env,
model, mcp, or non-SCE hook/plugin entries.

Installation now happens per asset: each embedded file is staged and
atomically renamed into place individually, and assets the current
selection or catalog no longer owns are pruned by relative path instead
of the whole directory being rebuilt. The two config files are merged
via a new config_merge module that replaces only the SCE-owned fragment
(hook entries by marker, plugin paths by prefix) and leaves every other
key and entry untouched, idempotently across repeated installs.

sce doctor's integration inspection is updated to match: the two
merge-target configs are checked by whether their SCE-owned fragment is
current rather than by byte-exact sha256, and `--fix` gained a repair
path that reinstalls just a drifted merge-target asset.

Co-authored-by: SCE <sce@crocoder.dev>
…iting them

Every setup write — config assets and required git hooks alike — unlinked
the destination file before renaming the staged replacement over it. The
staging file already lives in the destination's directory, so the rename
alone is atomic; the unlink only opened a window where the file did not
exist, and on a rename failure the error path deleted the staging copy too,
leaving neither. This mattered once `.claude/settings.json` and
`.opencode/opencode.json` became merge targets holding user-owned keys that
setup cannot reconstruct. Both pre-deletes are dropped in favor of atomic
rename.

`sce setup --hooks` also replaced `pre-commit`, `commit-msg`, and
`post-commit` wholesale, destroying any hook a repository already ran
(husky, lefthook, hand-written). Each canonical hook payload is now
delimited by an SCE managed block marker pair. Install creates the full
script when no hook exists, replaces the block in place when one already
carries it, recognizes and replaces a legacy pre-marker SCE payload
wholesale, and otherwise appends the block after a foreign hook's content
so SCE always runs last. A last-effective-line heuristic reports an
advisory when a foreign hook's trailing zero-indent `exec`/`exit` would
make the appended block unreachable. `sce doctor` now classifies hook
content by managed-block currency instead of byte-exact comparison, so
foreign content around a current block does not read as drift.

Co-authored-by: SCE <sce@crocoder.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant