@marktiderman/genesis-config 0.0.0-stage → 0.10.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 (51) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +461 -2
  3. package/dist/blocks.d.ts +473 -0
  4. package/dist/blocks.js +5 -0
  5. package/dist/blocks.js.map +1 -0
  6. package/dist/chunk-B6WRD3WF.js +6 -0
  7. package/dist/chunk-B6WRD3WF.js.map +1 -0
  8. package/dist/chunk-HIOKZIZP.js +218 -0
  9. package/dist/chunk-HIOKZIZP.js.map +1 -0
  10. package/dist/chunk-M7IY6LUN.js +123 -0
  11. package/dist/chunk-M7IY6LUN.js.map +1 -0
  12. package/dist/chunk-OW46SL2G.js +10 -0
  13. package/dist/chunk-OW46SL2G.js.map +1 -0
  14. package/dist/chunk-SEFG2QV6.js +413 -0
  15. package/dist/chunk-SEFG2QV6.js.map +1 -0
  16. package/dist/chunk-UD7SPYZH.js +354 -0
  17. package/dist/chunk-UD7SPYZH.js.map +1 -0
  18. package/dist/chunk-VYUX7VAX.js +52 -0
  19. package/dist/chunk-VYUX7VAX.js.map +1 -0
  20. package/dist/chunk-Y7NUBTWA.js +494 -0
  21. package/dist/chunk-Y7NUBTWA.js.map +1 -0
  22. package/dist/gate-CNTkn-Fv.d.ts +202 -0
  23. package/dist/gate-react.d.ts +48 -0
  24. package/dist/gate-react.js +37 -0
  25. package/dist/gate-react.js.map +1 -0
  26. package/dist/gate.d.ts +18 -0
  27. package/dist/gate.js +5 -0
  28. package/dist/gate.js.map +1 -0
  29. package/dist/index.d.ts +128 -0
  30. package/dist/index.js +9 -0
  31. package/dist/index.js.map +1 -0
  32. package/dist/model-uON71G4u.d.ts +437 -0
  33. package/dist/node.d.ts +159 -0
  34. package/dist/node.js +486 -0
  35. package/dist/node.js.map +1 -0
  36. package/dist/packages-CWhdXtzS.d.ts +203 -0
  37. package/dist/platforms-NR0liM8L.d.ts +10 -0
  38. package/dist/react.d.ts +60 -0
  39. package/dist/react.js +236 -0
  40. package/dist/react.js.map +1 -0
  41. package/dist/settings-protocol.d.ts +515 -0
  42. package/dist/settings-protocol.js +4 -0
  43. package/dist/settings-protocol.js.map +1 -0
  44. package/dist/settings-react.d.ts +143 -0
  45. package/dist/settings-react.js +943 -0
  46. package/dist/settings-react.js.map +1 -0
  47. package/dist/settings.d.ts +373 -0
  48. package/dist/settings.js +3 -0
  49. package/dist/settings.js.map +1 -0
  50. package/dist/types-D4hs16bJ.d.ts +39 -0
  51. package/package.json +141 -4
