@marktiderman/genesis-cli 1.13.1 → 1.14.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/index.js CHANGED
@@ -103,9 +103,9 @@ async function runScaffold(opts, fs) {
103
103
  function joinPath(...parts) {
104
104
  return parts.filter(Boolean).join("/").replace(/\/+/g, "/");
105
105
  }
106
- function dirname(path20) {
107
- const idx = path20.lastIndexOf("/");
108
- return idx === -1 ? "." : path20.slice(0, idx);
106
+ function dirname(path22) {
107
+ const idx = path22.lastIndexOf("/");
108
+ return idx === -1 ? "." : path22.slice(0, idx);
109
109
  }
110
110
  function brandPackageJson(consumer, genesisVersion) {
111
111
  return JSON.stringify(
@@ -663,8 +663,8 @@ function routeTags(source) {
663
663
  var GUARD = /<((?:[A-Z]\w*)?(?:Admin|Staff)\w*(?:Guard|Route|Only)|RequireAdmin|RequireStaff)>/;
664
664
  function wireStudioRoute(source, route, pageImportPath) {
665
665
  const tags = routeTags(source);
666
- const relative6 = route.replace(/^\//, "");
667
- const existing = tags.find((t) => new RegExp(`path=["'](/?${relative6.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")})["']`).test(t.text));
666
+ const relative7 = route.replace(/^\//, "");
667
+ const existing = tags.find((t) => new RegExp(`path=["'](/?${relative7.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")})["']`).test(t.text));
668
668
  if (existing) {
669
669
  return { skipped: `Your router already has a page at ${route}. Replace its element with <DataStudioPage /> to use the studio there.` };
670
670
  }
@@ -672,17 +672,17 @@ function wireStudioRoute(source, route, pageImportPath) {
672
672
  const roots = layouts.length ? layouts : tags.filter((t) => !t.selfClosing && t.close !== void 0 && /path=["']\/["']/.test(t.text));
673
673
  if (roots.length !== 1) {
674
674
  return {
675
- skipped: roots.length === 0 ? `No layout route found to put the page under. Add <Route path="${route}" element={<DataStudioPage />} /> where your app's other pages are.` : `More than one layout route; add <Route path="${relative6}" element={<DataStudioPage />} /> inside the one your other admin pages use.`
675
+ skipped: roots.length === 0 ? `No layout route found to put the page under. Add <Route path="${route}" element={<DataStudioPage />} /> where your app's other pages are.` : `More than one layout route; add <Route path="${relative7}" element={<DataStudioPage />} /> inside the one your other admin pages use.`
676
676
  };
677
677
  }
678
678
  const layout = roots[0];
679
679
  const base = (/\bpath=["']([^"']*)["']/.exec(layout.text)?.[1] ?? "").replace(/^\/+|\/+$/g, "");
680
- if (base && !relative6.startsWith(`${base}/`)) {
680
+ if (base && !relative7.startsWith(`${base}/`)) {
681
681
  return {
682
682
  skipped: `Your layout route lives at /${base}, outside ${route}. Add <Route path="${route}" element={<DataStudioPage />} /> where your app's other pages are.`
683
683
  };
684
684
  }
685
- const childPath = base ? relative6.slice(base.length + 1) : relative6;
685
+ const childPath = base ? relative7.slice(base.length + 1) : relative7;
686
686
  const guard = GUARD.exec(source)?.[1];
687
687
  const element = guard ? `<${guard}><DataStudioPage /></${guard}>` : "<DataStudioPage />";
688
688
  const before = source.slice(0, layout.close);
@@ -1352,7 +1352,7 @@ function globToRegExp(glob) {
1352
1352
  }
1353
1353
  function globMatcher(globs) {
1354
1354
  const res = (globs ?? []).filter((g) => g.trim()).map(globToRegExp);
1355
- return (path20) => res.some((re) => re.test(path20));
1355
+ return (path22) => res.some((re) => re.test(path22));
1356
1356
  }
1357
1357
  var DEFAULT_UI_PACKAGE = "@marktiderman/genesis-ui";
1358
1358
  var NATIVE_UI_PACKAGE = "@marktiderman/genesis-ui-native";
@@ -2222,6 +2222,11 @@ var BUILTIN_RULES = [
2222
2222
  "page-layout",
2223
2223
  // dates
2224
2224
  "iso-date-slice",
2225
+ // Genesis API usage (api-usage.ts)
2226
+ "resource-view-tree",
2227
+ "studio-server-auth-import",
2228
+ "removed-scope-name",
2229
+ "scope-practice-id",
2225
2230
  // native pack
2226
2231
  "native-raw-primitive",
2227
2232
  "native-literal-color",
@@ -3589,7 +3594,9 @@ function checkChanges(ctx, pkg, json, base, mergeBase) {
3589
3594
  }
3590
3595
  const raw = json;
3591
3596
  if (jsonBefore && (JSON.stringify(jsonBefore.genesis) !== JSON.stringify(raw.genesis) || JSON.stringify(jsonBefore.exports) !== JSON.stringify(raw.exports))) {
3592
- const registry = (git(ctx.root, ["diff", "--relative", "--name-only", mergeBase, "--", "features.ts", "src/features.ts"]) ?? "").trim();
3597
+ const appInRepo = path14.relative(top, realpathSync(ctx.root)).split(path14.sep).join("/");
3598
+ const candidates = [.../* @__PURE__ */ new Set(["features.ts", "src/features.ts", ...appInRepo ? [`${appInRepo}/features.ts`, `${appInRepo}/src/features.ts`] : []])];
3599
+ const registry = (git(top, ["diff", "--name-only", mergeBase, "--", ...candidates]) ?? "").trim();
3593
3600
  if (!registry) ctx.report({ rule: "package-unversioned-change", level: "warn", file: `${pkg.rel}/package.json`, message: `${pkg.name}'s blocks or exports changed but features.ts didn't; update the features they belong to` });
3594
3601
  }
3595
3602
  if (bumped && !named && before !== null) {
@@ -4547,6 +4554,358 @@ function checkIsoDateSlices(ctx) {
4547
4554
  }
4548
4555
  }
4549
4556
 
4557
+ // src/upgrade/scope-names.ts
4558
+ var IMPORTS_GENESIS = /\bfrom\s*["']@marktiderman\/genesis[\w/-]*["']/;
4559
+ function maskComments(text) {
4560
+ const out = text.split("");
4561
+ let quote2 = null;
4562
+ for (let i = 0; i < text.length; i++) {
4563
+ const ch = text[i];
4564
+ if (quote2) {
4565
+ if (ch === "\\") i++;
4566
+ else if (ch === quote2) quote2 = null;
4567
+ continue;
4568
+ }
4569
+ if (ch === '"' || ch === "'" || ch === "`") {
4570
+ quote2 = ch;
4571
+ continue;
4572
+ }
4573
+ if (ch === "/" && (text[i + 1] === "/" || text[i + 1] === "*")) {
4574
+ const line = text[i + 1] === "/";
4575
+ const end = line ? text.indexOf("\n", i) === -1 ? text.length : text.indexOf("\n", i) : text.indexOf("*/", i + 2) === -1 ? text.length : text.indexOf("*/", i + 2) + 2;
4576
+ for (let k = i; k < end; k++) if (out[k] !== "\n") out[k] = " ";
4577
+ i = end - 1;
4578
+ }
4579
+ }
4580
+ return out.join("");
4581
+ }
4582
+ var within = (spans, at) => spans.some(([a, b]) => at >= a && at < b);
4583
+ function importedFromGenesis(text, name) {
4584
+ for (const m of text.matchAll(/\bimport\s+(?:type\s+)?\{([^}]*)\}\s*from\s*["']@marktiderman\/genesis[\w/-]*["']/g)) {
4585
+ for (const part of m[1].split(",")) {
4586
+ const local = part.trim().replace(/^type\s+/, "").split(/\s+as\s+/).pop()?.trim();
4587
+ if (local === name) return true;
4588
+ }
4589
+ }
4590
+ return false;
4591
+ }
4592
+ var OPEN = { "(": ")", "{": "}", "[": "]" };
4593
+ function matching(text, open) {
4594
+ const stack = [];
4595
+ let quote2 = null;
4596
+ for (let i = open; i < text.length; i++) {
4597
+ const ch = text[i];
4598
+ if (quote2) {
4599
+ if (ch === "\\") i++;
4600
+ else if (ch === quote2) quote2 = null;
4601
+ continue;
4602
+ }
4603
+ if (ch === '"' || ch === "'" || ch === "`") quote2 = ch;
4604
+ else if (OPEN[ch]) stack.push(OPEN[ch]);
4605
+ else if (ch === ")" || ch === "}" || ch === "]") {
4606
+ stack.pop();
4607
+ if (stack.length === 0) return i + 1;
4608
+ }
4609
+ }
4610
+ return text.length;
4611
+ }
4612
+ function matchingBack(text, close) {
4613
+ let depth = 0;
4614
+ for (let i = close; i >= 0; i--) {
4615
+ const ch = text[i];
4616
+ if (ch === "}") depth++;
4617
+ else if (ch === "{") {
4618
+ depth--;
4619
+ if (depth === 0) return i;
4620
+ }
4621
+ }
4622
+ return 0;
4623
+ }
4624
+ function callSpans(text, name) {
4625
+ const out = [];
4626
+ for (const m of text.matchAll(new RegExp(`\\b${name}\\s*(?:<[^()]*?>)?\\s*\\(`, "g"))) {
4627
+ const open = m.index + m[0].length - 1;
4628
+ out.push([open, matching(text, open)]);
4629
+ }
4630
+ return out;
4631
+ }
4632
+ function typedObjectSpans(text, types) {
4633
+ const out = [];
4634
+ if (types.length === 0) return out;
4635
+ const names = `(?:(?:Partial|Readonly|Required|Pick|Omit)\\s*<\\s*)?(?:${types.join("|")})`;
4636
+ for (const m of text.matchAll(new RegExp(`:\\s*${names}\\b(?:<[^=]*?>)?[^=;{]*?=\\s*\\{`, "g"))) {
4637
+ const open = m.index + m[0].length - 1;
4638
+ out.push([open, matching(text, open)]);
4639
+ }
4640
+ for (const m of text.matchAll(new RegExp(`\\}\\s*(?:satisfies|as)\\s+${names}\\b`, "g"))) {
4641
+ const close = m.index;
4642
+ out.push([matchingBack(text, close), close + 1]);
4643
+ }
4644
+ return out;
4645
+ }
4646
+ function tagSpans(text, tag) {
4647
+ const out = [];
4648
+ for (const m of text.matchAll(new RegExp(`<${tag}\\b`, "g"))) {
4649
+ let depth = 0;
4650
+ let quote2 = null;
4651
+ let end = text.length;
4652
+ for (let i = m.index + 1; i < text.length; i++) {
4653
+ const ch = text[i];
4654
+ if (quote2) {
4655
+ if (ch === "\\") i++;
4656
+ else if (ch === quote2) quote2 = null;
4657
+ continue;
4658
+ }
4659
+ if (ch === '"' || ch === "'" || ch === "`") quote2 = ch;
4660
+ else if (ch === "{") depth++;
4661
+ else if (ch === "}") depth--;
4662
+ else if (ch === ">" && depth === 0) {
4663
+ end = i + 1;
4664
+ break;
4665
+ }
4666
+ }
4667
+ out.push([m.index, end]);
4668
+ }
4669
+ return out;
4670
+ }
4671
+ function attributeObjectSpans(text, tag, attr) {
4672
+ const out = [];
4673
+ for (const [a, b] of tagSpans(text, tag)) {
4674
+ const inTag = text.slice(a, b);
4675
+ for (const m of inTag.matchAll(new RegExp(`\\s${attr}\\s*=\\s*\\{\\s*\\{`, "g"))) {
4676
+ const open = a + m.index + m[0].length - 1;
4677
+ out.push([open, matching(text, open)]);
4678
+ }
4679
+ }
4680
+ return out;
4681
+ }
4682
+ function zoneBindings(text, hook, type) {
4683
+ const names = /* @__PURE__ */ new Set();
4684
+ if (hook) {
4685
+ for (const m of text.matchAll(/\b(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*(?::\s*DisplayTimeZones\s*)?=\s*useDisplayTimeZones\(\)/g)) names.add(m[1]);
4686
+ }
4687
+ if (type) for (const m of text.matchAll(/\b([A-Za-z_$][\w$]*)\s*\??\s*:\s*DisplayTimeZones\b/g)) names.add(m[1]);
4688
+ return [...names];
4689
+ }
4690
+ var escape = (name) => name.replace(/\$/g, "\\$");
4691
+ function findRemovedScopeNames(source) {
4692
+ const text = maskComments(source);
4693
+ if (!IMPORTS_GENESIS.test(text)) return [];
4694
+ const out = [];
4695
+ const has2 = (name) => importedFromGenesis(text, name);
4696
+ const viewSpans = [
4697
+ ...has2("defineView") ? callSpans(text, "defineView") : [],
4698
+ ...typedObjectSpans(text, ["ViewDefinition", "ViewField"].filter(has2))
4699
+ ];
4700
+ for (const m of text.matchAll(/(\btimeZone\s*:\s*)(["'`])practice\2/g)) {
4701
+ const at = m.index + m[1].length;
4702
+ if (!within(viewSpans, at)) continue;
4703
+ out.push({ index: m.index, what: "timeZone-practice", instead: 'timeZone: "scope"', start: at + 1, end: at + 1 + "practice".length, replacement: "scope" });
4704
+ }
4705
+ if (has2("resolveZone")) {
4706
+ for (const m of text.matchAll(/(\bresolveZone\(\s*)(["'`])practice\2/g)) {
4707
+ const at = m.index + m[1].length + 1;
4708
+ out.push({ index: m.index, what: "resolveZone-practice", instead: 'resolveZone("scope", \u2026)', start: at, end: at + "practice".length, replacement: "scope" });
4709
+ }
4710
+ }
4711
+ const propSpans = [
4712
+ ...has2("NativeResourceView") ? tagSpans(text, "NativeResourceView") : [],
4713
+ ...typedObjectSpans(text, ["NativeResourceViewProps"].filter(has2))
4714
+ ];
4715
+ for (const m of text.matchAll(/(^|[\s{,(])practiceTimeZone(\s*[=:])/gm)) {
4716
+ const at = m.index + m[1].length;
4717
+ if (!within(propSpans, at)) continue;
4718
+ out.push({ index: at, what: "practiceTimeZone", instead: "scopeTimeZone", start: at, end: at + "practiceTimeZone".length, replacement: "scopeTimeZone" });
4719
+ }
4720
+ const zoneSpans = [
4721
+ ...has2("DisplayTimeZonesProvider") ? attributeObjectSpans(text, "DisplayTimeZonesProvider", "value") : [],
4722
+ ...typedObjectSpans(text, ["DisplayTimeZones"].filter(has2))
4723
+ ];
4724
+ for (const m of text.matchAll(/(^|[\s{,])practice(\s*:)/gm)) {
4725
+ const at = m.index + m[1].length;
4726
+ if (!within(zoneSpans, at)) continue;
4727
+ out.push({ index: at, what: "DisplayTimeZones.practice", instead: "scope", start: at, end: at + "practice".length, replacement: "scope" });
4728
+ }
4729
+ for (const name of zoneBindings(text, has2("useDisplayTimeZones"), has2("DisplayTimeZones"))) {
4730
+ for (const m of text.matchAll(new RegExp(`(?<![\\w$])${escape(name)}\\s*\\??\\.\\s*(practice)(?![\\w$])`, "g"))) {
4731
+ const at = m.index + m[0].length - "practice".length;
4732
+ out.push({ index: m.index, what: "DisplayTimeZones.practice", instead: `${name}.scope`, start: at, end: at + "practice".length, replacement: "scope" });
4733
+ }
4734
+ }
4735
+ const seen = /* @__PURE__ */ new Set();
4736
+ return out.filter((f) => seen.has(f.start) ? false : (seen.add(f.start), true)).sort((a, b) => a.start - b.start);
4737
+ }
4738
+ function readsPracticeId(text) {
4739
+ if (!IMPORTS_GENESIS.test(text)) return [];
4740
+ return [...text.matchAll(/\bscope\s*\??\.\s*practiceId\b/g)].map((m) => m.index);
4741
+ }
4742
+ var augmentsResourceScope = (text) => /\binterface\s+ResourceScope\b/.test(text);
4743
+ var PRACTICE_ID_AUGMENTATION = 'declare module "@marktiderman/genesis-core" { interface ResourceScope { practiceId?: string } }';
4744
+
4745
+ // src/upgrade/codemods.ts
4746
+ var SKIP_DIRS3 = /* @__PURE__ */ new Set(["node_modules", "dist", "build", ".git", ".next", ".output", ".turbo", ".expo", "coverage", "ios", "android"]);
4747
+ var SCRIPT = /\.(?:[cm]?[jt]sx?)$/;
4748
+ var MAX_BYTES = 2 * 1024 * 1024;
4749
+ function appScripts(root) {
4750
+ const out = [];
4751
+ const walk = (dir) => {
4752
+ for (const entry of readdirSync(dir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
4753
+ const abs = path14.join(dir, entry.name);
4754
+ if (entry.isDirectory()) {
4755
+ if (!SKIP_DIRS3.has(entry.name)) walk(abs);
4756
+ } else if (entry.isFile() && SCRIPT.test(entry.name) && statSync(abs).size <= MAX_BYTES) {
4757
+ out.push(path14.relative(root, abs).split(path14.sep).join("/"));
4758
+ }
4759
+ }
4760
+ };
4761
+ walk(root);
4762
+ return out;
4763
+ }
4764
+
4765
+ // src/doctor/api-usage.ts
4766
+ var SCRIPT_EXTS5 = /* @__PURE__ */ new Set([".ts", ".tsx", ".js", ".jsx", ".mts", ".cts", ".mjs", ".cjs"]);
4767
+ function openingTag(code, start) {
4768
+ let depth = 0;
4769
+ let quote2 = null;
4770
+ for (let i = start + 1; i < code.length; i++) {
4771
+ const ch = code[i];
4772
+ if (quote2) {
4773
+ if (ch === "\\") i++;
4774
+ else if (ch === quote2) quote2 = null;
4775
+ continue;
4776
+ }
4777
+ if (ch === '"' || ch === "'" || ch === "`") quote2 = ch;
4778
+ else if (ch === "{") depth++;
4779
+ else if (ch === "}") depth--;
4780
+ else if (ch === ">" && depth === 0) return code.slice(start, i + 1);
4781
+ }
4782
+ return code.slice(start);
4783
+ }
4784
+ function ownAttributes(tag) {
4785
+ let depth = 0;
4786
+ let quote2 = null;
4787
+ let out = "";
4788
+ let inner = "";
4789
+ for (let i = 0; i < tag.length; i++) {
4790
+ const ch = tag[i];
4791
+ if (depth > 0) inner += ch;
4792
+ if (quote2) {
4793
+ if (ch === "\\") {
4794
+ i++;
4795
+ if (depth > 0) inner += tag[i] ?? "";
4796
+ else out += ch + (tag[i] ?? "");
4797
+ continue;
4798
+ }
4799
+ if (ch === quote2) quote2 = null;
4800
+ if (depth === 0) out += ch;
4801
+ continue;
4802
+ }
4803
+ if (ch === '"' || ch === "'" || ch === "`") {
4804
+ quote2 = ch;
4805
+ if (depth === 0) out += ch;
4806
+ } else if (ch === "{") {
4807
+ if (depth === 0) inner = "";
4808
+ depth++;
4809
+ } else if (ch === "}") {
4810
+ depth--;
4811
+ if (depth === 0) {
4812
+ const body = inner.slice(0, -1).trim();
4813
+ out += /^(["'`])[^"'`]*\1$/.test(body) ? `{${body}}` : "{}";
4814
+ }
4815
+ } else if (depth === 0) out += ch;
4816
+ }
4817
+ return out;
4818
+ }
4819
+ function checkTreeViews(ctx) {
4820
+ for (const file of ctx.files) {
4821
+ if (!SCRIPT_EXTS5.has(file.ext) || !/\btree\s*=/.test(file.code)) continue;
4822
+ for (const m of file.code.matchAll(/<(ResourceView|ResourcePage)\b(?:\s*<[^<>]*>)?/g)) {
4823
+ const tag = openingTag(file.code, (m.index ?? 0) + m[0].length - 1);
4824
+ const attrs = ownAttributes(tag);
4825
+ if (!/\stree\s*=/.test(attrs) || !/\spagination\s*=/.test(attrs)) continue;
4826
+ const paging = attrs.match(/\spagination\s*=\s*(?:\{\s*)?["'`](server|cursor)["'`]/);
4827
+ if (!paging) continue;
4828
+ ctx.report({
4829
+ rule: "resource-view-tree",
4830
+ level: "error",
4831
+ file: file.path,
4832
+ line: lineAt(file.code, m.index ?? 0),
4833
+ subject: m[1],
4834
+ message: `${m[1]} has \`tree\` with pagination="${paging[1]}", which throws when it renders: a tree is built from every row on the client. Leave pagination unset (docs/RESOURCE-VIEW.md, "Tree mode")`
4835
+ });
4836
+ }
4837
+ }
4838
+ }
4839
+ var STUDIO_SERVER = "@marktiderman/genesis-studio-server";
4840
+ var DEEP = /\b(?:from|import|require)\s*\(?\s*["']@marktiderman\/genesis-studio-server\/(dist|src|lib)\/[^"']*["']/g;
4841
+ var ROOT_REQUIRE = /\brequire\s*\(\s*["']@marktiderman\/genesis-studio-server["']\s*\)/g;
4842
+ function moduleFiles(ctx) {
4843
+ const scanned = new Set(ctx.files.map((f) => f.path));
4844
+ const ignored = globMatcher([...DEFAULT_IGNORE, ...ctx.config.ignore ?? []]);
4845
+ const extra = appScripts(ctx.root).filter((rel) => /\.(c|m)js$/.test(rel) && !scanned.has(rel) && !ignored(rel)).map((rel) => ({ path: rel, code: stripBlockComments(readFileSync(path14.join(ctx.root, rel), "utf8"), true) }));
4846
+ return [...ctx.files.filter((f) => SCRIPT_EXTS5.has(f.ext)), ...extra];
4847
+ }
4848
+ function checkStudioServerImports(ctx) {
4849
+ for (const file of moduleFiles(ctx)) {
4850
+ if (!file.code.includes(STUDIO_SERVER)) continue;
4851
+ for (const m of file.code.matchAll(DEEP)) {
4852
+ ctx.report({
4853
+ rule: "studio-server-auth-import",
4854
+ level: "warn",
4855
+ file: file.path,
4856
+ line: lineAt(file.code, m.index ?? 0),
4857
+ subject: `${STUDIO_SERVER}/${m[1]}`,
4858
+ message: `imports a studio-server file the package doesn't export, which fails at run time; the token checks and switchToUser are in ${STUDIO_SERVER}/auth (import or require)`
4859
+ });
4860
+ }
4861
+ for (const m of file.code.matchAll(ROOT_REQUIRE)) {
4862
+ ctx.report({
4863
+ rule: "studio-server-auth-import",
4864
+ level: "warn",
4865
+ file: file.path,
4866
+ line: lineAt(file.code, m.index ?? 0),
4867
+ subject: STUDIO_SERVER,
4868
+ message: `requires ${STUDIO_SERVER}, which is ESM-only and fails under require(); ${STUDIO_SERVER}/auth (the token checks and switchToUser) ships for require too`
4869
+ });
4870
+ }
4871
+ }
4872
+ }
4873
+ var REMOVED_WORDS = {
4874
+ "timeZone-practice": 'timeZone "practice"',
4875
+ "resolveZone-practice": 'resolveZone("practice")',
4876
+ practiceTimeZone: "practiceTimeZone",
4877
+ "DisplayTimeZones.practice": "DisplayTimeZones.practice"
4878
+ };
4879
+ function checkRemovedScopeNames(ctx) {
4880
+ let augmentedMemo;
4881
+ const augmented = () => augmentedMemo ??= ctx.files.some((f) => augmentsResourceScope(f.code)) || appScripts(ctx.root).filter((rel) => rel.endsWith(".d.ts")).some((rel) => augmentsResourceScope(readFileSync(path14.join(ctx.root, rel), "utf8")));
4882
+ for (const file of ctx.files) {
4883
+ if (!SCRIPT_EXTS5.has(file.ext)) continue;
4884
+ for (const hit of findRemovedScopeNames(file.code)) {
4885
+ ctx.report({
4886
+ rule: "removed-scope-name",
4887
+ level: "error",
4888
+ file: file.path,
4889
+ line: lineAt(file.code, hit.index),
4890
+ subject: REMOVED_WORDS[hit.what] ?? hit.what,
4891
+ message: `${REMOVED_WORDS[hit.what] ?? hit.what} was removed in genesis-core 2; use ${hit.instead}. \`genesis codemod genesis-core-2-scope-names\` rewrites every one`
4892
+ });
4893
+ }
4894
+ const reads = readsPracticeId(file.code);
4895
+ if (!reads.length || augmented()) continue;
4896
+ for (const index of reads) {
4897
+ ctx.report({
4898
+ rule: "scope-practice-id",
4899
+ level: "info",
4900
+ file: file.path,
4901
+ line: lineAt(file.code, index),
4902
+ subject: "practiceId",
4903
+ message: `scope.practiceId is the app's own scope key now, read as unknown; type it once: ${PRACTICE_ID_AUGMENTATION}`
4904
+ });
4905
+ }
4906
+ }
4907
+ }
4908
+
4550
4909
  // src/doctor/index.ts
4551
4910
  async function runDoctor(options = {}) {
4552
4911
  const root = path14.resolve(options.root ?? process.cwd());
@@ -4611,6 +4970,9 @@ function builtinChecks(config) {
4611
4970
  { name: "resource-workspaces", check: checkResourceWorkspaces },
4612
4971
  { name: "page-layouts", check: checkPageLayouts },
4613
4972
  { name: "iso-date-slices", check: checkIsoDateSlices },
4973
+ { name: "resource-view-trees", check: checkTreeViews },
4974
+ { name: "studio-server-imports", check: checkStudioServerImports },
4975
+ { name: "removed-scope-names", check: checkRemovedScopeNames },
4614
4976
  ...(config.packs ?? []).map((p) => packs[p])
4615
4977
  ];
4616
4978
  }