@yahoo/uds-create-config 5.108.2 → 5.108.4

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.
@@ -68,6 +68,11 @@ export declare function yosNative(): import("..").ConfigInstance<{
68
68
  when: import("zod").ZodOptional<import("zod").ZodString>;
69
69
  reason: import("zod").ZodString;
70
70
  }, import("zod/v4/core").$strict>>>;
71
+ names: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
72
+ label: import("zod").ZodOptional<import("zod").ZodString>;
73
+ description: import("zod").ZodOptional<import("zod").ZodString>;
74
+ }, import("zod/v4/core").$strict>>>;
75
+ removed: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
71
76
  }, import("zod/v4/core").$strict>>;
72
77
  defaults: import("zod").ZodOptional<import("zod").ZodObject<{
73
78
  background: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodObject<{
@@ -86,6 +86,11 @@ declare const ReactNativeSystemDefinition: ConfigClass<{
86
86
  when: _$zod.ZodOptional<_$zod.ZodString>;
87
87
  reason: _$zod.ZodString;
88
88
  }, _$zod_v4_core0.$strict>>>;
89
+ names: _$zod.ZodOptional<_$zod.ZodRecord<_$zod.ZodString, _$zod.ZodObject<{
90
+ label: _$zod.ZodOptional<_$zod.ZodString>;
91
+ description: _$zod.ZodOptional<_$zod.ZodString>;
92
+ }, _$zod_v4_core0.$strict>>>;
93
+ removed: _$zod.ZodOptional<_$zod.ZodArray<_$zod.ZodString>>;
89
94
  }, _$zod_v4_core0.$strict>>;
90
95
  defaults: _$zod.ZodOptional<_$zod.ZodObject<{
91
96
  background: _$zod.ZodOptional<_$zod.ZodUnion<readonly [_$zod.ZodUnion<readonly [_$zod.ZodString, _$zod.ZodObject<{
@@ -17,6 +17,7 @@ import { reanimatedCubicBezierMigration } from "../migrations/20261015212722_rea
17
17
  import { motionJsonSchemaMigration } from "../migrations/20261015221052_motion_json_schema.js";
18
18
  import { motionTypeOnlyMigration } from "../migrations/20261016135620_motion_type_only.js";
19
19
  import { styleSetOwnRuleOnlyMigration } from "../migrations/20261113131930_style_set_own_rule_only.js";
20
+ import { lintNamesRemovedMigration } from "../migrations/20261118171253_lint_names_removed.js";
20
21
  import { CanvasRole } from "../entities/system/CanvasRole.js";
21
22
  import { Guidance } from "../entities/system/Guidance.js";
22
23
  import { Source } from "../entities/system/Source.js";
@@ -78,5 +79,6 @@ if (!registeredSchemaMigrations().has(20261015221052)) registerSchemaMigrations(
78
79
  if (!registeredSchemaMigrations().has(20261016135620)) registerSchemaMigrations(motionTypeOnlyMigration);
79
80
  if (!registeredSchemaMigrations().has(20261015202345)) registerSchemaMigrations(componentElementSwapMigration);
80
81
  if (!registeredSchemaMigrations().has(20261113131930)) registerSchemaMigrations(styleSetOwnRuleOnlyMigration);
82
+ if (!registeredSchemaMigrations().has(20261118171253)) registerSchemaMigrations(lintNamesRemovedMigration);
81
83
  //#endregion
82
84
  export { ReactNativeSystem };
@@ -53,6 +53,7 @@ import { nativeLintLocationsMigration } from "../migrations/20261112145536_nativ
53
53
  import { variantBooleansMigration } from "../migrations/20261112154943_variant_booleans.js";
54
54
  import { vendorLinkTypeMigration } from "../migrations/20261112163439_vendor_link_type.js";
55
55
  import { styleSetOwnRuleOnlyMigration } from "../migrations/20261113131930_style_set_own_rule_only.js";
56
+ import { lintNamesRemovedMigration } from "../migrations/20261118171253_lint_names_removed.js";
56
57
  import { CanvasRole } from "../entities/system/CanvasRole.js";
57
58
  import { GlobalStyle } from "../entities/system/GlobalStyle.js";
58
59
  import { Guidance } from "../entities/system/Guidance.js";
@@ -244,5 +245,6 @@ if (!registeredSchemaMigrations().has(20261112154943)) registerSchemaMigrations(
244
245
  if (!registeredSchemaMigrations().has(20261112163439)) registerSchemaMigrations(vendorLinkTypeMigration);
245
246
  if (!registeredSchemaMigrations().has(20261113131930)) registerSchemaMigrations(styleSetOwnRuleOnlyMigration);
246
247
  if (!registeredSchemaMigrations().has(20261117234103)) registerSchemaMigrations(uds6038McpInputsMigration);
248
+ if (!registeredSchemaMigrations().has(20261118171253)) registerSchemaMigrations(lintNamesRemovedMigration);
247
249
  //#endregion
248
250
  export { System };
@@ -75,6 +75,11 @@ declare const NativeSettings: EntityClass<z.ZodObject<Omit<{
75
75
  when: z.ZodOptional<z.ZodString>;
76
76
  reason: z.ZodString;
77
77
  }, z.core.$strict>>>;
78
+ names: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
79
+ label: z.ZodOptional<z.ZodString>;
80
+ description: z.ZodOptional<z.ZodString>;
81
+ }, z.core.$strict>>>;
82
+ removed: z.ZodOptional<z.ZodArray<z.ZodString>>;
78
83
  }, z.core.$strict>>;
79
84
  defaults: z.ZodOptional<z.ZodObject<{
80
85
  background: z.ZodOptional<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
@@ -129,6 +129,11 @@ declare const LintSectionDefinition: SubEntityClass<z.ZodObject<{
129
129
  when: z.ZodOptional<z.ZodString>;
130
130
  reason: z.ZodString;
131
131
  }, z.core.$strict>>>;
132
+ names: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
133
+ label: z.ZodOptional<z.ZodString>;
134
+ description: z.ZodOptional<z.ZodString>;
135
+ }, z.core.$strict>>>;
136
+ removed: z.ZodOptional<z.ZodArray<z.ZodString>>;
132
137
  }, z.core.$strict>>;
133
138
  interface LintSectionClass extends Named<typeof LintSectionDefinition> {}
134
139
  declare const LintSection: LintSectionClass;
@@ -249,6 +254,11 @@ declare const SettingsDefinition: EntityClass<z.ZodObject<{
249
254
  when: z.ZodOptional<z.ZodString>;
250
255
  reason: z.ZodString;
251
256
  }, z.core.$strict>>>;
257
+ names: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
258
+ label: z.ZodOptional<z.ZodString>;
259
+ description: z.ZodOptional<z.ZodString>;
260
+ }, z.core.$strict>>>;
261
+ removed: z.ZodOptional<z.ZodArray<z.ZodString>>;
252
262
  }, z.core.$strict>>;
253
263
  defaults: z.ZodOptional<z.ZodObject<{
254
264
  background: z.ZodOptional<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
@@ -224,6 +224,19 @@ const lintFields = z.strictObject({
224
224
  })).meta({
225
225
  title: "Ignored findings",
226
226
  description: "Findings kept on purpose, each with its reason: a rule on a component, narrowed to a layer, a style key and the rule it is written in when those are given, or on a token. `uds lint` and Create both leave them out."
227
+ }).optional(),
228
+ /** This system's own words for a rule or a group, by its name, in place of the lint's. */
229
+ names: z.record(z.string(), z.strictObject({
230
+ label: z.string().min(1).optional(),
231
+ description: z.string().min(1).optional()
232
+ })).meta({
233
+ title: "Names",
234
+ description: "This system's own label and description for a rule or a group, keyed by the rule's or group's name: `{ 'near-token': { label: 'Off the scale' } }`. Create's Lint page shows them in place of the lint's own."
235
+ }).optional(),
236
+ /** Built-in rules the system has taken out: they don't run and aren't listed. */
237
+ removed: z.array(z.string()).meta({
238
+ title: "Removed rules",
239
+ description: "Built-in rules this system has taken out, by name. They don't run in Create or `uds lint` and aren't listed; taking a name out of the list puts the rule back."
227
240
  }).optional()
228
241
  });
