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
package/dist/programmatic.js
CHANGED
|
@@ -15,19 +15,19 @@
|
|
|
15
15
|
* import { scaffoldSync } from './programmatic.js';
|
|
16
16
|
* const result = scaffoldSync({ targetDir: '/tmp/my-site', projectName: 'my-site' });
|
|
17
17
|
*/
|
|
18
|
-
import { existsSync,
|
|
18
|
+
import { existsSync, readdirSync, readFileSync, rmdirSync, rmSync, statSync, writeFileSync, } from "node:fs";
|
|
19
19
|
import { basename, dirname, join, relative, resolve, sep } from "node:path";
|
|
20
20
|
import { fileURLToPath } from "node:url";
|
|
21
21
|
import { AddModuleRefusedError, addModuleSiteTopology, applyModuleToScaffold, } from "./add-module.js";
|
|
22
|
-
import { planDesignMd } from "./apply-design-md.js";
|
|
23
22
|
import { renderClaudeMd, syncClaudeMd, } from "./claude-md.js";
|
|
24
23
|
import { CATALOG_TARGET_PATH, writeComponentCatalog, } from "./component-catalog.js";
|
|
25
24
|
import { buildScaffoldMarkers, copyTemplate } from "./copy.js";
|
|
26
25
|
import { deriveArchitecture } from "./derive-architecture.js";
|
|
27
|
-
import {
|
|
26
|
+
import { compileDesignTheme } from "./design-compile.js";
|
|
27
|
+
import { DESIGN_GUIDE_FILE, DESIGN_SETTINGS_FILE, LOOK_FILE, guideCopiedFrom, planDesignFiles } from "./design-files.js";
|
|
28
28
|
import { DESIGN_SEED_PAGES, designHomeSeeds, planDesignHome, shapeHomePath, shippedHomeSeeds, siteIdentityName, } from "./design-home.js";
|
|
29
|
-
import {
|
|
30
|
-
import { resolveDesign,
|
|
29
|
+
import { readSectionLookCatalog, shippedPageTypes, validateDesignPresets, } from "./design-presets.js";
|
|
30
|
+
import { resolveDesign, } from "./design-scaffold.js";
|
|
31
31
|
import { writeAuthSecretFile } from "./lib/auth-secret-file.js";
|
|
32
32
|
import { appendEnvRows } from "./lib/declared-env.js";
|
|
33
33
|
import { ENV_CATALOG } from "./lib/env-catalog.js";
|
|
@@ -36,14 +36,14 @@ import { fetchTemplate } from "./lib/fetch-template.js";
|
|
|
36
36
|
import { assertLicenseKeyShape, writeLicenseKeyFiles, } from "./lib/license-key-files.js";
|
|
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
|
+
import { fillLookSamples, readLookSamples } from "./look-samples.js";
|
|
39
40
|
import { normalizeModules } from "./module-architecture.js";
|
|
40
41
|
import { withLevelMcpPackages, writePaidSections } from "./paid-sections.js";
|
|
41
42
|
import { RECOGNIZED_SHAPES, RESERVED_SHAPES, } from "./parse-args.js";
|
|
42
43
|
import { RemoveModuleRefusedError, removeModuleFromScaffold, } from "./remove-module.js";
|
|
43
44
|
import { scaffoldSeamRows } from "./seam-refresh.js";
|
|
44
45
|
import { writeSpokeFlowsReadme } from "./seed-flows.js";
|
|
45
|
-
import {
|
|
46
|
-
import { SITE_FONTS_PATH, renderSiteFonts } from "./site-fonts.js";
|
|
46
|
+
import { resolveSiteChrome } from "./site-chrome.js";
|
|
47
47
|
import { planSiteManifest } from "./site-manifest.js";
|
|
48
48
|
import { SITE_ROSTER_PATH, planHomeRecord, planSiteManifestDesign, readSiteRoster, withMeetPlaceholderSeeds, } from "./site-roster.js";
|
|
49
49
|
import { LEAD_SITE_ENV_VAR, dropSpokeCheckoutDependency, spokeCheckoutSite, spokeEnvRowOptions, writeSpokeCheckoutSlice, } from "./spoke-checkout.js";
|
|
@@ -97,24 +97,6 @@ function countFiles(dir) {
|
|
|
97
97
|
}
|
|
98
98
|
return count;
|
|
99
99
|
}
|
|
100
|
-
/** Every `.mdx` file under `dir`, recursively, sorted (#6816 D6). */
|
|
101
|
-
function listMdxFiles(dir) {
|
|
102
|
-
if (!existsSync(dir))
|
|
103
|
-
return [];
|
|
104
|
-
const out = [];
|
|
105
|
-
const stack = [dir];
|
|
106
|
-
while (stack.length > 0) {
|
|
107
|
-
const current = stack.pop();
|
|
108
|
-
for (const entry of readdirSync(current, { withFileTypes: true })) {
|
|
109
|
-
const abs = join(current, entry.name);
|
|
110
|
-
if (entry.isDirectory())
|
|
111
|
-
stack.push(abs);
|
|
112
|
-
else if (entry.name.endsWith(".mdx"))
|
|
113
|
-
out.push(abs);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
return out.sort();
|
|
117
|
-
}
|
|
118
100
|
/**
|
|
119
101
|
* The template a `shape` scaffolds (#6754 D5, extended #6757 D6 row 1): the
|
|
120
102
|
* one FREE-delivery manifest of that shape — a declared `--template` alias
|
|
@@ -217,12 +199,6 @@ export function scaffoldSync(opts, copied) {
|
|
|
217
199
|
// the template's copy in place would link /docs and /blog sitewide in a
|
|
218
200
|
// scaffold that carries neither route.
|
|
219
201
|
writeFileSync(join(targetAbs, NAV_CONFIG_PATH), renderNavConfig(enabledSurfaces));
|
|
220
|
-
// Site-level chrome knobs (#5612 D2) — beside nav-config.ts, same GENERATED
|
|
221
|
-
// idiom. `opts.layout` is set only by `scaffold()`, from the resolved
|
|
222
|
-
// template's `layout` block; a bare `scaffoldSync` call (every existing
|
|
223
|
-
// synchronous caller) writes DEFAULT_SITE_CHROME, byte-identical to the
|
|
224
|
-
// monorepo's own committed apps/web/lib/site-chrome.ts.
|
|
225
|
-
writeFileSync(join(targetAbs, SITE_CHROME_PATH), renderSiteChrome(resolveSiteChrome(opts.layout, opts.designLayout)));
|
|
226
202
|
// The paid-sections registry (#7536), from this scaffold's own
|
|
227
203
|
// `apps/web/package.json` — on the keyless snapshot, the all-stub render.
|
|
228
204
|
// `scaffold()` writes it again once every layer has landed.
|
|
@@ -307,7 +283,7 @@ export async function scaffold(opts) {
|
|
|
307
283
|
// #6813 D8 step 3 — the design this scaffold renders, resolved from its
|
|
308
284
|
// package ONCE, before any fetch or write: the caller's override, else the
|
|
309
285
|
// template's own. Unset for a scaffold naming neither. Replaces the
|
|
310
|
-
// `
|
|
286
|
+
// `shippedDesigns().includes` name check: an unrecognized name or a missing
|
|
311
287
|
// directory throws `TemplateError` here; a malformed package throws
|
|
312
288
|
// `DesignPackageError` (never caught), each naming the field.
|
|
313
289
|
const designRef = opts.design ?? template?.design;
|
|
@@ -328,7 +304,7 @@ export async function scaffold(opts) {
|
|
|
328
304
|
validateDesignPresets(resolvedDesign.pkg.sections, {
|
|
329
305
|
catalog: catalog(),
|
|
330
306
|
pageTypes: shippedPageTypes(SITE_TEMPLATES_DIR),
|
|
331
|
-
file: join(resolvedDesign.dir, "
|
|
307
|
+
file: join(resolvedDesign.dir, "design.yaml"),
|
|
332
308
|
});
|
|
333
309
|
}
|
|
334
310
|
// #7743 D5 — the design's home seeds are read and validated beside its
|
|
@@ -341,6 +317,13 @@ export async function scaffold(opts) {
|
|
|
341
317
|
const designContactSeeds = resolvedDesign !== undefined
|
|
342
318
|
? designHomeSeeds(resolvedDesign, { designsDir: DESIGNS_DIR, catalog, page: "contact" })
|
|
343
319
|
: [];
|
|
320
|
+
// #12472 D3 — the design's sample images, checked for form and read here,
|
|
321
|
+
// before the target is created: a malformed manifest, file or LOOK.md
|
|
322
|
+
// throws `LookSamplesError` naming it. Undefined for a design with no
|
|
323
|
+
// `samples/` (both shipped looks today), which copies and fills nothing.
|
|
324
|
+
const lookSamples = resolvedDesign !== undefined
|
|
325
|
+
? readLookSamples(resolvedDesign.dir, { designsDir: DESIGNS_DIR })
|
|
326
|
+
: undefined;
|
|
344
327
|
// #6813 D7 — the resolved design only when the CALLER chose one (`opts.design`);
|
|
345
328
|
// a template's own declared design is never gated (#6778 option (c)).
|
|
346
329
|
const chosenDesign = opts.design !== undefined ? resolvedDesign : undefined;
|
|
@@ -564,15 +547,6 @@ export async function scaffold(opts) {
|
|
|
564
547
|
modules,
|
|
565
548
|
...(spoke !== undefined ? { topology: "spoke", mcp: spoke.mcp } : {}),
|
|
566
549
|
...(surfaces !== undefined ? { surfaces } : {}),
|
|
567
|
-
// #5612 D1/D2 — the code registry's own `layout` block, known
|
|
568
|
-
// synchronously (unlike a bundle's `ailk-template.json`, only readable
|
|
569
|
-
// after install below). A template declaring none resolves to its
|
|
570
|
-
// design's knobs (#6638), and a `standard` one to the same defaults
|
|
571
|
-
// `scaffoldSync` already writes for a templateless scaffold.
|
|
572
|
-
...(template?.layout !== undefined ? { layout: template.layout } : {}),
|
|
573
|
-
// #6813 D8 step 6 — the resolved design's OWN layout (never its name):
|
|
574
|
-
// `resolveSiteChrome` reads a layout object now, not a `StarterDesign`.
|
|
575
|
-
...(resolvedDesign !== undefined ? { designLayout: resolvedDesign.pkg.layout } : {}),
|
|
576
550
|
}, copied);
|
|
577
551
|
// #6460 — the SAME marker map `scaffoldSync` just substituted the base
|
|
578
552
|
// `templates/` copy with, rebuilt here from the same inputs (`scaffold()`
|
|
@@ -665,9 +639,8 @@ export async function scaffold(opts) {
|
|
|
665
639
|
// (validated by `readAilkTemplateManifest`), if it declares one. Read
|
|
666
640
|
// only now: it lives in the bundle/tree, unreachable before install. When
|
|
667
641
|
// declared, it is authoritative over the code registry's `template.layout`
|
|
668
|
-
//
|
|
669
|
-
//
|
|
670
|
-
// `scaffoldSync` stands untouched.
|
|
642
|
+
// in the manifest's record below. No layout file is written: the site's
|
|
643
|
+
// layout knobs are its hub design record's (#12477 D4).
|
|
671
644
|
const installed = templateBundle !== undefined
|
|
672
645
|
? await extractModuleBundle({
|
|
673
646
|
bytes: templateBundle,
|
|
@@ -702,9 +675,6 @@ export async function scaffold(opts) {
|
|
|
702
675
|
});
|
|
703
676
|
})();
|
|
704
677
|
installedLayout = installed.layout;
|
|
705
|
-
if (installed.layout !== undefined) {
|
|
706
|
-
writeFileSync(join(result.targetDir, SITE_CHROME_PATH), renderSiteChrome(resolveSiteChrome(installed.layout, resolvedDesign?.pkg.layout)));
|
|
707
|
-
}
|
|
708
678
|
// #6878 D6 — re-render the nav with the SERVICE slugs the installed tree
|
|
709
679
|
// just landed (`content/en/Service/*.mdx`, absent on a product shape),
|
|
710
680
|
// now that `content/en/Service` exists to read. `scaffoldSync`'s own
|
|
@@ -726,51 +696,62 @@ export async function scaffold(opts) {
|
|
|
726
696
|
pruneUnrosteredSeeds(result.targetDir, mergeRoster(template, template.requires), result.surfaces, ownership);
|
|
727
697
|
}
|
|
728
698
|
// #6813 D5/D8 steps 9-10 — whenever a design is resolved (the caller's,
|
|
729
|
-
// else the template's): the design's
|
|
730
|
-
//
|
|
731
|
-
//
|
|
699
|
+
// else the template's): the design's design.yaml and guide (#6939, #12468);
|
|
700
|
+
// then the site manifest records the APPLIED design, only when a template
|
|
701
|
+
// installed one (`saas-product` ships none). No look file is written — no
|
|
702
|
+
// `theme:` block, layout or faces file, no section preset copy: the site
|
|
703
|
+
// renders its look from its hub design record, which the seed writes
|
|
704
|
+
// (#12477 D4).
|
|
732
705
|
// A scaffold naming neither a design nor a template (the bare overlay)
|
|
733
706
|
// executes no new statement.
|
|
734
707
|
if (resolvedDesign !== undefined) {
|
|
735
|
-
// #6939 — the scaffold's
|
|
736
|
-
//
|
|
737
|
-
|
|
738
|
-
//
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
writeFileSync(
|
|
753
|
-
|
|
754
|
-
|
|
708
|
+
// #6939, #12468 D5 — the scaffold's design.yaml is the design it wears,
|
|
709
|
+
// under the site's provenance lines: the template's name for every
|
|
710
|
+
// template but a bare-shape starter, which keeps the overlay's `_base`
|
|
711
|
+
// line. Then the design's guide, copied whole, at DESIGN.md.
|
|
712
|
+
const designFiles = planDesignFiles({
|
|
713
|
+
designDir: resolvedDesign.dir,
|
|
714
|
+
designsDir: DESIGNS_DIR,
|
|
715
|
+
siteDir: result.targetDir,
|
|
716
|
+
recorded: resolvedDesign.recorded,
|
|
717
|
+
...(template !== undefined && !Object.hasOwn(SHAPE_STARTERS, template.name)
|
|
718
|
+
? { sourceTemplate: template.name }
|
|
719
|
+
: {}),
|
|
720
|
+
version: markers["CREATE_AILK_VERSION"] ?? "",
|
|
721
|
+
});
|
|
722
|
+
writeFileSync(join(result.targetDir, DESIGN_SETTINGS_FILE), designFiles.designYaml);
|
|
723
|
+
const guidePath = join(result.targetDir, DESIGN_GUIDE_FILE);
|
|
724
|
+
if (designFiles.guide.action === "write")
|
|
725
|
+
writeFileSync(guidePath, designFiles.guide.text);
|
|
726
|
+
else if (designFiles.guide.action === "remove")
|
|
727
|
+
rmSync(guidePath);
|
|
728
|
+
// #12472 D4 — then the look's LOOK.md, by the guide's rule.
|
|
729
|
+
const lookPath = join(result.targetDir, LOOK_FILE);
|
|
730
|
+
if (designFiles.look.action === "write")
|
|
731
|
+
writeFileSync(lookPath, designFiles.look.text);
|
|
732
|
+
else if (designFiles.look.action === "remove")
|
|
733
|
+
rmSync(lookPath);
|
|
734
|
+
// SEC-12468-7 — the same line apply-design prints, for a guide from a path design.
|
|
735
|
+
const copiedFrom = guideCopiedFrom(designFiles.guide, DESIGNS_DIR);
|
|
736
|
+
if (copiedFrom !== undefined)
|
|
737
|
+
process.stdout.write(`guide copied from ${copiedFrom}\n`);
|
|
738
|
+
// SEC-12472-6 — a LOOK.md from a path design is announced the same way.
|
|
739
|
+
const lookCopiedFrom = guideCopiedFrom(designFiles.look, DESIGNS_DIR);
|
|
740
|
+
if (lookCopiedFrom !== undefined)
|
|
741
|
+
process.stdout.write(`look copied from ${lookCopiedFrom}\n`);
|
|
755
742
|
const siteMdxPath = join(result.targetDir, "content", "_site.mdx");
|
|
756
|
-
if (existsSync(siteMdxPath)) {
|
|
757
|
-
const current = readFileSync(siteMdxPath, "utf8");
|
|
758
|
-
const spliced = spliceThemeBlock(current, compiledTheme, siteMdxPath);
|
|
759
|
-
if (spliced !== current)
|
|
760
|
-
writeFileSync(siteMdxPath, spliced);
|
|
761
|
-
}
|
|
762
743
|
if (template !== undefined) {
|
|
763
744
|
const rosterPath = join(result.targetDir, SITE_ROSTER_PATH);
|
|
764
745
|
if (existsSync(rosterPath)) {
|
|
765
746
|
const rosterText = readFileSync(rosterPath, "utf8");
|
|
766
747
|
const chromeWritten = resolveSiteChrome(installedLayout ?? template.layout, resolvedDesign.pkg.layout);
|
|
767
|
-
const nextManifest = planSiteManifestDesign(rosterText, { design: resolvedDesign.recorded, layout: chromeWritten, theme:
|
|
748
|
+
const nextManifest = planSiteManifestDesign(rosterText, { design: resolvedDesign.recorded, layout: chromeWritten, theme: compileDesignTheme(resolvedDesign.pkg) }, rosterPath);
|
|
768
749
|
if (nextManifest !== undefined)
|
|
769
750
|
writeFileSync(rosterPath, nextManifest);
|
|
770
751
|
}
|
|
771
752
|
}
|
|
772
753
|
// #7743 D5 — the design's home arc, seeded over a placeholder home once
|
|
773
|
-
// every layer has landed
|
|
754
|
+
// every layer has landed. A home that is not
|
|
774
755
|
// the shape's placeholder is never written; `--design standard` (no
|
|
775
756
|
// seeds) leaves the shape's home byte-identical. The one
|
|
776
757
|
// `planDesignHome` call site in scaffold(). #8661 D11 — the contact page
|
|
@@ -804,32 +785,13 @@ export async function scaffold(opts) {
|
|
|
804
785
|
}
|
|
805
786
|
}
|
|
806
787
|
}
|
|
807
|
-
// #
|
|
808
|
-
//
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
// step 3b and applies none: nothing "the shape placed" to resolve against.
|
|
812
|
-
if (template !== undefined &&
|
|
813
|
-
Object.keys(resolvedDesign.pkg.sections).length > 0) {
|
|
814
|
-
const roster = readSiteRoster(result.targetDir);
|
|
815
|
-
if (roster !== undefined) {
|
|
816
|
-
const pageTypes = new Set();
|
|
817
|
-
for (const row of roster.rows) {
|
|
818
|
-
const pageType = row.value["pageType"];
|
|
819
|
-
if (typeof pageType === "string")
|
|
820
|
-
pageTypes.add(pageType);
|
|
821
|
-
}
|
|
822
|
-
const contentDir = join(result.targetDir, "content");
|
|
823
|
-
const pages = listMdxFiles(contentDir)
|
|
824
|
-
.filter((path) => path !== join(contentDir, "_site.mdx"))
|
|
825
|
-
.map((path) => ({ path, text: readFileSync(path, "utf8") }));
|
|
826
|
-
const presetResult = applyDesignPresets(pages, resolvedDesign.pkg.sections, { pageTypes });
|
|
827
|
-
for (const page of presetResult.pages)
|
|
828
|
-
writeFileSync(page.path, page.text);
|
|
829
|
-
}
|
|
788
|
+
// #12472 D3 — the look's samples, copied into the site and drawn in the
|
|
789
|
+
// empty image slots of its seeded pages, before the home is recorded.
|
|
790
|
+
if (lookSamples !== undefined) {
|
|
791
|
+
fillLookSamples(result.targetDir, lookSamples.look, lookSamples.samples);
|
|
830
792
|
}
|
|
831
793
|
// #7743 D6 — the manifest's `/` row records the seeded home's sections,
|
|
832
|
-
// as
|
|
794
|
+
// as seeded. #8661 — and the `/contact` row the seeded
|
|
833
795
|
// contact page's.
|
|
834
796
|
const rosterPath = join(result.targetDir, SITE_ROSTER_PATH);
|
|
835
797
|
if (seededPages.length > 0 && existsSync(rosterPath)) {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The sha256 of every retired-format DESIGN.md body create-ailk has shipped
|
|
3
|
+
* (#12468 D6 step 2, SEC-12468-3), normalised by `legacyBodyHash`
|
|
4
|
+
* (`design-files.ts`): the text after the closing `---` line, LF line
|
|
5
|
+
* endings, and the `Source template:` / `Design:` / `Version:` lines dropped
|
|
6
|
+
* only inside the body's leading `<!-- … -->` comment block — the same line
|
|
7
|
+
* anywhere else is the site's own text and stays in the hash.
|
|
8
|
+
*
|
|
9
|
+
* `create-ailk update` removes or replaces a site's retired DESIGN.md only
|
|
10
|
+
* when its body hashes into this set; any other body is the site's own edit
|
|
11
|
+
* and is kept as `DESIGN.retired.md`. A missing hash costs a review entry,
|
|
12
|
+
* never a site's text.
|
|
13
|
+
*
|
|
14
|
+
* Generated once, from the repository root, over every blob of the four
|
|
15
|
+
* shipped paths in `git log` up to 0db04b0d (35 retired-format blobs, 21
|
|
16
|
+
* distinct bodies):
|
|
17
|
+
*
|
|
18
|
+
* git log --format= --raw --no-abbrev 0db04b0d -- \
|
|
19
|
+
* 'packages/create-ailk/site-templates/designs/*\/DESIGN.md' \
|
|
20
|
+
* 'packages/create-ailk/site-templates/*\/DESIGN.md' \
|
|
21
|
+
* 'packages/create-ailk/template-*\/DESIGN.md' 'design-library/*\/DESIGN.md' \
|
|
22
|
+
* | awk '{ print $3; print $4 }' | grep -v '^0*$' | sort -u \
|
|
23
|
+
* | while read -r blob; do git cat-file -p "$blob" > "$TMP/$blob"; echo "$TMP/$blob"; done \
|
|
24
|
+
* | pnpm exec tsx -e 'import { readFileSync } from "node:fs";
|
|
25
|
+
* import { isLegacyDesignMd, legacyBodyHash } from "./packages/create-ailk/src/design-files.ts";
|
|
26
|
+
* const texts = readFileSync(0, "utf8").trim().split("\n").map((p) => readFileSync(p, "utf8"));
|
|
27
|
+
* console.log([...new Set(texts.filter(isLegacyDesignMd).map(legacyBodyHash))].sort().join("\n"));'
|
|
28
|
+
*/
|
|
29
|
+
export declare const RETIRED_DESIGN_BODIES: ReadonlySet<string>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The sha256 of every retired-format DESIGN.md body create-ailk has shipped
|
|
3
|
+
* (#12468 D6 step 2, SEC-12468-3), normalised by `legacyBodyHash`
|
|
4
|
+
* (`design-files.ts`): the text after the closing `---` line, LF line
|
|
5
|
+
* endings, and the `Source template:` / `Design:` / `Version:` lines dropped
|
|
6
|
+
* only inside the body's leading `<!-- … -->` comment block — the same line
|
|
7
|
+
* anywhere else is the site's own text and stays in the hash.
|
|
8
|
+
*
|
|
9
|
+
* `create-ailk update` removes or replaces a site's retired DESIGN.md only
|
|
10
|
+
* when its body hashes into this set; any other body is the site's own edit
|
|
11
|
+
* and is kept as `DESIGN.retired.md`. A missing hash costs a review entry,
|
|
12
|
+
* never a site's text.
|
|
13
|
+
*
|
|
14
|
+
* Generated once, from the repository root, over every blob of the four
|
|
15
|
+
* shipped paths in `git log` up to 0db04b0d (35 retired-format blobs, 21
|
|
16
|
+
* distinct bodies):
|
|
17
|
+
*
|
|
18
|
+
* git log --format= --raw --no-abbrev 0db04b0d -- \
|
|
19
|
+
* 'packages/create-ailk/site-templates/designs/*\/DESIGN.md' \
|
|
20
|
+
* 'packages/create-ailk/site-templates/*\/DESIGN.md' \
|
|
21
|
+
* 'packages/create-ailk/template-*\/DESIGN.md' 'design-library/*\/DESIGN.md' \
|
|
22
|
+
* | awk '{ print $3; print $4 }' | grep -v '^0*$' | sort -u \
|
|
23
|
+
* | while read -r blob; do git cat-file -p "$blob" > "$TMP/$blob"; echo "$TMP/$blob"; done \
|
|
24
|
+
* | pnpm exec tsx -e 'import { readFileSync } from "node:fs";
|
|
25
|
+
* import { isLegacyDesignMd, legacyBodyHash } from "./packages/create-ailk/src/design-files.ts";
|
|
26
|
+
* const texts = readFileSync(0, "utf8").trim().split("\n").map((p) => readFileSync(p, "utf8"));
|
|
27
|
+
* console.log([...new Set(texts.filter(isLegacyDesignMd).map(legacyBodyHash))].sort().join("\n"));'
|
|
28
|
+
*/
|
|
29
|
+
export const RETIRED_DESIGN_BODIES = new Set([
|
|
30
|
+
"0675af3be4327bd15c260913f7912ac318bbad56ca82d5a1f165559f5048fec8",
|
|
31
|
+
"095ef4be475d0ce1fbf2cd1dbae9b621261a1d16266fe4cdf9c6bd4b6b03ff2a",
|
|
32
|
+
"0f970440bfdeb8beabbedad7948a26b0a5eb4b0ae9d779f350b7c452e462b3bb",
|
|
33
|
+
"5a0c984ae41a715e45d70fd0870fb76359acd2f07fdf7aa09c021a9f6a181985",
|
|
34
|
+
"60947b2625996128ec9c187da4e46e5bc9229b1118a717361669d52814c0cdcf",
|
|
35
|
+
"6d1b264eee40252e77322431e8f9b1478c5873d9e657797cc1ef17c9d2a99231",
|
|
36
|
+
"7056b3a1e7e3de6c390f0b3f09cc19e07fddc96c92eb1e8204b680daf6345364",
|
|
37
|
+
"8d86e6835dfade028851375c0e82bb9a4af0c2c63c327eb8d6c72afa1fa8c1f8",
|
|
38
|
+
"94385ac9a3310fc592b0ac900a738a14d34a42d5bd23718b90f47f177460c574",
|
|
39
|
+
"99b77394e725ffb351032a6d4668fe4843b5b0c8d432a7a88808f0281141d0cd",
|
|
40
|
+
"a329a8f55bded4dddc0ce1ad35735d9b79518de3e1d4ff32bffb3838225c5393",
|
|
41
|
+
"a3607db8d4025c504120c8aac9eb9fcdb85d02d1dc16310a23e2d75903059921",
|
|
42
|
+
"b0e55842f47f47b64156d281a873bfd9fb789f62049d7a4b4600c032061f3d07",
|
|
43
|
+
"b7ddb3f6223b51111ee45dba079b3ce7708dd2a52005878e563707b1c04f52fc",
|
|
44
|
+
"b8a6b7a6b34f855cc4b78cf96237b811fba5f2347314800c7f1ad9a3e3feee18",
|
|
45
|
+
"c30315ffc589b4c08217093844f1fbbe0f2c317a4255585ddd016f9f573b3f04",
|
|
46
|
+
"d318f2469a93075c5feebfdd78100cdff694cdf6ed3b66c1894449beb4936d97",
|
|
47
|
+
"dfb1e4b7c08b35adf5659530e65a570acc62a1e68f0008a05fd3e3fbbbd68056",
|
|
48
|
+
"e53d71f1b974e757dce8e50cc119064b8ab1c7ca5a88983e75191e70f88c24e6",
|
|
49
|
+
"f5c4fe56e3dad9af8f8598c1e1b7073db7d015d59d9818e2bbcbac07a7c0c491",
|
|
50
|
+
"fa49266844f3c3aba1450ffe665ca91d91d713606bb162358d9021536517acfb",
|
|
51
|
+
]);
|
package/dist/seed-flows.d.ts
CHANGED
|
@@ -64,5 +64,5 @@ export interface SeedFlowsArgs {
|
|
|
64
64
|
dryRun: boolean;
|
|
65
65
|
help: boolean;
|
|
66
66
|
}
|
|
67
|
-
export declare const SEED_FLOWS_HELP = "create-ailk seed-flows \u2014 send a spoke's declared flows to its hub.\n\nUsage:\n AILK_SPOKE_KEY=<key> create-ailk seed-flows [<dir>] [--hub-url <origin>] [--dry-run]\n\nArguments:\n <dir> The spoke site. Defaults to the current dir.\n\nOptions:\n --hub-url <origin> The hub's origin. Else AILK_API_URL.
|
|
67
|
+
export declare const SEED_FLOWS_HELP = "create-ailk seed-flows \u2014 send a spoke's declared flows to its hub.\n\nUsage:\n AILK_SPOKE_KEY=<key> create-ailk seed-flows [<dir>] [--hub-url <origin>] [--dry-run]\n\nArguments:\n <dir> The spoke site. Defaults to the current dir.\n\nOptions:\n --hub-url <origin> The hub's origin. Else AILK_API_URL. It must be\n the origin the AILK_API_URL= line of\n apps/web/.env.local names; that line alone is read\n for --dry-run only. https: only (http: on\n localhost or 127.0.0.1).\n --dry-run Check every flows/*.json and print what would be sent.\n Sends nothing and reads no key.\n -h, --help Show this help.\n\nEach flows/<slug>.json is sent to PUT <hub>/v1/flows/<slug>/definition with\nthe spoke key, which is read from AILK_SPOKE_KEY only. The hub must have\nAILK_SPOKE_FLOW_SEED=true. Exit 0 when every flow was accepted, 1 when any\nfailed, 2 on a refusal (nothing is sent).\n";
|
|
68
68
|
export declare function parseSeedFlowsArgs(argv: string[]): SeedFlowsArgs;
|
package/dist/seed-flows.js
CHANGED
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
* variable, else (for `--dry-run` only) the `AILK_API_URL=` line of
|
|
16
16
|
* `apps/web/.env.local`, and must be `https:` (or `http:` on a loopback
|
|
17
17
|
* host); a send whose origin only that file names is refused, because a
|
|
18
|
-
* repo file never decides where the key goes (#9969 D8)
|
|
18
|
+
* repo file never decides where the key goes (#9969 D8), and so is a send to
|
|
19
|
+
* an origin other than the one that file names (#12477); the key comes from the
|
|
19
20
|
* `AILK_SPOKE_KEY` environment variable and nowhere else. Every refusal is
|
|
20
21
|
* thrown before the first request. The hub origin and its source are printed
|
|
21
22
|
* before any request, so where the key goes is visible before it is sent.
|
|
@@ -32,7 +33,7 @@ import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync, } from
|
|
|
32
33
|
import { join, resolve } from "node:path";
|
|
33
34
|
import { parseArgs } from "node:util";
|
|
34
35
|
import { ParseError } from "./parse-args.js";
|
|
35
|
-
import { HUB_ORIGIN_ENV_VAR, TopologyError, normalizeHubUrl, readSiteTopology, } from "./topology.js";
|
|
36
|
+
import { HUB_ORIGIN_ENV_VAR, TopologyError, normalizeHubUrl, readSiteTopology, readWebEnvValue, spokeOriginMismatch, } from "./topology.js";
|
|
36
37
|
/** The environment variable the spoke key is read from — and nowhere else. */
|
|
37
38
|
export const SPOKE_KEY_ENV_VAR = "AILK_SPOKE_KEY";
|
|
38
39
|
/** The header the key travels in (`packages/api-client`'s spoke header). */
|
|
@@ -107,16 +108,7 @@ function readDeclaredFlows(flowsDir) {
|
|
|
107
108
|
// ── The hub origin ──────────────────────────────────────────────────────────
|
|
108
109
|
/** The `AILK_API_URL=` value in `apps/web/.env.local`, if one is assigned. */
|
|
109
110
|
function readEnvLocalHubUrl(targetDir) {
|
|
110
|
-
|
|
111
|
-
if (!existsSync(path))
|
|
112
|
-
return undefined;
|
|
113
|
-
const line = readFileSync(path, "utf8")
|
|
114
|
-
.split(/\r?\n/)
|
|
115
|
-
.map((l) => /^\s*(?:export\s+)?AILK_API_URL\s*=\s*(.*)$/.exec(l))
|
|
116
|
-
.filter((m) => m !== null)
|
|
117
|
-
.pop(); // dotenv: the last assignment wins
|
|
118
|
-
const value = line?.[1]?.trim().replace(/^(["'])(.*)\1$/, "$2");
|
|
119
|
-
return value !== undefined && value !== "" ? value : undefined;
|
|
111
|
+
return readWebEnvValue(targetDir, ".env.local", HUB_ORIGIN_ENV_VAR);
|
|
120
112
|
}
|
|
121
113
|
const HUB_SOURCES_HINT = `The hub origin comes from --hub-url, else the ${HUB_ORIGIN_ENV_VAR} environment variable, else the ${HUB_ORIGIN_ENV_VAR}= line of apps/web/.env.local.`;
|
|
122
114
|
function resolveHub(targetDir, hubUrl, env) {
|
|
@@ -261,6 +253,11 @@ export async function seedFlows(opts) {
|
|
|
261
253
|
if (hub.source === "apps/web/.env.local") {
|
|
262
254
|
throw new SeedFlowsRefusedError(`seed-flows: the hub origin ${hub.origin} was read from apps/web/.env.local. Confirm it with --hub-url ${hub.origin} (or set ${HUB_ORIGIN_ENV_VAR}) — the spoke key is sent only to an origin you name. Nothing was sent.`);
|
|
263
255
|
}
|
|
256
|
+
// …and only to the hub the spoke's own apps/web/.env.local names (#12477).
|
|
257
|
+
const mismatch = spokeOriginMismatch(targetDir, hub.origin);
|
|
258
|
+
if (mismatch !== undefined) {
|
|
259
|
+
throw new SeedFlowsRefusedError(`seed-flows: ${mismatch}. Nothing was sent.`);
|
|
260
|
+
}
|
|
264
261
|
const key = env[SPOKE_KEY_ENV_VAR]?.trim() ?? "";
|
|
265
262
|
if (key === "") {
|
|
266
263
|
throw new SeedFlowsRefusedError(`seed-flows: set ${SPOKE_KEY_ENV_VAR} to the spoke key your hub issued. It is read from the environment only — never a flag or a file. Nothing was sent.`);
|
|
@@ -371,8 +368,9 @@ Arguments:
|
|
|
371
368
|
<dir> The spoke site. Defaults to the current dir.
|
|
372
369
|
|
|
373
370
|
Options:
|
|
374
|
-
--hub-url <origin> The hub's origin. Else AILK_API_URL.
|
|
375
|
-
AILK_API_URL= line of
|
|
371
|
+
--hub-url <origin> The hub's origin. Else AILK_API_URL. It must be
|
|
372
|
+
the origin the AILK_API_URL= line of
|
|
373
|
+
apps/web/.env.local names; that line alone is read
|
|
376
374
|
for --dry-run only. https: only (http: on
|
|
377
375
|
localhost or 127.0.0.1).
|
|
378
376
|
--dry-run Check every flows/*.json and print what would be sent.
|
package/dist/seed-workspace.d.ts
CHANGED
|
@@ -28,6 +28,8 @@ export interface SeedWorkspaceOptions {
|
|
|
28
28
|
sleep?: (ms: number) => Promise<void>;
|
|
29
29
|
/** Each report line as it happens; defaults to nothing. */
|
|
30
30
|
onLine?: (line: string) => void;
|
|
31
|
+
/** The shipped designs a site's recorded look resolves from; defaults to this installer's own. */
|
|
32
|
+
designsDir?: string;
|
|
31
33
|
}
|
|
32
34
|
export declare function seedWorkspace(opts: SeedWorkspaceOptions): Promise<{
|
|
33
35
|
result: ImportMdxResult;
|
|
@@ -54,6 +56,7 @@ export declare function scaffoldSeedPlan(input: ScaffoldSeedPlanInput): Scaffold
|
|
|
54
56
|
export interface RunScaffoldSeedOptions extends ScaffoldSeedPlanInput {
|
|
55
57
|
targetDir: string;
|
|
56
58
|
onLine: (line: string) => void;
|
|
59
|
+
designsDir?: string;
|
|
57
60
|
adapters?: MdxAdapterModule;
|
|
58
61
|
fetch?: typeof globalThis.fetch;
|
|
59
62
|
sleep?: (ms: number) => Promise<void>;
|
|
@@ -69,5 +72,5 @@ export interface SeedWorkspaceArgs {
|
|
|
69
72
|
workspaceId: string | undefined;
|
|
70
73
|
help: boolean;
|
|
71
74
|
}
|
|
72
|
-
export declare const SEED_WORKSPACE_HELP = "create-ailk seed-workspace \u2014 import a starter's pages into its workspace.\n\nUsage:\n AILK_AGENT_KEY=<key> create-ailk seed-workspace [<dir>] [--api-url <origin>] [--workspace <wksp_id>]\n\nArguments:\n <dir> The site. Defaults to the current dir.\n\nOptions:\n --api-url <origin> The site's API origin. Else AILK_API_URL. https:\n only (http: on localhost or 127.0.0.1).\n --workspace <wksp_id> The workspace the pages are written to. Else\n AILK_WORKSPACE_ID.\n -h, --help Show this help.\n\nEach content/en/<Type>/<slug>.mdx page is written to the workspace, and set\nLive when it has no Live version, through the API's content routes, with the\nagent key, which is read from AILK_AGENT_KEY only and needs the content-edit\nand content-publish grants, at Autonomous. Each page prints created, updated,\nunchanged, skipped or failed, so a re-run is safe. When every page is Live, the site\nswitches apps/web and apps/api to CONTENT_ADAPTER=database, keeping a value\neither already sets. The site's dependencies must be installed. Exit 0 when
|
|
75
|
+
export declare const SEED_WORKSPACE_HELP = "create-ailk seed-workspace \u2014 import a starter's pages into its workspace.\n\nUsage:\n AILK_AGENT_KEY=<key> create-ailk seed-workspace [<dir>] [--api-url <origin>] [--workspace <wksp_id>]\n\nArguments:\n <dir> The site. Defaults to the current dir.\n\nOptions:\n --api-url <origin> The site's API origin. Else AILK_API_URL. https:\n only (http: on localhost or 127.0.0.1).\n --workspace <wksp_id> The workspace the pages are written to. Else\n AILK_WORKSPACE_ID.\n -h, --help Show this help.\n\nEach content/en/<Type>/<slug>.mdx page is written to the workspace, and set\nLive when it has no Live version, through the API's content routes, with the\nagent key, which is read from AILK_AGENT_KEY only and needs the content-edit\nand content-publish grants, at Autonomous. Each page prints created, updated,\nunchanged, skipped or failed, so a re-run is safe. When every page is Live, the site\nswitches apps/web and apps/api to CONTENT_ADAPTER=database, keeping a value\neither already sets. The site's dependencies must be installed.\n\nThen the look: the site's first design record, from the design and starter it\nwas scaffolded with, is written to the workspace \u2014 only where the workspace\nholds none, and never for a site that still carries its look files or a\nworkspace already in use. This step alone needs the key's site-design grant;\nwithout it the step is skipped and named. On a spoke, whose pages are its own\nfiles, only the look is seeded, into the workspace and at the hub its\napps/web env files name. Exit 0 when every page was seeded and the look written, kept or\nskipped, 1 when any failed, 2 on a refusal (nothing is sent).\n";
|
|
73
76
|
export declare function parseSeedWorkspaceArgs(argv: string[]): SeedWorkspaceArgs;
|