@marktiderman/genesis-features 0.9.1 → 0.10.1

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 (43) hide show
  1. package/README.md +14 -279
  2. package/dist/blocks.d.ts +4 -470
  3. package/dist/blocks.js +7 -5
  4. package/dist/gate-react.d.ts +4 -45
  5. package/dist/gate-react.js +7 -36
  6. package/dist/gate.d.ts +4 -15
  7. package/dist/gate.js +7 -5
  8. package/dist/index.d.ts +4 -124
  9. package/dist/index.js +7 -8
  10. package/dist/node.d.ts +4 -156
  11. package/dist/node.js +7 -486
  12. package/dist/react.d.ts +4 -57
  13. package/dist/react.js +7 -235
  14. package/dist/settings-protocol.d.ts +7 -0
  15. package/dist/settings-protocol.js +7 -0
  16. package/dist/settings-react.d.ts +7 -0
  17. package/dist/settings-react.js +8 -0
  18. package/dist/settings.d.ts +7 -0
  19. package/dist/settings.js +7 -0
  20. package/package.json +35 -51
  21. package/dist/blocks.js.map +0 -1
  22. package/dist/chunk-B6WRD3WF.js +0 -6
  23. package/dist/chunk-B6WRD3WF.js.map +0 -1
  24. package/dist/chunk-OW46SL2G.js +0 -10
  25. package/dist/chunk-OW46SL2G.js.map +0 -1
  26. package/dist/chunk-SEFG2QV6.js +0 -413
  27. package/dist/chunk-SEFG2QV6.js.map +0 -1
  28. package/dist/chunk-VYUX7VAX.js +0 -52
  29. package/dist/chunk-VYUX7VAX.js.map +0 -1
  30. package/dist/chunk-YTPGUU5F.js +0 -121
  31. package/dist/chunk-YTPGUU5F.js.map +0 -1
  32. package/dist/chunk-Z3TTDIVM.js +0 -494
  33. package/dist/chunk-Z3TTDIVM.js.map +0 -1
  34. package/dist/gate-oYFzQKyb.d.ts +0 -199
  35. package/dist/gate-react.js.map +0 -1
  36. package/dist/gate.js.map +0 -1
  37. package/dist/index.js.map +0 -1
  38. package/dist/model-sTRmrxz3.d.ts +0 -437
  39. package/dist/node.js.map +0 -1
  40. package/dist/packages-CWhdXtzS.d.ts +0 -203
  41. package/dist/platforms-NR0liM8L.d.ts +0 -10
  42. package/dist/react.js.map +0 -1
  43. package/dist/types-Bd766VxF.d.ts +0 -39
