@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,128 @@
1
+ import { F as Features, b as FeatureRecord, a as Flags } from './model-uON71G4u.js';
2
+ export { D as DeprecatedFeatureLayer, c as FEATURE_HORIZONS, d as FEATURE_KINDS, e as FEATURE_LAYERS, f as FeatureDef, g as FeatureHorizon, h as FeatureIdOf, i as FeatureKind, j as FeatureLayer, k as FeatureLinks, l as FeatureMedia, m as FeaturePackage, n as FeatureRegistryError, o as FeatureVisibility, p as FindOptions, q as FlagDef, r as defineFeatures, s as defineFlags, t as expiredFlags, u as featureKind, v as featureLayer, w as featurePackageLayer, x as featureSchema, y as findFeatures, z as flagSchema, A as flagsForFeature, B as toRecords } from './model-uON71G4u.js';
3
+ export { BlockContributions, BlockDataUse, BlockDef, BlockError, BlockMigration, BlockNavItem, BlockPrivacy, BlockRoute, BlockSettingsRow, CONTENT_PACK_FIELD_TARGETS, ContentPackCheckOptions, ContentPackDef, ContentPackError, ContentPackFieldDefinition, ContentPackFieldTarget, ContentPackForm, ContentPackMetricTemplate, ContentPackRoadmapTemplate, ContentPackSectionValidator, ContentPackSections, ContentPackSessionType, Contributed, EnabledBlocks, ResolveBlocksOptions, ResolvedBlocks, contentPackBlocks, contentPackProblems, defineBlock, defineContentPack, resolveBlocks } from './blocks.js';
4
+ export { F as FeatureOff, G as GateAnswer, b as GateContext, c as GateFeature, d as GateFlag, e as GateReason, f as GateRegistry, a as GateSnapshot, g as GateSnapshotOptions, I as IdSet, S as SHIPPED_STATUSES, h as featureOn, i as fromSnapshot, j as gateSnapshot, k as isSnapshotStale, r as requireFeature } from './gate-CNTkn-Fv.js';
5
+ export { L as LayerPackage, M as ModuleMeta, O as OverlayMarker, a as PACKAGE_GROUPS, b as PACKAGE_LAYERS, c as PackageGroup, P as PackageLayer, d as PackageMeta, o as overlayUpstream, p as packageLayerProblems, r as readOverlayMarker, e as readPackageMeta } from './packages-CWhdXtzS.js';
6
+ export { APP_LOCK_LAYERS, DEFAULT_PRESET, PresetDefaults, ResolvedSettings, SCOPE_LAYERS, SETTINGS_LAYERS, SETTINGS_PRESETS, SETTING_KEY, SETTING_TYPES, SecretStore, SettingApplies, SettingDef, SettingEntry, SettingManifestEntry, SettingScope, SettingSource, SettingSpec, SettingType, SettingValueOf, SettingsCatalogue, SettingsDeclaration, SettingsError, SettingsGate, SettingsLayer, SettingsLayerValues, SettingsLayers, SettingsPreset, SettingsProblem, SettingsProblemKind, catalogueManifest, defineSettings, isLockedEntry, isPresetDefaults, resolveSettings, settingValueProblem, settingsCatalogue, settingsFromManifest, settingsGateContext, settingsLayerFromFile, settingsLayerFromRows, settingsSecrets, withSettings } from './settings.js';
7
+ export { a as FEATURE_PLATFORMS, F as FeaturePlatform } from './platforms-NR0liM8L.js';
8
+ export { d as FEATURE_STATUSES, e as FLAG_KINDS, a as FeatureAccess, F as FeatureStatus, b as FlagKind, c as FlagValue } from './types-D4hs16bJ.js';
9
+ export { statusOn } from './gate.js';
10
+ import 'zod';
11
+
12
+ /** Marks the start of the generated block in AGENTS.md. */
13
+ declare const AGENTS_BLOCK_START = "<!-- genesis-features:start -->";
14
+ /** Marks the end of the generated block in AGENTS.md. */
15
+ declare const AGENTS_BLOCK_END = "<!-- genesis-features:end -->";
16
+ /** Marks the start of the generated marketing block (e.g. in README.md). */
17
+ declare const MARKETING_BLOCK_START = "<!-- genesis-features:marketing:start -->";
18
+ /** Marks the end of the generated marketing block. */
19
+ declare const MARKETING_BLOCK_END = "<!-- genesis-features:marketing:end -->";
20
+ interface GenerateOptions {
21
+ /** The file the registry lives in, named in the "generated from" notes. Default `src/features.ts`. */
22
+ source?: string;
23
+ /** How agents run the CLI here, e.g. `genesis features` or `bun run features`. Default `genesis features`. */
24
+ command?: string;
25
+ /** Where the skill lives, named in the AGENTS.md pointer. Default `.claude/skills/features/SKILL.md`. */
26
+ skill?: string | false;
27
+ }
28
+ /**
29
+ * The registry as JSON, for tools that can't import TypeScript. Stable: no
30
+ * timestamps, features in declaration order, so `check` can compare it. It is
31
+ * also the record of every id ever used, which keeps ids permanent.
32
+ *
33
+ * @stability Beta
34
+ */
35
+ declare function toJson(features: Features, flags?: Flags, options?: GenerateOptions): string;
36
+ /** The schema an OpenFeature CLI flag manifest points at. */
37
+ declare const OPENFEATURE_MANIFEST_SCHEMA = "https://raw.githubusercontent.com/open-feature/cli/refs/heads/main/schema/v0/flag-manifest.json";
38
+ /**
39
+ * The flags as an OpenFeature CLI flag manifest (`flags.json`), so
40
+ * `openfeature generate` can make typed accessors from the same registry.
41
+ *
42
+ * @stability Beta
43
+ */
44
+ declare function toOpenFeatureManifest(flags: Flags, features?: Features): string;
45
+ /**
46
+ * The marker-delimited block for AGENTS.md: deliberately short. It points
47
+ * agents at `find` and the skill and gives counts, never the whole list, so
48
+ * AGENTS.md stays small however many features there are.
49
+ *
50
+ * @stability Beta
51
+ */
52
+ declare function toAgentsMarkdown(features: Features, flags?: Flags, options?: GenerateOptions): string;
53
+ /** The public, shipped features a marketing page shows: visibility public, a tagline, live or beta. */
54
+ declare function marketingRecords(features: Features): FeatureRecord[];
55
+ /**
56
+ * A benefit-led feature list for a README or a marketing page: public, shipped
57
+ * features with a tagline, highlights first, grouped by category.
58
+ *
59
+ * @stability Beta
60
+ */
61
+ declare function toMarketingMarkdown(features: Features, options?: {
62
+ heading?: string;
63
+ source?: string;
64
+ }): string;
65
+ /** Thrown when a generated block's markers are broken: one is missing, repeated or out of order. */
66
+ declare class BrokenBlockError extends Error {
67
+ constructor(start: string);
68
+ }
69
+ /** The generated AGENTS.md block inside `doc`, or null. */
70
+ declare const readAgentsBlock: (doc: string) => string | null;
71
+ /**
72
+ * `doc` with its generated AGENTS.md block replaced by `block`, or with
73
+ * `block` appended when it has none yet.
74
+ *
75
+ * @stability Beta
76
+ */
77
+ declare const replaceAgentsBlock: (doc: string, block: string) => string;
78
+ /**
79
+ * The agent skill for working with the registry, written to
80
+ * `.claude/skills/features/SKILL.md` by `genesis features build`. `outputs`
81
+ * names what the build writes in this repo, so the skill never claims a file
82
+ * the repo turned off.
83
+ *
84
+ * @stability Beta
85
+ */
86
+ declare function toSkillMarkdown(options?: GenerateOptions & {
87
+ outputs?: readonly string[];
88
+ }): string;
89
+
90
+ /**
91
+ * The `requires` graph checks shared by the feature registry
92
+ * (`defineFeatures`) and blocks (`resolveBlocks`). No zod here: blocks import
93
+ * this from a platform-neutral entry that ships to phones.
94
+ */
95
+ /** A node with the ids it needs. */
96
+ interface RequiresNode {
97
+ readonly requires?: readonly string[];
98
+ }
99
+ interface RequiresProblemsOptions {
100
+ /** What a node is called in messages: `feature` or `block`. */
101
+ noun: string;
102
+ /** Whether an id may be required. Default: it is a node of the graph. */
103
+ isKnown?: (id: string) => boolean;
104
+ /** The message for a requirement `isKnown` refuses. Default `"x" is not a <noun>`. */
105
+ unknown?: (req: string, id: string) => string;
106
+ /** Nodes already reported invalid: their edges can't be trusted, so they are skipped. */
107
+ skip?: ReadonlySet<string>;
108
+ }
109
+ /**
110
+ * Self-requirements, unknown requirements and cycles through `requires`, as
111
+ * problem strings (`a.requires: …`). Each cycle is reported once, from where
112
+ * the depth-first search found it: `a.requires: a cycle: a → b → a`.
113
+ *
114
+ * @stability Beta
115
+ */
116
+ declare function requiresProblems(nodes: Readonly<Record<string, RequiresNode>>, options: RequiresProblemsOptions): string[];
117
+ /** One requirement's problem (itself, or an unknown id), or undefined when it is fine. @stability Beta */
118
+ declare function requirementProblem(nodes: Readonly<Record<string, RequiresNode>>, id: string, req: string, options: RequiresProblemsOptions): string | undefined;
119
+ /** Cycles through `requires`, each reported once, from where the depth-first search found it. @stability Beta */
120
+ declare function cycleProblems(nodes: Readonly<Record<string, RequiresNode>>, skip?: ReadonlySet<string>): string[];
121
+ /**
122
+ * The ids in dependency order (what a node requires comes first), ties kept
123
+ * in the given order. Requirements outside `nodes` are ignored. Assumes no
124
+ * cycles ({@link requiresProblems} reports them).
125
+ */
126
+ declare function dependencyOrder(nodes: Readonly<Record<string, RequiresNode>>): string[];
127
+
128
+ export { AGENTS_BLOCK_END, AGENTS_BLOCK_START, BrokenBlockError, FeatureRecord, Features, Flags, type GenerateOptions, MARKETING_BLOCK_END, MARKETING_BLOCK_START, OPENFEATURE_MANIFEST_SCHEMA, type RequiresNode, type RequiresProblemsOptions, cycleProblems, dependencyOrder, marketingRecords, readAgentsBlock, replaceAgentsBlock, requirementProblem, requiresProblems, toAgentsMarkdown, toJson, toMarketingMarkdown, toOpenFeatureManifest, toSkillMarkdown };
package/dist/index.js ADDED
@@ -0,0 +1,9 @@
1
+ export { BlockError, CONTENT_PACK_FIELD_TARGETS, ContentPackError, PACKAGE_GROUPS, PACKAGE_LAYERS, contentPackBlocks, contentPackProblems, defineBlock, defineContentPack, overlayUpstream, packageLayerProblems, readOverlayMarker, readPackageMeta, resolveBlocks } from './chunk-Y7NUBTWA.js';
2
+ export { APP_LOCK_LAYERS, DEFAULT_PRESET, SCOPE_LAYERS, SETTINGS_LAYERS, SETTINGS_PRESETS, SETTING_KEY, SETTING_TYPES, SettingsError, catalogueManifest, defineSettings, isLockedEntry, isPresetDefaults, resolveSettings, settingValueProblem, settingsCatalogue, settingsFromManifest, settingsGateContext, settingsLayerFromFile, settingsLayerFromRows, settingsSecrets, withSettings } from './chunk-UD7SPYZH.js';
3
+ export { FeatureOff, SHIPPED_STATUSES, featureOn, fromSnapshot, gateSnapshot, isSnapshotStale, requireFeature } from './chunk-M7IY6LUN.js';
4
+ export { AGENTS_BLOCK_END, AGENTS_BLOCK_START, BrokenBlockError, FEATURE_HORIZONS, FEATURE_KINDS, FEATURE_LAYERS, FEATURE_STATUSES, FLAG_KINDS, FeatureRegistryError, MARKETING_BLOCK_END, MARKETING_BLOCK_START, OPENFEATURE_MANIFEST_SCHEMA, defineFeatures, defineFlags, expiredFlags, featureKind, featureLayer, featurePackageLayer, featureSchema, findFeatures, flagSchema, flagsForFeature, marketingRecords, readAgentsBlock, replaceAgentsBlock, toAgentsMarkdown, toJson, toMarketingMarkdown, toOpenFeatureManifest, toRecords, toSkillMarkdown } from './chunk-SEFG2QV6.js';
5
+ export { cycleProblems, dependencyOrder, requirementProblem, requiresProblems } from './chunk-VYUX7VAX.js';
6
+ export { FEATURE_PLATFORMS } from './chunk-B6WRD3WF.js';
7
+ export { statusOn } from './chunk-OW46SL2G.js';
8
+ //# sourceMappingURL=index.js.map
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -0,0 +1,437 @@
1
+ import { z } from 'zod';
2
+ import { F as FeaturePlatform } from './platforms-NR0liM8L.js';
3
+ import { F as FeatureStatus, a as FeatureAccess, b as FlagKind, c as FlagValue } from './types-D4hs16bJ.js';
4
+ import { P as PackageLayer } from './packages-CWhdXtzS.js';
5
+
6
+ /**
7
+ * When a planned or building feature is due, without dates: the roadmap's
8
+ * three columns.
9
+ *
10
+ * @stability Beta
11
+ */
12
+ declare const FEATURE_HORIZONS: readonly ["now", "next", "later"];
13
+ /** @stability Beta */
14
+ type FeatureHorizon = (typeof FEATURE_HORIZONS)[number];
15
+ /**
16
+ * Who may see a feature listed. `public` features with a `tagline` go on
17
+ * marketing output; `client:<name>` is one customer's own feature.
18
+ *
19
+ * @stability Beta
20
+ */
21
+ type FeatureVisibility = "internal" | "customer" | "public" | `client:${string}`;
22
+ /**
23
+ * Pointers from a feature to where it lives. `code` paths are relative to the
24
+ * repository root and `genesis features check` fails when one doesn't exist.
25
+ *
26
+ * @stability Beta
27
+ */
28
+ interface FeatureLinks {
29
+ /** Files or folders that implement the feature, relative to the repo root. */
30
+ code?: readonly string[];
31
+ /** Docs: a repo-relative path or a URL. */
32
+ docs?: readonly string[];
33
+ /** The tracking issue: a URL, `#123` or `owner/repo#123`. */
34
+ issue?: string;
35
+ }
36
+
37
+ /**
38
+ * What kind of thing a feature is, from smallest to largest, so an agent
39
+ * looking for a building block can tell an element from a whole block:
40
+ * `token`, `element` (one component), `pattern` (a composed component with
41
+ * slots), `layout` (a page or screen shell), `hook`, `provider` (data or
42
+ * context), `block` (a feature an app adds whole: UI, data and server),
43
+ * `service` (server code) and `tool` (CLI, CI, devtools).
44
+ *
45
+ * A feature's layer is not declared: it is its package's layer (see
46
+ * {@link featurePackageLayer} and `PACKAGE_LAYERS`).
47
+ *
48
+ * @stability Beta
49
+ */
50
+ declare const FEATURE_KINDS: readonly ["token", "element", "pattern", "layout", "hook", "provider", "block", "service", "tool"];
51
+ /** @stability Beta */
52
+ type FeatureKind = (typeof FEATURE_KINDS)[number];
53
+ /** @deprecated Use `FEATURE_KINDS`. Removed at the next major. */
54
+ declare const FEATURE_LAYERS: readonly ["token", "element", "pattern", "layout", "hook", "provider", "block", "service", "tool"];
55
+ /** @deprecated Use `FeatureKind`. Removed at the next major. */
56
+ type FeatureLayer = FeatureKind;
57
+ /** @deprecated Use `"element"`. Accepted until the next major. */
58
+ type DeprecatedFeatureLayer = "primitive";
59
+ /**
60
+ * A kind written in the deprecated `layer` field, with its old name
61
+ * `"primitive"` mapped to `"element"`.
62
+ *
63
+ * @stability Beta
64
+ */
65
+ declare function featureLayer(layer: FeatureKind | DeprecatedFeatureLayer | undefined): FeatureKind | undefined;
66
+ /**
67
+ * A feature's kind: `kind`, or else the deprecated `layer` field (read until
68
+ * the next major).
69
+ *
70
+ * @stability Beta
71
+ */
72
+ declare function featureKind(def: Pick<FeatureDef, "kind" | "layer">): FeatureKind | undefined;
73
+ /** A picture or video for a marketing page. @stability Beta */
74
+ interface FeatureMedia {
75
+ image?: string;
76
+ video?: string;
77
+ alt: string;
78
+ }
79
+ /**
80
+ * One feature. The object key in {@link defineFeatures} is its id: permanent,
81
+ * never reused, and renamed only through `aliases`.
82
+ *
83
+ * @stability Beta
84
+ */
85
+ interface FeatureDef {
86
+ name: string;
87
+ /** One sentence for the team: what it does for whom. */
88
+ summary: string;
89
+ status: FeatureStatus;
90
+ /** Who answers for it: a person, a team or an agent session's name. */
91
+ owner: string;
92
+ /** Which of the repo's apps or surfaces carry it, e.g. `["web"]`. */
93
+ apps: readonly string[];
94
+ /** Who it is for, e.g. `["client", "coach"]`. */
95
+ audience: readonly string[];
96
+ /** Roadmap column. Only on planned (required) or building features. */
97
+ horizon?: FeatureHorizon;
98
+ /** Default `customer`. */
99
+ visibility?: FeatureVisibility;
100
+ /** Default `all`. */
101
+ access?: FeatureAccess;
102
+ /** One testable sentence each. Required on beta and live features. */
103
+ acceptance?: readonly string[];
104
+ /** Ids this feature had before. An old id can't be reused. */
105
+ aliases?: readonly string[];
106
+ /** When someone last checked this entry against the product: `YYYY-MM-DD`. */
107
+ reviewedAt?: string;
108
+ /** Who is building it right now. Only on building features. */
109
+ claimedBy?: string;
110
+ /** When it first shipped or started: `YYYY-MM-DD` or `YYYY-MM`. */
111
+ since?: string;
112
+ links?: FeatureLinks;
113
+ /** One line of benefit, for customers. Needed for marketing output. */
114
+ tagline?: string;
115
+ /** A group on a marketing page. */
116
+ category?: string;
117
+ media?: FeatureMedia;
118
+ /** A hero item on a marketing page. */
119
+ highlight?: boolean;
120
+ /** What kind of thing it is. */
121
+ kind?: FeatureKind;
122
+ /**
123
+ * @deprecated Use `kind` (same values; `"primitive"` means `"element"`). Read until the
124
+ * next major, when `layer` is the owning package's layer, derived and never written.
125
+ */
126
+ layer?: FeatureKind | DeprecatedFeatureLayer;
127
+ /**
128
+ * Status per platform, when it differs from `status`: `{ web: "live", native: "planned" }`.
129
+ * A platform left out doesn't have it.
130
+ */
131
+ platforms?: Partial<Record<FeaturePlatform, FeatureStatus>>;
132
+ /** What to import, per platform, e.g. `{ web: "@marktiderman/genesis-ui/settings-row" }`. */
133
+ entry?: Partial<Record<FeaturePlatform, string>>;
134
+ /** Other words people use for it, so `find` matches them: `["chat", "dm"]`. */
135
+ keywords?: readonly string[];
136
+ /** The feature this one is a variant of. */
137
+ extends?: string;
138
+ /** Features it needs. A beta or live feature can't require an idea, a planned or a retired one. */
139
+ requires?: readonly string[];
140
+ /** What it adds to an app, e.g. `["nav item", "settings row", "table: threads"]`. */
141
+ contributes?: readonly string[];
142
+ /** The parts an app can replace or drop through `slots`. */
143
+ slots?: readonly string[];
144
+ }
145
+ /**
146
+ * One flag. `feature` names the {@link FeatureDef} it belongs to; a feature's
147
+ * flags are found by reverse lookup ({@link flagsForFeature}) and never
148
+ * written on the feature itself.
149
+ *
150
+ * @stability Beta
151
+ */
152
+ interface FlagDef<F extends string = string> {
153
+ feature: F;
154
+ kind: FlagKind;
155
+ owner: string;
156
+ default: FlagValue;
157
+ /** Where it can be set, e.g. `["platform", "practice", "user"]`. */
158
+ scopes: readonly string[];
159
+ description?: string;
160
+ /** `YYYY-MM-DD`. Required on release and experiment flags; `check` fails after it. */
161
+ expires?: string;
162
+ /** What to do when you flip it: a repo path or a URL. Required on ops flags. */
163
+ runbook?: string;
164
+ /**
165
+ * Flags are grouped by feature: one flag per feature by default. Every flag
166
+ * after a feature's first must say why it is a separate flag.
167
+ */
168
+ splitReason?: string;
169
+ }
170
+ /** The id type of a features object: `type FeatureId = FeatureIdOf<typeof features>`. */
171
+ type FeatureIdOf<T> = Extract<keyof T, string>;
172
+ /** A features object as {@link defineFeatures} returns it. */
173
+ type Features<Id extends string = string> = {
174
+ readonly [K in Id]: FeatureDef;
175
+ };
176
+ /** A flags object as {@link defineFlags} returns it. */
177
+ type Flags<F extends string = string> = {
178
+ readonly [name: string]: FlagDef<F>;
179
+ };
180
+ /** The Zod schema for one {@link FeatureDef}, field by field. Cross-field rules live in {@link featureProblems}. */
181
+ declare const featureSchema: z.ZodObject<{
182
+ name: z.ZodString;
183
+ summary: z.ZodString;
184
+ status: z.ZodEnum<{
185
+ idea: "idea";
186
+ planned: "planned";
187
+ building: "building";
188
+ beta: "beta";
189
+ live: "live";
190
+ deprecated: "deprecated";
191
+ retired: "retired";
192
+ }>;
193
+ owner: z.ZodString;
194
+ apps: z.ZodArray<z.ZodString>;
195
+ audience: z.ZodArray<z.ZodString>;
196
+ horizon: z.ZodOptional<z.ZodEnum<{
197
+ now: "now";
198
+ next: "next";
199
+ later: "later";
200
+ }>>;
201
+ visibility: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
202
+ internal: "internal";
203
+ customer: "customer";
204
+ public: "public";
205
+ }>, z.ZodString]>>;
206
+ access: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"all">, z.ZodObject<{
207
+ plan: z.ZodString;
208
+ }, z.core.$strict>]>>;
209
+ acceptance: z.ZodOptional<z.ZodArray<z.ZodString>>;
210
+ aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
211
+ reviewedAt: z.ZodOptional<z.ZodString>;
212
+ claimedBy: z.ZodOptional<z.ZodString>;
213
+ since: z.ZodOptional<z.ZodString>;
214
+ links: z.ZodOptional<z.ZodObject<{
215
+ code: z.ZodOptional<z.ZodArray<z.ZodString>>;
216
+ docs: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodString]>>>;
217
+ issue: z.ZodOptional<z.ZodString>;
218
+ }, z.core.$strict>>;
219
+ tagline: z.ZodOptional<z.ZodString>;
220
+ category: z.ZodOptional<z.ZodString>;
221
+ media: z.ZodOptional<z.ZodObject<{
222
+ image: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodString]>>;
223
+ video: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodString]>>;
224
+ alt: z.ZodString;
225
+ }, z.core.$strict>>;
226
+ highlight: z.ZodOptional<z.ZodBoolean>;
227
+ kind: z.ZodOptional<z.ZodEnum<{
228
+ token: "token";
229
+ element: "element";
230
+ pattern: "pattern";
231
+ layout: "layout";
232
+ hook: "hook";
233
+ provider: "provider";
234
+ block: "block";
235
+ service: "service";
236
+ tool: "tool";
237
+ }>>;
238
+ layer: z.ZodOptional<z.ZodEnum<{
239
+ primitive: "primitive";
240
+ token: "token";
241
+ element: "element";
242
+ pattern: "pattern";
243
+ layout: "layout";
244
+ hook: "hook";
245
+ provider: "provider";
246
+ block: "block";
247
+ service: "service";
248
+ tool: "tool";
249
+ }>>;
250
+ platforms: z.ZodOptional<z.ZodObject<{
251
+ web: z.ZodOptional<z.ZodEnum<{
252
+ idea: "idea";
253
+ planned: "planned";
254
+ building: "building";
255
+ beta: "beta";
256
+ live: "live";
257
+ deprecated: "deprecated";
258
+ retired: "retired";
259
+ }>>;
260
+ native: z.ZodOptional<z.ZodEnum<{
261
+ idea: "idea";
262
+ planned: "planned";
263
+ building: "building";
264
+ beta: "beta";
265
+ live: "live";
266
+ deprecated: "deprecated";
267
+ retired: "retired";
268
+ }>>;
269
+ server: z.ZodOptional<z.ZodEnum<{
270
+ idea: "idea";
271
+ planned: "planned";
272
+ building: "building";
273
+ beta: "beta";
274
+ live: "live";
275
+ deprecated: "deprecated";
276
+ retired: "retired";
277
+ }>>;
278
+ cli: z.ZodOptional<z.ZodEnum<{
279
+ idea: "idea";
280
+ planned: "planned";
281
+ building: "building";
282
+ beta: "beta";
283
+ live: "live";
284
+ deprecated: "deprecated";
285
+ retired: "retired";
286
+ }>>;
287
+ }, z.core.$strict>>;
288
+ entry: z.ZodOptional<z.ZodObject<{
289
+ web: z.ZodOptional<z.ZodString>;
290
+ native: z.ZodOptional<z.ZodString>;
291
+ server: z.ZodOptional<z.ZodString>;
292
+ cli: z.ZodOptional<z.ZodString>;
293
+ }, z.core.$strict>>;
294
+ keywords: z.ZodOptional<z.ZodArray<z.ZodString>>;
295
+ extends: z.ZodOptional<z.ZodString>;
296
+ requires: z.ZodOptional<z.ZodArray<z.ZodString>>;
297
+ contributes: z.ZodOptional<z.ZodArray<z.ZodString>>;
298
+ slots: z.ZodOptional<z.ZodArray<z.ZodString>>;
299
+ }, z.core.$strict>;
300
+ /** The Zod schema for one {@link FlagDef}. Cross-flag rules live in {@link defineFlags}. */
301
+ declare const flagSchema: z.ZodObject<{
302
+ feature: z.ZodString;
303
+ kind: z.ZodEnum<{
304
+ release: "release";
305
+ experiment: "experiment";
306
+ ops: "ops";
307
+ permission: "permission";
308
+ }>;
309
+ owner: z.ZodString;
310
+ default: z.ZodType<FlagValue, unknown, z.core.$ZodTypeInternals<FlagValue, unknown>>;
311
+ scopes: z.ZodArray<z.ZodString>;
312
+ description: z.ZodOptional<z.ZodString>;
313
+ expires: z.ZodOptional<z.ZodString>;
314
+ runbook: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodString]>>;
315
+ splitReason: z.ZodOptional<z.ZodString>;
316
+ }, z.core.$strict>;
317
+ /** Thrown by {@link defineFeatures} and {@link defineFlags}; lists every problem at once. */
318
+ declare class FeatureRegistryError extends Error {
319
+ readonly problems: string[];
320
+ constructor(problems: string[]);
321
+ }
322
+ /**
323
+ * The one source of truth for a repo's features. Validates every entry and
324
+ * returns the same object, so running code reads it directly and the key type
325
+ * becomes the repo's `FeatureId`:
326
+ *
327
+ * ```ts
328
+ * export const features = defineFeatures({
329
+ * tasks: { name: "Tasks", summary: "…", status: "live", owner: "mark", apps: ["web"], audience: ["client"],
330
+ * acceptance: ["A client can tick off a task their coach added."] },
331
+ * });
332
+ * export type FeatureId = FeatureIdOf<typeof features>;
333
+ * ```
334
+ *
335
+ * @stability Beta
336
+ */
337
+ declare function defineFeatures<const T extends Record<string, FeatureDef>>(features: T): T;
338
+ /**
339
+ * Flags, each tied to a feature of `features`. An unknown `feature` is a type
340
+ * error, and at runtime:
341
+ * - every flag needs an `owner`, a `kind`, a `default` and its `scopes`;
342
+ * - `release` and `experiment` flags need an `expires` date, `ops` flags a `runbook`;
343
+ * - a feature's second (third, …) flag needs a `splitReason`, because flags
344
+ * are grouped by feature unless there's a stated reason to split.
345
+ *
346
+ * `permission` flags are accepted here so the app still runs, and refused by
347
+ * `genesis features check`.
348
+ *
349
+ * @stability Beta
350
+ */
351
+ declare function defineFlags<F extends string, const T extends Record<string, FlagDef<NoInfer<F>>>>(features: {
352
+ readonly [K in F]: FeatureDef;
353
+ }, flags: T): T;
354
+ /**
355
+ * The names of the flags that belong to a feature, in declaration order.
356
+ *
357
+ * @stability Beta
358
+ */
359
+ declare function flagsForFeature(flags: Flags | undefined, id: string): string[];
360
+ /**
361
+ * Flags whose `expires` date is before `today` (`YYYY-MM-DD`, default today in
362
+ * UTC): remove the code path, then the flag.
363
+ *
364
+ * @stability Beta
365
+ */
366
+ declare function expiredFlags(flags: Flags | undefined, today?: string): string[];
367
+ /**
368
+ * A feature flattened for a list, a board or JSON: its id, its fields with
369
+ * defaults filled in, and the names of its flags.
370
+ *
371
+ * @stability Beta
372
+ */
373
+ interface FeatureRecord extends FeatureDef {
374
+ [key: string]: unknown;
375
+ id: string;
376
+ visibility: FeatureVisibility;
377
+ access: FeatureAccess;
378
+ flags: string[];
379
+ }
380
+ /**
381
+ * Features as records, in declaration order, each with its flags attached.
382
+ *
383
+ * @stability Beta
384
+ */
385
+ declare function toRecords(features: Features, flags?: Flags): FeatureRecord[];
386
+ /**
387
+ * Narrows {@link findFeatures}: only features on a platform (from `platforms`,
388
+ * or `apps` when a feature has no `platforms`), of a layer, or in a status.
389
+ *
390
+ * @stability Beta
391
+ */
392
+ interface FindOptions {
393
+ platform?: FeaturePlatform;
394
+ kind?: FeatureKind;
395
+ /** @deprecated Use `kind` (`"primitive"` is read as `"element"`). */
396
+ layer?: FeatureKind | DeprecatedFeatureLayer;
397
+ /**
398
+ * Only features whose package is in this layer (see {@link featurePackageLayer}).
399
+ * Needs `packages`: without them it throws, rather than matching nothing.
400
+ */
401
+ packageLayer?: PackageLayer;
402
+ /** The packages a feature can belong to, for `packageLayer`. */
403
+ packages?: readonly FeaturePackage[];
404
+ status?: FeatureStatus;
405
+ }
406
+ /**
407
+ * A package a feature can belong to: its npm name, its folder (repo-relative,
408
+ * e.g. `packages/ui`) when it is in this repo, and its layer.
409
+ *
410
+ * @stability Beta
411
+ */
412
+ interface FeaturePackage {
413
+ name: string;
414
+ dir?: string;
415
+ layer: PackageLayer;
416
+ }
417
+ /**
418
+ * A feature's layer, derived from the package that owns it: the first `entry`
419
+ * import whose package is known, else the first `links.code` path inside a
420
+ * known package folder. Undefined when no package owns it (an app's own
421
+ * feature, a tool in scripts/).
422
+ *
423
+ * @stability Beta
424
+ */
425
+ declare function featurePackageLayer(def: FeatureDef, packages: readonly FeaturePackage[]): PackageLayer | undefined;
426
+
427
+ /**
428
+ * Features matching `term` in their id, aliases, name, keywords, summary,
429
+ * tagline, category, import paths, slots, contributions or code paths, best
430
+ * matches (id, name and keywords) first. With `options` and an empty `term`,
431
+ * every feature that passes the filters.
432
+ *
433
+ * @stability Beta
434
+ */
435
+ declare function findFeatures(features: Features, term: string, flags?: Flags, options?: FindOptions): FeatureRecord[];
436
+
437
+ export { flagsForFeature as A, toRecords as B, type DeprecatedFeatureLayer as D, type Features as F, type Flags as a, type FeatureRecord as b, FEATURE_HORIZONS as c, FEATURE_KINDS as d, FEATURE_LAYERS as e, type FeatureDef as f, type FeatureHorizon as g, type FeatureIdOf as h, type FeatureKind as i, type FeatureLayer as j, type FeatureLinks as k, type FeatureMedia as l, type FeaturePackage as m, FeatureRegistryError as n, type FeatureVisibility as o, type FindOptions as p, type FlagDef as q, defineFeatures as r, defineFlags as s, expiredFlags as t, featureKind as u, featureLayer as v, featurePackageLayer as w, featureSchema as x, findFeatures as y, flagSchema as z };