229
242
  const LintSection = defineSubEntity({
@@ -4,7 +4,7 @@ import { createSliceMemo } from "../../framework/memo.js";
4
4
  import { moduleViewOf, registerModuleView } from "../../framework/module-views.js";
5
5
  import { File } from "./File.js";
6
6
  import { Settings, classPrefixOf, prefixed, varPrefixOf } from "./Settings.js";
7
- import { sourceVarPrefix } from "../../framework/projections.js";
7
+ import { heldLinked, sourceVarPrefix } from "../../framework/projections.js";
8
8
  import { hasJsMotion } from "./motion-presets.js";
9
9
  import { stylePropClassBase, stylePropOwnClasses } from "../../framework/class-names.js";
10
10
  import { Component } from "./Component.js";
@@ -526,6 +526,21 @@ function linkedComponentModule(config, componentPathOrRef) {
526
526
  const asked = typeof componentPathOrRef === "string" ? componentPathOrRef : componentPathOrRef.__ref;
527
527
  const parsed = asked.includes(":") ? splitRef(asked) : void 0;
528
528
  const askedSource = parsed?.kind === "component" ? parsed.source : void 0;
529
+ const row = askedSource !== void 0 && parsed !== void 0 ? heldRow({
530
+ config,
531
+ slug: askedSource,
532
+ path: parsed.path
533
+ }) : void 0;
534
+ if (row !== void 0) {
535
+ const held = linkedComponentModule(config, row);
536
+ return held && {
537
+ ...held,
538
+ source: {
539
+ ...held.source,
540
+ componentRef: asked
541
+ }
542
+ };
543
+ }
529
544
  const ref = splitRef(file.__ref);
530
545
  const slug = ref.source ?? askedSource;
531
546
  if (!slug) return void 0;
@@ -556,6 +571,38 @@ function linkedComponentModule(config, componentPathOrRef) {
556
571
  };
557
572
  }
558
573
  /**
574
+ * The row of this config's that holds `slug`'s component at `path` ({@link heldLinked}), or
575
+ * `undefined` when there's none. Every route the stylesheet emits the component through and that ends
576
+ * at `slug` (`bridge~yos` for `yos`) has to be held by a row, since the stylesheet emits the pin's
577
+ * rules for a route that doesn't hold it. Where routes are held by different rows, the first route's
578
+ * row answers.
579
+ */
580
+ function heldRow({ config, slug, path }) {
581
+ let first;
582
+ for (const [route, paths] of reachedComponents(config)) {
583
+ if (route !== slug && sourceHops(route).at(-1) !== slug) continue;
584
+ if (!paths.has(path)) continue;
585
+ const row = heldLinked({
586
+ config,
587
+ slug: route,
588
+ kind: Component.kind
589
+ }).get(path);
590
+ if (row === void 0) return void 0;
591
+ first ??= row;
592
+ }
593
+ return first;
594
+ }
595
+ const reachedComponentsCache = /* @__PURE__ */ new WeakMap();
596
+ /** Each slug the stylesheet emits linked components for (`reachedSlugs`), with the paths of the
597
+ * components it reaches through it. */
598
+ function reachedComponents(config) {
599
+ const cached = reachedComponentsCache.get(config);
600
+ if (cached) return cached;
601
+ const reached = new Map(config.reachedSlugs().filter((route) => config.drawnSourceFor(route) !== void 0).map((route) => [route, new Set(config.sourceClosure(route, Component.kind).map(pathOf))]));
602
+ reachedComponentsCache.set(config, reached);
603
+ return reached;
604
+ }
605
+ /**
559
606
  * The published identity a slug is pinned at, looked for through the chain: `yos` is declared by the
560
607
  * bridge this config links, not by this config.
561
608
  */
@@ -74,7 +74,7 @@ interface RecordedSource {
74
74
  * The dense-counter `2` a short-lived scheme stamped before the chain existed reads as the mint
75
75
  * that replaced it (see `detectedWireVersion`).
76
76
  */
77
- declare const SERIALIZED_CONFIG_VERSION = 20261117234103;
77
+ declare const SERIALIZED_CONFIG_VERSION = 20261118171253;
78
78
  interface SerializedConfig {
79
79
  /** See {@link SERIALIZED_CONFIG_VERSION}. Always written; a stored artifact may lack it. */
80
80
  readonly version: number;
@@ -2107,6 +2107,9 @@ declare class Config {
2107
2107
  * attribution and upgrade detection. Breaking a link is deleting the pin, once nothing refers
2108
2108
  * through it.
2109
2109
  *
2110
+ * `keepIdentityRefs` and `keepPointers` leave some sourced refs in place. `toJSON` records the closure
2111
+ * they reach, so the serialized result still loads with no sources attached.
2112
+ *
2110
2113
  * Local refs are untouched — the point is to remove dependence on other systems, not to flatten this
2111
2114
  * one into literals.
2112
2115
  */
@@ -2129,13 +2132,17 @@ declare class Config {
2129
2132
  * makes a dissolve an ordinary recorded edit, so it survives being replayed. */
2130
2133
  withMaterializedExtensions({
2131
2134
  slug,
2132
- only
2135
+ only,
2136
+ keepPointers
2133
2137
  }?: {
2134
2138
  slug?: string;
2135
2139
  only?: {
2136
2140
  kind: string;
2137
2141
  path: string;
2138
2142
  };
2143
+ /** Leaves an extension as it is when its source has the entity it points at
2144
+ * (`InlineOptions.keepPointers`). */
2145
+ keepPointers?: boolean;
2139
2146
  }): this;
2140
2147
  /**
2141
2148
  * The config a ref resolves in — this one for a local ref or a ref qualified with this config's own
@@ -4366,6 +4366,9 @@ var Config = class Config {
4366
4366
  * attribution and upgrade detection. Breaking a link is deleting the pin, once nothing refers
4367
4367
  * through it.
4368
4368
  *
4369
+ * `keepIdentityRefs` and `keepPointers` leave some sourced refs in place. `toJSON` records the closure
4370
+ * they reach, so the serialized result still loads with no sources attached.
4371
+ *
4369
4372
  * Local refs are untouched — the point is to remove dependence on other systems, not to flatten this
4370
4373
  * one into literals.
4371
4374
  */
@@ -4388,7 +4391,7 @@ var Config = class Config {
4388
4391
  * flattening `update` onto the envelope it was supposed to have removed, put the value back inside
4389
4392
  * `extend`, and then refuse to drop the pin because the extension still referenced it. `replace`
4390
4393
  * makes a dissolve an ordinary recorded edit, so it survives being replayed. */
4391
- withMaterializedExtensions({ slug, only } = {}) {
4394
+ withMaterializedExtensions({ slug, only, keepPointers } = {}) {
4392
4395
  const patches = [];
4393
4396
  for (const kind of this.ownedKinds()) {
4394
4397
  if (only !== void 0 && only.kind !== kind) continue;
@@ -4399,6 +4402,7 @@ var Config = class Config {
4399
4402
  if (!isExtendedRef(extension)) continue;
4400
4403
  if (slug !== void 0 && sourceOf(extension) !== slug) continue;
4401
4404
  if (only === void 0 && sourceOf(extension) === void 0) continue;
4405
+ if (keepPointers && this.resolveRef({ __ref: extension.__ref })) continue;
4402
4406
  const resolved = this.resolveExtension({
4403
4407
  kind,
4404
4408
  path,
@@ -6204,9 +6208,10 @@ var Config = class Config {
6204
6208
  const path = pathOf(target);
6205
6209
  const entity = source.resolve(kind, path);
6206
6210
  if (!entity) continue;
6211
+ const pointer = source.borrowedFrom(kind, path) === void 0 ? void 0 : source.storedBody(kind, path);
6207
6212
  kinds.add(kind);
6208
6213
  items[kind] ??= {};
6209
- items[kind][path] = entity.toJSON();
6214
+ items[kind][path] = pointer ?? entity.toJSON();
6210
6215
  }
6211
6216
  const settings = source.resolve("settings", "settings");
6212
6217
  if (settings && source.ownedKinds().includes("settings")) {
@@ -6681,7 +6686,7 @@ var Config = class Config {
6681
6686
  * links from the provided sources. A declared `linkedKind` with no provided source throws. */
6682
6687
  hydrateFrom(stored, options) {
6683
6688
  const claimed = schemaVersionOf(stored);
6684
- if (claimed > 20261117234103) throw new SchemaVersionTooNew(claimed);
6689
+ if (claimed > 20261118171253) throw new SchemaVersionTooNew(claimed);
6685
6690
  const wire = upgradeSerializedConfig(stored);
6686
6691
  if (!Array.isArray(wire.ownedKinds) || typeof wire.items !== "object" || wire.items === null) throw new ConfigFormatError(`Config "${stored.name ?? "system-config"}" cannot be hydrated: this is not a serialized config-v2 config (no "ownedKinds"/"items"). A pre-cutover build artifact converts through the registered cutover migration — import the config type's module (e.g. \`configs/system\`) before hydrating.`);
6687
6692
  const leftover = wire.options;
@@ -29,6 +29,13 @@ import { Ref } from "./utils/refs.js";
29
29
  */
30
30
  interface InlineOptions {
31
31
  readonly keepIdentityRefs?: boolean;
32
+ /**
33
+ * A row or folder stored as a pointer at an entity an attached source has stays that pointer, and
34
+ * only its delta is walked. A reader that keeps the sources attached sets it, so the config still
35
+ * says which of its rows are another system's (`heldLinked`) and a route through it draws as the
36
+ * config does. Any other pointer is materialized, or refused, as it would be without this.
37
+ */
38
+ readonly keepPointers?: boolean;
32
39
  /**
33
40
  * Called for a ref that can be neither inlined nor requalified, in place of the refusal. The ref is
34
41
  * left as it is so the walk reaches every other ref. A plan sets this to name every such ref rather
@@ -1,4 +1,4 @@
1
- import { MINTED, collectRefs, entityRefOf, isRef, kindOf, pathOf, ref, rewriteRefs, sourceOf } from "./utils/refs.js";
1
+ import { MINTED, collectRefs, entityRefOf, isExtendedRef, isRef, kindOf, pathOf, ref, rewriteRefs, sourceOf } from "./utils/refs.js";
2
2
  import { rejectData } from "./rejection.js";
3
3
  import { kindBorrowable } from "./registry.js";
4
4
  //#region src/framework/inline-sources.ts
@@ -249,6 +249,14 @@ function rewrittenBody({ body, kind, config, slug, options }) {
249
249
  });
250
250
  return sameBody(body, inlined) ? void 0 : inlined;
251
251
  }
252
+ /** The stored pointer at `kind:path` when {@link InlineOptions.keepPointers} keeps it: one into a
253
+ * source this walk takes, at an entity that source has. */
254
+ function keptPointer({ config, kind, path, slug, options }) {
255
+ if (!options?.keepPointers) return void 0;
256
+ const stored = config.storedBody(kind, path);
257
+ if (!isExtendedRef(stored) || !wants(stored, slug)) return void 0;
258
+ return config.resolveRef({ __ref: stored.__ref }) ? stored : void 0;
259
+ }
252
260
  /**
253
261
  * Every item and group body of `config`, rewritten by {@link inlineSourcedRefs}.
254
262
  *
@@ -257,8 +265,8 @@ function rewrittenBody({ body, kind, config, slug, options }) {
257
265
  * the pin's own `delete`, once nothing refers through it.
258
266
  *
259
267
  * Groups are walked as well as items. A group body carries fields like any entity, so a ref hiding in
260
- * one would otherwise survive a walk that only visited items — and "nothing sourced survives" is the
261
- * guarantee, not "nothing sourced survives in the places we remembered to look".
268
+ * one would otherwise survive a walk that only visited items. What does survive is what the options
269
+ * keep: an identity ref (`keepIdentityRefs`) and a pointer row or folder (`keepPointers`).
262
270
  */
263
271
  /**
264
272
  * Where each thing borrowed through `slug` will live once the pin is gone — `style-property:bg@ds` →
@@ -328,11 +336,36 @@ function inlineAllSources(config, slug, options) {
328
336
  });
329
337
  }
330
338
  }
331
- const materialized = config.applyAll(detaching).withMaterializedExtensions({ slug });
339
+ const materialized = config.applyAll(detaching).withMaterializedExtensions({
340
+ slug,
341
+ keepPointers: options?.keepPointers
342
+ });
332
343
  const rewrites = [];
333
344
  for (const kind of materialized.ownedKinds()) {
334
345
  if (materialized.entityOf(kind)?.sourceIdentity) continue;
335
346
  for (const item of materialized.list(kind)) {
347
+ const pointer = keptPointer({
348
+ config: materialized,
349
+ kind,
350
+ path: item.path,
351
+ slug,
352
+ options: walk
353
+ });
354
+ if (pointer !== void 0) {
355
+ if (!holdsWantedRef(pointer.extend, slug)) continue;
356
+ const extend = inlineSourcedRefs(pointer.extend, materialized, slug, walk);
357
+ if (sameBody(pointer.extend, extend)) continue;
358
+ rewrites.push({
359
+ kind,
360
+ operation: "replace",
361
+ path: item.path,
362
+ data: {
363
+ ...pointer,
364
+ extend
365
+ }
366
+ });
367
+ continue;
368
+ }
336
369
  const data = rewrittenBody({
337
370
  body: item.toJSON(),
338
371
  kind,
@@ -403,6 +436,20 @@ function withoutPointer(meta) {
403
436
  return kept;
404
437
  }
405
438
  function detachedGroupMeta({ config, kind, groupPath, slug, options }) {
439
+ if (options?.keepPointers) {
440
+ const stored = config.authoredGroups(kind).find((group) => group.path === groupPath)?.meta;
441
+ const kept = stored?.ref;
442
+ const owner = isRef(kept) ? config.configFor(kept) : void 0;
443
+ if (stored && isRef(kept) && wants(kept, slug) && owner && declaresGroup(owner, kept)) {
444
+ const { ref: _kept, ...fields } = stored;
445
+ if (!holdsWantedRef(fields, slug)) return void 0;
446
+ const inlined = inlineSourcedRefs(fields, config, slug, options);
447
+ return sameBody(fields, inlined) ? void 0 : {
448
+ ...inlined,
449
+ ref: kept
450
+ };
451
+ }
452
+ }
406
453
  const meta = config.groups(kind).find((group) => group.path === groupPath)?.meta ?? {};
407
454
  const pointer = meta.ref;
408
455
  if (!isRef(pointer) || !wants(pointer, slug)) {
@@ -15,7 +15,7 @@ import { Patch, SerializedConfig } from "./Config.js";
15
15
  * sets this constant to its own older timestamp; the merge ref then carries a registered migration
16
16
  * newer than the constant, and the assertion fails until the author re-mints.
17
17
  */
18
- declare const CURRENT_SCHEMA_VERSION = 20261117234103;
18
+ declare const CURRENT_SCHEMA_VERSION = 20261118171253;
19
19
  /** What the walkers need to see of an envelope — loose on purpose, so a typed `SerializedConfig`
20
20
  * and a raw old-shape record both flow in without casts. */
21
21
  interface VersionStamped {
@@ -13,7 +13,7 @@ import { ConfigFormatError } from "./rejection.js";
13
13
  * sets this constant to its own older timestamp; the merge ref then carries a registered migration
14
14
  * newer than the constant, and the assertion fails until the author re-mints.
15
15
  */
16
- const CURRENT_SCHEMA_VERSION = 20261117234103;
16
+ const CURRENT_SCHEMA_VERSION = 20261118171253;
17
17
  /** The mint that moved `options` into the `settings` kind — restated here, rather than imported
18
18
  * from the migration that owns it, because that migration imports this module. */
19
19
  const SETTINGS_AS_KIND_VERSION = 20260908171448;
@@ -45,7 +45,7 @@ function registerSchemaMigrations(...migrations) {
45
45
  for (const migration of migrations) {
46
46
  if (migration.version !== 1 && !isMintTimestamp(migration.version)) throw new Error(`Schema migration version ${migration.version} is not a mint timestamp — mint one with \`date +%Y%m%d%H%M%S\`, like a supabase migration.`);
47
47
  if (REGISTERED.has(migration.version)) throw new Error(`A schema migration at version ${migration.version} is already registered.`);
48
- if (migration.version > 20261117234103) throw new Error(`Schema migration ${migration.version} is newer than CURRENT_SCHEMA_VERSION (${CURRENT_SCHEMA_VERSION}) — a stale branch merged, or the mint forgot to bump the constant. Re-mint: set CURRENT_SCHEMA_VERSION to the newest migration version.`);
48
+ if (migration.version > 20261118171253) throw new Error(`Schema migration ${migration.version} is newer than CURRENT_SCHEMA_VERSION (${CURRENT_SCHEMA_VERSION}) — a stale branch merged, or the mint forgot to bump the constant. Re-mint: set CURRENT_SCHEMA_VERSION to the newest migration version.`);
49
49
  REGISTERED.set(migration.version, migration);
50
50
  }
51
51
  }
@@ -102,7 +102,7 @@ function pendingFor(version, target, options) {
102
102
  * Already-current input passes through untouched — same reference, so hot paths pay nothing.
103
103
  */
104
104
  function upgradeSerializedConfig(json, options) {
105
- const target = options?.target ?? 20261117234103;
105
+ const target = options?.target ?? 20261118171253;
106
106
  const version = detectedWireVersion(json);
107
107
  if (version > target) throw new SchemaVersionTooNew(version, target);
108
108
  const raw = json;
@@ -160,7 +160,7 @@ function upgradedSources(json, options) {
160
160
  * meaning under the current schema and replay skips it — reported by the caller, not swallowed here.
161
161
  */
162
162
  function upgradePatch(patch, writtenAt, options) {
163
- const target = options?.target ?? 20261117234103;
163
+ const target = options?.target ?? 20261118171253;
164
164
  if (writtenAt > target) throw new SchemaVersionTooNew(writtenAt, target);
165
165
  let current = patch;
166
166
  for (const migration of pendingFor(writtenAt, target, options)) {
@@ -179,7 +179,7 @@ function upgradePatch(patch, writtenAt, options) {
179
179
  * stamp would cause.
180
180
  */
181
181
  function upgradeDraftEntries(draft, options) {
182
- const target = options?.target ?? 20261117234103;
182
+ const target = options?.target ?? 20261118171253;
183
183
  const entries = [];
184
184
  const held = [];
185
185
  const retired = [];
@@ -0,0 +1,40 @@
1
+ import { Config } from "../framework/Config.js";
2
+ import { AuthoringLintGroup, AuthoringLintRule } from "./rules.js";
3
+
4
+ //#region src/lint/catalog.d.ts
5
+ /** A rule or a group as this system names it. */
6
+ interface LintRuleText {
7
+ readonly label?: string;
8
+ readonly description?: string;
9
+ }
10
+ /** A rule as this system has it. */
11
+ interface LintCatalogRule {
12
+ readonly id: AuthoringLintRule;
13
+ readonly group: AuthoringLintGroup;
14
+ readonly label: string;
15
+ readonly description: string;
16
+ }
17
+ interface LintCatalogGroup {
18
+ readonly id: AuthoringLintGroup;
19
+ readonly title: string;
20
+ readonly description: string;
21
+ }
22
+ interface LintCatalog {
23
+ readonly groups: Readonly<Record<AuthoringLintGroup, LintCatalogGroup>>;
24
+ /** Every rule that runs: the built-in ones less the removed. */
25
+ readonly rules: readonly LintCatalogRule[];
26
+ /** The rules the system removed. */
27
+ readonly removed: readonly LintCatalogRule[];
28
+ /** A rule that runs, or a removed one, by name. */
29
+ rule(id: string): LintCatalogRule | undefined;
30
+ }
31
+ declare const isBuiltInRule: (id: string) => id is AuthoringLintRule;
32
+ declare const isLintGroup: (id: string) => id is AuthoringLintGroup;
33
+ /** The rules the system removed. */
34
+ declare const removedLintRules: (config: Config | null) => ReadonlySet<string>;
35
+ /** The system's own words for rules and groups. */
36
+ declare const lintNames: (config: Config | null) => Readonly<Record<string, LintRuleText>>;
37
+ /** The lint as `config`'s system has it. The same object for the same config. */
38
+ declare function lintCatalog(config: Config | null): LintCatalog;
39
+ //#endregion
40
+ export { LintCatalog, LintCatalogGroup, LintCatalogRule, LintRuleText, isBuiltInRule, isLintGroup, lintCatalog, lintNames, removedLintRules };
@@ -0,0 +1,50 @@
1
+ import { Settings } from "../entities/system/Settings.js";
2
+ import "../index.js";
3
+ import { AUTHORING_LINT_GROUPS, AUTHORING_LINT_RULES } from "./rules.js";
4
+ //#region src/lint/catalog.ts
5
+ /**
6
+ * The lint as one system has it: the built-in rules and groups under the system's own names, less the
7
+ * rules it removed.
8
+ */
9
+ const lintSettings = (config) => (config ? Settings.get(config)?.lint : void 0) ?? {};
10
+ const isBuiltInRule = (id) => id in AUTHORING_LINT_RULES;
11
+ const isLintGroup = (id) => id in AUTHORING_LINT_GROUPS;
12
+ /** The rules the system removed. */
13
+ const removedLintRules = (config) => new Set(lintSettings(config).removed ?? []);
14
+ /** The system's own words for rules and groups. */
15
+ const lintNames = (config) => lintSettings(config).names ?? {};
16
+ const catalogs = /* @__PURE__ */ new WeakMap();
17
+ const NO_CONFIG_CATALOG = buildCatalog(null);
18
+ /** The lint as `config`'s system has it. The same object for the same config. */
19
+ function lintCatalog(config) {
20
+ if (!config) return NO_CONFIG_CATALOG;
21
+ const hit = catalogs.get(config);
22
+ if (hit) return hit;
23
+ const catalog = buildCatalog(config);
24
+ catalogs.set(config, catalog);
25
+ return catalog;
26
+ }
27
+ function buildCatalog(config) {
28
+ const names = lintNames(config);
29
+ const removed = removedLintRules(config);
30
+ const groups = Object.fromEntries(Object.keys(AUTHORING_LINT_GROUPS).map((id) => [id, {
31
+ id,
32
+ title: names[id]?.label ?? AUTHORING_LINT_GROUPS[id].title,
33
+ description: names[id]?.description ?? AUTHORING_LINT_GROUPS[id].about
34
+ }]));
35
+ const all = Object.keys(AUTHORING_LINT_RULES).map((id) => ({
36
+ id,
37
+ group: AUTHORING_LINT_RULES[id].group,
38
+ label: names[id]?.label ?? AUTHORING_LINT_RULES[id].label,
39
+ description: names[id]?.description ?? AUTHORING_LINT_RULES[id].detects
40
+ }));
41
+ const byId = new Map(all.map((rule) => [rule.id, rule]));
42
+ return {
43
+ groups,
44
+ rules: all.filter((rule) => !removed.has(rule.id)),
45
+ removed: all.filter((rule) => removed.has(rule.id)),
46
+ rule: (id) => byId.get(id)
47
+ };
48
+ }
49
+ //#endregion
50
+ export { isBuiltInRule, isLintGroup, lintCatalog, lintNames, removedLintRules };
@@ -1,12 +1,13 @@
1
1
  import { ConfigEdit } from "../framework/config-op.js";
2
2
  import { Config } from "../framework/Config.js";
3
- import { AuthoringLintGroup, AuthoringLintRule, AuthoringLintSeverity } from "./rules.js";
4
3
  import { ConfigLintFinding, LintIgnore, LintRetarget } from "./context.js";
4
+ import { AuthoringLintGroup, AuthoringLintRule, AuthoringLintSeverity } from "./rules.js";
5
+ import { LintRuleText } from "./catalog.js";
5
6
 
6
7
  //#region src/lint/edits.d.ts
7
8
  /** Where a finding is, as the config stores it, and the value it suggests. */
8
9
  interface LintFixSite {
9
- readonly rule: AuthoringLintRule;
10
+ readonly rule: string;
10
11
  readonly component?: string;
11
12
  readonly token?: string;
12
13
  readonly composite?: string;
@@ -47,6 +48,29 @@ declare function severityEdits({
47
48
  name: string;
48
49
  severity: AuthoringLintSeverity;
49
50
  }): ConfigEdit[];
51
+ /**
52
+ * The settings edit that gives a rule or a group the system's own label and description. A value the
53
+ * lint already gives it, or an empty one, drops the system's entry, so the lint's words show again.
54
+ */
55
+ declare function lintNameEdits({
56
+ config,
57
+ name,
58
+ text
59
+ }: {
60
+ config: Config;
61
+ name: string;
62
+ text: LintRuleText;
63
+ }): ConfigEdit[];
64
+ /** The settings edit that takes a rule out of the system, or (`removed: false`) puts it back. */
65
+ declare function removeRuleEdits({
66
+ config,
67
+ rule,
68
+ removed
69
+ }: {
70
+ config: Config;
71
+ rule: AuthoringLintRule;
72
+ removed: boolean;
73
+ }): ConfigEdit[];
50
74
  /** A finding's entry in `settings.lint.ignore`: as narrow as the finding says where it is. */
51
75
  declare function ignoreEntry(site: LintFixSite, reason: string): LintIgnore;
52
76
  /** The settings edit that keeps a finding, with why: `uds lint` and Create both leave it out. */
@@ -78,4 +102,4 @@ declare function fixEdits(sites: readonly LintFixSite[]): ConfigEdit[];
78
102
  /** The edit that repoints a finding's token at its fix, the other choice a finding can offer. */
79
103
  declare function retargetEdits(retarget: LintRetarget): ConfigEdit[];
80
104
  //#endregion
81
- export { LintFixSite, fixEdits, groupSeverity, hasFix, ignoreEdits, ignoreEntry, lintIgnores, lintSeverities, restoreEdits, retargetEdits, rulesOf, severityEdits };
105
+ export { LintFixSite, fixEdits, groupSeverity, hasFix, ignoreEdits, ignoreEntry, lintIgnores, lintNameEdits, lintSeverities, removeRuleEdits, restoreEdits, retargetEdits, rulesOf, severityEdits };
@@ -3,6 +3,7 @@ import { styleSetEdits } from "../entities/system/component-style-set.js";
3
3
  import { Token } from "../entities/system/Token.js";
4
4
  import "../index.js";
5
5
  import { AUTHORING_LINT_GROUPS, AUTHORING_LINT_RULES, flatLintSeverities, nestLintSeverities, ruleSeverity } from "./rules.js";
6
+ import { isBuiltInRule, isLintGroup, lintNames, removedLintRules } from "./catalog.js";
6
7
  //#region src/lint/edits.ts
7
8
  /**
8
9
  * The lint's settings and fixes as config edits: how loud a rule is, a finding kept on purpose, and
@@ -54,6 +55,44 @@ function severityEdits({ config, name, severity }) {
54
55
  }
55
56
  return settingsUpdate(config, { "lint.rules": Object.keys(severities).length > 0 ? nestLintSeverities(severities) : null });
56
57
  }
58
+ /**
59
+ * The settings edit that gives a rule or a group the system's own label and description. A value the
60
+ * lint already gives it, or an empty one, drops the system's entry, so the lint's words show again.
61
+ */
62
+ function lintNameEdits({ config, name, text }) {
63
+ let lint;
64
+ if (isLintGroup(name)) {
65
+ const about = AUTHORING_LINT_GROUPS[name];
66
+ lint = {
67
+ label: about.title,
68
+ description: about.about
69
+ };
70
+ } else if (isBuiltInRule(name)) {
71
+ const about = AUTHORING_LINT_RULES[name];
72
+ lint = {
73
+ label: about.label,
74
+ description: about.detects
75
+ };
76
+ }
77
+ if (!lint) return [];
78
+ const label = text.label?.trim();
79
+ const description = text.description?.trim();
80
+ const entry = {
81
+ ...label && label !== lint.label ? { label } : {},
82
+ ...description && description !== lint.description ? { description } : {}
83
+ };
84
+ const names = { ...lintNames(config) };
85
+ if (Object.keys(entry).length > 0) names[name] = entry;
86
+ else delete names[name];
87
+ return settingsUpdate(config, { "lint.names": Object.keys(names).length > 0 ? names : null });
88
+ }
89
+ /** The settings edit that takes a rule out of the system, or (`removed: false`) puts it back. */
90
+ function removeRuleEdits({ config, rule, removed }) {
91
+ const out = new Set(removedLintRules(config));
92
+ if (removed) out.add(rule);
93
+ else out.delete(rule);
94
+ return settingsUpdate(config, { "lint.removed": out.size > 0 ? [...out] : null });
95
+ }
57
96
  /** A finding's entry in `settings.lint.ignore`: as narrow as the finding says where it is. */
58
97
  function ignoreEntry(site, reason) {
59
98
  return {
@@ -130,4 +169,4 @@ function retargetEdits(retarget) {
130
169
  }];
131
170
  }
132
171
  //#endregion
133
- export { fixEdits, groupSeverity, hasFix, ignoreEdits, ignoreEntry, lintIgnores, lintSeverities, restoreEdits, retargetEdits, rulesOf, severityEdits };
172
+ export { fixEdits, groupSeverity, hasFix, ignoreEdits, ignoreEntry, lintIgnores, lintNameEdits, lintSeverities, removeRuleEdits, restoreEdits, retargetEdits, rulesOf, severityEdits };
@@ -1,5 +1,6 @@
1
- import { AUTHORING_LINT_GROUPS, AUTHORING_LINT_RULES, AuthoringLintFix, AuthoringLintGroup, AuthoringLintRule, AuthoringLintRuleSettings, AuthoringLintSeverity, CONFIG_LINT_RULES, ConfigLintCheck, ConfigReadLintRule, LintReads, LintRuleSettingNote, flatLintSeverities, lintReads, lintRuleSettingNotes, nestLintSeverities, ruleSeverity } from "./rules.js";
2
1
  import { ConfigLintFinding, ConfigLintOptions, LintIgnore, ignoredBy } from "./context.js";
3
- import { LintFixSite, fixEdits, groupSeverity, hasFix, ignoreEdits, ignoreEntry, lintIgnores, lintSeverities, restoreEdits, retargetEdits, rulesOf, severityEdits } from "./edits.js";
2
+ import { AUTHORING_LINT_GROUPS, AUTHORING_LINT_RULES, AuthoringLintFix, AuthoringLintGroup, AuthoringLintRule, AuthoringLintRuleSettings, AuthoringLintSeverity, CONFIG_LINT_RULES, ConfigLintCheck, ConfigReadLintRule, LintReads, LintRuleSettingNote, flatLintSeverities, lintReads, lintRuleSettingNotes, nestLintSeverities, ruleSeverity } from "./rules.js";
3
+ import { LintCatalog, LintCatalogGroup, LintCatalogRule, LintRuleText, isBuiltInRule, isLintGroup, lintCatalog, lintNames, removedLintRules } from "./catalog.js";
4
+ import { LintFixSite, fixEdits, groupSeverity, hasFix, ignoreEdits, ignoreEntry, lintIgnores, lintNameEdits, lintSeverities, removeRuleEdits, restoreEdits, retargetEdits, rulesOf, severityEdits } from "./edits.js";
4
5
  import { AuthoringLintEdit, AuthoringLintFinding, AuthoringLintResult, LintIgnoreProblem, LintRun, LintSources, lint, lintConfig } from "./lint.js";
5
- export { AUTHORING_LINT_GROUPS, AUTHORING_LINT_RULES, AuthoringLintEdit, AuthoringLintFinding, AuthoringLintFix, AuthoringLintGroup, AuthoringLintResult, AuthoringLintRule, AuthoringLintRuleSettings, AuthoringLintSeverity, CONFIG_LINT_RULES, ConfigLintCheck, type ConfigLintFinding, type ConfigLintOptions, ConfigReadLintRule, LintFixSite, type LintIgnore, LintIgnoreProblem, LintReads, LintRuleSettingNote, LintRun, LintSources, fixEdits, flatLintSeverities, groupSeverity, hasFix, ignoreEdits, ignoreEntry, ignoredBy, lint, lintConfig, lintIgnores, lintReads, lintRuleSettingNotes, lintSeverities, nestLintSeverities, restoreEdits, retargetEdits, ruleSeverity, rulesOf, severityEdits };
6
+ export { AUTHORING_LINT_GROUPS, AUTHORING_LINT_RULES, AuthoringLintEdit, AuthoringLintFinding, AuthoringLintFix, AuthoringLintGroup, AuthoringLintResult, AuthoringLintRule, AuthoringLintRuleSettings, AuthoringLintSeverity, CONFIG_LINT_RULES, ConfigLintCheck, type ConfigLintFinding, type ConfigLintOptions, ConfigReadLintRule, LintCatalog, LintCatalogGroup, LintCatalogRule, LintFixSite, type LintIgnore, LintIgnoreProblem, LintReads, LintRuleSettingNote, LintRuleText, LintRun, LintSources, fixEdits, flatLintSeverities, groupSeverity, hasFix, ignoreEdits, ignoreEntry, ignoredBy, isBuiltInRule, isLintGroup, lint, lintCatalog, lintConfig, lintIgnores, lintNameEdits, lintNames, lintReads, lintRuleSettingNotes, lintSeverities, nestLintSeverities, removeRuleEdits, removedLintRules, restoreEdits, retargetEdits, ruleSeverity, rulesOf, severityEdits };