create-ailk 0.41.0 → 0.42.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 (35) hide show
  1. package/README.md +31 -1
  2. package/component-catalog.json +6 -0
  3. package/dist/add-route.d.ts +2 -6
  4. package/dist/add-route.js +2 -43
  5. package/dist/export-content.js +11 -3
  6. package/dist/language-import.js +5 -2
  7. package/dist/lib/env-catalog.js +4 -0
  8. package/dist/lib/import-mdx.js +10 -7
  9. package/dist/magnet-page.d.ts +36 -0
  10. package/dist/magnet-page.js +70 -0
  11. package/dist/routes.d.ts +38 -2
  12. package/dist/routes.js +586 -27
  13. package/dist/surfaces.d.ts +16 -0
  14. package/dist/surfaces.js +36 -0
  15. package/dist/update.d.ts +1 -1
  16. package/dist/update.js +24 -2
  17. package/package.json +3 -3
  18. package/templates/.claude/hooks/template-guard.sh +145 -36
  19. package/templates/CLAUDE.md +1 -1
  20. package/templates/apps/api/CLAUDE.md +1 -0
  21. package/templates/apps/mcp/CLAUDE.md +5 -3
  22. package/templates/apps/web/CLAUDE.md +13 -1
  23. package/templates/apps/web/app/[locale]/layout.tsx +6 -3
  24. package/templates/apps/web/app/llms.txt/__tests__/site-listing.test.ts +28 -0
  25. package/templates/apps/web/app/sitemap.xml/__tests__/site-listing.test.ts +28 -0
  26. package/templates/apps/web/lib/__tests__/page-chrome.test.ts +24 -0
  27. package/templates/apps/web/lib/__tests__/route-paths.test.ts +57 -0
  28. package/templates/apps/web/lib/mcp-oauth.ts +14 -10
  29. package/templates/apps/web/lib/page-chrome.ts +8 -5
  30. package/templates/apps/web/lib/route-paths.ts +22 -0
  31. package/templates/apps/web/lib/services-path.ts +27 -18
  32. package/templates/apps/web/middleware.ts +2 -1
  33. package/templates/apps/web/next.config.mjs +123 -2
  34. package/templates/apps/web/src/lib/routes.ts +4 -2
  35. package/versions.json +50 -50
package/dist/routes.js CHANGED
@@ -48,6 +48,19 @@
48
48
  * later slice): it is REPORTED as kept by the site, never stray, and
49
49
  * `--write` never touches it.
50
50
  *
