create-acrylblends 1.5.2 → 1.5.4
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/dist/index.d.ts +2 -0
- package/dist/index.js +10 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -89,6 +89,8 @@ export declare function replacePlaceholders(text: string, name: string): string;
|
|
|
89
89
|
* version is the app as created. A folder that already is a repository, or a machine without git, is left alone.
|
|
90
90
|
*/
|
|
91
91
|
export declare function startRepository(directory: string): void;
|
|
92
|
+
/** An app with the extensions row (what plugin-share installs through) and no plugin-share row: a starter older than sharing. */
|
|
93
|
+
export declare function lacksPluginShare(directory: string): boolean;
|
|
92
94
|
/** Create the app. Returns the exit code: 0 done, 1 refused or failed, 2 a usage error. Never calls `process.exit`. */
|
|
93
95
|
export declare function runCreate(argv: readonly string[], io?: Io): Promise<number>;
|
|
94
96
|
//#endregion
|
package/dist/index.js
CHANGED
|
@@ -859,6 +859,13 @@ function startRepository(directory) {
|
|
|
859
859
|
"Initial commit from acrylblends"
|
|
860
860
|
]);
|
|
861
861
|
}
|
|
862
|
+
/** An app with the extensions row (what plugin-share installs through) and no plugin-share row: a starter older than sharing. */
|
|
863
|
+
function lacksPluginShare(directory) {
|
|
864
|
+
const file = join(directory, "blend.yaml");
|
|
865
|
+
if (!existsSync(file)) return false;
|
|
866
|
+
const names = [...readFileSync(file, "utf8").matchAll(/^ *name: ?(\S+)\r?$/gmu)].map((match) => match[1]);
|
|
867
|
+
return names.includes("extensions") && !names.includes("plugin-share");
|
|
868
|
+
}
|
|
862
869
|
/** The registry `--registry` names. */
|
|
863
870
|
function openNamedRegistry(name, cwd, reading) {
|
|
864
871
|
const source = parseRegistrySource(name, cwd);
|
|
@@ -920,7 +927,8 @@ async function createFromSource(options, target, directory, io) {
|
|
|
920
927
|
"--dir",
|
|
921
928
|
target
|
|
922
929
|
], io.cwd);
|
|
923
|
-
|
|
930
|
+
const share = lacksPluginShare(target) ? await framework(["add", "plugin-share"]) : 0;
|
|
931
|
+
if (await framework(["add", "desktop"]) !== 0 || share !== 0 || await framework(["upgrade"]) !== 0) {
|
|
924
932
|
io.stderr.write(`error: ${directory} was made, but putting it in the ACRYL frame failed (see above); it runs on its own with \`npm start\`\n`);
|
|
925
933
|
startRepository(target);
|
|
926
934
|
return 1;
|
|
@@ -1010,6 +1018,6 @@ async function runCreate(argv, io = processIo()) {
|
|
|
1010
1018
|
}
|
|
1011
1019
|
}
|
|
1012
1020
|
//#endregion
|
|
1013
|
-
export { CLASS, CREATE, HELP, PACKAGE, PACKAGE_MANAGERS, TEMPLATES, TEMPLATE_ALIASES, TEMPLATE_MANIFEST, TEMPLATE_SUMMARY, UsageError, VERSION, frameworkRange, isTemplate, nameFrom, parseCreateOptions, processIo, replacePlaceholders, resolveTemplate, runCreate, startRepository };
|
|
1021
|
+
export { CLASS, CREATE, HELP, PACKAGE, PACKAGE_MANAGERS, TEMPLATES, TEMPLATE_ALIASES, TEMPLATE_MANIFEST, TEMPLATE_SUMMARY, UsageError, VERSION, frameworkRange, isTemplate, lacksPluginShare, nameFrom, parseCreateOptions, processIo, replacePlaceholders, resolveTemplate, runCreate, startRepository };
|
|
1014
1022
|
|
|
1015
1023
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/names.ts","../src/source.ts","../src/registry.ts","../src/spawn.ts","../src/index.ts"],"sourcesContent":["/**\n * The one place this package names the framework. The templates are written with `__PACKAGE__` and `__RANGE__` (the range is stamped at create time from the framework version this package carries, see `frameworkRange`), and the text of `AGENTS.md` with\n * `__PACKAGE__`, so a rename (for example to `acryl`) is a change here and in `scripts/lib/names.mjs`, which a test keeps equal.\n */\nexport const PACKAGE = 'acrylblends'\nexport const CLASS = 'Acryl'\nexport const CREATE = 'create-acrylblends'\n\n/** The file that makes a folder a template other people can create apps from (`${CREATE} <name> github:owner/repo`). */\nexport const TEMPLATE_MANIFEST = 'acryl.template.json'\n","/**\n * Templates from outside this package: `github:owner/repo[#ref]`, a scoped npm package (`@scope/name[@version]`) or a packed tarball on disk.\n * A source is only ever downloaded and unpacked: no git clone (hooks), no lifecycle script (`npm pack --ignore-scripts`), nothing of it is run.\n */\nimport { spawnSync } from 'node:child_process'\nimport {\n cpSync,\n existsSync,\n lstatSync,\n mkdirSync,\n readdirSync,\n readFileSync,\n rmSync,\n writeFileSync,\n} from 'node:fs'\nimport { join, resolve } from 'node:path'\nimport { PACKAGE, TEMPLATE_MANIFEST } from './names'\n\nexport type Source =\n | { kind: 'github'; owner: string; repo: string; ref: string | undefined }\n | { kind: 'npm'; spec: string }\n | { kind: 'tarball'; path: string }\n | { kind: 'folder'; path: string }\n\n/** Where a registry can be read from: any source, or a static host that serves its `index.json` and each entry's archive under `base` (which ends in `/`). */\nexport type RegistrySource = Source | { kind: 'hosted'; base: string }\n\n/** What a template says about itself in `acryl.template.json`. */\nexport interface Manifest {\n name: string\n description: string\n /** Library plugins the template needs, added with `acrylblends add`. */\n plugins: string[]\n}\n\n/** A source that cannot be used; the message says why and is shown as it is. */\nexport class SourceError extends Error {\n override name = 'SourceError'\n}\n\nexport const SOURCE_FORMS = `github:owner/repo[#ref] (or the https://github.com/owner/repo address), @scope/name[@version], a packed .tgz file, or a folder (./path)`\n\n/** How much a source may hold, and what its refusal calls it. */\ninterface Limits {\n readonly what: string\n readonly files: number\n readonly bytes: number\n}\n\n/** A template is copied whole into the person's new app, so it is held to the size of an app's source. */\nconst TEMPLATE_LIMITS: Limits = { what: 'template', files: 5000, bytes: 50 * 1024 * 1024 }\n\n/**\n * A registry is read for its index and one entry, and grows with every entry it publishes (100 blueprints are about 33,000 files and 200 MB), so its bound\n * only stops a runaway download; the entry taken from it is a template and is held to the template's limits.\n */\nconst REGISTRY_LIMITS: Limits = { what: 'registry', files: 200_000, bytes: 2 * 1024 * 1024 * 1024 }\n\n/** Recognise a source argument, or return `undefined` when it is not one (so the caller can report a usage error). */\nexport function parseSource(text: string, cwd: string): Source | undefined {\n const github = /^github:([A-Za-z0-9_.-]+)\\/([A-Za-z0-9_.-]+)(?:#([A-Za-z0-9_./-]+))?$/.exec(text)\n if (github) return { kind: 'github', owner: github[1]!, repo: github[2]!, ref: github[3] }\n // A GitHub address as it is pasted from the browser: https://github.com/owner/repo, with .git or /tree/<ref> after it.\n const pasted =\n /^https:\\/\\/github\\.com\\/([A-Za-z0-9_.-]+)\\/([A-Za-z0-9_.-]+?)(?:\\.git)?(?:\\/tree\\/([A-Za-z0-9_./-]+))?\\/?$/.exec(\n text,\n )\n if (pasted) return { kind: 'github', owner: pasted[1]!, repo: pasted[2]!, ref: pasted[3] }\n if (text.startsWith('github:')) throw new SourceError(`\"${text}\" is not github:owner/repo[#ref]`)\n if (/^@[a-z0-9][a-z0-9._-]*\\/[a-z0-9][a-z0-9._-]*(@[A-Za-z0-9._-]+)?$/.test(text))\n return { kind: 'npm', spec: text }\n if (text.startsWith('@')) throw new SourceError(`\"${text}\" is not @scope/name[@version]`)\n if (/\\.(tgz|tar\\.gz)$/.test(text)) {\n const path = resolve(cwd, text)\n if (!existsSync(path)) throw new SourceError(`${path} does not exist`)\n return { kind: 'tarball', path }\n }\n // A folder is only a source when it is written as a path, so a template name is never taken for one.\n if (/^(\\.{1,2}[\\\\/]|[\\\\/]|[A-Za-z]:[\\\\/])/.test(text)) {\n const path = resolve(cwd, text)\n if (!existsSync(path) || !lstatSync(path).isDirectory())\n throw new SourceError(`${path} is not a folder`)\n return { kind: 'folder', path }\n }\n return undefined\n}\n\n/**\n * A registry, as `--registry` names it: a source, an https address, or a folder written as a bare path (`my-registry`, `run/registry`). A registry is never a template\n * name, so a path that is an existing folder is taken as one without the `./` a template source needs.\n */\nexport function parseRegistrySource(text: string, cwd: string): RegistrySource | undefined {\n const source = parseSource(text, cwd)\n if (source !== undefined) return source\n if (text.startsWith('https://')) return { kind: 'hosted', base: text.replace(/\\/*$/, '/') }\n const path = resolve(cwd, text)\n return existsSync(path) && lstatSync(path).isDirectory() ? { kind: 'folder', path } : undefined\n}\n\n/** How the bytes of a source are obtained; real by default, replaced in tests. */\nexport interface Fetchers {\n /** The body at a URL (a GitHub tarball). */\n download(url: string): Promise<Uint8Array>\n /** `npm pack <spec> --ignore-scripts` into `dest`; the path of the tarball. */\n pack(spec: string, dest: string): string\n}\n\nexport const realFetchers: Fetchers = {\n async download(url) {\n const response = await fetch(url, { redirect: 'follow' }).catch((cause: unknown) => {\n throw new SourceError(\n `could not reach ${url}: ${cause instanceof Error ? cause.message : String(cause)}`,\n )\n })\n if (!response.ok) throw new SourceError(`${url} answered ${response.status}`)\n return new Uint8Array(await response.arrayBuffer())\n },\n pack(spec, dest) {\n const result = spawnSync(\n 'npm',\n ['pack', spec, '--ignore-scripts', '--json', '--pack-destination', dest],\n {\n encoding: 'utf8',\n shell: false,\n env: { ...process.env, npm_config_ignore_scripts: 'true' },\n },\n )\n if (result.status !== 0)\n throw new SourceError(\n `npm could not pack ${spec}: ${(result.stderr || result.stdout).trim().split('\\n').at(-1)}`,\n )\n const file = (JSON.parse(result.stdout) as { filename: string }[])[0]?.filename\n if (!file) throw new SourceError(`npm packed nothing for ${spec}`)\n return join(dest, file)\n },\n}\n\n/** Unpack a tarball into `dir`, dropping its single top folder; refuses links, paths that leave the folder, and archives over `limits`. */\nfunction extract(tarball: string, dir: string, limits: Limits): void {\n const list = spawnSync('tar', ['-tzf', tarball], {\n encoding: 'utf8',\n maxBuffer: 256 * 1024 * 1024,\n })\n if (list.status !== 0) throw new SourceError(`${tarball} is not a readable tar.gz archive`)\n const entries = list.stdout.split('\\n').filter(Boolean)\n if (entries.length > limits.files)\n throw new SourceError(`the ${limits.what} has more than ${limits.files} files`)\n for (const entry of entries)\n if (entry.startsWith('/') || entry.split('/').includes('..'))\n throw new SourceError(`the archive holds a path that leaves its folder: ${entry}`)\n mkdirSync(dir, { recursive: true })\n const run = spawnSync('tar', ['-xzf', tarball, '-C', dir, '--strip-components=1'], {\n encoding: 'utf8',\n })\n if (run.status !== 0) throw new SourceError(`could not unpack ${tarball}: ${run.stderr.trim()}`)\n checkTree(dir, limits)\n}\n\n/** Refuse a tree that holds a link, or is larger than `limits`; the same check for an unpacked archive and a copied folder. */\nfunction checkTree(dir: string, limits: Limits): void {\n let bytes = 0\n let count = 0\n const walk = (folder: string) => {\n for (const entry of readdirSync(folder)) {\n const path = join(folder, entry)\n const info = lstatSync(path)\n if (info.isSymbolicLink())\n throw new SourceError(\n `the ${limits.what} holds a symbolic link (${path.slice(dir.length + 1)}); links are not allowed`,\n )\n if (info.isDirectory()) walk(path)\n else {\n bytes += info.size\n count += 1\n }\n }\n }\n walk(dir)\n if (count > limits.files)\n throw new SourceError(`the ${limits.what} has more than ${limits.files} files`)\n if (bytes > limits.bytes)\n throw new SourceError(`the ${limits.what} is larger than ${limits.bytes / 1024 / 1024} MB`)\n}\n\n/** Download or pack a template and unpack it into `dir` (which must not exist yet). Nothing in it is run. */\nexport const fetchTemplate = (source: Source, dir: string, scratch: string, fetchers: Fetchers) =>\n fetchSource(source, dir, scratch, fetchers, TEMPLATE_LIMITS)\n\n/** Download or copy a registry into `dir` (which must not exist yet), to read its index and take one entry from it. Nothing in it is run. */\nexport const fetchRegistry = (source: Source, dir: string, scratch: string, fetchers: Fetchers) =>\n fetchSource(source, dir, scratch, fetchers, REGISTRY_LIMITS)\n\nasync function fetchSource(\n source: Source,\n dir: string,\n scratch: string,\n fetchers: Fetchers,\n limits: Limits,\n): Promise<void> {\n mkdirSync(scratch, { recursive: true })\n if (source.kind === 'folder') {\n cpSync(source.path, dir, {\n recursive: true,\n filter: (path) => !/[\\\\/](\\.git|node_modules)([\\\\/]|$)/.test(path.slice(source.path.length)),\n })\n checkTree(dir, limits)\n return\n }\n let tarball: string\n if (source.kind === 'tarball') tarball = source.path\n else if (source.kind === 'npm') tarball = fetchers.pack(source.spec, scratch)\n else {\n tarball = join(scratch, 'source.tar.gz')\n writeFileSync(\n tarball,\n await fetchers.download(\n `https://codeload.github.com/${source.owner}/${source.repo}/tar.gz/${source.ref ?? 'HEAD'}`,\n ),\n )\n }\n extract(tarball, dir, limits)\n}\n\n/** Read and check `acryl.template.json`; a source without it is not a template. */\nexport function readManifest(dir: string): Manifest {\n const file = join(dir, TEMPLATE_MANIFEST)\n if (!existsSync(file))\n throw new SourceError(\n `this source has no ${TEMPLATE_MANIFEST}, so it is not a template: add one with a name and a description (see the create-acrylblends guide)`,\n )\n let data: unknown\n try {\n data = JSON.parse(readFileSync(file, 'utf8'))\n } catch {\n throw new SourceError(`${TEMPLATE_MANIFEST} is not valid JSON`)\n }\n const m = data as Record<string, unknown>\n if (typeof m.name !== 'string' || m.name.trim() === '')\n throw new SourceError(`${TEMPLATE_MANIFEST} needs a \"name\"`)\n if (typeof m.description !== 'string')\n throw new SourceError(`${TEMPLATE_MANIFEST} needs a \"description\"`)\n const plugins = m.plugins ?? []\n if (\n !Array.isArray(plugins) ||\n plugins.some((p) => typeof p !== 'string' || !/^[a-z][a-z0-9-]*$/.test(p))\n )\n throw new SourceError(\n `\"plugins\" in ${TEMPLATE_MANIFEST} is a list of plugin names such as \"desktop\"`,\n )\n return { name: m.name, description: m.description, plugins: plugins as string[] }\n}\n\nconst SKIP = new Set(['.git', 'node_modules', TEMPLATE_MANIFEST])\nconst GIT_ATTRIBUTES =\n '# Every checkout has the same line endings, on every OS.\\n* text=auto eol=lf\\n'\n/** Lifecycle scripts npm runs on `npm install` in the app's own folder. */\nexport const LIFECYCLE = [\n 'preinstall',\n 'install',\n 'postinstall',\n 'prepublish',\n 'preprepare',\n 'prepare',\n 'postprepare',\n]\n\nconst isText = (buffer: Buffer) => !buffer.subarray(0, 8000).includes(0)\n\n/**\n * Copy the unpacked template into `target`, replacing the placeholders of the built-in templates, naming the app, and pointing a dependency on the framework at\n * the release this package carries. Returns the files written (relative paths) and the lifecycle scripts the app's package.json defines.\n */\nexport function writeTemplate(\n from: string,\n target: string,\n stamp: (text: string) => string,\n range: string,\n name: string,\n): { files: string[]; lifecycle: Record<string, string> } {\n const files: string[] = []\n const walk = (src: string, dst: string, prefix: string) => {\n mkdirSync(dst, { recursive: true })\n for (const entry of readdirSync(src, { withFileTypes: true })) {\n if (SKIP.has(entry.name)) continue\n const outName = prefix === '' && entry.name === 'gitignore' ? '.gitignore' : entry.name\n if (entry.isDirectory())\n walk(join(src, entry.name), join(dst, outName), `${prefix}${entry.name}/`)\n else {\n const buffer = readFileSync(join(src, entry.name))\n writeFileSync(join(dst, outName), isText(buffer) ? stamp(buffer.toString('utf8')) : buffer)\n files.push(`${prefix}${outName}`)\n }\n }\n }\n walk(from, target, '')\n // An app's plugins are identified by every byte, so a CRLF checkout would make them different plugins. An entry made before make-entry wrote this file\n // has none; one that has its own keeps it.\n if (!existsSync(join(target, '.gitattributes'))) {\n writeFileSync(join(target, '.gitattributes'), GIT_ATTRIBUTES)\n files.push('.gitattributes')\n }\n const lifecycle: Record<string, string> = {}\n const pkgFile = join(target, 'package.json')\n if (existsSync(pkgFile)) {\n const pkg = JSON.parse(readFileSync(pkgFile, 'utf8')) as {\n name?: string\n scripts?: Record<string, string>\n dependencies?: Record<string, string>\n devDependencies?: Record<string, string>\n }\n pkg.name = name\n for (const group of [pkg.dependencies, pkg.devDependencies])\n if (group?.[PACKAGE] !== undefined) group[PACKAGE] = range\n writeFileSync(pkgFile, `${JSON.stringify(pkg, null, 2)}\\n`)\n for (const script of LIFECYCLE)\n if (typeof pkg.scripts?.[script] === 'string') lifecycle[script] = pkg.scripts[script]\n }\n return { files, lifecycle }\n}\n\n/** Remove a folder tree quietly. */\nexport const removeTree = (path: string) => rmSync(path, { recursive: true, force: true })\nexport { cpSync }\n","/**\n * Starters from a registry: `npm create acrylblends@latest my-app -- --from acryl.example`. A registry is a git repository (or a folder) with an `index.json` and one folder per\n * starter under `blends/<id>/`. Its CI says in the index which runtime an entry is for: only `runtime: acrylblends` entries are apps this package can make (the folder is the\n * app, with an `acryl.template.json`); the others are ACRYL app starters and are refused with one line. Nothing is run: the entry is downloaded, unpacked and copied.\n *\n * A registry grows with every entry and one starter is all that is wanted, so `openRegistry` reads as little as the registry allows. A folder is read in place. A static host\n * serves the index and one archive per entry (`archive`, `integrity`, written when the site deploys: workshop-registry/scripts/registry-archives.mjs). A repository holds no\n * archives, so it is downloaded whole. The public registry is a host with its repository behind it, for when the host cannot give the entry.\n */\nimport { createHash } from 'node:crypto'\nimport { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from 'node:fs'\nimport { join } from 'node:path'\nimport {\n type Fetchers,\n fetchRegistry,\n fetchTemplate,\n type RegistrySource,\n type Source,\n SourceError,\n} from './source'\n\n/** The public registry's repository (the same files the site lists). */\nexport const DEFAULT_REGISTRY = 'github:acrylblends/acrylblends.github.io'\nconst DEFAULT_REPOSITORY: Source = {\n kind: 'github',\n owner: 'acrylblends',\n repo: 'acrylblends.github.io',\n ref: undefined,\n}\n\n/** The public registry as its site serves it, with an archive per entry. */\nconst PUBLIC_REGISTRY = 'https://acrylblends.github.io/registry/'\n\n/** Where ACRYL app starters are opened. */\nexport const ACRYL_APP = 'https://acryl.dev'\n\n/** A registry id: dotted, lower case (`acryl.gtd`, `acrylblends.notes-desktop`, `login.thing`). */\nexport const REGISTRY_ID = /^[a-z0-9][a-z0-9-]*(\\.[a-z0-9][a-z0-9-]*)+$/\n\nexport interface RegistryEntry {\n readonly id: string\n readonly name: string\n readonly version: string\n /** The entry's folder inside the registry, `blends/<id>`. */\n readonly path: string\n /** `acrylblends` (an app this package makes) or `acryl` (an ACRYL app starter). An index written before the field existed has none: those entries are ACRYL's. */\n readonly runtime: 'acrylblends' | 'acryl'\n readonly description?: string\n /** Where a host publishes the entry on its own; a repository's index has none. */\n readonly archive?: EntryArchive\n}\n\n/** An entry published as one file: its path in the registry and the integrity of its bytes (`sha512-<base64>`). */\nexport interface EntryArchive {\n readonly path: string\n readonly integrity: string\n}\n\n/** A registry that can be read: what it offers, and one entry's files on request. */\nexport interface OpenRegistry {\n readonly entries: readonly RegistryEntry[]\n /** Put the entry's files into `dir` (which must not exist yet), held to a template's limits. Nothing of them is run. */\n takeEntry(entry: RegistryEntry, dir: string): Promise<void>\n}\n\n/** Where a registry's reading may keep what it downloads, and how it downloads. */\nexport interface RegistryReading {\n readonly scratch: string\n readonly fetchers: Fetchers\n}\n\n/** A host cannot give this entry, which is not a judgement on the entry: the public registry reads its repository instead. */\nclass EntryUnavailable extends SourceError {}\n\n/** The folder of an unpacked registry that holds `index.json`: the root, or its `registry/` folder (the public registry lives in its site's repository). */\n/** @param label - the registry as the person named it (a folder's path, `github:owner/repo`), for the one line when it has no index. */\nexport function registryRoot(unpacked: string, label = 'this registry'): string {\n for (const candidate of [unpacked, join(unpacked, 'registry')])\n if (existsSync(join(candidate, 'index.json'))) return candidate\n throw new SourceError(\n `${label} has no index.json (a registry is a folder with index.json and blends/<id>/, or index.json in its registry/ folder)`,\n )\n}\n\n/** An entry's archive as its index names it: both fields or neither, and a path that stays beside the entries. */\nfunction parseArchive(item: Record<string, unknown>): EntryArchive | undefined {\n if (item.archive === undefined && item.integrity === undefined) return undefined\n const { archive, integrity } = item\n if (\n typeof archive !== 'string' ||\n !/^blends\\/[^/\\\\]+\\.tgz$/.test(archive) ||\n archive.includes('..') ||\n typeof integrity !== 'string' ||\n !/^sha512-[A-Za-z0-9+/]+=*$/.test(integrity)\n )\n throw new SourceError(`registry entry ${String(item.id)} has no valid archive`)\n return { path: archive, integrity }\n}\n\n/** The entries of an `index.json`, from its text. */\nfunction parseIndex(text: string): RegistryEntry[] {\n let data: unknown\n try {\n data = JSON.parse(text)\n } catch {\n throw new SourceError('the registry index.json is not valid JSON')\n }\n const list = (data as { entries?: unknown }).entries\n if (!Array.isArray(list)) throw new SourceError('the registry index.json has no entries')\n const entries: RegistryEntry[] = []\n for (const item of list as Record<string, unknown>[]) {\n if (typeof item.id !== 'string' || typeof item.path !== 'string') continue\n if (!/^blends\\/[^/\\\\]+$/.test(item.path))\n throw new SourceError(`registry entry ${item.id} has no valid path`)\n const archive = parseArchive(item)\n entries.push({\n id: item.id,\n name: typeof item.name === 'string' ? item.name : item.id,\n version: typeof item.version === 'string' ? item.version : '0.0.0',\n path: item.path,\n runtime: item.runtime === 'acrylblends' ? 'acrylblends' : 'acryl',\n ...(typeof item.description === 'string' ? { description: item.description } : {}),\n ...(archive ? { archive } : {}),\n })\n }\n return entries\n}\n\n/** A registry in a folder, read in place: only the entry that is taken is copied. */\nfunction openFolder(unpacked: string, label: string, reading: RegistryReading): OpenRegistry {\n const root = registryRoot(unpacked, label)\n return {\n entries: parseIndex(readFileSync(join(root, 'index.json'), 'utf8')),\n takeEntry: (entry, dir) =>\n fetchTemplate(\n { kind: 'folder', path: join(root, entry.path) },\n dir,\n join(reading.scratch, 'download'),\n reading.fetchers,\n ),\n }\n}\n\n/** A registry that holds no archives, downloaded whole and then read as a folder. */\nasync function openUnpacked(\n source: Source,\n label: string,\n reading: RegistryReading,\n): Promise<OpenRegistry> {\n const unpacked = join(reading.scratch, 'registry')\n await fetchRegistry(source, unpacked, join(reading.scratch, 'download'), reading.fetchers)\n return openFolder(unpacked, label, reading)\n}\n\n/** A registry on a static host: its index, then only the archive of the entry that is taken. */\nasync function openHosted(base: string, reading: RegistryReading): Promise<OpenRegistry> {\n const index = await reading.fetchers.download(`${base}index.json`)\n return {\n entries: parseIndex(Buffer.from(index).toString('utf8')),\n async takeEntry(entry, dir) {\n if (entry.archive === undefined)\n throw new EntryUnavailable(`${base} publishes no archive for ${entry.id}`)\n const bytes = await downloadArchive(`${base}${entry.archive.path}`, entry.id, reading)\n const digest = createHash('sha512').update(bytes).digest('base64')\n if (`sha512-${digest}` !== entry.archive.integrity)\n throw new SourceError(`the archive of ${entry.id} does not match its integrity`)\n const download = join(reading.scratch, 'download')\n mkdirSync(download, { recursive: true })\n const path = join(download, 'entry.tgz')\n writeFileSync(path, bytes)\n await fetchTemplate({ kind: 'tarball', path }, dir, download, reading.fetchers)\n },\n }\n}\n\nasync function downloadArchive(\n url: string,\n id: string,\n reading: RegistryReading,\n): Promise<Uint8Array> {\n try {\n return await reading.fetchers.download(url)\n } catch (cause) {\n throw new EntryUnavailable(\n `could not download the archive of ${id}: ${cause instanceof Error ? cause.message : String(cause)}`,\n )\n }\n}\n\n/** Open a registry the person named, reading as little of it as it allows. */\nexport async function openRegistry(\n source: RegistrySource,\n label: string,\n reading: RegistryReading,\n): Promise<OpenRegistry> {\n if (source.kind === 'folder') return openFolder(source.path, source.path, reading)\n if (source.kind === 'hosted') return openHosted(source.base, reading)\n return openUnpacked(source, label, reading)\n}\n\n/**\n * Open the public registry: its site, or its repository when the site cannot answer. An entry the site cannot give is taken from the repository too. An archive that\n * came and does not match, or that breaks a template's limits, is refused: only a missing archive is a reason to look elsewhere.\n */\nexport async function openPublicRegistry(reading: RegistryReading): Promise<OpenRegistry> {\n let site: OpenRegistry\n try {\n site = await openHosted(PUBLIC_REGISTRY, reading)\n } catch {\n return openUnpacked(DEFAULT_REPOSITORY, DEFAULT_REGISTRY, reading)\n }\n return {\n entries: site.entries,\n async takeEntry(entry, dir) {\n try {\n await site.takeEntry(entry, dir)\n } catch (cause) {\n if (!(cause instanceof EntryUnavailable)) throw cause\n const repository = await openUnpacked(DEFAULT_REPOSITORY, DEFAULT_REGISTRY, reading)\n await repository.takeEntry(entry, dir)\n }\n },\n }\n}\n\n/** The entry for an id. An ACRYL app starter is refused in one line; an unknown id lists the starters this package can make. */\nexport function pickEntry(entries: readonly RegistryEntry[], id: string): RegistryEntry {\n const entry = entries.find((candidate) => candidate.id === id)\n if (!entry) {\n const mine = entries\n .filter((candidate) => candidate.runtime === 'acrylblends')\n .map((candidate) => candidate.id)\n throw new SourceError(\n `no starter \"${id}\" in this registry${mine.length > 0 ? `; starters for create-acrylblends: ${mine.join(', ')}` : ''}`,\n )\n }\n if (entry.runtime !== 'acrylblends')\n throw new SourceError(\n `${entry.id} is an ACRYL app starter: open it in the ACRYL app (${ACRYL_APP}). create-acrylblends makes acrylblends apps.`,\n )\n return entry\n}\n\n/**\n * Give a pulled starter to its new owner: the manifest names the app (`acrylblends.<name>`, private), because the registry's id and its public visibility belong to the starter,\n * not to the app made from it. Changes the `metadata` lines of `blend.yaml` (the id, the name, the visibility; the licence is dropped) and nothing else; a manifest it cannot read that way is left as it is.\n */\nexport function ownManifest(text: string, name: string): string {\n const lines = text.split('\\n')\n const start = lines.findIndex((line) => /^metadata:\\s*$/.test(line))\n if (start < 0) return text\n let end = start + 1\n while (end < lines.length && /^\\s+\\S|^\\s*$/.test(lines[end] ?? '')) end += 1\n const set = (key: string, value: string) => {\n for (let at = start + 1; at < end; at += 1) {\n const match = new RegExp(`^(\\\\s+)${key}:.*$`).exec(lines[at] ?? '')\n if (match) {\n lines[at] = `${match[1]}${key}: ${value}`\n return\n }\n }\n }\n set('id', `acrylblends.${name}`)\n set('name', name)\n set('visibility', 'private')\n // The starter's licence is the starter's: the new app names none until its owner chooses one.\n for (let at = end - 1; at > start; at -= 1)\n if (/^\\s+license:/.test(lines[at] ?? '')) lines.splice(at, 1)\n return lines.join('\\n')\n}\n\n/**\n * Keep a pulled starter's `blend.lock.json` true to the app made from it: the lock's origin names the manifest it was written from (its id and the digest of its text,\n * as blends-core's `manifestDigest`), and {@link ownManifest} has just changed both. The plugin folders are copied unchanged, so their digests stand. A lock it cannot\n * read is left as it is (`npm run snapshot capture` writes it again).\n */\nexport function ownLock(text: string, manifestText: string, name: string): string {\n let lock: unknown\n try {\n lock = JSON.parse(text)\n } catch {\n return text\n }\n const origin = (lock as { origin?: unknown } | null)?.origin\n if (origin === null || typeof origin !== 'object') return text\n const owned = {\n ...(lock as object),\n origin: {\n ...origin,\n id: `acrylblends.${name}`,\n digest: createHash('sha256').update(manifestText).digest('hex'),\n },\n }\n return `${JSON.stringify(owned, null, 2)}\\n`\n}\n\n/** A DSH profile name for an app, as the framework's scaffold writes it into `scripts/ide-host.mjs` (`acrylblends-<app>`). */\nexport function profileNameFor(appName: string): string {\n const slug = appName\n .toLowerCase()\n .replaceAll(/[^a-z0-9]+/gu, '-')\n .replaceAll(/^-+|-+$/gu, '')\n return `acrylblends-${slug === '' ? 'app' : slug}`\n}\n\n/**\n * The name the scaffold wrote into a starter where an app names itself: its manifest's one-word `metadata.name`, or else its `package.json` name, which\n * `init` set to the same name. A curated starter's manifest carries a display name (\"Productivity Hub\"), which the scaffold never wrote.\n */\nexport function starterName(\n manifestText: string,\n packageText: string | undefined,\n): string | undefined {\n const fromManifest = manifestName(manifestText)\n if (fromManifest !== undefined || packageText === undefined) return fromManifest\n let name: unknown\n try {\n name = (JSON.parse(packageText) as { name?: unknown }).name\n } catch {\n return undefined\n }\n return typeof name === 'string' && name !== '' ? name : undefined\n}\n\n/** The app's name as a starter's `blend.yaml` gives it (`metadata.name`), or undefined. */\nexport function manifestName(text: string): string | undefined {\n const lines = text.split('\\n')\n const start = lines.findIndex((line) => /^metadata:\\s*$/.test(line))\n if (start < 0) return undefined\n for (let at = start + 1; at < lines.length && /^\\s+\\S|^\\s*$/.test(lines[at] ?? ''); at += 1) {\n const match = /^\\s+name:\\s*[\"']?([^\"'#\\s]+)[\"']?\\s*(?:#.*)?$/.exec(lines[at] ?? '')\n if (match) return match[1]\n }\n return undefined\n}\n\n/**\n * Where the scaffold wrote an app's name (its `__APP_NAME__`): the headings and the `description:` line of the agents' instructions and skills,\n * the README's title, and the page's `APP_NAME` constant. A starter made from an app still says that app's name there; the app made from it says its own.\n */\nconst PROSE_FILES = ['AGENTS.md', 'CLAUDE.md', 'README.md']\n/** The lines of those files the scaffold put the name on. */\nconst NAMED_LINE = /^(?:#{1,6} |description: )/\nconst SKILL_SCOPES = ['.claude/skills', '.agents/skills']\nconst CODE_FILES = ['src/routes.ts', 'src/app.ts']\n\n/**\n * Give a starter's scaffold files the new app's name: `from` (the starter's `metadata.name`) becomes `to` where it stands as a whole name on a\n * heading or `description:` line of the agents' instructions, skills and README, and in the `APP_NAME` constant; the host script's DSH profile\n * follows. Nothing else is read for the name, so one that is also a common word (`notes`) never rewrites a route, a string or a sentence. Plugins and the lock stay as the starter\n * recorded them.\n * @returns the files it changed, relative to `dir`.\n */\nexport function renameApp(dir: string, from: string, to: string): string[] {\n if (from === to || !/^[A-Za-z0-9][\\w.-]*$/.test(from)) return []\n const escaped = from.replaceAll(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n const whole = new RegExp(`(?<![\\\\w-])${escaped}(?![\\\\w-])`, 'g')\n const prose = [...PROSE_FILES]\n for (const scope of SKILL_SCOPES) {\n const root = join(dir, scope)\n if (!existsSync(root)) continue\n for (const skill of readdirSync(root, { withFileTypes: true }))\n if (skill.isDirectory()) prose.push(`${scope}/${skill.name}/SKILL.md`)\n }\n const changed: string[] = []\n const rewrite = (file: string, edit: (text: string) => string) => {\n const path = join(dir, file)\n if (!existsSync(path)) return\n const text = readFileSync(path, 'utf8')\n const next = edit(text)\n if (next === text) return\n writeFileSync(path, next)\n changed.push(file)\n }\n for (const file of prose)\n rewrite(file, (text) =>\n text\n .split('\\n')\n .map((line) => (NAMED_LINE.test(line) ? line.replace(whole, to) : line))\n .join('\\n'),\n )\n const constant = new RegExp(`(\\\\bAPP_NAME = )(['\"])${escaped}\\\\2`, 'g')\n for (const file of CODE_FILES) rewrite(file, (text) => text.replace(constant, `$1$2${to}$2`))\n // npm's lock names the root package twice (top level and `packages[\"\"]`); a lock it cannot read is left as it is.\n rewrite('package-lock.json', (text) => {\n try {\n const lock = JSON.parse(text) as {\n name?: unknown\n packages?: Record<string, { name?: unknown }>\n }\n const root = lock.packages?.['']\n if (lock.name !== from && root?.name !== from) return text\n if (lock.name === from) lock.name = to\n if (root !== undefined && root.name === from) root.name = to\n return `${JSON.stringify(lock, null, 2)}\\n`\n } catch {\n return text\n }\n })\n const profile = profileNameFor(from)\n rewrite('scripts/ide-host.mjs', (text) =>\n text.replaceAll(`'${profile}'`, `'${profileNameFor(to)}'`),\n )\n return changed\n}\n","import { existsSync } from 'node:fs'\nimport { dirname, isAbsolute, join, win32 } from 'node:path'\n\nexport interface Invocation {\n file: string\n args: string[]\n}\n\n/**\n * How to start a package manager without the shell option (Node warns about passing args to a shell, DEP0190, and a `.cmd` shim cannot be spawned directly).\n * Off Windows the command runs as it is, and so does a program given by its path on Windows (Node, started with `process.execPath`). On Windows npm runs as `node npm-cli.js` (the one npm is running from, else the one beside `node`); any other\n * manager goes through `cmd.exe /d /s /c <name>.cmd`, whose arguments stay an array.\n */\nexport function packageManagerInvocation(\n command: string,\n args: readonly string[],\n platform: NodeJS.Platform = process.platform,\n env: NodeJS.ProcessEnv = process.env,\n exists: (path: string) => boolean = existsSync,\n execPath: string = process.execPath,\n): Invocation {\n if (platform !== 'win32') return { file: command, args: [...args] }\n // A program given by its path (Node itself, `process.execPath`) is not a package manager: it has no `.cmd` shim, and `node.exe.cmd` does not exist.\n if (isAbsolute(command) || win32.isAbsolute(command)) return { file: command, args: [...args] }\n if (command === 'npm') {\n const running = env.npm_execpath\n const cli =\n running !== undefined && /npm-cli\\.c?js$/.test(running)\n ? running\n : join(dirname(execPath), 'node_modules', 'npm', 'bin', 'npm-cli.js')\n if (exists(cli)) return { file: execPath, args: [cli, ...args] }\n }\n return { file: env.ComSpec ?? 'cmd.exe', args: ['/d', '/s', '/c', `${command}.cmd`, ...args] }\n}\n","import { spawn, spawnSync } from 'node:child_process'\nimport {\n copyFileSync,\n cpSync,\n existsSync,\n mkdirSync,\n mkdtempSync,\n readdirSync,\n readFileSync,\n writeFileSync,\n} from 'node:fs'\nimport { createRequire } from 'node:module'\nimport { tmpdir } from 'node:os'\nimport { basename, dirname, join, resolve } from 'node:path'\nimport { createInterface } from 'node:readline/promises'\nimport { fileURLToPath } from 'node:url'\nimport { parseArgs } from 'node:util'\nimport { findSecrets } from '@webboxes/app-persistence'\nimport { CLASS, CREATE, PACKAGE, TEMPLATE_MANIFEST } from './names'\nimport {\n openPublicRegistry,\n openRegistry,\n ownLock,\n ownManifest,\n pickEntry,\n REGISTRY_ID,\n type RegistryEntry,\n type RegistryReading,\n renameApp,\n starterName,\n} from './registry'\nimport {\n type Fetchers,\n fetchTemplate,\n LIFECYCLE,\n parseRegistrySource,\n parseSource,\n readManifest,\n realFetchers,\n removeTree,\n SOURCE_FORMS,\n SourceError,\n writeTemplate,\n} from './source'\nimport { packageManagerInvocation } from './spawn'\n\nexport { CLASS, CREATE, PACKAGE, TEMPLATE_MANIFEST }\n\n/**\n * The templates: the same list as acrylblends init (the framework package makes every one of them; create-acrylblends delegates). A test compares this list and its summaries with the\n * framework package's, so they cannot drift.\n */\nexport const TEMPLATES = ['blank', 'nodejs', 'notes', 'chat', 'todo', 'agent'] as const\nexport type Template = (typeof TEMPLATES)[number]\nexport const TEMPLATE_SUMMARY: Record<Template, string> = {\n blank: 'the router, a server and one route: the smallest app',\n nodejs: 'a web app with a page and a client component',\n notes: 'a multi-user notes app on the db port (sign-up, log-in, sessions)',\n chat: 'a chat app that streams an answer over server-sent events',\n todo: 'a to-do list on the router and state',\n agent: 'the blank app with an offline agent that builds plugins into the running app',\n}\n/** Names that were templates once and still work. */\nexport const TEMPLATE_ALIASES: Record<string, Template> = { 'acryl-app': 'agent' }\nconst TEMPLATE_LIST = TEMPLATES.map((name) => ` ${name.padEnd(7)} ${TEMPLATE_SUMMARY[name]}`).join(\n '\\n',\n)\nexport const PACKAGE_MANAGERS = ['npm', 'pnpm', 'yarn', 'bun'] as const\nexport type PackageManager = (typeof PACKAGE_MANAGERS)[number]\n\n/** The version of this package. */\nexport const VERSION: string = (\n createRequire(import.meta.url)('../package.json') as { version: string }\n).version\n\nexport const HELP = `${CREATE} ${VERSION} - create an ${CLASS} app\n\nUsage:\n npx acryl new [name] [starter] (the same through npm create ${PACKAGE}@latest [name] [starter])\n\n npx acryl new shop the Blank app in the ACRYL frame, installed and started\n npx acryl new shop notes the same from a starter (${TEMPLATES.join(', ')})\n\nThe app is made, installed and started with the chat, the panels and Settings; nothing is asked when a name is given. Next time: cd shop && npm run dev.\nTurn a step off:\n --no-start make and install it, do not start it\n --no-install make it only\n --bare the app without the frame\n\nA source makes the app from someone else's template (it is downloaded and unpacked, nothing in it runs unless --install):\n github:owner/repo[#ref] a GitHub repository, as a tarball (no clone)\n @scope/name[@version] an npm package (npm pack --ignore-scripts)\n ./template.tgz a packed template on disk\n ./folder a template folder on disk\nA template is a folder with an ${TEMPLATE_MANIFEST} (name, description, plugins).\n\nA starter from the registry is pulled by its id:\n --from <id | source> a registry id such as acrylblends.notes-desktop, or any of the sources above\n --registry <source> read the starters from this registry instead of the public one (github:owner/repo, an https:// address, or a folder)\nOnly starters made for ${CLASS} (runtime: ${PACKAGE}) are apps this command can make; an ACRYL app starter is refused with a line saying so.\n\nOther options:\n --template <name> the same as the word after the name (npm needs a -- before options when you use npm create)\n --install install a source's dependencies (the lifecycle scripts it will run are listed first); a template always installs\n --desktop the frame (already the default for a template and a registry starter); a starter from another source gets it only with this\n --bare no frame, for a registry starter too\n --pm <manager> ${PACKAGE_MANAGERS.join(', ')} (default: the one that ran this command, else npm)\n -y, --yes ask nothing, and use the name my-app when none is given\n -h, --help show this help\n\nTemplates (the same list as acrylblends init):\n${TEMPLATE_LIST}\n -v, --version show the version\n`\n\n/** A command line mistake. The command prints it with the help text and exits 2. */\nexport class UsageError extends Error {\n override name = 'UsageError'\n}\n\nexport interface Io {\n stdout: { write(text: string): unknown }\n stderr: { write(text: string): unknown }\n cwd: string\n env: Record<string, string | undefined>\n /** Ask one question; `undefined` when there is no terminal to ask on. */\n ask: ((question: string) => Promise<string>) | undefined\n /** Run a program, showing its output; resolves to the exit code. */\n run(command: string, args: string[], cwd: string): Promise<number>\n /** How a template source is fetched; the real network and npm by default. */\n fetchers?: Fetchers\n}\n\nexport function processIo(): Io {\n const interactive = Boolean(process.stdin.isTTY && process.stdout.isTTY)\n return {\n stdout: process.stdout,\n stderr: process.stderr,\n cwd: process.cwd(),\n env: process.env,\n ask: interactive\n ? async (question) => {\n const rl = createInterface({ input: process.stdin, output: process.stdout })\n try {\n return await rl.question(question)\n } finally {\n rl.close()\n }\n }\n : undefined,\n run: (command, args, cwd) =>\n new Promise((done) => {\n const invocation = packageManagerInvocation(command, args)\n const child = spawn(invocation.file, invocation.args, { cwd, stdio: 'inherit' })\n child.on('error', () => done(1))\n child.on('exit', (code) => done(code ?? 1))\n }),\n }\n}\n\nexport interface CreateOptions {\n directory: string | undefined\n template: Template | undefined\n install: boolean\n /**\n * Put the app inside the ACRYL frame, as `acrylblends init --desktop` does. On for a template and a registry blueprint, on for another source only with\n * `--desktop`, off with `--bare`.\n */\n desktop: boolean\n /** Start the app when it is created and installed (`<pm> run dev`), only when there is a terminal to show it in. Off with `--no-start`. */\n start: boolean\n pm: PackageManager | undefined\n yes: boolean\n /** `github:owner/repo[#ref]`, `@scope/name`, a packed `.tgz`, a folder, or a registry id: a template from outside this package. */\n source: string | undefined\n /** Where registry ids are read from; the public registry by default. */\n registry: string | undefined\n}\n\nexport function isTemplate(value: string): value is Template {\n return (TEMPLATES as readonly string[]).includes(value)\n}\n\n/** The template a name means: itself, or what an old name stands for. */\nexport function resolveTemplate(value: string): Template | undefined {\n return isTemplate(value) ? value : TEMPLATE_ALIASES[value]\n}\n\nexport function parseCreateOptions(argv: readonly string[]): CreateOptions {\n let parsed: ReturnType<typeof parse>\n try {\n parsed = parse(argv)\n } catch (error) {\n throw new UsageError((error as Error).message)\n }\n const { values, positionals } = parsed\n if (positionals.length > 2)\n throw new UsageError('takes a directory and at most one template source')\n // A bare name that is a built-in template means --template: `create my-app notes`. Only github:, @scope/ and .tgz are sources.\n const bare = positionals[1] !== undefined ? resolveTemplate(positionals[1]) : undefined\n if (positionals[1] !== undefined && values.template !== undefined)\n throw new UsageError('give a template (or a template source) or --template, not both')\n const named = values.template === undefined ? undefined : resolveTemplate(values.template)\n if (values.template !== undefined && named === undefined)\n throw new UsageError(`unknown template \"${values.template}\" (${TEMPLATES.join(', ')})`)\n if (values.pm !== undefined && !(PACKAGE_MANAGERS as readonly string[]).includes(values.pm))\n throw new UsageError(`unknown package manager \"${values.pm}\" (${PACKAGE_MANAGERS.join(', ')})`)\n const positionalSource = bare === undefined ? positionals[1] : undefined\n if (values.from !== undefined && positionals[1] !== undefined)\n throw new UsageError(\n 'give --from or a template (or a template source) after the directory, not both',\n )\n if (values.from !== undefined && values.template !== undefined)\n throw new UsageError('give --from or --template, not both')\n const source = values.from ?? positionalSource\n if (values.bare === true && values.desktop === true)\n throw new UsageError('give --bare or --desktop, not both')\n if (values['no-install'] === true && values.install === true)\n throw new UsageError('give --no-install or --install, not both')\n if (values.registry !== undefined && !(source !== undefined && REGISTRY_ID.test(source)))\n throw new UsageError('--registry goes with a registry id: --from <id> --registry <source>')\n return {\n directory: positionals[0],\n template: bare ?? named,\n // A template is the framework's own: it installs and opens in the frame unless told not to. A source is someone else's: nothing of it runs unless --install.\n install: values.install === true || (source === undefined && values['no-install'] !== true),\n // The frame (chat, agents, Settings) is the default for a template and for a blueprint from the registry, whose apps are made for it; a starter from\n // another source gets it when asked (--desktop), since it may not be built for it. --bare keeps either plain.\n desktop:\n values.bare !== true &&\n (values.desktop === true || source === undefined || REGISTRY_ID.test(source)),\n start: values['no-start'] !== true,\n pm: values.pm as PackageManager | undefined,\n yes: values.yes === true,\n source,\n registry: values.registry,\n }\n}\n\nconst parse = (argv: readonly string[]) =>\n parseArgs({\n args: [...argv],\n allowPositionals: true,\n strict: true,\n options: {\n template: { type: 'string' },\n from: { type: 'string' },\n registry: { type: 'string' },\n install: { type: 'boolean' },\n 'no-install': { type: 'boolean' },\n desktop: { type: 'boolean' },\n bare: { type: 'boolean' },\n 'no-start': { type: 'boolean' },\n pm: { type: 'string' },\n yes: { type: 'boolean', short: 'y' },\n },\n })\n\n/** A valid package name from a directory name: lower case letters, digits and dashes. */\nexport function nameFrom(directory: string): string {\n const name = basename(resolve(directory))\n .toLowerCase()\n .replace(/[^a-z0-9-]+/g, '-')\n .replace(/^[^a-z]+/, '')\n .replace(/-+$/g, '')\n return name === '' ? 'acryl-app' : name\n}\n\nfunction walkUp(from: string, test: (dir: string) => string | undefined): string {\n let dir = from\n for (;;) {\n const found = test(dir)\n if (found) return found\n const parent = dirname(dir)\n if (parent === dir) throw new Error(`${CREATE} cannot find its files`)\n dir = parent\n }\n}\nconst here = dirname(fileURLToPath(import.meta.url))\n/** The framework docs: the copy `prepack` puts in the package, or `docs/framework` of the repository. */\nconst docsRoot = () =>\n walkUp(here, (d) =>\n existsSync(join(d, 'docs', 'framework', 'README.md'))\n ? join(d, 'docs', 'framework')\n : undefined,\n )\n\n/**\n * The range a created app asks for: the framework version this package was released with, so a new app depends on the release that made it (and gets what that release's\n * commands can do), never an older one. A caret range, so it also takes the newer patch releases.\n */\nexport function frameworkRange(): string {\n const file = createRequire(import.meta.url).resolve(`${PACKAGE}/package.json`)\n return `^${(JSON.parse(readFileSync(file, 'utf8')) as { version: string }).version}`\n}\n\nexport function replacePlaceholders(text: string, name: string): string {\n return text\n .replaceAll('__APP_NAME__', name)\n .replaceAll('__PACKAGE__', PACKAGE)\n .replaceAll('__CLASS__', CLASS)\n .replaceAll('__RANGE__', frameworkRange())\n}\n\nfunction copyDocs(target: string): void {\n const filter = (path: string) => !/(upstream\\.json|UPSTREAM\\.md)$/.test(path)\n mkdirSync(join(target, 'docs'), { recursive: true })\n cpSync(docsRoot(), join(target, 'docs', 'framework'), { recursive: true, filter })\n}\n\nconst isEmpty = (directory: string) => !existsSync(directory) || readdirSync(directory).length === 0\n\n/** The `acrylblends` command of the installed framework package, which creates every template. */\nfunction acrylblendsBin(): string {\n const pkgFile = createRequire(import.meta.url).resolve(`${PACKAGE}/package.json`)\n const pkg = JSON.parse(readFileSync(pkgFile, 'utf8')) as { bin?: string | Record<string, string> }\n const bin = typeof pkg.bin === 'string' ? pkg.bin : pkg.bin?.[PACKAGE]\n if (!bin) throw new Error(`${PACKAGE} has no command to create an app with`)\n return join(dirname(pkgFile), bin)\n}\n\n/** The lifecycle scripts a template defines and the line that says when they run. */\nconst describeScripts = (scripts: Record<string, string>) =>\n Object.entries(scripts)\n .map(([key, value]) => ` ${key}: ${value}`)\n .join('\\n')\n\n/** Files whose text is checked for secrets: the template's own, not the framework docs copied in. */\nfunction textFiles(root: string): { path: string; text: string }[] {\n const found: { path: string; text: string }[] = []\n const walk = (dir: string, prefix: string) => {\n for (const entry of readdirSync(dir, { withFileTypes: true })) {\n if (\n entry.name === 'node_modules' ||\n entry.name === '.git' ||\n (prefix === '' && entry.name === 'docs')\n )\n continue\n if (entry.isDirectory()) walk(join(dir, entry.name), `${prefix}${entry.name}/`)\n else {\n const buffer = readFileSync(join(dir, entry.name))\n if (!buffer.subarray(0, 8000).includes(0))\n found.push({ path: `${prefix}${entry.name}`, text: buffer.toString('utf8') })\n }\n }\n }\n walk(root, '')\n return found\n}\n\n/**\n * A new app is a git repository from the start, as `acrylblends init` makes it: the frame's versions, Files and Changes work on it, and its first\n * version is the app as created. A folder that already is a repository, or a machine without git, is left alone.\n */\nexport function startRepository(directory: string): void {\n if (existsSync(join(directory, '.git'))) return\n const run = (args: string[]) =>\n spawnSync('git', args, { cwd: directory, stdio: 'ignore', windowsHide: true }).status === 0\n if (!run(['init', '-q'])) return\n if (!run(['add', '-A'])) return\n // A machine without a git identity still gets the first commit: this one is the scaffolder's, and later commits use the person's own identity.\n const identity = run(['config', 'user.email'])\n ? []\n : ['-c', 'user.name=acrylblends', '-c', 'user.email=scaffold@acrylblends.invalid']\n run([...identity, 'commit', '-q', '-m', 'Initial commit from acrylblends'])\n}\n\n/** The registry `--registry` names. */\nfunction openNamedRegistry(name: string, cwd: string, reading: RegistryReading) {\n const source = parseRegistrySource(name, cwd)\n if (!source) throw new UsageError(`unknown registry \"${name}\" (${SOURCE_FORMS})`)\n return openRegistry(source, name, reading)\n}\n\n/**\n * Create an app from a template source (`github:`, `@scope/name`, a packed tarball). The source is fetched and unpacked into a scratch folder, checked\n * (manifest, secrets), and only then copied to the target; nothing in it is installed or run unless `--install`, which lists the scripts first.\n */\nasync function createFromSource(\n options: CreateOptions,\n target: string,\n directory: string,\n io: Io,\n): Promise<number> {\n if (!isEmpty(target)) {\n io.stderr.write(`error: ${target} is not empty; nothing was changed\\n`)\n return 1\n }\n const scratch = mkdtempSync(join(tmpdir(), 'create-acrylblends-'))\n try {\n const name = nameFrom(target)\n const fetchers = io.fetchers ?? realFetchers\n let entry: RegistryEntry | undefined\n if (REGISTRY_ID.test(options.source!)) {\n // A registry id: read the registry's index, pick the entry (only an app for this runtime), and take its folder as the template.\n const reading = { scratch, fetchers }\n const registry =\n options.registry === undefined\n ? await openPublicRegistry(reading)\n : await openNamedRegistry(options.registry, io.cwd, reading)\n entry = pickEntry(registry.entries, options.source!)\n await registry.takeEntry(entry, join(scratch, 'source'))\n } else {\n const source = parseSource(options.source!, io.cwd)\n if (!source)\n throw new UsageError(`unknown template source \"${options.source}\" (${SOURCE_FORMS})`)\n await fetchTemplate(source, join(scratch, 'source'), join(scratch, 'download'), fetchers)\n }\n const manifest = readManifest(join(scratch, 'source'))\n const staged = join(scratch, 'app')\n const { files, lifecycle } = writeTemplate(\n join(scratch, 'source'),\n staged,\n (text) => replacePlaceholders(text, name),\n frameworkRange(),\n name,\n )\n if (entry !== undefined && existsSync(join(staged, 'blend.yaml'))) {\n const starterText = readFileSync(join(staged, 'blend.yaml'), 'utf8')\n // The starter was an app with its own name in its page, its README and its agents' instructions: they now say this app's. The staged package.json\n // already carries the new name, so the starter's is read from the source.\n const sourcePackage = join(scratch, 'source', 'package.json')\n const starter = starterName(\n starterText,\n existsSync(sourcePackage) ? readFileSync(sourcePackage, 'utf8') : undefined,\n )\n if (starter !== undefined) renameApp(staged, starter, name)\n const manifestText = ownManifest(starterText, name)\n writeFileSync(join(staged, 'blend.yaml'), manifestText)\n if (existsSync(join(staged, 'blend.lock.json')))\n writeFileSync(\n join(staged, 'blend.lock.json'),\n ownLock(readFileSync(join(staged, 'blend.lock.json'), 'utf8'), manifestText, name),\n )\n }\n if (!existsSync(join(staged, 'AGENTS.md')))\n writeFileSync(\n join(staged, 'AGENTS.md'),\n `# ${name}\\n\\nAn ${CLASS} app made from the template \"${manifest.name}\": ${manifest.description}\\n\\nThe framework's API is in \\`docs/framework/\\` (start at \\`docs/framework/README.md\\`).\\n`,\n )\n if (!existsSync(join(staged, 'CLAUDE.md')))\n copyFileSync(join(staged, 'AGENTS.md'), join(staged, 'CLAUDE.md'))\n const found = findSecrets(textFiles(staged))\n if (found.length > 0) {\n io.stderr.write(\n `error: the template holds what looks like a secret, so nothing was created:\\n${found.map((f) => ` ${f.path}:${f.line} (${f.kind})`).join('\\n')}\\n`,\n )\n return 1\n }\n copyDocs(staged)\n cpSync(staged, target, { recursive: true })\n // In the frame: the framework's own commands do it, as for an app made before the frame. `add desktop` brings the window; `upgrade` brings the starter's\n // library plugins to this release (its data then lives under ~/.acryl) and writes the frame around the starter's own frame row. Before the first\n // commit, so the app's first version is the app as made.\n if (options.desktop) {\n const framework = (args: string[]) =>\n io.run(process.execPath, [acrylblendsBin(), ...args, '--dir', target], io.cwd)\n if ((await framework(['add', 'desktop'])) !== 0 || (await framework(['upgrade'])) !== 0) {\n io.stderr.write(\n `error: ${directory} was made, but putting it in the ACRYL frame failed (see above); it runs on its own with ${'`npm start`'}\\n`,\n )\n startRepository(target)\n return 1\n }\n }\n startRepository(target)\n io.stdout.write(\n `created ${name} from ${entry ? `${entry.id} ${entry.version}` : manifest.name} (${manifest.description}) in ${target}: ${files.length} files, ${CLASS} docs in docs/framework\\n`,\n )\n if (manifest.plugins.length > 0)\n io.stdout.write(\n `it needs these plugins: ${manifest.plugins.join(', ')}; add them with: npx ${PACKAGE} add ${manifest.plugins.join(' ')}\\n`,\n )\n const pm: PackageManager =\n options.pm ??\n ((PACKAGE_MANAGERS as readonly string[]).find((m) =>\n (io.env.npm_config_user_agent ?? '').startsWith(`${m}/`),\n ) as PackageManager | undefined) ??\n 'npm'\n const hasScripts = Object.keys(lifecycle).length > 0\n if (options.install) {\n const pkg = JSON.parse(readFileSync(join(target, 'package.json'), 'utf8')) as {\n dependencies?: object\n devDependencies?: object\n }\n io.stdout.write(\n `running ${pm} install in ${directory}. This installs: ${[...Object.keys(pkg.dependencies ?? {}), ...Object.keys(pkg.devDependencies ?? {})].join(', ') || 'nothing'}` +\n `${hasScripts ? `\\nand runs the template's own lifecycle scripts:\\n${describeScripts(lifecycle)}` : ''}\\n` +\n `(the dependencies' install scripts run too unless your ${pm} is set to ignore them)\\n`,\n )\n if ((await io.run(pm, ['install'], target)) !== 0) {\n io.stderr.write(`error: ${pm} install failed; run it yourself in ${directory}\\n`)\n return 1\n }\n } else if (hasScripts) {\n io.stdout.write(\n `nothing was installed or run. The template defines ${LIFECYCLE.filter((k) => lifecycle[k]).join(', ')}, which ${pm} install would run:\\n${describeScripts(lifecycle)}\\nread them first, or pass --install to run them.\\n`,\n )\n }\n io.stdout.write(\n `\\nNext:\\n cd ${directory}\\n${options.install ? '' : ` ${pm} install\\n`}${\n options.desktop\n ? ` ${pm} run dev in the ACRYL frame, in the browser\\n ${pm} run desktop in the ACRYL frame, in its own window\\n ${pm} start the app on its own\\n`\n : ` ${existsSync(join(target, 'README.md')) ? 'see README.md or the package.json scripts' : 'see the package.json scripts'}\\n`\n }`,\n )\n return 0\n } catch (error) {\n if (error instanceof SourceError) {\n io.stderr.write(`error: ${error.message}\\nnothing was changed\\n`)\n return 1\n }\n throw error\n } finally {\n removeTree(scratch)\n }\n}\n\n/** Create the app. Returns the exit code: 0 done, 1 refused or failed, 2 a usage error. Never calls `process.exit`. */\nexport async function runCreate(argv: readonly string[], io: Io = processIo()): Promise<number> {\n try {\n if (argv.includes('-h') || argv.includes('--help')) {\n io.stdout.write(HELP)\n return 0\n }\n if (argv.includes('-v') || argv.includes('--version')) {\n io.stdout.write(`${VERSION}\\n`)\n return 0\n }\n const options = parseCreateOptions(argv)\n // A name on the command line means no questions at all; without one, the only question is the app's name.\n const askedName = options.directory === undefined && !options.yes && io.ask !== undefined\n const directory =\n options.directory ??\n (askedName\n ? (await io.ask!('What is your app called? (my-app): ')).trim() || 'my-app'\n : 'my-app')\n const target = resolve(io.cwd, directory)\n if (options.source !== undefined) return await createFromSource(options, target, directory, io)\n // The Blank app is what `acryl new my-app` makes; a starter is a word after the name.\n const template: Template = options.template ?? 'blank'\n if (!isEmpty(target)) {\n io.stderr.write(`error: ${target} is not empty; nothing was changed\\n`)\n return 1\n }\n const name = nameFrom(target)\n // Every template is a Cordis app, made by the framework package's own `init` (blend.yaml, plugins/, AGENTS.md, CLAUDE.md, the skill, the docs).\n const code = await io.run(\n process.execPath,\n [\n acrylblendsBin(),\n 'init',\n target,\n '--template',\n template,\n '--name',\n name,\n '--yes',\n '--no-next',\n // init frames the app by default: the plain app is asked for by name.\n ...(options.desktop ? ['--desktop'] : ['--bare']),\n ],\n io.cwd,\n )\n if (code !== 0) return 1\n const pm: PackageManager =\n options.pm ??\n ((PACKAGE_MANAGERS as readonly string[]).find((m) =>\n (io.env.npm_config_user_agent ?? '').startsWith(`${m}/`),\n ) as PackageManager | undefined) ??\n 'npm'\n if (options.install) {\n if ((await io.run(pm, ['install'], target)) !== 0) {\n io.stderr.write(`error: ${pm} install failed; run it yourself in ${directory}\\n`)\n return 1\n }\n }\n const start = `${pm} run dev`\n // The app opens by itself when it was made in the frame, installed, and there is a terminal to run it in (a script or CI never starts a server).\n if (options.start && options.desktop && options.install && io.ask !== undefined) {\n io.stdout.write(\n `\\n${name} is ready. Starting it (Ctrl+C stops it). Next time: cd ${directory} && ${start}\\n\\n`,\n )\n await io.run(pm, ['run', 'dev'], target)\n return 0\n }\n io.stdout.write(\n `\\nNext:\\n cd ${directory}\\n${options.install ? '' : ` ${pm} install\\n`} ${start}\\n`,\n )\n return 0\n } catch (error) {\n if (error instanceof UsageError) {\n io.stderr.write(`error: ${error.message}\\n\\n${HELP}`)\n return 2\n }\n io.stderr.write(`error: ${(error as Error).message}\\n`)\n return 1\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAIA,MAAa,UAAU;AACvB,MAAa,QAAQ;AACrB,MAAa,SAAS;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AM,OAC5C,GAAG,IAAI,yBAAyB,GAAA,CAAI,WAAW,GAAG,EAAE,EAAE,CACzD,KACA;EACF,IAAI,QAAQ,SACL;OAAA,MAAM,GAAG,IAAI,IAAI,CAAC,SAAS,GAAG,MAAM,MAAO,GAAG;IACjD,GAAG,OAAO,MAAM,UAAU,GAAG,sCAAsC,UAAU,GAAG;IAChF,OAAO;GACT;;EAEF,MAAM,QAAQ,GAAG,GAAG;EAEpB,IAAI,QAAQ,SAAS,QAAQ,WAAW,QAAQ,WAAW,GAAG,QAAQ,KAAA,GAAW;GAC/E,GAAG,OAAO,MACR,KAAK,KAAK,0DAA0D,UAAU,MAAM,MAAM,KAC5F;GACA,MAAM,GAAG,IAAI,IAAI,CAAC,OAAO,KAAK,GAAG,MAAM;GACvC,OAAO;EACT;EACA,GAAG,OAAO,MACR,iBAAiB,UAAU,IAAI,QAAQ,UAAU,KAAK,KAAK,GAAG,YAAY,IAAI,MAAM,GACtF;EACA,OAAO;CACT,SAAS,OAAO;EACd,IAAI,iBAAiB,YAAY;GAC/B,GAAG,OAAO,MAAM,UAAU,MAAM,QAAQ,MAAM,MAAM;GACpD,OAAO;EACT;EACA,GAAG,OAAO,MAAM,UAAW,MAAgB,QAAQ,GAAG;EACtD,OAAO;CACT;AACF"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/names.ts","../src/source.ts","../src/registry.ts","../src/spawn.ts","../src/index.ts"],"sourcesContent":["/**\n * The one place this package names the framework. The templates are written with `__PACKAGE__` and `__RANGE__` (the range is stamped at create time from the framework version this package carries, see `frameworkRange`), and the text of `AGENTS.md` with\n * `__PACKAGE__`, so a rename (for example to `acryl`) is a change here and in `scripts/lib/names.mjs`, which a test keeps equal.\n */\nexport const PACKAGE = 'acrylblends'\nexport const CLASS = 'Acryl'\nexport const CREATE = 'create-acrylblends'\n\n/** The file that makes a folder a template other people can create apps from (`${CREATE} <name> github:owner/repo`). */\nexport const TEMPLATE_MANIFEST = 'acryl.template.json'\n","/**\n * Templates from outside this package: `github:owner/repo[#ref]`, a scoped npm package (`@scope/name[@version]`) or a packed tarball on disk.\n * A source is only ever downloaded and unpacked: no git clone (hooks), no lifecycle script (`npm pack --ignore-scripts`), nothing of it is run.\n */\nimport { spawnSync } from 'node:child_process'\nimport {\n cpSync,\n existsSync,\n lstatSync,\n mkdirSync,\n readdirSync,\n readFileSync,\n rmSync,\n writeFileSync,\n} from 'node:fs'\nimport { join, resolve } from 'node:path'\nimport { PACKAGE, TEMPLATE_MANIFEST } from './names'\n\nexport type Source =\n | { kind: 'github'; owner: string; repo: string; ref: string | undefined }\n | { kind: 'npm'; spec: string }\n | { kind: 'tarball'; path: string }\n | { kind: 'folder'; path: string }\n\n/** Where a registry can be read from: any source, or a static host that serves its `index.json` and each entry's archive under `base` (which ends in `/`). */\nexport type RegistrySource = Source | { kind: 'hosted'; base: string }\n\n/** What a template says about itself in `acryl.template.json`. */\nexport interface Manifest {\n name: string\n description: string\n /** Library plugins the template needs, added with `acrylblends add`. */\n plugins: string[]\n}\n\n/** A source that cannot be used; the message says why and is shown as it is. */\nexport class SourceError extends Error {\n override name = 'SourceError'\n}\n\nexport const SOURCE_FORMS = `github:owner/repo[#ref] (or the https://github.com/owner/repo address), @scope/name[@version], a packed .tgz file, or a folder (./path)`\n\n/** How much a source may hold, and what its refusal calls it. */\ninterface Limits {\n readonly what: string\n readonly files: number\n readonly bytes: number\n}\n\n/** A template is copied whole into the person's new app, so it is held to the size of an app's source. */\nconst TEMPLATE_LIMITS: Limits = { what: 'template', files: 5000, bytes: 50 * 1024 * 1024 }\n\n/**\n * A registry is read for its index and one entry, and grows with every entry it publishes (100 blueprints are about 33,000 files and 200 MB), so its bound\n * only stops a runaway download; the entry taken from it is a template and is held to the template's limits.\n */\nconst REGISTRY_LIMITS: Limits = { what: 'registry', files: 200_000, bytes: 2 * 1024 * 1024 * 1024 }\n\n/** Recognise a source argument, or return `undefined` when it is not one (so the caller can report a usage error). */\nexport function parseSource(text: string, cwd: string): Source | undefined {\n const github = /^github:([A-Za-z0-9_.-]+)\\/([A-Za-z0-9_.-]+)(?:#([A-Za-z0-9_./-]+))?$/.exec(text)\n if (github) return { kind: 'github', owner: github[1]!, repo: github[2]!, ref: github[3] }\n // A GitHub address as it is pasted from the browser: https://github.com/owner/repo, with .git or /tree/<ref> after it.\n const pasted =\n /^https:\\/\\/github\\.com\\/([A-Za-z0-9_.-]+)\\/([A-Za-z0-9_.-]+?)(?:\\.git)?(?:\\/tree\\/([A-Za-z0-9_./-]+))?\\/?$/.exec(\n text,\n )\n if (pasted) return { kind: 'github', owner: pasted[1]!, repo: pasted[2]!, ref: pasted[3] }\n if (text.startsWith('github:')) throw new SourceError(`\"${text}\" is not github:owner/repo[#ref]`)\n if (/^@[a-z0-9][a-z0-9._-]*\\/[a-z0-9][a-z0-9._-]*(@[A-Za-z0-9._-]+)?$/.test(text))\n return { kind: 'npm', spec: text }\n if (text.startsWith('@')) throw new SourceError(`\"${text}\" is not @scope/name[@version]`)\n if (/\\.(tgz|tar\\.gz)$/.test(text)) {\n const path = resolve(cwd, text)\n if (!existsSync(path)) throw new SourceError(`${path} does not exist`)\n return { kind: 'tarball', path }\n }\n // A folder is only a source when it is written as a path, so a template name is never taken for one.\n if (/^(\\.{1,2}[\\\\/]|[\\\\/]|[A-Za-z]:[\\\\/])/.test(text)) {\n const path = resolve(cwd, text)\n if (!existsSync(path) || !lstatSync(path).isDirectory())\n throw new SourceError(`${path} is not a folder`)\n return { kind: 'folder', path }\n }\n return undefined\n}\n\n/**\n * A registry, as `--registry` names it: a source, an https address, or a folder written as a bare path (`my-registry`, `run/registry`). A registry is never a template\n * name, so a path that is an existing folder is taken as one without the `./` a template source needs.\n */\nexport function parseRegistrySource(text: string, cwd: string): RegistrySource | undefined {\n const source = parseSource(text, cwd)\n if (source !== undefined) return source\n if (text.startsWith('https://')) return { kind: 'hosted', base: text.replace(/\\/*$/, '/') }\n const path = resolve(cwd, text)\n return existsSync(path) && lstatSync(path).isDirectory() ? { kind: 'folder', path } : undefined\n}\n\n/** How the bytes of a source are obtained; real by default, replaced in tests. */\nexport interface Fetchers {\n /** The body at a URL (a GitHub tarball). */\n download(url: string): Promise<Uint8Array>\n /** `npm pack <spec> --ignore-scripts` into `dest`; the path of the tarball. */\n pack(spec: string, dest: string): string\n}\n\nexport const realFetchers: Fetchers = {\n async download(url) {\n const response = await fetch(url, { redirect: 'follow' }).catch((cause: unknown) => {\n throw new SourceError(\n `could not reach ${url}: ${cause instanceof Error ? cause.message : String(cause)}`,\n )\n })\n if (!response.ok) throw new SourceError(`${url} answered ${response.status}`)\n return new Uint8Array(await response.arrayBuffer())\n },\n pack(spec, dest) {\n const result = spawnSync(\n 'npm',\n ['pack', spec, '--ignore-scripts', '--json', '--pack-destination', dest],\n {\n encoding: 'utf8',\n shell: false,\n env: { ...process.env, npm_config_ignore_scripts: 'true' },\n },\n )\n if (result.status !== 0)\n throw new SourceError(\n `npm could not pack ${spec}: ${(result.stderr || result.stdout).trim().split('\\n').at(-1)}`,\n )\n const file = (JSON.parse(result.stdout) as { filename: string }[])[0]?.filename\n if (!file) throw new SourceError(`npm packed nothing for ${spec}`)\n return join(dest, file)\n },\n}\n\n/** Unpack a tarball into `dir`, dropping its single top folder; refuses links, paths that leave the folder, and archives over `limits`. */\nfunction extract(tarball: string, dir: string, limits: Limits): void {\n const list = spawnSync('tar', ['-tzf', tarball], {\n encoding: 'utf8',\n maxBuffer: 256 * 1024 * 1024,\n })\n if (list.status !== 0) throw new SourceError(`${tarball} is not a readable tar.gz archive`)\n const entries = list.stdout.split('\\n').filter(Boolean)\n if (entries.length > limits.files)\n throw new SourceError(`the ${limits.what} has more than ${limits.files} files`)\n for (const entry of entries)\n if (entry.startsWith('/') || entry.split('/').includes('..'))\n throw new SourceError(`the archive holds a path that leaves its folder: ${entry}`)\n mkdirSync(dir, { recursive: true })\n const run = spawnSync('tar', ['-xzf', tarball, '-C', dir, '--strip-components=1'], {\n encoding: 'utf8',\n })\n if (run.status !== 0) throw new SourceError(`could not unpack ${tarball}: ${run.stderr.trim()}`)\n checkTree(dir, limits)\n}\n\n/** Refuse a tree that holds a link, or is larger than `limits`; the same check for an unpacked archive and a copied folder. */\nfunction checkTree(dir: string, limits: Limits): void {\n let bytes = 0\n let count = 0\n const walk = (folder: string) => {\n for (const entry of readdirSync(folder)) {\n const path = join(folder, entry)\n const info = lstatSync(path)\n if (info.isSymbolicLink())\n throw new SourceError(\n `the ${limits.what} holds a symbolic link (${path.slice(dir.length + 1)}); links are not allowed`,\n )\n if (info.isDirectory()) walk(path)\n else {\n bytes += info.size\n count += 1\n }\n }\n }\n walk(dir)\n if (count > limits.files)\n throw new SourceError(`the ${limits.what} has more than ${limits.files} files`)\n if (bytes > limits.bytes)\n throw new SourceError(`the ${limits.what} is larger than ${limits.bytes / 1024 / 1024} MB`)\n}\n\n/** Download or pack a template and unpack it into `dir` (which must not exist yet). Nothing in it is run. */\nexport const fetchTemplate = (source: Source, dir: string, scratch: string, fetchers: Fetchers) =>\n fetchSource(source, dir, scratch, fetchers, TEMPLATE_LIMITS)\n\n/** Download or copy a registry into `dir` (which must not exist yet), to read its index and take one entry from it. Nothing in it is run. */\nexport const fetchRegistry = (source: Source, dir: string, scratch: string, fetchers: Fetchers) =>\n fetchSource(source, dir, scratch, fetchers, REGISTRY_LIMITS)\n\nasync function fetchSource(\n source: Source,\n dir: string,\n scratch: string,\n fetchers: Fetchers,\n limits: Limits,\n): Promise<void> {\n mkdirSync(scratch, { recursive: true })\n if (source.kind === 'folder') {\n cpSync(source.path, dir, {\n recursive: true,\n filter: (path) => !/[\\\\/](\\.git|node_modules)([\\\\/]|$)/.test(path.slice(source.path.length)),\n })\n checkTree(dir, limits)\n return\n }\n let tarball: string\n if (source.kind === 'tarball') tarball = source.path\n else if (source.kind === 'npm') tarball = fetchers.pack(source.spec, scratch)\n else {\n tarball = join(scratch, 'source.tar.gz')\n writeFileSync(\n tarball,\n await fetchers.download(\n `https://codeload.github.com/${source.owner}/${source.repo}/tar.gz/${source.ref ?? 'HEAD'}`,\n ),\n )\n }\n extract(tarball, dir, limits)\n}\n\n/** Read and check `acryl.template.json`; a source without it is not a template. */\nexport function readManifest(dir: string): Manifest {\n const file = join(dir, TEMPLATE_MANIFEST)\n if (!existsSync(file))\n throw new SourceError(\n `this source has no ${TEMPLATE_MANIFEST}, so it is not a template: add one with a name and a description (see the create-acrylblends guide)`,\n )\n let data: unknown\n try {\n data = JSON.parse(readFileSync(file, 'utf8'))\n } catch {\n throw new SourceError(`${TEMPLATE_MANIFEST} is not valid JSON`)\n }\n const m = data as Record<string, unknown>\n if (typeof m.name !== 'string' || m.name.trim() === '')\n throw new SourceError(`${TEMPLATE_MANIFEST} needs a \"name\"`)\n if (typeof m.description !== 'string')\n throw new SourceError(`${TEMPLATE_MANIFEST} needs a \"description\"`)\n const plugins = m.plugins ?? []\n if (\n !Array.isArray(plugins) ||\n plugins.some((p) => typeof p !== 'string' || !/^[a-z][a-z0-9-]*$/.test(p))\n )\n throw new SourceError(\n `\"plugins\" in ${TEMPLATE_MANIFEST} is a list of plugin names such as \"desktop\"`,\n )\n return { name: m.name, description: m.description, plugins: plugins as string[] }\n}\n\nconst SKIP = new Set(['.git', 'node_modules', TEMPLATE_MANIFEST])\nconst GIT_ATTRIBUTES =\n '# Every checkout has the same line endings, on every OS.\\n* text=auto eol=lf\\n'\n/** Lifecycle scripts npm runs on `npm install` in the app's own folder. */\nexport const LIFECYCLE = [\n 'preinstall',\n 'install',\n 'postinstall',\n 'prepublish',\n 'preprepare',\n 'prepare',\n 'postprepare',\n]\n\nconst isText = (buffer: Buffer) => !buffer.subarray(0, 8000).includes(0)\n\n/**\n * Copy the unpacked template into `target`, replacing the placeholders of the built-in templates, naming the app, and pointing a dependency on the framework at\n * the release this package carries. Returns the files written (relative paths) and the lifecycle scripts the app's package.json defines.\n */\nexport function writeTemplate(\n from: string,\n target: string,\n stamp: (text: string) => string,\n range: string,\n name: string,\n): { files: string[]; lifecycle: Record<string, string> } {\n const files: string[] = []\n const walk = (src: string, dst: string, prefix: string) => {\n mkdirSync(dst, { recursive: true })\n for (const entry of readdirSync(src, { withFileTypes: true })) {\n if (SKIP.has(entry.name)) continue\n const outName = prefix === '' && entry.name === 'gitignore' ? '.gitignore' : entry.name\n if (entry.isDirectory())\n walk(join(src, entry.name), join(dst, outName), `${prefix}${entry.name}/`)\n else {\n const buffer = readFileSync(join(src, entry.name))\n writeFileSync(join(dst, outName), isText(buffer) ? stamp(buffer.toString('utf8')) : buffer)\n files.push(`${prefix}${outName}`)\n }\n }\n }\n walk(from, target, '')\n // An app's plugins are identified by every byte, so a CRLF checkout would make them different plugins. An entry made before make-entry wrote this file\n // has none; one that has its own keeps it.\n if (!existsSync(join(target, '.gitattributes'))) {\n writeFileSync(join(target, '.gitattributes'), GIT_ATTRIBUTES)\n files.push('.gitattributes')\n }\n const lifecycle: Record<string, string> = {}\n const pkgFile = join(target, 'package.json')\n if (existsSync(pkgFile)) {\n const pkg = JSON.parse(readFileSync(pkgFile, 'utf8')) as {\n name?: string\n scripts?: Record<string, string>\n dependencies?: Record<string, string>\n devDependencies?: Record<string, string>\n }\n pkg.name = name\n for (const group of [pkg.dependencies, pkg.devDependencies])\n if (group?.[PACKAGE] !== undefined) group[PACKAGE] = range\n writeFileSync(pkgFile, `${JSON.stringify(pkg, null, 2)}\\n`)\n for (const script of LIFECYCLE)\n if (typeof pkg.scripts?.[script] === 'string') lifecycle[script] = pkg.scripts[script]\n }\n return { files, lifecycle }\n}\n\n/** Remove a folder tree quietly. */\nexport const removeTree = (path: string) => rmSync(path, { recursive: true, force: true })\nexport { cpSync }\n","/**\n * Starters from a registry: `npm create acrylblends@latest my-app -- --from acryl.example`. A registry is a git repository (or a folder) with an `index.json` and one folder per\n * starter under `blends/<id>/`. Its CI says in the index which runtime an entry is for: only `runtime: acrylblends` entries are apps this package can make (the folder is the\n * app, with an `acryl.template.json`); the others are ACRYL app starters and are refused with one line. Nothing is run: the entry is downloaded, unpacked and copied.\n *\n * A registry grows with every entry and one starter is all that is wanted, so `openRegistry` reads as little as the registry allows. A folder is read in place. A static host\n * serves the index and one archive per entry (`archive`, `integrity`, written when the site deploys: workshop-registry/scripts/registry-archives.mjs). A repository holds no\n * archives, so it is downloaded whole. The public registry is a host with its repository behind it, for when the host cannot give the entry.\n */\nimport { createHash } from 'node:crypto'\nimport { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from 'node:fs'\nimport { join } from 'node:path'\nimport {\n type Fetchers,\n fetchRegistry,\n fetchTemplate,\n type RegistrySource,\n type Source,\n SourceError,\n} from './source'\n\n/** The public registry's repository (the same files the site lists). */\nexport const DEFAULT_REGISTRY = 'github:acrylblends/acrylblends.github.io'\nconst DEFAULT_REPOSITORY: Source = {\n kind: 'github',\n owner: 'acrylblends',\n repo: 'acrylblends.github.io',\n ref: undefined,\n}\n\n/** The public registry as its site serves it, with an archive per entry. */\nconst PUBLIC_REGISTRY = 'https://acrylblends.github.io/registry/'\n\n/** Where ACRYL app starters are opened. */\nexport const ACRYL_APP = 'https://acryl.dev'\n\n/** A registry id: dotted, lower case (`acryl.gtd`, `acrylblends.notes-desktop`, `login.thing`). */\nexport const REGISTRY_ID = /^[a-z0-9][a-z0-9-]*(\\.[a-z0-9][a-z0-9-]*)+$/\n\nexport interface RegistryEntry {\n readonly id: string\n readonly name: string\n readonly version: string\n /** The entry's folder inside the registry, `blends/<id>`. */\n readonly path: string\n /** `acrylblends` (an app this package makes) or `acryl` (an ACRYL app starter). An index written before the field existed has none: those entries are ACRYL's. */\n readonly runtime: 'acrylblends' | 'acryl'\n readonly description?: string\n /** Where a host publishes the entry on its own; a repository's index has none. */\n readonly archive?: EntryArchive\n}\n\n/** An entry published as one file: its path in the registry and the integrity of its bytes (`sha512-<base64>`). */\nexport interface EntryArchive {\n readonly path: string\n readonly integrity: string\n}\n\n/** A registry that can be read: what it offers, and one entry's files on request. */\nexport interface OpenRegistry {\n readonly entries: readonly RegistryEntry[]\n /** Put the entry's files into `dir` (which must not exist yet), held to a template's limits. Nothing of them is run. */\n takeEntry(entry: RegistryEntry, dir: string): Promise<void>\n}\n\n/** Where a registry's reading may keep what it downloads, and how it downloads. */\nexport interface RegistryReading {\n readonly scratch: string\n readonly fetchers: Fetchers\n}\n\n/** A host cannot give this entry, which is not a judgement on the entry: the public registry reads its repository instead. */\nclass EntryUnavailable extends SourceError {}\n\n/** The folder of an unpacked registry that holds `index.json`: the root, or its `registry/` folder (the public registry lives in its site's repository). */\n/** @param label - the registry as the person named it (a folder's path, `github:owner/repo`), for the one line when it has no index. */\nexport function registryRoot(unpacked: string, label = 'this registry'): string {\n for (const candidate of [unpacked, join(unpacked, 'registry')])\n if (existsSync(join(candidate, 'index.json'))) return candidate\n throw new SourceError(\n `${label} has no index.json (a registry is a folder with index.json and blends/<id>/, or index.json in its registry/ folder)`,\n )\n}\n\n/** An entry's archive as its index names it: both fields or neither, and a path that stays beside the entries. */\nfunction parseArchive(item: Record<string, unknown>): EntryArchive | undefined {\n if (item.archive === undefined && item.integrity === undefined) return undefined\n const { archive, integrity } = item\n if (\n typeof archive !== 'string' ||\n !/^blends\\/[^/\\\\]+\\.tgz$/.test(archive) ||\n archive.includes('..') ||\n typeof integrity !== 'string' ||\n !/^sha512-[A-Za-z0-9+/]+=*$/.test(integrity)\n )\n throw new SourceError(`registry entry ${String(item.id)} has no valid archive`)\n return { path: archive, integrity }\n}\n\n/** The entries of an `index.json`, from its text. */\nfunction parseIndex(text: string): RegistryEntry[] {\n let data: unknown\n try {\n data = JSON.parse(text)\n } catch {\n throw new SourceError('the registry index.json is not valid JSON')\n }\n const list = (data as { entries?: unknown }).entries\n if (!Array.isArray(list)) throw new SourceError('the registry index.json has no entries')\n const entries: RegistryEntry[] = []\n for (const item of list as Record<string, unknown>[]) {\n if (typeof item.id !== 'string' || typeof item.path !== 'string') continue\n if (!/^blends\\/[^/\\\\]+$/.test(item.path))\n throw new SourceError(`registry entry ${item.id} has no valid path`)\n const archive = parseArchive(item)\n entries.push({\n id: item.id,\n name: typeof item.name === 'string' ? item.name : item.id,\n version: typeof item.version === 'string' ? item.version : '0.0.0',\n path: item.path,\n runtime: item.runtime === 'acrylblends' ? 'acrylblends' : 'acryl',\n ...(typeof item.description === 'string' ? { description: item.description } : {}),\n ...(archive ? { archive } : {}),\n })\n }\n return entries\n}\n\n/** A registry in a folder, read in place: only the entry that is taken is copied. */\nfunction openFolder(unpacked: string, label: string, reading: RegistryReading): OpenRegistry {\n const root = registryRoot(unpacked, label)\n return {\n entries: parseIndex(readFileSync(join(root, 'index.json'), 'utf8')),\n takeEntry: (entry, dir) =>\n fetchTemplate(\n { kind: 'folder', path: join(root, entry.path) },\n dir,\n join(reading.scratch, 'download'),\n reading.fetchers,\n ),\n }\n}\n\n/** A registry that holds no archives, downloaded whole and then read as a folder. */\nasync function openUnpacked(\n source: Source,\n label: string,\n reading: RegistryReading,\n): Promise<OpenRegistry> {\n const unpacked = join(reading.scratch, 'registry')\n await fetchRegistry(source, unpacked, join(reading.scratch, 'download'), reading.fetchers)\n return openFolder(unpacked, label, reading)\n}\n\n/** A registry on a static host: its index, then only the archive of the entry that is taken. */\nasync function openHosted(base: string, reading: RegistryReading): Promise<OpenRegistry> {\n const index = await reading.fetchers.download(`${base}index.json`)\n return {\n entries: parseIndex(Buffer.from(index).toString('utf8')),\n async takeEntry(entry, dir) {\n if (entry.archive === undefined)\n throw new EntryUnavailable(`${base} publishes no archive for ${entry.id}`)\n const bytes = await downloadArchive(`${base}${entry.archive.path}`, entry.id, reading)\n const digest = createHash('sha512').update(bytes).digest('base64')\n if (`sha512-${digest}` !== entry.archive.integrity)\n throw new SourceError(`the archive of ${entry.id} does not match its integrity`)\n const download = join(reading.scratch, 'download')\n mkdirSync(download, { recursive: true })\n const path = join(download, 'entry.tgz')\n writeFileSync(path, bytes)\n await fetchTemplate({ kind: 'tarball', path }, dir, download, reading.fetchers)\n },\n }\n}\n\nasync function downloadArchive(\n url: string,\n id: string,\n reading: RegistryReading,\n): Promise<Uint8Array> {\n try {\n return await reading.fetchers.download(url)\n } catch (cause) {\n throw new EntryUnavailable(\n `could not download the archive of ${id}: ${cause instanceof Error ? cause.message : String(cause)}`,\n )\n }\n}\n\n/** Open a registry the person named, reading as little of it as it allows. */\nexport async function openRegistry(\n source: RegistrySource,\n label: string,\n reading: RegistryReading,\n): Promise<OpenRegistry> {\n if (source.kind === 'folder') return openFolder(source.path, source.path, reading)\n if (source.kind === 'hosted') return openHosted(source.base, reading)\n return openUnpacked(source, label, reading)\n}\n\n/**\n * Open the public registry: its site, or its repository when the site cannot answer. An entry the site cannot give is taken from the repository too. An archive that\n * came and does not match, or that breaks a template's limits, is refused: only a missing archive is a reason to look elsewhere.\n */\nexport async function openPublicRegistry(reading: RegistryReading): Promise<OpenRegistry> {\n let site: OpenRegistry\n try {\n site = await openHosted(PUBLIC_REGISTRY, reading)\n } catch {\n return openUnpacked(DEFAULT_REPOSITORY, DEFAULT_REGISTRY, reading)\n }\n return {\n entries: site.entries,\n async takeEntry(entry, dir) {\n try {\n await site.takeEntry(entry, dir)\n } catch (cause) {\n if (!(cause instanceof EntryUnavailable)) throw cause\n const repository = await openUnpacked(DEFAULT_REPOSITORY, DEFAULT_REGISTRY, reading)\n await repository.takeEntry(entry, dir)\n }\n },\n }\n}\n\n/** The entry for an id. An ACRYL app starter is refused in one line; an unknown id lists the starters this package can make. */\nexport function pickEntry(entries: readonly RegistryEntry[], id: string): RegistryEntry {\n const entry = entries.find((candidate) => candidate.id === id)\n if (!entry) {\n const mine = entries\n .filter((candidate) => candidate.runtime === 'acrylblends')\n .map((candidate) => candidate.id)\n throw new SourceError(\n `no starter \"${id}\" in this registry${mine.length > 0 ? `; starters for create-acrylblends: ${mine.join(', ')}` : ''}`,\n )\n }\n if (entry.runtime !== 'acrylblends')\n throw new SourceError(\n `${entry.id} is an ACRYL app starter: open it in the ACRYL app (${ACRYL_APP}). create-acrylblends makes acrylblends apps.`,\n )\n return entry\n}\n\n/**\n * Give a pulled starter to its new owner: the manifest names the app (`acrylblends.<name>`, private), because the registry's id and its public visibility belong to the starter,\n * not to the app made from it. Changes the `metadata` lines of `blend.yaml` (the id, the name, the visibility; the licence is dropped) and nothing else; a manifest it cannot read that way is left as it is.\n */\nexport function ownManifest(text: string, name: string): string {\n const lines = text.split('\\n')\n const start = lines.findIndex((line) => /^metadata:\\s*$/.test(line))\n if (start < 0) return text\n let end = start + 1\n while (end < lines.length && /^\\s+\\S|^\\s*$/.test(lines[end] ?? '')) end += 1\n const set = (key: string, value: string) => {\n for (let at = start + 1; at < end; at += 1) {\n const match = new RegExp(`^(\\\\s+)${key}:.*$`).exec(lines[at] ?? '')\n if (match) {\n lines[at] = `${match[1]}${key}: ${value}`\n return\n }\n }\n }\n set('id', `acrylblends.${name}`)\n set('name', name)\n set('visibility', 'private')\n // The starter's licence is the starter's: the new app names none until its owner chooses one.\n for (let at = end - 1; at > start; at -= 1)\n if (/^\\s+license:/.test(lines[at] ?? '')) lines.splice(at, 1)\n return lines.join('\\n')\n}\n\n/**\n * Keep a pulled starter's `blend.lock.json` true to the app made from it: the lock's origin names the manifest it was written from (its id and the digest of its text,\n * as blends-core's `manifestDigest`), and {@link ownManifest} has just changed both. The plugin folders are copied unchanged, so their digests stand. A lock it cannot\n * read is left as it is (`npm run snapshot capture` writes it again).\n */\nexport function ownLock(text: string, manifestText: string, name: string): string {\n let lock: unknown\n try {\n lock = JSON.parse(text)\n } catch {\n return text\n }\n const origin = (lock as { origin?: unknown } | null)?.origin\n if (origin === null || typeof origin !== 'object') return text\n const owned = {\n ...(lock as object),\n origin: {\n ...origin,\n id: `acrylblends.${name}`,\n digest: createHash('sha256').update(manifestText).digest('hex'),\n },\n }\n return `${JSON.stringify(owned, null, 2)}\\n`\n}\n\n/** A DSH profile name for an app, as the framework's scaffold writes it into `scripts/ide-host.mjs` (`acrylblends-<app>`). */\nexport function profileNameFor(appName: string): string {\n const slug = appName\n .toLowerCase()\n .replaceAll(/[^a-z0-9]+/gu, '-')\n .replaceAll(/^-+|-+$/gu, '')\n return `acrylblends-${slug === '' ? 'app' : slug}`\n}\n\n/**\n * The name the scaffold wrote into a starter where an app names itself: its manifest's one-word `metadata.name`, or else its `package.json` name, which\n * `init` set to the same name. A curated starter's manifest carries a display name (\"Productivity Hub\"), which the scaffold never wrote.\n */\nexport function starterName(\n manifestText: string,\n packageText: string | undefined,\n): string | undefined {\n const fromManifest = manifestName(manifestText)\n if (fromManifest !== undefined || packageText === undefined) return fromManifest\n let name: unknown\n try {\n name = (JSON.parse(packageText) as { name?: unknown }).name\n } catch {\n return undefined\n }\n return typeof name === 'string' && name !== '' ? name : undefined\n}\n\n/** The app's name as a starter's `blend.yaml` gives it (`metadata.name`), or undefined. */\nexport function manifestName(text: string): string | undefined {\n const lines = text.split('\\n')\n const start = lines.findIndex((line) => /^metadata:\\s*$/.test(line))\n if (start < 0) return undefined\n for (let at = start + 1; at < lines.length && /^\\s+\\S|^\\s*$/.test(lines[at] ?? ''); at += 1) {\n const match = /^\\s+name:\\s*[\"']?([^\"'#\\s]+)[\"']?\\s*(?:#.*)?$/.exec(lines[at] ?? '')\n if (match) return match[1]\n }\n return undefined\n}\n\n/**\n * Where the scaffold wrote an app's name (its `__APP_NAME__`): the headings and the `description:` line of the agents' instructions and skills,\n * the README's title, and the page's `APP_NAME` constant. A starter made from an app still says that app's name there; the app made from it says its own.\n */\nconst PROSE_FILES = ['AGENTS.md', 'CLAUDE.md', 'README.md']\n/** The lines of those files the scaffold put the name on. */\nconst NAMED_LINE = /^(?:#{1,6} |description: )/\nconst SKILL_SCOPES = ['.claude/skills', '.agents/skills']\nconst CODE_FILES = ['src/routes.ts', 'src/app.ts']\n\n/**\n * Give a starter's scaffold files the new app's name: `from` (the starter's `metadata.name`) becomes `to` where it stands as a whole name on a\n * heading or `description:` line of the agents' instructions, skills and README, and in the `APP_NAME` constant; the host script's DSH profile\n * follows. Nothing else is read for the name, so one that is also a common word (`notes`) never rewrites a route, a string or a sentence. Plugins and the lock stay as the starter\n * recorded them.\n * @returns the files it changed, relative to `dir`.\n */\nexport function renameApp(dir: string, from: string, to: string): string[] {\n if (from === to || !/^[A-Za-z0-9][\\w.-]*$/.test(from)) return []\n const escaped = from.replaceAll(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n const whole = new RegExp(`(?<![\\\\w-])${escaped}(?![\\\\w-])`, 'g')\n const prose = [...PROSE_FILES]\n for (const scope of SKILL_SCOPES) {\n const root = join(dir, scope)\n if (!existsSync(root)) continue\n for (const skill of readdirSync(root, { withFileTypes: true }))\n if (skill.isDirectory()) prose.push(`${scope}/${skill.name}/SKILL.md`)\n }\n const changed: string[] = []\n const rewrite = (file: string, edit: (text: string) => string) => {\n const path = join(dir, file)\n if (!existsSync(path)) return\n const text = readFileSync(path, 'utf8')\n const next = edit(text)\n if (next === text) return\n writeFileSync(path, next)\n changed.push(file)\n }\n for (const file of prose)\n rewrite(file, (text) =>\n text\n .split('\\n')\n .map((line) => (NAMED_LINE.test(line) ? line.replace(whole, to) : line))\n .join('\\n'),\n )\n const constant = new RegExp(`(\\\\bAPP_NAME = )(['\"])${escaped}\\\\2`, 'g')\n for (const file of CODE_FILES) rewrite(file, (text) => text.replace(constant, `$1$2${to}$2`))\n // npm's lock names the root package twice (top level and `packages[\"\"]`); a lock it cannot read is left as it is.\n rewrite('package-lock.json', (text) => {\n try {\n const lock = JSON.parse(text) as {\n name?: unknown\n packages?: Record<string, { name?: unknown }>\n }\n const root = lock.packages?.['']\n if (lock.name !== from && root?.name !== from) return text\n if (lock.name === from) lock.name = to\n if (root !== undefined && root.name === from) root.name = to\n return `${JSON.stringify(lock, null, 2)}\\n`\n } catch {\n return text\n }\n })\n const profile = profileNameFor(from)\n rewrite('scripts/ide-host.mjs', (text) =>\n text.replaceAll(`'${profile}'`, `'${profileNameFor(to)}'`),\n )\n return changed\n}\n","import { existsSync } from 'node:fs'\nimport { dirname, isAbsolute, join, win32 } from 'node:path'\n\nexport interface Invocation {\n file: string\n args: string[]\n}\n\n/**\n * How to start a package manager without the shell option (Node warns about passing args to a shell, DEP0190, and a `.cmd` shim cannot be spawned directly).\n * Off Windows the command runs as it is, and so does a program given by its path on Windows (Node, started with `process.execPath`). On Windows npm runs as `node npm-cli.js` (the one npm is running from, else the one beside `node`); any other\n * manager goes through `cmd.exe /d /s /c <name>.cmd`, whose arguments stay an array.\n */\nexport function packageManagerInvocation(\n command: string,\n args: readonly string[],\n platform: NodeJS.Platform = process.platform,\n env: NodeJS.ProcessEnv = process.env,\n exists: (path: string) => boolean = existsSync,\n execPath: string = process.execPath,\n): Invocation {\n if (platform !== 'win32') return { file: command, args: [...args] }\n // A program given by its path (Node itself, `process.execPath`) is not a package manager: it has no `.cmd` shim, and `node.exe.cmd` does not exist.\n if (isAbsolute(command) || win32.isAbsolute(command)) return { file: command, args: [...args] }\n if (command === 'npm') {\n const running = env.npm_execpath\n const cli =\n running !== undefined && /npm-cli\\.c?js$/.test(running)\n ? running\n : join(dirname(execPath), 'node_modules', 'npm', 'bin', 'npm-cli.js')\n if (exists(cli)) return { file: execPath, args: [cli, ...args] }\n }\n return { file: env.ComSpec ?? 'cmd.exe', args: ['/d', '/s', '/c', `${command}.cmd`, ...args] }\n}\n","import { spawn, spawnSync } from 'node:child_process'\nimport {\n copyFileSync,\n cpSync,\n existsSync,\n mkdirSync,\n mkdtempSync,\n readdirSync,\n readFileSync,\n writeFileSync,\n} from 'node:fs'\nimport { createRequire } from 'node:module'\nimport { tmpdir } from 'node:os'\nimport { basename, dirname, join, resolve } from 'node:path'\nimport { createInterface } from 'node:readline/promises'\nimport { fileURLToPath } from 'node:url'\nimport { parseArgs } from 'node:util'\nimport { findSecrets } from '@webboxes/app-persistence'\nimport { CLASS, CREATE, PACKAGE, TEMPLATE_MANIFEST } from './names'\nimport {\n openPublicRegistry,\n openRegistry,\n ownLock,\n ownManifest,\n pickEntry,\n REGISTRY_ID,\n type RegistryEntry,\n type RegistryReading,\n renameApp,\n starterName,\n} from './registry'\nimport {\n type Fetchers,\n fetchTemplate,\n LIFECYCLE,\n parseRegistrySource,\n parseSource,\n readManifest,\n realFetchers,\n removeTree,\n SOURCE_FORMS,\n SourceError,\n writeTemplate,\n} from './source'\nimport { packageManagerInvocation } from './spawn'\n\nexport { CLASS, CREATE, PACKAGE, TEMPLATE_MANIFEST }\n\n/**\n * The templates: the same list as acrylblends init (the framework package makes every one of them; create-acrylblends delegates). A test compares this list and its summaries with the\n * framework package's, so they cannot drift.\n */\nexport const TEMPLATES = ['blank', 'nodejs', 'notes', 'chat', 'todo', 'agent'] as const\nexport type Template = (typeof TEMPLATES)[number]\nexport const TEMPLATE_SUMMARY: Record<Template, string> = {\n blank: 'the router, a server and one route: the smallest app',\n nodejs: 'a web app with a page and a client component',\n notes: 'a multi-user notes app on the db port (sign-up, log-in, sessions)',\n chat: 'a chat app that streams an answer over server-sent events',\n todo: 'a to-do list on the router and state',\n agent: 'the blank app with an offline agent that builds plugins into the running app',\n}\n/** Names that were templates once and still work. */\nexport const TEMPLATE_ALIASES: Record<string, Template> = { 'acryl-app': 'agent' }\nconst TEMPLATE_LIST = TEMPLATES.map((name) => ` ${name.padEnd(7)} ${TEMPLATE_SUMMARY[name]}`).join(\n '\\n',\n)\nexport const PACKAGE_MANAGERS = ['npm', 'pnpm', 'yarn', 'bun'] as const\nexport type PackageManager = (typeof PACKAGE_MANAGERS)[number]\n\n/** The version of this package. */\nexport const VERSION: string = (\n createRequire(import.meta.url)('../package.json') as { version: string }\n).version\n\nexport const HELP = `${CREATE} ${VERSION} - create an ${CLASS} app\n\nUsage:\n npx acryl new [name] [starter] (the same through npm create ${PACKAGE}@latest [name] [starter])\n\n npx acryl new shop the Blank app in the ACRYL frame, installed and started\n npx acryl new shop notes the same from a starter (${TEMPLATES.join(', ')})\n\nThe app is made, installed and started with the chat, the panels and Settings; nothing is asked when a name is given. Next time: cd shop && npm run dev.\nTurn a step off:\n --no-start make and install it, do not start it\n --no-install make it only\n --bare the app without the frame\n\nA source makes the app from someone else's template (it is downloaded and unpacked, nothing in it runs unless --install):\n github:owner/repo[#ref] a GitHub repository, as a tarball (no clone)\n @scope/name[@version] an npm package (npm pack --ignore-scripts)\n ./template.tgz a packed template on disk\n ./folder a template folder on disk\nA template is a folder with an ${TEMPLATE_MANIFEST} (name, description, plugins).\n\nA starter from the registry is pulled by its id:\n --from <id | source> a registry id such as acrylblends.notes-desktop, or any of the sources above\n --registry <source> read the starters from this registry instead of the public one (github:owner/repo, an https:// address, or a folder)\nOnly starters made for ${CLASS} (runtime: ${PACKAGE}) are apps this command can make; an ACRYL app starter is refused with a line saying so.\n\nOther options:\n --template <name> the same as the word after the name (npm needs a -- before options when you use npm create)\n --install install a source's dependencies (the lifecycle scripts it will run are listed first); a template always installs\n --desktop the frame (already the default for a template and a registry starter); a starter from another source gets it only with this\n --bare no frame, for a registry starter too\n --pm <manager> ${PACKAGE_MANAGERS.join(', ')} (default: the one that ran this command, else npm)\n -y, --yes ask nothing, and use the name my-app when none is given\n -h, --help show this help\n\nTemplates (the same list as acrylblends init):\n${TEMPLATE_LIST}\n -v, --version show the version\n`\n\n/** A command line mistake. The command prints it with the help text and exits 2. */\nexport class UsageError extends Error {\n override name = 'UsageError'\n}\n\nexport interface Io {\n stdout: { write(text: string): unknown }\n stderr: { write(text: string): unknown }\n cwd: string\n env: Record<string, string | undefined>\n /** Ask one question; `undefined` when there is no terminal to ask on. */\n ask: ((question: string) => Promise<string>) | undefined\n /** Run a program, showing its output; resolves to the exit code. */\n run(command: string, args: string[], cwd: string): Promise<number>\n /** How a template source is fetched; the real network and npm by default. */\n fetchers?: Fetchers\n}\n\nexport function processIo(): Io {\n const interactive = Boolean(process.stdin.isTTY && process.stdout.isTTY)\n return {\n stdout: process.stdout,\n stderr: process.stderr,\n cwd: process.cwd(),\n env: process.env,\n ask: interactive\n ? async (question) => {\n const rl = createInterface({ input: process.stdin, output: process.stdout })\n try {\n return await rl.question(question)\n } finally {\n rl.close()\n }\n }\n : undefined,\n run: (command, args, cwd) =>\n new Promise((done) => {\n const invocation = packageManagerInvocation(command, args)\n const child = spawn(invocation.file, invocation.args, { cwd, stdio: 'inherit' })\n child.on('error', () => done(1))\n child.on('exit', (code) => done(code ?? 1))\n }),\n }\n}\n\nexport interface CreateOptions {\n directory: string | undefined\n template: Template | undefined\n install: boolean\n /**\n * Put the app inside the ACRYL frame, as `acrylblends init --desktop` does. On for a template and a registry blueprint, on for another source only with\n * `--desktop`, off with `--bare`.\n */\n desktop: boolean\n /** Start the app when it is created and installed (`<pm> run dev`), only when there is a terminal to show it in. Off with `--no-start`. */\n start: boolean\n pm: PackageManager | undefined\n yes: boolean\n /** `github:owner/repo[#ref]`, `@scope/name`, a packed `.tgz`, a folder, or a registry id: a template from outside this package. */\n source: string | undefined\n /** Where registry ids are read from; the public registry by default. */\n registry: string | undefined\n}\n\nexport function isTemplate(value: string): value is Template {\n return (TEMPLATES as readonly string[]).includes(value)\n}\n\n/** The template a name means: itself, or what an old name stands for. */\nexport function resolveTemplate(value: string): Template | undefined {\n return isTemplate(value) ? value : TEMPLATE_ALIASES[value]\n}\n\nexport function parseCreateOptions(argv: readonly string[]): CreateOptions {\n let parsed: ReturnType<typeof parse>\n try {\n parsed = parse(argv)\n } catch (error) {\n throw new UsageError((error as Error).message)\n }\n const { values, positionals } = parsed\n if (positionals.length > 2)\n throw new UsageError('takes a directory and at most one template source')\n // A bare name that is a built-in template means --template: `create my-app notes`. Only github:, @scope/ and .tgz are sources.\n const bare = positionals[1] !== undefined ? resolveTemplate(positionals[1]) : undefined\n if (positionals[1] !== undefined && values.template !== undefined)\n throw new UsageError('give a template (or a template source) or --template, not both')\n const named = values.template === undefined ? undefined : resolveTemplate(values.template)\n if (values.template !== undefined && named === undefined)\n throw new UsageError(`unknown template \"${values.template}\" (${TEMPLATES.join(', ')})`)\n if (values.pm !== undefined && !(PACKAGE_MANAGERS as readonly string[]).includes(values.pm))\n throw new UsageError(`unknown package manager \"${values.pm}\" (${PACKAGE_MANAGERS.join(', ')})`)\n const positionalSource = bare === undefined ? positionals[1] : undefined\n if (values.from !== undefined && positionals[1] !== undefined)\n throw new UsageError(\n 'give --from or a template (or a template source) after the directory, not both',\n )\n if (values.from !== undefined && values.template !== undefined)\n throw new UsageError('give --from or --template, not both')\n const source = values.from ?? positionalSource\n if (values.bare === true && values.desktop === true)\n throw new UsageError('give --bare or --desktop, not both')\n if (values['no-install'] === true && values.install === true)\n throw new UsageError('give --no-install or --install, not both')\n if (values.registry !== undefined && !(source !== undefined && REGISTRY_ID.test(source)))\n throw new UsageError('--registry goes with a registry id: --from <id> --registry <source>')\n return {\n directory: positionals[0],\n template: bare ?? named,\n // A template is the framework's own: it installs and opens in the frame unless told not to. A source is someone else's: nothing of it runs unless --install.\n install: values.install === true || (source === undefined && values['no-install'] !== true),\n // The frame (chat, agents, Settings) is the default for a template and for a blueprint from the registry, whose apps are made for it; a starter from\n // another source gets it when asked (--desktop), since it may not be built for it. --bare keeps either plain.\n desktop:\n values.bare !== true &&\n (values.desktop === true || source === undefined || REGISTRY_ID.test(source)),\n start: values['no-start'] !== true,\n pm: values.pm as PackageManager | undefined,\n yes: values.yes === true,\n source,\n registry: values.registry,\n }\n}\n\nconst parse = (argv: readonly string[]) =>\n parseArgs({\n args: [...argv],\n allowPositionals: true,\n strict: true,\n options: {\n template: { type: 'string' },\n from: { type: 'string' },\n registry: { type: 'string' },\n install: { type: 'boolean' },\n 'no-install': { type: 'boolean' },\n desktop: { type: 'boolean' },\n bare: { type: 'boolean' },\n 'no-start': { type: 'boolean' },\n pm: { type: 'string' },\n yes: { type: 'boolean', short: 'y' },\n },\n })\n\n/** A valid package name from a directory name: lower case letters, digits and dashes. */\nexport function nameFrom(directory: string): string {\n const name = basename(resolve(directory))\n .toLowerCase()\n .replace(/[^a-z0-9-]+/g, '-')\n .replace(/^[^a-z]+/, '')\n .replace(/-+$/g, '')\n return name === '' ? 'acryl-app' : name\n}\n\nfunction walkUp(from: string, test: (dir: string) => string | undefined): string {\n let dir = from\n for (;;) {\n const found = test(dir)\n if (found) return found\n const parent = dirname(dir)\n if (parent === dir) throw new Error(`${CREATE} cannot find its files`)\n dir = parent\n }\n}\nconst here = dirname(fileURLToPath(import.meta.url))\n/** The framework docs: the copy `prepack` puts in the package, or `docs/framework` of the repository. */\nconst docsRoot = () =>\n walkUp(here, (d) =>\n existsSync(join(d, 'docs', 'framework', 'README.md'))\n ? join(d, 'docs', 'framework')\n : undefined,\n )\n\n/**\n * The range a created app asks for: the framework version this package was released with, so a new app depends on the release that made it (and gets what that release's\n * commands can do), never an older one. A caret range, so it also takes the newer patch releases.\n */\nexport function frameworkRange(): string {\n const file = createRequire(import.meta.url).resolve(`${PACKAGE}/package.json`)\n return `^${(JSON.parse(readFileSync(file, 'utf8')) as { version: string }).version}`\n}\n\nexport function replacePlaceholders(text: string, name: string): string {\n return text\n .replaceAll('__APP_NAME__', name)\n .replaceAll('__PACKAGE__', PACKAGE)\n .replaceAll('__CLASS__', CLASS)\n .replaceAll('__RANGE__', frameworkRange())\n}\n\nfunction copyDocs(target: string): void {\n const filter = (path: string) => !/(upstream\\.json|UPSTREAM\\.md)$/.test(path)\n mkdirSync(join(target, 'docs'), { recursive: true })\n cpSync(docsRoot(), join(target, 'docs', 'framework'), { recursive: true, filter })\n}\n\nconst isEmpty = (directory: string) => !existsSync(directory) || readdirSync(directory).length === 0\n\n/** The `acrylblends` command of the installed framework package, which creates every template. */\nfunction acrylblendsBin(): string {\n const pkgFile = createRequire(import.meta.url).resolve(`${PACKAGE}/package.json`)\n const pkg = JSON.parse(readFileSync(pkgFile, 'utf8')) as { bin?: string | Record<string, string> }\n const bin = typeof pkg.bin === 'string' ? pkg.bin : pkg.bin?.[PACKAGE]\n if (!bin) throw new Error(`${PACKAGE} has no command to create an app with`)\n return join(dirname(pkgFile), bin)\n}\n\n/** The lifecycle scripts a template defines and the line that says when they run. */\nconst describeScripts = (scripts: Record<string, string>) =>\n Object.entries(scripts)\n .map(([key, value]) => ` ${key}: ${value}`)\n .join('\\n')\n\n/** Files whose text is checked for secrets: the template's own, not the framework docs copied in. */\nfunction textFiles(root: string): { path: string; text: string }[] {\n const found: { path: string; text: string }[] = []\n const walk = (dir: string, prefix: string) => {\n for (const entry of readdirSync(dir, { withFileTypes: true })) {\n if (\n entry.name === 'node_modules' ||\n entry.name === '.git' ||\n (prefix === '' && entry.name === 'docs')\n )\n continue\n if (entry.isDirectory()) walk(join(dir, entry.name), `${prefix}${entry.name}/`)\n else {\n const buffer = readFileSync(join(dir, entry.name))\n if (!buffer.subarray(0, 8000).includes(0))\n found.push({ path: `${prefix}${entry.name}`, text: buffer.toString('utf8') })\n }\n }\n }\n walk(root, '')\n return found\n}\n\n/**\n * A new app is a git repository from the start, as `acrylblends init` makes it: the frame's versions, Files and Changes work on it, and its first\n * version is the app as created. A folder that already is a repository, or a machine without git, is left alone.\n */\nexport function startRepository(directory: string): void {\n if (existsSync(join(directory, '.git'))) return\n const run = (args: string[]) =>\n spawnSync('git', args, { cwd: directory, stdio: 'ignore', windowsHide: true }).status === 0\n if (!run(['init', '-q'])) return\n if (!run(['add', '-A'])) return\n // A machine without a git identity still gets the first commit: this one is the scaffolder's, and later commits use the person's own identity.\n const identity = run(['config', 'user.email'])\n ? []\n : ['-c', 'user.name=acrylblends', '-c', 'user.email=scaffold@acrylblends.invalid']\n run([...identity, 'commit', '-q', '-m', 'Initial commit from acrylblends'])\n}\n\n/** An app with the extensions row (what plugin-share installs through) and no plugin-share row: a starter older than sharing. */\nexport function lacksPluginShare(directory: string): boolean {\n const file = join(directory, 'blend.yaml')\n if (!existsSync(file)) return false\n const names = [...readFileSync(file, 'utf8').matchAll(/^ *name: ?(\\S+)\\r?$/gmu)].map(\n (match) => match[1],\n )\n return names.includes('extensions') && !names.includes('plugin-share')\n}\n\n/** The registry `--registry` names. */\nfunction openNamedRegistry(name: string, cwd: string, reading: RegistryReading) {\n const source = parseRegistrySource(name, cwd)\n if (!source) throw new UsageError(`unknown registry \"${name}\" (${SOURCE_FORMS})`)\n return openRegistry(source, name, reading)\n}\n\n/**\n * Create an app from a template source (`github:`, `@scope/name`, a packed tarball). The source is fetched and unpacked into a scratch folder, checked\n * (manifest, secrets), and only then copied to the target; nothing in it is installed or run unless `--install`, which lists the scripts first.\n */\nasync function createFromSource(\n options: CreateOptions,\n target: string,\n directory: string,\n io: Io,\n): Promise<number> {\n if (!isEmpty(target)) {\n io.stderr.write(`error: ${target} is not empty; nothing was changed\\n`)\n return 1\n }\n const scratch = mkdtempSync(join(tmpdir(), 'create-acrylblends-'))\n try {\n const name = nameFrom(target)\n const fetchers = io.fetchers ?? realFetchers\n let entry: RegistryEntry | undefined\n if (REGISTRY_ID.test(options.source!)) {\n // A registry id: read the registry's index, pick the entry (only an app for this runtime), and take its folder as the template.\n const reading = { scratch, fetchers }\n const registry =\n options.registry === undefined\n ? await openPublicRegistry(reading)\n : await openNamedRegistry(options.registry, io.cwd, reading)\n entry = pickEntry(registry.entries, options.source!)\n await registry.takeEntry(entry, join(scratch, 'source'))\n } else {\n const source = parseSource(options.source!, io.cwd)\n if (!source)\n throw new UsageError(`unknown template source \"${options.source}\" (${SOURCE_FORMS})`)\n await fetchTemplate(source, join(scratch, 'source'), join(scratch, 'download'), fetchers)\n }\n const manifest = readManifest(join(scratch, 'source'))\n const staged = join(scratch, 'app')\n const { files, lifecycle } = writeTemplate(\n join(scratch, 'source'),\n staged,\n (text) => replacePlaceholders(text, name),\n frameworkRange(),\n name,\n )\n if (entry !== undefined && existsSync(join(staged, 'blend.yaml'))) {\n const starterText = readFileSync(join(staged, 'blend.yaml'), 'utf8')\n // The starter was an app with its own name in its page, its README and its agents' instructions: they now say this app's. The staged package.json\n // already carries the new name, so the starter's is read from the source.\n const sourcePackage = join(scratch, 'source', 'package.json')\n const starter = starterName(\n starterText,\n existsSync(sourcePackage) ? readFileSync(sourcePackage, 'utf8') : undefined,\n )\n if (starter !== undefined) renameApp(staged, starter, name)\n const manifestText = ownManifest(starterText, name)\n writeFileSync(join(staged, 'blend.yaml'), manifestText)\n if (existsSync(join(staged, 'blend.lock.json')))\n writeFileSync(\n join(staged, 'blend.lock.json'),\n ownLock(readFileSync(join(staged, 'blend.lock.json'), 'utf8'), manifestText, name),\n )\n }\n if (!existsSync(join(staged, 'AGENTS.md')))\n writeFileSync(\n join(staged, 'AGENTS.md'),\n `# ${name}\\n\\nAn ${CLASS} app made from the template \"${manifest.name}\": ${manifest.description}\\n\\nThe framework's API is in \\`docs/framework/\\` (start at \\`docs/framework/README.md\\`).\\n`,\n )\n if (!existsSync(join(staged, 'CLAUDE.md')))\n copyFileSync(join(staged, 'AGENTS.md'), join(staged, 'CLAUDE.md'))\n const found = findSecrets(textFiles(staged))\n if (found.length > 0) {\n io.stderr.write(\n `error: the template holds what looks like a secret, so nothing was created:\\n${found.map((f) => ` ${f.path}:${f.line} (${f.kind})`).join('\\n')}\\n`,\n )\n return 1\n }\n copyDocs(staged)\n cpSync(staged, target, { recursive: true })\n // In the frame: the framework's own commands do it, as for an app made before the frame. `add desktop` brings the window; `upgrade` brings the starter's\n // library plugins to this release (its data then lives under ~/.acryl) and writes the frame around the starter's own frame row. Before the first\n // commit, so the app's first version is the app as made.\n if (options.desktop) {\n const framework = (args: string[]) =>\n io.run(process.execPath, [acrylblendsBin(), ...args, '--dir', target], io.cwd)\n // A starter made before sharing has no plugin-share row, so pull, list and publish would be refused in the new app: it gets the plugin now, mounted.\n const share = lacksPluginShare(target) ? await framework(['add', 'plugin-share']) : 0\n if (\n (await framework(['add', 'desktop'])) !== 0 ||\n share !== 0 ||\n (await framework(['upgrade'])) !== 0\n ) {\n io.stderr.write(\n `error: ${directory} was made, but putting it in the ACRYL frame failed (see above); it runs on its own with ${'`npm start`'}\\n`,\n )\n startRepository(target)\n return 1\n }\n }\n startRepository(target)\n io.stdout.write(\n `created ${name} from ${entry ? `${entry.id} ${entry.version}` : manifest.name} (${manifest.description}) in ${target}: ${files.length} files, ${CLASS} docs in docs/framework\\n`,\n )\n if (manifest.plugins.length > 0)\n io.stdout.write(\n `it needs these plugins: ${manifest.plugins.join(', ')}; add them with: npx ${PACKAGE} add ${manifest.plugins.join(' ')}\\n`,\n )\n const pm: PackageManager =\n options.pm ??\n ((PACKAGE_MANAGERS as readonly string[]).find((m) =>\n (io.env.npm_config_user_agent ?? '').startsWith(`${m}/`),\n ) as PackageManager | undefined) ??\n 'npm'\n const hasScripts = Object.keys(lifecycle).length > 0\n if (options.install) {\n const pkg = JSON.parse(readFileSync(join(target, 'package.json'), 'utf8')) as {\n dependencies?: object\n devDependencies?: object\n }\n io.stdout.write(\n `running ${pm} install in ${directory}. This installs: ${[...Object.keys(pkg.dependencies ?? {}), ...Object.keys(pkg.devDependencies ?? {})].join(', ') || 'nothing'}` +\n `${hasScripts ? `\\nand runs the template's own lifecycle scripts:\\n${describeScripts(lifecycle)}` : ''}\\n` +\n `(the dependencies' install scripts run too unless your ${pm} is set to ignore them)\\n`,\n )\n if ((await io.run(pm, ['install'], target)) !== 0) {\n io.stderr.write(`error: ${pm} install failed; run it yourself in ${directory}\\n`)\n return 1\n }\n } else if (hasScripts) {\n io.stdout.write(\n `nothing was installed or run. The template defines ${LIFECYCLE.filter((k) => lifecycle[k]).join(', ')}, which ${pm} install would run:\\n${describeScripts(lifecycle)}\\nread them first, or pass --install to run them.\\n`,\n )\n }\n io.stdout.write(\n `\\nNext:\\n cd ${directory}\\n${options.install ? '' : ` ${pm} install\\n`}${\n options.desktop\n ? ` ${pm} run dev in the ACRYL frame, in the browser\\n ${pm} run desktop in the ACRYL frame, in its own window\\n ${pm} start the app on its own\\n`\n : ` ${existsSync(join(target, 'README.md')) ? 'see README.md or the package.json scripts' : 'see the package.json scripts'}\\n`\n }`,\n )\n return 0\n } catch (error) {\n if (error instanceof SourceError) {\n io.stderr.write(`error: ${error.message}\\nnothing was changed\\n`)\n return 1\n }\n throw error\n } finally {\n removeTree(scratch)\n }\n}\n\n/** Create the app. Returns the exit code: 0 done, 1 refused or failed, 2 a usage error. Never calls `process.exit`. */\nexport async function runCreate(argv: readonly string[], io: Io = processIo()): Promise<number> {\n try {\n if (argv.includes('-h') || argv.includes('--help')) {\n io.stdout.write(HELP)\n return 0\n }\n if (argv.includes('-v') || argv.includes('--version')) {\n io.stdout.write(`${VERSION}\\n`)\n return 0\n }\n const options = parseCreateOptions(argv)\n // A name on the command line means no questions at all; without one, the only question is the app's name.\n const askedName = options.directory === undefined && !options.yes && io.ask !== undefined\n const directory =\n options.directory ??\n (askedName\n ? (await io.ask!('What is your app called? (my-app): ')).trim() || 'my-app'\n : 'my-app')\n const target = resolve(io.cwd, directory)\n if (options.source !== undefined) return await createFromSource(options, target, directory, io)\n // The Blank app is what `acryl new my-app` makes; a starter is a word after the name.\n const template: Template = options.template ?? 'blank'\n if (!isEmpty(target)) {\n io.stderr.write(`error: ${target} is not empty; nothing was changed\\n`)\n return 1\n }\n const name = nameFrom(target)\n // Every template is a Cordis app, made by the framework package's own `init` (blend.yaml, plugins/, AGENTS.md, CLAUDE.md, the skill, the docs).\n const code = await io.run(\n process.execPath,\n [\n acrylblendsBin(),\n 'init',\n target,\n '--template',\n template,\n '--name',\n name,\n '--yes',\n '--no-next',\n // init frames the app by default: the plain app is asked for by name.\n ...(options.desktop ? ['--desktop'] : ['--bare']),\n ],\n io.cwd,\n )\n if (code !== 0) return 1\n const pm: PackageManager =\n options.pm ??\n ((PACKAGE_MANAGERS as readonly string[]).find((m) =>\n (io.env.npm_config_user_agent ?? '').startsWith(`${m}/`),\n ) as PackageManager | undefined) ??\n 'npm'\n if (options.install) {\n if ((await io.run(pm, ['install'], target)) !== 0) {\n io.stderr.write(`error: ${pm} install failed; run it yourself in ${directory}\\n`)\n return 1\n }\n }\n const start = `${pm} run dev`\n // The app opens by itself when it was made in the frame, installed, and there is a terminal to run it in (a script or CI never starts a server).\n if (options.start && options.desktop && options.install && io.ask !== undefined) {\n io.stdout.write(\n `\\n${name} is ready. Starting it (Ctrl+C stops it). Next time: cd ${directory} && ${start}\\n\\n`,\n )\n await io.run(pm, ['run', 'dev'], target)\n return 0\n }\n io.stdout.write(\n `\\nNext:\\n cd ${directory}\\n${options.install ? '' : ` ${pm} install\\n`} ${start}\\n`,\n )\n return 0\n } catch (error) {\n if (error instanceof UsageError) {\n io.stderr.write(`error: ${error.message}\\n\\n${HELP}`)\n return 2\n }\n io.stderr.write(`error: ${(error as Error).message}\\n`)\n return 1\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAIA,MAAa,UAAU;AACvB,MAAa,QAAQ;AACrB,MAAa,SAAS;;AAGtB,MAAa,oBAAoB;;;;;;;;AC2BjC,IAAa,cAAb,cAAiC,MAAM;CACrC,OAAgB;AAClB;AAEA,MAAa,eAAe;;AAU5B,MAAM,kBAA0B;CAAE,MAAM;CAAY,OAAO;CAAM,OAAO;AAAiB;;;;;AAMzF,MAAM,kBAA0B;CAAE,MAAM;CAAY,OAAO;CAAS,OAAO;AAAuB;;AAGlG,SAAgB,YAAY,MAAc,KAAiC;CACzE,MAAM,SAAS,wEAAwE,KAAK,IAAI;CAChG,IAAI,QAAQ,OAAO;EAAE,MAAM;EAAU,OAAO,OAAO;EAAK,MAAM,OAAO;EAAK,KAAK,OAAO;CAAG;CAEzF,MAAM,SACJ,6GAA6G,KAC3G,IACF;CACF,IAAI,QAAQ,OAAO;EAAE,MAAM;EAAU,OAAO,OAAO;EAAK,MAAM,OAAO;EAAK,KAAK,OAAO;CAAG;CACzF,IAAI,KAAK,WAAW,SAAS,GAAG,MAAM,IAAI,YAAY,IAAI,KAAK,iCAAiC;CAChG,IAAI,mEAAmE,KAAK,IAAI,GAC9E,OAAO;EAAE,MAAM;EAAO,MAAM;CAAK;CACnC,IAAI,KAAK,WAAW,GAAG,GAAG,MAAM,IAAI,YAAY,IAAI,KAAK,+BAA+B;CACxF,IAAI,mBAAmB,KAAK,IAAI,GAAG;EACjC,MAAM,OAAO,QAAQ,KAAK,IAAI;EAC9B,IAAI,CAAC,WAAW,IAAI,GAAG,MAAM,IAAI,YAAY,GAAG,KAAK,gBAAgB;EACrE,OAAO;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AAU,KAAK,KAAK,GAAG,YAAY,IAAI,MAAM,GACtF;EACA,OAAO;CACT,SAAS,OAAO;EACd,IAAI,iBAAiB,YAAY;GAC/B,GAAG,OAAO,MAAM,UAAU,MAAM,QAAQ,MAAM,MAAM;GACpD,OAAO;EACT;EACA,GAAG,OAAO,MAAM,UAAW,MAAgB,QAAQ,GAAG;EACtD,OAAO;CACT;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-acrylblends",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.4",
|
|
4
4
|
"description": "Create an Acryl app: npm create acrylblends@latest",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"scaffold"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"acrylblends": "^1.5.
|
|
39
|
+
"acrylblends": "^1.5.4",
|
|
40
40
|
"@webboxes/app-persistence": "0.1.1"
|
|
41
41
|
},
|
|
42
42
|
"publishConfig": {
|