create-ailk 0.44.0 → 0.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
1
  import { AddModuleRefusedError, readArchitectureHeader } from "./add-module-core.js";
2
2
  import { type InstallReportRow } from "./lib/extract-module-bundle.js";
3
+ import type { Level } from "./lib/module-tier.js";
3
4
  import { type ModulePatch } from "./module-architecture.js";
4
5
  import { type ModuleName } from "./parse-args.js";
5
6
  import type { MarkerMap, WorkspaceVersionMap } from "./substitute.js";
@@ -43,6 +44,12 @@ export interface ApplyModuleOptions {
43
44
  templatesDir: string;
44
45
  /** The package's `site-templates/` dir — the shipped manifests the roster rows are read from. */
45
46
  siteTemplatesDir: string;
47
+ /**
48
+ * #11952 D2 — the site's licence level. When it is not Free, every MCP pack
49
+ * the level ships joins `apps/mcp/package.json`, as a fresh keyed scaffold's
50
+ * does. Absent: the packs the bundle's own patches add, and no others.
51
+ */
52
+ mcpLevel?: Level;
46
53
  }
47
54
  export interface AddModuleResult {
48
55
  /** Resolved absolute path to the site. */
@@ -36,7 +36,7 @@ import { appendEnvRows } from "./lib/declared-env.js";
36
36
  import { diffTwoStrings, extractModuleBundle, } from "./lib/extract-module-bundle.js";
37
37
  import { publicTreeRemoved } from "./lib/site-modules.js";
38
38
  import { normalizeModules } from "./module-architecture.js";
39
- import { MODULE_FLAGS_PATH, PAID_MCP_TOOLS_PATH, PAID_SECTIONS_PATH, writePaidSections, } from "./paid-sections.js";
39
+ import { MODULE_FLAGS_PATH, PAID_MCP_TOOLS_PATH, PAID_SECTIONS_PATH, withLevelMcpPackages, writePaidSections, } from "./paid-sections.js";
40
40
  import { ParseError, parseModules } from "./parse-args.js";
41
41
  import { RoutesRefusedError, writeRoutes } from "./routes.js";
42
42
  import { writeSpokeFlowsReadme } from "./seed-flows.js";
@@ -244,8 +244,23 @@ export async function applyModuleToScaffold(opts) {
244
244
  const abs = join(targetAbs, path);
245
245
  return { path, abs, before: existsSync(abs) ? readFileSync(abs, "utf8") : undefined };
246
246
  });
247
+ // #11952 D2 — every pack the level ships, after the bundle's own patches and
248
+ // before the registry is written from the file, the order a scaffold uses.
249
+ const levelRows = [];
250
+ const mcpPkgPath = join(targetAbs, "apps", "mcp", "package.json");
251
+ if (opts.mcpLevel !== undefined && opts.mcpLevel !== "free" && existsSync(mcpPkgPath)) {
252
+ const next = withLevelMcpPackages(readFileSync(mcpPkgPath, "utf8"), opts.mcpLevel, opts.versions);
253
+ if (next.added.length > 0) {
254
+ writeFileSync(mcpPkgPath, next.text);
255
+ levelRows.push({
256
+ path: "apps/mcp/package.json",
257
+ action: "patched",
258
+ change: `added ${next.added.join(", ")} (${opts.mcpLevel} level)`,
259
+ });
260
+ }
261
+ }
247
262
  writePaidSections(targetAbs);
