@easy-web/cli 0.1.3 → 0.2.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
@@ -1,6 +1,6 @@
1
1
  # @easy-web/cli
2
2
 
3
- Private Phase-1 create-only CLI. Generation is offline by default; installation is explicit.
3
+ Phase-1 create-only CLI. Generation is offline by default; installation is explicit.
4
4
 
5
5
  ```sh
6
6
  easy-web create --config ./create.json --json
@@ -21,12 +21,109 @@ easy-web create --config ./create.json --install
21
21
  ```
22
22
 
23
23
  Shell is always selected; omit `auth` or `cms` to exclude them. Recipe options are
24
- parsed with the package-owned schemas. CMS options use `composition`, `backend`,
25
- `mediaRoots` and optional `uiLocale`; selecting CMS currently fails before generation
26
- because both shell and CMS contribute `astro.config.mjs`. Multi-recipe JS config
27
- merging is not supported in Phase 1. Package dependencies, devDependencies and
24
+ parsed with the package-owned schemas. CMS editor generation uses the top-level
25
+ content composition, as shown below. Arbitrary multi-recipe JS config merging is
26
+ not supported in Phase 1. Package dependencies, devDependencies and
28
27
  scripts merge additively in resolver order; the later value wins a key collision.
29
28
 
29
+ ## Content-aware generation
30
+
31
+ An optional top-level `composition` selects content independently of CMS. The CLI
32
+ resolves a deterministic capability graph and runs package-owned recipes; it does
33
+ not clone a site, copy a pilot, or read a customer repository.
34
+
35
+ ```json
36
+ {
37
+ "target": "./new-site",
38
+ "recipes": {
39
+ "shell": { "siteName": "Example Site", "defaultLocale": "en", "noIndex": true }
40
+ },
41
+ "composition": {
42
+ "contentLocales": ["en"],
43
+ "contentTypes": [{
44
+ "id": "entries",
45
+ "primary": true,
46
+ "labels": { "en": "Entries" },
47
+ "routes": { "en": "/entries/" },
48
+ "traits": ["title", "slug", "summary", "image", "body"],
49
+ "bindings": ["list", "detail", "navigation"]
50
+ }]
51
+ }
52
+ }
53
+ ```
54
+
55
+ This first slice supports one locale matching `shell.defaultLocale`, one or more
56
+ content types, required `title`/`slug`/`body`, optional `summary`/`image`, and
57
+ `list`/`detail` plus optional `navigation` bindings. At most one type can be
58
+ `primary`; that marker describes its graph role, not a homepage renderer.
59
+ Routes use non-reserved lowercase path segments and must not overlap.
60
+ Unsupported traits, homepage bindings, multiple locales, and combining this
61
+ composition with application auth fail as invalid input, not partial output.
62
+ Existing shell-only and shell-plus-auth inputs retain their earlier behavior.
63
+
64
+ Core owns schema, sample-content and page generation. The generated definitions
65
+ record the composition and export Astro collections built from the shared trait
66
+ schemas. Typed adapters map `summary` to the Card contract's `description`, resolve
67
+ `href` from the configured route and slug, and prove capability conformance with
68
+ `assertImplements`. Detail pages use the rendered-body contract; image-enabled
69
+ sites declare Sharp and supply a local example asset handled by Astro.
70
+ The graph reports content roles and presentation bindings separately from files.
71
+
72
+ After creation, run `pnpm install`, replace the placeholder `site` URL in
73
+ `astro.config.mjs`, then run `pnpm typecheck` and `pnpm build`. The generated shell
74
+ includes a strict Astro `tsconfig.json`, `@astrojs/check`, shared tokens and
75
+ `SeoHead`. The SEO integration owns `robots.txt`; `noIndex: true` emits no sitemap,
76
+ disallows crawling and adds noindex metadata to generated pages. This is not
77
+ authentication and does not enforce a deployment environment's access policy.
78
+ Definitions and pages are generated source: editing the recorded trait list alone
79
+ does not regenerate schemas or routes. The CLI still has no modify/update command.
80
+
81
+ ### Add CMS to the same content composition
82
+
83
+ Add `cms-admin` to the bindings of each editable content type and add these recipe
84
+ options alongside `recipes.shell`:
85
+
86
+ ```json
87
+ {
88
+ "cms": {
89
+ "backend": {
90
+ "repo": "YOUR_ORG/YOUR_PROJECT/YOUR_REPOSITORY",
91
+ "tenantId": "YOUR_TENANT_ID",
92
+ "appId": "YOUR_PUBLIC_APP_ID",
93
+ "branch": "main"
94
+ },
95
+ "mediaRoots": ["src/assets/images"],
96
+ "uiLocale": "en"
97
+ }
98
+ }
99
+ ```
100
+
101
+ Do not repeat `composition` inside `recipes.cms`. Core still owns the collection
102
+ schemas, routes, example content and the only `astro.config.mjs`. The CMS add-on
103
+ reads the recorded composition at build time to generate Decap forms in the
104
+ standalone `/admin/` page, using the existing `AdminPage` component. Only content
105
+ types with `cms-admin` appear in the editor; no binding means no editor exposure.
106
+ CMS without a bound type, or a CMS binding without the add-on, is rejected.
107
+
108
+ The first media root owns editor uploads and the generated example image; all
109
+ configured roots get explicit source-asset previews. Roots must be distinct and
110
+ non-overlapping. Astro's markdown processor handles Decap's `/src/assets/...`
111
+ body-image URLs, while public pages retain optimized assets. The shared SEO
112
+ integration and `shell.noIndex` policy remain intact; the editor is always
113
+ noindex and excluded from the sitemap. These crawler settings are not authentication.
114
+
115
+ This writes public backend identifiers, never credentials. Configure the Azure
116
+ DevOps repository, public Entra application and permissions separately; generation
117
+ does not provision, authenticate, deploy or validate a live CMS login. Saves use
118
+ the configured branch (default `main`) without enabling an editorial workflow.
119
+
120
+ The published standalone `cmsMediaRecipe` API remains available with its older
121
+ nested composition and full trait support. That recipe owns a complete config and
122
+ schema and is not composable with the CLI shell; use the top-level composition
123
+ path above for generated content sites.
124
+
125
+ ## Target and validation boundary
126
+
30
127
  Targets must have an existing parent and be nonexistent or empty, including hidden
