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.
Files changed (144) hide show
  1. package/README.md +180 -43
  2. package/component-catalog.json +223 -285
  3. package/component-catalog.md +1 -1
  4. package/dist/apply-design.d.ts +26 -68
  5. package/dist/apply-design.js +150 -322
  6. package/dist/cli.js +152 -17
  7. package/dist/compare-chrome.d.ts +108 -0
  8. package/dist/compare-chrome.js +481 -0
  9. package/dist/compare-look.d.ts +94 -0
  10. package/dist/compare-look.js +378 -0
  11. package/dist/copy.js +1 -1
  12. package/dist/design-compile.d.ts +17 -21
  13. package/dist/design-compile.js +32 -56
  14. package/dist/design-files.d.ts +93 -0
  15. package/dist/design-files.js +312 -0
  16. package/dist/design-home.d.ts +4 -2
  17. package/dist/design-home.js +88 -6
  18. package/dist/design-names.d.ts +13 -0
  19. package/dist/design-names.js +76 -0
  20. package/dist/design-package.d.ts +46 -56
  21. package/dist/design-package.js +285 -288
  22. package/dist/design-presets.d.ts +41 -0
  23. package/dist/design-presets.js +83 -4
  24. package/dist/design-scaffold.d.ts +12 -2
  25. package/dist/design-scaffold.js +72 -34
  26. package/dist/generated/design-settings.d.ts +56 -0
  27. package/dist/generated/design-settings.js +237 -0
  28. package/dist/index.d.ts +1 -1
  29. package/dist/index.js +2 -2
  30. package/dist/inventory.d.ts +3 -2
  31. package/dist/inventory.js +10 -4
  32. package/dist/lib/design-checks.d.ts +46 -0
  33. package/dist/lib/design-checks.js +79 -1
  34. package/dist/lib/env-catalog.js +5 -1
  35. package/dist/lib/module-license-gate.d.ts +1 -1
  36. package/dist/lib/module-license-gate.js +1 -1
  37. package/dist/lib/render-verdict.d.ts +13 -1
  38. package/dist/lib/render-verdict.js +41 -1
  39. package/dist/look-hub.d.ts +44 -0
  40. package/dist/look-hub.js +130 -0
  41. package/dist/look-record.d.ts +35 -0
  42. package/dist/look-record.js +85 -0
  43. package/dist/look-samples.d.ts +66 -0
  44. package/dist/look-samples.js +456 -0
  45. package/dist/look-settings.d.ts +53 -0
  46. package/dist/look-settings.js +363 -0
  47. package/dist/module-architecture.js +12 -0
  48. package/dist/parse-args.d.ts +10 -6
  49. package/dist/parse-args.js +26 -13
  50. package/dist/programmatic.d.ts +1 -19
  51. package/dist/programmatic.js +65 -103
  52. package/dist/retired-design-bodies.d.ts +29 -0
  53. package/dist/retired-design-bodies.js +51 -0
  54. package/dist/seed-flows.d.ts +1 -1
  55. package/dist/seed-flows.js +12 -14
  56. package/dist/seed-workspace.d.ts +4 -1
  57. package/dist/seed-workspace.js +139 -17
  58. package/dist/site-chrome.d.ts +41 -41
  59. package/dist/site-chrome.js +50 -70
  60. package/dist/site-fonts.d.ts +10 -14
  61. package/dist/site-fonts.js +5 -1
  62. package/dist/starter-grid.d.ts +2 -2
  63. package/dist/strip-look-copies.d.ts +67 -0
  64. package/dist/strip-look-copies.js +591 -0
  65. package/dist/template-manifest.d.ts +6 -14
  66. package/dist/template-manifest.js +0 -9
  67. package/dist/template-record.d.ts +3 -1
  68. package/dist/template-record.js +3 -1
  69. package/dist/topology.d.ts +15 -0
  70. package/dist/topology.js +60 -0
  71. package/dist/update.d.ts +57 -1
  72. package/dist/update.js +742 -13
  73. package/package.json +3 -4
  74. package/site-templates/aliases/hub.TEMPLATE-MANIFEST.json +2 -31
  75. package/site-templates/designs/minimalism/DESIGN.md +163 -297
  76. package/site-templates/designs/minimalism/LOOK.md +42 -0
  77. package/site-templates/designs/minimalism/design.yaml +167 -0
  78. package/site-templates/designs/standard/DESIGN.md +145 -149
  79. package/site-templates/designs/standard/LOOK.md +42 -0
  80. package/site-templates/designs/standard/design.yaml +72 -0
  81. package/site-templates/marketing-site/TEMPLATE-MANIFEST.json +2 -31
  82. package/site-templates/marketing-site/TEMPLATE-MANIFEST.md +1 -25
  83. package/site-templates/marketing-site-free/TEMPLATE-MANIFEST.json +2 -31
  84. package/site-templates/marketing-site-free/TEMPLATE-MANIFEST.md +1 -25
  85. package/site-templates/shapes/local-business-service/TEMPLATE-MANIFEST.json +2 -31
  86. package/site-templates/shapes/local-business-service/TEMPLATE-MANIFEST.md +1 -25
  87. package/site-templates/shapes/organization-service/TEMPLATE-MANIFEST.json +2 -31
  88. package/site-templates/shapes/organization-service/TEMPLATE-MANIFEST.md +1 -25
  89. package/site-templates/shapes/person-service/TEMPLATE-MANIFEST.json +2 -31
  90. package/site-templates/shapes/person-service/TEMPLATE-MANIFEST.md +1 -25
  91. package/site-templates/shapes/person-service/content/_site.mdx +0 -26
  92. package/templates/.claude/rules/extending.md +3 -2
  93. package/templates/.env.example +11 -4
  94. package/templates/CLAUDE.md +1 -1
  95. package/templates/DESIGN.md +145 -149
  96. package/templates/README.md +15 -16
  97. package/templates/apps/api/.env.example +29 -4
  98. package/templates/apps/api/CLAUDE.md +7 -4
  99. package/templates/apps/api/src/__tests__/vercel-handler.test.ts +176 -2
  100. package/templates/apps/api/src/lib/__mocks__/prisma.ts +30 -4
  101. package/templates/apps/api/src/vercel-handler.ts +32 -2
  102. package/templates/apps/mcp/.env.example +8 -0
  103. package/templates/apps/mcp/CLAUDE.md +5 -3
  104. package/templates/apps/web/.env.example +10 -3
  105. package/templates/apps/web/CLAUDE.md +31 -4
  106. package/templates/apps/web/app/[locale]/layout.tsx +141 -77
  107. package/templates/apps/web/app/llms.txt/__tests__/site-listing.test.ts +13 -3
  108. package/templates/apps/web/app/not-found.tsx +11 -11
  109. package/templates/apps/web/auth.ts +48 -35
  110. package/templates/apps/web/jest.config.cjs +5 -0
  111. package/templates/apps/web/lib/__tests__/hub-site-config.test.ts +542 -10
  112. package/templates/apps/web/lib/__tests__/library-fonts.test.ts +35 -0
  113. package/templates/apps/web/lib/__tests__/page-chrome-navigation.test.ts +233 -0
  114. package/templates/apps/web/lib/__tests__/page-chrome.test.ts +123 -26
  115. package/templates/apps/web/lib/__tests__/section-look.test.ts +150 -0
  116. package/templates/apps/web/lib/__tests__/site-identity-feature-list.test.ts +19 -1
  117. package/templates/apps/web/lib/__tests__/site-navigation.test.ts +288 -0
  118. package/templates/apps/web/lib/__tests__/site-theme.test.ts +81 -289
  119. package/templates/apps/web/lib/deck-page.ts +3 -10
  120. package/templates/apps/web/lib/deploy-fonts.ts +12 -0
  121. package/templates/apps/web/lib/hub-site-config.ts +237 -29
  122. package/templates/apps/web/lib/library-fonts.ts +41 -0
  123. package/templates/apps/web/lib/mcp-oauth.ts +11 -4
  124. package/templates/apps/web/lib/page-chrome.ts +105 -20
  125. package/templates/apps/web/lib/section-look.ts +28 -0
  126. package/templates/apps/web/lib/site-design.ts +205 -0
  127. package/templates/apps/web/lib/site-navigation.ts +208 -0
  128. package/templates/apps/web/lib/site-theme-head.ts +98 -13
  129. package/templates/apps/web/lib/site-theme.ts +40 -62
  130. package/templates/apps/web/messages/en.json +0 -6
  131. package/templates/apps/web/next.config.mjs +213 -11
  132. package/templates/apps/web/package.json +2 -0
  133. package/templates/apps/web/site-pages.config.tsx +4 -2
  134. package/templates/content/_site.mdx +0 -26
  135. package/templates/design.yaml +75 -0
  136. package/templates/project.yaml +14 -0
  137. package/versions.json +52 -51
  138. package/site-templates/marketing-site/DESIGN.md +0 -259
  139. package/site-templates/marketing-site-free/DESIGN.md +0 -259
  140. package/site-templates/saas-product/DESIGN.md +0 -259
  141. package/templates/apps/web/lib/__tests__/deck-page.test.ts +0 -288
  142. package/templates/apps/web/lib/__tests__/site-theme-head.test.ts +0 -70
  143. package/templates/apps/web/lib/site-chrome.ts +0 -46
  144. package/templates/apps/web/lib/site-fonts.ts +0 -15