@@ -0,0 +1,373 @@
1
+ import { b as GateContext } from './gate-CNTkn-Fv.js';
2
+ import { c as FlagValue } from './types-D4hs16bJ.js';
3
+ import './platforms-NR0liM8L.js';
4
+
5
+ /**
6
+ * Settings: every Genesis package declares its settings with {@link defineSettings}, the app builds
7
+ * one catalogue from them ({@link settingsCatalogue}), and one resolver ({@link resolveSettings})
8
+ * turns the layers into values, with where each came from and what was wrong.
9
+ *
10
+ * Layers, low to high (a later layer wins unless an earlier layer locked the value):
11
+ *
12
+ * 1. default the declared default (for a per-preset default, the `max` value)
13
+ * 2. preset `max` (Genesis's default), `standard` or `min`: keys with a per-preset default
14
+ * 3. file genesis.config.json `settings`, committed and reviewed like code
15
+ * 4. database the app's `genesis_settings` table, changed live by platform admins
16
+ * 5. tenant only keys declared `scope: "tenant"`
17
+ * 6. person only keys declared `scope: "person"`
18
+ *
19
+ * A key declared `applies: "build"` takes effect only from a new build, so only the default,
20
+ * preset and file layers set it. Secrets are never settings: a key names the secret it needs
21
+ * (`needs: "secret:NAME"`) and the store it lives in, never its value.
22
+ *
23
+ * Feeding the gate: a boolean key linked to a feature (`feature`) that resolves to false puts the
24
+ * feature in `GateContext.off`; a key linked to a flag (`flag`) gives that flag its value
25
+ * ({@link settingsGateContext}, {@link withSettings}). There is no second gate.
26
+ *
27
+ * No zod, React, Node built-ins or DOM globals here: it ships to browsers, phones, edge functions
28
+ * and servers (`@marktiderman/genesis-config/settings`).
29
+ */
30
+
31
+ /** The presets: `max` (the default) turns everything on. @stability Beta */
32
+ declare const SETTINGS_PRESETS: readonly ["max", "standard", "min"];
33
+ /** @stability Beta */
34
+ type SettingsPreset = (typeof SETTINGS_PRESETS)[number];
35
+ /** Genesis's default preset: zero config is everything on. @stability Beta */
36
+ declare const DEFAULT_PRESET: SettingsPreset;
37
+ /** @stability Beta */
38
+ declare const SETTING_TYPES: readonly ["boolean", "number", "string", "list", "object"];
39
+ /** @stability Beta */
40
+ type SettingType = (typeof SETTING_TYPES)[number];
41
+ /** The lowest layer that may change a key: the app (file, database), a tenant, or a person. @stability Beta */
42
+ type SettingScope = "app" | "tenant" | "person";
43
+ /** `build`: needs a new binary or bundle. `runtime`: takes effect live. @stability Beta */
44
+ type SettingApplies = "build" | "runtime";
45
+ /** Where a secret a key needs is kept (config-layer §9). @stability Beta */
46
+ type SecretStore = "vault" | "edge" | "server-env" | "ci";
47
+ /** The layers, low to high. @stability Beta */
48
+ declare const SETTINGS_LAYERS: readonly ["default", "preset", "file", "database", "tenant", "person"];
49
+ /** @stability Beta */
50
+ type SettingsLayer = (typeof SETTINGS_LAYERS)[number];
51
+ /** A value by preset. All three are given. @stability Beta */
52
+ interface PresetDefaults<T> {
53
+ max: T;
54
+ standard: T;
55
+ min: T;
56
+ }
57
+ /** The value a type holds. @stability Beta */
58
+ type SettingValueOf<K extends SettingType> = K extends "boolean" ? boolean : K extends "number" ? number : K extends "string" ? string : K extends "list" ? readonly (string | number)[] : {
59
+ readonly [key: string]: unknown;
60
+ };
61
+ /**
62
+ * One key, as a package declares it.
63
+ *
64
+ * @stability Beta
65
+ */
66
+ interface SettingSpec<K extends SettingType = SettingType> {
67
+ type: K;
68
+ /** The default, or one per preset (`{ max, standard, min }`). `null` means "not set" (a string to fill in, say). */
69
+ default: SettingValueOf<K> | null | PresetDefaults<SettingValueOf<K> | null>;
70
+ /** The lowest layer that may change it. Default `app`. */
71
+ scope?: SettingScope;
72
+ /** Default `runtime`. A `build` key can't have a tenant or person scope. */
73
+ applies?: SettingApplies;
74
+ /** Other keys (`namespace.key`) that must be on while this one is on. */
75
+ requires?: readonly string[];
76
+ /** A number's bounds, or a list's length. */
77
+ min?: number;
78
+ max?: number;
79
+ /** The values a string or number may take, or a list's items. */
80
+ options?: readonly (string | number)[];
81
+ /** The secret it needs, by name only: `"secret:GITHUB_TOKEN"`. The value is never a setting. */
82
+ needs?: `secret:${string}`;
83
+ /** Where that secret is kept. Default `edge` (an Edge Function secret). Only with `needs`. */
84
+ store?: SecretStore;
85
+ /** A feature id (features.ts) this boolean switches: false puts it in `GateContext.off`. */
86
+ feature?: string;
87
+ /** A flag name (flags.json) this key gives its value to. */
88
+ flag?: string;
89
+ /** One line for the Settings screen and the agent. */
90
+ summary?: string;
91
+ /**
92
+ * The guided setup step that configures it, when it needs an outside service (`github.issues`):
93
+ * `genesis setup --step <id>`. The doctor's `setup-incomplete` names it while the key is unset.
94
+ */
95
+ setup?: string;
96
+ /** A number that must be whole (a count, days, milliseconds). Only a number takes it. */
97
+ integer?: boolean;
98
+ }
99
+ /** A declared key with its namespace folded in and its defaults filled. @stability Beta */
100
+ interface SettingDef {
101
+ /** `namespace.key` */
102
+ readonly key: string;
103
+ readonly namespace: string;
104
+ readonly type: SettingType;
105
+ /** The default for each preset (the same value three times for a plain default). */
106
+ readonly defaults: Readonly<PresetDefaults<unknown>>;
107
+ /** True when the default differs by preset (resolved by the preset layer). */
108
+ readonly byPreset: boolean;
109
+ /** True when a default is `null` ("not set"): only then may a layer set `null`. */
110
+ readonly nullable: boolean;
111
+ readonly scope: SettingScope;
112
+ readonly applies: SettingApplies;
113
+ readonly requires: readonly string[];
114
+ readonly min?: number;
115
+ readonly max?: number;
116
+ readonly options?: readonly (string | number)[];
117
+ readonly secret?: {
118
+ readonly name: string;
119
+ readonly store: SecretStore;
120
+ };
121
+ readonly feature?: string;
122
+ readonly flag?: string;
123
+ readonly summary?: string;
124
+ readonly setup?: string;
125
+ readonly integer?: true;
126
+ }
127
+ /** What {@link defineSettings} returns: one package's keys. @stability Beta */
128
+ interface SettingsDeclaration<N extends string = string, Keys extends string = string> {
129
+ readonly namespace: N;
130
+ readonly keys: {
131
+ readonly [K in Keys as `${N}.${K}`]: SettingDef;
132
+ };
133
+ }
134
+ /** A declaration or catalogue that can't be used. @stability Beta */
135
+ declare class SettingsError extends Error {
136
+ constructor(message: string);
137
+ }
138
+ /** A full key: `namespace.key`, or `namespace.group.key` is not allowed (one level). */
139
+ declare const SETTING_KEY: RegExp;
140
+ /** A setup step id: `github.issues`, `ai.key-budget`. */
141
+ declare const SETUP_STEP_ID: RegExp;
142
+ /** A per-preset default: an object with exactly `max`, `standard` and `min`. */
143
+ declare function isPresetDefaults(v: unknown): v is PresetDefaults<unknown>;
144
+ /**
145
+ * Why a value doesn't fit a key's type and bounds, or null when it does. `null` ("not set") fits
146
+ * only a key whose default is `null` (`nullable`).
147
+ */
148
+ declare function settingValueProblem(def: Pick<SettingDef, "type" | "min" | "max" | "options"> & {
149
+ nullable?: boolean;
150
+ integer?: boolean;
151
+ }, value: unknown): string | null;
152
+ /**
153
+ * A package's settings, declared next to its `defineBlock`. Keys are `namespace.key`.
154
+ *
155
+ * ```ts
156
+ * export const supportSettings = defineSettings("support", {
157
+ * messenger: { type: "boolean", default: { max: true, standard: true, min: false }, scope: "tenant" },
158
+ * dumpRetentionDays: { type: "number", default: 90, min: 7, max: 365 },
159
+ * githubRepo: { type: "string", default: null, needs: "secret:GITHUB_TOKEN", store: "edge" },
160
+ * });
161
+ * ```
162
+ *
163
+ * Throws a {@link SettingsError} for a declaration that can't be used (an unknown field, a
164
+ * default outside its bounds, a build-time key with a tenant scope, a secret value instead of a name).
165
+ *
166
+ * @stability Beta
167
+ */
168
+ declare function defineSettings<const N extends string, const S extends {
169
+ readonly [key: string]: SettingSpec;
170
+ }>(namespace: N, keys: S): SettingsDeclaration<N, Extract<keyof S, string>>;
171
+ /** Every package's keys in one place. @stability Beta */
172
+ interface SettingsCatalogue {
173
+ readonly keys: {
174
+ readonly [key: string]: SettingDef;
175
+ };
176
+ }
177
+ /**
178
+ * One catalogue from every package's declarations (the way features.ts builds the registry).
179
+ * Throws a {@link SettingsError} when two declarations share a namespace or a key, or a key
180
+ * requires one no declaration has.
181
+ *
182
+ * @stability Beta
183
+ */
184
+ declare function settingsCatalogue(declarations: readonly SettingsDeclaration[]): SettingsCatalogue;
185
+ /**
186
+ * One key's value in a layer. `locked: true` stops every later layer from changing it.
187
+ *
188
+ * @stability Beta
189
+ */
190
+ interface SettingEntry {
191
+ value: unknown;
192
+ locked?: boolean;
193
+ }
194
+ /** A layer's values by full key. @stability Beta */
195
+ type SettingsLayerValues = {
196
+ readonly [key: string]: SettingEntry;
197
+ };
198
+ /**
199
+ * The layers to resolve. Leave out what the caller doesn't have: no `preset` is `max`, no
200
+ * `tenant` means no tenant has changed anything.
201
+ *
202
+ * @stability Beta
203
+ */
204
+ interface SettingsLayers {
205
+ preset?: SettingsPreset;
206
+ file?: SettingsLayerValues;
207
+ database?: SettingsLayerValues;
208
+ tenant?: SettingsLayerValues;
209
+ person?: SettingsLayerValues;
210
+ }
211
+ /** @stability Beta */
212
+ type SettingsProblemKind = "unknown-key" | "type" | "scope" | "build-only" | "locked" | "requires" | "preset";
213
+ /**
214
+ * Something wrong in the layers: the value was ignored (every kind but `requires`, which keeps
215
+ * the value and says what it needs).
216
+ *
217
+ * @stability Beta
218
+ */
219
+ interface SettingsProblem {
220
+ kind: SettingsProblemKind;
221
+ key: string;
222
+ /** The layer the problem is in. For `requires`, the layer that set the key. */
223
+ layer: SettingsLayer;
224
+ message: string;
225
+ }
226
+ /** Where a value came from, and the layer that locked it, if any. @stability Beta */
227
+ interface SettingSource {
228
+ layer: SettingsLayer;
229
+ lockedBy?: SettingsLayer;
230
+ }
231
+ /** @stability Beta */
232
+ interface ResolvedSettings {
233
+ readonly preset: SettingsPreset;
234
+ readonly values: {
235
+ readonly [key: string]: unknown;
236
+ };
237
+ readonly sources: {
238
+ readonly [key: string]: SettingSource;
239
+ };
240
+ readonly problems: readonly SettingsProblem[];
241
+ }
242
+ /**
243
+ * The scope rule, in one place: which override layers may set a key of each scope. The app's own
244
+ * layers (file, database) set every key; the tenant layer only keys declared `scope: "tenant"`,
245
+ * the person layer only keys declared `scope: "person"` (decision C2, read literally). Changing
246
+ * this table is the whole change if that reading changes.
247
+ *
248
+ * @stability Beta
249
+ */
250
+ declare const SCOPE_LAYERS: Readonly<Record<SettingScope, readonly SettingsLayer[]>>;
251
+ /**
252
+ * Resolve every key in the catalogue through the layers. Later layers win unless an earlier one
253
+ * locked the value. Problems never throw: a bad entry is reported and skipped, so one typo in a
254
+ * table never takes the app down.
255
+ *
256
+ * - `unknown-key`: no package declares it.
257
+ * - `type`: the value doesn't fit the key's type or bounds.
258
+ * - `scope`: a tenant or person entry for a key not declared with that scope.
259
+ * - `build-only`: a database, tenant or person entry for a key that applies at build time.
260
+ * - `locked`: a later layer tried to change a value an earlier layer locked (setting the same
261
+ * value again isn't a problem).
262
+ * - `requires`: a key is on while a key it requires is off. The value stays; the screen and the
263
+ * doctor show what's missing.
264
+ * - `preset`: an unknown preset; the layers resolve on `max`.
265
+ *
266
+ * A lock whose own value is bad still locks: the value from the layers below stays, pinned, and
267
+ * the bad value is reported (`type`). A lock never fails open.
268
+ *
269
+ * @stability Beta
270
+ */
271
+ declare function resolveSettings(catalogue: SettingsCatalogue, layers?: SettingsLayers): ResolvedSettings;
272
+ /**
273
+ * genesis.config.json's `settings`, as a layer. Each key holds its value, or `{ "value": …,
274
+ * "locked": true }` to lock it: an object with exactly `value` and `locked` (a boolean) is that
275
+ * wrapper; any other object is the value itself.
276
+ *
277
+ * @stability Beta
278
+ */
279
+ declare function settingsLayerFromFile(settings: {
280
+ readonly [key: string]: unknown;
281
+ } | undefined): SettingsLayerValues;
282
+ /** `{ value, locked }` exactly, with a boolean lock: the file's way to lock a value. @stability Beta */
283
+ declare function isLockedEntry(raw: unknown): raw is {
284
+ value: unknown;
285
+ locked: boolean;
286
+ };
287
+ /** Rows (`{ key, value, locked }`, as the database returns them) as a layer. @stability Beta */
288
+ declare function settingsLayerFromRows(rows: readonly {
289
+ key: string;
290
+ value: unknown;
291
+ locked?: boolean | null;
292
+ }[]): SettingsLayerValues;
293
+ /** The secrets the catalogue's keys need, by name and store, never by value. @stability Beta */
294
+ declare function settingsSecrets(catalogue: SettingsCatalogue): Array<{
295
+ key: string;
296
+ name: string;
297
+ store: SecretStore;
298
+ }>;
299
+ /** What the resolved settings say to the gate. @stability Beta */
300
+ interface SettingsGate {
301
+ /** Features a boolean key linked with `feature` switched off (resolved to false). */
302
+ off: string[];
303
+ /** Flag values from keys linked with `flag`, when set. */
304
+ flags: {
305
+ [name: string]: FlagValue;
306
+ };
307
+ /** The features and flags whose keys the app locked (file or database): the context's own switches and flag values don't change them. */
308
+ locked: {
309
+ features: string[];
310
+ flags: string[];
311
+ };
312
+ }
313
+ /**
314
+ * What the resolved settings say to the gate: the features switched off (a boolean key linked
315
+ * with `feature` that resolved to false), flag values (a key linked with `flag`, when set), and
316
+ * which of those are locked.
317
+ *
318
+ * @stability Beta
319
+ */
320
+ declare function settingsGateContext(catalogue: SettingsCatalogue, resolved: ResolvedSettings): SettingsGate;
321
+ /** The layers whose locks outrank the gate context: the app's own. @stability Beta */
322
+ declare const APP_LOCK_LAYERS: readonly SettingsLayer[];
323
+ /**
324
+ * A gate context with the resolved settings folded in. The gate itself doesn't change:
325
+ *
326
+ * - a feature a setting switched off goes in `settingsOff`, so `featureOn` answers `reason:
327
+ * "setting"`;
328
+ * - a flag the context doesn't set takes the setting's value;
329
+ * - a setting the app locked (genesis.config.json or the database) wins over the context: the
330
+ * tenant's switch (`off`) can't turn off a feature whose key the app locked on, and the context's
331
+ * flag value can't change a flag the app locked. A tenant or person lock only stops later
332
+ * settings layers: the context's switch and flags still apply over it.
333
+ *
334
+ * ```ts
335
+ * const ctx = withSettings({ platform: "web", entitlements, off: tenantOff }, catalogue, resolved);
336
+ * featureOn({ features }, ctx, "support-messenger");
337
+ * ```
338
+ *
339
+ * @stability Beta
340
+ */
341
+ declare function withSettings(ctx: GateContext, catalogue: SettingsCatalogue, resolved: ResolvedSettings): GateContext;
342
+ /** One key as the database checks it (genesis_app_manifest.catalogue): no defaults, no secrets. @stability Beta */
343
+ interface SettingManifestEntry {
344
+ type: SettingType;
345
+ applies: SettingApplies;
346
+ scope: SettingScope;
347
+ min?: number;
348
+ max?: number;
349
+ options?: readonly (string | number)[];
350
+ /** Present (true) only when the key may be `null` ("not set"). */
351
+ nullable?: true;
352
+ /** Present (true) only for a number that must be whole. */
353
+ integer?: true;
354
+ }
355
+ /**
356
+ * The catalogue as the database's manifest stores it, so `set_genesis_setting` can check a value
357
+ * (type, bounds, runtime only) without the packages' code. Written on deploy with the manifest.
358
+ *
359
+ * @stability Beta
360
+ */
361
+ declare function catalogueManifest(catalogue: SettingsCatalogue): {
362
+ [key: string]: SettingManifestEntry;
363
+ };
364
+ /**
365
+ * A package's settings as its package.json declares them (`genesis.settings`: `{ namespace, keys }`),
366
+ * for tools that read packages without running them (the CLI's doctor). The same checks as
367
+ * {@link defineSettings}.
368
+ *
369
+ * @stability Beta
370
+ */
371
+ declare function settingsFromManifest(raw: unknown, where?: string): SettingsDeclaration;
372
+
373
+ export { APP_LOCK_LAYERS, DEFAULT_PRESET, type PresetDefaults, type ResolvedSettings, SCOPE_LAYERS, SETTINGS_LAYERS, SETTINGS_PRESETS, SETTING_KEY, SETTING_TYPES, SETUP_STEP_ID, type SecretStore, type SettingApplies, type SettingDef, type SettingEntry, type SettingManifestEntry, type SettingScope, type SettingSource, type SettingSpec, type SettingType, type SettingValueOf, type SettingsCatalogue, type SettingsDeclaration, SettingsError, type SettingsGate, type SettingsLayer, type SettingsLayerValues, type SettingsLayers, type SettingsPreset, type SettingsProblem, type SettingsProblemKind, catalogueManifest, defineSettings, isLockedEntry, isPresetDefaults, resolveSettings, settingValueProblem, settingsCatalogue, settingsFromManifest, settingsGateContext, settingsLayerFromFile, settingsLayerFromRows, settingsSecrets, withSettings };
@@ -0,0 +1,3 @@
1
+ export { APP_LOCK_LAYERS, DEFAULT_PRESET, SCOPE_LAYERS, SETTINGS_LAYERS, SETTINGS_PRESETS, SETTING_KEY, SETTING_TYPES, SETUP_STEP_ID, SettingsError, catalogueManifest, defineSettings, isLockedEntry, isPresetDefaults, resolveSettings, settingValueProblem, settingsCatalogue, settingsFromManifest, settingsGateContext, settingsLayerFromFile, settingsLayerFromRows, settingsSecrets, withSettings } from './chunk-UD7SPYZH.js';
2
+ //# sourceMappingURL=settings.js.map
3
+ //# sourceMappingURL=settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"settings.js"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * The registry's plain types, with no zod: shared by the model and the zod-free
3
+ * gate so `/gate` never pulls zod in, even in its type declarations.
4
+ */
5
+ /**
6
+ * Where a feature is in its life. The order is the board's column order.
7
+ * `idea` is captured but not agreed: it is in the list so `find` turns it up
8
+ * before someone builds the same thing twice.
9
+ *
10
+ * @stability Beta
11
+ */
12
+ declare const FEATURE_STATUSES: readonly ["idea", "planned", "building", "beta", "live", "deprecated", "retired"];
13
+ /** @stability Beta */
14
+ type FeatureStatus = (typeof FEATURE_STATUSES)[number];
15
+ /**
16
+ * Who gets a feature: everyone, or one paid plan. The feature id doubles as
17
+ * the billing entitlement's lookup key (a Stripe `lookup_key`).
18
+ *
19
+ * @stability Beta
20
+ */
21
+ type FeatureAccess = "all" | {
22
+ plan: string;
23
+ };
24
+ /**
25
+ * Why a flag exists. `release` and `experiment` flags need `expires`, `ops`
26
+ * flags need a `runbook`, and `permission` flags fail `check`: paid access
27
+ * belongs in entitlements (`access`), not flags.
28
+ *
29
+ * @stability Beta
30
+ */
31
+ declare const FLAG_KINDS: readonly ["release", "experiment", "ops", "permission"];
32
+ /** @stability Beta */
33
+ type FlagKind = (typeof FLAG_KINDS)[number];
34
+ /** A flag's default: anything an OpenFeature flag can hold. */
35
+ type FlagValue = boolean | string | number | {
36
+ readonly [key: string]: unknown;
37
+ };
38
+
39
+ export { type FeatureStatus as F, type FeatureAccess as a, type FlagKind as b, type FlagValue as c, FEATURE_STATUSES as d, FLAG_KINDS as e };
package/package.json CHANGED
@@ -1,6 +1,143 @@
1
1
  {
2
2
  "name": "@marktiderman/genesis-config",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.10.0",
4
+ "private": false,
5
+ "type": "module",
6
+ "sideEffects": false,
7
+ "description": "Genesis configuration: the typed feature registry (defineFeatures, defineFlags), blocks (defineBlock, resolveBlocks; /blocks, free of zod), the feature gate (featureOn; /gate, zod-free, with React hooks at /gate/react), generators for AGENTS.md and JSON, a stale-output check, and a FeatureList page. Formerly @marktiderman/genesis-features. Part of the Genesis framework.",
8
+ "keywords": [
9
+ "genesis",
10
+ "genesis-framework",
11
+ "feature-flags",
12
+ "feature-registry",
13
+ "openfeature",
14
+ "typescript",
15
+ "configuration",
16
+ "settings"
17
+ ],
18
+ "homepage": "https://github.com/marktiderman/genesis/tree/main/packages/features#readme",
19
+ "bugs": {
20
+ "url": "https://github.com/marktiderman/genesis/issues"
21
+ },
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/marktiderman/genesis.git",
25
+ "directory": "packages/features"
26
+ },
27
+ "license": "MIT",
28
+ "publishConfig": {
29
+ "access": "public",
30
+ "provenance": false
31
+ },
32
+ "main": "./dist/index.js",
33
+ "module": "./dist/index.js",
34
+ "types": "./dist/index.d.ts",
35
+ "exports": {
36
+ "./package.json": "./package.json",
37
+ ".": {
38
+ "types": "./dist/index.d.ts",
39
+ "import": "./dist/index.js"
40
+ },
41
+ "./blocks": {
42
+ "types": "./dist/blocks.d.ts",
43
+ "import": "./dist/blocks.js"
44
+ },
45
+ "./gate": {
46
+ "types": "./dist/gate.d.ts",
47
+ "import": "./dist/gate.js"
48
+ },
49
+ "./gate/react": {
50
+ "types": "./dist/gate-react.d.ts",
51
+ "import": "./dist/gate-react.js"
52
+ },
53
+ "./settings": {
54
+ "types": "./dist/settings.d.ts",
55
+ "import": "./dist/settings.js"
56
+ },
57
+ "./settings/react": {
58
+ "types": "./dist/settings-react.d.ts",
59
+ "import": "./dist/settings-react.js"
60
+ },
61
+ "./settings-protocol": {
62
+ "types": "./dist/settings-protocol.d.ts",
63
+ "import": "./dist/settings-protocol.js"
64
+ },
65
+ "./node": {
66
+ "types": "./dist/node.d.ts",
67
+ "import": "./dist/node.js"
68
+ },
69
+ "./react": {
70
+ "types": "./dist/react.d.ts",
71
+ "import": "./dist/react.js"
72
+ }
73
+ },
74
+ "files": [
75
+ "dist",
76
+ "README.md"
77
+ ],
78
+ "scripts": {
79
+ "build": "tsup && node ../../scripts/check-exports-resolve.mjs",
80
+ "clean": "rm -rf dist",
81
+ "typecheck": "tsc --noEmit",
82
+ "test": "vitest run"
83
+ },
84
+ "dependencies": {
85
+ "zod": "^4.6.6"
86
+ },
87
+ "peerDependencies": {
88
+ "@marktiderman/genesis-ui": "workspace:>=3.0.0 <4.0.0",
89
+ "lucide-react": "^1.0.0",
90
+ "react": "^19.0.0"
91
+ },
92
+ "peerDependenciesMeta": {
93
+ "@marktiderman/genesis-ui": {
94
+ "optional": true
95
+ },
96
+ "lucide-react": {
97
+ "optional": true
98
+ },
99
+ "react": {
100
+ "optional": true
101
+ }
102
+ },
103
+ "devDependencies": {
104
+ "@marktiderman/genesis-core": "workspace:^",
105
+ "@marktiderman/genesis-design-system": "workspace:^",
106
+ "@marktiderman/genesis-ui": "workspace:^",
107
+ "@testing-library/react": "^16.3.2",
108
+ "@types/node": "^22.9.0",
109
+ "@types/react": "^19.2.14",
110
+ "@types/react-dom": "^19.2.3",
111
+ "happy-dom": "^21.0.4",
112
+ "lucide-react": "^1.0.0",
113
+ "radix-ui": "^1.6.7",
114
+ "react": "^19.0.0",
115
+ "react-dom": "^19.0.0",
116
+ "tsup": "^8.3.0",
117
+ "typescript": "~6.0.3",
118
+ "vitest": "^5.0.5",
119
+ "zod": "^4.6.6"
120
+ },
121
+ "genesis": {
122
+ "layer": "foundation",
123
+ "group": "core",
124
+ "owner": "@marktiderman",
125
+ "essential": true,
126
+ "doctor": {
127
+ "prefer": [
128
+ {
129
+ "id": "no-env-feature-switches",
130
+ "need": "turning a feature on or off",
131
+ "level": "warn",
132
+ "forbid": {
133
+ "pattern": "\\b(?:import\\.meta\\.env|process\\.env)\\.(?:VITE_|NEXT_PUBLIC_|EXPO_PUBLIC_)?(?:FEATURE|FF|ENABLE|FLAG)_[A-Z0-9_]+"
134
+ },
135
+ "use": "a feature in features.ts read with featureOn / useFeature, or a flag",
136
+ "import": "@marktiderman/genesis-config",
137
+ "docs": "https://github.com/marktiderman/genesis/blob/main/packages/features/README.md",
138
+ "why": "An environment switch needs a redeploy to change and isn't in the feature registry."
139
+ }
140
+ ]
141
+ }
142
+ }
143
+ }