diff --git a/.changeset/compose-extensions-vike-only-guard.md b/.changeset/compose-extensions-vike-only-guard.md new file mode 100644 index 0000000..8e14208 --- /dev/null +++ b/.changeset/compose-extensions-vike-only-guard.md @@ -0,0 +1,7 @@ +--- +'@gemstack/framework': patch +--- + +Enforce the Vike-only constraint on `--compose-extensions` + +`--compose-extensions` is documented as Vike-only, but `runFramework` applied the vike-* composer personas regardless of the detected preset, so a Next project would be framed with `nextPageBuilder` plus composers telling the agent to install vike-auth/vike-crud/etc.: an incoherent prompt. It now gates compose on the Vike preset and, on any other preset, falls back to the hand-rolled + Prisma path and emits a log explaining why. diff --git a/packages/framework/src/run.test.ts b/packages/framework/src/run.test.ts index 9c8cedb..4ecf90c 100644 --- a/packages/framework/src/run.test.ts +++ b/packages/framework/src/run.test.ts @@ -127,6 +127,28 @@ test('--compose-extensions frames the agent with vike-auth, not hand-rolled auth assert.match(system(), /npm install vike-auth/) }) +test('--compose-extensions is ignored on a non-Vike preset and falls back with a log (#202)', async () => { + const events: FrameworkEvent[] = [] + const { driver, system } = recordingDriver() + const { detection } = await runFramework({ + intent: FAKE_INTENT, + driver, + cwd: '/tmp/ws', + signals: { dependencies: ['next'] }, // detect Next, not Vike + composeExtensions: true, + onEvent: e => events.push(e), + }) + + // The vike-* extensions are Vike-only, so a Next project does not get them. + assert.equal(detection.framework, 'Next.js') + assert.doesNotMatch(system(), /vike-auth/) + // And we say why, rather than silently framing Next with vike composers. + assert.ok( + events.some(e => e.kind === 'log' && /--compose-extensions ignored/.test(e.message)), + 'expected a log explaining the compose fallback', + ) +}) + test('without --compose-extensions the default framing has no vike-auth (publish-safe)', async () => { const { driver, system } = recordingDriver() await runFramework({ diff --git a/packages/framework/src/run.ts b/packages/framework/src/run.ts index 8ad0859..933984b 100644 --- a/packages/framework/src/run.ts +++ b/packages/framework/src/run.ts @@ -163,11 +163,21 @@ export async function runFramework(opts: RunFrameworkOptions): Promise