create-acrylblends 1.0.2 → 1.0.3
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.js +8 -1
- package/dist/index.js.map +1 -1
- package/docs/framework/README.md +1 -0
- package/docs/framework/agents/index.md +1 -1
- package/docs/framework/guides/data.md +12 -0
- package/docs/framework/workshop/README.md +381 -0
- package/docs/framework/workshop/facilitator.md +107 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -27,7 +27,7 @@ const TEMPLATE_MANIFEST = "acryl.template.json";
|
|
|
27
27
|
var SourceError = class extends Error {
|
|
28
28
|
name = "SourceError";
|
|
29
29
|
};
|
|
30
|
-
const SOURCE_FORMS = `github:owner/repo[#ref], @scope/name[@version], a packed .tgz file, or a folder (./path)`;
|
|
30
|
+
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)`;
|
|
31
31
|
const LIMITS = {
|
|
32
32
|
files: 5e3,
|
|
33
33
|
bytes: 52428800
|
|
@@ -41,6 +41,13 @@ function parseSource(text, cwd) {
|
|
|
41
41
|
repo: github[2],
|
|
42
42
|
ref: github[3]
|
|
43
43
|
};
|
|
44
|
+
const pasted = /^https:\/\/github\.com\/([A-Za-z0-9_.-]+)\/([A-Za-z0-9_.-]+?)(?:\.git)?(?:\/tree\/([A-Za-z0-9_./-]+))?\/?$/.exec(text);
|
|
45
|
+
if (pasted) return {
|
|
46
|
+
kind: "github",
|
|
47
|
+
owner: pasted[1],
|
|
48
|
+
repo: pasted[2],
|
|
49
|
+
ref: pasted[3]
|
|
50
|
+
};
|
|
44
51
|
if (text.startsWith("github:")) throw new SourceError(`"${text}" is not github:owner/repo[#ref]`);
|
|
45
52
|
if (/^@[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._-]*(@[A-Za-z0-9._-]+)?$/.test(text)) return {
|
|
46
53
|
kind: "npm",
|
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/** 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], @scope/name[@version], a packed .tgz file, or a folder (./path)`\n\nconst LIMITS = { files: 5000, bytes: 50 * 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 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/** 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' })\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 that are too big. */\nfunction extract(tarball: string, dir: string): void {\n const list = spawnSync('tar', ['-tzf', tarball], {\n encoding: 'utf8',\n maxBuffer: 64 * 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 template 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)\n}\n\n/** Refuse a tree that holds a link, or is larger than the limits; the same check for an unpacked archive and a copied folder. */\nexport function checkTree(dir: string): 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 template 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 template has more than ${LIMITS.files} files`)\n if (bytes > LIMITS.bytes)\n throw new SourceError(`the template is larger than ${LIMITS.bytes / 1024 / 1024} MB`)\n}\n\n/** Download or pack a source and unpack it into `dir` (which must not exist yet). Nothing in it is run. */\nexport async function fetchSource(\n source: Source,\n dir: string,\n scratch: string,\n fetchers: Fetchers,\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)\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)\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])\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 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 */\nimport { existsSync, readFileSync } from 'node:fs'\nimport { join } from 'node:path'\nimport { SourceError } from './source'\n\n/** The public registry, read from its repository (the same files the site lists). */\nexport const DEFAULT_REGISTRY = 'github:acrylblends/acrylblends.github.io'\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}\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). */\nexport function registryRoot(unpacked: string): string {\n for (const candidate of [unpacked, join(unpacked, 'registry')])\n if (existsSync(join(candidate, 'index.json'))) return candidate\n throw new SourceError(\n 'this registry has no index.json (it is a folder with index.json and blends/<id>/)',\n )\n}\n\n/** Read the index of an unpacked registry. */\nexport function readRegistry(unpacked: string): { root: string; entries: RegistryEntry[] } {\n const root = registryRoot(unpacked)\n let data: unknown\n try {\n data = JSON.parse(readFileSync(join(root, 'index.json'), 'utf8'))\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 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 })\n }\n return { root, entries }\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","import { existsSync } from 'node:fs'\nimport { dirname, join } 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. 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 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 } 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 DEFAULT_REGISTRY,\n ownManifest,\n pickEntry,\n REGISTRY_ID,\n type RegistryEntry,\n readRegistry,\n} from './registry'\nimport {\n type Fetchers,\n fetchSource,\n LIFECYCLE,\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 npm create ${PACKAGE}@latest [directory] [template | source] [-- options]\n\nA source makes the app from someone else's template (it is downloaded and unpacked, nothing in it runs):\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 (npm needs the -- before the options):\n npm create ${PACKAGE}@latest my-app -- --from acrylblends.notes-desktop\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, 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\nOptions:\n --template <name> one of the templates below (asked when not given); a bare name after the directory means the same\n (npm create ${PACKAGE}@latest my-app notes). Every template is a Cordis app: blend.yaml, plugins/\n --install install the dependencies after creating the app (the lifecycle scripts it will run are listed first)\n --pm <manager> ${PACKAGE_MANAGERS.join(', ')} (default: the one that ran this command, else npm)\n -y, --yes ask nothing: template nodejs unless --template is given, directory ${PACKAGE}-app\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 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.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 install: values.install === 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 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 * 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 registrySource = parseSource(options.registry ?? DEFAULT_REGISTRY, io.cwd)\n if (!registrySource)\n throw new UsageError(`unknown registry \"${options.registry}\" (${SOURCE_FORMS})`)\n await fetchSource(\n registrySource,\n join(scratch, 'registry'),\n join(scratch, 'download'),\n fetchers,\n )\n const registry = readRegistry(join(scratch, 'registry'))\n entry = pickEntry(registry.entries, options.source!)\n await fetchSource(\n { kind: 'folder', path: join(registry.root, entry.path) },\n join(scratch, 'source'),\n join(scratch, 'download'),\n fetchers,\n )\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 fetchSource(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 writeFileSync(\n join(staged, 'blend.yaml'),\n ownManifest(readFileSync(join(staged, 'blend.yaml'), 'utf8'), name),\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 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`} see the template's README or package.json scripts\\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 const ask = options.yes ? undefined : io.ask\n const directory =\n options.directory ??\n (ask\n ? (await ask(`Project directory (${PACKAGE}-app): `)).trim() || `${PACKAGE}-app`\n : `${PACKAGE}-app`)\n const target = resolve(io.cwd, directory)\n if (options.source !== undefined) return await createFromSource(options, target, directory, io)\n const template: Template =\n options.template ??\n (ask\n ? await (async () => {\n const answer =\n (\n await ask(\n `Templates:\\n${TEMPLATE_LIST}\\nWhich template do you want to use? [nodejs]: `,\n )\n ).trim() || 'nodejs'\n const chosen = resolveTemplate(answer)\n if (chosen === undefined)\n throw new UsageError(`unknown template \"${answer}\" (${TEMPLATES.join(', ')})`)\n return chosen\n })()\n : 'nodejs')\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 ],\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 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 }\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AqC;GACtE,OAAO;EACT;EACA,MAAM,OAAO,SAAS,MAAM;EAiB5B,IAAI,MAfe,GAAG,IACpB,QAAQ,UACR;GACE,eAAe;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF,GACA,GAAG,GACL,MACa,GAAG,OAAO;EACvB,MAAM,KACJ,QAAQ,MACN,iBAAuC,MAAM,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;EACpB,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/** 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\nconst LIMITS = { files: 5000, bytes: 50 * 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/** 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' })\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 that are too big. */\nfunction extract(tarball: string, dir: string): void {\n const list = spawnSync('tar', ['-tzf', tarball], {\n encoding: 'utf8',\n maxBuffer: 64 * 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 template 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)\n}\n\n/** Refuse a tree that holds a link, or is larger than the limits; the same check for an unpacked archive and a copied folder. */\nexport function checkTree(dir: string): 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 template 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 template has more than ${LIMITS.files} files`)\n if (bytes > LIMITS.bytes)\n throw new SourceError(`the template is larger than ${LIMITS.bytes / 1024 / 1024} MB`)\n}\n\n/** Download or pack a source and unpack it into `dir` (which must not exist yet). Nothing in it is run. */\nexport async function fetchSource(\n source: Source,\n dir: string,\n scratch: string,\n fetchers: Fetchers,\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)\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)\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])\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 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 */\nimport { existsSync, readFileSync } from 'node:fs'\nimport { join } from 'node:path'\nimport { SourceError } from './source'\n\n/** The public registry, read from its repository (the same files the site lists). */\nexport const DEFAULT_REGISTRY = 'github:acrylblends/acrylblends.github.io'\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}\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). */\nexport function registryRoot(unpacked: string): string {\n for (const candidate of [unpacked, join(unpacked, 'registry')])\n if (existsSync(join(candidate, 'index.json'))) return candidate\n throw new SourceError(\n 'this registry has no index.json (it is a folder with index.json and blends/<id>/)',\n )\n}\n\n/** Read the index of an unpacked registry. */\nexport function readRegistry(unpacked: string): { root: string; entries: RegistryEntry[] } {\n const root = registryRoot(unpacked)\n let data: unknown\n try {\n data = JSON.parse(readFileSync(join(root, 'index.json'), 'utf8'))\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 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 })\n }\n return { root, entries }\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","import { existsSync } from 'node:fs'\nimport { dirname, join } 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. 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 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 } 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 DEFAULT_REGISTRY,\n ownManifest,\n pickEntry,\n REGISTRY_ID,\n type RegistryEntry,\n readRegistry,\n} from './registry'\nimport {\n type Fetchers,\n fetchSource,\n LIFECYCLE,\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 npm create ${PACKAGE}@latest [directory] [template | source] [-- options]\n\nA source makes the app from someone else's template (it is downloaded and unpacked, nothing in it runs):\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 (npm needs the -- before the options):\n npm create ${PACKAGE}@latest my-app -- --from acrylblends.notes-desktop\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, 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\nOptions:\n --template <name> one of the templates below (asked when not given); a bare name after the directory means the same\n (npm create ${PACKAGE}@latest my-app notes). Every template is a Cordis app: blend.yaml, plugins/\n --install install the dependencies after creating the app (the lifecycle scripts it will run are listed first)\n --pm <manager> ${PACKAGE_MANAGERS.join(', ')} (default: the one that ran this command, else npm)\n -y, --yes ask nothing: template nodejs unless --template is given, directory ${PACKAGE}-app\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 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.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 install: values.install === 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 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 * 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 registrySource = parseSource(options.registry ?? DEFAULT_REGISTRY, io.cwd)\n if (!registrySource)\n throw new UsageError(`unknown registry \"${options.registry}\" (${SOURCE_FORMS})`)\n await fetchSource(\n registrySource,\n join(scratch, 'registry'),\n join(scratch, 'download'),\n fetchers,\n )\n const registry = readRegistry(join(scratch, 'registry'))\n entry = pickEntry(registry.entries, options.source!)\n await fetchSource(\n { kind: 'folder', path: join(registry.root, entry.path) },\n join(scratch, 'source'),\n join(scratch, 'download'),\n fetchers,\n )\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 fetchSource(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 writeFileSync(\n join(staged, 'blend.yaml'),\n ownManifest(readFileSync(join(staged, 'blend.yaml'), 'utf8'), name),\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 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`} see the template's README or package.json scripts\\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 const ask = options.yes ? undefined : io.ask\n const directory =\n options.directory ??\n (ask\n ? (await ask(`Project directory (${PACKAGE}-app): `)).trim() || `${PACKAGE}-app`\n : `${PACKAGE}-app`)\n const target = resolve(io.cwd, directory)\n if (options.source !== undefined) return await createFromSource(options, target, directory, io)\n const template: Template =\n options.template ??\n (ask\n ? await (async () => {\n const answer =\n (\n await ask(\n `Templates:\\n${TEMPLATE_LIST}\\nWhich template do you want to use? [nodejs]: `,\n )\n ).trim() || 'nodejs'\n const chosen = resolveTemplate(answer)\n if (chosen === undefined)\n throw new UsageError(`unknown template \"${answer}\" (${TEMPLATES.join(', ')})`)\n return chosen\n })()\n : 'nodejs')\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 ],\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 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;;;;;;;;ACwBjC,IAAa,cAAb,cAAiC,MAAM;CACrC,OAAgB;AAClB;AAEA,MAAa,eAAe;AAE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5B,IAAI,MAfe,GAAG,IACpB,QAAQ,UACR;GACE,eAAe;GACf;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF,GACA,GAAG,GACL,MACa,GAAG,OAAO;EACvB,MAAM,KACJ,QAAQ,MACN,iBAAuC,MAAM,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;EACpB,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"}
|
package/docs/framework/README.md
CHANGED
|
@@ -54,6 +54,7 @@ They are enabled as they are built.
|
|
|
54
54
|
| Look up a call | [API](api/index.md), [Routing](api/routing.md), [Context](api/context.md), [Request](api/request.md), [API summary](api/summary.md) |
|
|
55
55
|
| Understand the design | [Concepts](concepts/motivation.md) |
|
|
56
56
|
| Copy a pattern | [Guides](guides/best-practices.md), [Validation](guides/validation.md), [Testing](guides/testing.md), [Data, migrations and choosing a store](guides/data.md), [Forms, sessions and a database](guides/forms-and-sessions.md), [Client components without a bundler](guides/client-modules.md), [Bring your own tool](guides/bring-your-own-tool.md) |
|
|
57
|
+
| Run the 90-minute workshop | [Workshop](workshop/README.md), and the room around it in [Facilitator notes](workshop/facilitator.md) |
|
|
57
58
|
| Use Acryl inside a Cordis app | [Acryl in a Cordis app](cordis/acryl-in-a-cordis-app.md), [Plugin lifecycle](cordis/plugin-lifecycle.md), [Mounting](cordis/mounting.md) |
|
|
58
59
|
| Move from the 0.3 router calls | [Migration from 0.3](cordis/migration-from-0-3.md) |
|
|
59
60
|
| Know what runs in production, and what the sandbox stops | [What runs in production](guides/production.md) |
|
|
@@ -47,7 +47,7 @@ npm run dev
|
|
|
47
47
|
```
|
|
48
48
|
|
|
49
49
|
- `add` puts the `agent-panel` row (and `driver-pty`'s after it) in `blend.yaml` before the `routes` row and registers both in `src/app.ts`. On an app without the `agent` and `extensions` rows, such as `blank`, it refuses before it copies anything and says which rows are missing.
|
|
50
|
-
- **The panel's coding agents are yours.** `claude`, `codex` and `pi` run on the machine that runs the app, in the app folder, with the login of the person who started it: `claude` and `codex` use their own signed-in sessions, and `pi` is offered when `DEEPSEEK_API_KEY` is set or `pi` has stored a DeepSeek login (`~/.pi/agent/auth.json`). A program that is not installed, or is not logged in, is not offered; nothing is shared between machines, and a workshop laptop needs its own login. The panel's own `agent` (the offline scripted one) needs none.
|
|
50
|
+
- **The panel's coding agents are yours.** `claude`, `codex` and `pi` run on the machine that runs the app, in the app folder, with the login of the person who started it: `claude` and `codex` use their own signed-in sessions, and `pi` is offered when `DEEPSEEK_API_KEY` is set or `pi` has stored a DeepSeek login (`~/.pi/agent/auth.json`, read from the `HOME` of the process that runs the app: an app started under another `HOME` does not see the login, and the panel then lists `pty:pi` but no chat `pi`). A program that is not installed, or is not logged in, is not offered; nothing is shared between machines, and a workshop laptop needs its own login. The panel's own `agent` (the offline scripted one) needs none.
|
|
51
51
|
- `pi` has to be an executable on the `PATH`; a shell function that wraps the binary is fine as long as the binary itself is found by `which pi`.
|
|
52
52
|
- `driver-pty` brings `node-pty`, which ships prebuilt binaries for macOS, Windows and Linux. npm 11 and pnpm warn that its install script was not run (they ask you to approve dependency install scripts); you can ignore the warning. If no `pty:` terminal is offered and the app prints why at start, approve and rebuild: `npm approve-scripts node-pty`, then `npm rebuild node-pty` (pnpm: `pnpm approve-builds`).
|
|
53
53
|
|
|
@@ -142,6 +142,18 @@ CREATE TABLE tags (
|
|
|
142
142
|
- A database whose version is newer than your files (an older build started on newer data) is refused. The app does not start.
|
|
143
143
|
- A migration is plain SQL. Put the data change next to the shape change in the same file when they belong together.
|
|
144
144
|
|
|
145
|
+
**In an app made by `acrylblends init`** (a Cordis app) the provider is a row of `blend.yaml` (and an entry in the `registry` of `src/app.ts`, which `acrylblends add db` prints how to write):
|
|
146
|
+
|
|
147
|
+
```yaml
|
|
148
|
+
- id: db
|
|
149
|
+
name: acryl-db-sqlite
|
|
150
|
+
config:
|
|
151
|
+
path: data/app.sqlite
|
|
152
|
+
migrations: migrations
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
A relative `path` or `migrations` in a row is read from the app's folder (the one that holds `blend.yaml`), not from where the command was started. (Since 1.0.3; before it a relative path stopped the app with "no file base URL", and an absolute path, or the `db: { migrations: join(projectRoot, 'migrations') }` option of `compose` in `src/app.ts` as the notes template does, was the way.)
|
|
156
|
+
|
|
145
157
|
To add a feature that needs a column or a table, the work is always the same three steps: write the next migration, change the store that
|
|
146
158
|
reads and writes it, and change the handlers and views that use the store.
|
|
147
159
|
|
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
# From nothing to your own app: the ACRYL Blends workshop
|
|
2
|
+
|
|
3
|
+
Ninety minutes, starting from an empty folder. **Acryl** is a small web framework built on Web Standards: a handler takes a `Request` and returns a
|
|
4
|
+
`Response`, exactly as in the browser. **ACRYL Blends** puts that framework inside an app you own: a folder whose `blend.yaml` lists its plugins, whose
|
|
5
|
+
`plugins/` folder holds their code, and which runs in a browser or in a desktop window. A coding agent can change the app while it runs. By the end you
|
|
6
|
+
will have built an app from the blank template, added a feature to it with an agent, opened it as a desktop window, upgraded it, and published it as a
|
|
7
|
+
starter other people can pull from the registry.
|
|
8
|
+
|
|
9
|
+
Every command below is copy-pasteable and was run on the published packages. Each step says how long it takes; the checkpoints tell you whether you
|
|
10
|
+
are on time.
|
|
11
|
+
|
|
12
|
+
## What you need (10 minutes)
|
|
13
|
+
|
|
14
|
+
| | macOS | Windows | Linux |
|
|
15
|
+
| --- | --- | --- | --- |
|
|
16
|
+
| Node.js 22.19 or newer (24 LTS or 26 tested) | `node -v` | `node -v` | `node -v` |
|
|
17
|
+
| npm, which comes with Node | `npm -v` | `npm -v` | `npm -v` |
|
|
18
|
+
| git | `git --version` | `git --version` | `git --version` |
|
|
19
|
+
| a coding agent, logged in | `codex login status` or `claude --version` | same | same |
|
|
20
|
+
| a GitHub account and the `gh` CLI, logged in | `gh auth status` | same | same |
|
|
21
|
+
|
|
22
|
+
Install what is missing: Node from <https://nodejs.org> (the LTS), git from <https://git-scm.com>, the GitHub CLI (`brew install gh`, `winget
|
|
23
|
+
install GitHub.cli`, or <https://cli.github.com>), and one agent with `npm i -g @openai/codex` (then `codex login` once) or Claude Code. Run
|
|
24
|
+
`gh auth login` once, in any repository: step 10 publishes your app with a pull request. No prior knowledge of ACRYL, Cordis or Blends is needed;
|
|
25
|
+
every new word is explained where it appears.
|
|
26
|
+
|
|
27
|
+
Make a folder and open a terminal in it:
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
mkdir ~/acryl-workshop && cd ~/acryl-workshop
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## The path
|
|
34
|
+
|
|
35
|
+
| Minutes | Step | What you get |
|
|
36
|
+
| --- | --- | --- |
|
|
37
|
+
| 0-10 | Before you start | tools installed and checked |
|
|
38
|
+
| 10-15 | 1. Create and run | a blank app answering in a browser |
|
|
39
|
+
| 15-22 | 2. Change one thing | a route of your own, live, without a restart |
|
|
40
|
+
| 22-30 | 3. Tests and the typecheck | the app proves itself |
|
|
41
|
+
| 30-38 | 4. Data: JSON, then SQLite *(optional)* | a counter kept in a file, then in SQL |
|
|
42
|
+
| 38-45 | 5. A desktop window | the same app as a window |
|
|
43
|
+
| 45-53 | 6. Pull a starter from the registry | someone else's app in your folder |
|
|
44
|
+
| 53-60 | 7. Create from a template | the six starters, one table, one run |
|
|
45
|
+
| 60-75 | 8. An agent builds a feature | your app changed by the agent, still running |
|
|
46
|
+
| 75-82 | 9. Upgrade | the app moved to the current framework |
|
|
47
|
+
| 82-90 | 10. Publish it | your app as a registry starter |
|
|
48
|
+
|
|
49
|
+
> **Checkpoint 15 minutes:** your app answers in a browser. Without that, read the "Stuck?" line of step 1.
|
|
50
|
+
> **Checkpoint 45 minutes:** your app is open in a desktop window. Behind? Step 4 is the optional one; skip it and carry on.
|
|
51
|
+
> **Checkpoint 75 minutes:** the agent's page is live. Still waiting? Give it five more minutes, then skip step 9.
|
|
52
|
+
|
|
53
|
+
## 1. Create and run (5 minutes)
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
npm create acrylblends@latest my-hero blank
|
|
57
|
+
cd my-hero
|
|
58
|
+
npm install
|
|
59
|
+
npm run dev
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
You should see:
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
created my-hero (blank) in /Users/you/acryl-workshop/my-hero: … files, plugins instance, acryl-router, acryl-node-server, manifest, save
|
|
66
|
+
|
|
67
|
+
Next:
|
|
68
|
+
cd my-hero
|
|
69
|
+
npm install
|
|
70
|
+
npm run dev
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
then, from `npm run dev`:
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
my-hero listening on http://127.0.0.1:3080 (data in /Users/you/acryl-workshop/my-hero/.acrylblends)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Open that address: `{"app":"my-hero","ok":true}`. `/health` answers `{"ok":true}` too. Leave the terminal running.
|
|
80
|
+
|
|
81
|
+
**Stuck?** A busy port gets the next free one: use the address the app printed. The first `npm create` downloads the initializer, so give it a few
|
|
82
|
+
seconds.
|
|
83
|
+
|
|
84
|
+
## 2. Change one thing (7 minutes)
|
|
85
|
+
|
|
86
|
+
Open `src/routes.ts`. It builds an `Acryl` app and mounts it on the router. Add one line to that chain, just above `.get('/health', …)`, and keep the
|
|
87
|
+
indentation of the lines around it:
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
.get('/hello', (c) => c.json({ hello: 'workshop' }))
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Save. The terminal prints `Change detected … Restarting 'src/main.ts'`, and `http://127.0.0.1:3080/hello` answers `{"hello":"workshop"}`. No restart
|
|
94
|
+
command, no build step: the app watches its own source.
|
|
95
|
+
|
|
96
|
+
**Stuck?** No message means the file is not where the app watches; the message names the path it saw. A red error names the file and line.
|
|
97
|
+
|
|
98
|
+
## 3. Tests and the typecheck (8 minutes)
|
|
99
|
+
|
|
100
|
+
Stop the server with `Ctrl-C`, then:
|
|
101
|
+
|
|
102
|
+
```sh
|
|
103
|
+
npm test
|
|
104
|
+
npm run check
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
`npm test` ends with `ℹ pass 5`, `ℹ fail 0`. `npm run check` prints nothing when the types are clean.
|
|
108
|
+
|
|
109
|
+
Now add a test for your route in `test/`: copy the style of the existing test file, request `/hello` and expect `{"hello":"workshop"}`. `npm test`
|
|
110
|
+
again; a failure names the file and line.
|
|
111
|
+
|
|
112
|
+
**Stuck?** `npm run check` complaining about your new line is the typechecker doing its job; the message says which type it expected.
|
|
113
|
+
|
|
114
|
+
## 4. Data: JSON, then SQLite (8 minutes, optional)
|
|
115
|
+
|
|
116
|
+
An app keeps data through a **port**: a small interface a plugin provides. The smallest is `kv`, a JSON file in the app's own folder.
|
|
117
|
+
|
|
118
|
+
```sh
|
|
119
|
+
npx acrylblends add acryl-kv-json
|
|
120
|
+
npm install
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
`add` copies the plugin into `plugins/` and prints how to mount it. Three edits:
|
|
124
|
+
|
|
125
|
+
1. `blend.yaml`, before `- id: server`: add the provider row (the row's id is yours to pick; the name is the plugin):
|
|
126
|
+
|
|
127
|
+
```yaml
|
|
128
|
+
- id: kv
|
|
129
|
+
name: acryl-kv-json
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
2. `src/app.ts`: import the plugin and register it under that name:
|
|
133
|
+
|
|
134
|
+
```ts
|
|
135
|
+
import * as kvJson from '../plugins/acryl-kv-json/src/index.ts'
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
```ts
|
|
139
|
+
export const registry = { 'acryl-router': router, 'acryl-node-server': nodeServer, 'acryl-kv-json': kvJson, routes }
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
3. `src/routes.ts`: declare the port and count visits in your route:
|
|
143
|
+
|
|
144
|
+
```ts
|
|
145
|
+
import type {} from '../plugins/acryl-kv/src/cordis.ts'
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
```ts
|
|
149
|
+
inject: ['router', 'kv'],
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
```ts
|
|
153
|
+
.get('/hello', async (c) => {
|
|
154
|
+
const visits = await ctx.kv.update('visits', (n) => (n ?? 0) + 1)
|
|
155
|
+
return c.json({ hello: 'workshop', visits })
|
|
156
|
+
})
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
`npm run dev` again and open `/hello` twice: `visits` goes 1, 2. The file is `my-hero/.acrylblends/kv.json`.
|
|
160
|
+
|
|
161
|
+
The relational port is `db`, with numbered SQL migrations:
|
|
162
|
+
|
|
163
|
+
```sh
|
|
164
|
+
npx acrylblends add acryl-db-sqlite
|
|
165
|
+
mkdir migrations
|
|
166
|
+
printf 'CREATE TABLE visits (id INTEGER PRIMARY KEY, at TEXT NOT NULL);\n' > migrations/001-visits.sql
|
|
167
|
+
npm install
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
A row in `blend.yaml` (`- id: db`, `name: acryl-db-sqlite`), then the migration folder in `src/app.ts`, where the app is composed: the path is set
|
|
171
|
+
there, not in the manifest, because a relative path in the manifest has no folder to resolve against.
|
|
172
|
+
|
|
173
|
+
```ts
|
|
174
|
+
import * as dbSqlite from '../plugins/acryl-db-sqlite/src/index.ts'
|
|
175
|
+
// in the registry: 'acryl-db-sqlite': dbSqlite
|
|
176
|
+
const projectRoot = fileURLToPath(new URL('..', import.meta.url))
|
|
177
|
+
// in the compose options next to server:
|
|
178
|
+
db: { migrations: join(projectRoot, 'migrations') },
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Then `inject: ['router', 'kv', 'db']` with `import type {} from '../plugins/acryl-db/src/cordis.ts'`, and in the route
|
|
182
|
+
`await ctx.db.run('INSERT INTO visits (at) VALUES (?)', new Date().toISOString())` before the reply. The database is `my-hero/.acrylblends/data.sqlite`,
|
|
183
|
+
and the migrations run at start, in order.
|
|
184
|
+
|
|
185
|
+
**Stuck?** `migrations "migrations" is relative, but this app has no file base URL` means the folder was named in `blend.yaml`; move it into
|
|
186
|
+
`src/app.ts` as above. "no such table" means the file is not in `migrations/` at the app root.
|
|
187
|
+
|
|
188
|
+
## 5. A desktop window (7 minutes)
|
|
189
|
+
|
|
190
|
+
```sh
|
|
191
|
+
npx acrylblends add desktop
|
|
192
|
+
npm install
|
|
193
|
+
npm run desktop
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
A window opens, showing the same routes and the same data. The app's own code never imports Electron; every Electron call lives in `plugins/desktop`,
|
|
197
|
+
and the window's browser data stays inside `my-hero/.acrylblends/electron`. Close the window when you are done (`Cmd-Q`, `Alt-F4`).
|
|
198
|
+
|
|
199
|
+
**Stuck?** The first `npm run desktop` downloads Electron (about 200 MB). No display (a bare server)? Skip this step; nothing later needs it.
|
|
200
|
+
|
|
201
|
+
## 6. Pull a starter from the registry (8 minutes)
|
|
202
|
+
|
|
203
|
+
The registry is where people publish starters: <https://acrylblends.github.io/blends> (the starters written for this framework say
|
|
204
|
+
`runtime: acrylblends`; older ACRYL app starters are refused with a line saying so). Pull one by id, straight into a new folder:
|
|
205
|
+
|
|
206
|
+
```sh
|
|
207
|
+
cd ~/acryl-workshop
|
|
208
|
+
npm create acrylblends@latest from-the-registry -- --from <starter-id>
|
|
209
|
+
cd from-the-registry
|
|
210
|
+
npm install
|
|
211
|
+
npm run dev
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
The same command takes a git repository or a folder: `--from github:you/starter` or `--from ../a-template`. You get a complete app someone else
|
|
215
|
+
published, with its plugins, its dependencies and its `blend.yaml`, in your folder and yours to change. Nothing is installed for you: the starter's
|
|
216
|
+
`Next:` block asks for the same `npm install` as step 1.
|
|
217
|
+
|
|
218
|
+
For the workshop's own registry, name it:
|
|
219
|
+
|
|
220
|
+
```sh
|
|
221
|
+
npm create acrylblends@latest from-the-workshop -- --from <id> --registry github:acryldev/workshop-2026-11-20
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
Starters for this workshop: `acrylblends.notes-desktop` (notes with a desktop window), `acrylblends.chat`, `acrylblends.agent`.
|
|
225
|
+
|
|
226
|
+
**Stuck?** The `--` before `--from` is npm's, not ours: without it npm swallows the flag. A refused id prints its reason first (`error: acryl.gtd is an
|
|
227
|
+
ACRYL app starter: open it in the ACRYL app`) and then npm's own error block; read the first lines, not the last.
|
|
228
|
+
|
|
229
|
+
## 7. Create from a template (7 minutes)
|
|
230
|
+
|
|
231
|
+
Every app begins from one of six templates, the same list in `npm create acrylblends` and `acrylblends init`:
|
|
232
|
+
|
|
233
|
+
| Template | What you get |
|
|
234
|
+
| --- | --- |
|
|
235
|
+
| `blank` | the router, the server and one route: what you just built |
|
|
236
|
+
| `nodejs` | a page rendered with JSX and a client component, without a bundler |
|
|
237
|
+
| `notes` | a multi-user notes app on the `db` port: sign-up, sessions, migrations, search, a typed client |
|
|
238
|
+
| `chat` | an answer streamed over server-sent events from an OpenAI-compatible API, history in SQLite |
|
|
239
|
+
| `todo` | a to-do list on the router and live state |
|
|
240
|
+
| `agent` | the blank app with an offline agent that writes and installs plugins into the running app |
|
|
241
|
+
|
|
242
|
+
Try the one with a database and accounts, in a window:
|
|
243
|
+
|
|
244
|
+
```sh
|
|
245
|
+
cd ~/acryl-workshop
|
|
246
|
+
npm create acrylblends@latest notes-app notes
|
|
247
|
+
cd notes-app && npm install
|
|
248
|
+
npx acrylblends add desktop && npm install && npm run desktop
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
Sign up, add a note, close the window; run `npm run dev` and the note is still there, because it lives in `notes-app/.acrylblends/data.sqlite`.
|
|
252
|
+
|
|
253
|
+
**Stuck?** The sign-in page is at `/login`; the root redirects there. Delete the folder when you are done with it.
|
|
254
|
+
|
|
255
|
+
## 8. An agent builds a feature (15 minutes)
|
|
256
|
+
|
|
257
|
+
The agent panel turns a coding agent you already use into a chat in the corner of the page. It needs the plugins the `agent` template ships (its model,
|
|
258
|
+
tools and memory), so this step builds a second, small app from that template; it is the app you publish in step 10.
|
|
259
|
+
|
|
260
|
+
```sh
|
|
261
|
+
cd ~/acryl-workshop
|
|
262
|
+
npm create acrylblends@latest agent-app agent
|
|
263
|
+
cd agent-app
|
|
264
|
+
npm install
|
|
265
|
+
npx acrylblends add agent-panel driver-pty
|
|
266
|
+
npx acrylblends add desktop
|
|
267
|
+
npm install
|
|
268
|
+
npm run dev
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
`add agent-panel` adds the plugin rows the panel needs and registers it for you, and prints what it changed. (On a `blank` app it refuses and says
|
|
272
|
+
which rows are missing: that is why this step uses the `agent` template.) Open the page, click the panel button in the corner, pick `codex` (or
|
|
273
|
+
`claude`, or `pi` when pi has its DeepSeek login in your home folder), and ask:
|
|
274
|
+
|
|
275
|
+
> Add a page at /board that lists the app's tasks, newest first, and a test for it.
|
|
276
|
+
|
|
277
|
+
The agent reads `AGENTS.md`, reads `docs/framework` (which is in your app), edits your files, runs your tests, and the app reloads itself. It takes a
|
|
278
|
+
few minutes; the panel shows each step, and has a stop button. Open `/board` when it is done.
|
|
279
|
+
|
|
280
|
+
A terminal agent works too: choose `pty:codex` (or `pty:claude`, `pty:pi`) for its normal interactive session inside the app folder, where it can use
|
|
281
|
+
the door (`.acryl/bin/acryl`) to look at the page it built.
|
|
282
|
+
|
|
283
|
+
**Stuck?** The panel uses your own agent account: `codex login` (or `claude`) in a terminal first. If `npm install` warns that npm blocked
|
|
284
|
+
`node-pty`'s install script, ignore it: prebuilt binaries ship. Only if the panel lists no `pty:` terminal, run `npm approve-scripts node-pty` and
|
|
285
|
+
`npm rebuild node-pty` (the `add` output says the same).
|
|
286
|
+
|
|
287
|
+
## 9. Upgrade (7 minutes)
|
|
288
|
+
|
|
289
|
+
Your app carries its framework plugins as source, so a new release moves them in place and leaves your code alone. Run the tool by its full name:
|
|
290
|
+
**`npx acrylblends@latest`**, because an app's own copy of `acrylblends` shadows the bare command and an older copy has no `upgrade` at all.
|
|
291
|
+
|
|
292
|
+
```sh
|
|
293
|
+
cd ~/acryl-workshop/my-hero
|
|
294
|
+
npx acrylblends@latest upgrade --dry-run
|
|
295
|
+
npx acrylblends@latest upgrade
|
|
296
|
+
npm install && npm test
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
The dry run lists what would be replaced; the real run replaces untouched files and stops with a diff if you edited one (move your change into a plugin
|
|
300
|
+
of your own, or use `--force`, which backs the edited copies up first). An app made by this version is already current, so both commands answer
|
|
301
|
+
`everything is up to date`: that is the mechanism working, and an app made by an earlier release lists what it would move. Your tests still pass
|
|
302
|
+
afterwards.
|
|
303
|
+
|
|
304
|
+
## 10. Publish it, and the hero moment (8 minutes)
|
|
305
|
+
|
|
306
|
+
The app you publish is `agent-app`, the one the agent changed in step 8 (keep `my-hero` too: it is yours, saved the same way). It is already a
|
|
307
|
+
**starter**: `blend.yaml` names it, lists its rows, and `plugins/` holds its code. Two parts make it public: your own copy, then the registry.
|
|
308
|
+
|
|
309
|
+
**Your own copy first.** `npm run save` commits the app and pushes it to its remote (it refuses a file that looks like a secret, and refuses to push a
|
|
310
|
+
private app to a public remote). Create an empty repository on your git host, set it as `origin`, run `npm run save`.
|
|
311
|
+
|
|
312
|
+
**The registry.** Publishing is a pull request to the workshop registry, `github.com/acryldev/workshop-2026-11-20`, and it is four commands.
|
|
313
|
+
|
|
314
|
+
1. Fork and clone it, then let its script build the entry from your app:
|
|
315
|
+
|
|
316
|
+
```sh
|
|
317
|
+
cd ~/acryl-workshop
|
|
318
|
+
gh repo fork acryldev/workshop-2026-11-20 --clone
|
|
319
|
+
cd workshop-2026-11-20
|
|
320
|
+
node scripts/make-entry.mjs ../agent-app <your-github-login>.agent-app --description "the app I built in the workshop"
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
`make-entry` copies the app into `blends/<your-github-login>.agent-app/` without `node_modules`, `.git` or the app's data, marks its `blend.yaml`
|
|
324
|
+
public and licensed under that id, and writes the `acryl.template.json` that makes it pullable. The entry is the whole app: its dependencies come with
|
|
325
|
+
it, so whoever pulls it gets the desktop shell without adding it again. The id is lowercase, `<login>.<name>` with letters, digits and dashes.
|
|
326
|
+
|
|
327
|
+
2. Commit, push and open the pull request:
|
|
328
|
+
|
|
329
|
+
```sh
|
|
330
|
+
git add blends && git commit -m "add <your-github-login>.agent-app"
|
|
331
|
+
git push
|
|
332
|
+
gh pr create --fill --repo acryldev/workshop-2026-11-20
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
3. A check runs on the pull request, and when it passes the pull request is merged: your starter is listed, usually well under two minutes. If it
|
|
336
|
+
refuses, it comments what to change; fix, commit, push again and it re-checks. To take an app down, open a pull request that removes the folder:
|
|
337
|
+
`git rm -r blends/<your-github-login>.agent-app`.
|
|
338
|
+
|
|
339
|
+
Anyone can then start from it, in the browser or in a window:
|
|
340
|
+
|
|
341
|
+
```sh
|
|
342
|
+
npm create acrylblends@latest my-app -- --from <your-github-login>.agent-app --registry github:acryldev/workshop-2026-11-20
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
**Stuck?** The check's comment is the answer: read it, fix, push again. An id with a capital or a dot inside a part is refused by `make-entry`; use
|
|
346
|
+
lowercase `<login>.<name>`. `gh: not found` means the GitHub CLI is not installed, and `gh auth status` saying not logged in means `gh auth login`.
|
|
347
|
+
|
|
348
|
+
> **The hero moment.** An app you created, with a page an agent wrote for it, running as a desktop window, saved in your own repository, and published
|
|
349
|
+
> as a starter in the registry so the next person can pull it with one command. Along the way you built a second app from blank, a route, a test, a JSON
|
|
350
|
+
> store and a SQLite database. Note what you did not write: the router, the server, the JSON file, the SQLite migrations, the window, the page.
|
|
351
|
+
|
|
352
|
+
## Where next
|
|
353
|
+
|
|
354
|
+
- **Read the docs you already have**: every app carries `docs/framework`, the same pages as <https://acrylblends.github.io/docs>. Start with
|
|
355
|
+
`cordis/acryl-in-a-cordis-app.md`, then `guides/data.md`, then `guides/production.md` (what runs in production, and what does not).
|
|
356
|
+
- **Swap a provider by editing one row**: SQLite to Postgres (`npx acrylblends add acryl-db-postgres`), the browser to a window (`desktop`), one agent
|
|
357
|
+
to another (the panel's driver list).
|
|
358
|
+
- **Teach your agent**: `AGENTS.md` in your app is what it reads first; add your team's conventions there and the next run follows them.
|
|
359
|
+
- **Bring your own tool**: <https://acrylblends.github.io/docs/guides/bring-your-own-tool> wraps an outside library as a provider of a port.
|
|
360
|
+
|
|
361
|
+
## Browser only (WebBoxes.ai) TODO(M9)
|
|
362
|
+
|
|
363
|
+
No local install? The same app, and the same agent, will run as a hosted workspace: open it in a browser, pick a starter, and work in the same three
|
|
364
|
+
folders. Nothing to install, nothing to keep on your machine.
|
|
365
|
+
|
|
366
|
+
The hosted workspace is milestone M9 and is due before the workshop, so this section is a stub until it is live: write the address, the sign-in it
|
|
367
|
+
needs, and the two or three clicks that replace steps 1-2 here, then let the local steps stand for anyone who wants the app on their own disk.
|
|
368
|
+
|
|
369
|
+
---
|
|
370
|
+
|
|
371
|
+
## If something goes wrong
|
|
372
|
+
|
|
373
|
+
| Symptom | Do |
|
|
374
|
+
| --- | --- |
|
|
375
|
+
| `npm create` fails or hangs | check the network; the facilitator has prepared apps |
|
|
376
|
+
| A port is taken | use the address the app printed |
|
|
377
|
+
| The agent cannot log in | `codex login` / `claude` in a terminal, then retry in the panel |
|
|
378
|
+
| You want to start over | delete your app folder and repeat step 1; nothing lives outside it |
|
|
379
|
+
| Anything else | the **Stuck?** line of the step, then your facilitator |
|
|
380
|
+
|
|
381
|
+
Behind at a checkpoint? Skip step 4 (data) first, then the second app in step 7. Steps 1-3, 5, 8-10 are the spine.
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# Facilitator notes: the 90-minute ACRYL Blends workshop
|
|
2
|
+
|
|
3
|
+
Read the attendee handout first (`docs/framework/workshop/README.md`); this page is the room around it: what to put on each machine, what actually breaks, and
|
|
4
|
+
where to cut when the clock runs. Every timing and every failure below was measured on the published `acrylblends` 1.0.0 during the readiness walk
|
|
5
|
+
(`docs/plans/workshop-readiness.md`).
|
|
6
|
+
|
|
7
|
+
## Before the room: put this on every machine
|
|
8
|
+
|
|
9
|
+
| What | Why | How |
|
|
10
|
+
| --- | --- | --- |
|
|
11
|
+
| Node.js 22.19 or newer (24 LTS or 26 tested), npm 11 | the app runs TypeScript directly, no build step | `node -v`; if missing, the LTS from nodejs.org or `brew install node` (Node 26 today, which is tested) |
|
|
12
|
+
| git | the registry block clones the registry | `git --version` |
|
|
13
|
+
| A warm npm cache | the first `npm create` downloads the initializer, `npm install` downloads Electron | create one app and add the desktop shell once per machine (below) |
|
|
14
|
+
| A coding agent, logged in | step 7 drives Codex or Claude Code through the panel | `codex login status` or run `claude` once |
|
|
15
|
+
| `~/acryl-workshop/prepared/` | the no-network fallback and the reset | copy the two prepared apps (below) |
|
|
16
|
+
| A GitHub account with `gh auth login` | step 10 forks the workshop registry and opens a pull request | `gh auth status` |
|
|
17
|
+
| A device with `git` and a text editor | the edits in steps 2, 4 and 8 are small but real | `git --version` |
|
|
18
|
+
|
|
19
|
+
Warm-up, once per machine (this is also the exact smoke test that the room works):
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
mkdir -p ~/acryl-workshop && cd ~/acryl-workshop
|
|
23
|
+
npm create acrylblends@latest warmup notes
|
|
24
|
+
cd warmup && npm install && npm test
|
|
25
|
+
npx acrylblends add desktop && npm install
|
|
26
|
+
cd ~/acryl-workshop && cp -R warmup prepared-notes && rm -rf warmup
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
That leaves `prepared-notes` with everything installed, including Electron.
|
|
30
|
+
|
|
31
|
+
## Timings, checkpoints, and what to make optional
|
|
32
|
+
|
|
33
|
+
The handout's own timings, as measured on the published 1.0.2 (macOS, cold npm cache in a throwaway home):
|
|
34
|
+
|
|
35
|
+
| Minutes | Step | Measured | If late |
|
|
36
|
+
| --- | --- | --- | --- |
|
|
37
|
+
| 0-10 | installs and checks | seconds each | never cut |
|
|
38
|
+
| 10-15 | create and run the blank app | create 9 s cold (2 s warm), install 2 s, boot 2 s | never cut |
|
|
39
|
+
| 15-22 | change one route | reload is instant | never cut |
|
|
40
|
+
| 22-30 | tests and the typecheck | test 0.5-2 s, check 2.5-4 s | keep; cut the "write a test" exercise |
|
|
41
|
+
| 30-38 | data: JSON then SQLite (**optional**) | two adds plus edits, ~8 min | **cut first** |
|
|
42
|
+
| 38-45 | the desktop window | add 2 s, install 3 s, first Electron boot ~20 s | pre-warm Electron on every machine or demo it |
|
|
43
|
+
| 45-53 | pull a starter | create 4 s, install 3 s, runs at once | keep; it is the fastest win in the room |
|
|
44
|
+
| 53-60 | create from a template | create + install + add desktop 4 s | drop the second app |
|
|
45
|
+
| 60-75 | the agent builds a feature | set-up 4 s; codex wrote a page and tests in about 7 minutes | never cut; demo it if the room is behind |
|
|
46
|
+
| 75-82 | upgrade | seconds: a fresh app answers "everything is up to date" | keep; it is a 2-minute talk |
|
|
47
|
+
| 82-90 | publish and the hero moment | the registry steps are seconds; the PR is talk | always keep at least the hero talk |
|
|
48
|
+
|
|
49
|
+
Checkpoints in the handout, and what to look for as you walk the room: **15 minutes** every screen shows `{"app":"my-hero","ok":true}`; **45 minutes**
|
|
50
|
+
every screen has the app in a desktop window; **75 minutes** every screen has `/board` open with the agent's page. A machine behind at a checkpoint is
|
|
51
|
+
what the optional column is for, and the handout names the same choices so nobody has to guess.
|
|
52
|
+
|
|
53
|
+
## What breaks in the room, and what to say
|
|
54
|
+
|
|
55
|
+
These are the defects found by the walk. They are known; say so rather than letting people think they broke something.
|
|
56
|
+
|
|
57
|
+
- **The data step is the slow one.** Wiring `kv` then `db` by hand is about ten minutes of edits for a newcomer (two rows, two registry lines, two
|
|
58
|
+
type imports, the migrations folder). It is the block the handout names optional, and the one to help with first.
|
|
59
|
+
- **A relative migrations path in `blend.yaml` fails.** `migrations: migrations` in the row stops the app with "this app has no file base URL to
|
|
60
|
+
resolve it from". The folder is named in `src/app.ts`'s compose options instead; the handout teaches that form and the stuck line names the error.
|
|
61
|
+
- **`pi` shows up only when the app can see its login.** 1.0.2 offers pi as a chat driver when `DEEPSEEK_API_KEY` is exported or `~/.pi/agent/auth.json`
|
|
62
|
+
holds a deepseek entry, read from the HOME the app runs in. On a normal attendee machine it is there; in a run with a moved HOME it is not (and pi
|
|
63
|
+
would fail on its first message anyway). `pty:pi` needs only the program.
|
|
64
|
+
- **The agent run takes minutes, not seconds.** Codex wrote the page and its tests in about seven; tell the room to start it and keep talking.
|
|
65
|
+
- **Publishing.** The workshop registry is `github.com/acryldev/workshop-2026-11-20`, public and open. Attendees fork it, run
|
|
66
|
+
`node scripts/make-entry.mjs ../agent-app <login>.agent-app --description "..."`, push and open a pull request; a check merges it, usually well under
|
|
67
|
+
two minutes, and a refusal comes as a comment. Taking an app down is a pull request that removes its folder. Pulling is
|
|
68
|
+
`--from <id> --registry github:acryldev/workshop-2026-11-20` (rehearsed on 1.0.2: create 12 s, install 3 s, runs at once).
|
|
69
|
+
- **Browser-only attendees (TODO(M9)).** The handout's hosted-workspace stub is empty until M9 is live; until then a browser-only attendee can follow
|
|
70
|
+
along but not create an app.
|
|
71
|
+
- **node-pty's install script (C5).** `npm install` warns that npm 11 blocked `node-pty`'s script. The terminal drivers still list; the workshop does
|
|
72
|
+
not open one.
|
|
73
|
+
|
|
74
|
+
## The no-network fallback
|
|
75
|
+
|
|
76
|
+
If the venue has no reliable network:
|
|
77
|
+
|
|
78
|
+
1. Every machine gets `prepared-notes` and a prepared agent app from the sheet above, so steps 1-6 skip creation and installs.
|
|
79
|
+
2. Step 8 uses the cloned registry and the installed `blends-core`; no network needed.
|
|
80
|
+
3. Step 7 needs the agent's own model, so it cannot run offline. Demo it from your machine on a tethered connection, or record it (a 4-minute
|
|
81
|
+
screen recording of the codex run is enough).
|
|
82
|
+
4. Keep one machine on a phone hotspot for `npm create` failures.
|
|
83
|
+
|
|
84
|
+
## Demo script for the agent block (5 minutes, if you demo instead of hands-on)
|
|
85
|
+
|
|
86
|
+
1. On the prepared agent app: `npm run dev`, open the page, click the panel button.
|
|
87
|
+
2. Ask: "Add a route GET /agent-built to src/routes.ts that returns {\"built\": true}, then run the tests and tell me what happened."
|
|
88
|
+
3. Narrate while it runs: the agent reads `AGENTS.md`, reads `docs/framework`, edits `src/routes.ts`, runs the tests; the terminal prints
|
|
89
|
+
`Change detected … Restarting`; reload `/agent-built` and show `{"built":true}`.
|
|
90
|
+
4. Point at the panel's stop button and the audit line the panel writes under `.acrylblends/audit/`.
|
|
91
|
+
|
|
92
|
+
## Resetting between sessions
|
|
93
|
+
|
|
94
|
+
Everything a person makes lives inside their app folder and `~/acryl-workshop`. To reset a machine:
|
|
95
|
+
|
|
96
|
+
```sh
|
|
97
|
+
rm -rf ~/acryl-workshop/[a-z]*-app ~/acryl-workshop/registry
|
|
98
|
+
cp -R ~/acryl-workshop/prepared/* ~/acryl-workshop/ # if you keep a prepared/ folder
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Nothing is installed globally except the agent and Bun; neither needs cleaning between sessions.
|
|
102
|
+
|
|
103
|
+
## What is still open
|
|
104
|
+
|
|
105
|
+
- Starter pull (B1), the panel's rows (C1) and the upgrade command in the docs (B2) are with the framework team; when they land, the handout's
|
|
106
|
+
TODO lines become normal steps and this page's "what breaks" list shrinks.
|
|
107
|
+
- The Windows and Linux runs of the attendee handout are being replayed separately; add what differs to the handout's OS column rather than here.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-acrylblends",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
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.0.
|
|
39
|
+
"acrylblends": "^1.0.3",
|
|
40
40
|
"@webboxes/app-persistence": "0.1.1"
|
|
41
41
|
},
|
|
42
42
|
"publishConfig": {
|