fix(cli): detect slot recipes by defineSlotRecipe helper#572
Open
tobigumo wants to merge 1 commit into
Open
Conversation
The recipe type detection used `file.content.includes('slotRecipe')`,
but recipe sources call `defineSlotRecipe` (capital S). Since `includes`
is case-sensitive, the lowercase `slotRecipe` substring never matched,
so every slot recipe was misclassified as a regular recipe and registered
under `recipes` instead of `slotRecipes` in the generated theme index.
Match the `defineSlotRecipe` helper name instead, which all 42 published
slot recipes use and no regular recipe contains as a substring.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When adding a slot-recipe component (e.g.
tabs) via the CLI, the recipe is registered underrecipesinstead ofslotRecipesin the generatedtheme/recipes/index.ts:Root cause
packages/cli/src/utils/install.tsdecides the recipe type with:Recipe sources define slot recipes with
defineSlotRecipe(capitalS). BecauseString.prototype.includesis case-sensitive, the lowercaseslotRecipesubstring is never present in"defineSlotRecipe", so the check returnsfalse, the type collapses to'recipe', andupdateRecipeIndexroutes it intorecipes.This affects every slot recipe (all 42 published
*-recipeitems), not justtabs. The downstream routing inrecipes.tsis correct; only the type detection ininstall.tswas wrong.Fix
Match the helper name
defineSlotRecipeinstead:All 42 slot recipes call
defineSlotRecipe, and no regular recipe contains that string as a substring (defineRecipe⊄defineSlotRecipe), so the two-way classification stays correct.Verification
Ran the real
updateRecipeIndexagainst the actual published registry contents:tabs-recipe(slot) — old logic →recipes(reproduces the bug); fixed →slotRecipes✅button-recipe(defineRecipe) — both old and fixed →recipes✅ (no regression)