@easy-web/cli 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,6 +2,23 @@
2
2
 
3
3
  Phase-1 create-only CLI. Generation is offline by default; installation is explicit.
4
4
 
5
+ The CLI establishes a maintainable, upgradeable website structure; it does not
6
+ finish the website. Content, custom features, integration setup and deployment
7
+ remain developer-owned. Compatible package updates should not require rerunning
8
+ the generator: shared behavior belongs in packages, while generated configuration
9
+ and composition remain site-owned. Core content contracts must stay extensible
10
+ across CMS/storage/UI, and non-core integrations must remain removable.
11
+ See the [upgradeability-first standards](../../apps/docs/src/content/docs/architecture/index.mdx#upgradeability-first-standards).
12
+ There is no existing-site regeneration or automatic upgrade command.
13
+
14
+ Editable profiles use package-owned core schemas/runtime helpers and build-time
15
+ CMS compilation, with explicit site schema extensions and editor-only mappings.
16
+ Editor checks cover only supported constraints; core validation remains
17
+ authoritative, including after CMS removal. Advanced explicit editor configuration
18
+ can save invalid data that fails the build. See the
19
+ [manual adoption and upgrade guide](../../apps/docs/src/content/docs/guides/upgrading-editable-sites.mdx)
20
+ for the exact source/derived boundary and future-update design; no updater exists.
21
+
5
22
  ```sh
6
23
  easy-web create --config ./create.json --json
7
24
  # Equivalent explicit offline form:
@@ -14,7 +31,7 @@ easy-web create --config ./create.json --install
14
31
  {
15
32
  "target": "./new-site",
16
33
  "recipes": {
17
- "shell": { "siteName": "Example Site", "defaultLocale": "en", "noIndex": false },
34
+ "shell": { "siteName": "Example Site", "siteUrl": "https://example.com", "defaultLocale": "en", "noIndex": false },
18
35
  "auth": {}
19
36
  }
20
37
  }
@@ -26,6 +43,77 @@ content composition, as shown below. Arbitrary multi-recipe JS config merging is
26
43
  not supported in Phase 1. Package dependencies, devDependencies and
27
44
  scripts merge additively in resolver order; the later value wins a key collision.
28
45
 
46
+ Optional `recipes.shell.siteUrl` sets Astro's public `site` URL during creation.
47
+ Use an absolute HTTP(S) URL without credentials, query parameters or a fragment.
48
+ This is public configuration, not content or deployment provisioning. If omitted,
49
+ the existing `https://replace-with-your-domain.example` placeholder is preserved;
50
+ replace it before publishing the site. Invalid URLs fail before target creation.
51
+
52
+ ### Editable pages and configurable presentation
53
+
54
+ Set `recipes.shell.editablePages: true` for an editable homepage, Markdown pages
55
+ and site/navigation settings. It works without other content collections; add
56
+ the usual `recipes.cms` backend/media configuration to expose them in Decap.
57
+ No site-wide authentication is added.
58
+
59
+ ```json
60
+ {
61
+ "target": "./new-site",
62
+ "recipes": {
63
+ "shell": {
64
+ "siteName": "Example Site",
65
+ "siteUrl": "https://example.com",
66
+ "editablePages": true,
67
+ "headerVariant": "flyout",
68
+ "theme": {
69
+ "light": { "primary": "#245788", "onPrimary": "#ffffff" },
70
+ "dark": { "primary": "#8ab9ea", "onPrimary": "#111827" },
71
+ "fonts": { "sans": ["Example Sans", "system-ui", "sans-serif"] }
72
+ }
73
+ }
74
+ }
75
+ }
76
+ ```
77
+
78
+ The generated `src/site-content/` contains `home/<locale>.md`, `pages/*.md`
79
+ (or `pages/<locale>/*.md` for DE/EN), and `settings/site.json` plus
80
+ `settings/navigation.json`. Pages use title, summary, slug and Markdown body;
81
+ their slugs become top-level URLs such as `/contact/`. The second locale uses
82
+ its prefix, such as `/en/contact/`, and `translationKey` pairs translated pages.
83
+ Duplicate slugs/translations and routes reserved by the shell or configured
84
+ collections fail the build. The homepage is a fixed CMS file, not a deletable
85
+ folder entry. Site name, main/legal navigation and optional skip-link labels
86
+ are consumed by the layout, not unused editor forms. Missing settings fail
87
+ explicitly. Legal links initially remain empty: the site owner supplies legal
88
+ content and navigation.
89
+
90
+ `headerVariant` selects `standard` (the unchanged default), `centered`,
91
+ `hide-on-scroll` or `flyout`; only flyout renders nested navigation. `theme.light`
92
+ and `theme.dark` accept hexadecimal values for the existing semantic color tokens:
93
+ `surface`, `onSurface`, `surfaceMuted`, `primary`, `onPrimary`, `border`, `muted`,
94
+ `danger`, `onDanger`, `accent` and `link`. `theme.fonts.sans` and `.mono` accept
95
+ ordered font-family arrays; these select installed fonts, not download them.
96
+ Theme configuration generates `src/styles/site.css`, retaining unconfigured
97
+ tokens and system/explicit light/dark switching. Colors, fonts and header choice
98
+ remain CLI/site configuration, not CMS fields. The owner must check contrast
99
+ and provide any custom font assets.
100
+
101
+ Set `recipes.content.presentation.<content-type-id>.photosLayout: "lightbox"`
102
+ to use the shared accessible lightbox for a photo-bearing content type.
103
+ The sibling `imageFallback: "first-photo"` requires `photos` plus
104
+ `image` with `imageOptional: true`; explicit covers win, otherwise the first photo
105
+ supplies cards, detail cover and SEO image. Empty photo lists still render no
106
+ cover. Omission preserves the existing plain grid and no-fallback behavior.
107
+ These are recipe presentation choices, not fields in the entity composition.
108
+ Unknown content IDs or incompatible trait selections fail before target creation.
109
+
110
+ Page editing without CMS needs core `^1.10.0`; lightbox generation needs core
111
+ `^1.15.0`. CMS page editing and nonstandard headers require the forthcoming
112
+ `^1.16.0` family APIs. Do not install those new profiles from the registry before
113
+ that release is available. Default profiles retain their existing runtime floors.
114
+ All options remain create-only: they never rewrite an existing site, deploy,
115
+ provision resources or author production content.
116
+
29
117
  Generated runtime minima follow the APIs emitted by the selected recipes:
30
118
  shell-only uses core `^1.5.0`; single-locale unordered content collections require core
31
119
  `^1.6.0` (trait schemas); single-locale unordered content plus CMS requires core and CMS
@@ -124,11 +212,27 @@ Lists and details show locale-formatted dates with semantic `<time>` elements
124
212
  in UTC; labels are German for German locales and English otherwise.
125
213
  The existing CMS trait fields expose a required start and optional end with
126
214
  date-only UTC widgets. Schedule dates do not filter or sort content: default slug
127
- ordering and the opt-in `order` trait remain unchanged. The feature does not
215
+ ordering and the opt-in `order` trait remain unchanged unless the list explicitly
216
+ opts in below. The feature does not
128
217
  provide event times, time zones, recurrence, upcoming-event filtering or automatic
129
218
  schedule-based publishing. Publication gating is a separate option below.
130
219
  Schedule alone uses the existing core `^1.6.0` and CMS `^1.9.0` runtime floors.
131
220
 
221
+ ### Order a generated list by schedule start
222
+
223
+ Add `"listOrder": "schedule-start"` to a content type that selects `schedule`.
224
+ Its generated list sorts by ascending `startDate` (a calendar day), then by
225
+ locale-aware slug and collection ID. This is a list setting, not a filter or
226
+ an ordering imposed on other views. Publication and locale filters still apply
227
+ before sorting.
228
+
229
+ If the type also selects `order`, entries with an integer order come first in
230
+ ascending numeric order. Equal orders, and entries without an order, sort by
231
+ start date before slug and ID. Assigning only some entries an order therefore
232
+ moves them ahead of all unordered entries; assign every entry an order for full
233
+ manual control. Without `listOrder`, the existing numeric or default slug ordering
234
+ is unchanged. This option requires no additional generated runtime dependency.
235
+
132
236
  ### Opt in to publication gating
133
237
 
134
238
  Set `"publish": "missing-date-means-draft"` on an individual content type in
@@ -191,7 +295,7 @@ sites declare Sharp and supply a local example asset handled by Astro.
191
295
  The graph reports content roles and presentation bindings separately from files.
192
296
 
193
297
  After creation, run `pnpm install`, replace the placeholder `site` URL in
194
- `astro.config.mjs`, then run `pnpm typecheck` and `pnpm build`. The generated shell
298
+ `astro.config.mjs` if `shell.siteUrl` was omitted, then run `pnpm typecheck` and `pnpm build`. The generated shell
195
299
  includes a strict Astro `tsconfig.json`, `@astrojs/check`, shared tokens and
196
300
  `SeoHead`. The SEO integration owns `robots.txt`; `noIndex: true` emits no sitemap,
197
301
  disallows crawling and adds noindex metadata to generated pages. This is not
package/dist/bin.js CHANGED
@@ -196,8 +196,8 @@ async function main() {
196
196
  if (typeof argv.config !== "string" || !argv.config) {
197
197
  throw new CreateError("INVALID_INPUT", "create requires --config <file.json>");
198
198
  }
199
- const { readCreateConfig } = await import("./config-FBJBWD2V.js");
200
- const { createSite } = await import("./run-FINIRCSO.js");
199
+ const { readCreateConfig } = await import("./config-3CSMXIG5.js");
200
+ const { createSite } = await import("./run-N7WEJEX5.js");
201
201
  const result = await createSite(await readCreateConfig(argv.config), void 0, { install: argv.install === true });
202
202
  process.stdout.write(json ? `${JSON.stringify({ schemaVersion: 1, ...result })}
203
203
  ` : `Created ${result.target}
@@ -7,33 +7,49 @@ import {
7
7
  // src/create/config.ts
8
8
  import { readFile } from "fs/promises";
9
9
  import { z } from "astro/zod";
10
- import { shellRecipe, createContentSiteRecipes, generatedContentCompositionSchema } from "@easy-web/core/recipes";
10
+ import { shellRecipe, createShellRecipe, createContentSiteRecipes, generatedContentCompositionSchema, contentPresentationSchema, validateContentPresentation } from "@easy-web/core/recipes";
11
11
  import { authRecipe } from "@easy-web/auth/recipe";
12
- import { cmsMediaRecipe, cmsSiteOptionsSchema, createCmsContentSiteRecipes } from "@easy-web/cms-adapters";
12
+ import { cmsMediaRecipe, cmsSiteOptionsSchema, createCmsContentSiteRecipes, createCmsShellRecipes } from "@easy-web/cms-adapters";
13
13
  var configSchema = z.strictObject({
14
14
  target: z.string().trim().min(1),
15
15
  composition: generatedContentCompositionSchema.optional(),
16
16
  recipes: z.strictObject({
17
17
  shell: shellRecipe.optionsSchema.default(() => shellRecipe.optionsSchema.parse({})),
18
18
  auth: authRecipe.optionsSchema.optional(),
19
- cms: z.union([cmsSiteOptionsSchema, cmsMediaRecipe.optionsSchema]).optional()
19
+ cms: z.union([cmsSiteOptionsSchema, cmsMediaRecipe.optionsSchema]).optional(),
20
+ content: z.strictObject({ presentation: contentPresentationSchema }).optional()
20
21
  }).default(() => ({ shell: shellRecipe.optionsSchema.parse({}) }))
21
22
  }).superRefine((config, context) => {
22
23
  const cms = config.recipes.cms;
24
+ if (config.recipes.content) {
25
+ if (!config.composition) {
26
+ context.addIssue({ code: "custom", path: ["recipes", "content"], message: "Content presentation requires a top-level content composition" });
27
+ } else {
28
+ try {
29
+ validateContentPresentation(config.composition, config.recipes.content.presentation);
30
+ } catch (error) {
31
+ if (!(error instanceof z.ZodError)) throw error;
32
+ for (const issue of error.issues) context.addIssue({ ...issue, path: ["recipes", "content", "presentation", ...issue.path] });
33
+ }
34
+ }
35
+ }
23
36
  if (config.composition && cms && "composition" in cms) {
24
37
  context.addIssue({ code: "custom", path: ["recipes", "cms", "composition"], message: "Declare composition only once, at the top level, when generating content pages with CMS" });
25
38
  }
26
- if (!config.composition && cms && !("composition" in cms)) {
39
+ if (!config.composition && cms && !("composition" in cms) && !config.recipes.shell.editablePages) {
27
40
  context.addIssue({ code: "custom", path: ["composition"], message: "CMS editor generation requires a top-level content composition" });
28
41
  }
29
42
  if (config.composition) {
30
43
  const hasCmsBindings = config.composition.contentTypes.some((type) => type.bindings.includes("cms-admin"));
31
44
  if (hasCmsBindings && !cms) context.addIssue({ code: "custom", path: ["recipes", "cms"], message: "cms-admin bindings require the CMS recipe" });
32
- if (cms && !hasCmsBindings) context.addIssue({ code: "custom", path: ["composition"], message: "CMS generation requires at least one cms-admin content binding" });
45
+ if (cms && !hasCmsBindings && !config.recipes.shell.editablePages) context.addIssue({ code: "custom", path: ["composition"], message: "CMS generation requires at least one cms-admin content binding" });
33
46
  }
34
- if (config.composition && config.recipes.auth) {
47
+ if ((config.composition || config.recipes.shell.editablePages) && config.recipes.auth) {
35
48
  context.addIssue({ code: "custom", path: ["recipes", "auth"], message: "Content composition with application auth is not yet supported" });
36
49
  }
50
+ if (config.recipes.shell.editablePages && cms && "composition" in cms) {
51
+ context.addIssue({ code: "custom", path: ["recipes", "cms"], message: "Editable pages require the CMS site configuration, not the legacy media recipe" });
52
+ }
37
53
  if (config.composition && config.recipes.shell.defaultLocale !== config.composition.contentLocales[0]) {
38
54
  context.addIssue({ code: "custom", path: ["recipes", "shell", "defaultLocale"], message: "shell.defaultLocale must match the content composition locale" });
39
55
  }
@@ -53,12 +69,14 @@ function select(recipe, options) {
53
69
  }
54
70
  function selectionsFor(config) {
55
71
  const cmsOptions = config.recipes.cms;
56
- const cmsSite = config.composition && cmsOptions && !("composition" in cmsOptions) ? createCmsContentSiteRecipes(config.composition, cmsOptions) : void 0;
57
- const contentRecipes = cmsSite ?? (config.composition ? createContentSiteRecipes(config.composition) : void 0);
72
+ const cmsSite = config.composition && cmsOptions && !("composition" in cmsOptions) ? createCmsContentSiteRecipes(config.composition, cmsOptions, config.recipes.shell, config.recipes.content?.presentation) : void 0;
73
+ const contentRecipes = cmsSite ?? (config.composition ? createContentSiteRecipes(config.composition, { shellOptions: config.recipes.shell, presentation: config.recipes.content?.presentation }) : void 0);
74
+ const editableCms = !config.composition && cmsOptions && !("composition" in cmsOptions) && config.recipes.shell.editablePages ? createCmsShellRecipes(config.recipes.shell, cmsOptions) : void 0;
58
75
  return [
59
- select(contentRecipes?.shell ?? shellRecipe, config.recipes.shell),
76
+ select(contentRecipes?.shell ?? editableCms?.shell ?? createShellRecipe(config.recipes.shell), config.recipes.shell),
60
77
  ...contentRecipes ? [select(contentRecipes.content, {})] : [],
61
78
  ...cmsSite ? [select(cmsSite.cms, {})] : [],
79
+ ...editableCms ? [select(editableCms.cms, {})] : [],
62
80
  ...cmsOptions && "composition" in cmsOptions ? [select(cmsMediaRecipe, cmsOptions)] : [],
63
81
  ...config.recipes.auth ? [select(authRecipe, config.recipes.auth)] : []
64
82
  ];
@@ -82,4 +100,4 @@ export {
82
100
  parseCreateConfig,
83
101
  readCreateConfig
84
102
  };
85
- //# sourceMappingURL=chunk-5OEGZ74L.js.map
103
+ //# sourceMappingURL=chunk-CGJJE7WH.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/create/config.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { z } from 'astro/zod';\nimport { shellRecipe, createShellRecipe, createContentSiteRecipes, generatedContentCompositionSchema, contentPresentationSchema, validateContentPresentation } from '@easy-web/core/recipes';\nimport { authRecipe } from '@easy-web/auth/recipe';\nimport { cmsMediaRecipe, cmsSiteOptionsSchema, createCmsContentSiteRecipes, createCmsShellRecipes } from '@easy-web/cms-adapters';\nimport type { RecipeMetadata } from '@easy-web/core/recipes';\nimport { CreateError, invalid } from './errors.js';\n\nconst configSchema = z.strictObject({\n target: z.string().trim().min(1),\n composition: generatedContentCompositionSchema.optional(),\n recipes: z.strictObject({\n shell: shellRecipe.optionsSchema.default(() => shellRecipe.optionsSchema.parse({})),\n auth: authRecipe.optionsSchema.optional(),\n cms: z.union([cmsSiteOptionsSchema, cmsMediaRecipe.optionsSchema]).optional(),\n content: z.strictObject({ presentation: contentPresentationSchema }).optional(),\n }).default(() => ({ shell: shellRecipe.optionsSchema.parse({}) })),\n}).superRefine((config, context) => {\n const cms = config.recipes.cms;\n if (config.recipes.content) {\n if (!config.composition) {\n context.addIssue({ code: 'custom', path: ['recipes', 'content'], message: 'Content presentation requires a top-level content composition' });\n } else {\n try {\n validateContentPresentation(config.composition, config.recipes.content.presentation);\n } catch (error) {\n if (!(error instanceof z.ZodError)) throw error;\n for (const issue of error.issues) context.addIssue({ ...issue, path: ['recipes', 'content', 'presentation', ...issue.path] });\n }\n }\n }\n if (config.composition && cms && 'composition' in cms) {\n context.addIssue({ code: 'custom', path: ['recipes', 'cms', 'composition'], message: 'Declare composition only once, at the top level, when generating content pages with CMS' });\n }\n if (!config.composition && cms && !('composition' in cms) && !config.recipes.shell.editablePages) {\n context.addIssue({ code: 'custom', path: ['composition'], message: 'CMS editor generation requires a top-level content composition' });\n }\n if (config.composition) {\n const hasCmsBindings = config.composition.contentTypes.some((type) => type.bindings.includes('cms-admin'));\n if (hasCmsBindings && !cms) context.addIssue({ code: 'custom', path: ['recipes', 'cms'], message: 'cms-admin bindings require the CMS recipe' });\n if (cms && !hasCmsBindings && !config.recipes.shell.editablePages) context.addIssue({ code: 'custom', path: ['composition'], message: 'CMS generation requires at least one cms-admin content binding' });\n }\n if ((config.composition || config.recipes.shell.editablePages) && config.recipes.auth) {\n context.addIssue({ code: 'custom', path: ['recipes', 'auth'], message: 'Content composition with application auth is not yet supported' });\n }\n if (config.recipes.shell.editablePages && cms && 'composition' in cms) {\n context.addIssue({ code: 'custom', path: ['recipes', 'cms'], message: 'Editable pages require the CMS site configuration, not the legacy media recipe' });\n }\n if (config.composition && config.recipes.shell.defaultLocale !== config.composition.contentLocales[0]) {\n context.addIssue({ code: 'custom', path: ['recipes', 'shell', 'defaultLocale'], message: 'shell.defaultLocale must match the content composition locale' });\n }\n}).readonly();\n\nexport type CreateConfig = z.infer<typeof configSchema>;\n\nexport interface RecipeSelection {\n readonly recipe: RecipeMetadata;\n readonly options: unknown;\n}\n\n// Capture each recipe's typed options at admission; the composer sees one uniform hook type.\nfunction select<Options>(recipe: RecipeMetadata<Options>, options: Options): RecipeSelection {\n return {\n options,\n recipe: {\n ...recipe,\n generate: (context) => recipe.generate({ ...context, options }),\n validators: recipe.validators.map((validator) => ({\n ...validator,\n validate: (context) => validator.validate({ ...context, options }),\n })),\n },\n };\n}\n\nexport function selectionsFor(config: CreateConfig): readonly RecipeSelection[] {\n const cmsOptions = config.recipes.cms;\n const cmsSite = config.composition && cmsOptions && !('composition' in cmsOptions)\n ? createCmsContentSiteRecipes(config.composition, cmsOptions, config.recipes.shell, config.recipes.content?.presentation) : undefined;\n const contentRecipes = cmsSite ?? (config.composition ? createContentSiteRecipes(config.composition, { shellOptions: config.recipes.shell, presentation: config.recipes.content?.presentation }) : undefined);\n const editableCms = !config.composition && cmsOptions && !('composition' in cmsOptions) && config.recipes.shell.editablePages\n ? createCmsShellRecipes(config.recipes.shell, cmsOptions) : undefined;\n return [\n select(contentRecipes?.shell ?? editableCms?.shell ?? createShellRecipe(config.recipes.shell), config.recipes.shell),\n ...(contentRecipes ? [select(contentRecipes.content, {})] : []),\n ...(cmsSite ? [select(cmsSite.cms, {})] : []),\n ...(editableCms ? [select(editableCms.cms, {})] : []),\n ...(cmsOptions && 'composition' in cmsOptions ? [select(cmsMediaRecipe, cmsOptions)] : []),\n ...(config.recipes.auth ? [select(authRecipe, config.recipes.auth)] : []),\n ];\n}\n\nexport function parseCreateConfig(value: unknown): CreateConfig {\n const parsed = configSchema.safeParse(value);\n if (!parsed.success) invalid(`Invalid create config: ${parsed.error.message}`);\n return parsed.data;\n}\n\nexport async function readCreateConfig(path: string): Promise<CreateConfig> {\n try {\n return parseCreateConfig(JSON.parse(await readFile(path, 'utf8')));\n } catch (error) {\n if (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,CAAC,IAAI,CAAC;AAAA,IACnD,GAAI,cAAc,iBAAiB,aAAa,CAAC,OAAO,gBAAgB,UAAU,CAAC,IAAI,CAAC;AAAA,IACxF,GAAI,OAAO,QAAQ,OAAO,CAAC,OAAO,YAAY,OAAO,QAAQ,IAAI,CAAC,IAAI,CAAC;AAAA,EAC3E;AACJ;AAEO,SAAS,kBAAkB,OAA8B;AAC5D,QAAM,SAAS,aAAa,UAAU,KAAK;AAC3C,MAAI,CAAC,OAAO,QAAS,SAAQ,0BAA0B,OAAO,MAAM,OAAO,EAAE;AAC7E,SAAO,OAAO;AAClB;AAEA,eAAsB,iBAAiB,MAAqC;AACxE,MAAI;AACA,WAAO,kBAAkB,KAAK,MAAM,MAAM,SAAS,MAAM,MAAM,CAAC,CAAC;AAAA,EACrE,SAAS,OAAO;AACZ,QAAI,iBAAiB,YAAa,OAAM;AACxC,UAAM,IAAI,YAAY,iBAAiB,8BAA8B,IAAI,IAAI,EAAE,OAAO,MAAM,CAAC;AAAA,EACjG;AACJ;","names":[]}
@@ -3,11 +3,11 @@ import {
3
3
  parseCreateConfig,
4
4
  readCreateConfig,
5
5
  selectionsFor
6
- } from "./chunk-5OEGZ74L.js";
6
+ } from "./chunk-CGJJE7WH.js";
7
7
  import "./chunk-TCE4BQ7M.js";
8
8
  export {
9
9
  parseCreateConfig,
10
10
  readCreateConfig,
11
11
  selectionsFor
12
12
  };
13
- //# sourceMappingURL=config-FBJBWD2V.js.map
13
+ //# sourceMappingURL=config-3CSMXIG5.js.map
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  selectionsFor
4
- } from "./chunk-5OEGZ74L.js";
4
+ } from "./chunk-CGJJE7WH.js";
5
5
  import {
6
6
  CreateError,
7
7
  invalid
@@ -292,7 +292,11 @@ function withPlaceholderLockfile(site) {
292
292
  return { ...site, files: [...site.files, createPlaceholderLockfile(site)].sort((a, b) => a.path.localeCompare(b.path, "en")) };
293
293
  }
294
294
  var defaultRunner = async (cwd, command, args) => {
295
- await execute3(command, [...args], { cwd, shell: process.platform === "win32" });
295
+ if (process.platform === "win32") {
296
+ await execute3(process.env.ComSpec ?? "cmd.exe", ["/d", "/s", "/c", "pnpm.cmd install"], { cwd });
297
+ } else {
298
+ await execute3(command, [...args], { cwd });
299
+ }
296
300
  };
297
301
  async function installDependencies(target, options = {}) {
298
302
  if (options.install !== true) return;
@@ -405,4 +409,4 @@ async function createSite(config, selections = selectionsFor(config), installOpt
405
409
  export {
406
410
  createSite
407
411
  };
408
- //# sourceMappingURL=run-FINIRCSO.js.map
412
+ //# sourceMappingURL=run-N7WEJEX5.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/create/run.ts","../src/create/compose.ts","../src/create/git.ts","../src/create/target.ts","../src/create/stage.ts","../src/create/install.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\nimport { cp, link, mkdir, mkdtemp, readdir, rm, rmdir } from 'node:fs/promises';\nimport { dirname, join } from 'node:path';\nimport type { CreateConfig, RecipeSelection } from './config.js';\nimport { selectionsFor } from './config.js';\nimport { composeRecipes } from './compose.js';\nimport { CreateError } from './errors.js';\nimport { git } from './git.js';\nimport { checkAncestors, checkTargetRace, planTarget } from './target.js';\nimport { listFiles, writeAndValidate } from './stage.js';\nimport { installDependencies, withPlaceholderLockfile } from './install.js';\nimport type { InstallOptions } from './install.js';\n\nexport async function createSite(config: CreateConfig, selections: readonly RecipeSelection[] = selectionsFor(config), installOptions: InstallOptions = {}) {\n const plan = await planTarget(config.target);\n const staging = await mkdtemp(join(dirname(plan.path), '.easy-web-create-'));\n const branch = `easy-web-create-${randomUUID()}`;\n const root = join(staging, 'site');\n let worktree = false;\n let retained = false;\n let ownedTarget = false;\n let ownedMetadata = false;\n const published: string[] = [];\n const directories: string[] = [];\n let result: { target: string; commit: string; branch: string; graphJson: string; graphMermaid: string } | undefined;\n try {\n const site = withPlaceholderLockfile(await composeRecipes(selections));\n await checkTargetRace(plan);\n if (plan.gitRoot) {\n await git(plan.path, ['worktree', 'add', '-b', branch, root, plan.head ?? 'HEAD']);\n worktree = true;\n } else {\n await mkdir(root);\n await git(root, ['init', '--initial-branch=main', '--template=']);\n }\n await writeAndValidate(root, site);\n await checkTargetRace(plan);\n if (!plan.gitRoot) {\n if (!plan.stat) { await mkdir(plan.path); ownedTarget = true; }\n await mkdir(join(plan.path, '.git'));\n ownedMetadata = true;\n await checkAncestors(plan.path);\n // Hard links publish each allow-listed file exclusively; existing paths are never overwritten.\n for (const file of site.files) {\n const destination = join(plan.path, file.path);\n const parents: string[] = [];\n let parent = dirname(destination);\n while (parent !== plan.path) { parents.unshift(parent); parent = dirname(parent); }\n for (const directory of parents) {\n if (!directories.includes(directory)) { await mkdir(directory); directories.push(directory); }\n }\n await link(join(root, file.path), destination);\n published.push(destination);\n }\n const entries = await listFiles(plan.path);\n const expected = site.files.map(({ path }) => path).sort();\n if (JSON.stringify(entries) !== JSON.stringify(expected)) throw new CreateError('INVALID_INPUT', 'Target became occupied during publication');\n }\n if (!plan.gitRoot) {\n for (const entry of await readdir(join(root, '.git'))) {\n await cp(join(root, '.git', entry), join(plan.path, '.git', entry), { recursive: true, force: false, errorOnExist: true });\n }\n }\n const commitRoot = plan.gitRoot ? root : plan.path;\n await git(commitRoot, ['commit', '-m', 'Create easy-web site']);\n const commit = await git(commitRoot, ['rev-parse', 'HEAD']);\n retained = plan.gitRoot;\n result = { target: plan.gitRoot ? root : plan.path, commit, branch: plan.gitRoot ? branch : 'main', graphJson: site.graphJson, graphMermaid: site.graphMermaid };\n } catch (error) {\n const original = error instanceof CreateError\n ? error\n : new CreateError('CREATE_FAILED', 'Site generation/staging failed', { cause: error });\n const cleanupErrors: unknown[] = [];\n const cleanup = async (operation: () => Promise<unknown>): Promise<void> => {\n try { await operation(); } catch (cleanupError) { cleanupErrors.push(cleanupError); }\n };\n for (const path of published.reverse()) await cleanup(() => rm(path));\n for (const path of directories.reverse()) await cleanup(() => rmdir(path));\n if (ownedMetadata) await cleanup(() => rm(join(plan.path, '.git'), { recursive: true }));\n if (ownedTarget) await cleanup(() => rmdir(plan.path));\n if (cleanupErrors.length) Object.defineProperty(original, 'cleanupErrors', { value: cleanupErrors });\n throw original;\n } finally {\n if (!retained) {\n if (worktree) {\n const tracked = (await git(root, ['ls-files', '-z'])).split('\\0').filter(Boolean);\n if (tracked.length) await git(root, ['rm', '--cached', '--', ...tracked]);\n for (const entry of await readdir(root)) {\n if (entry !== '.git') await rm(join(root, entry), { recursive: true });\n }\n await git(plan.path, ['worktree', 'remove', root]);\n await git(plan.path, ['branch', '-d', branch]);\n }\n await rm(staging, { recursive: true });\n }\n }\n if (!result) throw new CreateError('CREATE_FAILED', 'Site creation produced no result');\n await installDependencies(result.target, installOptions);\n return result;\n}\n","import { z } from 'astro/zod';\nimport {\n resolveCapabilityGraph, toCapabilityGraphDocument,\n serializeCapabilityGraphJson, serializeCapabilityGraphMermaid,\n} from '@easy-web/core/recipes';\nimport type { RecipeGeneratedFile, RecipeOutputContribution } from '@easy-web/core/recipes';\nimport type { RecipeSelection } from './config.js';\nimport { invalid } from './errors.js';\n\nexport function outputPath(contribution: RecipeOutputContribution): string {\n const { target } = contribution;\n return contribution.kind === 'route' && target.startsWith('/')\n ? target.endsWith('/') ? `src/pages${target}index.astro` : `src/pages${target}.astro`\n : target;\n}\n\nexport function isFileContribution(contribution: RecipeOutputContribution): boolean {\n return contribution.kind !== 'content' && contribution.kind !== 'binding';\n}\n\nexport function safeOutputPath(path: string): string {\n const segments = path.split('/');\n if (!path || segments.some((segment) => !segment || segment === '.' || segment === '..'\n || /^\\.git$/i.test(segment) || /[\\\\:*?\"<>|]/.test(segment)\n || [...segment].some((character) => character.charCodeAt(0) < 32)\n || /[. ]$/.test(segment) || /^(?:con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\\.|$)/i.test(segment))) {\n invalid(`Unsafe generated path: ${path}`);\n }\n return path;\n}\n\nconst packageFragmentSchema = z.object({\n dependencies: z.record(z.string(), z.string()).optional(),\n devDependencies: z.record(z.string(), z.string()).optional(),\n scripts: z.record(z.string(), z.string()).optional(),\n}).catchall(z.json());\n\nexport function mergePackageFragments(fragments: readonly string[]): string {\n // Accumulator retains every top-level field and merges the three map-valued fields.\n let merged: Record<string, z.infer<ReturnType<typeof z.json>>> = {};\n for (const fragment of fragments) {\n const parsed = packageFragmentSchema.safeParse(JSON.parse(fragment));\n if (!parsed.success) invalid(`Invalid package.json fragment: ${parsed.error.message}`);\n const previous = packageFragmentSchema.parse(merged);\n merged = { ...merged, ...parsed.data };\n for (const key of ['dependencies', 'devDependencies', 'scripts'] as const) {\n if (previous[key] || parsed.data[key]) merged[key] = { ...previous[key], ...parsed.data[key] };\n }\n }\n return `${JSON.stringify(merged, null, 2)}\\n`;\n}\n\nexport interface ComposedSite {\n readonly files: readonly RecipeGeneratedFile[];\n readonly graphJson: string;\n readonly graphMermaid: string;\n}\n\nexport async function composeRecipes(selections: readonly RecipeSelection[]): Promise<ComposedSite> {\n const resolved = resolveCapabilityGraph(selections.map(({ recipe }) => recipe));\n if (!resolved.ok) invalid(`Recipe resolution failed: ${JSON.stringify(resolved.error)}`);\n const graph = resolved.value;\n const owners = new Map<string, string>();\n for (const { recipe } of selections) {\n for (const contribution of recipe.outputContributions.filter(isFileContribution)) {\n const path = safeOutputPath(outputPath(contribution));\n const key = path.toLowerCase();\n if (owners.has(key) && path !== 'package.json') {\n if (path === 'astro.config.mjs' && contribution.kind === 'configuration') {\n invalid('multi-recipe astro.config.mjs merge not yet supported in Phase 1 — select recipes individually or wait for a future composer');\n }\n invalid(`Shared output is not mergeable: ${path}`);\n }\n owners.set(key, path);\n }\n }\n const files = new Map<string, RecipeGeneratedFile>();\n const fragments: string[] = [];\n for (const node of graph.recipes) {\n const selection = selections.find(({ recipe }) => recipe.id === node.id);\n if (!selection) invalid(`Missing selected recipe: ${node.id}`);\n const { recipe } = selection;\n const options = recipe.optionsSchema.parse(selection.options);\n const context = { options, capabilities: graph.capabilities.map(({ id }) => id), contributions: recipe.outputContributions };\n for (const validator of recipe.validators.filter(({ phase }) => phase === 'options')) {\n const issues = await validator.validate(context);\n if (issues.length) invalid(`Recipe validation failed: ${JSON.stringify(issues)}`);\n }\n const output = await recipe.generate(context);\n const declared = recipe.outputContributions.filter(isFileContribution).map(outputPath).sort();\n const generated = output.files.map(({ path }) => safeOutputPath(path)).sort();\n if (new Set(generated).size !== generated.length || JSON.stringify(declared) !== JSON.stringify(generated)) {\n invalid(`Generated files differ from declared contributions: ${recipe.id}`);\n }\n for (const file of output.files) {\n if (file.path === 'package.json') fragments.push(String(file.content));\n else files.set(file.path, file);\n }\n }\n if (fragments.length) files.set('package.json', { path: 'package.json', content: mergePackageFragments(fragments) });\n const output = { files: [...files.values()].sort((a, b) => a.path.localeCompare(b.path, 'en')) };\n for (const { recipe, options } of selections) {\n for (const validator of recipe.validators.filter(({ phase }) => phase === 'output')) {\n const issues = await validator.validate({ options, capabilities: graph.capabilities.map(({ id }) => id), contributions: recipe.outputContributions, output });\n if (issues.length) invalid(`Recipe validation failed: ${JSON.stringify(issues)}`);\n }\n }\n const document = toCapabilityGraphDocument(graph);\n if (!document.ok) invalid(`Graph serialization failed: ${document.error.code}`);\n return { ...output, graphJson: serializeCapabilityGraphJson(document.value), graphMermaid: serializeCapabilityGraphMermaid(document.value) };\n}\n","import { execFile } from 'node:child_process';\nimport { promisify } from 'node:util';\nimport { CreateError } from './errors.js';\n\nconst execute = promisify(execFile);\n\nexport async function git(cwd: string, args: readonly string[]): Promise<string> {\n const env: NodeJS.ProcessEnv = { ...process.env, GIT_MASTER: '1', GIT_TERMINAL_PROMPT: '0' };\n // Ambient Git overrides must not redirect operations into the invoker's repository.\n for (const key of Object.keys(env)) {\n if (key.startsWith('GIT_') && !['GIT_MASTER', 'GIT_TERMINAL_PROMPT', 'GIT_AUTHOR_NAME', 'GIT_AUTHOR_EMAIL', 'GIT_COMMITTER_NAME', 'GIT_COMMITTER_EMAIL'].includes(key)) delete env[key];\n }\n try {\n const result = await execute('git', ['-c', 'core.hooksPath=', '-c', 'commit.gpgSign=false', ...args], {\n cwd, env, timeout: 30_000, maxBuffer: 4 * 1024 * 1024,\n });\n return result.stdout.trimEnd();\n } catch (error) {\n throw new CreateError('CREATE_FAILED', `Git operation failed: ${args[0]}`, { cause: error });\n }\n}\n","import { lstat, readdir, realpath } from 'node:fs/promises';\nimport { dirname, parse, resolve } from 'node:path';\nimport type { Stats } from 'node:fs';\nimport { execFile } from 'node:child_process';\nimport { promisify } from 'node:util';\nimport { git } from './git.js';\nimport { invalid } from './errors.js';\n\nexport async function statOrMissing(path: string): Promise<Stats | undefined> {\n try {\n return await lstat(path);\n } catch (error) {\n if (error instanceof Error && 'code' in error && error.code === 'ENOENT') return undefined;\n throw error;\n }\n}\n\nexport async function checkAncestors(path: string): Promise<void> {\n if (process.platform === 'win32') {\n const result = await promisify(execFile)('powershell.exe', ['-NoProfile', '-NonInteractive', '-Command',\n \"Set-StrictMode -Version Latest; $ErrorActionPreference='Stop'; $path=$env:EASY_WEB_CHECK_PATH; while ($path) { if (Test-Path -LiteralPath $path) { $item=Get-Item -Force -LiteralPath $path; if (($item.Attributes -band [IO.FileAttributes]::ReparsePoint) -ne 0) { 'reparse'; break } }; $path=[IO.Path]::GetDirectoryName($path) }\"],\n { env: { ...process.env, EASY_WEB_CHECK_PATH: path }, timeout: 15_000 });\n if (result.stdout.trim() === 'reparse') invalid(`Reparse-point target ancestor: ${path}`);\n }\n let current = path;\n while (true) {\n const stat = await statOrMissing(current);\n if (stat && (!stat.isDirectory() || stat.isSymbolicLink())) invalid(`Unsafe target ancestor: ${current}`);\n if (current === parse(current).root) break;\n current = dirname(current);\n }\n}\n\nexport interface TargetPlan {\n readonly path: string;\n readonly stat: Stats | undefined;\n readonly gitRoot: boolean;\n readonly head?: string;\n}\n\nexport async function planTarget(input: string): Promise<TargetPlan> {\n const path = resolve(input);\n await checkAncestors(path);\n const stat = await statOrMissing(path);\n if (!stat) {\n if (!(await statOrMissing(dirname(path)))) invalid('Target parent directory must exist');\n return { path, stat, gitRoot: false };\n }\n const entries = await readdir(path);\n if (!entries.length) return { path, stat, gitRoot: false };\n if (entries.length !== 1 || entries[0] !== '.git') invalid(`Target is not empty (including hidden/ignored files): ${path}`);\n const metadata = await lstat(resolve(path, '.git'));\n if (metadata.isSymbolicLink()) invalid('Git metadata must not be a link');\n const root = await git(path, ['rev-parse', '--show-toplevel']);\n if (await realpath(root) !== await realpath(path)) invalid('Target must be a Git root or worktree');\n const head = await git(path, ['rev-parse', '--verify', 'HEAD']);\n if (await git(path, ['ls-tree', '-r', '--name-only', head])\n || await git(path, ['ls-files', '--stage'])\n || await git(path, ['status', '--porcelain', '--untracked-files=all', '--ignored'])) {\n invalid('Target Git HEAD tree, index and worktree must be empty and clean');\n }\n return { path, stat, gitRoot: true, head };\n}\n\nexport async function checkTargetRace(plan: TargetPlan): Promise<void> {\n const current = await planTarget(plan.path);\n if (current.stat?.ino !== plan.stat?.ino || current.stat?.dev !== plan.stat?.dev\n || current.gitRoot !== plan.gitRoot || current.head !== plan.head) {\n invalid('Target changed after planning');\n }\n}\n","import { execFile } from 'node:child_process';\nimport { promisify } from 'node:util';\nimport { mkdir, readdir, writeFile, lstat } from 'node:fs/promises';\nimport { dirname, join } from 'node:path';\nimport type { ComposedSite } from './compose.js';\nimport { safeOutputPath } from './compose.js';\nimport { invalid } from './errors.js';\nimport { git } from './git.js';\n\nconst execute = promisify(execFile);\n\nexport async function listFiles(root: string, prefix = ''): Promise<readonly string[]> {\n const files: string[] = [];\n for (const name of await readdir(join(root, prefix))) {\n if (!prefix && name === '.git') continue;\n const path = prefix ? `${prefix}/${name}` : name;\n const stat = await lstat(join(root, path));\n if (stat.isSymbolicLink()) invalid(`Staging contains a link: ${path}`);\n if (stat.isDirectory()) files.push(...await listFiles(root, path));\n else if (stat.isFile()) files.push(path);\n else invalid(`Staging contains a special file: ${path}`);\n }\n return files.sort();\n}\n\nexport async function writeAndValidate(root: string, site: ComposedSite): Promise<void> {\n for (const file of site.files) {\n const path = join(root, safeOutputPath(file.path));\n await mkdir(dirname(path), { recursive: true });\n await writeFile(path, file.content, { flag: 'wx' });\n if (file.path.endsWith('.json')) JSON.parse(String(file.content));\n if (/\\.(?:mjs|cjs|js)$/.test(file.path)) {\n await execute(process.execPath, ['--check', path], { timeout: 30_000 });\n }\n }\n const expected = site.files.map(({ path }) => path).sort();\n if (JSON.stringify(await listFiles(root)) !== JSON.stringify(expected)) invalid('Staging tree differs from the output allow-list');\n await git(root, ['add', '--', ...expected]);\n const staged = (await git(root, ['diff', '--cached', '--name-status', '--no-renames', '-z'])).split('\\0').filter(Boolean);\n const paths: string[] = [];\n for (let index = 0; index < staged.length; index += 2) {\n if (staged[index] !== 'A') invalid('Staged diff must contain additions only');\n const path = staged[index + 1];\n if (path) paths.push(path);\n }\n if (JSON.stringify(paths.sort()) !== JSON.stringify(expected)) invalid('Git index differs from the output allow-list');\n}\n","import { execFile } from 'node:child_process';\nimport { promisify } from 'node:util';\nimport type { RecipeGeneratedFile } from '@easy-web/core/recipes';\nimport type { ComposedSite } from './compose.js';\nimport { CreateError, invalid } from './errors.js';\n\nconst execute = promisify(execFile);\nconst dependencyRange = /^(?:[~^]?\\d+(?:\\.\\d+){0,2}(?:-[0-9A-Za-z.-]+)?|[<>=*xX| .\\d~^-]+)$/;\n\ninterface PackageManifest {\n readonly dependencies?: Readonly<Record<string, string>>;\n readonly devDependencies?: Readonly<Record<string, string>>;\n readonly optionalDependencies?: Readonly<Record<string, string>>;\n}\n\nexport type InstallRunner = (cwd: string, command: string, args: readonly string[]) => Promise<void>;\n\nexport interface InstallOptions {\n readonly install?: boolean;\n readonly runner?: InstallRunner;\n}\n\nfunction quote(value: string): string {\n return `'${value.replaceAll(\"'\", \"''\")}'`;\n}\n\nfunction packageManifest(site: ComposedSite): PackageManifest {\n const file = site.files.find(({ path }) => path === 'package.json');\n if (!file) invalid('Generated site has no package.json');\n return JSON.parse(String(file.content)) as PackageManifest;\n}\n\nfunction dependencyGroups(manifest: PackageManifest): readonly [string, Readonly<Record<string, string>>][] {\n return [\n ['dependencies', manifest.dependencies ?? {}],\n ['devDependencies', manifest.devDependencies ?? {}],\n ['optionalDependencies', manifest.optionalDependencies ?? {}],\n ];\n}\n\nexport function validateDependencySources(site: ComposedSite): void {\n for (const [group, dependencies] of dependencyGroups(packageManifest(site))) {\n for (const [name, source] of Object.entries(dependencies)) {\n if (!dependencyRange.test(source)) {\n invalid(`Unsupported ${group} source for ${name}: ${source}`);\n }\n }\n }\n}\n\nexport function createPlaceholderLockfile(site: ComposedSite): RecipeGeneratedFile {\n const manifest = packageManifest(site);\n const lines = [\n \"lockfileVersion: '9.0'\",\n '',\n 'settings:',\n ' autoInstallPeers: true',\n ' excludeLinksFromLockfile: false',\n '',\n 'importers:',\n '',\n ' .:',\n ];\n for (const [group, dependencies] of dependencyGroups(manifest)) {\n const entries = Object.entries(dependencies).sort(([left], [right]) => left.localeCompare(right, 'en'));\n if (!entries.length) continue;\n lines.push(` ${group}:`);\n for (const [name, specifier] of entries) {\n lines.push(` ${quote(name)}:`, ` specifier: ${quote(specifier)}`);\n }\n }\n return { path: 'pnpm-lock.yaml', content: `${lines.join('\\n')}\\n` };\n}\n\nexport function withPlaceholderLockfile(site: ComposedSite): ComposedSite {\n validateDependencySources(site);\n return { ...site, files: [...site.files, createPlaceholderLockfile(site)].sort((a, b) => a.path.localeCompare(b.path, 'en')) };\n}\n\nconst defaultRunner: InstallRunner = async (cwd, command, args) => {\n await execute(command, [...args], { cwd, shell: process.platform === 'win32' });\n};\n\nexport async function installDependencies(target: string, options: InstallOptions = {}): Promise<void> {\n if (options.install !== true) return;\n const command = process.platform === 'win32' ? 'pnpm.cmd' : 'pnpm';\n try {\n await (options.runner ?? defaultRunner)(target, command, ['install']);\n } catch (error) {\n throw new CreateError('CREATE_FAILED', 'Dependency installation failed', { cause: error });\n }\n}\n"],"mappings":";;;;;;;;;;AAAA,SAAS,kBAAkB;AAC3B,SAAS,IAAI,MAAM,S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AACjD,cAAM,IAAI,KAAK,MAAM,CAAC,UAAU,MAAM,MAAM,CAAC;AAAA,MACjD;AACA,YAAM,GAAG,SAAS,EAAE,WAAW,KAAK,CAAC;AAAA,IACzC;AAAA,EACJ;AACA,MAAI,CAAC,OAAQ,OAAM,IAAI,YAAY,iBAAiB,kCAAkC;AACtF,QAAM,oBAAoB,OAAO,QAAQ,cAAc;AACvD,SAAO;AACX;","names":["mkdir","readdir","dirname","join","recipe","output","execFile","promisify","promisify","execFile","execFile","promisify","readdir","lstat","dirname","execute","promisify","execFile","readdir","lstat","dirname","execFile","promisify","execute","promisify","execFile","join","dirname","mkdir","readdir"]}
1
+ {"version":3,"sources":["../src/create/run.ts","../src/create/compose.ts","../src/create/git.ts","../src/create/target.ts","../src/create/stage.ts","../src/create/install.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\nimport { cp, link, mkdir, mkdtemp, readdir, rm, rmdir } from 'node:fs/promises';\nimport { dirname, join } from 'node:path';\nimport type { CreateConfig, RecipeSelection } from './config.js';\nimport { selectionsFor } from './config.js';\nimport { composeRecipes } from './compose.js';\nimport { CreateError } from './errors.js';\nimport { git } from './git.js';\nimport { checkAncestors, checkTargetRace, planTarget } from './target.js';\nimport { listFiles, writeAndValidate } from './stage.js';\nimport { installDependencies, withPlaceholderLockfile } from './install.js';\nimport type { InstallOptions } from './install.js';\n\nexport async function createSite(config: CreateConfig, selections: readonly RecipeSelection[] = selectionsFor(config), installOptions: InstallOptions = {}) {\n const plan = await planTarget(config.target);\n const staging = await mkdtemp(join(dirname(plan.path), '.easy-web-create-'));\n const branch = `easy-web-create-${randomUUID()}`;\n const root = join(staging, 'site');\n let worktree = false;\n let retained = false;\n let ownedTarget = false;\n let ownedMetadata = false;\n const published: string[] = [];\n const directories: string[] = [];\n let result: { target: string; commit: string; branch: string; graphJson: string; graphMermaid: string } | undefined;\n try {\n const site = withPlaceholderLockfile(await composeRecipes(selections));\n await checkTargetRace(plan);\n if (plan.gitRoot) {\n await git(plan.path, ['worktree', 'add', '-b', branch, root, plan.head ?? 'HEAD']);\n worktree = true;\n } else {\n await mkdir(root);\n await git(root, ['init', '--initial-branch=main', '--template=']);\n }\n await writeAndValidate(root, site);\n await checkTargetRace(plan);\n if (!plan.gitRoot) {\n if (!plan.stat) { await mkdir(plan.path); ownedTarget = true; }\n await mkdir(join(plan.path, '.git'));\n ownedMetadata = true;\n await checkAncestors(plan.path);\n // Hard links publish each allow-listed file exclusively; existing paths are never overwritten.\n for (const file of site.files) {\n const destination = join(plan.path, file.path);\n const parents: string[] = [];\n let parent = dirname(destination);\n while (parent !== plan.path) { parents.unshift(parent); parent = dirname(parent); }\n for (const directory of parents) {\n if (!directories.includes(directory)) { await mkdir(directory); directories.push(directory); }\n }\n await link(join(root, file.path), destination);\n published.push(destination);\n }\n const entries = await listFiles(plan.path);\n const expected = site.files.map(({ path }) => path).sort();\n if (JSON.stringify(entries) !== JSON.stringify(expected)) throw new CreateError('INVALID_INPUT', 'Target became occupied during publication');\n }\n if (!plan.gitRoot) {\n for (const entry of await readdir(join(root, '.git'))) {\n await cp(join(root, '.git', entry), join(plan.path, '.git', entry), { recursive: true, force: false, errorOnExist: true });\n }\n }\n const commitRoot = plan.gitRoot ? root : plan.path;\n await git(commitRoot, ['commit', '-m', 'Create easy-web site']);\n const commit = await git(commitRoot, ['rev-parse', 'HEAD']);\n retained = plan.gitRoot;\n result = { target: plan.gitRoot ? root : plan.path, commit, branch: plan.gitRoot ? branch : 'main', graphJson: site.graphJson, graphMermaid: site.graphMermaid };\n } catch (error) {\n const original = error instanceof CreateError\n ? error\n : new CreateError('CREATE_FAILED', 'Site generation/staging failed', { cause: error });\n const cleanupErrors: unknown[] = [];\n const cleanup = async (operation: () => Promise<unknown>): Promise<void> => {\n try { await operation(); } catch (cleanupError) { cleanupErrors.push(cleanupError); }\n };\n for (const path of published.reverse()) await cleanup(() => rm(path));\n for (const path of directories.reverse()) await cleanup(() => rmdir(path));\n if (ownedMetadata) await cleanup(() => rm(join(plan.path, '.git'), { recursive: true }));\n if (ownedTarget) await cleanup(() => rmdir(plan.path));\n if (cleanupErrors.length) Object.defineProperty(original, 'cleanupErrors', { value: cleanupErrors });\n throw original;\n } finally {\n if (!retained) {\n if (worktree) {\n const tracked = (await git(root, ['ls-files', '-z'])).split('\\0').filter(Boolean);\n if (tracked.length) await git(root, ['rm', '--cached', '--', ...tracked]);\n for (const entry of await readdir(root)) {\n if (entry !== '.git') await rm(join(root, entry), { recursive: true });\n }\n await git(plan.path, ['worktree', 'remove', root]);\n await git(plan.path, ['branch', '-d', branch]);\n }\n await rm(staging, { recursive: true });\n }\n }\n if (!result) throw new CreateError('CREATE_FAILED', 'Site creation produced no result');\n await installDependencies(result.target, installOptions);\n return result;\n}\n","import { z } from 'astro/zod';\nimport {\n resolveCapabilityGraph, toCapabilityGraphDocument,\n serializeCapabilityGraphJson, serializeCapabilityGraphMermaid,\n} from '@easy-web/core/recipes';\nimport type { RecipeGeneratedFile, RecipeOutputContribution } from '@easy-web/core/recipes';\nimport type { RecipeSelection } from './config.js';\nimport { invalid } from './errors.js';\n\nexport function outputPath(contribution: RecipeOutputContribution): string {\n const { target } = contribution;\n return contribution.kind === 'route' && target.startsWith('/')\n ? target.endsWith('/') ? `src/pages${target}index.astro` : `src/pages${target}.astro`\n : target;\n}\n\nexport function isFileContribution(contribution: RecipeOutputContribution): boolean {\n return contribution.kind !== 'content' && contribution.kind !== 'binding';\n}\n\nexport function safeOutputPath(path: string): string {\n const segments = path.split('/');\n if (!path || segments.some((segment) => !segment || segment === '.' || segment === '..'\n || /^\\.git$/i.test(segment) || /[\\\\:*?\"<>|]/.test(segment)\n || [...segment].some((character) => character.charCodeAt(0) < 32)\n || /[. ]$/.test(segment) || /^(?:con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\\.|$)/i.test(segment))) {\n invalid(`Unsafe generated path: ${path}`);\n }\n return path;\n}\n\nconst packageFragmentSchema = z.object({\n dependencies: z.record(z.string(), z.string()).optional(),\n devDependencies: z.record(z.string(), z.string()).optional(),\n scripts: z.record(z.string(), z.string()).optional(),\n}).catchall(z.json());\n\nexport function mergePackageFragments(fragments: readonly string[]): string {\n // Accumulator retains every top-level field and merges the three map-valued fields.\n let merged: Record<string, z.infer<ReturnType<typeof z.json>>> = {};\n for (const fragment of fragments) {\n const parsed = packageFragmentSchema.safeParse(JSON.parse(fragment));\n if (!parsed.success) invalid(`Invalid package.json fragment: ${parsed.error.message}`);\n const previous = packageFragmentSchema.parse(merged);\n merged = { ...merged, ...parsed.data };\n for (const key of ['dependencies', 'devDependencies', 'scripts'] as const) {\n if (previous[key] || parsed.data[key]) merged[key] = { ...previous[key], ...parsed.data[key] };\n }\n }\n return `${JSON.stringify(merged, null, 2)}\\n`;\n}\n\nexport interface ComposedSite {\n readonly files: readonly RecipeGeneratedFile[];\n readonly graphJson: string;\n readonly graphMermaid: string;\n}\n\nexport async function composeRecipes(selections: readonly RecipeSelection[]): Promise<ComposedSite> {\n const resolved = resolveCapabilityGraph(selections.map(({ recipe }) => recipe));\n if (!resolved.ok) invalid(`Recipe resolution failed: ${JSON.stringify(resolved.error)}`);\n const graph = resolved.value;\n const owners = new Map<string, string>();\n for (const { recipe } of selections) {\n for (const contribution of recipe.outputContributions.filter(isFileContribution)) {\n const path = safeOutputPath(outputPath(contribution));\n const key = path.toLowerCase();\n if (owners.has(key) && path !== 'package.json') {\n if (path === 'astro.config.mjs' && contribution.kind === 'configuration') {\n invalid('multi-recipe astro.config.mjs merge not yet supported in Phase 1 — select recipes individually or wait for a future composer');\n }\n invalid(`Shared output is not mergeable: ${path}`);\n }\n owners.set(key, path);\n }\n }\n const files = new Map<string, RecipeGeneratedFile>();\n const fragments: string[] = [];\n for (const node of graph.recipes) {\n const selection = selections.find(({ recipe }) => recipe.id === node.id);\n if (!selection) invalid(`Missing selected recipe: ${node.id}`);\n const { recipe } = selection;\n const options = recipe.optionsSchema.parse(selection.options);\n const context = { options, capabilities: graph.capabilities.map(({ id }) => id), contributions: recipe.outputContributions };\n for (const validator of recipe.validators.filter(({ phase }) => phase === 'options')) {\n const issues = await validator.validate(context);\n if (issues.length) invalid(`Recipe validation failed: ${JSON.stringify(issues)}`);\n }\n const output = await recipe.generate(context);\n const declared = recipe.outputContributions.filter(isFileContribution).map(outputPath).sort();\n const generated = output.files.map(({ path }) => safeOutputPath(path)).sort();\n if (new Set(generated).size !== generated.length || JSON.stringify(declared) !== JSON.stringify(generated)) {\n invalid(`Generated files differ from declared contributions: ${recipe.id}`);\n }\n for (const file of output.files) {\n if (file.path === 'package.json') fragments.push(String(file.content));\n else files.set(file.path, file);\n }\n }\n if (fragments.length) files.set('package.json', { path: 'package.json', content: mergePackageFragments(fragments) });\n const output = { files: [...files.values()].sort((a, b) => a.path.localeCompare(b.path, 'en')) };\n for (const { recipe, options } of selections) {\n for (const validator of recipe.validators.filter(({ phase }) => phase === 'output')) {\n const issues = await validator.validate({ options, capabilities: graph.capabilities.map(({ id }) => id), contributions: recipe.outputContributions, output });\n if (issues.length) invalid(`Recipe validation failed: ${JSON.stringify(issues)}`);\n }\n }\n const document = toCapabilityGraphDocument(graph);\n if (!document.ok) invalid(`Graph serialization failed: ${document.error.code}`);\n return { ...output, graphJson: serializeCapabilityGraphJson(document.value), graphMermaid: serializeCapabilityGraphMermaid(document.value) };\n}\n","import { execFile } from 'node:child_process';\nimport { promisify } from 'node:util';\nimport { CreateError } from './errors.js';\n\nconst execute = promisify(execFile);\n\nexport async function git(cwd: string, args: readonly string[]): Promise<string> {\n const env: NodeJS.ProcessEnv = { ...process.env, GIT_MASTER: '1', GIT_TERMINAL_PROMPT: '0' };\n // Ambient Git overrides must not redirect operations into the invoker's repository.\n for (const key of Object.keys(env)) {\n if (key.startsWith('GIT_') && !['GIT_MASTER', 'GIT_TERMINAL_PROMPT', 'GIT_AUTHOR_NAME', 'GIT_AUTHOR_EMAIL', 'GIT_COMMITTER_NAME', 'GIT_COMMITTER_EMAIL'].includes(key)) delete env[key];\n }\n try {\n const result = await execute('git', ['-c', 'core.hooksPath=', '-c', 'commit.gpgSign=false', ...args], {\n cwd, env, timeout: 30_000, maxBuffer: 4 * 1024 * 1024,\n });\n return result.stdout.trimEnd();\n } catch (error) {\n throw new CreateError('CREATE_FAILED', `Git operation failed: ${args[0]}`, { cause: error });\n }\n}\n","import { lstat, readdir, realpath } from 'node:fs/promises';\nimport { dirname, parse, resolve } from 'node:path';\nimport type { Stats } from 'node:fs';\nimport { execFile } from 'node:child_process';\nimport { promisify } from 'node:util';\nimport { git } from './git.js';\nimport { invalid } from './errors.js';\n\nexport async function statOrMissing(path: string): Promise<Stats | undefined> {\n try {\n return await lstat(path);\n } catch (error) {\n if (error instanceof Error && 'code' in error && error.code === 'ENOENT') return undefined;\n throw error;\n }\n}\n\nexport async function checkAncestors(path: string): Promise<void> {\n if (process.platform === 'win32') {\n const result = await promisify(execFile)('powershell.exe', ['-NoProfile', '-NonInteractive', '-Command',\n \"Set-StrictMode -Version Latest; $ErrorActionPreference='Stop'; $path=$env:EASY_WEB_CHECK_PATH; while ($path) { if (Test-Path -LiteralPath $path) { $item=Get-Item -Force -LiteralPath $path; if (($item.Attributes -band [IO.FileAttributes]::ReparsePoint) -ne 0) { 'reparse'; break } }; $path=[IO.Path]::GetDirectoryName($path) }\"],\n { env: { ...process.env, EASY_WEB_CHECK_PATH: path }, timeout: 15_000 });\n if (result.stdout.trim() === 'reparse') invalid(`Reparse-point target ancestor: ${path}`);\n }\n let current = path;\n while (true) {\n const stat = await statOrMissing(current);\n if (stat && (!stat.isDirectory() || stat.isSymbolicLink())) invalid(`Unsafe target ancestor: ${current}`);\n if (current === parse(current).root) break;\n current = dirname(current);\n }\n}\n\nexport interface TargetPlan {\n readonly path: string;\n readonly stat: Stats | undefined;\n readonly gitRoot: boolean;\n readonly head?: string;\n}\n\nexport async function planTarget(input: string): Promise<TargetPlan> {\n const path = resolve(input);\n await checkAncestors(path);\n const stat = await statOrMissing(path);\n if (!stat) {\n if (!(await statOrMissing(dirname(path)))) invalid('Target parent directory must exist');\n return { path, stat, gitRoot: false };\n }\n const entries = await readdir(path);\n if (!entries.length) return { path, stat, gitRoot: false };\n if (entries.length !== 1 || entries[0] !== '.git') invalid(`Target is not empty (including hidden/ignored files): ${path}`);\n const metadata = await lstat(resolve(path, '.git'));\n if (metadata.isSymbolicLink()) invalid('Git metadata must not be a link');\n const root = await git(path, ['rev-parse', '--show-toplevel']);\n if (await realpath(root) !== await realpath(path)) invalid('Target must be a Git root or worktree');\n const head = await git(path, ['rev-parse', '--verify', 'HEAD']);\n if (await git(path, ['ls-tree', '-r', '--name-only', head])\n || await git(path, ['ls-files', '--stage'])\n || await git(path, ['status', '--porcelain', '--untracked-files=all', '--ignored'])) {\n invalid('Target Git HEAD tree, index and worktree must be empty and clean');\n }\n return { path, stat, gitRoot: true, head };\n}\n\nexport async function checkTargetRace(plan: TargetPlan): Promise<void> {\n const current = await planTarget(plan.path);\n if (current.stat?.ino !== plan.stat?.ino || current.stat?.dev !== plan.stat?.dev\n || current.gitRoot !== plan.gitRoot || current.head !== plan.head) {\n invalid('Target changed after planning');\n }\n}\n","import { execFile } from 'node:child_process';\nimport { promisify } from 'node:util';\nimport { mkdir, readdir, writeFile, lstat } from 'node:fs/promises';\nimport { dirname, join } from 'node:path';\nimport type { ComposedSite } from './compose.js';\nimport { safeOutputPath } from './compose.js';\nimport { invalid } from './errors.js';\nimport { git } from './git.js';\n\nconst execute = promisify(execFile);\n\nexport async function listFiles(root: string, prefix = ''): Promise<readonly string[]> {\n const files: string[] = [];\n for (const name of await readdir(join(root, prefix))) {\n if (!prefix && name === '.git') continue;\n const path = prefix ? `${prefix}/${name}` : name;\n const stat = await lstat(join(root, path));\n if (stat.isSymbolicLink()) invalid(`Staging contains a link: ${path}`);\n if (stat.isDirectory()) files.push(...await listFiles(root, path));\n else if (stat.isFile()) files.push(path);\n else invalid(`Staging contains a special file: ${path}`);\n }\n return files.sort();\n}\n\nexport async function writeAndValidate(root: string, site: ComposedSite): Promise<void> {\n for (const file of site.files) {\n const path = join(root, safeOutputPath(file.path));\n await mkdir(dirname(path), { recursive: true });\n await writeFile(path, file.content, { flag: 'wx' });\n if (file.path.endsWith('.json')) JSON.parse(String(file.content));\n if (/\\.(?:mjs|cjs|js)$/.test(file.path)) {\n await execute(process.execPath, ['--check', path], { timeout: 30_000 });\n }\n }\n const expected = site.files.map(({ path }) => path).sort();\n if (JSON.stringify(await listFiles(root)) !== JSON.stringify(expected)) invalid('Staging tree differs from the output allow-list');\n await git(root, ['add', '--', ...expected]);\n const staged = (await git(root, ['diff', '--cached', '--name-status', '--no-renames', '-z'])).split('\\0').filter(Boolean);\n const paths: string[] = [];\n for (let index = 0; index < staged.length; index += 2) {\n if (staged[index] !== 'A') invalid('Staged diff must contain additions only');\n const path = staged[index + 1];\n if (path) paths.push(path);\n }\n if (JSON.stringify(paths.sort()) !== JSON.stringify(expected)) invalid('Git index differs from the output allow-list');\n}\n","import { execFile } from 'node:child_process';\nimport { promisify } from 'node:util';\nimport type { RecipeGeneratedFile } from '@easy-web/core/recipes';\nimport type { ComposedSite } from './compose.js';\nimport { CreateError, invalid } from './errors.js';\n\nconst execute = promisify(execFile);\nconst dependencyRange = /^(?:[~^]?\\d+(?:\\.\\d+){0,2}(?:-[0-9A-Za-z.-]+)?|[<>=*xX| .\\d~^-]+)$/;\n\ninterface PackageManifest {\n readonly dependencies?: Readonly<Record<string, string>>;\n readonly devDependencies?: Readonly<Record<string, string>>;\n readonly optionalDependencies?: Readonly<Record<string, string>>;\n}\n\nexport type InstallRunner = (cwd: string, command: string, args: readonly string[]) => Promise<void>;\n\nexport interface InstallOptions {\n readonly install?: boolean;\n readonly runner?: InstallRunner;\n}\n\nfunction quote(value: string): string {\n return `'${value.replaceAll(\"'\", \"''\")}'`;\n}\n\nfunction packageManifest(site: ComposedSite): PackageManifest {\n const file = site.files.find(({ path }) => path === 'package.json');\n if (!file) invalid('Generated site has no package.json');\n return JSON.parse(String(file.content)) as PackageManifest;\n}\n\nfunction dependencyGroups(manifest: PackageManifest): readonly [string, Readonly<Record<string, string>>][] {\n return [\n ['dependencies', manifest.dependencies ?? {}],\n ['devDependencies', manifest.devDependencies ?? {}],\n ['optionalDependencies', manifest.optionalDependencies ?? {}],\n ];\n}\n\nexport function validateDependencySources(site: ComposedSite): void {\n for (const [group, dependencies] of dependencyGroups(packageManifest(site))) {\n for (const [name, source] of Object.entries(dependencies)) {\n if (!dependencyRange.test(source)) {\n invalid(`Unsupported ${group} source for ${name}: ${source}`);\n }\n }\n }\n}\n\nexport function createPlaceholderLockfile(site: ComposedSite): RecipeGeneratedFile {\n const manifest = packageManifest(site);\n const lines = [\n \"lockfileVersion: '9.0'\",\n '',\n 'settings:',\n ' autoInstallPeers: true',\n ' excludeLinksFromLockfile: false',\n '',\n 'importers:',\n '',\n ' .:',\n ];\n for (const [group, dependencies] of dependencyGroups(manifest)) {\n const entries = Object.entries(dependencies).sort(([left], [right]) => left.localeCompare(right, 'en'));\n if (!entries.length) continue;\n lines.push(` ${group}:`);\n for (const [name, specifier] of entries) {\n lines.push(` ${quote(name)}:`, ` specifier: ${quote(specifier)}`);\n }\n }\n return { path: 'pnpm-lock.yaml', content: `${lines.join('\\n')}\\n` };\n}\n\nexport function withPlaceholderLockfile(site: ComposedSite): ComposedSite {\n validateDependencySources(site);\n return { ...site, files: [...site.files, createPlaceholderLockfile(site)].sort((a, b) => a.path.localeCompare(b.path, 'en')) };\n}\n\nconst defaultRunner: InstallRunner = async (cwd, command, args) => {\n if (process.platform === 'win32') {\n await execute(process.env.ComSpec ?? 'cmd.exe', ['/d', '/s', '/c', 'pnpm.cmd install'], { cwd });\n } else {\n await execute(command, [...args], { cwd });\n }\n};\n\nexport async function installDependencies(target: string, options: InstallOptions = {}): Promise<void> {\n if (options.install !== true) return;\n const command = process.platform === 'win32' ? 'pnpm.cmd' : 'pnpm';\n try {\n await (options.runner ?? defaultRunner)(target, command, ['install']);\n } catch (error) {\n throw new CreateError('CREATE_FAILED', 'Dependency installation failed', { cause: error });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OAAO,CAAC;AACxE,mBAAW,SAAS,MAAMG,SAAQ,IAAI,GAAG;AACrC,cAAI,UAAU,OAAQ,OAAM,GAAGH,MAAK,MAAM,KAAK,GAAG,EAAE,WAAW,KAAK,CAAC;AAAA,QACzE;AACA,cAAM,IAAI,KAAK,MAAM,CAAC,YAAY,UAAU,IAAI,CAAC;AACjD,cAAM,IAAI,KAAK,MAAM,CAAC,UAAU,MAAM,MAAM,CAAC;AAAA,MACjD;AACA,YAAM,GAAG,SAAS,EAAE,WAAW,KAAK,CAAC;AAAA,IACzC;AAAA,EACJ;AACA,MAAI,CAAC,OAAQ,OAAM,IAAI,YAAY,iBAAiB,kCAAkC;AACtF,QAAM,oBAAoB,OAAO,QAAQ,cAAc;AACvD,SAAO;AACX;","names":["mkdir","readdir","dirname","join","recipe","output","execFile","promisify","promisify","execFile","execFile","promisify","readdir","lstat","dirname","execute","promisify","execFile","readdir","lstat","dirname","execFile","promisify","execute","promisify","execFile","join","dirname","mkdir","readdir"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easy-web/cli",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "description": "Create-only command-line interface for generating easy-web sites.",
5
5
  "type": "module",
6
6
  "engines": {
@@ -16,9 +16,9 @@
16
16
  "dependencies": {
17
17
  "mri": "^1.2.0",
18
18
  "astro": "^7.3.5",
19
- "@easy-web/core": "1.14.0",
20
- "@easy-web/auth": "1.14.0",
21
- "@easy-web/cms-adapters": "1.14.0"
19
+ "@easy-web/core": "1.16.0",
20
+ "@easy-web/auth": "1.16.0",
21
+ "@easy-web/cms-adapters": "1.16.0"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@types/node": "^24.0.0",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/create/config.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { z } from 'astro/zod';\nimport { shellRecipe, createContentSiteRecipes, generatedContentCompositionSchema } from '@easy-web/core/recipes';\nimport { authRecipe } from '@easy-web/auth/recipe';\nimport { cmsMediaRecipe, cmsSiteOptionsSchema, createCmsContentSiteRecipes } from '@easy-web/cms-adapters';\nimport type { RecipeMetadata } from '@easy-web/core/recipes';\nimport { CreateError, invalid } from './errors.js';\n\nconst configSchema = z.strictObject({\n target: z.string().trim().min(1),\n composition: generatedContentCompositionSchema.optional(),\n recipes: z.strictObject({\n shell: shellRecipe.optionsSchema.default(() => shellRecipe.optionsSchema.parse({})),\n auth: authRecipe.optionsSchema.optional(),\n cms: z.union([cmsSiteOptionsSchema, cmsMediaRecipe.optionsSchema]).optional(),\n }).default(() => ({ shell: shellRecipe.optionsSchema.parse({}) })),\n}).superRefine((config, context) => {\n const cms = config.recipes.cms;\n if (config.composition && cms && 'composition' in cms) {\n context.addIssue({ code: 'custom', path: ['recipes', 'cms', 'composition'], message: 'Declare composition only once, at the top level, when generating content pages with CMS' });\n }\n if (!config.composition && cms && !('composition' in cms)) {\n context.addIssue({ code: 'custom', path: ['composition'], message: 'CMS editor generation requires a top-level content composition' });\n }\n if (config.composition) {\n const hasCmsBindings = config.composition.contentTypes.some((type) => type.bindings.includes('cms-admin'));\n if (hasCmsBindings && !cms) context.addIssue({ code: 'custom', path: ['recipes', 'cms'], message: 'cms-admin bindings require the CMS recipe' });\n if (cms && !hasCmsBindings) context.addIssue({ code: 'custom', path: ['composition'], message: 'CMS generation requires at least one cms-admin content binding' });\n }\n if (config.composition && config.recipes.auth) {\n context.addIssue({ code: 'custom', path: ['recipes', 'auth'], message: 'Content composition with application auth is not yet supported' });\n }\n if (config.composition && config.recipes.shell.defaultLocale !== config.composition.contentLocales[0]) {\n context.addIssue({ code: 'custom', path: ['recipes', 'shell', 'defaultLocale'], message: 'shell.defaultLocale must match the content composition locale' });\n }\n}).readonly();\n\nexport type CreateConfig = z.infer<typeof configSchema>;\n\nexport interface RecipeSelection {\n readonly recipe: RecipeMetadata;\n readonly options: unknown;\n}\n\n// Capture each recipe's typed options at admission; the composer sees one uniform hook type.\nfunction select<Options>(recipe: RecipeMetadata<Options>, options: Options): RecipeSelection {\n return {\n options,\n recipe: {\n ...recipe,\n generate: (context) => recipe.generate({ ...context, options }),\n validators: recipe.validators.map((validator) => ({\n ...validator,\n validate: (context) => validator.validate({ ...context, options }),\n })),\n },\n };\n}\n\nexport function selectionsFor(config: CreateConfig): readonly RecipeSelection[] {\n const cmsOptions = config.recipes.cms;\n const cmsSite = config.composition && cmsOptions && !('composition' in cmsOptions)\n ? createCmsContentSiteRecipes(config.composition, cmsOptions) : undefined;\n const contentRecipes = cmsSite ?? (config.composition ? createContentSiteRecipes(config.composition) : undefined);\n return [\n select(contentRecipes?.shell ?? shellRecipe, config.recipes.shell),\n ...(contentRecipes ? [select(contentRecipes.content, {})] : []),\n ...(cmsSite ? [select(cmsSite.cms, {})] : []),\n ...(cmsOptions && 'composition' in cmsOptions ? [select(cmsMediaRecipe, cmsOptions)] : []),\n ...(config.recipes.auth ? [select(authRecipe, config.recipes.auth)] : []),\n ];\n}\n\nexport function parseCreateConfig(value: unknown): CreateConfig {\n const parsed = configSchema.safeParse(value);\n if (!parsed.success) invalid(`Invalid create config: ${parsed.error.message}`);\n return parsed.data;\n}\n\nexport async function readCreateConfig(path: string): Promise<CreateConfig> {\n try {\n return parseCreateConfig(JSON.parse(await readFile(path, 'utf8')));\n } catch (error) {\n if (error instanceof CreateError) throw error;\n throw new CreateError('INVALID_INPUT', `Cannot read create config: ${path}`, { cause: error });\n }\n}\n"],"mappings":";;;;;;;AAAA,SAAS,gBAAgB;AACzB,SAAS,SAAS;AAClB,SAAS,aAAa,0BAA0B,yCAAyC;AACzF,SAAS,kBAAkB;AAC3B,SAAS,gBAAgB,sBAAsB,mCAAmC;AAIlF,IAAM,eAAe,EAAE,aAAa;AAAA,EAChC,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC;AAAA,EAC/B,aAAa,kCAAkC,SAAS;AAAA,EACxD,SAAS,EAAE,aAAa;AAAA,IACpB,OAAO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