Skip to content

[Blueprints] Type Blueprint v2 plugin collision handling - #3865

Merged
adamziel merged 1 commit into
trunkfrom
type/blueprint-v2-plugin-if-already-installed
Jul 2, 2026
Merged

[Blueprints] Type Blueprint v2 plugin collision handling#3865
adamziel merged 1 commit into
trunkfrom
type/blueprint-v2-plugin-if-already-installed

Conversation

@adamziel

@adamziel adamziel commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

What changed?

This types ifAlreadyInstalled on Blueprint v2 plugin object declarations:

Field Accepted values
plugins[].ifAlreadyInstalled overwrite, skip, error

It adds declaration tests for accepted values and rejects an unknown value with @ts-expect-error.

Why?

The plugin install step already has this collision policy. Blueprint v2 plugin objects need to expose the same option at the declaration layer so TypeScript authors can express install collision behavior without casts.

This PR only updates v2 declaration types. It does not wire the option into the v2 runner; that should remain a separate, focused PR if needed.

Consumers

Consumer Benefit
Blueprint v2 runner work Gets a typed declaration field for plugin install collision policy.
TypeScript Blueprint authors Can write ifAlreadyInstalled: "skip" or "error" on plugin objects directly.
Existing Blueprint v1 consumers No runtime behavior change; this only affects v2 declaration types.

Testing

  • npm run format:uncommitted
  • npm exec nx run playground-blueprints:typecheck
  • npm exec nx run playground-blueprints:lint
  • npm exec nx run playground-blueprints:test:vite -- --testFiles=packages/playground/blueprints/src/tests/v2/blueprint-v2-declaration.spec.ts
  • git diff --check

Part of #2592.

@adamziel
adamziel marked this pull request as ready for review July 2, 2026 14:48
@adamziel
adamziel requested review from a team, Copilot and zaerl July 2, 2026 14:48

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.

Adds a typed ifAlreadyInstalled collision policy to Blueprint v2 plugin declarations so TypeScript authors can express plugin install collision behavior without casts.

Changes:

  • Extends the v2 schema plugin declaration with ifAlreadyInstalled?: 'overwrite' | 'skip' | 'error'.
  • Adds declaration-type tests to accept known policies and reject unknown values via @ts-expect-error.

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/v2/wep-1-blueprint-v2-schema/appendix-A-blueprint-v2-schema.ts Adds the ifAlreadyInstalled union type + docs to the plugin schema.
packages/playground/blueprints/src/tests/v2/blueprint-v2-declaration.spec.ts Adds type-level tests for accepted/rejected ifAlreadyInstalled values.

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

Comment on lines +656 to +661
/**
* How to handle a plugin that is already installed.
*
* @default "overwrite"
*/
ifAlreadyInstalled?: 'overwrite' | 'skip' | 'error';
Comment on lines +125 to +138
it('accepts plugin install collision handling', () => {
const blueprint = {
version: 2,
plugins: [
{
source: 'akismet',
ifAlreadyInstalled: 'skip',
},
{
source: 'jetpack',
ifAlreadyInstalled: 'error',
},
],
} satisfies BlueprintV2Declaration;
@adamziel
adamziel merged commit e51c27c into trunk Jul 2, 2026
103 of 105 checks passed
@adamziel
adamziel deleted the type/blueprint-v2-plugin-if-already-installed branch July 2, 2026 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment