Repository navigation
feat(recipes): recipes add --project merges a recipe into an existing site - #1023
Merged
Merged
Conversation
… project (#1014) Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Fixes #1014
What changed
urlcode recipes add <name> --project <dir>merges a bundled recipe into an existing project (a site'sapp/), instead of the files being copied by hand.--outstill creates a new standalone project; exactly one of the two is required. The flag is--project, as every other command names the project;--intoalready means something else (artifacts stage).The merge (
packages/core/src/recipe-merge.ts, SDKmergeRecipe):urlcode.yamlare added to the project'surlcode.yaml. Includes (routes/auth.yaml) are written and appended toincludes. An identical existing include file (the oneextensions add authwrote) is not a clash and is not written.extensions.<name>.config(collections.bookings, thestaffmembership collection) is a unit. It is added if missing, left alone if identical, and a clash if it differs. Other top-level mappings (site.spa) merge the same way.README.mdis not copied (recipes showprints it).tests/requests.json, one per line as the recipes write them. Fixtures have no id, so an identical fixture is skipped, and the same request with different expectations is a clash.id, and membership lists as a union.tests/audit.json:expectRoutesmoves by the routes the merge added, measured from the project as loaded after the write.recipe-clash. Every clash is named, and nothing is written.recipe-needs-extension, namingurlcode extensions add auth store.routes,includes,extensions,settings,files,fixtures,seed,expectRoutes,written), the recipe'sinputsas notes, and thevalidate/test/auditcommands to run next.--dry-runwrites nothing.urlcode.yamllast, then the project is loaded again. Any failure restores every changed file and removes every created file and directory. Paths through a symlink are refused.urlcode.yamlis edited in place with the helpersextensions adduses. New entries are spliced after the existing ones, with the recipe's own comments, and every other line stays byte-identical;checkedYamlEditrefuses rather than reformats.yamlInsertEntrygained an optional pre-rendered block, so an emptyroutes: {}/collections: {}opens into block YAML instead of one long flow line.extensions addbehaves exactly as before (it passes no block).plan-feature: the newcommandsfield is the next step when a recipe applies:urlcode extensions addfor missing extensions, thenurlcode recipes add <recipe> --project <dir>. Before a site exists, it isurlcode init <directory> --with ...and the merge into<directory>/app.nextstays canonical MCP tool names.Docs:
docs/RECIPES.mdhas a new section, "Adding a recipe to an existing project".TOOLING.md(plan-featurecommands, and a pointer from MCPadd_recipe),AI-AUTHORING.md,llms.txtand the regeneratedllms-full.txt.AGENTS.md, viaagents-guide.ts, andskills/urlcode/SKILL.md.recipes add ... --project appinstead of "copy these files and set expectRoutes".Evidence
test/recipe-merge.test.ts:app/validate, test and audit ready. The audit count moves 0 → 2 → 4.route /andfile app/public/index.html, with every file byte-identical.--out/--projectare exclusive.tests/) restores everything and removes the createdfunctions/.packages/store/test/recipes.test.ts:init+extensions add auth storesite with the real auth and store extensions. Each passesvalidate --local,test(twice) andauditready with--local-review, with the count fromtests/audit.json.bookingscollection refuses a re-add, naming it, with nothing written.test/addons.integration.tsruns the same three merges through realurlcode initandurlcode extensions add auth store(npm-packed core and add-ons): validate, test and audit ready. Passed locally.plan-featuretest forcommands, with and without a project.npm run verify: pass (local, macOS, Node 26.10), before the final merge of main; the recipe-merge, feature-plan, CLI and store recipe tests andnpm run checkrerun green after itnpm run test:package: pass (39 packaged example commands, starter and cookbook checks)Limitations
urlcode testwith429. The auth extension keeps Better Auth's sign-in rate limit (10/min) on in hermetic runs. store-booking + store-credits is one such pair. Filed as [Bug]: a site whose fixtures sign in more than ten times fails urlcode test with 429 (Better Auth rate limit in hermetic runs) #1019 and documented in RECIPES.md; the two-recipe test uses store-booking + protected-download.add_recipestill creates a new directory, and TOOLING.md points to the CLI.urlcode.yaml) is refused when the merge would need to edit it. So is aurlcode.yamllayout the in-place edit cannot handle.🤖 Generated with Claude Code