package/dist/node.js CHANGED
@@ -1,486 +1,7 @@
1
- import { BrokenBlockError, expiredFlags, toAgentsMarkdown, readAgentsBlock, replaceAgentsBlock, toJson, toOpenFeatureManifest, toSkillMarkdown, toMarketingMarkdown, readBlock, MARKETING_BLOCK_START, MARKETING_BLOCK_END, replaceBlock } from './chunk-SEFG2QV6.js';
2
- import './chunk-VYUX7VAX.js';
3
- import './chunk-B6WRD3WF.js';
4
- import './chunk-OW46SL2G.js';
5
- import { existsSync, readFileSync, readdirSync, mkdirSync, writeFileSync } from 'fs';
6
- import { join, dirname } from 'path';
7
-
8
- var CODE = "{ts,tsx,js,jsx,mjs,cjs}";
9
- var DEFAULT_SCAN = [`src/**/*.${CODE}`, `app/**/*.${CODE}`, `packages/*/src/**/*.${CODE}`];
10
- var DEFAULT_TESTS = [`**/*.{test,spec}.${CODE}`, "**/__tests__/**/*", "supabase/tests/**/*.sql"];
11
- var DEFAULT_COVERAGE = [`src/routes/**/*.${CODE}`, `app/routes/**/*.${CODE}`, "**/*.functions.ts"];
12
- var DEFAULT_COVERAGE_IGNORE = ["**/routeTree.gen.ts", "**/__root.tsx", "**/*.d.ts"];
13
- var DEFAULT_ACCESSORS = ["useFlag", "getFlag", "<Flag name>"];
14
- var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", "dist", "build", "coverage", "out", "storybook-static"]);
15
- function read(file) {
16
- return existsSync(file) ? readFileSync(file, "utf8").replace(/\r\n/g, "\n") : null;
17
- }
18
- function globToRegExp(glob) {
19
- let out = "";
20
- for (let i = 0; i < glob.length; i++) {
21
- const c = glob[i];
22
- if (c === "*" && glob[i + 1] === "*") {
23
- const slash = glob[i + 2] === "/";
24
- out += slash ? "(?:.*/)?" : ".*";
25
- i += slash ? 2 : 1;
26
- } else if (c === "*") out += "[^/]*";
27
- else if (c === "?") out += "[^/]";
28
- else if (c === "{") {
29
- const close = glob.indexOf("}", i);
30
- out += `(?:${glob.slice(i + 1, close).split(",").map((s) => s.replace(/[.+^$()|[\]\\]/g, "\\$&")).join("|")})`;
31
- i = close;
32
- } else out += c.replace(/[.+^$()|[\]\\]/g, "\\$&");
33
- }
34
- return new RegExp(`^${out}$`);
35
- }
36
- function listFiles(root) {
37
- const out = [];
38
- const walk = (rel) => {
39
- let entries;
40
- try {
41
- entries = readdirSync(join(root, rel), { withFileTypes: true });
42
- } catch {
43
- return;
44
- }
45
- for (const entry of entries) {
46
- const path = rel ? `${rel}/${entry.name}` : entry.name;
47
- if (entry.isDirectory()) {
48
- if (!entry.name.startsWith(".") && !SKIP_DIRS.has(entry.name)) walk(path);
49
- } else if (entry.isFile()) out.push(path);
50
- }
51
- };
52
- walk("");
53
- return out;
54
- }
55
- function matcher(globs) {
56
- const res = globs.map(globToRegExp);
57
- return (path) => res.some((re) => re.test(path));
58
- }
59
- var at = (path, text, index) => `${path}:${text.slice(0, index).split("\n").length}`;
60
- function literalAt(text, i) {
61
- const quote = text[i];
62
- if (quote !== '"' && quote !== "'" && quote !== "`") return null;
63
- const end = text.indexOf(quote, i + 1);
64
- if (end === -1) return null;
65
- const value = text.slice(i + 1, end);
66
- if (quote === "`" && value.includes("${")) return null;
67
- return value;
68
- }
69
- function blankComments(text, strings = false) {
70
- return blankFrom(text, 0, false, strings).out;
71
- }
72
- var BEFORE_REGEX = new Set("(,=:[!&|?{};+-*%<>~^");
73
- var REGEX_KEYWORDS = /(?:^|[^\w$.])(?:return|typeof|instanceof|in|new|delete|void|throw|case|do|else|yield|await)$/;
74
- function blankFrom(text, i, inTemplate, strings = false) {
75
- const keep = (chunk) => strings ? chunk.replace(/[^\n]/g, " ") : chunk;
76
- let out = "";
77
- let depth = 0;
78
- while (i < text.length) {
79
- const c = text[i];
80
- const next = text[i + 1];
81
- if (inTemplate && c === "}" && depth === 0) return { out, end: i };
82
- if (c === "{") depth++;
83
- else if (c === "}") depth--;
84
- if (c === "/" && next === "/") {
85
- const end = text.indexOf("\n", i);
86
- const stop = end === -1 ? text.length : end;
87
- out += " ".repeat(stop - i);
88
- i = stop;
89
- } else if (c === "/" && next === "*") {
90
- const end = text.indexOf("*/", i + 2);
91
- const stop = end === -1 ? text.length : end + 2;
92
- out += text.slice(i, stop).replace(/[^\n]/g, " ");
93
- i = stop;
94
- } else if (c === "/" && next !== ">" && startsRegex(out)) {
95
- let j = i + 1;
96
- let inClass = false;
97
- while (j < text.length && text[j] !== "\n") {
98
- const r = text[j];
99
- if (r === "\\") j += 2;
100
- else {
101
- if (r === "[") inClass = true;
102
- else if (r === "]") inClass = false;
103
- else if (r === "/" && !inClass) break;
104
- j++;
105
- }
106
- }
107
- if (text[j] !== "/") {
108
- out += c;
109
- i++;
110
- continue;
111
- }
112
- out += text.slice(i, j + 1);
113
- i = j + 1;
114
- } else if (c === "`") {
115
- out += c;
116
- let j = i + 1;
117
- while (j < text.length && text[j] !== "`") {
118
- if (text[j] === "\\") {
119
- out += keep(text.slice(j, j + 2));
120
- j += 2;
121
- } else if (text[j] === "$" && text[j + 1] === "{") {
122
- out += "${";
123
- const inner = blankFrom(text, j + 2, true, strings);
124
- out += inner.out;
125
- j = inner.end;
126
- if (j < text.length) out += text[j];
127
- j++;
128
- } else {
129
- out += keep(text[j]);
130
- j++;
131
- }
132
- }
133
- if (j < text.length) out += "`";
134
- i = j + 1;
135
- } else if (c === '"' || c === "'") {
136
- let j = i + 1;
137
- while (j < text.length && text[j] !== c && text[j] !== "\n") j += text[j] === "\\" ? 2 : 1;
138
- if (text[j] === c) {
139
- out += c + keep(text.slice(i + 1, j)) + c;
140
- i = j + 1;
141
- } else {
142
- out += c;
143
- i++;
144
- }
145
- } else {
146
- out += c;
147
- i++;
148
- }
149
- }
150
- return { out, end: i };
151
- }
152
- function startsRegex(before) {
153
- const trimmed = before.replace(/\s+$/, "");
154
- if (trimmed === "") return true;
155
- if (before.endsWith("<")) return false;
156
- return BEFORE_REGEX.has(trimmed[trimmed.length - 1]) || REGEX_KEYWORDS.test(trimmed);
157
- }
158
- function scanFlagReads(path, source, accessors = DEFAULT_ACCESSORS) {
159
- const text = blankComments(source);
160
- const code = blankComments(source, true);
161
- const keys = [];
162
- const dynamic = [];
163
- for (const accessor of accessors) {
164
- const jsx = /^<(\w[\w.]*)\s+(\w+)>$/.exec(accessor);
165
- if (jsx) {
166
- const re2 = new RegExp(`<${jsx[1].replace(/\./g, "\\.")}\\b[^>]*?\\b${jsx[2]}\\s*=\\s*`, "g");
167
- for (const m of code.matchAll(re2)) {
168
- let i = m.index + m[0].length;
169
- if (text[i] === "{") i = text.slice(i + 1).search(/\S/) + i + 1;
170
- const key = literalAt(text, i);
171
- if (key === null) dynamic.push(at(path, text, m.index));
172
- else keys.push({ key, where: at(path, text, m.index) });
173
- }
174
- continue;
175
- }
176
- const re = new RegExp(`(?<![\\w$.])(function\\s+)?${accessor.replace(/\$/g, "\\$")}\\s*(?:<[^>()]*>)?\\s*\\(\\s*`, "g");
177
- for (const m of code.matchAll(re)) {
178
- if (m[1]) continue;
179
- const i = m.index + m[0].length;
180
- if (text[i] === ")") continue;
181
- const key = literalAt(text, i);
182
- if (key !== null) keys.push({ key, where: at(path, text, m.index) });
183
- else if (!/^[\w$]+\??\s*:/.test(text.slice(i))) dynamic.push(at(path, text, m.index));
184
- }
185
- }
186
- return { keys, dynamic };
187
- }
188
- var ids = (features) => new Set(Object.entries(features).flatMap(([id, f]) => [id, ...f.aliases ?? []]));
189
- function removedIds(options) {
190
- const json = options.json === void 0 ? "features.json" : options.json;
191
- if (!json) return [];
192
- const doc = read(join(options.root, json));
193
- if (doc === null) return [];
194
- const sides = conflictSides(doc) ?? [{ side: "", text: doc }];
195
- const previous = [];
196
- for (const { side, text } of sides) {
197
- const recorded = recordedIds(text);
198
- if (!recorded) {
199
- throw new Error(
200
- `${json} can't be read as JSON${side ? ` on the ${side} side of its merge conflict` : ""}, so the check that feature ids are permanent can't run. Fix it, or restore it from git, and run again`
201
- );
202
- }
203
- previous.push(...recorded);
204
- }
205
- const now = ids(options.features);
206
- return [...new Set(previous)].filter((id) => !now.has(id));
207
- }
208
- function recordedIds(doc) {
209
- try {
210
- return JSON.parse(doc.replace(/^\uFEFF/, "")).features?.flatMap((f) => [...f.status === "idea" || f.status === "planned" ? [] : [f.id], ...f.aliases ?? []]) ?? [];
211
- } catch {
212
- return null;
213
- }
214
- }
215
- var markers = {
216
- ours: /^<{7}(?: .*)?\r?$/,
217
- base: /^\|{7}(?: .*)?\r?$/,
218
- theirs: /^={7}\r?$/,
219
- end: /^>{7}(?: .*)?\r?$/
220
- };
221
- function conflictSides(doc) {
222
- const ours = [];
223
- const theirs = [];
224
- let state = "both";
225
- let conflicted = false;
226
- for (const line of doc.split("\n")) {
227
- if (state === "both" && markers.ours.test(line)) {
228
- state = "ours";
229
- conflicted = true;
230
- } else if (state === "ours" && markers.base.test(line)) state = "base";
231
- else if ((state === "ours" || state === "base") && markers.theirs.test(line)) state = "theirs";
232
- else if (state === "theirs" && markers.end.test(line)) state = "both";
233
- else {
234
- if (state === "both" || state === "ours") ours.push(line);
235
- if (state === "both" || state === "theirs") theirs.push(line);
236
- }
237
- }
238
- if (!conflicted) return null;
239
- return [
240
- { side: "ours", text: ours.join("\n") },
241
- { side: "theirs", text: theirs.join("\n") }
242
- ];
243
- }
244
- var canonical = (features) => new Map(Object.entries(features).flatMap(([id, f]) => [id, ...f.aliases ?? []].map((name) => [name, id])));
245
- var and = (items) => items.length < 2 ? items.join("") : `${items.slice(0, -1).join(", ")} and ${items.at(-1)}`;
246
- var removedMessage = (id) => `the feature id "${id}" was removed. Ids are permanent once a feature is being built: keep the entry with status "retired", or list "${id}" in the new entry's aliases`;
247
- function outputs(options) {
248
- const { features, flags, source, command } = options;
249
- const agents = options.agents === void 0 ? "AGENTS.md" : options.agents;
250
- const json = options.json === void 0 ? "features.json" : options.json;
251
- const openfeature = options.openfeature === void 0 ? "flags.json" : options.openfeature;
252
- const skill = options.skill === void 0 ? ".claude/skills/features/SKILL.md" : options.skill;
253
- const whole = (content) => ({ next: () => content, same: (current, next) => current === next });
254
- const list = [];
255
- if (agents) {
256
- const block = toAgentsMarkdown(features, flags, { source, command, skill });
257
- list.push({
258
- path: agents,
259
- next: (current) => replaceAgentsBlock(current ?? "", block),
260
- same: (current) => current !== null && readAgentsBlock(current) === block
261
- });
262
- }
263
- if (json) list.push({ path: json, ...whole(toJson(features, flags, { source })) });
264
- if (openfeature && flags && Object.keys(flags).length) list.push({ path: openfeature, ...whole(toOpenFeatureManifest(flags, features)) });
265
- const writesFlags = Boolean(openfeature && flags && Object.keys(flags).length);
266
- const generated = [
267
- ...agents ? [`the ${agents} block`] : [],
268
- ...json ? [`\`${json}\``] : [],
269
- ...writesFlags ? [`\`${openfeature}\` (the OpenFeature flag manifest)`] : [],
270
- ...options.marketing ? [`the ${options.marketing} Features section`] : [],
271
- ...skill ? ["this skill"] : []
272
- ];
273
- if (skill) list.push({ path: skill, ...whole(toSkillMarkdown({ source, command, outputs: generated })) });
274
- if (options.marketing) {
275
- const block = toMarketingMarkdown(features, { heading: options.marketingHeading, source });
276
- list.push({
277
- path: options.marketing,
278
- next: (current) => replaceBlock(current ?? "", block, MARKETING_BLOCK_START, MARKETING_BLOCK_END),
279
- same: (current) => current !== null && readBlock(current, MARKETING_BLOCK_START, MARKETING_BLOCK_END) === block
280
- });
281
- }
282
- return list;
283
- }
284
- function claudeImport(options) {
285
- const agents = options.agents === void 0 ? "AGENTS.md" : options.agents;
286
- const claude = options.claude === void 0 ? "CLAUDE.md" : options.claude;
287
- return agents && claude ? { path: claude, line: `@${agents}` } : null;
288
- }
289
- var hasImport = (doc, line) => doc !== null && new RegExp(`^${line.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}\\s*$`, "m").test(doc);
290
- function buildFeatureOutputs(options) {
291
- const removed = removedIds(options);
292
- if (removed.length) throw new Error(removed.map(removedMessage).join("\n"));
293
- const changed = [];
294
- const write = (rel, next) => {
295
- const file = join(options.root, rel);
296
- mkdirSync(dirname(file), { recursive: true });
297
- writeFileSync(file, next);
298
- changed.push(rel);
299
- };
300
- for (const output of outputs(options)) {
301
- const current = read(join(options.root, output.path));
302
- let next;
303
- try {
304
- next = output.next(current);
305
- } catch (error) {
306
- if (error instanceof BrokenBlockError) throw new Error(`${output.path}: ${error.message}`);
307
- throw error;
308
- }
309
- if (!output.same(current, next)) write(output.path, next);
310
- }
311
- const claude = claudeImport(options);
312
- if (claude) {
313
- const current = read(join(options.root, claude.path));
314
- if (!hasImport(current, claude.line)) {
315
- const base = current === null || current === "" ? "" : current.endsWith("\n") ? `${current}
316
- ` : `${current}
317
-
318
- `;
319
- write(claude.path, `${base}${claude.line}
320
- `);
321
- }
322
- }
323
- return changed;
324
- }
325
- function checkFeatureOutputs(options) {
326
- const { root, features, flags } = options;
327
- const today = options.today ?? (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
328
- const errors = [];
329
- const warnings = [];
330
- const stale = [];
331
- const known = ids(features);
332
- for (const output of outputs(options)) {
333
- const current = read(join(root, output.path));
334
- let same;
335
- try {
336
- same = output.same(current, output.next(current));
337
- } catch (error) {
338
- if (!(error instanceof BrokenBlockError)) throw error;
339
- errors.push(`${output.path}: ${error.message}`);
340
- continue;
341
- }
342
- if (!same) {
343
- stale.push(output.path);
344
- errors.push(`${output.path} is stale. Run \`${options.command ?? "genesis features"} build\` and commit the result.`);
345
- }
346
- }
347
- const claude = claudeImport(options);
348
- if (claude && !hasImport(read(join(root, claude.path)), claude.line)) {
349
- errors.push(`${claude.path} must import the agent notes with a line \`${claude.line}\` (\`build\` adds it).`);
350
- }
351
- try {
352
- for (const id of removedIds(options)) errors.push(removedMessage(id));
353
- } catch (error) {
354
- errors.push(error.message);
355
- }
356
- const reviewCutoff = new Date(Date.parse(today) - (options.reviewDays ?? 90) * 864e5).toISOString().slice(0, 10);
357
- const claims = [];
358
- for (const [id, def] of Object.entries(features)) {
359
- for (const path of def.links?.code ?? []) {
360
- if (!existsSync(join(root, path))) errors.push(`${id}.links.code: ${path} doesn't exist`);
361
- }
362
- for (const path of def.links?.docs ?? []) {
363
- if (!/^https?:\/\//.test(path) && !existsSync(join(root, path))) warnings.push(`${id}.links.docs: ${path} doesn't exist`);
364
- }
365
- if (def.claimedBy) claims.push([id, def.claimedBy]);
366
- if (def.layer !== void 0) warnings.push(`${id}.layer: deprecated, write kind: "${def.layer === "primitive" ? "element" : def.layer}" (layer will be the owning package's, derived)`);
367
- if (def.status !== "idea" && def.status !== "planned" && def.status !== "retired") {
368
- if (!def.reviewedAt) warnings.push(`${id}: never reviewed (set reviewedAt)`);
369
- else if (def.reviewedAt < reviewCutoff) warnings.push(`${id}: last reviewed ${def.reviewedAt}, over ${options.reviewDays ?? 90} days ago`);
370
- }
371
- }
372
- const files = listFiles(root);
373
- const expired = expiredFlags(flags, today);
374
- if (flags) {
375
- for (const [name, flag] of Object.entries(flags)) {
376
- if (flag.kind === "permission") errors.push(`${name}: a permission flag. Paid or role access belongs in the feature's \`access\` (entitlements), not a flag`);
377
- if (flag.runbook && !/^https?:\/\//.test(flag.runbook) && !existsSync(join(root, flag.runbook))) {
378
- errors.push(`${name}.runbook: ${flag.runbook} doesn't exist`);
379
- }
380
- }
381
- for (const name of expired) errors.push(`${name} expired on ${flags[name].expires}: remove its code path, then the flag`);
382
- if (options.scan !== false) {
383
- const inScan = matcher(options.scan ?? DEFAULT_SCAN);
384
- const skipped = matcher(options.scanIgnore ?? (options.tests || DEFAULT_TESTS));
385
- const used = /* @__PURE__ */ new Map();
386
- for (const path of files.filter((p) => inScan(p) && !skipped(p) && !p.endsWith(".d.ts"))) {
387
- const { keys, dynamic } = scanFlagReads(path, readFileSync(join(root, path), "utf8"), options.flagAccessors ?? DEFAULT_ACCESSORS);
388
- for (const where of dynamic) errors.push(`${where}: a flag read with a computed key. Use a literal key, so the read can be checked`);
389
- for (const { key, where } of keys) {
390
- if (!Object.hasOwn(flags, key)) errors.push(`${where}: the flag "${key}" is read but not defined`);
391
- if (!used.has(key)) used.set(key, where);
392
- }
393
- }
394
- for (const name of Object.keys(flags)) {
395
- if (!used.has(name)) errors.push(`${name}: defined but never read. Remove it, or read it through the flag accessor`);
396
- }
397
- }
398
- }
399
- const tagged = /* @__PURE__ */ new Set();
400
- if (options.tests !== false) {
401
- const inTests = matcher(options.tests ?? DEFAULT_TESTS);
402
- for (const path of files.filter(inTests)) {
403
- const text = readFileSync(join(root, path), "utf8");
404
- for (const m of text.matchAll(/@feat:([a-z][a-z0-9]*(?:[-_.][a-z0-9]+)*)/g)) {
405
- if (!known.has(m[1])) errors.push(`${at(path, text, m.index)}: @feat:${m[1]} is not a feature`);
406
- else tagged.add(m[1]);
407
- }
408
- }
409
- for (const [id, def] of Object.entries(features)) {
410
- const names = [id, ...def.aliases ?? []];
411
- if (def.status === "live" && !names.some((n) => tagged.has(n))) warnings.push(`${id}: live, but no test is tagged @feat:${id}`);
412
- }
413
- }
414
- const idOf = canonical(features);
415
- const shippedIn = /* @__PURE__ */ new Map();
416
- const shipped = (name) => {
417
- const id = idOf.get(name);
418
- if (!shippedIn.has(id)) shippedIn.set(id, { changesets: [], prs: [] });
419
- return shippedIn.get(id);
420
- };
421
- const changesets = options.changesets === void 0 ? ".changeset" : options.changesets;
422
- if (changesets) {
423
- for (const path of listChangesets(root, changesets)) {
424
- const text = read(join(root, path)).replace(/^---\n[\s\S]*?\n---\n/, "");
425
- for (const m of text.matchAll(/^features:[ \t]*\[?([^\]\n]*)\]?[ \t]*$/gim)) {
426
- for (const id of m[1].split(/[\s,]+/).filter(Boolean)) {
427
- if (!known.has(id)) errors.push(`${path}: Features: ${id} is not a feature`);
428
- else if (!shipped(id).changesets.includes(path)) shipped(id).changesets.push(path);
429
- }
430
- }
431
- }
432
- }
433
- for (const [name, prs] of Object.entries(options.evidence?.prs ?? {})) {
434
- if (!known.has(name)) continue;
435
- const list = shipped(name).prs;
436
- for (const pr of prs) if (!list.some((p) => p.number === pr.number)) list.push(pr);
437
- }
438
- const plannedButShipped = [];
439
- for (const [id, def] of Object.entries(features)) {
440
- const found = shippedIn.get(id);
441
- if (def.status !== "planned" && def.status !== "idea" || !found || !found.changesets.length && !found.prs.length) continue;
442
- const prs = [...found.prs].sort((a, b) => a.number - b.number);
443
- plannedButShipped.push({ id, changesets: found.changesets, prs });
444
- warnings.push(`${id} is still ${def.status === "idea" ? "an idea" : "planned"}, but ${and([...found.changesets, ...prs.map((p) => `PR #${p.number}`)])} shipped work for it`);
445
- }
446
- for (const label of options.labels ?? []) {
447
- const id = /^feature:(.+)$/.exec(label.trim())?.[1];
448
- if (id && !known.has(id)) errors.push(`PR label ${label}: ${id} is not a feature`);
449
- }
450
- if (options.coverage !== false) {
451
- const inCoverage = matcher(options.coverage ?? DEFAULT_COVERAGE);
452
- const ignored = matcher(options.coverageIgnore ?? DEFAULT_COVERAGE_IGNORE);
453
- const covered = Object.values(features).flatMap((f) => f.links?.code ?? []).map((p) => p.replace(/\/+$/, ""));
454
- for (const path of files.filter((p) => inCoverage(p) && !ignored(p))) {
455
- if (!covered.some((c) => path === c || path.startsWith(`${c}/`))) warnings.push(`${path}: no feature's links.code covers it`);
456
- }
457
- }
458
- return { ok: errors.length === 0, errors, warnings, stale, expiredFlags: expired, claims, plannedButShipped };
459
- }
460
- function listChangesets(root, dir) {
461
- try {
462
- return readdirSync(join(root, dir)).filter((f) => f.endsWith(".md") && f.toLowerCase() !== "readme.md").map((f) => `${dir}/${f}`);
463
- } catch {
464
- return [];
465
- }
466
- }
467
- function summarizeCheck(result, features) {
468
- const total = Object.keys(features).length;
469
- const lines = [
470
- `Features: ${total} in the registry; ${result.errors.length} error${result.errors.length === 1 ? "" : "s"}, ${result.warnings.length} warning${result.warnings.length === 1 ? "" : "s"}.`
471
- ];
472
- if (result.stale.length) lines.push(`- Stale generated files: ${result.stale.join(", ")}. Run the features build.`);
473
- if (result.expiredFlags.length) lines.push(`- Expired flags: ${result.expiredFlags.join(", ")}. Remove the code path, then the flag.`);
474
- if (result.plannedButShipped.length) {
475
- const n = result.plannedButShipped.length;
476
- lines.push(`- ${n} planned feature${n === 1 ? " has" : "s have"} shipped work: ${result.plannedButShipped.map((s) => s.id).join(", ")}. Move ${n === 1 ? "its" : "their"} status on.`);
477
- }
478
- if (result.claims.length) lines.push(`- Being built: ${result.claims.map(([id, by]) => `${id} (${by})`).join(", ")}.`);
479
- const other = result.errors.length - result.stale.length - result.expiredFlags.length;
480
- if (other > 0) lines.push(`- ${other} other error${other === 1 ? "" : "s"}: run the features check for details.`);
481
- return lines.join("\n");
482
- }
483
-
484
- export { blankComments, buildFeatureOutputs, checkFeatureOutputs, globToRegExp, scanFlagReads, summarizeCheck };
485
- //# sourceMappingURL=node.js.map
486
- //# sourceMappingURL=node.js.map
1
+ /**
2
+ * `@marktiderman/genesis-features/node`: renamed to `@marktiderman/genesis-config/node`.
3
+ *
4
+ * @deprecated Import from `@marktiderman/genesis-config/node` instead: `npx genesis codemod
5
+ * genesis-features-renamed-genesis-config` moves an app's imports. This alias goes after 0.11.
6
+ */
7
+ export * from "@marktiderman/genesis-config/node";
package/dist/react.d.ts CHANGED
@@ -1,60 +1,7 @@
1
- import * as react from 'react';
2
- import { ResourcePageProps } from '@marktiderman/genesis-ui/data';
3
- import { F as Features, a as Flags, b as FeatureRecord } from './model-sTRmrxz3.js';
4
- import { a as FeatureStatus } from './types-Bd766VxF.js';
5
- import 'zod';
6
- import './platforms-NR0liM8L.js';
7
- import './packages-CWhdXtzS.js';
8
-
9
1
  /**
10
- * A feature's status as a badge. `StatusBadge` covers the active states and
11
- * deprecated; idea, planned and retired have no status there, so they use the
12
- * secondary and outline `Badge`.
2
+ * `@marktiderman/genesis-features/react`: renamed to `@marktiderman/genesis-config/react`.
13
3
  *
14
- * @stability Beta
4
+ * @deprecated Import from `@marktiderman/genesis-config/react` instead: `npx genesis codemod
5
+ * genesis-features-renamed-genesis-config` moves an app's imports. This alias goes after 0.11.
15
6
  */
16
- declare function FeatureStatusBadge({ status }: {
17
- status: FeatureStatus;
18
- }): react.JSX.Element;
19
- /** @stability Beta */
20
- interface FeatureListProps {
21
- features: Features;
22
- /** The repo's flags, so each feature shows its own. */
23
- flags?: Flags;
24
- /** Default "Features". */
25
- title?: string;
26
- subtitle?: string;
27
- /**
28
- * The view before the user picks one: `"table"` (default) or `"board"`. The
29
- * page's grid view is the board, grouped by status.
30
- */
31
- defaultView?: "table" | "board";
32
- /** Persist the user's view, page size and density under this key. */
33
- viewSettingsKey?: string;
34
- /** A link for a repo path in `links.code` / `links.docs`, e.g. to GitHub. Default: shown as text. */
35
- pathHref?: (path: string) => string | undefined;
36
- /**
37
- * `"admin"` (default): the full list, a status board and the roadmap.
38
- * `"marketing"`: public, shipped features with a tagline as benefit cards,
39
- * highlights first, grouped by category.
40
- */
41
- variant?: "admin" | "marketing";
42
- /** Show the roadmap (features with a `horizon`) under the list. Default true. */
43
- roadmap?: boolean;
44
- /** Anything else for the underlying `ResourcePage` (e.g. `urlState`). */
45
- resourcePageProps?: Partial<ResourcePageProps<FeatureRecord>>;
46
- className?: string;
47
- }
48
- /**
49
- * A repo's features as a page. The default (`variant="admin"`) is a
50
- * ResourcePage over static data: a table, and in its grid view a board grouped
51
- * by status, with status chips, filters by app, audience and visibility,
52
- * search, and a detail panel with the feature's links, acceptance and flags.
53
- * Planned work is kept off the list and shown on the roadmap below it.
54
- * `variant="marketing"` shows only public, shipped features with a tagline.
55
- *
56
- * @stability Beta
57
- */
58
- declare function FeatureList({ features, flags, title, subtitle, defaultView, viewSettingsKey, pathHref, variant, roadmap, resourcePageProps, className, }: FeatureListProps): react.JSX.Element;
59
-
60
- export { FeatureList, type FeatureListProps, FeatureStatusBadge };
7
+ export * from "@marktiderman/genesis-config/react";