Skip to content

[Blueprints][installTheme step] Honor ifAlreadyInstalled for directory themes - #3855

Merged
adamziel merged 1 commit into
trunkfrom
add/theme-directory-if-already-installed
Jul 1, 2026
Merged

[Blueprints][installTheme step] Honor ifAlreadyInstalled for directory themes#3855
adamziel merged 1 commit into
trunkfrom
add/theme-directory-if-already-installed

Conversation

@adamziel

@adamziel adamziel commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

What it does

Makes directory-based installTheme resources honor the existing ifAlreadyInstalled option.

ifAlreadyInstalled Directory theme behavior
overwrite Replace the existing theme directory.
skip Keep the existing theme directory and continue.
error Throw before writing files.

Rationale

Zip-based theme installs already respect ifAlreadyInstalled, but directory resources always rewrote the target directory through writeFiles(..., { rmRoot: true }).

Blueprint v2 lowering uses directory resources, so it needs the same collision semantics as zip resources before the runner can rely on this step consistently.

Implementation

Before writing directory-resource theme files, installTheme() now checks whether the target directory already exists and applies the same ifAlreadyInstalled rule used by zip installs.

This PR intentionally does not add path validation or symlink hardening. Those are separate behaviors and should stay reviewable on their own.

Testing instructions

Validated locally:

npm run format:uncommitted
npm exec nx run playground-blueprints:test:vite -- --testFiles=packages/playground/blueprints/src/tests/steps/install-theme.spec.ts
npm exec nx run playground-blueprints:lint
npm exec nx run playground-blueprints:typecheck
git diff --check
Base automatically changed from add/theme-install-on-error to trunk July 1, 2026 17:48
@adamziel
adamziel force-pushed the add/theme-directory-if-already-installed branch 5 times, most recently from fea5c7f to c83ea32 Compare July 1, 2026 18:17
@adamziel adamziel changed the title [Blueprints] Honor ifAlreadyInstalled for directory themes Jul 1, 2026
@adamziel
adamziel marked this pull request as ready for review July 1, 2026 18:30
@adamziel
adamziel requested review from a team, Copilot and mho22 July 1, 2026 18:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates the installTheme blueprint step so directory-based theme installs honor the ifAlreadyInstalled collision behavior (matching zip-based installs), and adds a test covering skip/overwrite/error.

Changes:

  • Apply ifAlreadyInstalled semantics when installing directory theme resources (skip, overwrite, error).
  • Add a spec that exercises the new directory-theme collision behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
packages/playground/blueprints/src/lib/steps/install-theme.ts Adds collision handling before writing directory theme files to honor ifAlreadyInstalled.
packages/playground/blueprints/src/tests/steps/install-theme.spec.ts Adds coverage for directory-theme installs respecting skip/overwrite/error.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/playground/blueprints/src/lib/steps/install-theme.ts
@adamziel
adamziel force-pushed the add/theme-directory-if-already-installed branch from c83ea32 to 5d9a7aa Compare July 1, 2026 18:36
@adamziel adamziel added the [Type] Enhancement New feature or request label Jul 1, 2026
@adamziel
adamziel merged commit 747ad5d into trunk Jul 1, 2026
52 of 53 checks passed
@adamziel
adamziel deleted the add/theme-directory-if-already-installed branch July 1, 2026 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants