@clearlydev/nx-archweave 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/README.md +34 -3
  2. package/dist/bin/review-verdict.js +2 -2
  3. package/dist/eslint/index.js +1 -1
  4. package/dist/generators/_chunks/{chunk-MQNQJOWA.js → chunk-22FVJUNE.js} +4 -2
  5. package/dist/generators/_chunks/{chunk-JNYQTW7S.js → chunk-2ADC6RKP.js} +2 -2
  6. package/dist/generators/_chunks/{chunk-XSALM2IR.js → chunk-6PKKKQMD.js} +55 -11
  7. package/dist/generators/_chunks/chunk-72D3GWHO.js +269 -0
  8. package/dist/generators/_chunks/{chunk-C2WELXMV.js → chunk-736LFDT4.js} +33 -9
  9. package/dist/generators/_chunks/{chunk-VCLVE4EQ.js → chunk-7RTT5NBN.js} +4 -4
  10. package/dist/generators/_chunks/chunk-AOKTOS3U.js +294 -0
  11. package/dist/generators/_chunks/chunk-B6RBCUIL.js +325 -0
  12. package/dist/generators/_chunks/chunk-BDLK2IID.js +10 -0
  13. package/dist/generators/_chunks/{chunk-M7UBCSYL.js → chunk-CHZPA6OE.js} +5 -3
  14. package/dist/generators/_chunks/{chunk-3HSNM6AS.js → chunk-DAXD47YO.js} +9 -7
  15. package/dist/generators/_chunks/{chunk-LJRFVE6B.js → chunk-F5C5HUSI.js} +10 -9
  16. package/dist/generators/_chunks/chunk-GN76UMTK.js +28 -0
  17. package/dist/generators/_chunks/{chunk-ZRHIFPUC.js → chunk-J24X4EOB.js} +1 -1
  18. package/dist/generators/_chunks/{chunk-23NN76E3.js → chunk-JSHZ6VSW.js} +1 -1
  19. package/dist/generators/_chunks/chunk-KNVBFTH4.js +64 -0
  20. package/dist/generators/_chunks/chunk-MF75SQM6.js +98 -0
  21. package/dist/generators/_chunks/chunk-N6SPEKJB.js +106 -0
  22. package/dist/generators/_chunks/chunk-OX7W4SJ2.js +214 -0
  23. package/dist/generators/_chunks/chunk-R2VEJGNP.js +84 -0
  24. package/dist/generators/_chunks/chunk-SBOQHME6.js +140 -0
  25. package/dist/generators/_chunks/{chunk-7EDJKUY4.js → chunk-STGNMZLM.js} +1 -1
  26. package/dist/generators/_chunks/{chunk-XXXON43Z.js → chunk-SZRBDQCU.js} +4 -51
  27. package/dist/generators/_chunks/{chunk-FBCIELXS.js → chunk-W2BBF5MS.js} +5 -86
  28. package/dist/generators/_chunks/{chunk-2WXAGWAJ.js → chunk-YVISD736.js} +3 -1
  29. package/dist/generators/add-agent-rules/generator.js +4 -3
  30. package/dist/generators/add-backend/generator.js +3 -2
  31. package/dist/generators/add-fsd-lite/generator.js +8 -5
  32. package/dist/generators/add-github-templates/generator.js +3 -2
  33. package/dist/generators/add-integration/generator.js +6 -3
  34. package/dist/generators/add-review/generator.js +4 -3
  35. package/dist/generators/add-storybook/files/example/button/button.stories.tsx.template +13 -0
  36. package/dist/generators/add-storybook/files/example/button/button.tsx.template +7 -0
  37. package/dist/generators/add-storybook/files/example/index.ts.template +1 -0
  38. package/dist/generators/add-storybook/files/library/tailwind.css.template +2 -0
  39. package/dist/generators/add-storybook/generator.js +28 -0
  40. package/dist/generators/add-tailwind/files/next/postcss.config.mjs.template +7 -0
  41. package/dist/generators/add-tailwind/files/react-vite/index.css.template +2 -0
  42. package/dist/generators/add-tailwind/generator.js +26 -0
  43. package/dist/generators/allow-builds/generator.js +11 -208
  44. package/dist/generators/doctor/generator.js +444 -61
  45. package/dist/generators/entity/generator.js +5 -3
  46. package/dist/generators/feature/generator.js +5 -3
  47. package/dist/generators/init/generator.js +81 -20
  48. package/dist/generators/install-integration/generator.js +6 -3
  49. package/dist/generators/page/generator.js +5 -3
  50. package/dist/generators/record-integration/generator.js +4 -1
  51. package/dist/generators/shared/generator.js +5 -3
  52. package/dist/generators/widget/generator.js +5 -3
  53. package/dist/migrations/update-0.5.3/add-toolkit-config-lint-input.js +9 -4
  54. package/generators.json +10 -0
  55. package/package.json +6 -1
  56. package/src/generators/add-agent-rules/schema.json +2 -2
  57. package/src/generators/add-storybook/schema.json +33 -0
  58. package/src/generators/add-tailwind/schema.json +18 -0
  59. package/src/generators/init/schema.json +8 -0
@@ -3,7 +3,31 @@ import {
3
3
  } from "../_chunks/chunk-U6LAFHSF.js";
4
4
  import {
5
5
  detectUnitTestRunner
6
- } from "../_chunks/chunk-M7UBCSYL.js";
6
+ } from "../_chunks/chunk-CHZPA6OE.js";
7
+ import {
8
+ STORYBOOK_TAILWIND_CSS,
9
+ STORYBOOK_UNKNOWN_VITE_TARGET,
10
+ STORYBOOK_VITE_CONFIG_PLUGIN_TARGET,
11
+ STORYBOOK_VITE_PLUGIN_TARGET,
12
+ TAILWIND_VITE_IMPORT,
13
+ ensurePreviewImport,
14
+ ensureTailwindCss,
15
+ hasTailwindImport,
16
+ loadedViteStylesheets,
17
+ loadsTailwindVitePlugin,
18
+ nextRootLayout,
19
+ postcssHasTailwind,
20
+ storiesCoverSource,
21
+ storybookDefaultViteConfig,
22
+ storybookEslintStatus,
23
+ storybookMainFramework,
24
+ storybookViteTarget,
25
+ tailwindEntryStylesheet,
26
+ tailwindSourceLine,
27
+ tailwindSourcePaths,
28
+ viteAppLayerStylesheet,
29
+ viteTailwindEntry
30
+ } from "../_chunks/chunk-B6RBCUIL.js";
7
31
  import "../_chunks/chunk-ASY3CK5L.js";
8
32
  import {
9
33
  REVIEW_MODES,
@@ -11,11 +35,11 @@ import {
11
35
  REVIEW_WORKFLOW_CONTRACT,
12
36
  ROUND_MARKER,
13
37
  judgeReviewFileConflict
14
- } from "../_chunks/chunk-2WXAGWAJ.js";
38
+ } from "../_chunks/chunk-YVISD736.js";
15
39
  import {
16
40
  createGroupDetector,
17
41
  indexFilePattern
18
- } from "../_chunks/chunk-MQNQJOWA.js";
42
+ } from "../_chunks/chunk-22FVJUNE.js";
19
43
  import {
20
44
  resolveFsdPolicy
21
45
  } from "../_chunks/chunk-5MI3O4VZ.js";