248
- const rows = [...report, ...checkoutRows];
263
+ const rows = [...report, ...checkoutRows, ...levelRows];
249
264
  for (const { path, abs, before } of generated) {
250
265
  if (existsSync(abs) && readFileSync(abs, "utf8") !== before)
251
266
  rows.push({ path, action: "written" });
@@ -23,7 +23,7 @@ import { CONTACT_PAGE_PATH, DESIGN_SEED_PAGES, HOME_PAGE_PATH, designHomeSeeds,
23
23
  import { applyDesignPresets, readSectionLookCatalog, shippedPageTypes, validateDesignPresets, } from "./design-presets.js";
24
24
  import { resolveDesign, spliceThemeBlock } from "./design-scaffold.js";
25
25
  import { chromeKnobReaders, unreadChromeKnobs } from "./lib/chrome-readers.js";
26
- import { LICENSE_KEY_FILE } from "./lib/license-key-files.js";
26
+ import { readSiteKey } from "./lib/license-key-files.js";
27
27
  import { CONVERSION_HINT_URL, LicenseRequiredError, assertDesignAllowed, deriveLevel, } from "./lib/module-license-gate.js";
28
28
  import { LEVEL_LABEL } from "./lib/module-tier.js";
29
29
  import { ParseError } from "./parse-args.js";
@@ -140,17 +140,6 @@ function listMdxFiles(dir) {
140
140
  }
141
141
  return out.sort();
142
142
  }
143
- /** The site's own key (D6): `<target>/ailk.key`, else `AILK_LICENSE_KEY`, else none. */
144
- function readSiteKey(targetAbs, env) {
145
- const keyPath = join(targetAbs, LICENSE_KEY_FILE);
146
- if (existsSync(keyPath)) {
147
- const key = readFileSync(keyPath, "utf8").trim();
148
- if (key.length > 0)
149
- return key;
150
- }
151
- const fromEnv = env["AILK_LICENSE_KEY"];
152
- return fromEnv !== undefined && fromEnv.length > 0 ? fromEnv : undefined;
153
- }
154
143
  /**
155
144
  * Apply a design to an existing site (D2–D7). Refuses before any write
156
145
  * (C1–C6); otherwise writes only the files whose text changes — page files,
@@ -156,7 +156,7 @@ export const ENV_CATALOG = {
156
156
  secret: true,
157
157
  },
158
158
  MCP_ABUSE_BLOCKED_USER_AGENTS: {
159
- description: "Comma-separated User-Agent substrings the MCP server blocks, beyond its built-in list.",
159
+ description: "Comma-separated User-Agent substrings the MCP server refuses on write-tool calls; empty refuses none.",
160
160
  secret: false,
161
161
  },
162
162
  MCP_CORS_WRITE_ALLOWED_ORIGINS: {
@@ -1,6 +1,8 @@
1
1
  export declare const LICENSE_KEY_FILE = "ailk.key";
2
2
  export declare const LICENSE_ENV_FILE: string;
3
3
  export declare const LICENSE_ENV_VAR = "AILK_LICENSE_KEY";
4
+ /** The site's own key (D6): `<target>/ailk.key`, else `AILK_LICENSE_KEY`, else none. */
5
+ export declare function readSiteKey(targetAbs: string, env: NodeJS.ProcessEnv): string | undefined;
4
6
  /**
5
7
  * Throws unless `key` is 1–4096 characters of `[A-Za-z0-9._-]`. The message
6
8
  * describes the rule, never the value.
@@ -21,6 +21,17 @@ import { dirname, join } from "node:path";
21
21
  export const LICENSE_KEY_FILE = "ailk.key";
22
22
  export const LICENSE_ENV_FILE = join("apps", "api", ".env");
23
23
  export const LICENSE_ENV_VAR = "AILK_LICENSE_KEY";
24
+ /** The site's own key (D6): `<target>/ailk.key`, else `AILK_LICENSE_KEY`, else none. */
25
+ export function readSiteKey(targetAbs, env) {
26
+ const keyPath = join(targetAbs, LICENSE_KEY_FILE);
27
+ if (existsSync(keyPath)) {
28
+ const key = readFileSync(keyPath, "utf8").trim();
29
+ if (key.length > 0)
30
+ return key;
31
+ }
32
+ const fromEnv = env["AILK_LICENSE_KEY"];
33
+ return fromEnv !== undefined && fromEnv.length > 0 ? fromEnv : undefined;
34
+ }
24
35
  const KEY_SHAPE = /^[A-Za-z0-9._-]{1,4096}$/;
25
36
  /** `.gitignore` lines that already ignore a root `ailk.key`. */
26
37
  const KEY_IGNORE_LINES = new Set([
@@ -1,3 +1,5 @@
1
+ import { type Level } from "./lib/module-tier.js";
2
+ import type { WorkspaceVersionMap } from "./substitute.js";
1
3
  /** Scaffold-relative path of the generated registry. */
2
4
  export declare const PAID_SECTIONS_PATH = "apps/web/lib/paid-sections.generated.ts";
3
5
  /** Scaffold-relative path of the generated module-presence flags (#8843 D10). */
@@ -58,6 +60,23 @@ export declare function writeModuleFlags(targetDir: string): "added" | "updated"
58
60
  * appearance, so a package two modules deliver is one row.
59
61
  */
60
62
  export declare function paidMcpToolRows(): string[];
63
+ /**
64
+ * #11952 D1 — the paid MCP tool packs a licence level ships: every pack a
65
+ * module of `LEVEL_MODULES[level]` lists, in `paidMcpToolRows()` order.
66
+ * Free ships none; Pro and Pro Plus ship the same three today.
67
+ */
68
+ export declare function levelMcpPackages(level: Level): string[];
69
+ /**
70
+ * #11952 D2 — `text` (an apps/mcp/package.json) with every
71
+ * `levelMcpPackages(level)` pack its `dependencies` lacks added at
72
+ * `^<versions[pack]>`, dependency keys sorted. `added` is sorted; when it is
73
+ * empty, `text` comes back byte-identical. Throws, naming the pack, when
74
+ * `versions` has none for a pack it must add.
75
+ */
76
+ export declare function withLevelMcpPackages(text: string, level: Level, versions: WorkspaceVersionMap): {
77
+ text: string;
78
+ added: string[];
79
+ };
61
80
  /**
62
81
  * Render the MCP registry: one `() => import("<package>")` per carried
63
82
  * package, `[]` when none is carried. Line 1 is `// oss: false` exactly when
@@ -30,6 +30,7 @@
30
30
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
31
31
  import { dirname, join } from "node:path";
32
32
  import { readArchitectureHeader } from "./add-module-core.js";
33
+ import { LEVEL_MODULES } from "./lib/module-tier.js";
33
34
  import { readSiteManifestModules } from "./lib/site-modules.js";
34
35
  import { MODULE_SLICES } from "./module-architecture.js";
35
36
  import { RECOGNIZED_MODULES } from "./parse-args.js";
@@ -222,6 +223,46 @@ export function paidMcpToolRows() {
222
223
  }
223
224
  return rows;
224
225
  }
226
+ /**
227
+ * #11952 D1 — the paid MCP tool packs a licence level ships: every pack a
228
+ * module of `LEVEL_MODULES[level]` lists, in `paidMcpToolRows()` order.
229
+ * Free ships none; Pro and Pro Plus ship the same three today.
230
+ */
231
+ export function levelMcpPackages(level) {
232
+ const shipped = LEVEL_MODULES[level];
233
+ return paidMcpToolRows().filter((pkg) => shipped.some((m) => (MODULE_SLICES[m].paidMcpToolPackages ?? []).includes(pkg)));
234
+ }
235
+ /**
236
+ * #11952 D2 — `text` (an apps/mcp/package.json) with every
237
+ * `levelMcpPackages(level)` pack its `dependencies` lacks added at
238
+ * `^<versions[pack]>`, dependency keys sorted. `added` is sorted; when it is
239
+ * empty, `text` comes back byte-identical. Throws, naming the pack, when
240
+ * `versions` has none for a pack it must add.
241
+ */
242
+ export function withLevelMcpPackages(text, level, versions) {
243
+ let pkg;
244
+ try {
245
+ pkg = JSON.parse(text);
246
+ }
247
+ catch (err) {
248
+ throw new Error(`apps/mcp/package.json is not valid JSON: ${err.message}`, { cause: err });
249
+ }
250
+ const deps = { ...(pkg.dependencies ?? {}) };
251
+ const added = levelMcpPackages(level)
252
+ .filter((name) => !Object.hasOwn(deps, name))
253
+ .sort();
254
+ if (added.length === 0)
255
+ return { text, added };
256
+ for (const name of added) {
257
+ const version = versions[name];
258
+ if (version === undefined) {
259
+ throw new Error(`apps/mcp/package.json needs a version for ${name}, and this create-ailk's versions.json has none`);
260
+ }
261
+ deps[name] = `^${version}`;
262
+ }
263
+ pkg.dependencies = Object.fromEntries(Object.keys(deps).sort().map((key) => [key, deps[key]]));
264
+ return { text: `${JSON.stringify(pkg, null, 2)}\n`, added };
265
+ }
225
266
  const PAID_MCP_TOOLS_HEADER = `// paid-tools.generated.ts — the paid MCP tool packages this site carries.
226
267
  //
227
268
  // GENERATED by create-ailk from MODULE_SLICES (\`paidMcpToolPackages\`) and
@@ -37,7 +37,7 @@ import { assertLicenseKeyShape, writeLicenseKeyFiles, } from "./lib/license-key-
37
37
  import { assertDesignAllowed, assertReleased, deriveDesignLevel, deriveLevel, resolveModuleSet, resolvePaidModules, } from "./lib/module-license-gate.js";
38
38
  import { classifyModules, isAddition } from "./lib/module-tier.js";
39
39
  import { normalizeModules } from "./module-architecture.js";
40
- import { writePaidSections } from "./paid-sections.js";
40
+ import { withLevelMcpPackages, writePaidSections } from "./paid-sections.js";
41
41
  import { RECOGNIZED_SHAPES, RESERVED_SHAPES, } from "./parse-args.js";
42
42
  import { RemoveModuleRefusedError, removeModuleFromScaffold, } from "./remove-module.js";
43
43
  import { scaffoldSeamRows } from "./seam-refresh.js";
@@ -481,6 +481,37 @@ export async function scaffold(opts) {
481
481
  // (#6813 D7) — and `chosen.free` decides Free-ness by identity (D2), never
482
482
  // by `FREE_DESIGNS.includes(name)` alone (a path is never in that list).
483
483
  assertDesignAllowed(chosenDesign?.display, level ?? "free", chosenDesign?.free);
484
+ // #11952 D3 — the MCP build installs its level's packs (D1), so a run that
485
+ // composed no level (a `--modules` keep run, a `--template` alias run)
486
+ // derives one here, from the key alone. Kept apart from `level`: the
487
+ // manifest records what it did before (#6944), and the design gate above is
488
+ // already decided. Fail closed: a probe that cannot answer installs today's
489
+ // packs and never refuses the run. A `--without-mcp` spoke has nothing to
490
+ // install, so it never probes.
491
+ let mcpLevel = level ?? "free";
492
+ if (level === undefined && !(spoke !== undefined && opts.mcp === false)) {
493
+ try {
494
+ mcpLevel = await deriveDesignLevel({
495
+ licenseKey,
496
+ ...(opts.moduleRegistryUrl !== undefined
497
+ ? { registryUrl: opts.moduleRegistryUrl }
498
+ : {}),
499
+ ...(opts.fetchImpl !== undefined ? { fetchImpl: opts.fetchImpl } : {}),
500
+ });
501
+ }
502
+ catch {
503
+ mcpLevel = "free";
504
+ }
505
+ }
506
+ // Threaded to extractModuleBundle for `package.json` patch targets'
507
+ // `workspace:*` substitution (spec 5418 § 3 D2) — the same version map
508
+ // `scaffoldSync` already reads for `copyTemplate`, re-read here since
509
+ // `scaffold()` doesn't share `scaffoldSync`'s call frame. Read before the
510
+ // target exists, so a level pack it lacks refuses first (#11952 NFR4).
511
+ const versions = readVersionMap();
512
+ // Throws, naming the pack, when `versions` lacks one the level ships — the
513
+ // same check the write below makes, run here against an empty dependency set.
514
+ withLevelMcpPackages(`{"dependencies":{}}`, mcpLevel, versions);
484
515
  // The template's OWN bundle, fetched here — before `scaffoldSync` — so the
485
516
  // fourth refusal (the template's bundle unpublished, parent record D17 /
486
517
  // spec 5481 § 3 DD5 row 4) throws with the target still non-existent, like
@@ -543,11 +574,6 @@ export async function scaffold(opts) {
543
574
  // `resolveSiteChrome` reads a layout object now, not a `StarterDesign`.
544
575
  ...(resolvedDesign !== undefined ? { designLayout: resolvedDesign.pkg.layout } : {}),
545
576
  }, copied);
546
- // Threaded to extractModuleBundle for `package.json` patch targets'
547
- // `workspace:*` substitution (spec 5418 § 3 D2) — the same version map
548
- // `scaffoldSync` already reads for `copyTemplate`, re-read here since
549
- // `scaffold()` doesn't share `scaffoldSync`'s call frame.
550
- const versions = readVersionMap();
551
577
  // #6460 — the SAME marker map `scaffoldSync` just substituted the base
552
578
  // `templates/` copy with, rebuilt here from the same inputs (`scaffold()`
553
579
  // does not share `scaffoldSync`'s call frame, exactly as `versions` above
@@ -875,6 +901,13 @@ export async function scaffold(opts) {
875
901
  }));
876
902
  }
877
903
  }
904
+ // #11952 D2 — every pack the level ships, after the bundles' own patches.
905
+ const mcpPkgPath = join(result.targetDir, "apps", "mcp", "package.json");
906
+ if (existsSync(mcpPkgPath)) {
907
+ const next = withLevelMcpPackages(readFileSync(mcpPkgPath, "utf8"), mcpLevel, versions);
908
+ if (next.added.length > 0)
909
+ writeFileSync(mcpPkgPath, next.text);
910
+ }
878
911
  // #7536 D3 — the registry follows `apps/web/package.json`, which a module
879
912
  // bundle's `patches` (and the template layer) just finished editing.
880
913
  writePaidSections(result.targetDir);
@@ -1259,6 +1292,22 @@ export async function addModule(opts) {
1259
1292
  if (bundleBytes === undefined) {
1260
1293
  throw new Error(`module "${opts.moduleName}": no bundle was resolved`);
1261
1294
  }
1295
+ // #11952 D3 — the MCP build installs its level's packs, so add-module reads
1296
+ // the level from the same key, as `scaffold()` and `update` do. A read that
1297
+ // fails adds no packs and never refuses the run.
1298
+ let mcpLevel;
1299
+ try {
1300
+ ({ level: mcpLevel } = await deriveLevel({
1301
+ licenseKey: opts.licenseKey,
1302
+ ...(opts.moduleRegistryUrl !== undefined
1303
+ ? { registryUrl: opts.moduleRegistryUrl }
1304
+ : {}),
1305
+ ...(opts.fetchImpl !== undefined ? { fetchImpl: opts.fetchImpl } : {}),
1306
+ }));
1307
+ }
1308
+ catch {
1309
+ mcpLevel = undefined;
1310
+ }
1262
1311
  return applyModuleToScaffold({
1263
1312
  targetDir: targetAbs,
1264
1313
  moduleName: opts.moduleName,
@@ -1267,6 +1316,7 @@ export async function addModule(opts) {
1267
1316
  markers: buildScaffoldMarkers(basename(targetAbs)),
1268
1317
  templatesDir: TEMPLATES_DIR,
1269
1318
  siteTemplatesDir: SITE_TEMPLATES_DIR,
1319
+ ...(mcpLevel !== undefined ? { mcpLevel } : {}),
1270
1320
  });
1271
1321
  }
1272
1322
  /**
package/dist/update.d.ts CHANGED
@@ -1,6 +1,7 @@
1
+ import { type Level } from "./lib/module-tier.js";
1
2
  import { type MdxParse } from "./mdx-braces.js";
2
3
  import { type ModuleName } from "./parse-args.js";
3
- import type { WorkspaceVersionMap } from "./substitute.js";
4
+ import { type WorkspaceVersionMap } from "./substitute.js";
4
5
  /** A refusal the CLI exits 2 on, thrown before anything is written. */
5
6
  export declare class UpdateRefusedError extends Error {
6
7
  readonly exitCode = 2;
@@ -33,6 +34,10 @@ export interface UpdateSiteOptions {
33
34
  * `null` acts as "not installed". Absent: `loadSiteMdxParse(targetDir)`.
34
35
  */
35
36
  mdxParse?: MdxParse | null;
37
+ /** #11952 D4 — read for AILK_LICENSE_KEY only. Default process.env. */
38
+ env?: NodeJS.ProcessEnv;
39
+ /** #11952 D4 — forwarded to deriveLevel as registryUrl. Default: AILK_MODULE_REGISTRY_URL / fetchModule's default. */
40
+ moduleRegistryUrl?: string;
36
41
  }
37
42
  export interface UpdateResult {
38
43
  targetDir: string;
@@ -101,6 +106,20 @@ export interface UpdateResult {
101
106
  path: string;
102
107
  version: string;
103
108
  }>;
109
+ /** The `apps/web/package.json` scripts set to the running template's, with the published template version each was (#11940). */
110
+ scriptsCarried?: Array<{
111
+ script: string;
112
+ version: string;
113
+ }>;
114
+ /** The dependencies added to `apps/web/package.json` this run (#9889 D9, #11392), sorted. */
115
+ webDependenciesAdded?: string[];
116
+ /** #11952 D4 — the packs added to apps/mcp/package.json for the site's level. */
117
+ mcpPackagesAdded?: {
118
+ level: Level;
119
+ packages: string[];
120
+ };
121
+ /** #11952 D4 — why the level's packs were not checked, when they were not. */
122
+ mcpLevelUnchecked?: string;
104
123
  /** The `project.yaml` `env_contract` rows added for env vars the written files read (#10172). */
105
124
  envRowsAdded?: string[];
106
125
  /** Record rows dropped because the path is no longer recordable (#10173). */
@@ -183,6 +202,6 @@ export interface UpdateArgs {
183
202
  target: string | undefined;
184
203
  help: boolean;
185
204
  }
186
- export declare const UPDATE_HELP = "create-ailk update \u2014 bring template fixes into a site's copied app code.\n\nUsage:\n create-ailk update [<target-dir>]\n\nArguments:\n <target-dir> The existing site. Defaults to the current dir.\n\nOptions:\n --help, -h Print this message.\n\nReads .ailk-template-files.json (written beside .ailk-site-manifest.json by\nevery template scaffold) to tell an untouched copy from an edit. An\nuntouched apps/web, apps/api or apps/mcp file, or a root tools/jest file the\napp jest configs require, whose template copy changed is overwritten. An\nedited file whose template copy also changed is three-way merged with\n`git` (git must be on PATH); a conflict leaves the file alone and is\nlisted under \"Needs review\"; an apps/web/messages catalog instead gains the\ntemplate's new keys and keeps every value it has \u2014 also when its recorded\nversion's copy cannot be read \u2014 and is reviewed only when a key is an object\non one side and a value on the other; a written apps/web file that uses\nthrough t(...) a key the catalog then lacks is held with it, listed under\n\"Held back with <catalog>\". Each @working-theory/* package a written apps/web\nfile imports that apps/web/package.json does not declare is added to its\ndependencies at this release's version. An edited file whose\nbytes are another published create-ailk version's copy is a stale copy, not\nan edit: it is overwritten or removed as an untouched file is, listed with\nthe version it matched. An edit that touches only comment lines is listed as\n\"comment-only edit\"; on a conflict the template's copy lands. A file at a\ntemplate path that is not in the record (one an earlier sync-routes --apply\nor add-route copied without recording it) whose bytes are a published\ncreate-ailk version's copy \u2014 from the version the site was scaffolded at to\nthis one \u2014 is adopted: recorded and moved forward as an untouched file is,\nlisted under \"Adopted\" with the version it matched. One whose bytes are the\nrunning copy with this site's modules' patches applied (a module's\njest.config.cjs or next.config.mjs edit) is left as it is and not listed.\nOne whose bytes match no published copy is a site edit: skipped, never overwritten, and counted under\n\"Held as site edits, not in the record\". No file under a route the site\nlists in customizations.yaml declined_routes is written: each is listed under\n\"Skipped\" naming the declined route. Every template\ntest, and every site-edited template file, that imports a file left under\n\"Needs review\" (by a relative or @/ import, transitively) is held\nat the site's version with it, its record entry is not advanced, and it is\nlisted under \"Held back with <file>\" \u2014 reconcile the file, then run update\nagain to bring it forward. A skipped file never holds another. A file whose\nown bytes are the record's is not held by what it imports: it moves, unless\nit names an export the held copy lacks, and the held file is listed as\n\"Held back: <file> \u2014 imported by N moved files; the site edit is <hunk\nsummary>\". A written file whose import names a file the site lacks gets it\nadded when this template supplies it; otherwise it is held the same way,\nunder \"Held back with <file> (not in this site)\", unless its own copy\nalready named the file \u2014 then it moves and the path is listed under \"Not in\nthis site or the template: <file>\". A file the template removed is kept\nwhile any file still in the site imports it. A file a customizations.yaml\nentry records is never removed, nor anything it imports: it keeps its record\nrow and is listed under \"Skipped\" as kept. Every other file in the run\nstill updates. When project.yaml has an env_contract block, each\nenv var the written files read that has no row gains one; no row is edited.\nA record row at a path create-ailk no longer records is dropped and listed.\nA surface the site's .ailk-site-manifest.json names a page on but\narchitecture.yaml does not declare (one no module owns, such as projects)\ngets its route files added and is declared, listed under \"Surfaces declared\nfrom the roster\". A code-route row of that roster no page file serves is\ndropped, listed under \"Roster rows dropped, no route serves them\".\nA site with no record gets one on its first run, from the version its\n.ailk-site-manifest.json already records. A site scaffolded before\n@working-theory/mcp-server has its copied apps/mcp moved to the boot set:\nthe server and each module's paid MCP pack join apps/mcp/package.json, the\ncopied server files go, and apps/mcp/src/lib/paid-tools.generated.ts is\nrewritten on every run. A site scaffolded before @working-theory/api has its\ncopied apps/api moved to the boot file: the app becomes @working-theory/app-api,\nthe package and the six @working-theory/api-<module> packages join\napps/api/package.json, its bins and build:vercel delegate to the package, and\nthe copied server files go. Run `pnpm install` after either move, since the\napp's package.json gained dependencies. Each mdx-body page in content/ with no\n'# ' heading gets its title and description written into its body as its\nheading and intro, listed under \"Page heading added\"; a page with one heading\nis left as it is, and one with several, or one whose frontmatter it cannot\nread, is listed under \"Needs review\". Each bare { on an mdx-body page is\nescaped as \\{ when the site's own MDX parser then reads the page clean, listed\nunder \"Placeholder brace escaped\"; a page it cannot escape safely, or any page\nwith one while the site's dependencies are not installed, is listed under\n\"Needs review\". Each topology seam (*.generated.* \u2014 the web seam, the\n(authed) gate, the API origin and the MCP seam) is rendered again for the\ntopology and sign-in mode .ailk-site-manifest.json records and listed under\n\"Regenerated\", when its bytes are still the render .ailk-template-files.json\nrecords; one edited by hand, or with no recorded render, is listed under\n\"Needs review\" and left as it is. Last, the generated route files of every installed page\npackage (one whose package.json declares \"ailk\": { \"routes\" }) are rewritten\nfrom its manifest, listed under \"Route files regenerated\"; run\n`create-ailk routes --write` after the install when the packages were not\ninstalled yet. Each hand-written page `routes --check` then fails on \u2014 no\ndecided customizations.yaml entry, under a package's prefix, or at a\npackage's own route \u2014 is listed under \"Needs review\". Commit before running,\nand review the diff after.\n";
205
+ export declare const UPDATE_HELP = "create-ailk update \u2014 bring template fixes into a site's copied app code.\n\nUsage:\n create-ailk update [<target-dir>]\n\nArguments:\n <target-dir> The existing site. Defaults to the current dir.\n\nOptions:\n --help, -h Print this message.\n\nReads .ailk-template-files.json (written beside .ailk-site-manifest.json by\nevery template scaffold) to tell an untouched copy from an edit. An\nuntouched apps/web, apps/api or apps/mcp file, or a root tools/jest file the\napp jest configs require, whose template copy changed is overwritten. An\nedited file whose template copy also changed is three-way merged with\n`git` (git must be on PATH); a conflict leaves the file alone and is\nlisted under \"Needs review\"; an apps/web/messages catalog instead gains the\ntemplate's new keys and keeps every value it has \u2014 also when its recorded\nversion's copy cannot be read \u2014 and is reviewed only when a key is an object\non one side and a value on the other; a written apps/web file that uses\nthrough t(...) a key the catalog then lacks is held with it, listed under\n\"Held back with <catalog>\". Each @working-theory/* package a written apps/web\nfile imports that apps/web/package.json does not declare is added to its\ndependencies at this release's version. A site missing a paid MCP package\nits licence level ships gets it in apps/mcp/package.json; the level is read\nfrom the site's key (ailk.key, else AILK_LICENSE_KEY) through the module\nregistry, and a run with no key adds none. apps/web/package.json's\nscripts.build is set to this template's when it is a published create-ailk\ntemplate's, listed under \"Build scripts carried\"; a build script matching no\ntemplate's is left as it is and listed under \"Needs review\". An edited file whose\nbytes are another published create-ailk version's copy is a stale copy, not\nan edit: it is overwritten or removed as an untouched file is, listed with\nthe version it matched. An edit that touches only comment lines is listed as\n\"comment-only edit\"; on a conflict the template's copy lands. A file at a\ntemplate path that is not in the record (one an earlier sync-routes --apply\nor add-route copied without recording it) whose bytes are a published\ncreate-ailk version's copy \u2014 from the version the site was scaffolded at to\nthis one \u2014 is adopted: recorded and moved forward as an untouched file is,\nlisted under \"Adopted\" with the version it matched. One whose bytes are the\nrunning copy with this site's modules' patches applied (a module's\njest.config.cjs or next.config.mjs edit) is left as it is and not listed.\nOne whose bytes match no published copy is a site edit: skipped, never overwritten, and counted under\n\"Held as site edits, not in the record\". No file under a route the site\nlists in customizations.yaml declined_routes is written: each is listed under\n\"Skipped\" naming the declined route. Every template\ntest, and every site-edited template file, that imports a file left under\n\"Needs review\" (by a relative or @/ import, transitively) is held\nat the site's version with it, its record entry is not advanced, and it is\nlisted under \"Held back with <file>\" \u2014 reconcile the file, then run update\nagain to bring it forward. A skipped file never holds another. A file whose\nown bytes are the record's is not held by what it imports: it moves, unless\nit names an export the held copy lacks, and the held file is listed as\n\"Held back: <file> \u2014 imported by N moved files; the site edit is <hunk\nsummary>\". A written file whose import names a file the site lacks gets it\nadded when this template supplies it; otherwise it is held the same way,\nunder \"Held back with <file> (not in this site)\", unless its own copy\nalready named the file \u2014 then it moves and the path is listed under \"Not in\nthis site or the template: <file>\". A file the template removed is kept\nwhile any file still in the site imports it. A file a customizations.yaml\nentry records is never removed, nor anything it imports: it keeps its record\nrow and is listed under \"Skipped\" as kept. Every other file in the run\nstill updates. When project.yaml has an env_contract block, each\nenv var the written files read that has no row gains one; no row is edited.\nA record row at a path create-ailk no longer records is dropped and listed.\nA surface the site's .ailk-site-manifest.json names a page on but\narchitecture.yaml does not declare (one no module owns, such as projects)\ngets its route files added and is declared, listed under \"Surfaces declared\nfrom the roster\". A code-route row of that roster no page file serves is\ndropped, listed under \"Roster rows dropped, no route serves them\".\nA site with no record gets one on its first run, from the version its\n.ailk-site-manifest.json already records. A site scaffolded before\n@working-theory/mcp-server has its copied apps/mcp moved to the boot set:\nthe server and each module's paid MCP pack join apps/mcp/package.json, the\ncopied server files go, and apps/mcp/src/lib/paid-tools.generated.ts is\nrewritten on every run. A site scaffolded before @working-theory/api has its\ncopied apps/api moved to the boot file: the app becomes @working-theory/app-api,\nthe package and the six @working-theory/api-<module> packages join\napps/api/package.json, its bins and build:vercel delegate to the package, and\nthe copied server files go. Run `pnpm install` after either move, since the\napp's package.json gained dependencies. Each mdx-body page in content/ with no\n'# ' heading gets its title and description written into its body as its\nheading and intro, listed under \"Page heading added\"; a page with one heading\nis left as it is, and one with several, or one whose frontmatter it cannot\nread, is listed under \"Needs review\". Each bare { on an mdx-body page is\nescaped as \\{ when the site's own MDX parser then reads the page clean, listed\nunder \"Placeholder brace escaped\"; a page it cannot escape safely, or any page\nwith one while the site's dependencies are not installed, is listed under\n\"Needs review\". Each topology seam (*.generated.* \u2014 the web seam, the\n(authed) gate, the API origin and the MCP seam) is rendered again for the\ntopology and sign-in mode .ailk-site-manifest.json records and listed under\n\"Regenerated\", when its bytes are still the render .ailk-template-files.json\nrecords; one edited by hand, or with no recorded render, is listed under\n\"Needs review\" and left as it is. Last, the generated route files of every installed page\npackage (one whose package.json declares \"ailk\": { \"routes\" }) are rewritten\nfrom its manifest, listed under \"Route files regenerated\"; run\n`create-ailk routes --write` after the install when the packages were not\ninstalled yet. Each hand-written page `routes --check` then fails on \u2014 no\ndecided customizations.yaml entry, under a package's prefix, or at a\npackage's own route \u2014 is listed under \"Needs review\". Commit before running,\nand review the diff after.\n";
187
206
  /** Parse the argv AFTER the `update` word. Strict `node:util` parseArgs, like `parseAdoptArgs`. */
188
207
  export declare function parseUpdateArgs(argv: string[]): UpdateArgs;