@marktiderman/genesis-cli 1.25.0 → 1.26.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.
package/dist/expo.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ConfigPlugin } from '@expo/config-plugins';
2
2
  import { ExpoConfig } from '@expo/config-types';
3
- import { G as GenesisDataUse, a as GenesisPrivacy, b as GenesisLinks } from './config-CR4kqSCp.js';
4
- export { c as GenesisConfigError, P as PRIVACY_DATA_TYPES, d as PRIVACY_PURPOSES, p as privacyDataType, r as readGenesisConfig, v as validateLinks, e as validatePrivacy } from './config-CR4kqSCp.js';
3
+ import { G as GenesisDataUse, a as GenesisPrivacy, b as GenesisLinks } from './config-ARs2YQ60.js';
4
+ export { c as GenesisConfigError, P as PRIVACY_DATA_TYPES, d as PRIVACY_PURPOSES, p as privacyDataType, r as readGenesisConfig, v as validateLinks, e as validatePrivacy } from './config-ARs2YQ60.js';
5
5
  import '@marktiderman/genesis-features';
6
6
 
7
7
  declare const APP_VARIANTS: readonly ["development", "preview", "production"];
@@ -35,7 +35,7 @@
35
35
  "version": "0.1.2"
36
36
  },
37
37
  "@marktiderman/genesis-chat": {
38
- "version": "0.10.1",
38
+ "version": "0.10.2",
39
39
  "blocks": {
40
40
  "chat": {
41
41
  "feature": {
@@ -108,16 +108,16 @@
108
108
  "version": "0.4.0"
109
109
  },
110
110
  "@marktiderman/genesis-core": {
111
- "version": "2.14.0"
111
+ "version": "2.15.0"
112
112
  },
113
113
  "@marktiderman/genesis-design-system": {
114
- "version": "1.10.0"
114
+ "version": "1.11.0"
115
115
  },
116
116
  "@marktiderman/genesis-extension": {
117
117
  "version": "0.2.2"
118
118
  },
119
119
  "@marktiderman/genesis-features": {
120
- "version": "0.8.2"
120
+ "version": "0.9.0"
121
121
  },
122
122
  "@marktiderman/genesis-forms": {
123
123
  "version": "0.11.1"
@@ -141,16 +141,16 @@
141
141
  "version": "0.8.1"
142
142
  },
143
143
  "@marktiderman/genesis": {
144
- "version": "0.10.21"
144
+ "version": "0.10.22"
145
145
  },
146
146
  "@marktiderman/genesis-cli": {
147
- "version": "1.25.0"
147
+ "version": "1.26.0"
148
148
  },
149
149
  "@marktiderman/genesis-media": {
150
150
  "version": "0.2.0"
151
151
  },
152
152
  "@marktiderman/genesis-native": {
153
- "version": "0.10.0",
153
+ "version": "0.10.1",
154
154
  "blocks": {
155
155
  "push": {
156
156
  "feature": {
@@ -328,7 +328,7 @@
328
328
  }
329
329
  },
330
330
  "@marktiderman/genesis-notifications": {
331
- "version": "0.4.2",
331
+ "version": "0.4.3",
332
332
  "blocks": {
333
333
  "notifications": {
334
334
  "feature": {
@@ -393,7 +393,7 @@
393
393
  }
394
394
  },
395
395
  "@marktiderman/genesis-product": {
396
- "version": "0.2.0",
396
+ "version": "0.2.1",
397
397
  "blocks": {
398
398
  "product-board": {
399
399
  "feature": {
@@ -423,7 +423,7 @@
423
423
  }
424
424
  },
425
425
  "@marktiderman/genesis-sites": {
426
- "version": "0.6.1",
426
+ "version": "0.6.2",
427
427
  "blocks": {
428
428
  "sites": {
429
429
  "feature": {
@@ -467,13 +467,13 @@
467
467
  }
468
468
  },
469
469
  "@marktiderman/genesis-studio": {
470
- "version": "0.4.0"
470
+ "version": "0.4.1"
471
471
  },
472
472
  "@marktiderman/genesis-studio-server": {
473
- "version": "0.5.3"
473
+ "version": "0.5.4"
474
474
  },
475
475
  "@marktiderman/genesis-supabase": {
476
- "version": "0.14.1",
476
+ "version": "0.14.2",
477
477
  "blocks": {
478
478
  "account": {
479
479
  "feature": {
@@ -712,7 +712,7 @@
712
712
  }
713
713
  },
714
714
  "@marktiderman/genesis-support": {
715
- "version": "0.6.1",
715
+ "version": "0.6.2",
716
716
  "blocks": {
717
717
  "support-feedback": {
718
718
  "feature": {
@@ -1026,10 +1026,10 @@
1026
1026
  "version": "0.1.1"
1027
1027
  },
1028
1028
  "@marktiderman/genesis-ui": {
1029
- "version": "2.33.0"
1029
+ "version": "2.34.0"
1030
1030
  },
1031
1031
  "@marktiderman/genesis-ui-native": {
1032
- "version": "3.10.0"
1032
+ "version": "3.11.0"
1033
1033
  }
1034
1034
  }
1035
1035
  }
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { FileSystem, ScaffoldLogger, ScaffoldOptions, ScaffoldResult, planScaffold, runScaffold, validateConsumerName } from './scaffolder.js';
2
2
  import postgres from 'postgres';
3
3
  export { RunDoctorOptions, defineDoctorPlugin, formatReport, runDoctor } from './doctor.js';
4
- export { D as DoctorConfig, f as DoctorConfigError, g as DoctorContext, h as DoctorPlugin, i as DoctorResult, F as Finding, c as GenesisConfigError, j as GenesisConfigFile, b as GenesisLinks, k as GenesisSupabase, r as readGenesisConfig, v as validateLinks } from './config-CR4kqSCp.js';
4
+ export { D as DoctorConfig, f as DoctorConfigError, g as DoctorContext, h as DoctorPlugin, i as DoctorResult, F as Finding, c as GenesisConfigError, j as GenesisConfigFile, b as GenesisLinks, k as GenesisSupabase, r as readGenesisConfig, v as validateLinks } from './config-ARs2YQ60.js';
5
5
  import '@marktiderman/genesis-features';
6
6
 
7
7
  type StorageType = "string" | "number" | "boolean" | "datetime" | "json";
@@ -44,6 +44,9 @@ interface IntrospectedTable {
44
44
  interface FieldSettings {
45
45
  label?: string;
46
46
  description?: string;
47
+ /** The form-control hint (`textarea`, `date`…). */
48
+ control?: string;
49
+ /** @deprecated Renamed `control`; still read. */
47
50
  widget?: string;
48
51
  /** Server-owned: clients never write it. */
49
52
  readonly?: boolean;
package/dist/index.js CHANGED
@@ -258,7 +258,7 @@ var init_comments = __esm({
258
258
  "src/introspect/comments.ts"() {
259
259
  MARKER = "@genesis";
260
260
  TABLE_KEYS = { label: "string", labelField: "string", description: "string", noun: "string", nounPlural: "string", key: "key" };
261
- FIELD_KEYS = { label: "string", description: "string", widget: "string", readonly: "boolean", sensitive: "boolean" };
261
+ FIELD_KEYS = { label: "string", description: "string", control: "string", widget: "string", readonly: "boolean", sensitive: "boolean" };
262
262
  CommentSettingsError = class extends Error {
263
263
  };
264
264
  }
@@ -617,7 +617,8 @@ function field(column, indent) {
617
617
  const description = column.settings?.description ?? column.description;
618
618
  if (label) parts.push(`label: ${quote(label)}`);
619
619
  if (description) parts.push(`description: ${quote(description)}`);
620
- if (column.settings?.widget) parts.push(`widget: ${quote(column.settings.widget)}`);
620
+ if (column.settings?.control) parts.push(`control: ${quote(column.settings.control)}`);
621
+ else if (column.settings?.widget) parts.push(`widget: ${quote(column.settings.widget)}`);
621
622
  if (column.settings?.readonly) parts.push("readOnly: true");
622
623
  if (column.settings?.sensitive) parts.push("sensitive: true");
623
624
  return `${indent}{ ${parts.join(", ")} },`;
@@ -3017,7 +3018,9 @@ function loadGenesis(root, config) {
3017
3018
  const { dir: uiDir, exports: exportNames, values, components } = pkg;
3018
3019
  const tokens = /* @__PURE__ */ new Set();
3019
3020
  const themeFiles = resolveThemeFiles(root, config, uiDir);
3020
- for (const file of themeFiles) for (const t of declaredTokens(readFileSync(file, "utf8"))) tokens.add(t);
3021
+ const themeCss = themeFiles.map((file) => readFileSync(file, "utf8"));
3022
+ for (const css of themeCss) for (const t of declaredTokens(css)) tokens.add(t);
3023
+ const colorTokens = colorRoles(themeCss);
3021
3024
  const byLower = new Map(components.map((c) => [c.toLowerCase(), c]));
3022
3025
  const rawTags = /* @__PURE__ */ new Map();
3023
3026
  for (const tag of TAGS) if (byLower.has(tag)) rawTags.set(tag, byLower.get(tag));
@@ -3033,6 +3036,8 @@ function loadGenesis(root, config) {
3033
3036
  values,
3034
3037
  components,
3035
3038
  tokens,
3039
+ colorTokens,
3040
+ ...themeParts(root) ? { themeParts: themeParts(root) } : {},
3036
3041
  rawTags,
3037
3042
  palette: loadPalette(root),
3038
3043
  companions: loadCompanions(root, config, uiPackage)
@@ -3132,6 +3137,49 @@ function parseExportNames(dts) {
3132
3137
  }
3133
3138
  return names;
3134
3139
  }
3140
+ var COLOUR_VALUE = /^(?:-?[\d.]+(?:deg)?\s+[\d.]+%\s+[\d.]+%(?:\s*\/\s*[\d.]+%?)?|#[0-9a-f]{3,8}|(?:hsla?|rgba?|oklch|oklab|lab|lch|color)\(.*\))$/i;
3141
+ function colorRoles(sheets) {
3142
+ const declared = /* @__PURE__ */ new Map();
3143
+ for (const css of sheets) {
3144
+ for (const m of css.matchAll(/(--[A-Za-z0-9_-]+)\s*:\s*([^;{}]+);/g)) {
3145
+ const list = declared.get(m[1]) ?? [];
3146
+ list.push(m[2].trim());
3147
+ declared.set(m[1], list);
3148
+ }
3149
+ }
3150
+ const roles = /* @__PURE__ */ new Set();
3151
+ for (const [name, values] of declared) if (values.some((v) => COLOUR_VALUE.test(v))) roles.add(name);
3152
+ for (let pass = 0; pass < 4; pass++) {
3153
+ for (const [name, values] of declared) {
3154
+ if (roles.has(name)) continue;
3155
+ if (values.some((v) => [...v.matchAll(/var\(\s*(--[A-Za-z0-9_-]+)/g)].some((r) => roles.has(r[1])))) roles.add(name);
3156
+ }
3157
+ }
3158
+ return roles;
3159
+ }
3160
+ var partsCache = /* @__PURE__ */ new Map();
3161
+ function themeParts(root) {
3162
+ const ds = findPackageDir(root, DESIGN_SYSTEM_PACKAGE);
3163
+ if (!ds) return null;
3164
+ if (partsCache.has(ds)) return partsCache.get(ds);
3165
+ let found = null;
3166
+ const dist = path21.join(ds, "dist");
3167
+ try {
3168
+ for (const name of existsSync(dist) ? readdirSync(dist) : []) {
3169
+ if (!name.endsWith(".js")) continue;
3170
+ const code = readFileSync(path21.join(dist, name), "utf8");
3171
+ const at = code.indexOf("THEME_PARTS = Object.freeze([");
3172
+ if (at === -1) continue;
3173
+ const body = code.slice(at, code.indexOf("]);", at));
3174
+ found = [...body.matchAll(/\bp\(\s*"([a-z][a-z0-9-]*)"/g)].map((m) => m[1]);
3175
+ break;
3176
+ }
3177
+ } catch {
3178
+ found = null;
3179
+ }
3180
+ partsCache.set(ds, found);
3181
+ return found;
3182
+ }
3135
3183
  function declaredTokens(css) {
3136
3184
  return [...css.matchAll(/(--[A-Za-z0-9_-]+)\s*:/g)].map((m) => m[1]);
3137
3185
  }
@@ -3493,7 +3541,11 @@ var BUILTIN_RULES = [
3493
3541
  // an app whose database files live in another app (database.ts)
3494
3542
  "database-elsewhere",
3495
3543
  // the app's eslint config loads Genesis's lint rules (eslint-config.ts)
3496
- "genesis-eslint-config"
3544
+ "genesis-eslint-config",
3545
+ // custom views and app parts (custom-views.ts)
3546
+ "app-part-colors",
3547
+ "app-part-name",
3548
+ "custom-view-states"
3497
3549
  ];
3498
3550
  var DEFAULT_LOCAL_PRIMITIVE_DIRS = ["src/components/ui"];
3499
3551
  var STARTER_LEFTOVERS = ["components.json", "src/lib/utils.ts"];
@@ -3516,7 +3568,7 @@ function checkProjectLayout(ctx) {
3516
3568
  rule: "local-primitives",
3517
3569
  file: dir,
3518
3570
  subject: dir,
3519
- message: `is a local design-system primitive folder; use ${ctx.genesis.uiPackage} (or extend it upstream)`
3571
+ message: `is a local design-system primitive folder; use ${ctx.genesis.uiPackage} for those, and keep the app's own components in another folder`
3520
3572
  });
3521
3573
  }
3522
3574
  }
@@ -6702,6 +6754,73 @@ function checkRemovedScopeNames(ctx) {
6702
6754
  }
6703
6755
  }
6704
6756
  }
6757
+
6758
+ // src/doctor/custom-views.ts
6759
+ var JSX_EXTS4 = /* @__PURE__ */ new Set([".tsx", ".jsx"]);
6760
+ var CUSTOM_VIEW = /<CustomView\b|\buseCustomView\s*[<(]/;
6761
+ var APP_PART = /data-slot\s*=\s*\{?\s*["'`]app-/;
6762
+ var COLOUR_KEY = /\b(color|background(?:Color)?|border(?:Top|Right|Bottom|Left|Block|Inline)?(?:Color)?|outline(?:Color)?|textDecorationColor|caretColor|accentColor|fill|stroke|columnRuleColor|boxShadow)\s*:\s*(["'`])([^"'`]*)\2/g;
6763
+ var COLOUR_UTILITY = /(?<![\w-])(?:bg|text|border(?:-[xytrbls])?|ring|ring-offset|fill|stroke|from|to|via|outline|divide|decoration|shadow|accent|caret|placeholder)-\[([^\]]*var\(--[^\]]*)\]/g;
6764
+ var VARIABLE = /var\(\s*(--[A-Za-z0-9_-]+)/g;
6765
+ function checkAppParts(ctx) {
6766
+ const roles = ctx.genesis.colorTokens;
6767
+ const genesisParts = new Set(ctx.genesis.themeParts ?? []);
6768
+ const overlays = markedOverlays(ctx);
6769
+ for (const file of ctx.files) {
6770
+ if (!JSX_EXTS4.has(file.ext) && file.ext !== ".ts" && file.ext !== ".js") continue;
6771
+ if (insideOverlayOf(overlays, file, ctx.genesis.uiPackage)) continue;
6772
+ const code = file.code;
6773
+ if (JSX_EXTS4.has(file.ext)) {
6774
+ for (const m of code.matchAll(/\bdata-slot\s*=\s*(?:\{\s*)?["'`]([^"'`$]+)["'`]/g)) {
6775
+ const name = m[1];
6776
+ if (name.startsWith("app-")) continue;
6777
+ const clash = genesisParts.has(name);
6778
+ ctx.report({
6779
+ rule: "app-part-name",
6780
+ level: "warn",
6781
+ file: file.path,
6782
+ line: lineAt(code, m.index ?? 0),
6783
+ subject: name,
6784
+ message: clash ? `marks an app element data-slot="${name}", which is a Genesis part (THEME_PARTS): every app style's rules for it would hit this element too. Name the app's own part "app-${name}"` : `marks an app element data-slot="${name}"; name the app's own part "app-${name}", so it never collides with a Genesis part (docs/adr/0018-app-brands-styles-themes.md)`
6785
+ });
6786
+ }
6787
+ }
6788
+ if (roles && roles.size && (CUSTOM_VIEW.test(code) || APP_PART.test(code))) {
6789
+ const seen = /* @__PURE__ */ new Set();
6790
+ const check = (value, at) => {
6791
+ for (const v of value.matchAll(VARIABLE)) {
6792
+ const name = v[1];
6793
+ if (roles.has(name)) continue;
6794
+ const line = lineAt(code, at);
6795
+ if (seen.has(`${line}:${name}`)) continue;
6796
+ seen.add(`${line}:${name}`);
6797
+ ctx.report({
6798
+ rule: "app-part-colors",
6799
+ level: "warn",
6800
+ file: file.path,
6801
+ line,
6802
+ subject: name,
6803
+ message: `colours a custom view or app part with ${name}, which isn't a colour role; take colours from roles only (hsl(var(--primary)), bg-primary, text-muted-foreground) so the app brand and dark mode reach it`
6804
+ });
6805
+ }
6806
+ };
6807
+ for (const m of code.matchAll(COLOUR_KEY)) check(m[3], m.index ?? 0);
6808
+ for (const m of code.matchAll(COLOUR_UTILITY)) check(m[1], m.index ?? 0);
6809
+ }
6810
+ if (JSX_EXTS4.has(file.ext) && CUSTOM_VIEW.test(code)) {
6811
+ for (const m of code.matchAll(/\bstatus\s*[!=]={1,2}\s*["'`](loading|empty|error)["'`]/g)) {
6812
+ ctx.report({
6813
+ rule: "custom-view-states",
6814
+ level: "warn",
6815
+ file: file.path,
6816
+ line: lineAt(code, m.index ?? 0),
6817
+ subject: m[1],
6818
+ message: `draws a custom view's own ${m[1]} state; <CustomView> draws loading, empty and error in the app's style (pass its loading, empty or error prop to replace one) (docs/adr/0019-custom-views.md)`
6819
+ });
6820
+ }
6821
+ }
6822
+ }
6823
+ }
6705
6824
  var SCRIPT_EXTS6 = /* @__PURE__ */ new Set([".ts", ".tsx", ".js", ".jsx", ".mts", ".cts", ".mjs", ".cjs"]);
6706
6825
  var DECLARATION = /\/\*\*((?:(?!\*\/)[\s\S])*)\*\/\s*\n(?:export\s+)?(?:declare\s+)?(?:abstract\s+)?(?:function|const|let|class|interface|type|enum|namespace)\s+([A-Za-z_$][\w$]*)/g;
6707
6826
  var REEXPORT = /\/\*\*((?:(?!\*\/)[\s\S])*)\*\/\s*\nexport\s+(?:type\s+)?\{([^}]*)\}/g;
@@ -7171,7 +7290,7 @@ var read = (file) => existsSync(file) ? readFileSync(file, "utf8") : null;
7171
7290
  var CORE = [
7172
7291
  {
7173
7292
  need: "anything, before building it",
7174
- use: 'search what exists: `genesis features find <term>`, this catalog, and the "Available but unused" list in `genesis doctor --verbose`',
7293
+ use: 'search what exists: `genesis features find <term>`, this catalog, and the "Available but unused" list in `genesis doctor --verbose`. Check the install is current first (`genesis upgrade --dry-run`): an old one hides pieces that exist',
7175
7294
  docs: `${GENESIS_DOCS}/FRAMEWORK.md`,
7176
7295
  from: "genesis-cli"
7177
7296
  },
@@ -7196,9 +7315,15 @@ var CORE = [
7196
7315
  rule: "raw-color",
7197
7316
  from: "genesis-cli"
7198
7317
  },
7318
+ {
7319
+ need: "a Genesis piece that is close but doesn't quite fit",
7320
+ use: "extend it: a prop, a variant, a slot, or your own component that wraps it; never a parallel copy beside it",
7321
+ docs: `${GENESIS_DOCS}/FRAMEWORK.md`,
7322
+ from: "genesis-cli"
7323
+ },
7199
7324
  {
7200
7325
  need: "something no primitive covers",
7201
- use: "write the gap up for Genesis (an issue or a proposal) first, then invent in the app, on Genesis primitives",
7326
+ use: "invent it in the app, on Genesis tokens and primitives; Genesis asks for no write-up first. You may add it to `docs/genesis-upstream.md` (`genesis upstream`) if you think Genesis should have it",
7202
7327
  docs: `${GENESIS_DOCS}/FRAMEWORK.md`,
7203
7328
  from: "genesis-cli"
7204
7329
  }
@@ -7241,10 +7366,12 @@ var AGENTS_START = "<!-- genesis-primitives:start -->";
7241
7366
  var AGENTS_END = "<!-- genesis-primitives:end -->";
7242
7367
  var RULES = [
7243
7368
  `Use the Genesis primitive for the need first: reuse, then extend, then invent (G1 to G6 in ${GENESIS_DOCS}/FRAMEWORK.md).`,
7369
+ "Before deciding Genesis lacks a piece, look at all of it (the catalog below, `genesis features find <term>`) and check the installed packages are current (`genesis upgrade --dry-run`). An old install hides pieces that exist; upgrade before building around a gap that is already closed.",
7244
7370
  "Never copy an older screen as a template. Old screens predate the primitives; the doctor flags what they did.",
7245
7371
  "A list screen is a view (`defineView`) rendered by `ResourceView`; a record view is `RecordView`; on the phone, `NativeResourceView`.",
7246
7372
  "Screens never call the database client (`supabase.from`, `.rpc`) directly: reads go through a view or a named data function, writes through the resource's provider rules.",
7247
- "When no primitive fits, write the gap up for Genesis before inventing, then invent in the app on Genesis primitives.",
7373
+ "When a Genesis piece is close and does the same job, extend it: a prop, a variant, a slot, or your own component that wraps it. Never build a parallel copy beside it.",
7374
+ "When no Genesis piece does the job, invent it in the app: your own screens and components, on Genesis tokens and primitives. Genesis asks for no write-up or approval first (your app's own design review still applies); you may add it to `docs/genesis-upstream.md` if you think Genesis should have it.",
7248
7375
  "Run `genesis doctor` before you finish; it enforces these rules."
7249
7376
  ];
7250
7377
  function skillDescription(text) {
@@ -8408,6 +8535,7 @@ function builtinChecks(config, options = {}) {
8408
8535
  { name: "resource-view-trees", check: checkTreeViews },
8409
8536
  { name: "studio-server-imports", check: checkStudioServerImports },
8410
8537
  { name: "removed-scope-names", check: checkRemovedScopeNames },
8538
+ { name: "app-parts", check: checkAppParts },
8411
8539
  { name: "stability-imports", check: checkStabilityImports },
8412
8540
  { name: "agent-guide", check: (ctx) => {
8413
8541
  checkAgentGuide(ctx);