@@ -29,13 +53,22 @@ import {
29
53
  lintInputsProjectSnippet,
30
54
  lintInputsTargetDefaultsSnippet,
31
55
  resolveTargetDefaults
32
- } from "../_chunks/chunk-XXXON43Z.js";
56
+ } from "../_chunks/chunk-SZRBDQCU.js";
57
+ import "../_chunks/chunk-KNVBFTH4.js";
58
+ import "../_chunks/chunk-R2VEJGNP.js";
33
59
  import {
60
+ inferredRootApp,
61
+ isBackend,
62
+ isEndToEnd,
34
63
  resolveFrontendApp,
35
64
  sourceRootOf
36
- } from "../_chunks/chunk-FBCIELXS.js";
37
- import "../_chunks/chunk-YEMQFSL6.js";
38
- import "../_chunks/chunk-TXAQ2GJC.js";
65
+ } from "../_chunks/chunk-W2BBF5MS.js";
66
+ import {
67
+ detectFramework
68
+ } from "../_chunks/chunk-YEMQFSL6.js";
69
+ import {
70
+ resolveProjectType
71
+ } from "../_chunks/chunk-TXAQ2GJC.js";
39
72
  import {
40
73
  ESLINT_CONFIG_CANDIDATES,
41
74
  classifyBoundaryConstraints,
@@ -53,15 +86,16 @@ import {
53
86
  import "../_chunks/chunk-34V6HAJT.js";
54
87
  import {
55
88
  diskRunNx
56
- } from "../_chunks/chunk-23NN76E3.js";
89
+ } from "../_chunks/chunk-JSHZ6VSW.js";
57
90
  import {
58
91
  readToolkitConfig,
59
92
  recordedFrontends
60
- } from "../_chunks/chunk-C2WELXMV.js";
93
+ } from "../_chunks/chunk-736LFDT4.js";
61
94
  import {
62
95
  detectWorkspacePackageManager,
63
96
  runNxCommand
64
97
  } from "../_chunks/chunk-5Z7VZPES.js";
98
+ import "../_chunks/chunk-BDLK2IID.js";
65
99
 
66
100
  // ../shared/dist/lib/doctor-report.js
67
101
  function createDoctorCheck(input) {
@@ -140,7 +174,7 @@ function detectEnvironment(root) {
140
174
 
141
175
  // ../template-engine/dist/doctor/run-doctor-checks.js
142
176
  import { existsSync as existsSync7 } from "node:fs";
143
- import { join as join7 } from "node:path";
177
+ import { join as join9 } from "node:path";
144
178
 
145
179
  // ../template-engine/dist/doctor/review-checks.js
146
180
  import { existsSync as existsSync2, readdirSync, readFileSync as readFileSync2 } from "node:fs";
@@ -614,7 +648,7 @@ function buildBackendChecks(root, projects) {
614
648
  suggestedAction: "Fix the backend field, then re-run doctor."
615
649
  }));