51
+ * Site pages (#11700). Every other routing file under `app/[locale]/` that the
52
+ * generator, `add-route magnet` (byte for byte) and the template did not
53
+ * write — not a `.ailk-template-files.json` key, not on `architecture.yaml`'s
54
+ * `customizations.scaffold_paths` — is a site page. A site page, and a
55
+ * recorded package route, needs a DECIDED `customizations.yaml` entry
56
+ * (`build-in: site — <decider>, <YYYY-MM-DD>, <reason>` or
57
+ * `build-in: ailk#<N>`, the scaffold lint's grammar): check mode fails one
58
+ * that has none, or whose entry is `undecided` — `undecided_ok_until` does
59
+ * not apply to a page. Each reported `page.tsx` names the `add-route magnet`
60
+ * command or the installed package page that already serves its address.
61
+ * With no template record, a page outside every prefix cannot be told from a
62
+ * template page, so that rule is skipped and the report says so.
63
+ *
51
64
  * Adoption (#11657 D2). A manifest may list `adopts` — routing files OUTSIDE
52
65
  * its own prefixes, each one of its entries, that another installed
53
66
  * manifest names in its `siteOwned` list (the signal-collectors package's
@@ -112,16 +125,32 @@
112
125
  * canonicalized) is not carried either. A site with no readable header
113
126
  * carries every entry. A manifest without the flag is never gated.
114
127
  *
128
+ * Route-family renames (#11385 D5–D7). A site renames a family's first
129
+ * segment with `<family>: { path: /<segment> }` in `content/_site.mdx`
130
+ * (`readSiteRouteRenames`, which refuses frontmatter it cannot read with
131
+ * certainty). Each locale entry under the family's convention segment is then
132
+ * planned under the new one — its file text unchanged, its topology and
133
+ * surface gates read on the convention path — and both segments are the
134
+ * prefix's stray scope. `--write` vacates the old directory: it deletes only
135
+ * generated routing files there, never follows a link, re-checks each file at
136
+ * delete time, and lists each deletion as `removed`. A rename that collides
137
+ * (`routeRenameRefusals`, an installed prefix, a content page `[slug]`
138
+ * serves), would strand a site file, moves a recorded route, lands on an
139
+ * occupied target or meets a symbolic link is refused before anything is
140
+ * written or deleted.
141
+ *
115
142
  * Pure module: no `import.meta.url`, so jest imports it directly.
116
143
  */
117
- import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from "node:fs";
144
+ import { existsSync, lstatSync, mkdirSync, readdirSync, readFileSync, realpathSync, rmdirSync, unlinkSync, writeFileSync, } from "node:fs";
118
145
  import { dirname, join, posix, relative, resolve, sep } from "node:path";
119
146
  import { parseArgs } from "node:util";
120
147
  import { AddModuleRefusedError, readArchitectureHeader } from "./add-module-core.js";
121
148
  import { declinedRouteOfPath, readDeclinedRoutes } from "./declined-routes.js";
122
149
  import { publicTreeRemoved } from "./lib/site-modules.js";
150
+ import { MAGNET_COMMAND_RE, MAGNET_PAGE_MARKER, isGeneratedMagnetPage } from "./magnet-page.js";
123
151
  import { LEGACY_SITE_ROSTER_PATH, SITE_ROSTER_PATH, readRosterPageRoutes } from "./site-roster.js";
124
- import { GATEABLE_SURFACES, ROUTE_ROOT, canonicalizeSurface, isRemovedPublicRoutePath } from "./surfaces.js";
152
+ import { GATEABLE_SURFACES, RENAMABLE_ROUTE_FAMILIES, RESERVED_ROUTE_SEGMENTS, ROUTE_ROOT, ROUTES_FIRST_SEGMENTS, canonicalizeSurface, isRemovedPublicRoutePath, } from "./surfaces.js";
153
+ import { TEMPLATE_RECORD_PATH, TemplateRecordError, parseTemplateRecord } from "./template-record.js";
125
154
  import { isSpokeExcluded, readSpokeShape } from "./topology.js";
126
155
  /** The app a page package's routes mount in, relative to the site root. */
127
156
  export const ROUTES_APP_DIR = "apps/web";
@@ -536,6 +565,13 @@ export function isGenerated(text) {
536
565
  const first = lines[0] === OSS_FALSE_MARKER ? (lines[1] ?? "") : (lines[0] ?? "");
537
566
  return first.startsWith(GENERATED_ROUTE_HEADER);
538
567
  }
568
+ /** The scaffold lint's two decided forms (`template-overlay/tools/lint-architecture.ts`), byte-identical; a test pins them equal. */
569
+ const DECISION_AILK = /^build-in: ailk#(\d+)(?: [—-] .+)?$/;
570
+ const DECISION_SITE = /^build-in: site [—-] [^,]+, \d{4}-\d{2}-\d{2}, .+$/;
571
+ /** Whether an entry records a decision (#11700 D2): `undecided`, no decision or any other text is not one. */
572
+ function isDecided(entry) {
573
+ return entry.decision !== undefined && (DECISION_SITE.test(entry.decision) || DECISION_AILK.test(entry.decision));
574
+ }
539
575
  /** The scaffold lint's own glob (`template-overlay/tools/lint-architecture.ts`): `**` is zero or more whole segments, `*` stays inside one. */
540
576
  function globToRegExp(glob) {
541
577
  const segments = glob.split("/");
@@ -556,7 +592,8 @@ function globToRegExp(glob) {
556
592
  * The entries of `<site>/customizations.yaml`, when the site has one — read
557
593
  * by line, in the shape the scaffold's own file documents (create-ailk
558
594
  * carries no YAML parser): under `customizations:`, each `- id: <id>` entry's
559
- * `paths:` list of quoted or bare globs, block or flow form. An entry with no id or no paths
595
+ * `paths:` list of quoted or bare globs, block or flow form, and its
596
+ * `decision:`. An entry with no id or no paths
560
597
  * records nothing; the overlay lint owns the file's full validation.
561
598
  */
562
599
  function readRecorded(siteDir) {
@@ -570,7 +607,7 @@ function readRecorded(siteDir) {
570
607
  const unquote = (raw) => raw.trim().replace(/^["']|["']$/g, "");
571
608
  const flush = () => {
572
609
  if (current?.id !== undefined && current.paths.length > 0) {
573
- out.push({ id: current.id, patterns: current.paths.map(globToRegExp) });
610
+ out.push({ id: current.id, patterns: current.paths.map(globToRegExp), decision: current.decision });
574
611
  }
575
612
  current = undefined;
576
613
  };
@@ -592,7 +629,7 @@ function readRecorded(siteDir) {
592
629
  const rest = entry ? entry[3] : (/^\s+(\w+):(.*)$/.exec(line)?.[2] ?? "");
593
630
  if (entry) {
594
631
  flush();
595
- current = { id: undefined, paths: [] };
632
+ current = { id: undefined, paths: [], decision: undefined };
596
633
  }
597
634
  if (current === undefined)
598
635
  continue;
@@ -600,6 +637,10 @@ function readRecorded(siteDir) {
600
637
  current.id = unquote(rest);
601
638
  inPaths = false;
602
639
  }
640
+ else if (key === "decision") {
641
+ current.decision = unquote(rest);
642
+ inPaths = false;
643
+ }
603
644
  else if (key === "paths") {
604
645
  // The flow form, `paths: ["a/**", "b/**"]`, or the block form below it.
605
646
  const flow = /^\s*\[(.*)\]\s*$/.exec(rest);
@@ -631,6 +672,299 @@ export function customizationsRecord(siteDir) {
631
672
  export function isRecordedRoute(siteDir, sitePath) {
632
673
  return customizationsRecord(siteDir)(sitePath) !== undefined;
633
674
  }
675
+ // ── Route-family renames — content/_site.mdx's `<family>.path` (#11385) ─────
676
+ const SITE_MDX = "content/_site.mdx";
677
+ const ROUTE_PATH_RE = /^\/[a-z0-9]+(-[a-z0-9]+)*$/;
678
+ /** A `path` key anywhere on a line, block or flow. */
679
+ const PATH_KEY_RE = /(?:^|[\s{,-])["']?path["']?\s*:/;
680
+ const hasOwn = (record, key) => Object.prototype.hasOwnProperty.call(record, key);
681
+ const unquoteScalar = (raw) => raw.trim().replace(/^"(.*)"$|^'(.*)'$/, "$1$2");
682
+ /**
683
+ * The route family paths `content/_site.mdx`'s frontmatter sets, read by line
684
+ * (create-ailk carries no YAML parser): a renamable top-level key's `path`,
685
+ * block form (`meet:` then an indented `path: /meetings`, quoted or bare) or
686
+ * one-line flow form (`meet: { path: /meetings }`). Whatever this reader
687
+ * cannot read with certainty is refused with its line, never guessed
688
+ * (SEC-11385-3): a YAML anchor, alias or merge key; a renamable key twice; a
689
+ * multi-line flow mapping on one; a `path` line it cannot attribute to one
690
+ * top-level key; a `path` on a family that is not renamable; and a value that
691
+ * is not one lowercase kebab segment, or is reserved. `services.path` is its
692
+ * own setting and is not read here. No file reads as no rename.
693
+ */
694
+ function readSiteRouteFamilies(siteDir) {
695
+ const out = { paths: {}, defaultLocale: "en" };
696
+ const file = join(resolve(siteDir), SITE_MDX);
697
+ if (!existsSync(file))
698
+ return out;
699
+ const lines = readFileSync(file, "utf8").split(/\r?\n/);
700
+ if (lines[0]?.trim() !== "---")
701
+ return out;
702
+ const refuse = (i, why) => {
703
+ throw new RoutesRefusedError(`${SITE_MDX} line ${i + 1}: ${why}`);
704
+ };
705
+ const renamable = (key) => hasOwn(RENAMABLE_ROUTE_FAMILIES, key);
706
+ const seen = new Set();
707
+ let top;
708
+ let childIndent;
709
+ let topHasPath = false;
710
+ let scalarIndent;
711
+ const takePath = (i, family, rawValue) => {
712
+ if (family === "services")
713
+ return;
714
+ const value = unquoteScalar(rawValue.replace(/\s+#.*$/, ""));
715
+ if (!renamable(family)) {
716
+ refuse(i, `${family}.path ${value}: ${family} is not a renamable route family (${Object.keys(RENAMABLE_ROUTE_FAMILIES).join(", ")})`);
717
+ }
718
+ if (topHasPath)
719
+ refuse(i, `${family}.path appears twice`);
720
+ topHasPath = true;
721
+ if (!ROUTE_PATH_RE.test(value)) {
722
+ refuse(i, `${family}.path ${value}: a route family's path is one lowercase kebab segment, like /writing-samples`);
723
+ }
724
+ if (RESERVED_ROUTE_SEGMENTS.includes(value.slice(1))) {
725
+ refuse(i, `${family}.path ${value}: reserved — ${value} is a reserved segment (${RESERVED_ROUTE_SEGMENTS.join(", ")})`);
726
+ }
727
+ out.paths[family] = value.slice(1);
728
+ };
729
+ for (let i = 1; i < lines.length; i++) {
730
+ const raw = lines[i];
731
+ if (/^(---|\.\.\.)\s*$/.test(raw))
732
+ break;
733
+ const indent = raw.length - raw.trimStart().length;
734
+ // A block scalar's lines are prose, not structure.
735
+ if (scalarIndent !== undefined) {
736
+ if (raw.trim() === "" || indent > scalarIndent)
737
+ continue;
738
+ scalarIndent = undefined;
739
+ }
740
+ // Quoted text and comments are not structure either.
741
+ const bare = raw
742
+ .replace(/"(?:[^"\\]|\\.)*"|'(?:[^']|'')*'/g, '""')
743
+ .replace(/(^|\s)#.*$/, "")
744
+ .trimEnd();
745
+ if (bare.trim() === "")
746
+ continue;
747
+ // A node starts a line, a list item or a value — or, in a flow collection, follows `[`, `{` or `,`.
748
+ const flow = /(?::|^\s*-)\s+[[{]/.test(bare);
749
+ const node = flow ? /(?:^\s*|^\s*-\s+|:\s+|[[{,]\s*)[&*][^\s,\]}]/ : /(?:^\s*|^\s*-\s+|:\s+)[&*][^\s,\]}]/;
750
+ if (/(?:^|[\s{,])<<\s*:/.test(bare) || node.test(bare)) {
751
+ refuse(i, "an anchor, alias or merge key, which create-ailk cannot read with certainty — write the route family paths out in full");
752
+ }
753
+ if (/(?::|^\s*-)\s+[|>][-+1-9]*$/.test(bare))
754
+ scalarIndent = indent;
755
+ if (indent === 0) {
756
+ const key = /^(["']?)([A-Za-z_$][\w$-]*)\1\s*:(?:\s+(.*))?$/.exec(raw);
757
+ top = key?.[2];
758
+ childIndent = undefined;
759
+ topHasPath = false;
760
+ if (key === null || top === undefined)
761
+ continue;
762
+ if (renamable(top)) {
763
+ if (seen.has(top))
764
+ refuse(i, `${top} appears twice`);
765
+ seen.add(top);
766
+ }
767
+ const value = (key[3] ?? "").replace(/\s+#.*$/, "").trim();
768
+ if (top === "defaultLocale" && value !== "")
769
+ out.defaultLocale = unquoteScalar(value);
770
+ if (!value.startsWith("{"))
771
+ continue;
772
+ if (!value.endsWith("}") || /[{}[\]]/.test(value.slice(1, -1))) {
773
+ if (renamable(top) || PATH_KEY_RE.test(bare))
774
+ refuse(i, `${top}: a flow mapping create-ailk cannot read — write it on one line, or in block form`);
775
+ continue;
776
+ }
777
+ for (const pair of value.slice(1, -1).split(",")) {
778
+ const at = pair.indexOf(":");
779
+ if (at !== -1 && unquoteScalar(pair.slice(0, at)) === "path")
780
+ takePath(i, top, pair.slice(at + 1));
781
+ }
782
+ continue;
783
+ }
784
+ if (top === undefined) {
785
+ if (PATH_KEY_RE.test(bare))
786
+ refuse(i, "a path line create-ailk cannot attribute to one top-level key");
787
+ continue;
788
+ }
789
+ childIndent ??= indent;
790
+ const pathLine = /^\s*(["']?)path\1\s*:(?:\s+(.*))?$/.exec(raw);
791
+ if (indent === childIndent && pathLine !== null)
792
+ takePath(i, top, pathLine[2] ?? "");
793
+ else if (renamable(top) && PATH_KEY_RE.test(bare)) {
794
+ refuse(i, `${top}: a path line create-ailk cannot attribute to the route family — set ${top}.path directly under ${top}`);
795
+ }
796
+ }
797
+ return out;
798
+ }
799
+ /** Family-keyed paths → `{ <convention segment>: <served segment> }`. */
800
+ function conventionRenames(paths) {
801
+ const out = {};
802
+ for (const [family, segment] of Object.entries(paths))
803
+ out[RENAMABLE_ROUTE_FAMILIES[family]] = segment;
804
+ return out;
805
+ }
806
+ /**
807
+ * The site's route renames (#11385 D6): `content/_site.mdx`'s renamable
808
+ * family paths as `{ <convention segment>: <served segment> }` —
809
+ * `{ meet: "meetings" }`, `{ "case-studies": "work" }`. Throws
810
+ * `RoutesRefusedError`, naming the key and the line, for frontmatter it
811
+ * cannot read with certainty; no file is `{}`.
812
+ */
813
+ export function readSiteRouteRenames(siteDir) {
814
+ return conventionRenames(readSiteRouteFamilies(siteDir).paths);
815
+ }
816
+ /**
817
+ * A copy of `@working-theory/templates`' `routeRenameRefusals` (#11385 D7),
818
+ * message for message — `tests/routes/route-renames-parity.test.ts` runs both
819
+ * over one table. `renames` is family-keyed; the served set is
820
+ * `ROUTES_FIRST_SEGMENTS` (the routes map's first segments) plus
821
+ * `extraServed`.
822
+ */
823
+ export function routeRenameRefusals(renames, conventions, reserved, extraServed = []) {
824
+ const served = new Set(extraServed);
825
+ for (const first of ROUTES_FIRST_SEGMENTS)
826
+ served.add(first);
827
+ const entries = Object.entries(renames);
828
+ const refusals = [];
829
+ for (const [family, target] of entries) {
830
+ const head = `${family} → /${target}:`;
831
+ const own = conventions[family];
832
+ if (target === own) {
833
+ refusals.push(`${head} no-op — it is the family's own segment`);
834
+ }
835
+ else if (reserved.includes(target)) {
836
+ refusals.push(`${head} reserved — /${target} is a reserved segment`);
837
+ }
838
+ else {
839
+ const chained = entries.find(([other]) => other !== family && conventions[other] === target);
840
+ if (chained !== undefined) {
841
+ refusals.push(`${head} chain — /${target} is ${chained[0]}'s own segment, which ${chained[0]} renames to /${chained[1]}`);
842
+ }
843
+ else if (served.has(target)) {
844
+ refusals.push(`${head} served route — /${target} is already served`);
845
+ }
846
+ }
847
+ for (const [other, otherTarget] of entries) {
848
+ if (other !== family && otherTarget === target && family < other) {
849
+ refusals.push(`${head} same target — ${family} and ${other} both rename to /${target}`);
850
+ }
851
+ }
852
+ }
853
+ return refusals;
854
+ }
855
+ /** A path under `app/[locale]/` (no leading slash) with a renamed first segment swapped. */
856
+ function renamedEntryPath(path, renames) {
857
+ const [first, ...rest] = path.split("/");
858
+ return first !== undefined && hasOwn(renames, first) ? [renames[first], ...rest].join("/") : path;
859
+ }
860
+ /** Every entry at or under `path`, lstat-read: a link is listed and never followed. */
861
+ function lstatTree(path) {
862
+ let stat;
863
+ try {
864
+ stat = lstatSync(path);
865
+ }
866
+ catch {
867
+ return [];
868
+ }
869
+ if (stat.isSymbolicLink())
870
+ return [{ path, link: true }];
871
+ if (!stat.isDirectory())
872
+ return [{ path, link: false }];
873
+ return readdirSync(path)
874
+ .sort()
875
+ .flatMap((name) => lstatTree(join(path, name)));
876
+ }
877
+ /** The package a generated file's header names, or undefined for a file the generator did not write. */
878
+ function generatedBy(text) {
879
+ if (!isGenerated(text))
880
+ return undefined;
881
+ const lines = text.split("\n", 2);
882
+ const header = lines[0] === OSS_FALSE_MARKER ? lines[1] : lines[0];
883
+ return header.slice(GENERATED_ROUTE_HEADER.length).split(" ")[0];
884
+ }
885
+ /**
886
+ * Every reason the site's renames cannot be carried out (#11385 D7), each
887
+ * `<family> → /<new>: <reason>`: `routeRenameRefusals` over the installed
888
+ * manifests' first segments that belong to no renamed family and the content
889
+ * slugs `[slug]` would serve at a target; then, per family, a symbolic link
890
+ * at or under the old or new directory, a file under the old directory that
891
+ * is not a generated routing file (it would be stranded), a
892
+ * `customizations.yaml` record under the old directory, and a file under the
893
+ * new one that is not a generated routing file of the family's own packages.
894
+ * Check mode refuses only the collisions and the links: it reports a
895
+ * stranded, recorded or occupying file as the stray, recorded or stale file
896
+ * it is, so `--check` names it rather than stopping.
897
+ */
898
+ function renameRefusals(root, web, manifests, recorded, families, mode) {
899
+ const renamed = new Set(Object.keys(families.paths).map((family) => RENAMABLE_ROUTE_FAMILIES[family]));
900
+ const extra = new Set();
901
+ const serve = (segment) => {
902
+ if (segment !== undefined && segment !== "" && !renamed.has(segment))
903
+ extra.add(segment);
904
+ };
905
+ for (const manifest of manifests) {
906
+ for (const prefix of manifest.prefix)
907
+ serve(prefix.split("/")[0]);
908
+ for (const entry of manifest.routes)
909
+ if (entry.mount === "locale")
910
+ serve(routeSegments(entry.path)[0]);
911
+ }
912
+ // No page-type registry is vendored here, so a default-locale content file
913
+ // of any type at the target's slug counts as a page `[slug]` serves.
914
+ const contentDir = join(root, "content", families.defaultLocale);
915
+ const types = existsSync(contentDir)
916
+ ? readdirSync(contentDir, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name)
917
+ : [];
918
+ for (const target of Object.values(families.paths)) {
919
+ if (types.some((type) => existsSync(join(contentDir, type, `${target}.mdx`))))
920
+ extra.add(target);
921
+ }
922
+ const refusals = routeRenameRefusals(families.paths, RENAMABLE_ROUTE_FAMILIES, RESERVED_ROUTE_SEGMENTS, [...extra]);
923
+ const site = (path) => relative(root, path).split(sep).join("/");
924
+ for (const [family, target] of Object.entries(families.paths)) {
925
+ const head = `${family} → /${target}:`;
926
+ const from = RENAMABLE_ROUTE_FAMILIES[family];
927
+ const owners = new Set(manifests
928
+ .filter((m) => m.prefix.some((p) => p.split("/")[0] === from) || m.routes.some((e) => e.mount === "locale" && e.path.split("/")[0] === from))
929
+ .map((m) => m.package));
930
+ const oldTree = lstatTree(join(web, LOCALE_DIR, from));
931
+ const newTree = lstatTree(join(web, LOCALE_DIR, target));
932
+ for (const { path, link } of [...oldTree, ...newTree]) {
933
+ if (link)
934
+ refusals.push(`${head} link — ${site(path)} is a symbolic link`);
935
+ }
936
+ if (mode === "check")
937
+ continue;
938
+ const generated = (path) => ROUTING_FILES.has(posix.basename(path.split(sep).join("/"))) ? generatedBy(readFileSync(path, "utf8")) : undefined;
939
+ const oldFiles = oldTree.filter((e) => !e.link).map((e) => e.path);
940
+ for (const path of oldFiles) {
941
+ if (generated(path) === undefined) {
942
+ refusals.push(`${head} stranded — ${site(path)} is not a generated route file, and would be left behind under /${from}`);
943
+ }
944
+ }
945
+ const candidates = [
946
+ ...oldFiles.map(site),
947
+ ...manifests.flatMap((m) => m.routes
948
+ .filter((e) => e.mount === "locale" && e.path.split("/")[0] === from)
949
+ .map((e) => posix.join(ROUTES_APP_DIR, LOCALE_DIR, e.path))),
950
+ ];
951
+ for (const record of recorded) {
952
+ const match = candidates.find((path) => record.patterns.some((re) => re.test(path)));
953
+ if (match !== undefined) {
954
+ refusals.push(`${head} recorded route — customizations.yaml "${record.id}" records ${match} under /${from}, which would no longer match the moved file`);
955
+ }
956
+ }
957
+ for (const { path, link } of newTree) {
958
+ if (link)
959
+ continue;
960
+ const by = generated(path);
961
+ if (by === undefined || !owners.has(by)) {
962
+ refusals.push(`${head} occupied target — ${site(path)} is not a generated route file of ${family}`);
963
+ }
964
+ }
965
+ }
966
+ return refusals;
967
+ }
634
968
  /** Routing files under `<web>/<mount dir>/<prefix>`, as site-relative POSIX paths, sorted. */
635
969
  function routingFilesUnder(web, siteDir, prefix, mount = "locale") {
636
970
  const out = [];
@@ -651,9 +985,11 @@ function routingFilesUnder(web, siteDir, prefix, mount = "locale") {
651
985
  walk(root);
652
986
  return out.sort();
653
987
  }
654
- function plan(siteDir) {
988
+ function plan(siteDir, mode = "check") {
655
989
  const root = resolve(siteDir);
656
990
  const web = join(root, ROUTES_APP_DIR);
991
+ const families = readSiteRouteFamilies(root);
992
+ const renames = conventionRenames(families.paths);
657
993
  const manifests = readRouteManifests(root);
658
994
  const recorded = readRecorded(root);
659
995
  // The site's topology (`.ailk-site-manifest.json`): on a spoke, the paths
@@ -676,16 +1012,34 @@ function plan(siteDir) {
676
1012
  }
677
1013
  }
678
1014
  for (const entry of manifest.routes) {
679
- const absPath = join(web, mountDir(entry.mount), entry.path);
1015
+ // #11385 D5 — a renamed family's entry is planned under the new
1016
+ // segment; the gates read the convention path they are keyed on.
1017
+ const routePath = entry.mount === "locale" ? renamedEntryPath(entry.path, renames) : entry.path;
1018
+ const absPath = join(web, mountDir(entry.mount), routePath);
680
1019
  const sitePath = relative(root, absPath).split(sep).join("/");
681
- if (!carries(manifest, entry, sitePath)) {
1020
+ const conventionSitePath = relative(root, join(web, mountDir(entry.mount), entry.path)).split(sep).join("/");
1021
+ if (!carries(manifest, entry, conventionSitePath)) {
682
1022
  notCarried.push(sitePath);
683
1023
  continue;
684
1024
  }
685
- planned.push({ sitePath, absPath, text: renderRouteFile(manifest, entry), record: recordFor(recorded, sitePath) });
1025
+ planned.push({
1026
+ sitePath,
1027
+ absPath,
1028
+ routePath,
1029
+ text: renderRouteFile(manifest, entry),
1030
+ record: recordFor(recorded, sitePath),
1031
+ package: manifest.package,
1032
+ entry,
1033
+ });
1034
+ }
1035
+ }
1036
+ if (Object.keys(families.paths).length > 0) {
1037
+ const refusals = renameRefusals(root, web, manifests, recorded, families, mode);
1038
+ if (refusals.length > 0) {
1039
+ throw new RoutesRefusedError(`${SITE_MDX}: the route family rename is refused, and nothing was written or removed:\n ${refusals.join("\n ")}`);
686
1040
  }
687
1041
  }
688
- return { root, web, manifests, planned, recorded, notCarried };
1042
+ return { root, web, manifests, planned, recorded, notCarried, renames };
689
1043
  }
690
1044
  /**
691
1045
  * Whether a `siteGated` manifest's entry at `sitePath` is a route of the site
@@ -718,14 +1072,15 @@ export function siteGate(siteDir) {
718
1072
  return surface === undefined || surfaces.has(surface.id);
719
1073
  };
720
1074
  }
721
- /** The count check mode fails on: missing, stale and stray route files, orphaned overrides, missing seam aliases and unserved roster routes. */
1075
+ /** The count check mode fails on: missing, stale and stray route files, orphaned overrides, missing seam aliases, unserved roster routes and undecided pages. */
722
1076
  export function routesFailing(drift) {
723
1077
  return (drift.missing.length +
724
1078
  drift.stale.length +
725
1079
  drift.stray.length +
726
1080
  drift.orphanedOverrides.length +
727
1081
  drift.seamAliasMissing.length +
728
- drift.unservedRoster.length);
1082
+ drift.unservedRoster.length +
1083
+ drift.undecidedPages.length);
729
1084
  }
730
1085
  /**
731
1086
  * The two site files that bind a `siteSeam` package's `<package>/site` to
@@ -828,7 +1183,7 @@ function matchPage(page, route) {
828
1183
  return dynamic ? "dynamic" : "static";
829
1184
  }
830
1185
  /** The roster page routes the site carries that no page file serves, each with the page path it expected (D4–D6). */
831
- function unservedRoster(root, web) {
1186
+ function unservedRoster(root, web, renames) {
832
1187
  const routes = rosterRoutes(root);
833
1188
  if (routes.length === 0)
834
1189
  return [];
@@ -849,17 +1204,99 @@ function unservedRoster(root, web) {
849
1204
  continue;
850
1205
  if (declinedRouteOfPath(expected, declined) !== undefined)
851
1206
  continue;
852
- const matches = pages.map((page) => matchPage(page, segments));
1207
+ // #11385 D5 — a renamed family's roster route is served under its new segment.
1208
+ const at = renamedEntryPath(segments.join("/"), renames).split("/").filter((s) => s !== "");
1209
+ const matches = pages.map((page) => matchPage(page, at));
853
1210
  const served = matches.includes("static") ||
854
1211
  (matches.includes("dynamic") && (segments.some(isDynamic) || hasContent(segments[segments.length - 1])));
855
1212
  if (!served)
856
- out.push(`${route} → ${expected}`);
1213
+ out.push(`${route} → ${posix.join(ROUTES_APP_DIR, LOCALE_DIR, ...at, "page.tsx")}`);
857
1214
  }
858
1215
  return out;
859
1216
  }
1217
+ // ── Site pages — each a package page or a decided one (#11700) ─────────────
1218
+ /** The keys of the site's `.ailk-template-files.json`, or `undefined` with no record; a record that does not parse refuses. */
1219
+ function readTemplateFiles(root) {
1220
+ const path = join(root, TEMPLATE_RECORD_PATH);
1221
+ if (!existsSync(path))
1222
+ return undefined;
1223
+ try {
1224
+ return new Set(Object.keys(parseTemplateRecord(readFileSync(path, "utf8"), { onUnrecordable: () => { } }).files));
1225
+ }
1226
+ catch (err) {
1227
+ if (err instanceof TemplateRecordError)
1228
+ throw new RoutesRefusedError(err.message);
1229
+ throw err;
1230
+ }
1231
+ }
1232
+ /**
1233
+ * `architecture.yaml`'s `customizations.scaffold_paths` globs — the files a
1234
+ * generator or module bundle writes — read by line in the shape
1235
+ * `derive-architecture.ts` emits: a two-space `scaffold_paths:` key under the
1236
+ * top-level `customizations:`, then four-space `- "<glob>"` items.
1237
+ */
1238
+ function readScaffoldPaths(root) {
1239
+ const path = join(root, "architecture.yaml");
1240
+ if (!existsSync(path))
1241
+ return [];
1242
+ const out = [];
1243
+ let inCustomizations = false;
1244
+ let inList = false;
1245
+ for (const line of readFileSync(path, "utf8").split(/\r?\n/)) {
1246
+ if (/^\S/.test(line)) {
1247
+ inCustomizations = /^customizations:/.test(line);
1248
+ inList = false;
1249
+ }
1250
+ else if (inCustomizations && /^ {2}\S/.test(line)) {
1251
+ inList = /^ {2}scaffold_paths:\s*$/.test(line);
1252
+ }
1253
+ else if (inList) {
1254
+ const item = /^ {4}-\s+(.+?)\s*$/.exec(line);
1255
+ if (item)
1256
+ out.push(globToRegExp(item[1].replace(/^["']|["']$/g, "")));
1257
+ }
1258
+ }
1259
+ return out;
1260
+ }
1261
+ /** A `page.tsx`'s route segments under `app/[locale]/`: route groups and `_` / `@` folders dropped. */
1262
+ function routeSegments(localePath) {
1263
+ return posix
1264
+ .dirname(localePath)
1265
+ .split("/")
1266
+ .filter((s) => s !== "." && !(s.startsWith("(") && s.endsWith(")")) && !s.startsWith("_") && !s.startsWith("@"));
1267
+ }
1268
+ /**
1269
+ * What already serves a hand-written `page.tsx` (#11700 D6): the
1270
+ * `add-route magnet` command for a magnet page, else the installed package
1271
+ * page whose route matches its address (a static match before a dynamic
1272
+ * one), else nothing.
1273
+ */
1274
+ function suggestionFor(sitePath, text, planned) {
1275
+ const localePath = sitePath.slice(`${ROUTES_APP_DIR}/${LOCALE_DIR}/`.length);
1276
+ const segments = routeSegments(localePath);
1277
+ if (text.includes(MAGNET_PAGE_MARKER) || /\bmagnet(?:Landing|Start)\b/.test(text)) {
1278
+ const landing = segments.length > 1 && segments[segments.length - 1] === "start" ? segments.slice(0, -1) : segments;
1279
+ const flow = MAGNET_COMMAND_RE.exec(text.split("\n", 1)[0] ?? "")?.[2] ?? /\bslug:\s*"([^"]+)"/.exec(text)?.[1] ?? "<flow-slug>";
1280
+ return `regenerate it: \`create-ailk add-route magnet --path /${landing.join("/")} --flow ${flow}\``;
1281
+ }
1282
+ let dynamic;
1283
+ for (const p of planned) {
1284
+ if (p.entry.mount !== "locale" || p.entry.kind !== "page")
1285
+ continue;
1286
+ const match = matchPage(routeSegments(p.routePath), segments);
1287
+ if (match === "static")
1288
+ return `${p.package}'s ${p.entry.path} serves this address — delete this file, then run \`create-ailk routes --write\``;
1289
+ if (match === "dynamic")
1290
+ dynamic ??= p;
1291
+ }
1292
+ if (dynamic === undefined)
1293
+ return undefined;
1294
+ return `${dynamic.package}'s ${dynamic.entry.path} serves this address (from a content file) — delete this file, then run \`create-ailk routes --write\``;
1295
+ }
860
1296
  /** How the site's route files and message overrides differ from the installed page packages. `routesFailing` zero means in sync. */
861
1297
  export function checkRoutes(siteDir) {
862
- const { root, web, manifests, planned, recorded, notCarried } = plan(siteDir);
1298
+ const { root, web, manifests, planned, recorded, notCarried, renames } = plan(siteDir);
1299
+ const templateFiles = readTemplateFiles(root);
863
1300
  const drift = {
864
1301
  missing: [],
865
1302
  stale: [],
@@ -869,15 +1306,27 @@ export function checkRoutes(siteDir) {
869
1306
  siteKept: [],
870
1307
  orphanedOverrides: orphanedOverrides(web, root, manifests),
871
1308
  seamAliasMissing: seamAliasMissing(web, root, manifests),
872
- unservedRoster: unservedRoster(root, web),
1309
+ unservedRoster: unservedRoster(root, web, renames),
1310
+ undecidedPages: [],
1311
+ decidedPages: [],
1312
+ routeSuggestions: {},
1313
+ sitePagesUnchecked: templateFiles === undefined,
873
1314
  generated: planned.length,
874
1315
  };
1316
+ const read = (sitePath) => readFileSync(join(root, sitePath), "utf8");
1317
+ // A recorded route needs a decided entry; an undecided one fails (#11700 D3).
1318
+ const claim = (sitePath, record, state) => {
1319
+ if (isDecided(record))
1320
+ drift.recorded.push({ path: sitePath, state, id: record.id });
1321
+ else
1322
+ drift.undecidedPages.push({ path: sitePath, id: record.id });
1323
+ };
875
1324
  const known = new Set();
876
1325
  for (const p of planned) {
877
1326
  known.add(p.sitePath);
878
1327
  const exists = existsSync(p.absPath);
879
1328
  if (p.record) {
880
- drift.recorded.push({ path: p.sitePath, state: exists ? "replaced" : "removed", id: p.record.id });
1329
+ claim(p.sitePath, p.record, exists ? "replaced" : "removed");
881
1330
  }
882
1331
  else if (!exists) {
883
1332
  drift.missing.push(p.sitePath);
@@ -891,11 +1340,15 @@ export function checkRoutes(siteDir) {
891
1340
  // contract ahead of its first page): nothing under its prefix is stray.
892
1341
  if (manifest.routes.length === 0)
893
1342
  continue;
894
- const kept = new Set(manifest.siteOwned.map((path) => relative(root, join(web, LOCALE_DIR, path)).split(sep).join("/")));
1343
+ const kept = new Set(manifest.siteOwned.map((path) => relative(root, join(web, LOCALE_DIR, renamedEntryPath(path, renames))).split(sep).join("/")));
895
1344
  const rootPage = join(web, LOCALE_DIR, ROOT_PAGE);
896
1345
  const underPrefixes = [
897
1346
  ...(manifest.localeRoot && existsSync(rootPage) ? [relative(root, rootPage).split(sep).join("/")] : []),
898
- ...manifest.prefix.flatMap((prefix) => routingFilesUnder(web, root, prefix)),
1347
+ // #11385 D5 — a renamed prefix's stray scope is its old and its new segment.
1348
+ ...manifest.prefix.flatMap((prefix) => {
1349
+ const moved = renamedEntryPath(prefix, renames);
1350
+ return moved === prefix ? routingFilesUnder(web, root, prefix) : [...routingFilesUnder(web, root, prefix), ...routingFilesUnder(web, root, moved)];
1351
+ }),
899
1352
  ...manifest.appPrefixes.flatMap((prefix) => routingFilesUnder(web, root, prefix, "app")),
900
1353
  ];
901
1354
  for (const sitePath of underPrefixes) {
@@ -906,13 +1359,47 @@ export function checkRoutes(siteDir) {
906
1359
  drift.siteKept.push(sitePath);
907
1360
  continue;
908
1361
  }
1362
+ // A pair `add-route magnet` wrote is never reported (#11700 D5).
1363
+ if (isGeneratedMagnetPage(sitePath, read(sitePath)))
1364
+ continue;
909
1365
  const record = recordFor(recorded, sitePath);
910
1366
  if (record)
911
- drift.recorded.push({ path: sitePath, state: "replaced", id: record.id });
1367
+ claim(sitePath, record, "replaced");
912
1368
  else
913
1369
  drift.stray.push(sitePath);
914
1370
  }
915
1371
  }
1372
+ // Every other routing file under app/[locale]/ the template, a generator or
1373
+ // `add-route magnet` did not write is a site page (#11700 D1).
1374
+ const shipped = readScaffoldPaths(root);
1375
+ for (const sitePath of routingFilesUnder(web, root, "")) {
1376
+ if (known.has(sitePath) || templateFiles?.has(sitePath) || shipped.some((re) => re.test(sitePath)))
1377
+ continue;
1378
+ const text = read(sitePath);
1379
+ if (isGenerated(text) || isGeneratedMagnetPage(sitePath, text))
1380
+ continue;
1381
+ const record = recordFor(recorded, sitePath);
1382
+ if (record !== undefined && isDecided(record))
1383
+ drift.decidedPages.push({ path: sitePath, state: "replaced", id: record.id });
1384
+ else if (record !== undefined)
1385
+ drift.undecidedPages.push({ path: sitePath, id: record.id });
1386
+ else if (templateFiles !== undefined)
1387
+ drift.undecidedPages.push({ path: sitePath });
1388
+ }
1389
+ drift.undecidedPages.sort((a, b) => (a.path < b.path ? -1 : a.path > b.path ? 1 : 0));
1390
+ const reported = [
1391
+ ...drift.stray,
1392
+ ...drift.stale.filter((path) => !isGenerated(read(path))),
1393
+ ...drift.undecidedPages.map((page) => page.path),
1394
+ ...drift.decidedPages.map((page) => page.path),
1395
+ ];
1396
+ for (const sitePath of reported) {
1397
+ if (posix.basename(sitePath) !== "page.tsx" || !existsSync(join(root, sitePath)))
1398
+ continue;
1399
+ const suggestion = suggestionFor(sitePath, read(sitePath), planned);
1400
+ if (suggestion !== undefined)
1401
+ drift.routeSuggestions[sitePath] = suggestion;
1402
+ }
916
1403
  return drift;
917
1404
  }
918
1405
  function readCatalog(path) {
@@ -989,8 +1476,8 @@ function orphanedOverrides(web, siteDir, manifests) {
989
1476
  }
990
1477
  /** Write every generated file that is missing or stale; a recorded route is left exactly as it is. */
991
1478
  export function writeRoutes(siteDir) {
992
- const { planned } = plan(siteDir);
993
- const result = { written: [], current: [], recorded: [], kept: [] };
1479
+ const { root, web, planned, renames } = plan(siteDir, "write");
1480
+ const result = { written: [], current: [], recorded: [], kept: [], removed: [] };
994
1481
  for (const p of planned) {
995
1482
  const exists = existsSync(p.absPath);
996
1483
  if (p.record) {
@@ -1012,8 +1499,60 @@ export function writeRoutes(siteDir) {
1012
1499
  writeFileSync(p.absPath, p.text);
1013
1500
  result.written.push(p.sitePath);
1014
1501
  }
1502
+ for (const from of Object.keys(renames))
1503
+ vacate(join(web, LOCALE_DIR, from), root, result);
1015
1504
  return result;
1016
1505
  }
1506
+ /**
1507
+ * Delete the generated routing files under a renamed family's old directory
1508
+ * and the directories that leaves empty (#11385 D5, SEC-11385-5). Entries are
1509
+ * read with lstat and no link is followed; each file is re-checked as it is
1510
+ * deleted — a regular file, its real path inside the directory, still
1511
+ * carrying the generator header — and one that fails is left and reported as
1512
+ * kept. `plan()` has already refused anything else under the directory.
1513
+ */
1514
+ function vacate(dir, root, result) {
1515
+ let base;
1516
+ try {
1517
+ if (!lstatSync(dir).isDirectory())
1518
+ return;
1519
+ base = realpathSync(dir);
1520
+ }
1521
+ catch {
1522
+ return;
1523
+ }
1524
+ const walk = (current) => {
1525
+ for (const name of readdirSync(current).sort()) {
1526
+ const path = join(current, name);
1527
+ const stat = lstatSync(path);
1528
+ if (stat.isDirectory()) {
1529
+ walk(path);
1530
+ continue;
1531
+ }
1532
+ const sitePath = relative(root, path).split(sep).join("/");
1533
+ const deletable = stat.isFile() &&
1534
+ ROUTING_FILES.has(name) &&
1535
+ realpathSync(path).startsWith(`${base}${sep}`) &&
1536
+ isGenerated(readFileSync(path, "utf8"));
1537
+ if (!deletable) {
1538
+ result.kept.push(sitePath);
1539
+ continue;
1540
+ }
1541
+ unlinkSync(path);
1542
+ result.removed.push(sitePath);
1543
+ }
1544
+ if (readdirSync(current).length === 0)
1545
+ rmdirSync(current);
1546
+ };
1547
+ walk(dir);
1548
+ }
1549
+ /**
1550
+ * The order an agent or a person adds a page in (#11700 D8). The same
1551
+ * sentence is in this help, the check's failure header, the scaffold
1552
+ * CLAUDE.md, the `add-page` and `extend-site` skill text and
1553
+ * `template-guard.sh`'s refusal; `routes.test.ts` reads all six.
1554
+ */
1555
+ export const PAGE_DECISION_GUIDANCE = "Before you add a page, look up its page type and the package route that serves it, and use that package page when it exists. Otherwise record the decision in customizations.yaml (build-in: site — <decider>, <YYYY-MM-DD>, <reason>) before you write the file.";
1017
1556
  export const ROUTES_HELP = `create-ailk routes — generate the route files for the pages a site's packages ship.
1018
1557
 
1019
1558
  Usage:
@@ -1039,7 +1578,13 @@ Options:
1039
1578
  the catalog no longer has. And it names each roster
1040
1579
  page route (.ailk-site-manifest.json) that no page
1041
1580
  file serves — neither a site page nor a generated
1042
- re-export.
1581
+ re-export. And it names each undecided page: a
1582
+ routing file under app/[locale]/ that no package,
1583
+ generator or template wrote, or a recorded package
1584
+ route, with no decided customizations.yaml entry
1585
+ (an undecided entry fails too). A reported
1586
+ page.tsx names the package page or the add-route
1587
+ magnet command that already serves its address.
1043
1588
  --help, -h Print this message.
1044
1589
 
1045
1590
  A page package is an installed @working-theory/* dependency of apps/web whose
@@ -1058,6 +1603,11 @@ are not carried when .ailk-site-manifest.json lists no marketing module, and
1058
1603
  neither is any page under a surface the architecture.yaml "# Surfaces:" header
1059
1604
  leaves out. Run --write after \`pnpm install\` (the manifests are read from the
1060
1605
  installed packages); the scaffold's preflight runs --check as \`pnpm routes:check\`.
1606
+
1607
+ ${PAGE_DECISION_GUIDANCE} A decided entry is
1608
+ "build-in: site — <decider>, <YYYY-MM-DD>, <reason>" or "build-in: ailk#<N>";
1609
+ undecided_ok_until does not apply to a page. With no .ailk-template-files.json
1610
+ a page outside every package prefix is not checked, and the report says so.
1061
1611
  `;
1062
1612
  /** Parse the argv AFTER the `routes` word. Strict `node:util` parseArgs, like `parseSyncRoutesArgs`. */
1063
1613
  export function parseRoutesArgs(argv) {
@@ -1090,10 +1640,12 @@ export function formatRoutesReport(result, mode) {
1090
1640
  const lines = [];
1091
1641
  if (mode === "check") {
1092
1642
  const drift = result;
1643
+ const hint = (p) => (drift.routeSuggestions[p] === undefined ? "" : ` → ${drift.routeSuggestions[p]}`);
1093
1644
  const failing = [
1094
1645
  ...drift.missing.map((p) => ` missing: ${p}`),
1095
- ...drift.stale.map((p) => ` stale: ${p}`),
1096
- ...drift.stray.map((p) => ` stray: ${p}`),
1646
+ ...drift.stale.map((p) => ` stale: ${p}${hint(p)}`),
1647
+ ...drift.stray.map((p) => ` stray: ${p}${hint(p)}`),
1648
+ ...drift.undecidedPages.map(({ path, id }) => ` undecided: ${path} — ${id === undefined ? "no customizations.yaml entry" : `customizations.yaml "${id}" is undecided`}${hint(path)}`),
1097
1649
  ...drift.orphanedOverrides.map((p) => ` orphaned override: ${p}`),
1098
1650
  ...drift.seamAliasMissing.map((p) => ` missing site seam alias: ${p}`),
1099
1651
  ...drift.unservedRoster.map((entry) => {
@@ -1105,7 +1657,12 @@ export function formatRoutesReport(result, mode) {
1105
1657
  lines.push(`[create-ailk] routes: OK — ${drift.generated} generated route file(s) in sync`);
1106
1658
  }
1107
1659
  else {
1108
- lines.push(`[create-ailk] routes: ${failing.length} route file(s) or message override(s) differ from the installed page packages (run \`create-ailk routes --write\` to rewrite a route file; record a replaced or removed route in customizations.yaml; delete an orphaned override, whose key the package no longer has; add a page for an unserved roster route, or drop or decline its row):`, ...failing);
1660
+ lines.push(`[create-ailk] routes: ${failing.length} route file(s) or message override(s) differ from the installed page packages (run \`create-ailk routes --write\` to rewrite a route file; record a replaced or removed route in customizations.yaml; delete an orphaned override, whose key the package no longer has; add a page for an unserved roster route, or drop or decline its row):${drift.undecidedPages.length > 0 ? ` ${PAGE_DECISION_GUIDANCE}` : ""}`, ...failing);
1661
+ }
1662
+ for (const r of drift.decidedPages)
1663
+ lines.push(` kept by the site (decided): ${r.path} — customizations.yaml "${r.id}"${hint(r.path)}`);
1664
+ if (drift.sitePagesUnchecked) {
1665
+ lines.push(` site pages not checked: no ${TEMPLATE_RECORD_PATH} (run create-ailk update to write it)`);
1109
1666
  }
1110
1667
  }
1111
1668
  else {
@@ -1115,6 +1672,8 @@ export function formatRoutesReport(result, mode) {
1115
1672
  lines.push(` wrote: ${p}`);
1116
1673
  for (const p of write.kept)
1117
1674
  lines.push(` kept (not a generated file, never overwritten): ${p}`);
1675
+ for (const p of write.removed)
1676
+ lines.push(` removed: ${p}`);
1118
1677
  }
1119
1678
  for (const r of result.recorded)
1120
1679
  lines.push(` ${r.state} (recorded): ${r.path} — customizations.yaml "${r.id}"`);