31
128
  and ignored content. Linked paths/junctions and unsafe output paths are rejected.
32
129
  An existing clean Git root/worktree with an empty committed HEAD tree and index
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-FKY2BS4K.js");
200
- const { createSite } = await import("./run-KXSV4EFL.js");
199
+ const { readCreateConfig } = await import("./config-FBJBWD2V.js");
200
+ const { createSite } = await import("./run-FINIRCSO.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}
@@ -0,0 +1,85 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ CreateError,
4
+ invalid
5
+ } from "./chunk-TCE4BQ7M.js";
6
+
7
+ // src/create/config.ts
8
+ import { readFile } from "fs/promises";
9
+ import { z } from "astro/zod";
10
+ import { shellRecipe, createContentSiteRecipes, generatedContentCompositionSchema } from "@easy-web/core/recipes";
11
+ import { authRecipe } from "@easy-web/auth/recipe";
12
+ import { cmsMediaRecipe, cmsSiteOptionsSchema, createCmsContentSiteRecipes } from "@easy-web/cms-adapters";
13
+ var configSchema = z.strictObject({
14
+ target: z.string().trim().min(1),
15
+ composition: generatedContentCompositionSchema.optional(),
16
+ recipes: z.strictObject({
17
+ shell: shellRecipe.optionsSchema.default(() => shellRecipe.optionsSchema.parse({})),
18
+ auth: authRecipe.optionsSchema.optional(),
19
+ cms: z.union([cmsSiteOptionsSchema, cmsMediaRecipe.optionsSchema]).optional()
20
+ }).default(() => ({ shell: shellRecipe.optionsSchema.parse({}) }))
21
+ }).superRefine((config, context) => {
22
+ const cms = config.recipes.cms;
23
+ if (config.composition && cms && "composition" in cms) {
24
+ context.addIssue({ code: "custom", path: ["recipes", "cms", "composition"], message: "Declare composition only once, at the top level, when generating content pages with CMS" });
25
+ }
26
+ if (!config.composition && cms && !("composition" in cms)) {
27
+ context.addIssue({ code: "custom", path: ["composition"], message: "CMS editor generation requires a top-level content composition" });
28
+ }
29
+ if (config.composition) {
30
+ const hasCmsBindings = config.composition.contentTypes.some((type) => type.bindings.includes("cms-admin"));
31
+ 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" });
33
+ }
34
+ if (config.composition && config.recipes.auth) {
35
+ context.addIssue({ code: "custom", path: ["recipes", "auth"], message: "Content composition with application auth is not yet supported" });
36
+ }
37
+ if (config.composition && config.recipes.shell.defaultLocale !== config.composition.contentLocales[0]) {
38
+ context.addIssue({ code: "custom", path: ["recipes", "shell", "defaultLocale"], message: "shell.defaultLocale must match the content composition locale" });
39
+ }
40
+ }).readonly();
41
+ function select(recipe, options) {
42
+ return {
43
+ options,
44
+ recipe: {
45
+ ...recipe,
46
+ generate: (context) => recipe.generate({ ...context, options }),
47
+ validators: recipe.validators.map((validator) => ({
48
+ ...validator,
49
+ validate: (context) => validator.validate({ ...context, options })
50
+ }))
51
+ }
52
+ };
53
+ }
54
+ function selectionsFor(config) {
55
+ 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);
58
+ return [
59
+ select(contentRecipes?.shell ?? shellRecipe, config.recipes.shell),
60
+ ...contentRecipes ? [select(contentRecipes.content, {})] : [],
61
+ ...cmsSite ? [select(cmsSite.cms, {})] : [],
62
+ ...cmsOptions && "composition" in cmsOptions ? [select(cmsMediaRecipe, cmsOptions)] : [],
63
+ ...config.recipes.auth ? [select(authRecipe, config.recipes.auth)] : []
64
+ ];
65
+ }
66
+ function parseCreateConfig(value) {
67
+ const parsed = configSchema.safeParse(value);
68
+ if (!parsed.success) invalid(`Invalid create config: ${parsed.error.message}`);
69
+ return parsed.data;
70
+ }
71
+ async function readCreateConfig(path) {
72
+ try {
73
+ return parseCreateConfig(JSON.parse(await readFile(path, "utf8")));
74
+ } catch (error) {
75
+ if (error instanceof CreateError) throw error;
76
+ throw new CreateError("INVALID_INPUT", `Cannot read create config: ${path}`, { cause: error });
77
+ }
78
+ }
79
+
80
+ export {
81
+ selectionsFor,
82
+ parseCreateConfig,
83
+ readCreateConfig
84
+ };
85
+ //# sourceMappingURL=chunk-5OEGZ74L.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, 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,I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,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-GMXLQJ4E.js";
6
+ } from "./chunk-5OEGZ74L.js";
7
7
  import "./chunk-TCE4BQ7M.js";
