@marktiderman/genesis-cli 1.26.1 → 1.28.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/README.md +20 -1
- package/dist/cli.js +1129 -450
- package/dist/cli.js.map +1 -1
- package/dist/{config-ARs2YQ60.d.ts → config-BmMsEWU-.d.ts} +7 -0
- package/dist/doctor.d.ts +3 -3
- package/dist/doctor.js +492 -33
- package/dist/doctor.js.map +1 -1
- package/dist/expo.d.ts +2 -2
- package/dist/expo.js +11 -0
- package/dist/expo.js.map +1 -1
- package/dist/genesis-catalog.json +36 -12
- package/dist/index.d.ts +11 -5
- package/dist/index.js +493 -34
- package/dist/index.js.map +1 -1
- package/dist/starter/package.json +5 -5
- package/dist/starter/supabase/migrations/20261025000095_genesis_support_ticket_fixes.sql +115 -0
- package/dist/starter/supabase/tests/database/genesis_support_ticket_fixes.test.sql +121 -0
- package/dist/vite.js +490 -31
- package/dist/vite.js.map +1 -1
- package/package.json +4 -4
package/dist/vite.js
CHANGED
|
@@ -24,6 +24,15 @@ var __export = (target, all) => {
|
|
|
24
24
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
+
// src/regexp.ts
|
|
28
|
+
function escapeRegExp(s) {
|
|
29
|
+
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
30
|
+
}
|
|
31
|
+
var init_regexp = __esm({
|
|
32
|
+
"src/regexp.ts"() {
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
|
|
27
36
|
// src/introspect/catalog-text.ts
|
|
28
37
|
function tokenize(tree) {
|
|
29
38
|
const tokens = [];
|
|
@@ -153,9 +162,6 @@ function splitTopLevel(expr, separator) {
|
|
|
153
162
|
parts.push(expr.slice(from));
|
|
154
163
|
return parts;
|
|
155
164
|
}
|
|
156
|
-
function escapeRegExp(s) {
|
|
157
|
-
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
158
|
-
}
|
|
159
165
|
function checkEnumValues(definition, column) {
|
|
160
166
|
const outer = /^CHECK \((.*)\)(?: NOT VALID)?$/s.exec(definition.trim());
|
|
161
167
|
if (!outer) return void 0;
|
|
@@ -190,6 +196,7 @@ function checkEnumValues(definition, column) {
|
|
|
190
196
|
var CAST, LITERAL;
|
|
191
197
|
var init_catalog_text = __esm({
|
|
192
198
|
"src/introspect/catalog-text.ts"() {
|
|
199
|
+
init_regexp();
|
|
193
200
|
CAST = String.raw`::[a-z][a-z ]*(?:\(\d+(?:,\d+)?\))?`;
|
|
194
201
|
LITERAL = String.raw`'((?:[^']|'')*)'${CAST}`;
|
|
195
202
|
}
|
|
@@ -284,8 +291,11 @@ var init_model = __esm({
|
|
|
284
291
|
});
|
|
285
292
|
|
|
286
293
|
// src/introspect/postgres.ts
|
|
287
|
-
function where(
|
|
288
|
-
return "schemas" in scope ?
|
|
294
|
+
function where(scope) {
|
|
295
|
+
return "schemas" in scope ? { condition: "n.nspname = any(array(select jsonb_array_elements_text($1::text::jsonb)))", param: JSON.stringify(scope.schemas) } : { condition: "c.oid = any(array(select jsonb_array_elements_text($1::text::jsonb)::oid))", param: JSON.stringify(scope.oids) };
|
|
296
|
+
}
|
|
297
|
+
async function read(sql, text, param) {
|
|
298
|
+
return [...await sql.unsafe(text, [param])];
|
|
289
299
|
}
|
|
290
300
|
function linkOf(columns, refColumns, refUnique = []) {
|
|
291
301
|
if (columns.length === 1) return 0;
|
|
@@ -294,7 +304,8 @@ function linkOf(columns, refColumns, refUnique = []) {
|
|
|
294
304
|
return own.length === 1 && refUnique[own[0]] === true ? own[0] : -1;
|
|
295
305
|
}
|
|
296
306
|
async function readRelations(sql, scope, into) {
|
|
297
|
-
const
|
|
307
|
+
const { condition, param } = where(scope);
|
|
308
|
+
const columns = await read(sql, `
|
|
298
309
|
select c.oid::text as oid, c.relkind::text as relkind, n.nspname as schema, c.relname as table,
|
|
299
310
|
obj_description(c.oid, 'pg_class') as table_comment,
|
|
300
311
|
a.attnum::int as attnum,
|
|
@@ -313,17 +324,17 @@ async function readRelations(sql, scope, into) {
|
|
|
313
324
|
join pg_attribute a on a.attrelid = c.oid and a.attnum > 0 and not a.attisdropped
|
|
314
325
|
join pg_type t on t.oid = a.atttypid
|
|
315
326
|
where c.relkind in ('r', 'p', 'v', 'm', 'f')
|
|
316
|
-
and ${
|
|
317
|
-
order by n.nspname, c.relname, a.attnum
|
|
318
|
-
const keys = await sql`
|
|
327
|
+
and ${condition}
|
|
328
|
+
order by n.nspname, c.relname, a.attnum`, param);
|
|
329
|
+
const keys = await read(sql, `
|
|
319
330
|
select c.oid::text as oid, array_agg(k.attnum::int order by k.ord) as columns
|
|
320
331
|
from pg_constraint con
|
|
321
332
|
join pg_class c on c.oid = con.conrelid
|
|
322
333
|
join pg_namespace n on n.oid = c.relnamespace
|
|
323
334
|
cross join lateral unnest(con.conkey) with ordinality as k(attnum, ord)
|
|
324
|
-
where con.contype = 'p' and ${
|
|
325
|
-
group by c.oid
|
|
326
|
-
const links = await sql`
|
|
335
|
+
where con.contype = 'p' and ${condition}
|
|
336
|
+
group by c.oid`, param);
|
|
337
|
+
const links = await read(sql, `
|
|
327
338
|
select c.oid::text as oid, con.conkey::int[] as attnums,
|
|
328
339
|
array(select a.attname::text from unnest(con.conkey) with ordinality k(attnum, ord)
|
|
329
340
|
join pg_attribute a on a.attrelid = c.oid and a.attnum = k.attnum order by k.ord) as columns,
|
|
@@ -340,9 +351,9 @@ async function readRelations(sql, scope, into) {
|
|
|
340
351
|
join pg_class rc on rc.oid = con.confrelid
|
|
341
352
|
join pg_namespace rn on rn.oid = rc.relnamespace
|
|
342
353
|
where con.contype = 'f'
|
|
343
|
-
and ${
|
|
344
|
-
order by con.conname
|
|
345
|
-
const checks = await sql`
|
|
354
|
+
and ${condition}
|
|
355
|
+
order by con.conname`, param);
|
|
356
|
+
const checks = await read(sql, `
|
|
346
357
|
select c.oid::text as oid, con.conkey[1]::int as attnum, a.attname as column,
|
|
347
358
|
pg_get_constraintdef(con.oid) as definition
|
|
348
359
|
from pg_constraint con
|
|
@@ -350,9 +361,9 @@ async function readRelations(sql, scope, into) {
|
|
|
350
361
|
join pg_namespace n on n.oid = c.relnamespace
|
|
351
362
|
join pg_attribute a on a.attrelid = c.oid and a.attnum = con.conkey[1]
|
|
352
363
|
where con.contype = 'c' and array_length(con.conkey, 1) = 1
|
|
353
|
-
and ${
|
|
354
|
-
order by con.conname
|
|
355
|
-
const views = await sql`
|
|
364
|
+
and ${condition}
|
|
365
|
+
order by con.conname`, param);
|
|
366
|
+
const views = await read(sql, `
|
|
356
367
|
select c.oid::text as oid, r.ev_action::text as ev_action
|
|
357
368
|
from pg_class c
|
|
358
369
|
join pg_namespace n on n.oid = c.relnamespace
|
|
@@ -360,7 +371,7 @@ async function readRelations(sql, scope, into) {
|
|
|
360
371
|
where c.relkind = 'v'
|
|
361
372
|
and (pg_relation_is_updatable(c.oid, false) & 20) = 20
|
|
362
373
|
and not exists (select 1 from pg_rewrite o where o.ev_class = c.oid and o.rulename <> '_RETURN')
|
|
363
|
-
and ${
|
|
374
|
+
and ${condition}`, param);
|
|
364
375
|
const added = [];
|
|
365
376
|
for (const row of columns) {
|
|
366
377
|
let relation = into.get(row.oid);
|
|
@@ -934,6 +945,7 @@ function readGenesisConfig(root) {
|
|
|
934
945
|
}
|
|
935
946
|
if (raw.appFolder !== void 0) out.appFolder = validateAppFolder(raw.appFolder, file);
|
|
936
947
|
if (raw.environments !== void 0) out.environments = validateEnvironments(raw.environments, file);
|
|
948
|
+
if (raw.client !== void 0) out.client = validateClient(raw.client, file);
|
|
937
949
|
return out;
|
|
938
950
|
}
|
|
939
951
|
var PLAIN_FOLDER = /^[A-Za-z0-9_][A-Za-z0-9_.-]{0,59}(?:\/[A-Za-z0-9_][A-Za-z0-9_.-]{0,59}){0,7}$/;
|
|
@@ -945,6 +957,16 @@ function validateAppFolder(raw, source = "config") {
|
|
|
945
957
|
if (!isPlainFolder(norm)) throw new GenesisConfigError(`${source}: "appFolder" must be the app's folder from the repository root, such as "mobile" or "apps/phone" (got ${JSON.stringify(raw)})`);
|
|
946
958
|
return norm;
|
|
947
959
|
}
|
|
960
|
+
function validateClient(raw, source = "config") {
|
|
961
|
+
const fail = (msg) => {
|
|
962
|
+
throw new GenesisConfigError(`${source}: ${msg}`);
|
|
963
|
+
};
|
|
964
|
+
if (!isObject(raw)) return fail(`"client" must be { "dir": "<the client layer's folder, e.g. src/client>" }`);
|
|
965
|
+
for (const key2 of Object.keys(raw)) if (key2 !== "dir" && key2 !== "$comment") fail(`client: unknown setting "${key2}" (known: dir)`);
|
|
966
|
+
const dir = typeof raw.dir === "string" ? raw.dir.replace(/^\.\//, "").replace(/\/+$/, "") : "";
|
|
967
|
+
if (!isPlainFolder(dir)) return fail(`client.dir must be a folder inside the app, such as "src/client" (got ${JSON.stringify(raw.dir)})`);
|
|
968
|
+
return { dir };
|
|
969
|
+
}
|
|
948
970
|
function validateSupabase(raw, source = "config") {
|
|
949
971
|
const fail = (msg) => {
|
|
950
972
|
throw new GenesisConfigError(`${source}: ${msg}`);
|
|
@@ -1208,7 +1230,7 @@ function globToRegExp(glob) {
|
|
|
1208
1230
|
}
|
|
1209
1231
|
function globMatcher(globs) {
|
|
1210
1232
|
const res = (globs ?? []).filter((g) => g.trim()).map(globToRegExp);
|
|
1211
|
-
return (
|
|
1233
|
+
return (path51) => res.some((re) => re.test(path51));
|
|
1212
1234
|
}
|
|
1213
1235
|
var GENESIS_PACKAGE = /^@marktiderman\/genesis(-[a-z0-9-]+)?$/;
|
|
1214
1236
|
var BLOCK_ID = /^[a-z][a-z0-9]*(?:[-_.][a-z0-9]+)*$/;
|
|
@@ -2767,6 +2789,319 @@ function resolvePlugin(id, configDir) {
|
|
|
2767
2789
|
function resolveFrom(id, from) {
|
|
2768
2790
|
return createRequire(path21.join(from, "noop.js")).resolve(id);
|
|
2769
2791
|
}
|
|
2792
|
+
|
|
2793
|
+
// src/doctor/js-scan.ts
|
|
2794
|
+
var IDENT_START = /[A-Za-z_$]/;
|
|
2795
|
+
var IDENT = /[\w$]/;
|
|
2796
|
+
var PUNCT3 = ["...", "===", "!==", "**=", "<<=", ">>=", "??=", "&&=", "||="];
|
|
2797
|
+
var PUNCT2 = ["=>", "==", "!=", "<=", ">=", "&&", "||", "??", "?.", "++", "--", "+=", "-=", "*=", "/=", "%=", "&=", "|=", "^=", "**", "<<", ">>"];
|
|
2798
|
+
var EXPRESSION_KEYWORDS = /* @__PURE__ */ new Set(["return", "typeof", "case", "do", "else", "in", "new", "delete", "void", "throw", "yield", "await", "instanceof"]);
|
|
2799
|
+
var TYPE_PARAMETERS = /^<\s*[A-Za-z_$][\w$]*\s*(?:,|extends\b)/;
|
|
2800
|
+
function scanCode(code, options = {}) {
|
|
2801
|
+
const jsx = options.jsx ?? true;
|
|
2802
|
+
const tokens = [];
|
|
2803
|
+
const push = (kind, value) => tokens.push({ kind, value, index: tokens.length });
|
|
2804
|
+
const expressionNext = (start) => {
|
|
2805
|
+
if (tokens.length <= start) return true;
|
|
2806
|
+
const t = tokens[tokens.length - 1];
|
|
2807
|
+
if (!t) return true;
|
|
2808
|
+
if (t.kind === "ident") return EXPRESSION_KEYWORDS.has(t.value);
|
|
2809
|
+
if (t.kind === "jsxTag" || t.kind === "literal") return false;
|
|
2810
|
+
return !(t.value === ")" || t.value === "]" || t.value === "}" || t.value === "<>");
|
|
2811
|
+
};
|
|
2812
|
+
const skipString2 = (i2, quote2) => {
|
|
2813
|
+
let j = i2 + 1;
|
|
2814
|
+
while (j < code.length && code[j] !== quote2) {
|
|
2815
|
+
if (code[j] === "\\") j++;
|
|
2816
|
+
else if (code[j] === "\n") return j;
|
|
2817
|
+
j++;
|
|
2818
|
+
}
|
|
2819
|
+
return j + 1;
|
|
2820
|
+
};
|
|
2821
|
+
const skipAttribute = (i2, quote2) => {
|
|
2822
|
+
const end = code.indexOf(quote2, i2 + 1);
|
|
2823
|
+
return end < 0 ? code.length : end + 1;
|
|
2824
|
+
};
|
|
2825
|
+
const skipRegex = (i2) => {
|
|
2826
|
+
let j = i2 + 1;
|
|
2827
|
+
let inClass = false;
|
|
2828
|
+
while (j < code.length && code[j] !== "\n") {
|
|
2829
|
+
const c = code[j];
|
|
2830
|
+
if (c === "\\") j++;
|
|
2831
|
+
else if (c === "[") inClass = true;
|
|
2832
|
+
else if (c === "]") inClass = false;
|
|
2833
|
+
else if (c === "/" && !inClass) {
|
|
2834
|
+
j++;
|
|
2835
|
+
while (j < code.length && IDENT.test(code[j])) j++;
|
|
2836
|
+
return j;
|
|
2837
|
+
}
|
|
2838
|
+
j++;
|
|
2839
|
+
}
|
|
2840
|
+
return j;
|
|
2841
|
+
};
|
|
2842
|
+
const skipTrivia = (i2) => {
|
|
2843
|
+
let j = i2;
|
|
2844
|
+
for (; ; ) {
|
|
2845
|
+
while (j < code.length && /\s/.test(code[j])) j++;
|
|
2846
|
+
if (code.startsWith("//", j)) {
|
|
2847
|
+
const end = code.indexOf("\n", j);
|
|
2848
|
+
j = end < 0 ? code.length : end;
|
|
2849
|
+
} else if (code.startsWith("/*", j)) {
|
|
2850
|
+
const end = code.indexOf("*/", j + 2);
|
|
2851
|
+
j = end < 0 ? code.length : end + 2;
|
|
2852
|
+
} else return j;
|
|
2853
|
+
}
|
|
2854
|
+
};
|
|
2855
|
+
const stack = [{ k: "code", depth: 0, stop: false, start: 0 }];
|
|
2856
|
+
const openCode = () => stack.push({ k: "code", depth: 0, stop: true, start: tokens.length });
|
|
2857
|
+
const openElement = (i2) => {
|
|
2858
|
+
if (code[i2 + 1] === ">") {
|
|
2859
|
+
stack.push({ k: "children" });
|
|
2860
|
+
return i2 + 2;
|
|
2861
|
+
}
|
|
2862
|
+
let j = i2 + 1;
|
|
2863
|
+
while (j < code.length && /[\w$.:-]/.test(code[j])) j++;
|
|
2864
|
+
const name = code.slice(i2 + 1, j);
|
|
2865
|
+
if (name) push("jsxTag", name.split(/[.:]/)[0]);
|
|
2866
|
+
stack.push({ k: "tag" });
|
|
2867
|
+
return j;
|
|
2868
|
+
};
|
|
2869
|
+
const closeElement = () => {
|
|
2870
|
+
stack.pop();
|
|
2871
|
+
push("punct", "<>");
|
|
2872
|
+
};
|
|
2873
|
+
let i = 0;
|
|
2874
|
+
while (i < code.length) {
|
|
2875
|
+
const top = stack[stack.length - 1];
|
|
2876
|
+
if (top.k === "code") {
|
|
2877
|
+
i = skipTrivia(i);
|
|
2878
|
+
if (i >= code.length) break;
|
|
2879
|
+
const c = code[i];
|
|
2880
|
+
if (c === '"' || c === "'") {
|
|
2881
|
+
i = skipString2(i, c);
|
|
2882
|
+
push("literal", "''");
|
|
2883
|
+
} else if (c === "`") {
|
|
2884
|
+
stack.push({ k: "template" });
|
|
2885
|
+
i++;
|
|
2886
|
+
} else if (IDENT_START.test(c)) {
|
|
2887
|
+
let j = i + 1;
|
|
2888
|
+
while (j < code.length && IDENT.test(code[j])) j++;
|
|
2889
|
+
push("ident", code.slice(i, j));
|
|
2890
|
+
i = j;
|
|
2891
|
+
} else if (/\d/.test(c) || c === "." && /\d/.test(code[i + 1] ?? "")) {
|
|
2892
|
+
let j = i + 1;
|
|
2893
|
+
while (j < code.length && /[\w.]/.test(code[j])) j++;
|
|
2894
|
+
push("literal", "0");
|
|
2895
|
+
i = j;
|
|
2896
|
+
} else if (c === "/" && expressionNext(top.start)) {
|
|
2897
|
+
i = skipRegex(i);
|
|
2898
|
+
push("literal", "//");
|
|
2899
|
+
} else if (c === "<" && jsx && expressionNext(top.start) && /[A-Za-z_$>]/.test(code[i + 1] ?? "") && !TYPE_PARAMETERS.test(code.slice(i, i + 200))) {
|
|
2900
|
+
i = openElement(i);
|
|
2901
|
+
} else if (c === "{") {
|
|
2902
|
+
top.depth++;
|
|
2903
|
+
push("punct", "{");
|
|
2904
|
+
i++;
|
|
2905
|
+
} else if (c === "}") {
|
|
2906
|
+
i++;
|
|
2907
|
+
if (top.depth === 0 && top.stop) stack.pop();
|
|
2908
|
+
else {
|
|
2909
|
+
top.depth = Math.max(0, top.depth - 1);
|
|
2910
|
+
push("punct", "}");
|
|
2911
|
+
}
|
|
2912
|
+
} else {
|
|
2913
|
+
const three = code.slice(i, i + 3);
|
|
2914
|
+
const two = code.slice(i, i + 2);
|
|
2915
|
+
const p = PUNCT3.includes(three) ? three : PUNCT2.includes(two) ? two : c;
|
|
2916
|
+
push("punct", p);
|
|
2917
|
+
i += p.length;
|
|
2918
|
+
}
|
|
2919
|
+
} else if (top.k === "template") {
|
|
2920
|
+
const c = code[i];
|
|
2921
|
+
if (c === "\\") i += 2;
|
|
2922
|
+
else if (c === "`") {
|
|
2923
|
+
stack.pop();
|
|
2924
|
+
push("literal", "``");
|
|
2925
|
+
i++;
|
|
2926
|
+
} else if (c === "$" && code[i + 1] === "{") {
|
|
2927
|
+
openCode();
|
|
2928
|
+
i += 2;
|
|
2929
|
+
} else i++;
|
|
2930
|
+
} else if (top.k === "tag") {
|
|
2931
|
+
i = skipTrivia(i);
|
|
2932
|
+
const c = code[i];
|
|
2933
|
+
if (c === void 0) break;
|
|
2934
|
+
if (c === "/" && code[i + 1] === ">") {
|
|
2935
|
+
closeElement();
|
|
2936
|
+
i += 2;
|
|
2937
|
+
} else if (c === ">") {
|
|
2938
|
+
stack[stack.length - 1] = { k: "children" };
|
|
2939
|
+
i++;
|
|
2940
|
+
} else if (c === "{") {
|
|
2941
|
+
openCode();
|
|
2942
|
+
i++;
|
|
2943
|
+
} else if (c === '"' || c === "'") i = skipAttribute(i, c);
|
|
2944
|
+
else if (c === "<") i = openElement(i);
|
|
2945
|
+
else i++;
|
|
2946
|
+
} else {
|
|
2947
|
+
const c = code[i];
|
|
2948
|
+
if (c === "<" && code[i + 1] === "/") {
|
|
2949
|
+
const end = code.indexOf(">", i);
|
|
2950
|
+
i = end < 0 ? code.length : end + 1;
|
|
2951
|
+
closeElement();
|
|
2952
|
+
} else if (c === "<" && /[A-Za-z_$>]/.test(code[i + 1] ?? "")) i = openElement(i);
|
|
2953
|
+
else if (c === "{") {
|
|
2954
|
+
openCode();
|
|
2955
|
+
i++;
|
|
2956
|
+
} else i++;
|
|
2957
|
+
}
|
|
2958
|
+
}
|
|
2959
|
+
return tokens;
|
|
2960
|
+
}
|
|
2961
|
+
function usesAsCode(code, name, options = {}) {
|
|
2962
|
+
const tokens = scanCode(code, options);
|
|
2963
|
+
return tokens.some((t, i) => {
|
|
2964
|
+
if (t.value !== name) return false;
|
|
2965
|
+
if (t.kind === "jsxTag") return true;
|
|
2966
|
+
if (t.kind !== "ident") return false;
|
|
2967
|
+
const before = tokens[i - 1];
|
|
2968
|
+
const after = tokens[i + 1];
|
|
2969
|
+
if (before?.value === "." || before?.value === "?." || before?.value === "as" || before?.value === "import") return false;
|
|
2970
|
+
if (after?.value === ":" && (before?.value === "{" || before?.value === ",")) return false;
|
|
2971
|
+
return true;
|
|
2972
|
+
});
|
|
2973
|
+
}
|
|
2974
|
+
var NOT_METHODS = /* @__PURE__ */ new Set(["if", "for", "while", "switch", "with", "function", "return", "typeof", "await", "new"]);
|
|
2975
|
+
var BEFORE_METHOD = /* @__PURE__ */ new Set(["{", "}", ";", ",", "*", "async", "get", "set", "static", "public", "private", "protected", "readonly", "override", "abstract", "declare", "accessor"]);
|
|
2976
|
+
var TYPE_PARAMETERS_REACH = 200;
|
|
2977
|
+
var OPENS = /* @__PURE__ */ new Set(["(", "[", "{"]);
|
|
2978
|
+
var CLOSES = /* @__PURE__ */ new Set([")", "]", "}"]);
|
|
2979
|
+
function boundNames(list) {
|
|
2980
|
+
const out = [];
|
|
2981
|
+
const params = [[]];
|
|
2982
|
+
let depth = 0;
|
|
2983
|
+
let angles = 0;
|
|
2984
|
+
let inType = false;
|
|
2985
|
+
for (const t of list) {
|
|
2986
|
+
if (OPENS.has(t.value)) depth++;
|
|
2987
|
+
else if (CLOSES.has(t.value)) depth--;
|
|
2988
|
+
else if (depth === 0 && t.value === ":") inType = true;
|
|
2989
|
+
else if (depth === 0 && t.value === "=") inType = false;
|
|
2990
|
+
else if (inType && t.value === "<") angles++;
|
|
2991
|
+
else if (inType && (t.value === ">" || t.value === ">>")) angles = Math.max(0, angles - t.value.length);
|
|
2992
|
+
if (depth === 0 && angles === 0 && t.value === ",") {
|
|
2993
|
+
params.push([]);
|
|
2994
|
+
inType = false;
|
|
2995
|
+
} else params[params.length - 1].push(t);
|
|
2996
|
+
}
|
|
2997
|
+
for (const param of params) {
|
|
2998
|
+
let d = 0;
|
|
2999
|
+
let end = param.length;
|
|
3000
|
+
for (let k = 0; k < param.length; k++) {
|
|
3001
|
+
const v = param[k].value;
|
|
3002
|
+
if (OPENS.has(v)) d++;
|
|
3003
|
+
else if (CLOSES.has(v)) d--;
|
|
3004
|
+
else if (d === 0 && (v === "=" || v === ":" || v === "?")) {
|
|
3005
|
+
end = k;
|
|
3006
|
+
break;
|
|
3007
|
+
}
|
|
3008
|
+
}
|
|
3009
|
+
const pattern = param.slice(0, end);
|
|
3010
|
+
let skipping = -1;
|
|
3011
|
+
d = 0;
|
|
3012
|
+
for (let k = 0; k < pattern.length; k++) {
|
|
3013
|
+
const t = pattern[k];
|
|
3014
|
+
if (t.value === "[" && skipping < 0) {
|
|
3015
|
+
let depth2 = 0;
|
|
3016
|
+
let close = k;
|
|
3017
|
+
for (; close < pattern.length; close++) {
|
|
3018
|
+
const v = pattern[close].value;
|
|
3019
|
+
if (OPENS.has(v)) depth2++;
|
|
3020
|
+
else if (CLOSES.has(v) && --depth2 === 0) break;
|
|
3021
|
+
}
|
|
3022
|
+
if (pattern[close + 1]?.value === ":") {
|
|
3023
|
+
k = close;
|
|
3024
|
+
continue;
|
|
3025
|
+
}
|
|
3026
|
+
}
|
|
3027
|
+
if (OPENS.has(t.value)) d++;
|
|
3028
|
+
else if (CLOSES.has(t.value)) {
|
|
3029
|
+
d--;
|
|
3030
|
+
if (skipping > d) skipping = -1;
|
|
3031
|
+
}
|
|
3032
|
+
if (skipping >= 0) {
|
|
3033
|
+
if (t.value === "," && d === skipping) skipping = -1;
|
|
3034
|
+
continue;
|
|
3035
|
+
}
|
|
3036
|
+
if (t.value === "=") {
|
|
3037
|
+
skipping = d;
|
|
3038
|
+
continue;
|
|
3039
|
+
}
|
|
3040
|
+
if (t.kind === "ident" && pattern[k + 1]?.value !== ":") out.push(t.value);
|
|
3041
|
+
}
|
|
3042
|
+
}
|
|
3043
|
+
return out;
|
|
3044
|
+
}
|
|
3045
|
+
function boundAsParameter(code, name, options = {}) {
|
|
3046
|
+
const tokens = scanCode(code, options);
|
|
3047
|
+
const match = new Int32Array(tokens.length).fill(-1);
|
|
3048
|
+
const open = [];
|
|
3049
|
+
tokens.forEach((t, k) => {
|
|
3050
|
+
if (t.value === "(") open.push(k);
|
|
3051
|
+
else if (t.value === ")" && open.length) match[open.pop()] = k;
|
|
3052
|
+
});
|
|
3053
|
+
const arrowAfter = (end) => {
|
|
3054
|
+
const next = tokens[end + 1];
|
|
3055
|
+
if (next?.value === "=>") return true;
|
|
3056
|
+
if (next?.value !== ":") return false;
|
|
3057
|
+
let depth = 0;
|
|
3058
|
+
for (let k = end + 2; k < Math.min(tokens.length, end + 200); k++) {
|
|
3059
|
+
const v = tokens[k].value;
|
|
3060
|
+
if (v === "(" || v === "{" || v === "[" || v === "<") depth++;
|
|
3061
|
+
else if (v === ")" || v === "}" || v === "]" || v === ">") depth--;
|
|
3062
|
+
if (depth < 0) return false;
|
|
3063
|
+
if (depth === 0 && v === "=>") return true;
|
|
3064
|
+
if (depth === 0 && (v === ";" || v === "," || v === "=")) return false;
|
|
3065
|
+
}
|
|
3066
|
+
return false;
|
|
3067
|
+
};
|
|
3068
|
+
const beforeTypeParameters = (paren) => {
|
|
3069
|
+
let k = paren - 1;
|
|
3070
|
+
if (tokens[k]?.value !== ">" && tokens[k]?.value !== ">>") return k;
|
|
3071
|
+
let depth = 0;
|
|
3072
|
+
for (const stop = Math.max(0, k - TYPE_PARAMETERS_REACH); k >= stop; k--) {
|
|
3073
|
+
const v = tokens[k].value;
|
|
3074
|
+
if (v === ">") depth++;
|
|
3075
|
+
else if (v === ">>") depth += 2;
|
|
3076
|
+
else if (v === "<" && --depth === 0) return k - 1;
|
|
3077
|
+
}
|
|
3078
|
+
return -1;
|
|
3079
|
+
};
|
|
3080
|
+
const isFunction = (paren) => {
|
|
3081
|
+
let k = beforeTypeParameters(paren);
|
|
3082
|
+
if (k < 0) return false;
|
|
3083
|
+
if (tokens[k]?.kind === "ident" && tokens[k].value !== "function") k--;
|
|
3084
|
+
if (tokens[k]?.value === "*") k--;
|
|
3085
|
+
return tokens[k]?.value === "function";
|
|
3086
|
+
};
|
|
3087
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
3088
|
+
const t = tokens[i];
|
|
3089
|
+
if (t.value === "=>" && tokens[i - 1]?.kind === "ident" && tokens[i - 1].value === name && tokens[i - 2]?.value !== ".") return true;
|
|
3090
|
+
if (t.value !== "(") continue;
|
|
3091
|
+
const end = match[i];
|
|
3092
|
+
if (end < 0) continue;
|
|
3093
|
+
const before = tokens[i - 1];
|
|
3094
|
+
const catchClause = before?.value === "catch";
|
|
3095
|
+
const nameAt = beforeTypeParameters(i);
|
|
3096
|
+
const methodName = nameAt >= 0 ? tokens[nameAt] : void 0;
|
|
3097
|
+
const typed = tokens[end + 1]?.value === ":" && !arrowAfter(end);
|
|
3098
|
+
const method = !catchClause && methodName?.kind === "ident" && !NOT_METHODS.has(methodName.value) && (tokens[end + 1]?.value === "{" || typed && (nameAt === 0 || BEFORE_METHOD.has(tokens[nameAt - 1].value)));
|
|
3099
|
+
if ((catchClause || isFunction(i) || method || arrowAfter(end)) && boundNames(tokens.slice(i + 1, end)).includes(name)) return true;
|
|
3100
|
+
}
|
|
3101
|
+
return false;
|
|
3102
|
+
}
|
|
3103
|
+
|
|
3104
|
+
// src/doctor/rules.ts
|
|
2770
3105
|
var BUILTIN_RULES = [
|
|
2771
3106
|
"local-primitives",
|
|
2772
3107
|
// figma (figma/routes.ts; runs when genesis.config.json has a figma block)
|
|
@@ -2854,7 +3189,10 @@ var BUILTIN_RULES = [
|
|
|
2854
3189
|
// custom views and app parts (custom-views.ts)
|
|
2855
3190
|
"app-part-colors",
|
|
2856
3191
|
"app-part-name",
|
|
2857
|
-
"custom-view-states"
|
|
3192
|
+
"custom-view-states",
|
|
3193
|
+
// the app's client layer (client-layer.ts)
|
|
3194
|
+
"client/layer",
|
|
3195
|
+
"client/one-view-per-resource"
|
|
2858
3196
|
];
|
|
2859
3197
|
var DEFAULT_LOCAL_PRIMITIVE_DIRS = ["src/components/ui"];
|
|
2860
3198
|
var STARTER_LEFTOVERS = ["components.json", "src/lib/utils.ts"];
|
|
@@ -2993,14 +3331,32 @@ function checkShadowedExports(ctx) {
|
|
|
2993
3331
|
const re = /\bexport\s+(?:default\s+)?(?:declare\s+)?(?:async\s+)?(?:function\*?|const|let|var|class)\s+([A-Z][\w$]*)/g;
|
|
2994
3332
|
for (const file of ctx.files) {
|
|
2995
3333
|
if (!SCRIPT_EXTS.has(file.ext) || insideOverlayOf(overlays, file, ctx.genesis.uiPackage)) continue;
|
|
3334
|
+
const wrapped = wrappedGenesisNames(file.code, ctx.genesis.uiPackage, { jsx: file.ext !== ".ts" && file.ext !== ".mts" });
|
|
2996
3335
|
file.code.split("\n").forEach((text, i) => {
|
|
2997
3336
|
for (const m of text.matchAll(re)) {
|
|
2998
3337
|
if (!ctx.genesis.values.has(m[1])) continue;
|
|
3338
|
+
if (wrapped.has(m[1])) continue;
|
|
2999
3339
|
ctx.report({ rule: "shadowed-export", file: file.path, line: i + 1, subject: m[1], message: `shadows the Genesis export '${m[1]}'; reuse or extend ${m[1]} from ${ctx.genesis.uiPackage} (or rename yours if it's a different thing)` });
|
|
3000
3340
|
}
|
|
3001
3341
|
});
|
|
3002
3342
|
}
|
|
3003
3343
|
}
|
|
3344
|
+
function wrappedGenesisNames(code, uiPackage, options = {}) {
|
|
3345
|
+
const out = /* @__PURE__ */ new Set();
|
|
3346
|
+
const pkg = uiPackage.replace(/[.*+?^${}()|[\]\\/]/g, "\\$&");
|
|
3347
|
+
const re = new RegExp(`\\bimport\\s+(?:type\\s+)?\\{([^}]*)\\}\\s*from\\s*["']${pkg}(?:/[^"']*)?["']`, "g");
|
|
3348
|
+
for (const m of code.matchAll(re)) {
|
|
3349
|
+
if (/^import\s+type\b/.test(m[0])) continue;
|
|
3350
|
+
for (const part of m[1].split(",")) {
|
|
3351
|
+
const spec = part.trim();
|
|
3352
|
+
if (!spec || spec.startsWith("type ")) continue;
|
|
3353
|
+
const [imported, local] = spec.split(/\s+as\s+/).map((x) => x.trim());
|
|
3354
|
+
if (!imported || !local || local === imported) continue;
|
|
3355
|
+
if (usesAsCode(code, local, options)) out.add(imported);
|
|
3356
|
+
}
|
|
3357
|
+
}
|
|
3358
|
+
return out;
|
|
3359
|
+
}
|
|
3004
3360
|
function unusedComponents(ctx) {
|
|
3005
3361
|
const used = /* @__PURE__ */ new Set();
|
|
3006
3362
|
const pkg = ctx.genesis.uiPackage.replace(/[.*+?^${}()|[\]\\/]/g, "\\$&");
|
|
@@ -3815,7 +4171,7 @@ function createTrail(ctx) {
|
|
|
3815
4171
|
declared = null;
|
|
3816
4172
|
}
|
|
3817
4173
|
const byPath = new Map(ctx.files.map((f) => [f.absolutePath, f]));
|
|
3818
|
-
const
|
|
4174
|
+
const read3 = (abs) => byPath.get(abs) ?? readSource(abs);
|
|
3819
4175
|
const importsCache = /* @__PURE__ */ new Map();
|
|
3820
4176
|
const importsOf = (file) => {
|
|
3821
4177
|
const hit = importsCache.get(file.absolutePath);
|
|
@@ -3892,7 +4248,7 @@ function createTrail(ctx) {
|
|
|
3892
4248
|
cut.add(abs);
|
|
3893
4249
|
continue;
|
|
3894
4250
|
}
|
|
3895
|
-
const target =
|
|
4251
|
+
const target = read3(abs);
|
|
3896
4252
|
if (!target) {
|
|
3897
4253
|
unknown = true;
|
|
3898
4254
|
continue;
|
|
@@ -6130,7 +6486,109 @@ function checkAppParts(ctx) {
|
|
|
6130
6486
|
}
|
|
6131
6487
|
}
|
|
6132
6488
|
}
|
|
6133
|
-
|
|
6489
|
+
init_regexp();
|
|
6490
|
+
var JSX_EXTS5 = /* @__PURE__ */ new Set([".tsx", ".jsx"]);
|
|
6491
|
+
var SCRIPT_EXTS6 = /* @__PURE__ */ new Set([".ts", ".tsx", ".js", ".jsx", ".mts"]);
|
|
6492
|
+
var DEFAULT_CLIENT_DIR = "src/client";
|
|
6493
|
+
function clientLayer(root, files) {
|
|
6494
|
+
let dir = DEFAULT_CLIENT_DIR;
|
|
6495
|
+
try {
|
|
6496
|
+
dir = readGenesisConfig(root)?.client?.dir ?? DEFAULT_CLIENT_DIR;
|
|
6497
|
+
} catch {
|
|
6498
|
+
}
|
|
6499
|
+
const inside2 = `${dir}/`;
|
|
6500
|
+
const present = files.some((f) => f.path.startsWith(inside2) && /(^|\/)resource-view\.(t|j)sx?$/.test(f.path)) || existsSync(path21.join(root, dir, "resource-view.tsx"));
|
|
6501
|
+
const recordWrapper = files.some((f) => f.path.startsWith(inside2) && /(^|\/)record-view\.(t|j)sx?$/.test(f.path)) || existsSync(path21.join(root, dir, "record-view.tsx"));
|
|
6502
|
+
return { dir, present, recordWrapper };
|
|
6503
|
+
}
|
|
6504
|
+
function genesisImports(code, uiPackage) {
|
|
6505
|
+
const out = /* @__PURE__ */ new Map();
|
|
6506
|
+
const escaped = uiPackage.replace(/[.*+?^${}()|[\]\\/]/g, "\\$&");
|
|
6507
|
+
const re = new RegExp(`import\\s*(?:type\\s+)?\\{([^}]*)\\}\\s*from\\s*["']${escaped}(?:/data)?["']`, "g");
|
|
6508
|
+
for (const m of code.matchAll(re)) {
|
|
6509
|
+
if (/^\s*type\s/.test(m[0].slice(6))) continue;
|
|
6510
|
+
for (const part of m[1].split(",")) {
|
|
6511
|
+
const spec = part.trim().replace(/^type\s+/, "");
|
|
6512
|
+
if (!spec || part.trim().startsWith("type ")) continue;
|
|
6513
|
+
const [imported, local] = spec.split(/\s+as\s+/).map((x) => x.trim());
|
|
6514
|
+
if (imported === "ResourceView" || imported === "RecordView") out.set(local ?? imported, imported);
|
|
6515
|
+
}
|
|
6516
|
+
}
|
|
6517
|
+
return out;
|
|
6518
|
+
}
|
|
6519
|
+
function checkClientLayer(ctx) {
|
|
6520
|
+
const layer = clientLayer(ctx.root, ctx.files);
|
|
6521
|
+
const inside2 = `${layer.dir}/`;
|
|
6522
|
+
if (layer.present) {
|
|
6523
|
+
for (const file of ctx.files) {
|
|
6524
|
+
if (!JSX_EXTS5.has(file.ext) || file.path.startsWith(inside2)) continue;
|
|
6525
|
+
const imported = genesisImports(file.code, ctx.genesis.uiPackage);
|
|
6526
|
+
for (const [local, name] of imported) {
|
|
6527
|
+
if (name === "RecordView" && !layer.recordWrapper) continue;
|
|
6528
|
+
const at = file.code.search(new RegExp(`<${local}\\b`));
|
|
6529
|
+
if (at < 0) continue;
|
|
6530
|
+
ctx.report({
|
|
6531
|
+
rule: "client/layer",
|
|
6532
|
+
level: "warn",
|
|
6533
|
+
file: file.path,
|
|
6534
|
+
line: lineAt(file.code, at),
|
|
6535
|
+
subject: name,
|
|
6536
|
+
message: `renders Genesis's <${name}> directly; the app has a client layer (${layer.dir}), so render its ${name === "ResourceView" ? "ResourceView from resource-view.tsx" : "RecordView from record-view.tsx"}, and its defaults reach this screen too (docs/adr/0020-client-layer.md)`
|
|
6537
|
+
});
|
|
6538
|
+
}
|
|
6539
|
+
}
|
|
6540
|
+
}
|
|
6541
|
+
if (!layer.present) return;
|
|
6542
|
+
const seen = /* @__PURE__ */ new Map();
|
|
6543
|
+
for (const file of ctx.files) {
|
|
6544
|
+
if (!SCRIPT_EXTS6.has(file.ext) || SHOWN_OR_TRIED.test(file.path)) continue;
|
|
6545
|
+
const imports = importedNames(file.path, file.code);
|
|
6546
|
+
for (const m of file.code.matchAll(/\bdefineView\s*(?:<[^>]*>)?\s*\(\s*([A-Za-z_$][\w$]*)((?:\s*(?:\.\s*[A-Za-z_$][\w$]*|\[\s*["'`][^"'`]+["'`]\s*\]))*)\s*[,)]/g)) {
|
|
6547
|
+
const base = m[1];
|
|
6548
|
+
const access = m[2].replace(/\s+/g, "").replace(/'|`/g, '"');
|
|
6549
|
+
const imported = imports.get(base);
|
|
6550
|
+
if (!imported && !declaredAtTop(file.code, base)) continue;
|
|
6551
|
+
if (boundAsParameter(file.code, base, { jsx: file.ext !== ".ts" && file.ext !== ".mts" })) continue;
|
|
6552
|
+
const identity = `${imported ?? `${file.path}#${base}`}${access}`;
|
|
6553
|
+
const shown = `${base}${access}`;
|
|
6554
|
+
const line = lineAt(file.code, m.index ?? 0);
|
|
6555
|
+
const first = seen.get(identity);
|
|
6556
|
+
if (!first) {
|
|
6557
|
+
seen.set(identity, { file: file.path, line });
|
|
6558
|
+
continue;
|
|
6559
|
+
}
|
|
6560
|
+
ctx.report({
|
|
6561
|
+
rule: "client/one-view-per-resource",
|
|
6562
|
+
level: "warn",
|
|
6563
|
+
file: file.path,
|
|
6564
|
+
line,
|
|
6565
|
+
subject: shown,
|
|
6566
|
+
message: `defines a second view over ${shown} (the first is in ${first.file}:${first.line}); keep one view per resource and narrow it on the screen (preset, filter, columns), so its rules can't drift (docs/adr/0020-client-layer.md)`
|
|
6567
|
+
});
|
|
6568
|
+
}
|
|
6569
|
+
}
|
|
6570
|
+
}
|
|
6571
|
+
function declaredAtTop(code, name) {
|
|
6572
|
+
const escaped = escapeRegExp(name);
|
|
6573
|
+
return new RegExp(`^(?:export\\s+)?(?:const|let|var)\\s+${escaped}\\b`, "m").test(code);
|
|
6574
|
+
}
|
|
6575
|
+
var SHOWN_OR_TRIED = /(\.stories\.|\.test\.|\.spec\.|(^|\/)__tests__\/)/;
|
|
6576
|
+
function importedNames(filePath, code) {
|
|
6577
|
+
const out = /* @__PURE__ */ new Map();
|
|
6578
|
+
const dir = path21.posix.dirname(filePath);
|
|
6579
|
+
const where2 = (spec) => spec.startsWith(".") ? path21.posix.normalize(path21.posix.join(dir, spec)).replace(/\.(t|j)sx?$/, "").replace(/\/index$/, "") : spec;
|
|
6580
|
+
for (const m of code.matchAll(/import\s+(?:type\s+)?\{([^}]*)\}\s*from\s*["']([^"']+)["']/g)) {
|
|
6581
|
+
for (const part of m[1].split(",")) {
|
|
6582
|
+
const spec = part.trim().replace(/^type\s+/, "");
|
|
6583
|
+
if (!spec) continue;
|
|
6584
|
+
const [imported, local] = spec.split(/\s+as\s+/).map((x) => x.trim());
|
|
6585
|
+
out.set(local ?? imported, `${where2(m[2])}#${imported}`);
|
|
6586
|
+
}
|
|
6587
|
+
}
|
|
6588
|
+
for (const m of code.matchAll(/import\s+(?:\*\s+as\s+)?([A-Za-z_$][\w$]*)\s+from\s*["']([^"']+)["']/g)) out.set(m[1], `${where2(m[2])}#*`);
|
|
6589
|
+
return out;
|
|
6590
|
+
}
|
|
6591
|
+
var SCRIPT_EXTS7 = /* @__PURE__ */ new Set([".ts", ".tsx", ".js", ".jsx", ".mts", ".cts", ".mjs", ".cjs"]);
|
|
6134
6592
|
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;
|
|
6135
6593
|
var REEXPORT = /\/\*\*((?:(?!\*\/)[\s\S])*)\*\/\s*\nexport\s+(?:type\s+)?\{([^}]*)\}/g;
|
|
6136
6594
|
function specifierParts(spec) {
|
|
@@ -6220,7 +6678,7 @@ function checkStabilityImports(ctx) {
|
|
|
6220
6678
|
return cache2.get(pkg);
|
|
6221
6679
|
};
|
|
6222
6680
|
for (const file of ctx.files) {
|
|
6223
|
-
if (!
|
|
6681
|
+
if (!SCRIPT_EXTS7.has(file.ext)) continue;
|
|
6224
6682
|
for (const { pkg, specifier, names, line } of genesisNamedImports(file.code)) {
|
|
6225
6683
|
const tags = tagsOf(pkg);
|
|
6226
6684
|
if (!tags) continue;
|
|
@@ -6553,7 +7011,7 @@ function sourceSchemas(source) {
|
|
|
6553
7011
|
return schemas?.length ? schemas : null;
|
|
6554
7012
|
}
|
|
6555
7013
|
var lf = (text) => text.replace(/\r\n/g, "\n");
|
|
6556
|
-
async function checkContracts(ctx,
|
|
7014
|
+
async function checkContracts(ctx, read3 = postgresContract) {
|
|
6557
7015
|
const settings = ctx.config.contracts;
|
|
6558
7016
|
if (!settings) return;
|
|
6559
7017
|
const out = settings.out ?? DEFAULT_CONTRACT_OUT;
|
|
@@ -6577,7 +7035,7 @@ async function checkContracts(ctx, read2 = postgresContract) {
|
|
|
6577
7035
|
}
|
|
6578
7036
|
let expected;
|
|
6579
7037
|
try {
|
|
6580
|
-
expected = lf((await
|
|
7038
|
+
expected = lf((await read3(url, schemas)).content);
|
|
6581
7039
|
} catch (err) {
|
|
6582
7040
|
const generation = err.name === "EmitError";
|
|
6583
7041
|
const message = err.message.split("\n")[0];
|
|
@@ -6595,7 +7053,7 @@ async function checkContracts(ctx, read2 = postgresContract) {
|
|
|
6595
7053
|
}
|
|
6596
7054
|
}
|
|
6597
7055
|
var GENESIS_DOCS = "https://github.com/marktiderman/genesis/blob/main/docs";
|
|
6598
|
-
var
|
|
7056
|
+
var read2 = (file) => existsSync(file) ? readFileSync(file, "utf8") : null;
|
|
6599
7057
|
var CORE = [
|
|
6600
7058
|
{
|
|
6601
7059
|
need: "anything, before building it",
|
|
@@ -6725,7 +7183,7 @@ function packageGuides(root, packages) {
|
|
|
6725
7183
|
const guides = [];
|
|
6726
7184
|
for (const p of packages) {
|
|
6727
7185
|
const stable = p.local ? path21.join(p.dir, "SKILL.md") : stableGuidePath(root, p);
|
|
6728
|
-
const text = stable === null ? null :
|
|
7186
|
+
const text = stable === null ? null : read2(stable);
|
|
6729
7187
|
if (stable === null || text === null) continue;
|
|
6730
7188
|
const description = skillDescription(text);
|
|
6731
7189
|
const at = description.indexOf("Load before");
|
|
@@ -6824,8 +7282,8 @@ function claudeState(root) {
|
|
|
6824
7282
|
function agentGuideState(root, packages, agentsFile = "AGENTS.md") {
|
|
6825
7283
|
const rows = primitivesCatalog(packages);
|
|
6826
7284
|
const guides = packageGuides(root, packages);
|
|
6827
|
-
const skill =
|
|
6828
|
-
const block = currentAgentsBlock(
|
|
7285
|
+
const skill = read2(path21.join(root, SKILL_PATH))?.replace(/\r\n/g, "\n") ?? null;
|
|
7286
|
+
const block = currentAgentsBlock(read2(path21.join(root, agentsFile)));
|
|
6829
7287
|
return {
|
|
6830
7288
|
skill: skill === null ? "missing" : skill === renderSkill(rows, guides) ? "ok" : "stale",
|
|
6831
7289
|
agents: block === null || block === "broken" ? block ?? "missing" : block === renderAgentsBlock(rows, guides) ? "ok" : "stale",
|
|
@@ -7826,6 +8284,7 @@ function builtinChecks(config, options = {}) {
|
|
|
7826
8284
|
{ name: "studio-server-imports", check: checkStudioServerImports },
|
|
7827
8285
|
{ name: "removed-scope-names", check: checkRemovedScopeNames },
|
|
7828
8286
|
{ name: "app-parts", check: checkAppParts },
|
|
8287
|
+
{ name: "client-layer", check: checkClientLayer },
|
|
7829
8288
|
{ name: "stability-imports", check: checkStabilityImports },
|
|
7830
8289
|
{ name: "agent-guide", check: (ctx) => {
|
|
7831
8290
|
checkAgentGuide(ctx);
|