create-ailk 0.46.6 → 0.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +180 -43
- package/component-catalog.json +223 -285
- package/component-catalog.md +1 -1
- package/dist/apply-design.d.ts +26 -68
- package/dist/apply-design.js +150 -322
- package/dist/cli.js +152 -17
- package/dist/compare-chrome.d.ts +108 -0
- package/dist/compare-chrome.js +481 -0
- package/dist/compare-look.d.ts +94 -0
- package/dist/compare-look.js +378 -0
- package/dist/copy.js +1 -1
- package/dist/design-compile.d.ts +17 -21
- package/dist/design-compile.js +32 -56
- package/dist/design-files.d.ts +93 -0
- package/dist/design-files.js +312 -0
- package/dist/design-home.d.ts +4 -2
- package/dist/design-home.js +88 -6
- package/dist/design-names.d.ts +13 -0
- package/dist/design-names.js +76 -0
- package/dist/design-package.d.ts +46 -56
- package/dist/design-package.js +285 -288
- package/dist/design-presets.d.ts +41 -0
- package/dist/design-presets.js +83 -4
- package/dist/design-scaffold.d.ts +12 -2
- package/dist/design-scaffold.js +72 -34
- package/dist/generated/design-settings.d.ts +56 -0
- package/dist/generated/design-settings.js +237 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/inventory.d.ts +3 -2
- package/dist/inventory.js +10 -4
- package/dist/lib/design-checks.d.ts +46 -0
- package/dist/lib/design-checks.js +79 -1
- package/dist/lib/env-catalog.js +5 -1
- package/dist/lib/module-license-gate.d.ts +1 -1
- package/dist/lib/module-license-gate.js +1 -1
- package/dist/lib/render-verdict.d.ts +13 -1
- package/dist/lib/render-verdict.js +41 -1
- package/dist/look-hub.d.ts +44 -0
- package/dist/look-hub.js +130 -0
- package/dist/look-record.d.ts +35 -0
- package/dist/look-record.js +85 -0
- package/dist/look-samples.d.ts +66 -0
- package/dist/look-samples.js +456 -0
- package/dist/look-settings.d.ts +53 -0
- package/dist/look-settings.js +363 -0
- package/dist/module-architecture.js +12 -0
- package/dist/parse-args.d.ts +10 -6
- package/dist/parse-args.js +26 -13
- package/dist/programmatic.d.ts +1 -19
- package/dist/programmatic.js +65 -103
- package/dist/retired-design-bodies.d.ts +29 -0
- package/dist/retired-design-bodies.js +51 -0
- package/dist/seed-flows.d.ts +1 -1
- package/dist/seed-flows.js +12 -14
- package/dist/seed-workspace.d.ts +4 -1
- package/dist/seed-workspace.js +139 -17
- package/dist/site-chrome.d.ts +41 -41
- package/dist/site-chrome.js +50 -70
- package/dist/site-fonts.d.ts +10 -14
- package/dist/site-fonts.js +5 -1
- package/dist/starter-grid.d.ts +2 -2
- package/dist/strip-look-copies.d.ts +67 -0
- package/dist/strip-look-copies.js +591 -0
- package/dist/template-manifest.d.ts +6 -14
- package/dist/template-manifest.js +0 -9
- package/dist/template-record.d.ts +3 -1
- package/dist/template-record.js +3 -1
- package/dist/topology.d.ts +15 -0
- package/dist/topology.js +60 -0
- package/dist/update.d.ts +57 -1
- package/dist/update.js +742 -13
- package/package.json +3 -4
- package/site-templates/aliases/hub.TEMPLATE-MANIFEST.json +2 -31
- package/site-templates/designs/minimalism/DESIGN.md +163 -297
- package/site-templates/designs/minimalism/LOOK.md +42 -0
- package/site-templates/designs/minimalism/design.yaml +167 -0
- package/site-templates/designs/standard/DESIGN.md +145 -149
- package/site-templates/designs/standard/LOOK.md +42 -0
- package/site-templates/designs/standard/design.yaml +72 -0
- package/site-templates/marketing-site/TEMPLATE-MANIFEST.json +2 -31
- package/site-templates/marketing-site/TEMPLATE-MANIFEST.md +1 -25
- package/site-templates/marketing-site-free/TEMPLATE-MANIFEST.json +2 -31
- package/site-templates/marketing-site-free/TEMPLATE-MANIFEST.md +1 -25
- package/site-templates/shapes/local-business-service/TEMPLATE-MANIFEST.json +2 -31
- package/site-templates/shapes/local-business-service/TEMPLATE-MANIFEST.md +1 -25
- package/site-templates/shapes/organization-service/TEMPLATE-MANIFEST.json +2 -31
- package/site-templates/shapes/organization-service/TEMPLATE-MANIFEST.md +1 -25
- package/site-templates/shapes/person-service/TEMPLATE-MANIFEST.json +2 -31
- package/site-templates/shapes/person-service/TEMPLATE-MANIFEST.md +1 -25
- package/site-templates/shapes/person-service/content/_site.mdx +0 -26
- package/templates/.claude/rules/extending.md +3 -2
- package/templates/.env.example +11 -4
- package/templates/CLAUDE.md +1 -1
- package/templates/DESIGN.md +145 -149
- package/templates/README.md +15 -16
- package/templates/apps/api/.env.example +29 -4
- package/templates/apps/api/CLAUDE.md +7 -4
- package/templates/apps/api/src/__tests__/vercel-handler.test.ts +176 -2
- package/templates/apps/api/src/lib/__mocks__/prisma.ts +30 -4
- package/templates/apps/api/src/vercel-handler.ts +32 -2
- package/templates/apps/mcp/.env.example +8 -0
- package/templates/apps/mcp/CLAUDE.md +5 -3
- package/templates/apps/web/.env.example +10 -3
- package/templates/apps/web/CLAUDE.md +31 -4
- package/templates/apps/web/app/[locale]/layout.tsx +141 -77
- package/templates/apps/web/app/llms.txt/__tests__/site-listing.test.ts +13 -3
- package/templates/apps/web/app/not-found.tsx +11 -11
- package/templates/apps/web/auth.ts +48 -35
- package/templates/apps/web/jest.config.cjs +5 -0
- package/templates/apps/web/lib/__tests__/hub-site-config.test.ts +542 -10
- package/templates/apps/web/lib/__tests__/library-fonts.test.ts +35 -0
- package/templates/apps/web/lib/__tests__/page-chrome-navigation.test.ts +233 -0
- package/templates/apps/web/lib/__tests__/page-chrome.test.ts +123 -26
- package/templates/apps/web/lib/__tests__/section-look.test.ts +150 -0
- package/templates/apps/web/lib/__tests__/site-identity-feature-list.test.ts +19 -1
- package/templates/apps/web/lib/__tests__/site-navigation.test.ts +288 -0
- package/templates/apps/web/lib/__tests__/site-theme.test.ts +81 -289
- package/templates/apps/web/lib/deck-page.ts +3 -10
- package/templates/apps/web/lib/deploy-fonts.ts +12 -0
- package/templates/apps/web/lib/hub-site-config.ts +237 -29
- package/templates/apps/web/lib/library-fonts.ts +41 -0
- package/templates/apps/web/lib/mcp-oauth.ts +11 -4
- package/templates/apps/web/lib/page-chrome.ts +105 -20
- package/templates/apps/web/lib/section-look.ts +28 -0
- package/templates/apps/web/lib/site-design.ts +205 -0
- package/templates/apps/web/lib/site-navigation.ts +208 -0
- package/templates/apps/web/lib/site-theme-head.ts +98 -13
- package/templates/apps/web/lib/site-theme.ts +40 -62
- package/templates/apps/web/messages/en.json +0 -6
- package/templates/apps/web/next.config.mjs +213 -11
- package/templates/apps/web/package.json +2 -0
- package/templates/apps/web/site-pages.config.tsx +4 -2
- package/templates/content/_site.mdx +0 -26
- package/templates/design.yaml +75 -0
- package/templates/project.yaml +14 -0
- package/versions.json +52 -51
- package/site-templates/marketing-site/DESIGN.md +0 -259
- package/site-templates/marketing-site-free/DESIGN.md +0 -259
- package/site-templates/saas-product/DESIGN.md +0 -259
- package/templates/apps/web/lib/__tests__/deck-page.test.ts +0 -288
- package/templates/apps/web/lib/__tests__/site-theme-head.test.ts +0 -70
- package/templates/apps/web/lib/site-chrome.ts +0 -46
- package/templates/apps/web/lib/site-fonts.ts +0 -15
|
@@ -0,0 +1,591 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `create-ailk strip-look-copies [<dir>] [--apply] [--api-url <origin>]
|
|
3
|
+
* [--workspace <id>]` — remove from a site's page files the section look
|
|
4
|
+
* values its look already sets (#12474 D10, spec
|
|
5
|
+
* docs/specs/12474-a-page-takes-its-section-spec.md).
|
|
6
|
+
*
|
|
7
|
+
* A design's presets were copied onto every page file at scaffold; once the
|
|
8
|
+
* site renders its sections with the hub's look merged in (D1–D3), those
|
|
9
|
+
* copies only pin the page to the look it had then. This command removes a
|
|
10
|
+
* copy where three things hold:
|
|
11
|
+
*
|
|
12
|
+
* - **The look would put it back.** The look is the design read's worked-out
|
|
13
|
+
* `settings.sections` (`GET /v1/workspaces/<id>/design`, its top-level
|
|
14
|
+
* `settings`, never `design.settings`), and the site's own read
|
|
15
|
+
* (`GET /v1/content/site-config`) must carry the same design at the same
|
|
16
|
+
* version with the same sections digest — so the strip is against the look
|
|
17
|
+
* the site renders from. An entry goes only when its field is in the
|
|
18
|
+
* section type's look group (`component-catalog.json`), the look sets it
|
|
19
|
+
* and its value, read as a scalar, equals the look's.
|
|
20
|
+
* - **The render does not move.** A section the look would add a field to
|
|
21
|
+
* (one the look sets and the section lacks) is left whole, so the merge on
|
|
22
|
+
* the raw entry gives back exactly the stored entry; a section whose every
|
|
23
|
+
* entry is a copy is left whole too, so its `data` never empties.
|
|
24
|
+
* - **Nobody chose it.** The entry is held, in the same section (index and
|
|
25
|
+
* type) with the same value, in the file at the commit that added it and
|
|
26
|
+
* at every commit since that touched it (`git log --follow`, `git show`);
|
|
27
|
+
* otherwise it was chosen and is listed as edited. A file no commit holds
|
|
28
|
+
* is kept whole. This is D5's history rule for files.
|
|
29
|
+
*
|
|
30
|
+
* Each removal is `removeSectionLookField`'s bounded splice: the entry and one
|
|
31
|
+
* separator, no other byte.
|
|
32
|
+
*
|
|
33
|
+
* Credentials as `migrate-content`'s (#10204 D2): the origin from `--api-url`,
|
|
34
|
+
* else `AILK_API_URL` (https:, or http: on a loopback host); the workspace from
|
|
35
|
+
* `--workspace`, else `AILK_WORKSPACE_ID`; the agent key from `AILK_AGENT_KEY`
|
|
36
|
+
* and nowhere else; the spoke key, sent only from a spoke, from
|
|
37
|
+
* `AILK_SPOKE_KEY` only. No key is ever printed. On a spoke, a workspace or
|
|
38
|
+
* origin other than the one its `apps/web/.env` / `.env.local` names is
|
|
39
|
+
* refused before any request (#12477).
|
|
40
|
+
*
|
|
41
|
+
* Dry unless `--apply`. With `--apply` and something to remove, it refuses a
|
|
42
|
+
* dirty work tree, and on the default branch (`main`, `master`, or the one
|
|
43
|
+
* `origin/HEAD` names) first creates and switches to
|
|
44
|
+
* `look-copy-import/<YYYYMMDD>`; then it writes the changed files and prints
|
|
45
|
+
* the next steps. It never commits, pushes or opens a pull request. `git`
|
|
46
|
+
* runs through `spawnSync` with a fixed argument list and no shell.
|
|
47
|
+
*
|
|
48
|
+
* Pure module: no `import.meta.url`, so jest can import it directly.
|
|
49
|
+
*/
|
|
50
|
+
import { spawnSync } from "node:child_process";
|
|
51
|
+
import { createHash } from "node:crypto";
|
|
52
|
+
import { readFileSync, readdirSync, realpathSync, statSync, writeFileSync, } from "node:fs";
|
|
53
|
+
import { join, relative, resolve, sep } from "node:path";
|
|
54
|
+
import { parseArgs } from "node:util";
|
|
55
|
+
import { locatePageSections, pageTypeOf, readSectionLookCatalog, removeSectionLookField, } from "./design-presets.js";
|
|
56
|
+
import { ParseError } from "./parse-args.js";
|
|
57
|
+
import { SPOKE_KEY_ENV_VAR } from "./seed-flows.js";
|
|
58
|
+
import { AGENT_KEY_ENV_VAR, WORKSPACE_ID_ENV_VAR } from "./seed-workspace.js";
|
|
59
|
+
import { TemplateError } from "./template-manifest.js";
|
|
60
|
+
import { HUB_ORIGIN_ENV_VAR, TopologyError, normalizeHubUrl, readSiteTopology, spokeOriginMismatch, spokeWorkspaceMismatch, } from "./topology.js";
|
|
61
|
+
/** The branch an `--apply` on the default branch creates, before its date. */
|
|
62
|
+
export const LOOK_COPY_IMPORT_BRANCH_PREFIX = "look-copy-import/";
|
|
63
|
+
/** A workspace id is one URL path segment. */
|
|
64
|
+
const WORKSPACE_ID_RE = /^[A-Za-z0-9_-]{1,128}$/;
|
|
65
|
+
/** A refusal the CLI exits 2 on, thrown before any write. */
|
|
66
|
+
export class StripLookCopiesRefusedError extends Error {
|
|
67
|
+
exitCode = 2;
|
|
68
|
+
constructor(message) {
|
|
69
|
+
super(message);
|
|
70
|
+
this.name = "StripLookCopiesRefusedError";
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function refuse(message) {
|
|
74
|
+
throw new StripLookCopiesRefusedError(`strip-look-copies: ${message} Nothing was written.`);
|
|
75
|
+
}
|
|
76
|
+
/** A value given, or `undefined` for an absent or empty one. */
|
|
77
|
+
function given(value) {
|
|
78
|
+
const trimmed = value?.trim();
|
|
79
|
+
return trimmed === undefined || trimmed === "" ? undefined : trimmed;
|
|
80
|
+
}
|
|
81
|
+
function isPlainObject(value) {
|
|
82
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
83
|
+
}
|
|
84
|
+
function hasOwn(obj, key) {
|
|
85
|
+
return Object.prototype.hasOwnProperty.call(obj, key);
|
|
86
|
+
}
|
|
87
|
+
// ── git, through spawnSync with a fixed argument list ───────────────────────
|
|
88
|
+
function git(cwd, args) {
|
|
89
|
+
const res = spawnSync("git", args, {
|
|
90
|
+
cwd,
|
|
91
|
+
encoding: "utf8",
|
|
92
|
+
maxBuffer: 256 * 1024 * 1024,
|
|
93
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
94
|
+
});
|
|
95
|
+
return { ok: res.error === undefined && res.status === 0, stdout: res.stdout ?? "" };
|
|
96
|
+
}
|
|
97
|
+
/** JSON with every object's keys sorted, so two equal looks digest alike. */
|
|
98
|
+
function canonicalJson(value) {
|
|
99
|
+
if (Array.isArray(value))
|
|
100
|
+
return `[${value.map(canonicalJson).join(",")}]`;
|
|
101
|
+
if (isPlainObject(value)) {
|
|
102
|
+
return `{${Object.keys(value)
|
|
103
|
+
.sort()
|
|
104
|
+
.map((key) => `${JSON.stringify(key)}:${canonicalJson(value[key])}`)
|
|
105
|
+
.join(",")}}`;
|
|
106
|
+
}
|
|
107
|
+
return JSON.stringify(value) ?? "null";
|
|
108
|
+
}
|
|
109
|
+
function digest(value) {
|
|
110
|
+
return createHash("sha256").update(canonicalJson(value)).digest("hex");
|
|
111
|
+
}
|
|
112
|
+
/** How long one hub read may take before it is refused. */
|
|
113
|
+
const REQUEST_TIMEOUT_MS = 15_000;
|
|
114
|
+
/** The `data` of an `{ ok: true, data }` answer to a GET; any other answer is refused. */
|
|
115
|
+
async function getData(fetch, url, headers, what) {
|
|
116
|
+
let res;
|
|
117
|
+
try {
|
|
118
|
+
// A redirect would re-send the key to another URL (as seed-flows.ts says).
|
|
119
|
+
res = await fetch(url, {
|
|
120
|
+
method: "GET",
|
|
121
|
+
headers,
|
|
122
|
+
redirect: "error",
|
|
123
|
+
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS),
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
catch {
|
|
127
|
+
refuse(`the ${what} could not be sent.`);
|
|
128
|
+
}
|
|
129
|
+
if (!res.ok)
|
|
130
|
+
refuse(`the ${what} answered ${res.status}.`);
|
|
131
|
+
let body;
|
|
132
|
+
try {
|
|
133
|
+
body = await res.json();
|
|
134
|
+
}
|
|
135
|
+
catch {
|
|
136
|
+
refuse(`the ${what} answered no JSON.`);
|
|
137
|
+
}
|
|
138
|
+
const data = isPlainObject(body) && body["ok"] === true ? body["data"] : undefined;
|
|
139
|
+
if (!isPlainObject(data))
|
|
140
|
+
refuse(`the ${what} answered no data.`);
|
|
141
|
+
return data;
|
|
142
|
+
}
|
|
143
|
+
/** The worked-out `settings.sections` of one read; refused when absent. */
|
|
144
|
+
function sectionsOf(settings, what) {
|
|
145
|
+
if (!isPlainObject(settings))
|
|
146
|
+
refuse(`the ${what} carries no worked-out settings.`);
|
|
147
|
+
const sections = settings["sections"];
|
|
148
|
+
if (!isPlainObject(sections))
|
|
149
|
+
refuse(`the ${what} carries no section settings.`);
|
|
150
|
+
return sections;
|
|
151
|
+
}
|
|
152
|
+
// ── Reading a value as a scalar ─────────────────────────────────────────────
|
|
153
|
+
/** Index of the quote closing the quoted scalar `text` opens with, or -1. */
|
|
154
|
+
function closingQuote(text) {
|
|
155
|
+
const quote = text[0];
|
|
156
|
+
for (let i = 1; i < text.length; i++) {
|
|
157
|
+
if (quote === '"' && text[i] === "\\") {
|
|
158
|
+
i++;
|
|
159
|
+
}
|
|
160
|
+
else if (text[i] === quote) {
|
|
161
|
+
if (quote === "'" && text[i + 1] === "'") {
|
|
162
|
+
i++;
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
return i;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return -1;
|
|
169
|
+
}
|
|
170
|
+
/** Plain scalars YAML 1.1 and 1.2 read differently, or read as null: never a copy. */
|
|
171
|
+
const AMBIGUOUS_PLAIN = /^(?:y|Y|yes|Yes|YES|n|N|no|No|NO|on|On|ON|off|Off|OFF|~|null|Null|NULL|True|TRUE|False|FALSE)$/;
|
|
172
|
+
/**
|
|
173
|
+
* A value span read as one scalar — a quoted string, `true`/`false`, a plain
|
|
174
|
+
* decimal number or a plain string — or undefined when it is anything else (a
|
|
175
|
+
* collection, an anchor, alias or tag, a block scalar, a value on more than
|
|
176
|
+
* one line, a form YAML versions read differently).
|
|
177
|
+
*/
|
|
178
|
+
function readScalar(raw) {
|
|
179
|
+
const text = raw.trim();
|
|
180
|
+
if (text === "" || text.includes("\n"))
|
|
181
|
+
return undefined;
|
|
182
|
+
const first = text[0];
|
|
183
|
+
if (first === '"' || first === "'") {
|
|
184
|
+
const close = closingQuote(text);
|
|
185
|
+
if (close < 0 || !/^\s*(?:#.*)?$/.test(text.slice(close + 1)))
|
|
186
|
+
return undefined;
|
|
187
|
+
const quoted = text.slice(0, close + 1);
|
|
188
|
+
if (first === "'")
|
|
189
|
+
return { value: quoted.slice(1, -1).replace(/''/g, "'") };
|
|
190
|
+
try {
|
|
191
|
+
const value = JSON.parse(quoted);
|
|
192
|
+
return typeof value === "string" ? { value } : undefined;
|
|
193
|
+
}
|
|
194
|
+
catch {
|
|
195
|
+
return undefined;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
if ("{[&*!|>%@`#".includes(first))
|
|
199
|
+
return undefined;
|
|
200
|
+
const plain = text.replace(/[ \t]+#.*$/, "");
|
|
201
|
+
if (plain === "true")
|
|
202
|
+
return { value: true };
|
|
203
|
+
if (plain === "false")
|
|
204
|
+
return { value: false };
|
|
205
|
+
if (AMBIGUOUS_PLAIN.test(plain))
|
|
206
|
+
return undefined;
|
|
207
|
+
if (/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]+)?(?:[eE][-+]?[0-9]+)?$/.test(plain)) {
|
|
208
|
+
return { value: Number(plain) };
|
|
209
|
+
}
|
|
210
|
+
if (/^[-+.0-9]/.test(plain) || /: |[,[\]{}#]/.test(plain))
|
|
211
|
+
return undefined;
|
|
212
|
+
return { value: plain };
|
|
213
|
+
}
|
|
214
|
+
/** The scalar section `index`'s `data` entry `field` holds in `text`, or undefined. */
|
|
215
|
+
function heldValue(section, text, field) {
|
|
216
|
+
const entry = section.entries.find((e) => e.key === field);
|
|
217
|
+
return entry === undefined ? undefined : readScalar(text.slice(entry.valueStart, entry.valueEnd));
|
|
218
|
+
}
|
|
219
|
+
// ── The pages ───────────────────────────────────────────────────────────────
|
|
220
|
+
/** Every `.mdx` under `dir` but `_site.mdx`, site-relative with `/`, sorted. */
|
|
221
|
+
function pageFiles(siteDir, dir) {
|
|
222
|
+
const out = [];
|
|
223
|
+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
224
|
+
const full = join(dir, entry.name);
|
|
225
|
+
if (entry.isDirectory())
|
|
226
|
+
out.push(...pageFiles(siteDir, full));
|
|
227
|
+
else if (entry.isFile() && entry.name.endsWith(".mdx") && entry.name !== "_site.mdx") {
|
|
228
|
+
out.push(relative(siteDir, full).split(sep).join("/"));
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
return out.sort();
|
|
232
|
+
}
|
|
233
|
+
/** The file's text at every commit that touched it, oldest last; `null` where it cannot be read; undefined when none did. */
|
|
234
|
+
function fileHistory(top, pathInRepo) {
|
|
235
|
+
const log = git(top, ["log", "--follow", "--format=%H", "--", pathInRepo]);
|
|
236
|
+
const shas = log.ok ? log.stdout.split("\n").filter((line) => line.trim() !== "") : [];
|
|
237
|
+
if (shas.length === 0)
|
|
238
|
+
return undefined;
|
|
239
|
+
return shas.map((sha) => {
|
|
240
|
+
const shown = git(top, ["show", `${sha.trim()}:${pathInRepo}`]);
|
|
241
|
+
return shown.ok ? shown.stdout : null;
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
/** The page's sections in `text`, or undefined when they cannot be read. */
|
|
245
|
+
function sectionsIn(text, file) {
|
|
246
|
+
try {
|
|
247
|
+
return locatePageSections(text, file);
|
|
248
|
+
}
|
|
249
|
+
catch (err) {
|
|
250
|
+
if (err instanceof TemplateError)
|
|
251
|
+
return undefined;
|
|
252
|
+
throw err;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Whether a look may set a field, read from its JSON Schema in the catalog —
|
|
257
|
+
* the rule `@working-theory/validation` applies to the zod schema (#12474 D7),
|
|
258
|
+
* which create-ailk cannot import: an enum, a const or a union of consts, a
|
|
259
|
+
* boolean, or a number with both ends and a maximum of at most 10 000.
|
|
260
|
+
*/
|
|
261
|
+
export function lookSettable(schema) {
|
|
262
|
+
if (!isPlainObject(schema))
|
|
263
|
+
return false;
|
|
264
|
+
if (Array.isArray(schema["enum"]) || "const" in schema || schema["type"] === "boolean")
|
|
265
|
+
return true;
|
|
266
|
+
if (Array.isArray(schema["anyOf"])) {
|
|
267
|
+
return schema["anyOf"].every((option) => isPlainObject(option) && "const" in option);
|
|
268
|
+
}
|
|
269
|
+
if (schema["type"] === "number" || schema["type"] === "integer") {
|
|
270
|
+
const min = schema["minimum"] ?? schema["exclusiveMinimum"];
|
|
271
|
+
const max = schema["maximum"] ?? schema["exclusiveMaximum"];
|
|
272
|
+
return typeof min === "number" && typeof max === "number" && max <= 10_000;
|
|
273
|
+
}
|
|
274
|
+
return false;
|
|
275
|
+
}
|
|
276
|
+
function planPage(siteDir, top, path, look, catalog) {
|
|
277
|
+
const abs = join(siteDir, path);
|
|
278
|
+
const text = readFileSync(abs, "utf8");
|
|
279
|
+
const plan = { path, text, next: text, lines: [], removed: [], kept: [] };
|
|
280
|
+
let pageType;
|
|
281
|
+
let located;
|
|
282
|
+
try {
|
|
283
|
+
pageType = pageTypeOf(text, path);
|
|
284
|
+
located = pageType === undefined ? undefined : locatePageSections(text, path);
|
|
285
|
+
}
|
|
286
|
+
catch (err) {
|
|
287
|
+
if (!(err instanceof TemplateError))
|
|
288
|
+
throw err;
|
|
289
|
+
plan.kept.push({ path, reason: "unreadable" });
|
|
290
|
+
plan.lines.push(`${path}: kept — its sections cannot be read`);
|
|
291
|
+
return plan;
|
|
292
|
+
}
|
|
293
|
+
const pageLook = pageType === undefined ? undefined : look[pageType];
|
|
294
|
+
if (located === undefined || !isPlainObject(pageLook))
|
|
295
|
+
return plan;
|
|
296
|
+
const steps = [];
|
|
297
|
+
located.forEach((section, index) => {
|
|
298
|
+
const sectionLook = hasOwn(pageLook, section.type) ? pageLook[section.type] : undefined;
|
|
299
|
+
if (!isPlainObject(sectionLook))
|
|
300
|
+
return;
|
|
301
|
+
const entryOf = hasOwn(catalog, section.type) ? catalog[section.type] : undefined;
|
|
302
|
+
const group = entryOf?.look ?? [];
|
|
303
|
+
const candidates = [];
|
|
304
|
+
for (const entry of section.entries) {
|
|
305
|
+
if (!group.includes(entry.key) || !hasOwn(sectionLook, entry.key))
|
|
306
|
+
continue;
|
|
307
|
+
// A field a look may not set is never put back by the look at render (#12474 D7), so its copy stays.
|
|
308
|
+
if (!lookSettable(hasOwn(entryOf.properties, entry.key) ? entryOf.properties[entry.key] : undefined))
|
|
309
|
+
continue;
|
|
310
|
+
const held = readScalar(text.slice(entry.valueStart, entry.valueEnd));
|
|
311
|
+
if (held !== undefined && held.value === sectionLook[entry.key]) {
|
|
312
|
+
candidates.push({ index, sectionType: section.type, field: entry.key, value: held.value });
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
if (candidates.length === 0)
|
|
316
|
+
return;
|
|
317
|
+
const keys = new Set(section.entries.map((e) => e.key));
|
|
318
|
+
const missing = Object.keys(sectionLook).find((field) => !keys.has(field));
|
|
319
|
+
const kept = { path, reason: "section", index, sectionType: section.type };
|
|
320
|
+
if (missing !== undefined) {
|
|
321
|
+
steps.push({ kind: "section", kept, line: `${path}: kept ${section.type} — the look sets ${section.type}.${missing}, which it does not hold` });
|
|
322
|
+
}
|
|
323
|
+
else if (candidates.length === section.entries.length) {
|
|
324
|
+
steps.push({ kind: "section", kept, line: `${path}: kept ${section.type} — every entry it holds is a look copy` });
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
327
|
+
for (const candidate of candidates)
|
|
328
|
+
steps.push({ kind: "copy", candidate });
|
|
329
|
+
}
|
|
330
|
+
});
|
|
331
|
+
// The history is read only for a page with a candidate copy.
|
|
332
|
+
const history = steps.some((step) => step.kind === "copy")
|
|
333
|
+
? fileHistory(top, relative(top, realpathSync(abs)).split(sep).join("/"))
|
|
334
|
+
: [];
|
|
335
|
+
if (history === undefined) {
|
|
336
|
+
plan.kept.push({ path, reason: "no-commit" });
|
|
337
|
+
plan.lines.push(`${path}: kept — no commit holds this file`);
|
|
338
|
+
return plan;
|
|
339
|
+
}
|
|
340
|
+
const versions = history.map((version) => (version === null ? undefined : { text: version, sections: sectionsIn(version, path) }));
|
|
341
|
+
let next = text;
|
|
342
|
+
for (const step of steps) {
|
|
343
|
+
if (step.kind === "section") {
|
|
344
|
+
plan.kept.push(step.kept);
|
|
345
|
+
plan.lines.push(step.line);
|
|
346
|
+
continue;
|
|
347
|
+
}
|
|
348
|
+
const { index, sectionType, field, value } = step.candidate;
|
|
349
|
+
const unchanged = versions.every((version) => {
|
|
350
|
+
const section = version?.sections?.[index];
|
|
351
|
+
return section !== undefined && section.type === sectionType && heldValue(section, version.text, field)?.value === value;
|
|
352
|
+
});
|
|
353
|
+
if (unchanged) {
|
|
354
|
+
next = removeSectionLookField(next, path, index, field);
|
|
355
|
+
plan.removed.push({ path, index, sectionType, field });
|
|
356
|
+
plan.lines.push(`${path}: ${sectionType}.${field}`);
|
|
357
|
+
}
|
|
358
|
+
else {
|
|
359
|
+
plan.kept.push({ path, reason: "edited", index, sectionType, field });
|
|
360
|
+
plan.lines.push(`${path}: kept ${sectionType}.${field} — changed since the file's first commit`);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
return { ...plan, next };
|
|
364
|
+
}
|
|
365
|
+
// ── The command ─────────────────────────────────────────────────────────────
|
|
366
|
+
function branchDate(now) {
|
|
367
|
+
const pad = (n) => String(n).padStart(2, "0");
|
|
368
|
+
return `${now.getFullYear()}${pad(now.getMonth() + 1)}${pad(now.getDate())}`;
|
|
369
|
+
}
|
|
370
|
+
const plural = (n, one, many) => `${n} ${n === 1 ? one : many}`;
|
|
371
|
+
export async function stripLookCopies(opts) {
|
|
372
|
+
const siteDir = resolve(opts.targetDir);
|
|
373
|
+
const env = opts.env ?? process.env;
|
|
374
|
+
const onLine = opts.onLine ?? (() => undefined);
|
|
375
|
+
const apply = opts.apply === true;
|
|
376
|
+
// Credentials (#10204 D2), every one before any request.
|
|
377
|
+
const agentKey = given(env[AGENT_KEY_ENV_VAR]);
|
|
378
|
+
if (agentKey === undefined) {
|
|
379
|
+
refuse(`set ${AGENT_KEY_ENV_VAR} to an agent key that may read the workspace's design. It is read from the environment only — never a flag or a file.`);
|
|
380
|
+
}
|
|
381
|
+
const workspaceId = given(opts.workspaceId) ?? given(env[WORKSPACE_ID_ENV_VAR]);
|
|
382
|
+
if (workspaceId === undefined) {
|
|
383
|
+
refuse(`no workspace id was given. Pass --workspace <wksp_id>, or set ${WORKSPACE_ID_ENV_VAR}.`);
|
|
384
|
+
}
|
|
385
|
+
if (!WORKSPACE_ID_RE.test(workspaceId)) {
|
|
386
|
+
refuse("the workspace id is malformed: letters, digits, _ and - only.");
|
|
387
|
+
}
|
|
388
|
+
const flagOrigin = given(opts.apiUrl);
|
|
389
|
+
const source = flagOrigin !== undefined ? "--api-url" : HUB_ORIGIN_ENV_VAR;
|
|
390
|
+
const rawOrigin = flagOrigin ?? given(env[HUB_ORIGIN_ENV_VAR]);
|
|
391
|
+
if (rawOrigin === undefined) {
|
|
392
|
+
refuse(`no API origin was given. Pass --api-url <origin>, or set ${HUB_ORIGIN_ENV_VAR}.`);
|
|
393
|
+
}
|
|
394
|
+
let origin;
|
|
395
|
+
try {
|
|
396
|
+
origin = normalizeHubUrl(rawOrigin);
|
|
397
|
+
}
|
|
398
|
+
catch (err) {
|
|
399
|
+
if (!(err instanceof TopologyError))
|
|
400
|
+
throw err;
|
|
401
|
+
refuse(`the API origin must be an https: origin (http: only on a loopback host) with no path, query, fragment or credentials (from ${source}).`);
|
|
402
|
+
}
|
|
403
|
+
// The site, inside a git work tree.
|
|
404
|
+
let isDir = false;
|
|
405
|
+
try {
|
|
406
|
+
isDir = statSync(siteDir).isDirectory();
|
|
407
|
+
}
|
|
408
|
+
catch {
|
|
409
|
+
// Refused below.
|
|
410
|
+
}
|
|
411
|
+
if (!isDir)
|
|
412
|
+
refuse(`${opts.targetDir} is not a directory.`);
|
|
413
|
+
// On a spoke, the workspace and origin are the ones its env files name, and
|
|
414
|
+
// the spoke key goes only there; a hub site sends none.
|
|
415
|
+
let isSpoke;
|
|
416
|
+
try {
|
|
417
|
+
isSpoke = readSiteTopology(siteDir) === "spoke";
|
|
418
|
+
}
|
|
419
|
+
catch (err) {
|
|
420
|
+
if (!(err instanceof TopologyError))
|
|
421
|
+
throw err;
|
|
422
|
+
refuse(`${err.message}.`);
|
|
423
|
+
}
|
|
424
|
+
if (isSpoke) {
|
|
425
|
+
const mismatch = spokeWorkspaceMismatch(siteDir, workspaceId) ?? spokeOriginMismatch(siteDir, origin);
|
|
426
|
+
if (mismatch !== undefined)
|
|
427
|
+
refuse(`${mismatch}.`);
|
|
428
|
+
}
|
|
429
|
+
const spokeKey = isSpoke ? given(env[SPOKE_KEY_ENV_VAR]) : undefined;
|
|
430
|
+
const toplevel = git(siteDir, ["rev-parse", "--show-toplevel"]);
|
|
431
|
+
if (!toplevel.ok || toplevel.stdout.trim() === "") {
|
|
432
|
+
refuse(`${opts.targetDir} is not inside a git work tree; the import reads each page's history.`);
|
|
433
|
+
}
|
|
434
|
+
const top = realpathSync(toplevel.stdout.trim());
|
|
435
|
+
const realSite = realpathSync(siteDir);
|
|
436
|
+
onLine(`Reading the look of workspace ${workspaceId} at ${origin} (from ${source}).${apply ? "" : " Nothing is written without --apply."}`);
|
|
437
|
+
// The look, and the site's own read of it (D10).
|
|
438
|
+
const fetch = opts.fetch ?? globalThis.fetch;
|
|
439
|
+
const member = await getData(fetch, `${origin}/v1/workspaces/${workspaceId}/design`, { accept: "application/json", authorization: `Bearer ${agentKey}` }, "design read");
|
|
440
|
+
if (!isPlainObject(member["design"])) {
|
|
441
|
+
refuse("the design read found no design record for the workspace; import its look into the record first.");
|
|
442
|
+
}
|
|
443
|
+
const look = sectionsOf(member["settings"], "design read");
|
|
444
|
+
const site = await getData(fetch, `${origin}/v1/content/site-config`, spokeKey === undefined
|
|
445
|
+
? { accept: "application/json" }
|
|
446
|
+
: { accept: "application/json", "x-ailk-spoke-key": spokeKey }, "site-config read");
|
|
447
|
+
const siteDesign = site["design"];
|
|
448
|
+
if (!isPlainObject(siteDesign)) {
|
|
449
|
+
refuse("the site-config read carries no design, so the site does not render from the hub's look.");
|
|
450
|
+
}
|
|
451
|
+
const siteLook = sectionsOf(siteDesign["settings"], "site-config read");
|
|
452
|
+
if (siteDesign["version"] !== member["version"]) {
|
|
453
|
+
refuse(`the site-config read's design is at version ${JSON.stringify(siteDesign["version"])}, the design read's at version ${JSON.stringify(member["version"])}; the site does not render from this look.`);
|
|
454
|
+
}
|
|
455
|
+
if (digest(siteLook) !== digest(look)) {
|
|
456
|
+
refuse("the site-config read's section settings differ from the design read's; the site does not render from this look.");
|
|
457
|
+
}
|
|
458
|
+
// The pages.
|
|
459
|
+
const catalog = readSectionLookCatalog(opts.catalogPath);
|
|
460
|
+
const contentDir = join(realSite, "content");
|
|
461
|
+
let hasContent = false;
|
|
462
|
+
try {
|
|
463
|
+
hasContent = statSync(contentDir).isDirectory();
|
|
464
|
+
}
|
|
465
|
+
catch {
|
|
466
|
+
// No content: nothing to remove.
|
|
467
|
+
}
|
|
468
|
+
const plans = (hasContent ? pageFiles(realSite, contentDir) : []).map((path) => planPage(realSite, top, path, look, catalog));
|
|
469
|
+
const removed = plans.flatMap((plan) => plan.removed);
|
|
470
|
+
const kept = plans.flatMap((plan) => plan.kept);
|
|
471
|
+
const changed = plans.filter((plan) => plan.next !== plan.text);
|
|
472
|
+
const total = `${plural(removed.length, "look copy", "look copies")} to remove in ${plural(changed.length, "page", "pages")}.`;
|
|
473
|
+
const printPages = () => plans.forEach((plan) => plan.lines.forEach(onLine));
|
|
474
|
+
if (!apply || removed.length === 0) {
|
|
475
|
+
printPages();
|
|
476
|
+
onLine(removed.length === 0 ? "Nothing to remove." : total);
|
|
477
|
+
if (!apply)
|
|
478
|
+
onLine("Dry run: nothing was written. Re-run with --apply to remove them.");
|
|
479
|
+
return { removed, kept, written: [] };
|
|
480
|
+
}
|
|
481
|
+
// --apply: every check before the first change.
|
|
482
|
+
const status = git(top, ["status", "--porcelain"]);
|
|
483
|
+
if (!status.ok)
|
|
484
|
+
refuse("git status could not be read.");
|
|
485
|
+
if (status.stdout.trim() !== "") {
|
|
486
|
+
refuse("the work tree has uncommitted changes. Commit or stash them first, so the import's diff is its own.");
|
|
487
|
+
}
|
|
488
|
+
for (const plan of changed) {
|
|
489
|
+
if (readFileSync(join(realSite, plan.path), "utf8") !== plan.text) {
|
|
490
|
+
refuse(`${plan.path} changed while the import read it. Re-run.`);
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
const current = git(top, ["symbolic-ref", "--quiet", "--short", "HEAD"]);
|
|
494
|
+
const currentBranch = current.ok ? current.stdout.trim() : undefined;
|
|
495
|
+
const defaults = new Set(["main", "master"]);
|
|
496
|
+
const originHead = git(top, ["symbolic-ref", "--quiet", "--short", "refs/remotes/origin/HEAD"]);
|
|
497
|
+
if (originHead.ok)
|
|
498
|
+
defaults.add(originHead.stdout.trim().replace(/^origin\//, ""));
|
|
499
|
+
let branch = currentBranch;
|
|
500
|
+
if (currentBranch === undefined || defaults.has(currentBranch)) {
|
|
501
|
+
branch = `${LOOK_COPY_IMPORT_BRANCH_PREFIX}${branchDate(opts.now ?? new Date())}`;
|
|
502
|
+
if (!git(top, ["switch", "--quiet", "-c", branch]).ok) {
|
|
503
|
+
refuse(`could not create and switch to ${branch}; it may already exist. Switch to a branch that is not the default branch and re-run.`);
|
|
504
|
+
}
|
|
505
|
+
onLine(`Switched to a new branch ${branch}: ${currentBranch === undefined ? "HEAD was detached" : `${currentBranch} is the default branch`}.`);
|
|
506
|
+
}
|
|
507
|
+
printPages();
|
|
508
|
+
for (const plan of changed)
|
|
509
|
+
writeFileSync(join(realSite, plan.path), plan.next);
|
|
510
|
+
onLine(`Removed ${plural(removed.length, "look copy", "look copies")} from ${plural(changed.length, "page", "pages")} on ${branch}.`);
|
|
511
|
+
onLine(`Next: review the diff (git diff), commit it, push ${branch} and open a pull request. This command commits, pushes and opens nothing itself.`);
|
|
512
|
+
return {
|
|
513
|
+
removed,
|
|
514
|
+
kept,
|
|
515
|
+
written: changed.map((plan) => plan.path),
|
|
516
|
+
...(branch !== undefined && { branch }),
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
export const STRIP_LOOK_COPIES_HELP = `create-ailk strip-look-copies — remove from a site's page files the section look values its look already sets.
|
|
520
|
+
|
|
521
|
+
Usage:
|
|
522
|
+
AILK_AGENT_KEY=<key> create-ailk strip-look-copies [<dir>] [--apply] [--api-url <origin>] [--workspace <wksp_id>]
|
|
523
|
+
|
|
524
|
+
Arguments:
|
|
525
|
+
<dir> The site, inside a git work tree. Defaults to the
|
|
526
|
+
current dir.
|
|
527
|
+
|
|
528
|
+
Options:
|
|
529
|
+
--apply Write the files. Without it the command prints what
|
|
530
|
+
it would remove and writes nothing.
|
|
531
|
+
--api-url <origin> The API origin that holds the workspace — on a
|
|
532
|
+
spoke, its hub's. Else AILK_API_URL. https: only
|
|
533
|
+
(http: on localhost or 127.0.0.1).
|
|
534
|
+
--workspace <wksp_id> The workspace whose look is read. Else
|
|
535
|
+
AILK_WORKSPACE_ID.
|
|
536
|
+
-h, --help Show this help.
|
|
537
|
+
|
|
538
|
+
The look is the workspace design's worked-out section settings, read with the
|
|
539
|
+
agent key from AILK_AGENT_KEY only. The site's own read of it,
|
|
540
|
+
GET /v1/content/site-config, is sent on a spoke with AILK_SPOKE_KEY when it
|
|
541
|
+
is set, and keyless otherwise, and must carry the same design version and
|
|
542
|
+
section settings; else the command refuses. On a spoke, a workspace or origin
|
|
543
|
+
other than the one its apps/web/.env or .env.local names is refused. No key is
|
|
544
|
+
printed.
|
|
545
|
+
|
|
546
|
+
A section entry in a content/ page (not _site.mdx) is removed when its field
|
|
547
|
+
is a look field of its section type, the look sets it to the same value, the
|
|
548
|
+
look sets no field the section lacks, and the entry is unchanged in every
|
|
549
|
+
commit of the file since the one that added it. Any other entry stays: a
|
|
550
|
+
value that differs, one a commit changed (listed as edited), a section the
|
|
551
|
+
look would add a field to (listed as kept), a file no commit holds. Only the
|
|
552
|
+
entry and one separator are removed; every other byte stays.
|
|
553
|
+
|
|
554
|
+
The dry run prints one line per removal, <path>: <sectionType>.<field> (no
|
|
555
|
+
values), and a total. --apply refuses a dirty work tree; on the default
|
|
556
|
+
branch (main, master, or the one origin/HEAD names) it first creates and
|
|
557
|
+
switches to look-copy-import/<YYYYMMDD>; then it writes the files and prints
|
|
558
|
+
the next steps. It never commits, pushes or opens a pull request. A second
|
|
559
|
+
run reports nothing to remove. Exit 0 on success, 2 on a refusal (nothing is
|
|
560
|
+
written).
|
|
561
|
+
`;
|
|
562
|
+
export function parseStripLookCopiesArgs(argv) {
|
|
563
|
+
let parsed;
|
|
564
|
+
try {
|
|
565
|
+
parsed = parseArgs({
|
|
566
|
+
args: argv,
|
|
567
|
+
strict: true,
|
|
568
|
+
allowPositionals: true,
|
|
569
|
+
options: {
|
|
570
|
+
apply: { type: "boolean", default: false },
|
|
571
|
+
"api-url": { type: "string" },
|
|
572
|
+
workspace: { type: "string" },
|
|
573
|
+
help: { type: "boolean", default: false, short: "h" },
|
|
574
|
+
},
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
catch (err) {
|
|
578
|
+
throw new ParseError(`strip-look-copies: ${err.message}`);
|
|
579
|
+
}
|
|
580
|
+
const [target, ...rest] = parsed.positionals;
|
|
581
|
+
if (rest.length > 0) {
|
|
582
|
+
throw new ParseError(`strip-look-copies takes at most one target directory, got ${parsed.positionals.length} arguments`);
|
|
583
|
+
}
|
|
584
|
+
return {
|
|
585
|
+
target,
|
|
586
|
+
apply: parsed.values.apply === true,
|
|
587
|
+
apiUrl: parsed.values["api-url"],
|
|
588
|
+
workspaceId: parsed.values.workspace,
|
|
589
|
+
help: parsed.values.help === true,
|
|
590
|
+
};
|
|
591
|
+
}
|
|
@@ -29,16 +29,6 @@ import { type BuildableShape, type TemplateAlias } from "./starter-grid.js";
|
|
|
29
29
|
*/
|
|
30
30
|
export declare const STARTER_SHAPES: readonly ["organization-product", "organization-service", "local-business-service", "local-business-product", "person-service"];
|
|
31
31
|
export type StarterShape = (typeof STARTER_SHAPES)[number];
|
|
32
|
-
/**
|
|
33
|
-
* The closed **design** enum (same contract section) — the look applied to
|
|
34
|
-
* any shape; orthogonal to it by construction. Each name RESOLVES to a
|
|
35
|
-
* package at `site-templates/designs/<name>/` (#6813 D2/D3, D11 pins this set
|
|
36
|
-
* equal to that directory listing): `resolveDesign` (`design-scaffold.ts`)
|
|
37
|
-
* reads the package's own `layout`, `colors` and treatments — no design fact
|
|
38
|
-
* lives in this module, or anywhere in `packages/create-ailk/src`, any more.
|
|
39
|
-
*/
|
|
40
|
-
export declare const STARTER_DESIGNS: readonly ["standard", "minimalism"];
|
|
41
|
-
export type StarterDesign = (typeof STARTER_DESIGNS)[number];
|
|
42
32
|
/**
|
|
43
33
|
* One site template: its fixed module list and the page rows it brings itself.
|
|
44
34
|
*
|
|
@@ -90,9 +80,11 @@ export interface TemplateManifest {
|
|
|
90
80
|
/**
|
|
91
81
|
* The design this template renders (same contract section) — the look,
|
|
92
82
|
* orthogonal to `shape` by construction: any design applies to any shape.
|
|
93
|
-
*
|
|
83
|
+
* One of `shippedDesigns()` (`design-names.ts`, #12500 D6) — the looks are
|
|
84
|
+
* read from the installer's design directory, so a test, not the compiler,
|
|
85
|
+
* holds each manifest's design to that list.
|
|
94
86
|
*/
|
|
95
|
-
design:
|
|
87
|
+
design: string;
|
|
96
88
|
/**
|
|
97
89
|
* The template this one EXTENDS — its lineage, never its level (#5618 D2).
|
|
98
90
|
* A single parent, not a list: "later layers win file by file" needs a
|
|
@@ -113,8 +105,8 @@ export interface TemplateManifest {
|
|
|
113
105
|
* Site-level chrome knobs (#5612 D1) — nav/footer/banner/home. Every field
|
|
114
106
|
* optional; a template declaring none (all four settled entries below)
|
|
115
107
|
* renders byte-identically to before this field existed. See
|
|
116
|
-
* `site-chrome.ts` for the vocabulary
|
|
117
|
-
* `
|
|
108
|
+
* `site-chrome.ts` for the vocabulary and defaults; the knobs reach a site
|
|
109
|
+
* as its hub design record's layout changes (`look-record.ts`, #12477).
|
|
118
110
|
*/
|
|
119
111
|
layout?: TemplateLayout;
|
|
120
112
|
}
|
|
@@ -17,15 +17,6 @@ export const STARTER_SHAPES = [
|
|
|
17
17
|
"local-business-product",
|
|
18
18
|
"person-service",
|
|
19
19
|
];
|
|
20
|
-
/**
|
|
21
|
-
* The closed **design** enum (same contract section) — the look applied to
|
|
22
|
-
* any shape; orthogonal to it by construction. Each name RESOLVES to a
|
|
23
|
-
* package at `site-templates/designs/<name>/` (#6813 D2/D3, D11 pins this set
|
|
24
|
-
* equal to that directory listing): `resolveDesign` (`design-scaffold.ts`)
|
|
25
|
-
* reads the package's own `layout`, `colors` and treatments — no design fact
|
|
26
|
-
* lives in this module, or anywhere in `packages/create-ailk/src`, any more.
|
|
27
|
-
*/
|
|
28
|
-
export const STARTER_DESIGNS = ["standard", "minimalism"];
|
|
29
20
|
/**
|
|
30
21
|
* The base layer's directory under `site-templates/` (#5618 D1) — the seed
|
|
31
22
|
* files every template reaches by declaring `extends`, installed by
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
export declare const TEMPLATE_RECORD_PATH = ".ailk-template-files.json";
|
|
3
3
|
/**
|
|
4
4
|
* The app paths a generator rewrites after `copyTemplate` lands its copy
|
|
5
|
-
* (§1): the nav, the site chrome
|
|
5
|
+
* (§1): the nav, the retired site chrome and site fonts (no generator writes
|
|
6
|
+
* them since #12477; listed so `update` never records them and only its
|
|
7
|
+
* look retirement removes them), the paid-sections
|
|
6
8
|
* registry and its module-presence flags (#8843 D10), the paid MCP tool
|
|
7
9
|
* registry (#9460 DD6; `update` rewrites it every run, #9567), the four spoke seams, and a commerce spoke's checkout config,
|
|
8
10
|
* which the checkout writer stamps and the site owns from then on (#8748
|
package/dist/template-record.js
CHANGED
|
@@ -35,7 +35,9 @@ import { AUTH_CONFIG_PATH, SPOKE_SEAM_FILES } from "./topology.js";
|
|
|
35
35
|
export const TEMPLATE_RECORD_PATH = ".ailk-template-files.json";
|
|
36
36
|
/**
|
|
37
37
|
* The app paths a generator rewrites after `copyTemplate` lands its copy
|
|
38
|
-
* (§1): the nav, the site chrome
|
|
38
|
+
* (§1): the nav, the retired site chrome and site fonts (no generator writes
|
|
39
|
+
* them since #12477; listed so `update` never records them and only its
|
|
40
|
+
* look retirement removes them), the paid-sections
|
|
39
41
|
* registry and its module-presence flags (#8843 D10), the paid MCP tool
|
|
40
42
|
* registry (#9460 DD6; `update` rewrites it every run, #9567), the four spoke seams, and a commerce spoke's checkout config,
|
|
41
43
|
* which the checkout writer stamps and the site owns from then on (#8748
|