8
8
  export {
9
9
  parseCreateConfig,
10
10
  readCreateConfig,
11
11
  selectionsFor
12
12
  };
13
- //# sourceMappingURL=config-FKY2BS4K.js.map
13
+ //# sourceMappingURL=config-FBJBWD2V.js.map
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  selectionsFor
4
- } from "./chunk-GMXLQJ4E.js";
4
+ } from "./chunk-5OEGZ74L.js";
5
5
  import {
6
6
  CreateError,
7
7
  invalid
@@ -22,7 +22,10 @@ import {
22
22
  } from "@easy-web/core/recipes";
23
23
  function outputPath(contribution) {
24
24
  const { target } = contribution;
25
- return contribution.kind === "route" && target.startsWith("/") ? target === "/" ? "src/pages/index.astro" : `src/pages${target}.astro` : target;
25
+ return contribution.kind === "route" && target.startsWith("/") ? target.endsWith("/") ? `src/pages${target}index.astro` : `src/pages${target}.astro` : target;
26
+ }
27
+ function isFileContribution(contribution) {
28
+ return contribution.kind !== "content" && contribution.kind !== "binding";
26
29
  }
27
30
  function safeOutputPath(path) {
28
31
  const segments = path.split("/");
@@ -56,7 +59,7 @@ async function composeRecipes(selections) {
56
59
  const graph = resolved.value;
57
60
  const owners = /* @__PURE__ */ new Map();
58
61
  for (const { recipe } of selections) {
59
- for (const contribution of recipe.outputContributions) {
62
+ for (const contribution of recipe.outputContributions.filter(isFileContribution)) {
60
63
  const path = safeOutputPath(outputPath(contribution));
61
64
  const key = path.toLowerCase();
62
65
  if (owners.has(key) && path !== "package.json") {
@@ -81,7 +84,7 @@ async function composeRecipes(selections) {
81
84
  if (issues.length) invalid(`Recipe validation failed: ${JSON.stringify(issues)}`);
82
85
  }
83
86
  const output2 = await recipe.generate(context);
84
- const declared = recipe.outputContributions.map(outputPath).sort();
87
+ const declared = recipe.outputContributions.filter(isFileContribution).map(outputPath).sort();
85
88
  const generated = output2.files.map(({ path }) => safeOutputPath(path)).sort();
86
89
  if (new Set(generated).size !== generated.length || JSON.stringify(declared) !== JSON.stringify(generated)) {
87
90
  invalid(`Generated files differ from declared contributions: ${recipe.id}`);
@@ -402,4 +405,4 @@ async function createSite(config, selections = selectionsFor(config), installOpt
402
405
  export {
403
406
  createSite
404
407
  };
405
- //# sourceMappingURL=run-KXSV4EFL.js.map
408
+ //# sourceMappingURL=run-FINIRCSO.js.map
@@ -0,0 +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,SAAAA,QAAO,SAAS,WAAAC,UAAS,IAAI,aAAa;AAC7D,SAAS,WAAAC,UAAS,QAAAC,aAAY;;;ACF9B,SAAS,SAAS;AAClB;AAAA,EACI;AAAA,EAAwB;AAAA,EACxB;AAAA,EAA8B;AAAA,OAC3B;AAKA,SAAS,WAAW,cAAgD;AACvE,QAAM,EAAE,OAAO,IAAI;AACnB,SAAO,aAAa,SAAS,WAAW,OAAO,WAAW,GAAG,IACvD,OAAO,SAAS,GAAG,IAAI,YAAY,MAAM,gBAAgB,YAAY,MAAM,WAC3E;AACV;AAEO,SAAS,mBAAmB,cAAiD;AAChF,SAAO,aAAa,SAAS,aAAa,aAAa,SAAS;AACpE;AAEO,SAAS,eAAe,MAAsB;AACjD,QAAM,WAAW,KAAK,MAAM,GAAG;AAC/B,MAAI,CAAC,QAAQ,SAAS,KAAK,CAAC,YAAY,CAAC,WAAW,YAAY,OAAO,YAAY,QAC5E,WAAW,KAAK,OAAO,KAAK,cAAc,KAAK,OAAO,KACtD,CAAC,GAAG,OAAO,EAAE,KAAK,CAAC,cAAc,UAAU,WAAW,CAAC,IAAI,EAAE,KAC7D,QAAQ,KAAK,OAAO,KAAK,kDAAkD,KAAK,OAAO,CAAC,GAAG;AAC9F,YAAQ,0BAA0B,IAAI,EAAE;AAAA,EAC5C;AACA,SAAO;AACX;AAEA,IAAM,wBAAwB,EAAE,OAAO;AAAA,EACnC,cAAc,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,EAAE,SAAS;AAAA,EACxD,iBAAiB,EAAE,OAAO,EAAE,OAAO,GAAG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,CAAC,MAAM,YAAY,MAAM,GAAG,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.1.3",
3
+ "version": "0.2.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.8.0",
20
- "@easy-web/auth": "1.8.0",
21
- "@easy-web/cms-adapters": "1.8.0"
19
+ "@easy-web/core": "1.9.0",
20
+ "@easy-web/auth": "1.9.0",
21
+ "@easy-web/cms-adapters": "1.9.0"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@types/node": "^24.0.0",
@@ -1,60 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- CreateError,
4
- invalid
5
- } from "./chunk-TCE4BQ7M.js";
6
-
7
- // src/create/config.ts
8
- import { readFile } from "fs/promises";
9
- import { z } from "astro/zod";
10
- import { shellRecipe } from "@easy-web/core/recipes";
11
- import { authRecipe } from "@easy-web/auth/recipe";
12
- import { cmsMediaRecipe } from "@easy-web/cms-adapters";
13
- var configSchema = z.strictObject({
14
- target: z.string().trim().min(1),
15
- recipes: z.strictObject({
16
- shell: shellRecipe.optionsSchema.default(() => shellRecipe.optionsSchema.parse({})),
17
- auth: authRecipe.optionsSchema.optional(),
18
- cms: cmsMediaRecipe.optionsSchema.optional()
19
- }).default(() => ({ shell: shellRecipe.optionsSchema.parse({}) }))
20
- }).readonly();
21
- function select(recipe, options) {
22
- return {
23
- options,
24
- recipe: {
25
- ...recipe,
26
- generate: (context) => recipe.generate({ ...context, options }),
27
- validators: recipe.validators.map((validator) => ({
28
- ...validator,
29
- validate: (context) => validator.validate({ ...context, options })
30
- }))
31
- }
32
- };
33
- }
34
- function selectionsFor(config) {
35
- return [
36
- select(shellRecipe, config.recipes.shell),
37
- ...config.recipes.cms ? [select(cmsMediaRecipe, config.recipes.cms)] : [],
38
- ...config.recipes.auth ? [select(authRecipe, config.recipes.auth)] : []
39
- ];
40
- }
41
- function parseCreateConfig(value) {
42
- const parsed = configSchema.safeParse(value);
43
- if (!parsed.success) invalid(`Invalid create config: ${parsed.error.message}`);
44
- return parsed.data;
45
- }
46
- async function readCreateConfig(path) {
47
- try {
48
- return parseCreateConfig(JSON.parse(await readFile(path, "utf8")));
49
- } catch (error) {
50
- if (error instanceof CreateError) throw error;
51
- throw new CreateError("INVALID_INPUT", `Cannot read create config: ${path}`, { cause: error });
52
- }
53
- }
54
-
55
- export {
56
- selectionsFor,
57
- parseCreateConfig,
58
- readCreateConfig
59
- };
60
- //# sourceMappingURL=chunk-GMXLQJ4E.js.map
@@ -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 } from '@easy-web/core/recipes';\nimport { authRecipe } from '@easy-web/auth/recipe';\nimport { cmsMediaRecipe } 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 recipes: z.strictObject({\n shell: shellRecipe.optionsSchema.default(() => shellRecipe.optionsSchema.parse({})),\n auth: authRecipe.optionsSchema.optional(),\n cms: cmsMediaRecipe.optionsSchema.optional(),\n }).default(() => ({ shell: shellRecipe.optionsSchema.parse({}) })),\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 return [\n select(shellRecipe, config.recipes.shell),\n ...(config.recipes.cms ? [select(cmsMediaRecipe, config.recipes.cms)] : []),\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,mBAAmB;AAC5B,SAAS,kBAAkB;AAC3B,SAAS,sBAAsB;AAI/B,IAAM,eAAe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AkB,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":[]}
@@ -1 +0,0 @@
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 === '/' ? 'src/pages/index.astro' : `src/pages${target}.astro`\n : target;\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) {\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.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,SAAAA,QAAO,SAAS,WAAAC,UAAS,IAAI,aAAa;AAC7D,SAAS,WAAAC,UAAS,QAAAC,aAAY;;;ACF9B,SAAS,SAAS;AAClB;AAAA,EACI;AAAA,EAAwB;AAAA,EACxB;AAAA,EAA8B;AAAA,OAC3B;AAKA,SAAS,WAAW,cAAgD;AACvE,QAAM,EAAE,OAAO,IAAI;AACnB,SAAO,aAAa,SAAS,WAAW,OAAO,WAAW,GAAG,IACvD,WAAW,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AQ,MAAM,GAAG,IAAI,CAAC;AACpE,eAAW,QAAQ,YAAY,QAAQ,EAAG,OAAM,QAAQ,MAAM,MAAM,IAAI,CAAC;AACzE,QAAI,cAAe,OAAM,QAAQ,MAAM,GAAGA,MAAK,KAAK,MAAM,MAAM,GAAG,EAAE,WAAW,KAAK,CAAC,CAAC;AACvF,QAAI,YAAa,OAAM,QAAQ,MAAM,MAAM,KAAK,IAAI,CAAC;AACrD,QAAI,cAAc,OAAQ,QAAO,eAAe,UAAU,iBAAiB,EAAE,OAAO,cAAc,CAAC;AACnG,UAAM;AAAA,EACV,UAAE;AACE,QAAI,CAAC,UAAU;AACX,UAAI,UAAU;AACV,cAAM,WAAW,MAAM,IAAI,MAAM,CAAC,YAAY,IAAI,CAAC,GAAG,MAAM,IAAI,EAAE,OAAO,OAAO;AAChF,YAAI,QAAQ,OAAQ,OAAM,IAAI,MAAM,CAAC,MAAM,YAAY,MAAM,GAAG,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"]}