616
650
  } else {
617
- let hasDependency = false;
651
+ let hasDependency;
618
652
  try {
619
653
  const pkg = JSON.parse(readFileSync3(join3(root, "package.json"), "utf-8"));
620
654
  const packageName = backend === "nest" ? "@nestjs/core" : "express";
@@ -726,12 +760,29 @@ function buildUntaggedProjectsCheck(projects, roleTags) {
726
760
 
727
761
  // ../template-engine/dist/doctor/fsd-like-check.js
728
762
  import { existsSync as existsSync4, readdirSync as readdirSync3 } from "node:fs";
763
+ import { join as join5 } from "node:path";
764
+
765
+ // ../template-engine/dist/doctor/toolkit-managed.js
766
+ import { readFileSync as readFileSync4 } from "node:fs";
729
767
  import { join as join4 } from "node:path";
768
+ function isToolkitManaged(root) {
769
+ try {
770
+ const config = JSON.parse(readFileSync4(join4(root, "toolkit.config.json"), "utf-8"));
771
+ if (typeof config !== "object" || config === null || Array.isArray(config))
772
+ return false;
773
+ const preset = config["preset"];
774
+ return typeof preset === "string" && preset !== "";
775
+ } catch {
776
+ return false;
777
+ }
778
+ }
779
+
780
+ // ../template-engine/dist/doctor/fsd-like-check.js
730
781
  var FSD_LAYERS = ["app", "_app", "pages", "_pages", "widgets", "features", "entities", "shared"];
731
782
  function conventionalSourceRoots(root) {
732
783
  const scanRoots = ["src"];
733
784
  try {
734
- for (const entry of readdirSync3(join4(root, "apps"), { withFileTypes: true })) {
785
+ for (const entry of readdirSync3(join5(root, "apps"), { withFileTypes: true })) {
735
786
  if (entry.isDirectory())
736
787
  scanRoots.push(`apps/${entry.name}/src`);
737
788
  }
@@ -740,16 +791,16 @@ function conventionalSourceRoots(root) {
740
791
  return scanRoots;
741
792
  }
742
793
  function buildFsdLikeCheck(root, projects) {
743
- const scanRoots = projects === void 0 ? conventionalSourceRoots(root) : [...new Set(projects.map((project) => project.sourceRoot))].sort();
794
+ const scanRoots = projects === void 0 ? conventionalSourceRoots(root) : [...new Set(projects.filter((project) => project.fsdScan !== false).map((project) => project.sourceRoot))].sort();
744
795
  let found = [];
745
796
  for (const scanRoot of scanRoots) {
746
797
  for (const layer of FSD_LAYERS) {
747
- if (existsSync4(join4(root, scanRoot, layer)))
798
+ if (existsSync4(join5(root, scanRoot, layer)))
748
799
  found.push(scanRoot === "." || scanRoot === "" ? layer : `${scanRoot}/${layer}`);
749
800
  }
750
801
  }
751
802
  found = found.sort();
752
- if (existsSync4(join4(root, "toolkit.config.json"))) {
803
+ if (isToolkitManaged(root)) {
753
804
  return createDoctorCheck({
754
805
  id: "fsd-like-structure",
755
806
  label: "FSD-like structure",
@@ -778,8 +829,8 @@ function buildFsdLikeCheck(root, projects) {
778
829
  }
779
830
 
780
831
  // ../template-engine/dist/doctor/fsd-enforcement-check.js
781
- import { existsSync as existsSync5, readdirSync as readdirSync4, readFileSync as readFileSync4 } from "node:fs";
782
- import { join as join5 } from "node:path";
832
+ import { existsSync as existsSync5, readdirSync as readdirSync4, readFileSync as readFileSync5 } from "node:fs";
833
+ import { join as join6 } from "node:path";
783
834
 
784
835
  // ../template-engine/dist/doctor/doctor-projects.js
785
836
  function projectPrefix(root) {
@@ -788,11 +839,11 @@ function projectPrefix(root) {
788
839
 
789
840
  // ../template-engine/dist/doctor/fsd-enforcement-check.js
790
841
  function fsdEnabledPerConfig(root) {
791
- const path = join5(root, "toolkit.config.json");
792
- if (!existsSync5(path))
842
+ if (!isToolkitManaged(root))
793
843
  return null;
844
+ const path = join6(root, "toolkit.config.json");
794
845
  try {
795
- const config = JSON.parse(readFileSync4(path, "utf-8"));
846
+ const config = JSON.parse(readFileSync5(path, "utf-8"));
796
847
  const fsd = config["fsd"];
797
848
  if (typeof fsd === "object" && fsd !== null && typeof fsd["enabled"] === "boolean") {
798
849
  return fsd["enabled"];
@@ -805,18 +856,18 @@ function fsdEnabledPerConfig(root) {
805
856
  function eslintConfigPaths(root, projects) {
806
857
  if (projects !== void 0) {
807
858
  const dirs2 = ["", ...projects.map((project) => projectPrefix(project.root))];
808
- return [...new Set(dirs2.flatMap((dir) => ESLINT_CONFIG_CANDIDATES.map((name) => `${dir}${name}`)))].filter((rel) => existsSync5(join5(root, rel)));
859
+ return [...new Set(dirs2.flatMap((dir) => ESLINT_CONFIG_CANDIDATES.map((name) => `${dir}${name}`)))].filter((rel) => existsSync5(join6(root, rel)));
809
860
  }
810
861
  const dirsIn = (rel) => {
811
862
  try {
812
- return readdirSync4(join5(root, rel), { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => rel === "" ? entry.name : `${rel}/${entry.name}`);
863
+ return readdirSync4(join6(root, rel), { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => rel === "" ? entry.name : `${rel}/${entry.name}`);
813
864
  } catch {
814
865
  return [];
815
866
  }
816
867
  };
817
868
  const apps = dirsIn("apps");
818
869
  const dirs = ["", ...apps, ...apps.flatMap((app) => dirsIn(app))];
819
- return dirs.flatMap((dir) => ESLINT_CONFIG_CANDIDATES.map((name) => dir === "" ? name : `${dir}/${name}`)).filter((rel) => existsSync5(join5(root, rel)));
870
+ return dirs.flatMap((dir) => ESLINT_CONFIG_CANDIDATES.map((name) => dir === "" ? name : `${dir}/${name}`)).filter((rel) => existsSync5(join6(root, rel)));
820
871
  }
821
872
  function buildFsdEnforcementCheck(root, projects) {
822
873
  const id = "fsd-enforcement-applied";
@@ -845,7 +896,7 @@ function buildFsdEnforcementCheck(root, projects) {
845
896
  });
846
897
  }
847
898
  function appliedFsdConfigs(root, projects) {
848
- return eslintConfigPaths(root, projects).filter((rel) => classifyFsdEslintConfig(readFileSync4(join5(root, rel), "utf-8")) === "applied");
899
+ return eslintConfigPaths(root, projects).filter((rel) => classifyFsdEslintConfig(readFileSync5(join6(root, rel), "utf-8")) === "applied");
849
900
  }
850
901
  function buildFsdRuleAnchoredCheck(root, projects) {
851
902
  const id = "fsd-rule-anchored";
@@ -854,7 +905,7 @@ function buildFsdRuleAnchoredCheck(root, projects) {
854
905
  if (applied.length === 0) {
855
906
  return createDoctorCheck({ id, label, status: "not-applicable", message: "no ESLint config wires the FSD rule", evidence: [] });
856
907
  }
857
- const unanchored = applied.filter((rel) => !/fsdBoundaries\(\s*\{[^}]*\bcwd\s*:/s.test(maskComments(readFileSync4(join5(root, rel), "utf-8"))));
908
+ const unanchored = applied.filter((rel) => !/fsdBoundaries\(\s*\{[^}]*\bcwd\s*:/s.test(maskComments(readFileSync5(join6(root, rel), "utf-8"))));
858
909
  if (unanchored.length === 0) {
859
910
  return createDoctorCheck({ id, label, status: "pass", message: "every FSD rule config passes cwd", evidence: applied });
860
911
  }
@@ -869,21 +920,21 @@ function buildFsdRuleAnchoredCheck(root, projects) {
869
920
  }
870
921
 
871
922
  // ../template-engine/dist/doctor/lint-cache-check.js
872
- import { existsSync as existsSync6, readdirSync as readdirSync5, readFileSync as readFileSync5 } from "node:fs";
873
- import { join as join6 } from "node:path";
923
+ import { existsSync as existsSync6, readdirSync as readdirSync5, readFileSync as readFileSync6 } from "node:fs";
924
+ import { join as join7 } from "node:path";
874
925
  var ESLINT_PLUGIN = "@nx/eslint/plugin";
875
926
  var INFERRED_EXECUTOR = "nx:run-commands";
876
927
  var isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
877
928
  function readJson(path) {
878
929
  try {
879
- const parsed = JSON.parse(readFileSync5(path, "utf-8"));
930
+ const parsed = JSON.parse(readFileSync6(path, "utf-8"));
880
931
  return isObject(parsed) ? parsed : null;
881
932
  } catch {
882
933
  return null;
883
934
  }
884
935
  }
885
936
  function readLintSetup(root) {
886
- const nxJson = readJson(join6(root, "nx.json"));
937
+ const nxJson = readJson(join7(root, "nx.json"));
887
938
  if (nxJson === null)
888
939
  return null;
889
940
  const plugins = Array.isArray(nxJson["plugins"]) ? nxJson["plugins"] : [];
@@ -901,15 +952,15 @@ function projectList(root, projects) {
901
952
  return projects.map((project) => ({ name: project.name, root: project.root, tags: project.tags }));
902
953
  const found = [];
903
954
  for (const folder of ["apps", "libs"]) {
904
- let entries = [];
955
+ let entries;
905
956
  try {
906
- entries = readdirSync5(join6(root, folder), { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
957
+ entries = readdirSync5(join7(root, folder), { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
907
958
  } catch {
908
959
  continue;
909
960
  }
910
961
  for (const name of entries) {
911
962
  const dir = `${folder}/${name}`;
912
- const config = readJson(join6(root, dir, "project.json")) ?? readJson(join6(root, dir, "package.json"));
963
+ const config = readJson(join7(root, dir, "project.json")) ?? readJson(join7(root, dir, "package.json"));
913
964
  if (config === null)
914
965
  continue;
915
966
  const tags = Array.isArray(config["tags"]) ? config["tags"] : isObject(config["nx"]) && Array.isArray(config["nx"]["tags"]) ? config["nx"]["tags"] : [];
@@ -925,7 +976,7 @@ function ownLintTarget(root, project, target) {
925
976
  [`${prefix}package.json`, (config) => isObject(config["nx"]) && isObject(config["nx"]["targets"]) ? config["nx"]["targets"][target] : void 0]
926
977
  ];
927
978
  for (const [file, pick] of candidates) {
928
- const config = readJson(join6(root, file));
979
+ const config = readJson(join7(root, file));
929
980
  if (config === null)
930
981
  continue;
931
982
  const own = pick(config);
@@ -938,7 +989,7 @@ function ownLintTarget(root, project, target) {
938
989
  inputs: Array.isArray(own["inputs"]) ? own["inputs"] : void 0
939
990
  };
940
991
  }
941
- const pkg = readJson(join6(root, `${prefix}package.json`));
992
+ const pkg = readJson(join7(root, `${prefix}package.json`));
942
993
  if (pkg !== null && isObject(pkg["scripts"]) && typeof pkg["scripts"][target] === "string") {
943
994
  return { project: project.name, file: `${prefix}package.json`, executor: "nx:run-script", inputs: void 0 };
944
995
  }
@@ -946,7 +997,7 @@ function ownLintTarget(root, project, target) {
946
997
  }
947
998
  function configFileOf(root, projectRoot) {
948
999
  const prefix = projectPrefix(projectRoot);
949
- return existsSync6(join6(root, `${prefix}project.json`)) ? `${prefix}project.json` : `${prefix}package.json`;
1000
+ return existsSync6(join7(root, `${prefix}project.json`)) ? `${prefix}project.json` : `${prefix}package.json`;
950
1001
  }
951
1002
  function resolveDefaults(setup, project, own) {
952
1003
  const executor = own === null ? INFERRED_EXECUTOR : own.executor ?? (setup.pluginRegistered ? INFERRED_EXECUTOR : void 0);
@@ -974,8 +1025,8 @@ function namesOwnFiles(inputs) {
974
1025
  }
975
1026
  function eslintConfigNames(root, projectRoot) {
976
1027
  const prefix = projectPrefix(projectRoot);
977
- const own = ESLINT_CONFIG_CANDIDATES.find((name) => existsSync6(join6(root, `${prefix}${name}`)));
978
- const workspace = ESLINT_CONFIG_CANDIDATES.find((name) => existsSync6(join6(root, name)));
1028
+ const own = ESLINT_CONFIG_CANDIDATES.find((name) => existsSync6(join7(root, `${prefix}${name}`)));
1029
+ const workspace = ESLINT_CONFIG_CANDIDATES.find((name) => existsSync6(join7(root, name)));
979
1030
  return [
980
1031
  ...own === void 0 || prefix === "" ? [] : [`{projectRoot}/${own}`],
981
1032
  ...workspace === void 0 ? [] : [`{workspaceRoot}/${workspace}`]
@@ -983,8 +1034,8 @@ function eslintConfigNames(root, projectRoot) {
983
1034
  }
984
1035
  var NOT_READ = "nx.json could not be read";
985
1036
  function runNxAt(root) {
986
- const detected = detectWorkspacePackageManager((path) => existsSync6(join6(root, path)), (path) => existsSync6(join6(root, path)) ? readFileSync5(join6(root, path), "utf-8") : void 0);
987
- const recorded = readJson(join6(root, "toolkit.config.json"))?.["packageManager"];
1037
+ const detected = detectWorkspacePackageManager((path) => existsSync6(join7(root, path)), (path) => existsSync6(join7(root, path)) ? readFileSync6(join7(root, path), "utf-8") : void 0);
1038
+ const recorded = readJson(join7(root, "toolkit.config.json"))?.["packageManager"];
988
1039
  const known = ["pnpm", "npm", "yarn", "bun"].includes(recorded) ? recorded : null;
989
1040
  return runNxCommand(detected ?? known);
990
1041
  }
@@ -1074,6 +1125,293 @@ function buildLintInputsSpreadCheck(root, projects) {
1074
1125
  });
1075
1126
  }
1076
1127
 
1128
+ // ../template-engine/dist/doctor/storybook-setup-check.js
1129
+ import { posix } from "node:path";
1130
+
1131
+ // ../template-engine/dist/doctor/recorded-tools.js
1132
+ import { readdirSync as readdirSync6, readFileSync as readFileSync7, statSync } from "node:fs";
1133
+ import { join as join8 } from "node:path";
1134
+ function recordedToolProjects(root, key, field = "projects") {
1135
+ try {
1136
+ const config = JSON.parse(readFileSync7(join8(root, "toolkit.config.json"), "utf-8"));
1137
+ const section = typeof config === "object" && config !== null ? config[key] : void 0;
1138
+ const projects = typeof section === "object" && section !== null ? section[field] : void 0;
1139
+ return Array.isArray(projects) ? projects.filter((entry) => typeof entry === "string") : [];
1140
+ } catch {
1141
+ return [];
1142
+ }
1143
+ }
1144
+ function diskFiles(root) {
1145
+ return {
1146
+ read: (path) => {
1147
+ try {
1148
+ return readFileSync7(join8(root, path), "utf-8");
1149
+ } catch {
1150
+ return null;
1151
+ }
1152
+ },
1153
+ children: (dir) => {
1154
+ try {
1155
+ return readdirSync6(join8(root, dir));
1156
+ } catch {
1157
+ return [];
1158
+ }
1159
+ },
1160
+ isFile: (path) => {
1161
+ try {
1162
+ return statSync(join8(root, path)).isFile();
1163
+ } catch {
1164
+ return true;
1165
+ }
1166
+ }
1167
+ };
1168
+ }
1169
+
1170
+ // ../template-engine/dist/doctor/storybook-setup-check.js
1171
+ var STORYBOOK_MAINS = ["main.ts", "main.mts", "main.js"];
1172
+ var STORYBOOK_PREVIEWS = ["preview.ts", "preview.tsx", "preview.mts", "preview.js", "preview.jsx"];
1173
+ var ESLINT_CONFIGS = ["eslint.config.mjs", "eslint.config.js", "eslint.config.cjs", "eslint.config.ts", "eslint.config.mts"];
1174
+ var SOURCE_STORIES_GLOB = "'../src/**/*.@(mdx|stories.@(js|jsx|ts|tsx))'";
1175
+ var REACT_VITE = "@storybook/react-vite";
1176
+ var NEXTJS = "@storybook/nextjs";
1177
+ var LIBRARY_SOURCE_LINE = '@source "../src";';
1178
+ var prefixOf = (root) => root === "" || root === "." ? "" : `${root}/`;
1179
+ function commonProblems(root, project, main) {
1180
+ const files = diskFiles(root);
1181
+ const exists = (path) => files.read(path) !== null;
1182
+ const name = project.name;
1183
+ const dir = prefixOf(project.root);
1184
+ const problems = [];
1185
+ if (!storiesCoverSource(files.read(main) ?? "")) {
1186
+ problems.push(`${name}: ${main}'s stories don't reach every layer under ${project.sourceRoot} \u2014 use ${SOURCE_STORIES_GLOB}`);
1187
+ }
1188
+ const eslint = ESLINT_CONFIGS.map((file) => `${dir}${file}`).find(exists);
1189
+ if (eslint !== void 0) {
1190
+ const rootConfig = dir === "" ? void 0 : ESLINT_CONFIGS.find(exists);
1191
+ const status = storybookEslintStatus(files.read(eslint) ?? "", rootConfig === void 0 ? "" : files.read(rootConfig) ?? "");
1192
+ if (!status.plugin)
1193
+ problems.push(`${name}: ${eslint} does not load eslint-plugin-storybook`);
1194
+ if (!status.ignore)
1195
+ problems.push(`${name}: ${eslint} does not ignore storybook-static \u2014 lint reads the built Storybook otherwise`);
1196
+ }
1197
+ return problems;
1198
+ }
1199
+ function appProblems(root, project, tailwindApps) {
1200
+ const files = diskFiles(root);
1201
+ const exists = (path) => files.read(path) !== null;
1202
+ const name = project.name;
1203
+ const storybookDir = `${prefixOf(project.root)}.storybook`;
1204
+ const framework = detectFramework({ exists, read: files.read, projectRoot: project.root }).id;
1205
+ if (framework !== "react-vite" && framework !== "next") {
1206
+ return [`${name}: not a React (Vite) or Next.js app (${framework}) \u2014 add-storybook supports those two`];
1207
+ }
1208
+ const main = STORYBOOK_MAINS.map((file) => `${storybookDir}/${file}`).find(exists);
1209
+ if (main === void 0)
1210
+ return [`${name}: no .storybook/main in ${project.root} \u2014 run Nx's Storybook setup (nx g @nx/storybook:configuration ${name})`];
1211
+ const problems = commonProblems(root, project, main);
1212
+ if (tailwindApps.includes(name)) {
1213
+ const stylesheet = tailwindEntryStylesheet({ root: project.root, sourceRoot: project.sourceRoot, framework }, files);
1214
+ const preview = STORYBOOK_PREVIEWS.map((file) => `${storybookDir}/${file}`).find(exists) ?? `${storybookDir}/preview.ts`;
1215
+ if (stylesheet !== null && !exists(stylesheet)) {
1216
+ problems.push(`${name}: the app's Tailwind stylesheet ${stylesheet} is missing (see tailwind-setup), so the preview can't import it`);
1217
+ } else if (stylesheet !== null) {
1218
+ const relative = posix.relative(storybookDir, stylesheet);
1219
+ const spec = relative.startsWith(".") ? relative : `./${relative}`;
1220
+ const text = files.read(preview);
1221
+ if (text === null || ensurePreviewImport(text, spec).status !== "already-applied") {
1222
+ problems.push(`${name}: ${preview} does not import ${stylesheet} \u2014 add import '${spec}'; first`);
1223
+ }
1224
+ }
1225
+ }
1226
+ return problems;
1227
+ }
1228
+ function libraryProblems(root, project, tailwindLibraries) {
1229
+ const files = diskFiles(root);
1230
+ const exists = (path) => files.read(path) !== null;
1231
+ const name = project.name;
1232
+ const storybookDir = `${prefixOf(project.root)}.storybook`;
1233
+ const main = STORYBOOK_MAINS.map((file) => `${storybookDir}/${file}`).find(exists);
1234
+ if (main === void 0) {
1235
+ return [`${name}: no .storybook/main in ${project.root} \u2014 run Nx's Storybook setup (nx g @nx/storybook:configuration ${name} --uiFramework=${REACT_VITE})`];
1236
+ }
1237
+ const mainText = files.read(main) ?? "";
1238
+ const framework = storybookMainFramework(mainText);
1239
+ if (framework !== null && framework !== REACT_VITE) {
1240
+ const steps = framework === NEXTJS ? `; rerun add-storybook --project=${name} for the steps that switch it` : "";
1241
+ return [`${name}: its Storybook uses ${framework} \u2014 add-storybook supports React (Vite) libraries only${steps}`];
1242
+ }
1243
+ const problems = commonProblems(root, project, main);
1244
+ if (!tailwindLibraries.includes(name))
1245
+ return problems;
1246
+ const add = `add ${TAILWIND_VITE_IMPORT} and tailwindcss() in`;
1247
+ const target = storybookViteTarget(mainText);
1248
+ if (target.kind === "viteFinal" && !loadsTailwindVitePlugin(mainText)) {
1249
+ problems.push(`${name}: ${main} does not load Tailwind \u2014 ${add} ${STORYBOOK_VITE_PLUGIN_TARGET}`);
1250
+ } else if (target.kind === "viteConfigPath") {
1251
+ const viteConfig = posix.join(project.root, target.path);
1252
+ if (!loadsTailwindVitePlugin(files.read(viteConfig) ?? "")) {
1253
+ problems.push(`${name}: ${viteConfig} does not load Tailwind \u2014 its Storybook loads this Vite config (viteConfigPath); ${add} ${STORYBOOK_VITE_CONFIG_PLUGIN_TARGET}`);
1254
+ }
1255
+ } else if (target.kind === "none") {
1256
+ const viteConfig = storybookDefaultViteConfig(project.root, exists);
1257
+ if (viteConfig === null) {
1258
+ problems.push(`${name}: ${main} has no viteFinal or viteConfigPath \u2014 ${add} ${STORYBOOK_UNKNOWN_VITE_TARGET}`);
1259
+ } else if (!loadsTailwindVitePlugin(files.read(viteConfig) ?? "")) {
1260
+ problems.push(`${name}: ${viteConfig} does not load Tailwind \u2014 .storybook/main names no viteConfigPath, so its Storybook loads this Vite config; ${add} ${STORYBOOK_VITE_CONFIG_PLUGIN_TARGET}`);
1261
+ }
1262
+ }
1263
+ const css = `${storybookDir}/tailwind.css`;
1264
+ const cssText = files.read(css);
1265
+ if (cssText === null) {
1266
+ problems.push(`${name}: ${css} is missing \u2014 rerun add-storybook --project=${name}`);
1267
+ } else if (ensureTailwindCss(cssText, LIBRARY_SOURCE_LINE).status !== "already-applied") {
1268
+ problems.push(`${name}: ${css} does not load Tailwind with @source "../src" \u2014 add @import "tailwindcss"; and ${LIBRARY_SOURCE_LINE}`);
1269
+ }
1270
+ const preview = STORYBOOK_PREVIEWS.map((file) => `${storybookDir}/${file}`).find(exists) ?? `${storybookDir}/preview.ts`;
1271
+ const previewText = files.read(preview);
1272
+ if (previewText === null || ensurePreviewImport(previewText, STORYBOOK_TAILWIND_CSS).status !== "already-applied") {
1273
+ problems.push(`${name}: ${preview} does not import ${STORYBOOK_TAILWIND_CSS} \u2014 add import '${STORYBOOK_TAILWIND_CSS}'; first`);
1274
+ }
1275
+ return problems;
1276
+ }
1277
+ function buildStorybookSetupCheck(root, projects) {
1278
+ const recorded = recordedToolProjects(root, "storybook");
1279
+ const base = { id: "storybook-setup", label: "Storybook setup" };
1280
+ if (recorded.length === 0) {
1281
+ return createDoctorCheck({ ...base, status: "pass", message: "Storybook was not added by nx-archweave \u2014 nothing to check", evidence: [] });
1282
+ }
1283
+ if (projects === void 0) {
1284
+ return createDoctorCheck({
1285
+ ...base,
1286
+ status: "warning",
1287
+ message: "Could not read the workspace projects \u2014 the recorded Storybook apps were not checked",
1288
+ evidence: recorded.map((name) => `recorded: ${name}`),
1289
+ suggestedAction: "Fix the project.json that Nx cannot parse, then run doctor again."
1290
+ });
1291
+ }
1292
+ const tailwindApps = recordedToolProjects(root, "tailwind");
1293
+ const tailwindLibraries = recordedToolProjects(root, "storybook", "tailwind");
1294
+ const problems = recorded.flatMap((name) => {
1295
+ const project = projects.find((candidate) => candidate.name === name);
1296
+ if (project === void 0)
1297
+ return [`recorded project ${name} not found`];
1298
+ return project.projectType === "library" ? libraryProblems(root, project, tailwindLibraries) : appProblems(root, project, tailwindApps);
1299
+ });
1300
+ if (problems.length === 0) {
1301
+ return createDoctorCheck({ ...base, status: "pass", message: `Storybook is set up in ${recorded.join(", ")}`, evidence: recorded });
1302
+ }
1303
+ return createDoctorCheck({
1304
+ ...base,
1305
+ status: "warning",
1306
+ message: "Storybook setup is incomplete in the recorded projects",
1307
+ evidence: problems,
1308
+ suggestedAction: "Add what each line names, or rerun add-storybook --project=<project> (--applyEslint for the ESLint lines). Remove a project that no longer exists from toolkit.config.json's storybook.projects."
1309
+ });
1310
+ }
1311
+
1312
+ // ../template-engine/dist/doctor/tailwind-setup-check.js
1313
+ import { posix as posix2 } from "node:path";
1314
+ var VITE_CONFIGS = ["vite.config.mts", "vite.config.ts", "vite.config.mjs", "vite.config.js", "vite.config.cts", "vite.config.cjs"];
1315
+ var POSTCSS_CONFIGS = ["postcss.config.mjs", "postcss.config.js", "postcss.config.cjs", "postcss.config.ts", "postcss.config.mts", "postcss.config.json"];
1316
+ var prefixOf2 = (root) => root === "" || root === "." ? "" : `${root}/`;
1317
+ var within = (path, dir) => dir === "" || dir === "." || path === dir || path.startsWith(`${dir}/`);
1318
+ function globBase(path) {
1319
+ const wildcard = path.search(/[*?[{]/);
1320
+ if (wildcard === -1)
1321
+ return path;
1322
+ const slash = path.lastIndexOf("/", wildcard);
1323
+ return slash === -1 ? "." : path.slice(0, slash);
1324
+ }
1325
+ function appProblems2(root, project, projects) {
1326
+ const files = diskFiles(root);
1327
+ const read = files.read;
1328
+ const exists = (path) => read(path) !== null;
1329
+ const name = project.name;
1330
+ const appDir = prefixOf2(project.root);
1331
+ const src = prefixOf2(project.sourceRoot);
1332
+ const framework = detectFramework({ exists, read, projectRoot: project.root }).id;
1333
+ const problems = [];
1334
+ let stylesheet = null;
1335
+ if (framework === "react-vite") {
1336
+ const configs = VITE_CONFIGS.map((file) => `${appDir}${file}`).filter(exists);
1337
+ if (!configs.some((path) => loadsTailwindVitePlugin(read(path) ?? ""))) {
1338
+ problems.push(`${name}: ${configs[0] ?? `${appDir}vite.config.mts`} does not load @tailwindcss/vite`);
1339
+ }
1340
+ const loaded = loadedViteStylesheets(project, files);
1341
+ const entry = viteTailwindEntry(project, files, loaded);
1342
+ const appLayer = viteAppLayerStylesheet(project.sourceRoot);
1343
+ if (entry !== null) {
1344
+ stylesheet = entry;
1345
+ } else {
1346
+ const css2 = read(appLayer);
1347
+ if (css2 === null) {
1348
+ problems.push(`${name}: no stylesheet the app loads has @import "tailwindcss", and ${appLayer} is missing`);
1349
+ } else {
1350
+ if (!loaded.includes(appLayer)) {
1351
+ problems.push(`${name}: nothing under ${project.sourceRoot} imports ${appLayer} \u2014 add import './styles/index.css'; to ${src}app/app.tsx`);
1352
+ }
1353
+ stylesheet = appLayer;
1354
+ }
1355
+ }
1356
+ } else if (framework === "next") {
1357
+ if (!POSTCSS_CONFIGS.map((file) => `${appDir}${file}`).some((path) => postcssHasTailwind(read(path) ?? ""))) {
1358
+ problems.push(`${name}: no PostCSS config in ${project.root} loads @tailwindcss/postcss`);
1359
+ }
1360
+ stylesheet = tailwindEntryStylesheet({ ...project, framework }, files);
1361
+ if (stylesheet === null) {
1362
+ problems.push(`${name}: ${nextRootLayout(project, files) ?? `${src}app/layout.tsx`} imports no single local stylesheet to load Tailwind from`);
1363
+ }
1364
+ } else {
1365
+ problems.push(`${name}: not a React (Vite) or Next.js app (${framework}) \u2014 add-tailwind supports those two`);
1366
+ }
1367
+ const css = stylesheet === null ? null : read(stylesheet);
1368
+ if (stylesheet !== null && css === null)
1369
+ problems.push(`${name}: ${stylesheet} is missing`);
1370
+ if (stylesheet !== null && css !== null) {
1371
+ if (!hasTailwindImport(css))
1372
+ problems.push(`${name}: ${stylesheet} has no @import "tailwindcss"`);
1373
+ const sources = tailwindSourcePaths(css).map((path) => posix2.normalize(posix2.join(posix2.dirname(stylesheet), globBase(path))));
1374
+ for (const dependency of project.dependencies ?? []) {
1375
+ const library = projects.find((other) => other.packageName === dependency && other.name !== project.name);
1376
+ if (library === void 0 || within(library.root, project.root) || sources.some((source) => within(library.root, source)))
1377
+ continue;
1378
+ const line = tailwindSourceLine(posix2.relative(posix2.dirname(stylesheet), library.root));
1379
+ problems.push(`${name}: depends on ${dependency} (${library.root}), which no @source in ${stylesheet} covers \u2014 add ${line}`);
1380
+ }
1381
+ }
1382
+ return problems;
1383
+ }
1384
+ function buildTailwindSetupCheck(root, projects) {
1385
+ const recorded = recordedToolProjects(root, "tailwind");
1386
+ const base = { id: "tailwind-setup", label: "Tailwind setup" };
1387
+ if (recorded.length === 0) {
1388
+ return createDoctorCheck({ ...base, status: "pass", message: "Tailwind was not added by nx-archweave \u2014 nothing to check", evidence: [] });
1389
+ }
1390
+ if (projects === void 0) {
1391
+ return createDoctorCheck({
1392
+ ...base,
1393
+ status: "warning",
1394
+ message: "Could not read the workspace projects \u2014 the recorded Tailwind apps were not checked",
1395
+ evidence: recorded.map((name) => `recorded: ${name}`),
1396
+ suggestedAction: "Fix the project.json that Nx cannot parse, then run doctor again."
1397
+ });
1398
+ }
1399
+ const problems = recorded.flatMap((name) => {
1400
+ const project = projects.find((candidate) => candidate.name === name);
1401
+ return project === void 0 ? [`recorded project ${name} not found`] : appProblems2(root, project, projects);
1402
+ });
1403
+ if (problems.length === 0) {
1404
+ return createDoctorCheck({ ...base, status: "pass", message: `Tailwind CSS v4 is wired in ${recorded.join(", ")}`, evidence: recorded });
1405
+ }
1406
+ return createDoctorCheck({
1407
+ ...base,
1408
+ status: "warning",
1409
+ message: "Tailwind setup is incomplete in the recorded apps",
1410
+ evidence: problems,
1411
+ suggestedAction: "Add what each line names, or rerun add-tailwind --project=<app>. Remove an app that no longer exists from toolkit.config.json's tailwind.projects."
1412
+ });
1413
+ }
1414
+
1077
1415
  // ../template-engine/dist/doctor/run-doctor-checks.js
1078
1416
  var NOT_APPLICABLE_IDS = [
1079
1417
  "fsd-like-structure",
@@ -1081,6 +1419,8 @@ var NOT_APPLICABLE_IDS = [
1081
1419
  "fsd-rule-anchored",
1082
1420
  "fsd-lint-cache",
1083
1421
  "lint-inputs-spread",
1422
+ "tailwind-setup",
1423
+ "storybook-setup",
1084
1424
  "nx-version",
1085
1425
  "package-manager",
1086
1426
  "workspace-root",
@@ -1129,6 +1469,8 @@ function runDoctorChecks(root, projects, nxSupport) {
1129
1469
  buildFsdRuleAnchoredCheck(root, projects),
1130
1470
  buildLintCacheCheck(root, projects),
1131
1471
  buildLintInputsSpreadCheck(root, projects),
1472
+ buildTailwindSetupCheck(root, projects),
1473
+ buildStorybookSetupCheck(root, projects),
1132
1474
  createDoctorCheck({
1133
1475
  id: "package-manager",
1134
1476
  label: "Package manager",
@@ -1154,8 +1496,9 @@ function runDoctorChecks(root, projects, nxSupport) {
1154
1496
  const overallStatus = computeOverallStatus(checks);
1155
1497
  return { checks, overallStatus };
1156
1498
  }
1157
- var VALIDATED_NX_MAJORS = [23, 24];
1158
- var VALIDATED_RANGE_TEXT = `${VALIDATED_NX_MAJORS[0]}.x\u2013${VALIDATED_NX_MAJORS[VALIDATED_NX_MAJORS.length - 1]}.x`;
1499
+ var VALIDATED_NX_MAJORS = [24];
1500
+ var VALIDATED_RANGE_TEXT = VALIDATED_NX_MAJORS.length === 1 ? `${VALIDATED_NX_MAJORS[0]}.x` : `${VALIDATED_NX_MAJORS[0]}.x\u2013${VALIDATED_NX_MAJORS[VALIDATED_NX_MAJORS.length - 1]}.x`;
1501
+ var NEWEST_VALIDATED_MAJOR = VALIDATED_NX_MAJORS[VALIDATED_NX_MAJORS.length - 1];
1159
1502
  function extractMajor(version) {
1160
1503
  const match = /(\d+)/.exec(version);
1161
1504
  return match ? Number(match[1]) : null;
@@ -1211,6 +1554,16 @@ function buildNxVersionCheck(env, nxSupport) {
1211
1554
  evidence: [`nx@${env.nxVersion}`]
1212
1555
  });
1213
1556
  }
1557
+ if (nxSupport !== void 0 && major >= nxSupport.supportedMajors.min && major <= nxSupport.supportedMajors.max) {
1558
+ return createDoctorCheck({
1559
+ id: "nx-version",
1560
+ label: "Nx version",
1561
+ status: "warning",
1562
+ message: `Nx ${env.nxVersion} is outside the toolkit-validated range (${VALIDATED_RANGE_TEXT}) \u2014 may work, unvalidated`,
1563
+ evidence: [`nx@${env.nxVersion}`],
1564
+ suggestedAction: major < VALIDATED_NX_MAJORS[0] ? `Upgrade to Nx ${NEWEST_VALIDATED_MAJOR}, or stay on @clearlydev/nx-archweave 0.6.x.` : "Proceed with care and report issues; validation for newer majors lands with toolkit updates."
1565
+ });
1566
+ }
1214
1567
  if (major < VALIDATED_NX_MAJORS[0]) {
1215
1568
  return createDoctorCheck({
1216
1569
  id: "nx-version",
@@ -1218,7 +1571,7 @@ function buildNxVersionCheck(env, nxSupport) {
1218
1571
  status: "warning",
1219
1572
  message: `Nx ${env.nxVersion} is below the toolkit-validated range (${VALIDATED_RANGE_TEXT}) \u2014 generator behavior is not guaranteed`,
1220
1573
  evidence: [`nx@${env.nxVersion}`],
1221
- suggestedAction: `Upgrade the workspace to Nx ${VALIDATED_NX_MAJORS[VALIDATED_NX_MAJORS.length - 1]}.x before running the generators.`
1574
+ suggestedAction: `Upgrade the workspace to Nx ${NEWEST_VALIDATED_MAJOR}.x before running the generators.`
1222
1575
  });
1223
1576
  }
1224
1577
  return createDoctorCheck({
@@ -1273,21 +1626,18 @@ function buildFrameworkChecks(env) {
1273
1626
  })
1274
1627
  ];
1275
1628
  }
1276
- function isToolkitManaged(root) {
1277
- return existsSync7(join7(root, "toolkit.config.json"));
1278
- }
1279
1629
  function buildExistingConfigCheck(root) {
1280
- const exists = isToolkitManaged(root);
1630
+ const exists = existsSync7(join9(root, "toolkit.config.json"));
1281
1631
  return createDoctorCheck({
1282
1632
  id: "existing-config",
1283
1633
  label: "toolkit.config.json",
1284
1634
  status: "pass",
1285
- message: exists ? "Found \u2014 the workspace is managed by nx-archweave; init and the generators merge into it, changing only their own fields" : "Not found \u2014 init creates it",
1635
+ message: !exists ? "Not found \u2014 init creates it" : isToolkitManaged(root) ? "Found \u2014 the workspace is managed by nx-archweave; init and the generators merge into it, changing only their own fields" : "Found \u2014 init hasn't set this workspace up yet (no preset recorded); init and the generators merge into it",
1286
1636
  evidence: exists ? ["toolkit.config.json"] : []
1287
1637
  });
1288
1638
  }
1289
1639
  function buildIntegrationManifestCheck(root) {
1290
- const exists = existsSync7(join7(root, "archweave-integrations.json"));
1640
+ const exists = existsSync7(join9(root, "archweave-integrations.json"));
1291
1641
  return createDoctorCheck({
1292
1642
  id: "integration-manifest",
1293
1643
  label: "Integration manifest",
@@ -1297,8 +1647,8 @@ function buildIntegrationManifestCheck(root) {
1297
1647
  });
1298
1648
  }
1299
1649
  function buildAgentRulesCheck(root) {
1300
- const claudeExists = existsSync7(join7(root, "CLAUDE.md"));
1301
- const agentsExists = existsSync7(join7(root, "AGENTS.md"));
1650
+ const claudeExists = existsSync7(join9(root, "CLAUDE.md"));
1651
+ const agentsExists = existsSync7(join9(root, "AGENTS.md"));
1302
1652
  const exists = claudeExists || agentsExists;
1303
1653
  const evidence = [claudeExists && "CLAUDE.md", agentsExists && "AGENTS.md"].filter(Boolean);
1304
1654
  return createDoctorCheck({
@@ -1310,8 +1660,8 @@ function buildAgentRulesCheck(root) {
1310
1660
  });
1311
1661
  }
1312
1662
  function buildGithubTemplatesCheck(root) {
1313
- const issueTemplateExists = existsSync7(join7(root, ".github", "ISSUE_TEMPLATE"));
1314
- const prTemplateExists = existsSync7(join7(root, ".github", "PULL_REQUEST_TEMPLATE.md"));
1663
+ const issueTemplateExists = existsSync7(join9(root, ".github", "ISSUE_TEMPLATE"));
1664
+ const prTemplateExists = existsSync7(join9(root, ".github", "PULL_REQUEST_TEMPLATE.md"));
1315
1665
  const exists = issueTemplateExists || prTemplateExists;
1316
1666
  const managed = isToolkitManaged(root);
1317
1667
  return createDoctorCheck({
@@ -1448,16 +1798,16 @@ function buildIntegrationDoctorChecks(results) {
1448
1798
  }
1449
1799
 
1450
1800
  // ../integrations/dist/config/read-enabled-integrations.js
1451
- import { existsSync as existsSync8, readFileSync as readFileSync6 } from "node:fs";
1452
- import { join as join8 } from "node:path";
1801
+ import { existsSync as existsSync8, readFileSync as readFileSync8 } from "node:fs";
1802
+ import { join as join10 } from "node:path";
1453
1803
  var CONFIG_FILENAME = "toolkit.config.json";
1454
1804
  function readEnabledIntegrationIds(root) {
1455
- const configPath = join8(root, CONFIG_FILENAME);
1805
+ const configPath = join10(root, CONFIG_FILENAME);
1456
1806
  if (!existsSync8(configPath)) {
1457
1807
  return [];
1458
1808
  }
1459
1809
  try {
1460
- const parsed = JSON.parse(readFileSync6(configPath, "utf8"));
1810
+ const parsed = JSON.parse(readFileSync8(configPath, "utf8"));
1461
1811
  const enabled = parsed?.integrations?.enabled;
1462
1812
  return Array.isArray(enabled) && enabled.every((id) => typeof id === "string") ? enabled : [];
1463
1813
  } catch {
@@ -1517,9 +1867,42 @@ async function applyLiveVerification(driftResults, ctx) {
1517
1867
 
1518
1868
  // src/generators/doctor/workspace-checks.ts
1519
1869
  import { getProjects, joinPathFragments } from "@nx/devkit";
1870
+ function packageFacts(tree, root) {
1871
+ const raw = tree.read(joinPathFragments(root, "package.json"), "utf-8");
1872
+ if (raw === null) return {};
1873
+ let pkg;
1874
+ try {
1875
+ pkg = JSON.parse(raw);
1876
+ } catch {
1877
+ return {};
1878
+ }
1879
+ if (typeof pkg !== "object" || pkg === null || Array.isArray(pkg)) return {};
1880
+ const record = pkg;
1881
+ const names = (field) => {
1882
+ const value = record[field];
1883
+ return typeof value === "object" && value !== null && !Array.isArray(value) ? Object.keys(value) : [];
1884
+ };
1885
+ return {
1886
+ ...typeof record["name"] === "string" ? { packageName: record["name"] } : {},
1887
+ dependencies: [.../* @__PURE__ */ new Set([...names("dependencies"), ...names("devDependencies")])]
1888
+ };
1889
+ }
1520
1890
  function doctorProjects(tree) {
1521
1891
  try {
1522
- return [...getProjects(tree).entries()].map(([name, config]) => ({ name, root: config.root, sourceRoot: sourceRootOf(tree, config), tags: config.tags ?? [] })).sort((a, b) => a.name.localeCompare(b.name));
1892
+ const backendTag = readBoundaryTags(readToolkitConfig(tree)).backend;
1893
+ const projects = getProjects(tree);
1894
+ const listed = [...projects.entries()].map(([name, config]) => ({
1895
+ name,
1896
+ root: config.root,
1897
+ sourceRoot: sourceRootOf(tree, config),
1898
+ tags: config.tags ?? [],
1899
+ projectType: resolveProjectType(tree, config.root, config.projectType),
1900
+ ...isEndToEnd(config.root) || isBackend(config.root, config, backendTag) ? { fsdScan: false } : {},
1901
+ ...packageFacts(tree, config.root)
1902
+ }));
1903
+ const rootApp = inferredRootApp(tree, projects);
1904
+ if (rootApp?.kind === "found") listed.push({ name: rootApp.project, root: ".", sourceRoot: rootApp.sourceRoot, tags: [], projectType: "application", ...packageFacts(tree, ".") });
1905
+ return listed.sort((a, b) => a.name.localeCompare(b.name));
1523
1906
  } catch {
1524
1907
  return void 0;
1525
1908
  }
@@ -1662,9 +2045,9 @@ function buildPolicySuggestion(tree, sourceRoot, current) {
1662
2045
  }
1663
2046
 
1664
2047
  // src/generators/doctor/nx-support.ts
1665
- import { readFileSync as readFileSync7 } from "node:fs";
2048
+ import { readFileSync as readFileSync9 } from "node:fs";
1666
2049
  import { createRequire } from "node:module";
1667
- import { join as join9 } from "node:path";
2050
+ import { join as join11 } from "node:path";
1668
2051
  var MAJORS_EITHER_SIDE = 1;
1669
2052
  function majorOf(version) {
1670
2053
  const match = /^(\d+)\./.exec(version.trim());
@@ -1673,7 +2056,7 @@ function majorOf(version) {
1673
2056
  function readOwnDevkitVersion() {
1674
2057
  try {
1675
2058
  const path = createRequire(import.meta.url).resolve("@nx/devkit/package.json");
1676
- const version = JSON.parse(readFileSync7(path, "utf-8")).version;
2059
+ const version = JSON.parse(readFileSync9(path, "utf-8")).version;
1677
2060
  return typeof version === "string" ? version : void 0;
1678
2061
  } catch {
1679
2062
  return void 0;
@@ -1681,7 +2064,7 @@ function readOwnDevkitVersion() {
1681
2064
  }
1682
2065
  function readInstalledNx(root) {
1683
2066
  try {
1684
- const version = JSON.parse(readFileSync7(join9(root, "node_modules", "nx", "package.json"), "utf-8")).version;
2067
+ const version = JSON.parse(readFileSync9(join11(root, "node_modules", "nx", "package.json"), "utf-8")).version;
1685
2068
  return typeof version === "string" ? version : void 0;
1686
2069
  } catch {
1687
2070
  return void 0;