From bc100ff703b5e905b8ce9ffbd51540727ddcf759 Mon Sep 17 00:00:00 2001 From: freddie Date: Wed, 15 Apr 2026 18:24:36 +0100 Subject: [PATCH] fix(cookbook): remove withResolvedCatalog from regenerate command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The regenerate command wrapped applyRecipe/generateRecipe/renderRecipe inside withResolvedCatalog(), which resolves workspace:* and catalog: protocols to concrete versions in package.json files before the callback runs. This broke patch application for recipes whose context lines include those protocol values (e.g. multipass, partytown) because the skeleton's package.json no longer matched what the patches expected. The regenerate command doesn't need resolved versions — patches need workspace:* intact for context matching, generateRecipe diffs against HEAD (which also has workspace:*), and renderRecipe just reads YAML. The existing git checkout/clean at the end of each loop iteration already handles skeleton restoration. Co-Authored-By: Claude Opus 4.6 (1M context) --- cookbook/src/commands/regenerate.ts | 32 ++++++++++++----------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/cookbook/src/commands/regenerate.ts b/cookbook/src/commands/regenerate.ts index efaed1753d..4c18195933 100644 --- a/cookbook/src/commands/regenerate.ts +++ b/cookbook/src/commands/regenerate.ts @@ -2,7 +2,6 @@ import {execSync} from 'child_process'; import {CommandModule} from 'yargs'; import {applyRecipe} from '../lib/apply'; import {FILES_TO_IGNORE_FOR_GENERATE, TEMPLATE_PATH} from '../lib/constants'; -import {withResolvedCatalog} from '../lib/workspace'; import {generateRecipe} from '../lib/generate'; import {isRenderFormat, RENDER_FORMATS, renderRecipe} from '../lib/render'; import {listRecipes, separator, RecipeManifestFormat} from '../lib/util'; @@ -71,24 +70,19 @@ async function handler(args: RegenerateArgs) { for await (const recipe of recipes) { console.log(`🔄 Regenerating recipe '${recipe}'`); - // resolve catalog/workspace protocols, apply recipe, then restore - await withResolvedCatalog(async () => { - applyRecipe({ - recipeTitle: recipe, - }); - // generate the recipe - await generateRecipe({ - recipeName: recipe, - onlyFiles: args.onlyFiles, - filenamesToIgnore: FILES_TO_IGNORE_FOR_GENERATE, - referenceBranch: args.referenceBranch, - recipeManifestFormat: args.recipeManifestFormat, - }); - // render the recipe - renderRecipe({ - recipeName: recipe, - format, - }); + applyRecipe({ + recipeTitle: recipe, + }); + await generateRecipe({ + recipeName: recipe, + onlyFiles: args.onlyFiles, + filenamesToIgnore: FILES_TO_IGNORE_FOR_GENERATE, + referenceBranch: args.referenceBranch, + recipeManifestFormat: args.recipeManifestFormat, + }); + renderRecipe({ + recipeName: recipe, + format, }); // clean up the skeleton template directory execSync(`git checkout -- ${TEMPLATE_PATH}`);