package/dist/cli.js CHANGED
@@ -23,6 +23,10 @@
23
23
  * agent key from AILK_AGENT_KEY, print one line per page and the count
24
24
  * line, exit 1 if any failed (2 on a refusal it names, nothing sent)
25
25
  * (#10207)
26
+ * on a `strip-look-copies` subcommand: list — or, with --apply, remove
27
+ * on a branch off the default one — the section look values a site's
28
+ * page files copy from its hub look, exit (2 on a refusal it names,
29
+ * nothing written) (#12474)
26
30
  * on an `inventory` subcommand: freeze a site's URLs into
27
31
  * .ailk-cutover/inventory.json once and audit each page against its
28
32
  * workspace, exit 1 if any prose page fails (2 on a refusal) (#10648)
@@ -41,8 +45,9 @@
41
45
  * to a linked Vercel project and redeploy, exit (#6683 D9)
42
46
  * on a `provision-env` subcommand: set MCP_PUBLIC_HTTP_URL (and apps/mcp's
43
47
  * BETTER_AUTH_URL) on the linked Vercel projects, exit (#10392 D9)
44
- * on an `apply-design` subcommand: rewrite an existing site's look,
45
- * print the changed-file report, exit (#6819)
48
+ * on an `apply-design` subcommand: write an existing site's hub design
49
+ * record, print the record written, exit (2 on a refusal it names)
50
+ * (#6819, #12477)
46
51
  * on an `update` subcommand: bring template fixes into a site's
47
52
  * already-copied apps/web, apps/api and apps/mcp code, print the
48
53
  * per-file report, exit (2 on a refusal it names) (#8522)
@@ -79,8 +84,10 @@ import { fileURLToPath } from "node:url";
79
84
  import { ADD_MODULE_HELP, AddModuleRefusedError, formatAddModuleReport, parseAddModuleArgs, } from "./add-module.js";
80
85
  import { ADD_ROUTE_HELP, AddRouteRefusedError, MAGNET_ROUTE, addMagnetToScaffold, addRouteToScaffold, formatAddMagnetReport, formatAddRouteReport, parseAddRouteArgs, } from "./add-route.js";
81
86
  import { ADOPT_HELP, AdoptRefusedError, adoptSite, formatAdoptReport, parseAdoptArgs, } from "./adopt.js";
82
- import { APPLY_DESIGN_HELP, applyDesign, formatApplyDesignReport, parseApplyDesignArgs, } from "./apply-design.js";
87
+ import { APPLY_DESIGN_HELP, ApplyDesignRefusedError, applyDesign, formatApplyDesignReport, parseApplyDesignArgs, } from "./apply-design.js";
83
88
  import { CLAUDE_MD_CHECK_PATH } from "./claude-md.js";
89
+ import { COMPARE_CHROME_HELP, CompareChromeRefusedError, compareChrome, parseCompareChromeArgs, } from "./compare-chrome.js";
90
+ import { COMPARE_LOOK_HELP, CompareLookRefusedError, compareLook, parseCompareLookArgs, } from "./compare-look.js";
84
91
  import { COMPARE_RENDERS_HELP, CompareRendersRefusedError, compareRenders, parseCompareRendersArgs, } from "./compare-renders.js";
85
92
  import { buildScaffoldMarkers } from "./copy.js";
86
93
  import { CUTOVER_HELP, CutoverRefusedError, cutover, parseCutoverArgs, } from "./cutover.js";
@@ -92,14 +99,16 @@ import { withNpmTokenUserConfig } from "./lib/npm-auth.js";
92
99
  import { FREE_PREREQUISITES_NOTE, LICENSED_PREREQUISITES_NOTE, isLicensedInstall, proCallout, } from "./lib/pro-callout.js";
93
100
  import { loadChromium } from "./lib/render-comparison.js";
94
101
  import { LICENSE_SET_HELP, runLicenseSet } from "./license-set.js";
102
+ import { LOOK_SETTINGS_HELP, lookSettings, parseLookSettingsArgs } from "./look-settings.js";
95
103
  import { MIGRATE_CONTENT_HELP, MigrateContentRefusedError, migrateContent, parseMigrateContentArgs, } from "./migrate-content.js";
96
- import { PLUGIN_INSTALL_LINES, ParseError, helpText, parseCliArgs, parseModules, resolveCliShape, toScaffoldOptions, } from "./parse-args.js";
104
+ import { PLUGIN_INSTALL_LINES, ParseError, designsHelp, helpText, parseCliArgs, parseModules, resolveCliShape, toScaffoldOptions, } from "./parse-args.js";
97
105
  import { addModule, removeModule, formatSurfaceDrift, scaffold, syncArchitectureSync, syncCatalogSync, syncClaudeMdSync, syncRoutesSync, } from "./programmatic.js";
98
106
  import { PROVISION_ENV_HELP, runProvisionEnv } from "./provision-env.js";
99
107
  import { REMOVE_MODULE_HELP, RemoveModuleRefusedError, formatRemoveModuleReport, parseRemoveModuleArgs, } from "./remove-module.js";
100
108
  import { ROUTES_HELP, RoutesRefusedError, checkRoutes, formatRoutesReport, parseRoutesArgs, routesFailing, writeRoutes, } from "./routes.js";
101
109
  import { SEED_FLOWS_HELP, SeedFlowsRefusedError, parseSeedFlowsArgs, seedFlows, } from "./seed-flows.js";
102
110
  import { SEED_WORKSPACE_HELP, SeedWorkspaceRefusedError, parseSeedWorkspaceArgs, runScaffoldSeed, seedWorkspace, } from "./seed-workspace.js";
111
+ import { STRIP_LOOK_COPIES_HELP, StripLookCopiesRefusedError, parseStripLookCopiesArgs, stripLookCopies, } from "./strip-look-copies.js";
103
112
  import { CORE_SURFACE_PATHS, SURFACE_ALIASES } from "./surfaces.js";
104
113
  import { SYNC_ROUTES_HELP, formatSyncRoutesReport, parseSyncRoutesArgs, } from "./sync-routes.js";
105
114
  import { UPDATE_HELP, UpdateRefusedError, formatUpdateReport, parseUpdateArgs, updateSite, } from "./update.js";
@@ -370,6 +379,34 @@ async function main() {
370
379
  process.exit(2);
371
380
  }
372
381
  }
382
+ // `strip-look-copies [dir]` (#12474 D10): remove from a site's page files
383
+ // the section look values its hub look already sets — a dry run that writes
384
+ // nothing unless --apply. A refusal it names exits 2 before any write.
385
+ if (argv[0] === "strip-look-copies") {
386
+ try {
387
+ const args = parseStripLookCopiesArgs(argv.slice(1));
388
+ if (args.help) {
389
+ process.stdout.write(STRIP_LOOK_COPIES_HELP);
390
+ process.exit(0);
391
+ }
392
+ await stripLookCopies({
393
+ targetDir: args.target ?? process.cwd(),
394
+ apply: args.apply,
395
+ apiUrl: args.apiUrl,
396
+ workspaceId: args.workspaceId,
397
+ catalogPath: resolve(PKG_ROOT, "component-catalog.json"),
398
+ onLine: (line) => process.stdout.write(`${line}\n`),
399
+ });
400
+ process.exit(0);
401
+ }
402
+ catch (err) {
403
+ if (!(err instanceof ParseError) && !(err instanceof StripLookCopiesRefusedError)) {
404
+ throw err;
405
+ }
406
+ process.stderr.write(`[create-ailk] ${err.message}\n`);
407
+ process.exit(2);
408
+ }
409
+ }
373
410
  // `inventory [dir]` (#10648): freeze a site's URL set and audit each page
374
411
  // against its workspace.
375
412
  if (argv[0] === "inventory") {
@@ -490,6 +527,93 @@ async function main() {
490
527
  process.exit(2);
491
528
  }
492
529
  }
530
+ // `compare-chrome [dir]` (#12403 D6): capture a site's header, open menus
531
+ // and footer before a chrome change, and compare them after.
532
+ if (argv[0] === "compare-chrome") {
533
+ try {
534
+ const args = parseCompareChromeArgs(argv.slice(1));
535
+ if (args.help) {
536
+ process.stdout.write(COMPARE_CHROME_HELP);
537
+ process.exit(0);
538
+ }
539
+ const { exitCode } = await compareChrome({
540
+ origin: args.origin,
541
+ paths: args.paths,
542
+ ...(args.capture !== undefined && { capture: args.capture }),
543
+ ...(args.against !== undefined && { against: args.against }),
544
+ ...(args.out !== undefined && { out: args.out }),
545
+ ...(args.tolerance !== undefined && { tolerance: args.tolerance }),
546
+ ...(args.expect !== undefined && { expect: args.expect }),
547
+ // The site's Playwright `chromium`; its pages carry the locator slice too.
548
+ chromium: loadChromium([resolve(args.target ?? process.cwd())]),
549
+ onLine: (line) => process.stdout.write(`${line}\n`),
550
+ });
551
+ process.exit(exitCode);
552
+ }
553
+ catch (err) {
554
+ if (!(err instanceof ParseError) && !(err instanceof CompareChromeRefusedError)) {
555
+ throw err;
556
+ }
557
+ process.stderr.write(`[create-ailk] ${err.message}\n`);
558
+ process.exit(2);
559
+ }
560
+ }
561
+ // `compare-look [dir]` (#12476 D6): capture whole pages at both widths,
562
+ // light and dark, before a look change, and compare them after.
563
+ if (argv[0] === "compare-look") {
564
+ try {
565
+ const args = parseCompareLookArgs(argv.slice(1));
566
+ if (args.help) {
567
+ process.stdout.write(COMPARE_LOOK_HELP);
568
+ process.exit(0);
569
+ }
570
+ const { exitCode } = await compareLook({
571
+ origin: args.origin,
572
+ paths: args.paths,
573
+ ...(args.capture !== undefined && { capture: args.capture }),
574
+ ...(args.against !== undefined && { against: args.against }),
575
+ ...(args.out !== undefined && { out: args.out }),
576
+ ...(args.tolerance !== undefined && { tolerance: args.tolerance }),
577
+ ...(args.expect !== undefined && { expect: args.expect }),
578
+ // Playwright's `chromium`; its contexts take a colour scheme.
579
+ chromium: loadChromium([resolve(args.target ?? process.cwd())]),
580
+ onLine: (line) => process.stdout.write(`${line}\n`),
581
+ });
582
+ process.exit(exitCode);
583
+ }
584
+ catch (err) {
585
+ if (!(err instanceof ParseError) && !(err instanceof CompareLookRefusedError)) {
586
+ throw err;
587
+ }
588
+ process.stderr.write(`[create-ailk] ${err.message}\n`);
589
+ process.exit(2);
590
+ }
591
+ }
592
+ // `look-settings [dir] --out <file>` (#12476 D2): the design settings a
593
+ // site's hub design record will hold, handed over only when they compile
594
+ // to the site's three generated look files byte for byte.
595
+ if (argv[0] === "look-settings") {
596
+ try {
597
+ const args = parseLookSettingsArgs(argv.slice(1));
598
+ if (args.help) {
599
+ process.stdout.write(LOOK_SETTINGS_HELP);
600
+ process.exit(0);
601
+ }
602
+ const { exitCode } = lookSettings({
603
+ dir: resolve(args.target ?? process.cwd()),
604
+ out: args.out,
605
+ onLine: (line) => process.stdout.write(`${line}\n`),
606
+ onError: (line) => process.stderr.write(`${line}\n`),
607
+ });
608
+ process.exit(exitCode);
609
+ }
610
+ catch (err) {
611
+ if (!(err instanceof ParseError))
612
+ throw err;
613
+ process.stderr.write(`[create-ailk] ${err.message}\n`);
614
+ process.exit(2);
615
+ }
616
+ }
493
617
  // `routes --write | --check [dir]` (#11219, ADR 0040 rule 3): the one
494
618
  // route-file generator, over the manifests of the site's installed page
495
619
  // packages. Check mode exits 1 iff a generated file is missing, stale or
@@ -556,25 +680,34 @@ async function main() {
556
680
  stderr: (text) => process.stderr.write(text),
557
681
  }));
558
682
  }
559
- // `apply-design <name|path> [--target <dir>]` (#6819): rewrite an existing
560
- // site's look only. Every refusal — the licence gate included — reaches
561
- // the top-level catch, exit 1, as a scaffold-time design refusal does.
683
+ // `apply-design <name|path> [--target <dir>]` (#6819): write an existing
684
+ // site's hub design record (#12477 D5). A refusal of the site or its
685
+ // credentials exits 2; every other error — the licence gate included —
686
+ // reaches the top-level catch, exit 1, as a scaffold-time design refusal does.
562
687
  if (argv[0] === "apply-design") {
563
688
  const args = parseApplyDesignArgs(argv.slice(1));
564
689
  if (args.help || args.design === undefined) {
565
690
  process.stdout.write(APPLY_DESIGN_HELP);
566
691
  process.exit(0);
567
692
  }
568
- const result = await applyDesign({
569
- design: args.design,
570
- targetDir: args.target ?? process.cwd(),
571
- designsDir: resolve(PKG_ROOT, "site-templates", "designs"),
572
- siteTemplatesDir: resolve(PKG_ROOT, "site-templates"),
573
- templatesDir: resolve(PKG_ROOT, "templates"),
574
- catalogPath: resolve(PKG_ROOT, "component-catalog.json"),
575
- allowUnreadChrome: args.allowUnreadChrome,
576
- });
577
- process.stdout.write(formatApplyDesignReport(result));
693
+ try {
694
+ const result = await applyDesign({
695
+ design: args.design,
696
+ targetDir: args.target ?? process.cwd(),
697
+ designsDir: resolve(PKG_ROOT, "site-templates", "designs"),
698
+ siteTemplatesDir: resolve(PKG_ROOT, "site-templates"),
699
+ catalogPath: resolve(PKG_ROOT, "component-catalog.json"),
700
+ apiUrl: args.apiUrl,
701
+ workspaceId: args.workspaceId,
702
+ });
703
+ process.stdout.write(formatApplyDesignReport(result));
704
+ }
705
+ catch (err) {
706
+ if (!(err instanceof ApplyDesignRefusedError))
707
+ throw err;
708
+ process.stderr.write(`[create-ailk] ${err.message}\n`);
709
+ process.exit(2);
710
+ }
578
711
  process.exit(0);
579
712
  }
580
713
  // `update [<target-dir>]` (#8522): bring template fixes into a site's
@@ -596,6 +729,7 @@ async function main() {
596
729
  templatesDir: resolve(PKG_ROOT, "templates"),
597
730
  version: readPackageVersion(),
598
731
  versions: readVersionMap(),
732
+ ...(args.lookFrom !== undefined ? { look: { from: args.lookFrom } } : {}),
599
733
  });
600
734
  process.stdout.write(formatUpdateReport(result));
601
735
  }
@@ -641,6 +775,7 @@ async function main() {
641
775
  }
642
776
  if (opts.help) {
643
777
  process.stdout.write(helpText +
778
+ designsHelp() +
644
779
  "\n" +
645
780
  SYNC_ROUTES_HELP +
646
781
  "\n" +
@@ -0,0 +1,108 @@
1
+ /** A refusal before anything is rendered: exit 2. */
2
+ export declare class CompareChromeRefusedError extends Error {
3
+ name: string;
4
+ }
5
+ /** The slice of a Playwright `Locator` the capture uses. */
6
+ export interface ChromeLocator {
7
+ count(): Promise<number>;
8
+ nth(index: number): ChromeLocator;
9
+ click(): Promise<void>;
10
+ screenshot(options: {
11
+ animations: "disabled";
12
+ }): Promise<Buffer>;
13
+ }
14
+ /** The slice of a Playwright `Page` the capture uses. */
15
+ export interface ChromePage {
16
+ setViewportSize(size: {
17
+ width: number;
18
+ height: number;
19
+ }): Promise<void>;
20
+ goto(url: string, options: {
21
+ waitUntil: "load";
22
+ timeout: number;
23
+ }): Promise<{
24
+ status(): number;
25
+ } | null>;
26
+ url(): string;
27
+ evaluate(expression: string): Promise<unknown>;
28
+ screenshot(options: {
29
+ animations: "disabled";
30
+ }): Promise<Buffer>;
31
+ locator(selector: string): ChromeLocator;
32
+ keyboard: {
33
+ press(key: string): Promise<void>;
34
+ };
35
+ }
36
+ /** The slice of Playwright's `chromium` the capture launches. */
37
+ export interface ChromeChromium {
38
+ launch(): Promise<{
39
+ newContext(): Promise<{
40
+ newPage(): Promise<ChromePage>;
41
+ close(): Promise<void>;
42
+ }>;
43
+ close(): Promise<void>;
44
+ }>;
45
+ }
46
+ export interface ChromeLink {
47
+ text: string;
48
+ href: string;
49
+ }
50
+ /** The render stamp #12401's layout puts on the header's wrapper; null where missing. */
51
+ export interface NavStamp {
52
+ source: string | null;
53
+ version: string | null;
54
+ }
55
+ /** Every `a[href]` inside the first visible `selector`, or null when none is visible. */
56
+ export declare const linksExpression: (selector: string) => string;
57
+ /**
58
+ * The page's render stamp (#12401): the `<head>` meta every page carries
59
+ * whatever its header style, else the attributes on the header's wrapper.
60
+ */
61
+ export declare const STAMP_EXPRESSION: string;
62
+ export interface ChromeDifference {
63
+ path: string;
64
+ viewport: string;
65
+ part: string;
66
+ /** What differs: the first unequal link, the pixel share, a side missing, or a page that did not load. */
67
+ detail: string;
68
+ }
69
+ export interface CompareChromeOptions {
70
+ origin: string;
71
+ paths: readonly string[];
72
+ /** `--capture <dir>`: record the before capture. */
73
+ capture?: string;
74
+ /** `--against <dir>`: capture again and compare with that one. */
75
+ against?: string;
76
+ /** Where the comparison's evidence goes; default `<against>/comparison`. */
77
+ out?: string;
78
+ tolerance?: number;
79
+ /** `--expect-source` and `--expect-version`, given together. */
80
+ expect?: {
81
+ source: string;
82
+ version: string;
83
+ };
84
+ /** Playwright's `chromium`, from the site's own install; `undefined` refuses. */
85
+ chromium: ChromeChromium | undefined;
86
+ onLine?: (line: string) => void;
87
+ now?: () => Date;
88
+ }
89
+ /** Captures or compares (D6); answers the exit code: 0 all equal, 1 a difference or a page that did not load. */
90
+ export declare function compareChrome(o: CompareChromeOptions): Promise<{
91
+ exitCode: number;
92
+ }>;
93
+ export interface CompareChromeArgs {
94
+ target: string | undefined;
95
+ origin: string | undefined;
96
+ paths: string[];
97
+ capture: string | undefined;
98
+ against: string | undefined;
99
+ out: string | undefined;
100
+ tolerance: number | undefined;
101
+ expect: {
102
+ source: string;
103
+ version: string;
104
+ } | undefined;
105
+ help: boolean;
106
+ }
107
+ export declare const COMPARE_CHROME_HELP = "create-ailk compare-chrome \u2014 before-and-after captures of a site's header, open menus and footer.\n\nUsage:\n create-ailk compare-chrome [<dir>] --origin <url> --path <path> [--path <path> \u2026] --capture <dir>\n create-ailk compare-chrome [<dir>] --origin <url> --path <path> [--path <path> \u2026] --against <dir> [--out <dir>] [--tolerance <share>] [--expect-source record --expect-version <n>]\n\nArguments:\n <dir> The site, whose Playwright runs the browser. Defaults to the current dir.\n\nOptions:\n --origin <url> The live site.\n --path <path> A site path to capture; repeat for each.\n --capture <dir> Record the header, each open desktop menu, the open phone menu and the footer.\n --against <dir> Capture again and compare with that capture.\n --out <dir> Where comparison.json, comparison.md, after/ and shots/ go. Default <against>/comparison.\n --tolerance <share> The share of a screenshot's pixels that may differ. Default 0.\n --expect-source <src> With --expect-version: every page must render its header from <src> (record or files).\n --expect-version <n> The record version every page must render.\n -h, --help Show this help.\n\nLinks (text, address, order) and screenshots are compared at 1440 and 390 wide.\nNeeds Playwright's Chromium in the site: pnpm add -D @playwright/test && pnpm exec playwright install chromium.\nThe runbook is docs/internal/runbooks/site-navigation-import.md.\nExit 0 when every part is the same, 1 when one is not or a page did not load,\n2 on a refusal.\n";
108
+ export declare function parseCompareChromeArgs(argv: string[]): CompareChromeArgs;