react-doctor 0.4.2-dev.42c339f → 0.4.2-dev.48e61bc

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/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="92822f58-92ef-58d5-8850-2746c0b48fc0")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="8f832498-1354-594d-b3a2-3688f3cf18d5")}catch(e){}}();
3
3
  import { createRequire } from "node:module";
4
4
  import { execFile, execFileSync, spawn, spawnSync } from "node:child_process";
5
5
  import * as path$1 from "node:path";
@@ -8,6 +8,7 @@ import * as fs$1 from "node:fs";
8
8
  import fs, { mkdtempSync, rmSync } from "node:fs";
9
9
  import process$1 from "node:process";
10
10
  import * as Schema from "effect/Schema";
11
+ import * as ts from "typescript";
11
12
  import reactDoctorPlugin, { ALL_REACT_DOCTOR_RULE_KEYS, FRAMEWORK_SPECIFIC_RULE_KEYS, MOTION_LIBRARY_PACKAGES, REACT_COMPILER_RULES, REACT_DOCTOR_RULES } from "oxlint-plugin-react-doctor";
12
13
  import * as Cause from "effect/Cause";
13
14
  import * as Effect from "effect/Effect";
@@ -32,9 +33,8 @@ import * as NodeFileSystem from "@effect/platform-node-shared/NodeFileSystem";
32
33
  import * as NodePath from "@effect/platform-node-shared/NodePath";
33
34
  import * as ChildProcess from "effect/unstable/process/ChildProcess";
34
35
  import { ChildProcessSpawner } from "effect/unstable/process/ChildProcessSpawner";
35
- import * as ts from "typescript";
36
36
  import { gzipSync } from "node:zlib";
37
- import { createHash, randomUUID } from "node:crypto";
37
+ import crypto, { createHash, randomUUID } from "node:crypto";
38
38
  import * as Exit from "effect/Exit";
39
39
  import * as Sentry from "@sentry/node";
40
40
  import { performance } from "node:perf_hooks";
@@ -5151,8 +5151,8 @@ const isFile = (filePath) => {
5151
5151
  return false;
5152
5152
  }
5153
5153
  };
5154
- const SOURCE_FILE_PATTERN = /\.(tsx?|jsx?)$/;
5155
- const GENERATED_BUNDLE_FILE_PATTERN = /\.(iife|umd|global|min)\.js$/i;
5154
+ const SOURCE_FILE_PATTERN = /\.(tsx?|jsx?|mts|mjs)$/;
5155
+ const GENERATED_BUNDLE_FILE_PATTERN = /\.(iife|umd|global|min)\.m?js$/i;
5156
5156
  const MINIFIED_SNIFF_BYTES = 65536;
5157
5157
  const GIT_LS_FILES_MAX_BUFFER_BYTES = 50 * 1024 * 1024;
5158
5158
  const IGNORED_DIRECTORIES = new Set([
@@ -6064,6 +6064,204 @@ const resolveEffectiveReactMajor = (reactVersion, packageJson) => {
6064
6064
  if (peerFloor === null) return hasUpperBoundOnlyPeerRange(peerReactRange) ? null : installedReactMajor;
6065
6065
  return installedReactMajor !== null ? Math.min(installedReactMajor, peerFloor) : peerFloor;
6066
6066
  };
6067
+ const JSX_FILE_PATTERN = /\.(tsx|jsx)$/;
6068
+ const MILLISECONDS_PER_SECOND = 1e3;
6069
+ const SCORE_API_URL = "https://www.react.doctor/api/score";
6070
+ const ENTERPRISE_CONTACT_URL = "https://react.doctor/enterprise";
6071
+ const SHARE_BASE_URL = "https://react.doctor/share";
6072
+ const CI_URL = "https://react.doctor/ci";
6073
+ const GITHUB_ACTIONS_SETUP_URL = "https://www.react.doctor/docs/ci-and-prs/github-actions-setup";
6074
+ const DOCS_URL = "https://react.doctor/docs";
6075
+ const DOCS_RULES_BASE_URL = `${DOCS_URL}/rules`;
6076
+ const FETCH_TIMEOUT_MS = 1e4;
6077
+ const GITHUB_VIEWER_PERMISSION_TIMEOUT_MS = 2e3;
6078
+ const DEFAULT_BRANCH_CANDIDATES = ["main", "master"];
6079
+ const ADOPTABLE_LINT_CONFIG_FILENAMES = [".oxlintrc.json", ".eslintrc.json"];
6080
+ const OXLINT_NODE_REQUIREMENT = "^20.19.0 || >=22.12.0";
6081
+ const GIT_SHOW_MAX_BUFFER_BYTES = 10 * 1024 * 1024;
6082
+ const ES_TARGET_YEAR_BY_NAME = {
6083
+ es3: 1999,
6084
+ es5: 2009,
6085
+ es6: 2015,
6086
+ es2015: 2015,
6087
+ es2016: 2016,
6088
+ es2017: 2017,
6089
+ es2018: 2018,
6090
+ es2019: 2019,
6091
+ es2020: 2020,
6092
+ es2021: 2021,
6093
+ es2022: 2022,
6094
+ es2023: 2023,
6095
+ es2024: 2024,
6096
+ es2025: 2025,
6097
+ esnext: 9999
6098
+ };
6099
+ /**
6100
+ * Project-config files that `StagedFiles.materialize` copies into
6101
+ * the temp directory alongside staged sources so oxlint resolves
6102
+ * `tsconfig` / `package.json` / lint configs the same way it would
6103
+ * in the working tree. Hoisted out of the staged-files helper so
6104
+ * the constant lives next to the rest of the IO budget knobs.
6105
+ */
6106
+ const STAGED_FILES_PROJECT_CONFIG_FILENAMES = [
6107
+ "tsconfig.json",
6108
+ "tsconfig.base.json",
6109
+ "package.json",
6110
+ "doctor.config.ts",
6111
+ "doctor.config.mts",
6112
+ "doctor.config.cts",
6113
+ "doctor.config.js",
6114
+ "doctor.config.mjs",
6115
+ "doctor.config.cjs",
6116
+ "doctor.config.json",
6117
+ "doctor.config.jsonc",
6118
+ "oxlint.json",
6119
+ ".oxlintrc.json"
6120
+ ];
6121
+ const CONFIG_FINGERPRINT_FILENAMES = [
6122
+ "doctor.config.ts",
6123
+ "doctor.config.mts",
6124
+ "doctor.config.cts",
6125
+ "doctor.config.js",
6126
+ "doctor.config.mjs",
6127
+ "doctor.config.cjs",
6128
+ "doctor.config.json",
6129
+ "doctor.config.jsonc",
6130
+ "react-doctor.config.json",
6131
+ "package.json",
6132
+ "pnpm-workspace.yaml",
6133
+ "tsconfig.json",
6134
+ "tsconfig.base.json",
6135
+ ".oxlintrc.json",
6136
+ ".eslintrc.json",
6137
+ "pnpm-lock.yaml",
6138
+ "package-lock.json",
6139
+ "yarn.lock",
6140
+ "bun.lock",
6141
+ "bun.lockb",
6142
+ ".gitignore"
6143
+ ];
6144
+ const CANONICAL_GITHUB_URL = "https://github.com/millionco/react-doctor";
6145
+ const CANONICAL_DISCORD_URL = "https://react.doctor/discord";
6146
+ const SKILL_NAME = "react-doctor";
6147
+ const OXLINT_OUTPUT_MAX_BYTES = 50 * 1024 * 1024;
6148
+ const OXLINT_SPAWN_TIMEOUT_MS = 6e4;
6149
+ const DEAD_CODE_WORKER_MAX_OLD_SPACE_MB = 8192;
6150
+ const RECOMMENDED_PNPM_MINIMUM_RELEASE_AGE_MINUTES = 10080;
6151
+ const DIAGNOSTIC_CATEGORY_BUCKETS = [
6152
+ "Security",
6153
+ "Bugs",
6154
+ "Performance",
6155
+ "Accessibility",
6156
+ "Maintainability"
6157
+ ];
6158
+ const APP_ONLY_RULE_KEYS = new Set([
6159
+ "react-hooks-js/static-components",
6160
+ "react-doctor/no-render-prop-children",
6161
+ "react-doctor/prefer-explicit-variants"
6162
+ ]);
6163
+ const COMPILER_CLEANUP_BUCKET = "compiler-cleanup";
6164
+ const COMPILER_CLEANUP_RULE_KEYS = new Set(["react-doctor/react-compiler-no-manual-memoization"]);
6165
+ const MAX_GLOB_PATTERN_LENGTH_CHARS = 1024;
6166
+ const CONFIG_CACHE_TTL_MS = 300 * 1e3;
6167
+ const TSCONFIG_FILENAME = "tsconfig.json";
6168
+ const isRelativeExtendsValue = (extendsValue) => extendsValue.startsWith("./") || extendsValue.startsWith("../") || path$1.isAbsolute(extendsValue);
6169
+ const ensureJsonExtension = (filePath) => path$1.extname(filePath) === "" ? `${filePath}.json` : filePath;
6170
+ const resolvePackageExtendsPath = (extendsValue, fromConfigDirectory) => {
6171
+ const requireFromConfig = createRequire(path$1.join(fromConfigDirectory, "tsconfig.json"));
6172
+ const candidates = [
6173
+ extendsValue,
6174
+ ensureJsonExtension(extendsValue),
6175
+ `${extendsValue.replace(/\/$/, "")}/tsconfig.json`
6176
+ ];
6177
+ for (const candidate of candidates) try {
6178
+ return requireFromConfig.resolve(candidate);
6179
+ } catch {
6180
+ continue;
6181
+ }
6182
+ return null;
6183
+ };
6184
+ const resolveExtendsPath = (extendsValue, fromConfigDirectory) => {
6185
+ if (isRelativeExtendsValue(extendsValue)) return ensureJsonExtension(path$1.resolve(fromConfigDirectory, extendsValue));
6186
+ return resolvePackageExtendsPath(extendsValue, fromConfigDirectory);
6187
+ };
6188
+ const normalizeCompilerOptions = (compilerOptions) => {
6189
+ if (!isPlainObject(compilerOptions)) return { hasExplicitLib: false };
6190
+ const target = typeof compilerOptions.target === "string" ? compilerOptions.target : void 0;
6191
+ const hasExplicitLib = Object.hasOwn(compilerOptions, "lib");
6192
+ return {
6193
+ target,
6194
+ lib: Array.isArray(compilerOptions.lib) ? compilerOptions.lib.filter((entry) => typeof entry === "string") : void 0,
6195
+ hasExplicitLib
6196
+ };
6197
+ };
6198
+ const readTsConfig = (filePath) => {
6199
+ let content;
6200
+ try {
6201
+ content = fs$1.readFileSync(filePath, "utf-8");
6202
+ } catch {
6203
+ return null;
6204
+ }
6205
+ const parsed = ts.parseConfigFileTextToJson(filePath, content);
6206
+ if (!isPlainObject(parsed.config)) return null;
6207
+ return {
6208
+ extends: typeof parsed.config.extends === "string" ? parsed.config.extends : void 0,
6209
+ compilerOptions: normalizeCompilerOptions(parsed.config.compilerOptions)
6210
+ };
6211
+ };
6212
+ const mergeCompilerOptions = (inherited, current) => {
6213
+ const target = current.target ?? inherited?.target;
6214
+ const hasExplicitLib = current.hasExplicitLib || Boolean(inherited?.hasExplicitLib);
6215
+ return {
6216
+ target,
6217
+ lib: current.hasExplicitLib ? current.lib : inherited?.lib,
6218
+ hasExplicitLib
6219
+ };
6220
+ };
6221
+ const readResolvedCompilerOptions = (tsConfigPath, extendsDepth, visitedPaths) => {
6222
+ const realPath = fs$1.realpathSync.native(tsConfigPath);
6223
+ if (visitedPaths.has(realPath)) return null;
6224
+ const tsConfig = readTsConfig(realPath);
6225
+ if (!tsConfig) return null;
6226
+ const nextVisitedPaths = new Set(visitedPaths);
6227
+ nextVisitedPaths.add(realPath);
6228
+ if (tsConfig.extends && extendsDepth < 8) {
6229
+ const parentPath = resolveExtendsPath(tsConfig.extends, path$1.dirname(realPath));
6230
+ if (parentPath && isFile(parentPath)) return mergeCompilerOptions(readResolvedCompilerOptions(parentPath, extendsDepth + 1, nextVisitedPaths), tsConfig.compilerOptions);
6231
+ }
6232
+ return tsConfig.compilerOptions;
6233
+ };
6234
+ const targetYearIsPreES2023 = (target) => {
6235
+ const year = ES_TARGET_YEAR_BY_NAME[target.toLowerCase()];
6236
+ return year !== void 0 && year < 2023;
6237
+ };
6238
+ const libEntryIncludesES2023Array = (entry) => {
6239
+ const normalizedEntry = entry.toLowerCase();
6240
+ if (normalizedEntry === "esnext" || normalizedEntry === "esnext.array") return true;
6241
+ const esYearMatch = /^es(\d{4})(?:\.(.+))?$/.exec(normalizedEntry);
6242
+ if (!esYearMatch) return false;
6243
+ if (Number(esYearMatch[1]) < 2023) return false;
6244
+ const component = esYearMatch[2];
6245
+ return component === void 0 || component === "array";
6246
+ };
6247
+ const libIncludesES2023 = (lib) => lib.some(libEntryIncludesES2023Array);
6248
+ const compilerOptionsArePreES2023 = (compilerOptions) => {
6249
+ if (compilerOptions.hasExplicitLib) return !libIncludesES2023(compilerOptions.lib ?? []);
6250
+ if (compilerOptions.target) return targetYearIsPreES2023(compilerOptions.target);
6251
+ return false;
6252
+ };
6253
+ const compilerOptionsDeclareTargetOrLib = (compilerOptions) => compilerOptions.hasExplicitLib || compilerOptions.target !== void 0;
6254
+ const detectPreES2023FromConfig = (tsConfigPath) => {
6255
+ const compilerOptions = readResolvedCompilerOptions(tsConfigPath, 0, /* @__PURE__ */ new Set());
6256
+ if (!compilerOptions) return false;
6257
+ if (!compilerOptionsDeclareTargetOrLib(compilerOptions)) return false;
6258
+ return compilerOptionsArePreES2023(compilerOptions);
6259
+ };
6260
+ const detectPreES2023Target = (directory) => {
6261
+ const tsConfigPath = path$1.join(directory, TSCONFIG_FILENAME);
6262
+ if (isFile(tsConfigPath)) return detectPreES2023FromConfig(tsConfigPath);
6263
+ return false;
6264
+ };
6067
6265
  const REACT_DEPENDENCY_NAMES = new Set([
6068
6266
  "react",
6069
6267
  "react-native",
@@ -6265,6 +6463,7 @@ const discoverProject = (directory) => {
6265
6463
  version: findNextjsVersion(directory, packageJson)
6266
6464
  }) : null;
6267
6465
  const preactVersion = getPreactVersion(packageJson);
6466
+ const isPreES2023Target = hasTypeScript && detectPreES2023Target(directory);
6268
6467
  const projectInfo = {
6269
6468
  rootDirectory: directory,
6270
6469
  projectName,
@@ -6286,6 +6485,7 @@ const discoverProject = (directory) => {
6286
6485
  shopifyFlashListVersion,
6287
6486
  shopifyFlashListMajorVersion: shopifyFlashListVersion === null ? null : getLowestDependencyMajor(shopifyFlashListVersion),
6288
6487
  hasReanimated,
6488
+ isPreES2023Target,
6289
6489
  sourceFileCount
6290
6490
  };
6291
6491
  cachedProjectInfos.set(directory, projectInfo);
@@ -6355,66 +6555,6 @@ const isTailwindAtLeast = (detected, required) => {
6355
6555
  if (detected.major !== required.major) return detected.major > required.major;
6356
6556
  return detected.minor >= required.minor;
6357
6557
  };
6358
- const JSX_FILE_PATTERN = /\.(tsx|jsx)$/;
6359
- const MILLISECONDS_PER_SECOND = 1e3;
6360
- const SCORE_API_URL = "https://www.react.doctor/api/score";
6361
- const ENTERPRISE_CONTACT_URL = "https://react.doctor/enterprise";
6362
- const SHARE_BASE_URL = "https://react.doctor/share";
6363
- const CI_URL = "https://react.doctor/ci";
6364
- const GITHUB_ACTIONS_SETUP_URL = "https://www.react.doctor/docs/ci-and-prs/github-actions-setup";
6365
- const DOCS_URL = "https://react.doctor/docs";
6366
- const DOCS_RULES_BASE_URL = `${DOCS_URL}/rules`;
6367
- const FETCH_TIMEOUT_MS = 1e4;
6368
- const GITHUB_VIEWER_PERMISSION_TIMEOUT_MS = 2e3;
6369
- const DEFAULT_BRANCH_CANDIDATES = ["main", "master"];
6370
- const ADOPTABLE_LINT_CONFIG_FILENAMES = [".oxlintrc.json", ".eslintrc.json"];
6371
- const OXLINT_NODE_REQUIREMENT = "^20.19.0 || >=22.12.0";
6372
- const GIT_SHOW_MAX_BUFFER_BYTES = 10 * 1024 * 1024;
6373
- /**
6374
- * Project-config files that `StagedFiles.materialize` copies into
6375
- * the temp directory alongside staged sources so oxlint resolves
6376
- * `tsconfig` / `package.json` / lint configs the same way it would
6377
- * in the working tree. Hoisted out of the staged-files helper so
6378
- * the constant lives next to the rest of the IO budget knobs.
6379
- */
6380
- const STAGED_FILES_PROJECT_CONFIG_FILENAMES = [
6381
- "tsconfig.json",
6382
- "tsconfig.base.json",
6383
- "package.json",
6384
- "doctor.config.ts",
6385
- "doctor.config.mts",
6386
- "doctor.config.cts",
6387
- "doctor.config.js",
6388
- "doctor.config.mjs",
6389
- "doctor.config.cjs",
6390
- "doctor.config.json",
6391
- "doctor.config.jsonc",
6392
- "oxlint.json",
6393
- ".oxlintrc.json"
6394
- ];
6395
- const CANONICAL_GITHUB_URL = "https://github.com/millionco/react-doctor";
6396
- const CANONICAL_DISCORD_URL = "https://react.doctor/discord";
6397
- const SKILL_NAME = "react-doctor";
6398
- const OXLINT_OUTPUT_MAX_BYTES = 50 * 1024 * 1024;
6399
- const OXLINT_SPAWN_TIMEOUT_MS = 6e4;
6400
- const DEAD_CODE_WORKER_MAX_OLD_SPACE_MB = 8192;
6401
- const RECOMMENDED_PNPM_MINIMUM_RELEASE_AGE_MINUTES = 10080;
6402
- const DIAGNOSTIC_CATEGORY_BUCKETS = [
6403
- "Security",
6404
- "Bugs",
6405
- "Performance",
6406
- "Accessibility",
6407
- "Maintainability"
6408
- ];
6409
- const APP_ONLY_RULE_KEYS = new Set([
6410
- "react-hooks-js/static-components",
6411
- "react-doctor/no-render-prop-children",
6412
- "react-doctor/prefer-explicit-variants"
6413
- ]);
6414
- const COMPILER_CLEANUP_BUCKET = "compiler-cleanup";
6415
- const COMPILER_CLEANUP_RULE_KEYS = new Set(["react-doctor/react-compiler-no-manual-memoization"]);
6416
- const MAX_GLOB_PATTERN_LENGTH_CHARS = 1024;
6417
- const CONFIG_CACHE_TTL_MS = 300 * 1e3;
6418
6558
  var InvalidGlobPatternError = class extends Error {
6419
6559
  pattern;
6420
6560
  reason;
@@ -6725,7 +6865,6 @@ const LEGACY_RULE_KEY_TO_NATIVE_RULE_KEY = {
6725
6865
  "react/jsx-no-new-function-as-prop": "react-doctor/jsx-no-new-function-as-prop",
6726
6866
  "react/jsx-no-new-object-as-prop": "react-doctor/jsx-no-new-object-as-prop",
6727
6867
  "react/jsx-no-script-url": "react-doctor/jsx-no-script-url",
6728
- "react/jsx-no-target-blank": "react-doctor/jsx-no-target-blank",
6729
6868
  "react/jsx-no-undef": "react-doctor/jsx-no-undef",
6730
6869
  "react/jsx-no-useless-fragment": "react-doctor/jsx-no-useless-fragment",
6731
6870
  "react/jsx-pascal-case": "react-doctor/jsx-pascal-case",
@@ -7921,51 +8060,51 @@ const FLAGGED_DEPENDENCIES = [
7921
8060
  {
7922
8061
  packageName: "expo-modules-autolinking",
7923
8062
  rule: "expo-no-redundant-dependency",
7924
- message: "\"expo-modules-autolinking\" should not be a direct dependency — Expo installs it transitively as needed",
8063
+ message: "\"expo-modules-autolinking\" should not be a direct dependency. Expo pins the compatible version through the SDK, and a direct entry can drift to a version that breaks prebuild, Metro, or native builds",
7925
8064
  help: "Remove `expo-modules-autolinking` from your package.json"
7926
8065
  },
7927
8066
  {
7928
8067
  packageName: "expo-dev-launcher",
7929
8068
  rule: "expo-no-redundant-dependency",
7930
- message: "\"expo-dev-launcher\" should not be a direct dependency — it is pulled in by `expo-dev-client`",
8069
+ message: "\"expo-dev-launcher\" should not be a direct dependency. `expo-dev-client` pins the compatible launcher, and a direct entry can drift to a version that breaks native builds",
7931
8070
  help: "Remove `expo-dev-launcher` and depend on `expo-dev-client` instead"
7932
8071
  },
7933
8072
  {
7934
8073
  packageName: "expo-dev-menu",
7935
8074
  rule: "expo-no-redundant-dependency",
7936
- message: "\"expo-dev-menu\" should not be a direct dependency — it is pulled in by `expo-dev-client`",
8075
+ message: "\"expo-dev-menu\" should not be a direct dependency. `expo-dev-client` pins the compatible dev menu, and a direct entry can drift to a version that breaks native builds",
7937
8076
  help: "Remove `expo-dev-menu` and depend on `expo-dev-client` instead"
7938
8077
  },
7939
8078
  {
7940
8079
  packageName: "expo-modules-core",
7941
8080
  rule: "expo-no-redundant-dependency",
7942
- message: "\"expo-modules-core\" should not be a direct dependency — use the API re-exported from the `expo` package",
8081
+ message: "\"expo-modules-core\" should not be a direct dependency. Expo pins the compatible native core, and a direct entry can drift to a version that breaks prebuild or native builds",
7943
8082
  help: "Remove `expo-modules-core` from your package.json and import from `expo` instead"
7944
8083
  },
7945
8084
  {
7946
8085
  packageName: "@expo/metro-config",
7947
8086
  rule: "expo-no-redundant-dependency",
7948
- message: "\"@expo/metro-config\" should not be a direct dependency — use the `expo/metro-config` sub-export of the `expo` package",
8087
+ message: "\"@expo/metro-config\" should not be a direct dependency. Expo pins the compatible Metro config, and a direct entry can drift to a version that breaks bundling",
7949
8088
  help: "Remove `@expo/metro-config` and import `expo/metro-config` in your metro.config.js"
7950
8089
  },
7951
8090
  {
7952
8091
  packageName: "@types/react-native",
7953
8092
  rule: "expo-no-redundant-dependency",
7954
- message: "\"@types/react-native\" should not be installed — React Native ships its own types since SDK 48",
8093
+ message: "\"@types/react-native\" should not be installed. React Native ships its own types since SDK 48, so the extra package can introduce duplicate or stale type definitions",
7955
8094
  help: "Remove `@types/react-native` from your package.json",
7956
8095
  minSdkMajor: 48
7957
8096
  },
7958
8097
  {
7959
8098
  packageName: "@expo/config-plugins",
7960
8099
  rule: "expo-no-redundant-dependency",
7961
- message: "\"@expo/config-plugins\" should not be a direct dependency — use the `expo/config-plugins` sub-export of the `expo` package",
8100
+ message: "\"@expo/config-plugins\" should not be a direct dependency. Expo pins the compatible config-plugin API, and a direct entry can drift to a version that breaks prebuild",
7962
8101
  help: "Remove `@expo/config-plugins`; config-plugin authors should import from `expo/config-plugins`. See https://github.com/expo/expo/pull/18855",
7963
8102
  minSdkMajor: 48
7964
8103
  },
7965
8104
  {
7966
8105
  packageName: "@expo/prebuild-config",
7967
8106
  rule: "expo-no-redundant-dependency",
7968
- message: "\"@expo/prebuild-config\" should not be a direct dependency — Expo installs it transitively",
8107
+ message: "\"@expo/prebuild-config\" should not be a direct dependency. Expo pins the compatible prebuild config, and a direct entry can drift to a version that breaks prebuild",
7969
8108
  help: "Remove `@expo/prebuild-config` from your package.json",
7970
8109
  minSdkMajor: 53
7971
8110
  },
@@ -7979,28 +8118,28 @@ const FLAGGED_DEPENDENCIES = [
7979
8118
  {
7980
8119
  packageName: "expo-app-loading",
7981
8120
  rule: "expo-no-redundant-dependency",
7982
- message: "\"expo-app-loading\" was removed in SDK 49",
8121
+ message: "\"expo-app-loading\" was removed in SDK 49, so keeping it can leave imports unresolved after upgrading Expo",
7983
8122
  help: "Remove `expo-app-loading` and use `expo-splash-screen` instead. See https://docs.expo.dev/versions/latest/sdk/splash-screen/",
7984
8123
  minSdkMajor: 49
7985
8124
  },
7986
8125
  {
7987
8126
  packageName: "expo-firebase-analytics",
7988
8127
  rule: "expo-no-redundant-dependency",
7989
- message: "\"expo-firebase-analytics\" was removed in SDK 48",
8128
+ message: "\"expo-firebase-analytics\" was removed in SDK 48, so keeping it can leave imports unresolved or fail native builds after upgrading Expo",
7990
8129
  help: FIREBASE_HELP,
7991
8130
  minSdkMajor: 48
7992
8131
  },
7993
8132
  {
7994
8133
  packageName: "expo-firebase-recaptcha",
7995
8134
  rule: "expo-no-redundant-dependency",
7996
- message: "\"expo-firebase-recaptcha\" was removed in SDK 48",
8135
+ message: "\"expo-firebase-recaptcha\" was removed in SDK 48, so keeping it can leave imports unresolved or fail native builds after upgrading Expo",
7997
8136
  help: FIREBASE_HELP,
7998
8137
  minSdkMajor: 48
7999
8138
  },
8000
8139
  {
8001
8140
  packageName: "expo-firebase-core",
8002
8141
  rule: "expo-no-redundant-dependency",
8003
- message: "\"expo-firebase-core\" was removed in SDK 48",
8142
+ message: "\"expo-firebase-core\" was removed in SDK 48, so keeping it can leave imports unresolved or fail native builds after upgrading Expo",
8004
8143
  help: FIREBASE_HELP,
8005
8144
  minSdkMajor: 48
8006
8145
  }
@@ -8041,7 +8180,7 @@ const checkExpoGitignore = (context) => {
8041
8180
  }));
8042
8181
  if (findLocalModuleNativeFiles(rootDirectory).find((nativeFilePath) => isPathGitIgnored(rootDirectory, nativeFilePath) === true) !== void 0) diagnostics.push(buildExpoDiagnostic({
8043
8182
  rule: "expo-gitignore",
8044
- message: "The native `ios`/`android` directories of a local Expo module under `modules/` are gitignored — usually caused by an overly broad `ios`/`android` ignore rule",
8183
+ message: "The native `ios`/`android` directories of a local Expo module under `modules/` are gitignored, so required native code can be missing from CI or teammate checkouts.",
8045
8184
  help: "Use anchored patterns like `/ios` and `/android` in .gitignore so only the top-level native directories are excluded, not those inside `modules/`"
8046
8185
  }));
8047
8186
  return diagnostics;
@@ -8103,17 +8242,16 @@ const checkExpoPackageJsonConflicts = (context) => {
8103
8242
  const conflictingScriptNames = CONFLICTING_SCRIPT_NAMES.filter((scriptName) => Boolean(packageJson.scripts?.[scriptName]));
8104
8243
  if (conflictingScriptNames.length > 0) {
8105
8244
  const quotedNames = conflictingScriptNames.map((name) => `"${name}"`).join(", ");
8106
- const shadowsExpoCli = conflictingScriptNames.includes("expo");
8107
8245
  diagnostics.push(buildExpoDiagnostic({
8108
8246
  rule: "expo-package-json-conflict",
8109
- message: `package.json defines ${quotedNames} ${conflictingScriptNames.length === 1 ? "as a script that conflicts" : "as scripts that conflict"} with binaries in node_modules/.bin${shadowsExpoCli ? " — a `expo` script shadows the Expo CLI and will likely cause build failures" : ""}`,
8247
+ message: `package.json defines ${quotedNames} ${conflictingScriptNames.length === 1 ? "as a script that shadows" : "as scripts that shadow"} Expo/React Native binaries in node_modules/.bin, so tooling can run the local script instead of the expected CLI and fail builds.`,
8110
8248
  help: "Rename these scripts so they don't collide with the `expo` / `react-native` binaries"
8111
8249
  }));
8112
8250
  }
8113
8251
  const packageName = packageJson.name;
8114
8252
  if (typeof packageName === "string" && context.directDependencyNames.has(packageName)) diagnostics.push(buildExpoDiagnostic({
8115
8253
  rule: "expo-package-json-conflict",
8116
- message: `package.json "name" is "${packageName}", which collides with a dependency of the same name`,
8254
+ message: `package.json "name" is "${packageName}", which collides with a dependency of the same name, so package self-resolution can shadow the dependency and break imports that expect the installed package.`,
8117
8255
  help: "Rename your package so it no longer matches one of its dependencies"
8118
8256
  }));
8119
8257
  return diagnostics;
@@ -8184,7 +8322,7 @@ const checkExpoRouterReactNavigation = (context) => {
8184
8322
  if (reactNavigationNames.length === 0) return [];
8185
8323
  return [buildExpoDiagnostic({
8186
8324
  rule: "expo-router-no-react-navigation",
8187
- message: `As of SDK 56, expo-router is no longer compatible with react-navigation, but ${reactNavigationNames.map((name) => `"${name}"`).join(", ")} ${reactNavigationNames.length === 1 ? "is" : "are"} installed as direct ${reactNavigationNames.length === 1 ? "dependency" : "dependencies"}`,
8325
+ message: `As of SDK 56, expo-router is no longer compatible with directly installed @react-navigation packages, so keeping ${reactNavigationNames.map((name) => `"${name}"`).join(", ")} can break routing or linking behavior after the SDK upgrade.`,
8188
8326
  help: "Remove these `@react-navigation/*` packages and replace direct imports with their expo-router equivalents. See https://docs.expo.dev/router/migrate/sdk-55-to-56/"
8189
8327
  })];
8190
8328
  };
@@ -8556,7 +8694,9 @@ const setColorEnabled = (enabled) => {
8556
8694
  highlighter.gray = colors.gray;
8557
8695
  highlighter.bold = colors.bold;
8558
8696
  };
8559
- const computeJsxIncludePaths = (includePaths) => includePaths.length > 0 ? includePaths.filter((filePath) => JSX_FILE_PATTERN.test(filePath)) : void 0;
8697
+ const NEXT_ENTRY_FILE_PATTERN = /^(?:\.\/)?(?:src\/)?(?:middleware|proxy)\.(?:tsx?|jsx?|mts|mjs)$/;
8698
+ const shouldIncludeExplicitLintPath = (filePath, project) => JSX_FILE_PATTERN.test(filePath) || project?.framework === "nextjs" && NEXT_ENTRY_FILE_PATTERN.test(filePath);
8699
+ const computeExplicitLintIncludePaths = (includePaths, project) => includePaths.length > 0 ? includePaths.filter((filePath) => shouldIncludeExplicitLintPath(filePath, project)) : void 0;
8560
8700
  const LINGUIST_ATTRIBUTE_PATTERN = /^linguist-(?:vendored|generated)(?:=([a-zA-Z0-9]+))?$/i;
8561
8701
  const FALSY_VALUES = new Set([
8562
8702
  "false",
@@ -8636,7 +8776,7 @@ const collectIgnorePatterns = (rootDirectory) => {
8636
8776
  return patterns;
8637
8777
  };
8638
8778
  const KNIP_JSON_FILENAME = "knip.json";
8639
- const isRecord$1 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
8779
+ const isRecord$1$1 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
8640
8780
  const readJsonFileSafe = (filePath) => {
8641
8781
  let rawContents;
8642
8782
  try {
@@ -8652,10 +8792,10 @@ const readJsonFileSafe = (filePath) => {
8652
8792
  };
8653
8793
  const readKnipConfig = (rootDirectory) => {
8654
8794
  const knipJson = readJsonFileSafe(path.join(rootDirectory, KNIP_JSON_FILENAME));
8655
- if (isRecord$1(knipJson)) return knipJson;
8795
+ if (isRecord$1$1(knipJson)) return knipJson;
8656
8796
  const packageJson = readJsonFileSafe(path.join(rootDirectory, "package.json"));
8657
- const packageKnipConfig = isRecord$1(packageJson) ? packageJson.knip : null;
8658
- return isRecord$1(packageKnipConfig) ? packageKnipConfig : null;
8797
+ const packageKnipConfig = isRecord$1$1(packageJson) ? packageJson.knip : null;
8798
+ return isRecord$1$1(packageKnipConfig) ? packageKnipConfig : null;
8659
8799
  };
8660
8800
  const normalizePatternList = (value) => {
8661
8801
  if (typeof value === "string" && value.length > 0) return [value];
@@ -8667,10 +8807,10 @@ const prefixWorkspacePatterns = (workspacePattern, patterns) => {
8667
8807
  return patterns.map((pattern) => pattern.startsWith("!") ? `!${normalizedWorkspacePattern}/${pattern.slice(1)}` : `${normalizedWorkspacePattern}/${pattern}`);
8668
8808
  };
8669
8809
  const collectKnipWorkspacePatterns = (workspaces, settingName) => {
8670
- if (!isRecord$1(workspaces)) return [];
8810
+ if (!isRecord$1$1(workspaces)) return [];
8671
8811
  const patterns = [];
8672
8812
  for (const [workspacePattern, workspaceConfig] of Object.entries(workspaces)) {
8673
- if (!isRecord$1(workspaceConfig)) continue;
8813
+ if (!isRecord$1$1(workspaceConfig)) continue;
8674
8814
  patterns.push(...prefixWorkspacePatterns(workspacePattern, normalizePatternList(workspaceConfig[settingName])));
8675
8815
  }
8676
8816
  return patterns;
@@ -8982,7 +9122,7 @@ const checkDeadCode = async (options) => {
8982
9122
  plugin: DEAD_CODE_PLUGIN,
8983
9123
  rule: "unused-file",
8984
9124
  severity: "warning",
8985
- message: "Unused file — not reachable from any entry point",
9125
+ message: "Unused file is not reachable from any entry point, so it adds maintenance surface without shipping any code.",
8986
9126
  help: "Delete the file if it is truly unreachable, or import it from an entry point.",
8987
9127
  line: 0,
8988
9128
  column: 0,
@@ -8995,7 +9135,7 @@ const checkDeadCode = async (options) => {
8995
9135
  plugin: DEAD_CODE_PLUGIN,
8996
9136
  rule: unusedExport.isTypeOnly ? "unused-type" : "unused-export",
8997
9137
  severity: "warning",
8998
- message: `Unused ${label}: \`${unusedExport.name}\``,
9138
+ message: `Unused ${label}: \`${unusedExport.name}\` is exported but no module imports it, so it expands the public surface and can mislead callers about supported API.`,
8999
9139
  help: "Drop the `export` keyword (or remove the declaration) if no other module uses this symbol.",
9000
9140
  line: unusedExport.line,
9001
9141
  column: unusedExport.column,
@@ -9010,7 +9150,7 @@ const checkDeadCode = async (options) => {
9010
9150
  rule: unusedDependency.isDevDependency ? "unused-dev-dependency" : "unused-dependency",
9011
9151
  severity: "warning",
9012
9152
  message: `Unused ${label}: \`${unusedDependency.name}\``,
9013
- help: "Remove the dependency from package.json if it is genuinely unused.",
9153
+ help: `An unused ${label} adds install time and supply-chain surface without being used; remove it from package.json if it is genuinely unused.`,
9014
9154
  line: 0,
9015
9155
  column: 0,
9016
9156
  category: DEAD_CODE_CATEGORY
@@ -9023,7 +9163,7 @@ const checkDeadCode = async (options) => {
9023
9163
  plugin: DEAD_CODE_PLUGIN,
9024
9164
  rule: "circular-dependency",
9025
9165
  severity: "warning",
9026
- message: `Circular import cycle: ${cycle.files.map(toRelative).join(" → ")}`,
9166
+ message: `Circular import cycle: ${cycle.files.map(toRelative).join(" → ")}. Modules in the cycle can observe partially initialized exports, causing order-dependent bugs.`,
9027
9167
  help: "Break the cycle by extracting the shared code into a third module that both files import.",
9028
9168
  line: 0,
9029
9169
  column: 0,
@@ -9106,11 +9246,11 @@ const listSourceFilesViaFilesystem = (rootDirectory) => {
9106
9246
  return filePaths;
9107
9247
  };
9108
9248
  const listSourceFiles = (rootDirectory) => excludeMinifiedFiles(rootDirectory, listSourceFilesViaGit(rootDirectory) ?? listSourceFilesViaFilesystem(rootDirectory));
9109
- const resolveLintIncludePaths = (rootDirectory, userConfig) => {
9249
+ const resolveLintIncludePaths = (rootDirectory, userConfig, project) => {
9110
9250
  if (!Array.isArray(userConfig?.ignore?.files) || userConfig.ignore.files.length === 0) return;
9111
9251
  const ignoredPatterns = compileIgnoredFilePatterns(userConfig);
9112
9252
  return listSourceFiles(rootDirectory).filter((filePath) => {
9113
- if (!JSX_FILE_PATTERN.test(filePath)) return false;
9253
+ if (!shouldIncludeExplicitLintPath(filePath, project)) return false;
9114
9254
  return !isFileIgnoredByPatterns(filePath, rootDirectory, ignoredPatterns);
9115
9255
  });
9116
9256
  };
@@ -9838,6 +9978,7 @@ const buildCapabilities = (project) => {
9838
9978
  capabilities.add("zod");
9839
9979
  if (project.zodMajorVersion !== null && project.zodMajorVersion >= 4) capabilities.add("zod:4");
9840
9980
  }
9981
+ if (project.isPreES2023Target) capabilities.add("pre-es2023");
9841
9982
  if (project.hasReactCompiler) capabilities.add("react-compiler");
9842
9983
  if (project.hasTanStackQuery) capabilities.add("tanstack-query");
9843
9984
  if (project.hasTypeScript) capabilities.add("typescript");
@@ -9890,16 +10031,16 @@ const readPluginShape = (pluginSpecifier, loadModule) => {
9890
10031
  ruleNames: new Set(Object.keys(rules))
9891
10032
  };
9892
10033
  };
9893
- const bundledRequire = createRequire(import.meta.url);
10034
+ const bundledRequire$1 = createRequire(import.meta.url);
9894
10035
  const resolveReactHooksJsPlugin = (hasReactCompiler, customRulesOnly) => {
9895
10036
  if (!hasReactCompiler || customRulesOnly) return null;
9896
10037
  let pluginSpecifier;
9897
10038
  try {
9898
- pluginSpecifier = bundledRequire.resolve("eslint-plugin-react-hooks");
10039
+ pluginSpecifier = bundledRequire$1.resolve("eslint-plugin-react-hooks");
9899
10040
  } catch {
9900
10041
  return null;
9901
10042
  }
9902
- const { ruleNames } = readPluginShape(pluginSpecifier, (spec) => bundledRequire(spec));
10043
+ const { ruleNames } = readPluginShape(pluginSpecifier, (spec) => bundledRequire$1(spec));
9903
10044
  return {
9904
10045
  entry: {
9905
10046
  name: "react-hooks-js",
@@ -11462,7 +11603,7 @@ const runInspect = (input, hooks = {}) => Effect.gen(function* () {
11462
11603
  directory: scanDirectory,
11463
11604
  repo
11464
11605
  }).pipe(Effect.orElseSucceed(() => null)) : Effect.succeed(null));
11465
- const lintIncludePaths = (input.skipJsxIncludeFilter ? input.includePaths.length > 0 ? [...input.includePaths] : void 0 : computeJsxIncludePaths([...input.includePaths])) ?? resolveLintIncludePaths(scanDirectory, resolvedConfig.config);
11606
+ const lintIncludePaths = (input.skipJsxIncludeFilter ? input.includePaths.length > 0 ? [...input.includePaths] : void 0 : computeExplicitLintIncludePaths([...input.includePaths], project)) ?? resolveLintIncludePaths(scanDirectory, resolvedConfig.config, project);
11466
11607
  const scannedFilePaths = input.suppressScanSummary ? (lintIncludePaths ?? (yield* filesService.listSourceFiles(scanDirectory))).map((relativePath) => path$1.resolve(scanDirectory, relativePath)) : [];
11467
11608
  const beforeLint = hooks.beforeLint ?? NO_HOOKS.beforeLint;
11468
11609
  const afterLint = hooks.afterLint ?? NO_HOOKS.afterLint;
@@ -12048,6 +12189,22 @@ const filterSourceFiles = (filePaths) => filePaths.filter(isLintableSourceFile);
12048
12189
  * instead of being improvised per diagnostic.
12049
12190
  */
12050
12191
  const buildRuleDocsUrl = (plugin, rule) => `${DOCS_RULES_BASE_URL}/${plugin}/${rule}`;
12192
+ const computeConfigFingerprint = (projectDirectory, version) => {
12193
+ const parts = [`v=${version}`];
12194
+ let directory = projectDirectory;
12195
+ for (;;) {
12196
+ for (const filename of CONFIG_FINGERPRINT_FILENAMES) try {
12197
+ const stat = fs.statSync(path.join(directory, filename));
12198
+ parts.push(`${directory}/${filename}=${stat.mtimeMs}:${stat.size}`);
12199
+ } catch {
12200
+ continue;
12201
+ }
12202
+ const parent = path.dirname(directory);
12203
+ if (parent === directory) break;
12204
+ directory = parent;
12205
+ }
12206
+ return crypto.createHash("sha1").update(parts.join("|")).digest("hex");
12207
+ };
12051
12208
  const groupBy = (items, keyFn) => {
12052
12209
  const groups = /* @__PURE__ */ new Map();
12053
12210
  for (const item of items) {
@@ -12248,7 +12405,7 @@ const makeNoopConsole = () => ({
12248
12405
  });
12249
12406
  //#endregion
12250
12407
  //#region src/cli/utils/version.ts
12251
- const VERSION = "0.4.2-dev.42c339f";
12408
+ const VERSION = "0.4.2-dev.48e61bc";
12252
12409
  //#endregion
12253
12410
  //#region src/cli/utils/json-mode.ts
12254
12411
  let context = null;
@@ -12606,13 +12763,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
12606
12763
  * uploads source-map artifacts under, so stack frames symbolicate. Honors the
12607
12764
  * standard `SENTRY_RELEASE` override.
12608
12765
  */
12609
- const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.4.2-dev.42c339f`;
12766
+ const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.4.2-dev.48e61bc`;
12610
12767
  /**
12611
12768
  * Deployment environment shown in Sentry's environment filter. Defaults to
12612
12769
  * `production` for tagged releases and `development` for dev/unbuilt versions,
12613
12770
  * overridable via the standard `SENTRY_ENVIRONMENT` env var.
12614
12771
  */
12615
- const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.4.2-dev.42c339f") ? "development" : "production");
12772
+ const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.4.2-dev.48e61bc") ? "development" : "production");
12616
12773
  /**
12617
12774
  * Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
12618
12775
  * (set to `0` to disable tracing) and falls back to
@@ -15875,13 +16032,14 @@ const buildRuntimeLayers = (input) => {
15875
16032
  const linterLayer = input.shouldSkipLint ? Linter.layerOf([]) : Linter.layerOxlint;
15876
16033
  const deadCodeLayer = input.shouldRunDeadCode ? DeadCode.layerNode : DeadCode.layerOf([]);
15877
16034
  const scoreLayer = input.shouldComputeScore ? Score.layerHttp : Score.layerOf(null);
16035
+ const projectLayer = input.projectInfoOverride === void 0 ? Project.layerNode : Project.layerOf(input.projectInfoOverride);
15878
16036
  const progressLayer = input.shouldShowProgressSpinners ? Progress.layerOra(buildSpinnerProgressHandle) : Progress.layerNoop;
15879
16037
  const configLayer = input.hasConfigOverride ? Config.layerOf({
15880
16038
  config: input.userConfig,
15881
16039
  resolvedDirectory: input.directory,
15882
16040
  configSourceDirectory: input.configSourceDirectory
15883
16041
  }) : Config.layerNode;
15884
- const baseLayers = Layer.mergeAll(Project.layerNode, configLayer, Files.layerNode, Git.layerNode, linterLayer, LintPartialFailures.layerLive, deadCodeLayer, progressLayer, Reporter.layerNoop, scoreLayer);
16042
+ const baseLayers = Layer.mergeAll(projectLayer, configLayer, Files.layerNode, Git.layerNode, linterLayer, LintPartialFailures.layerLive, deadCodeLayer, progressLayer, Reporter.layerNoop, scoreLayer);
15885
16043
  return input.oxlintConcurrency === void 0 ? baseLayers : Layer.mergeAll(baseLayers, Layer.succeed(OxlintConcurrency, input.oxlintConcurrency));
15886
16044
  };
15887
16045
  //#endregion
@@ -16607,6 +16765,11 @@ const printCategoryCountUp = (tallies) => Effect.gen(function* () {
16607
16765
  });
16608
16766
  const TOP_ERROR_DETAIL_INDENT = " ";
16609
16767
  const pickRepresentativeDiagnostic = (ruleDiagnostics) => ruleDiagnostics.find((diagnostic) => diagnostic.line > 0) ?? ruleDiagnostics[0];
16768
+ const hasIndistinctSiteLocations = (ruleDiagnostics) => {
16769
+ const firstDiagnostic = ruleDiagnostics[0];
16770
+ if (firstDiagnostic === void 0) return false;
16771
+ return ruleDiagnostics.every((diagnostic) => diagnostic.line <= 0 && diagnostic.filePath === firstDiagnostic.filePath);
16772
+ };
16610
16773
  const FRAME_CONTEXT_REACH_LINES = 3;
16611
16774
  const clusterNearbyDiagnostics = (diagnostics) => {
16612
16775
  const byFile = groupBy(diagnostics, (diagnostic) => diagnostic.filePath);
@@ -16670,7 +16833,9 @@ const buildRuleDetailBlock = (ruleKey, ruleDiagnostics, resolveSourceRoot, rende
16670
16833
  const learnMoreLine = formatLearnMoreLine(representative);
16671
16834
  if (learnMoreLine) lines.push(`${TOP_ERROR_DETAIL_INDENT}${highlighter.info(learnMoreLine)}`);
16672
16835
  }
16673
- if (!renderEverySite) for (const explanationLine of wrapTextToWidth(representative.message, resolveMeasureWidth(4), { breakLongWords: false })) lines.push(`${TOP_ERROR_DETAIL_INDENT}${explanationLine}`);
16836
+ const isCollapsedWarningGroup = severity === "warning" && hasIndistinctSiteLocations(ruleDiagnostics);
16837
+ const impactMessages = isCollapsedWarningGroup ? [...new Set(ruleDiagnostics.map((diagnostic) => diagnostic.message))] : [representative.message];
16838
+ for (const impactMessage of impactMessages) for (const explanationLine of wrapTextToWidth(impactMessage, resolveMeasureWidth(4), { breakLongWords: false })) lines.push(`${TOP_ERROR_DETAIL_INDENT}${explanationLine}`);
16674
16839
  if (representative.help) for (const fixLine of wrapTextToWidth(`→ ${representative.help}`, resolveMeasureWidth(4), { breakLongWords: false })) lines.push(highlighter.dim(`${TOP_ERROR_DETAIL_INDENT}${fixLine}`));
16675
16840
  if (renderEverySite && isAgentEnvironment) {
16676
16841
  const fixRecipeLine = formatFixRecipeLine(representative);
@@ -16678,7 +16843,7 @@ const buildRuleDetailBlock = (ruleKey, ruleDiagnostics, resolveSourceRoot, rende
16678
16843
  }
16679
16844
  const renderCodeFrame = severity === "error";
16680
16845
  const sites = renderEverySite ? ruleDiagnostics : [representative];
16681
- for (const cluster of clusterNearbyDiagnostics(sites)) lines.push(...buildDiagnosticClusterLines(cluster, resolveSourceRoot, renderCodeFrame));
16846
+ if (!(isCollapsedWarningGroup && representative.help.includes(representative.filePath))) for (const cluster of clusterNearbyDiagnostics(sites)) lines.push(...buildDiagnosticClusterLines(cluster, resolveSourceRoot, renderCodeFrame));
16682
16847
  return lines;
16683
16848
  };
16684
16849
  const selectErrorRuleGroups = (diagnostics, rulePriority) => buildSortedRuleGroups(diagnostics.filter((diagnostic) => diagnostic.severity === "error"), rulePriority);
@@ -16807,6 +16972,9 @@ const computeProjectedScore = async (topErrorSource, rescoreSource, currentScore
16807
16972
  if (!potentialScore || potentialScore.score <= currentScore.score) return null;
16808
16973
  return potentialScore.score;
16809
16974
  };
16975
+ //#endregion
16976
+ //#region src/cli/utils/filter-diagnostics-by-categories.ts
16977
+ const filterDiagnosticsByCategories = (diagnostics, categories) => categories.size === 0 ? [...diagnostics] : diagnostics.filter((diagnostic) => categories.has(diagnostic.category));
16810
16978
  const FORCE_ONBOARDING_ENV_VAR = "REACT_DOCTOR_FORCE_ONBOARDING";
16811
16979
  const FALSY_FLAG_VALUES = new Set([
16812
16980
  "",
@@ -17237,11 +17405,259 @@ const resolveOxlintNodeEffect = (isLintEnabled, isQuiet) => Effect.gen(function*
17237
17405
  });
17238
17406
  const resolveOxlintNode = (isLintEnabled, isQuiet) => Effect.runPromise(resolveOxlintNodeEffect(isLintEnabled, isQuiet).pipe(Effect.provide(NodeResolver.layerNode)));
17239
17407
  //#endregion
17408
+ //#region src/cli/utils/cli-input-error.ts
17409
+ /**
17410
+ * A mistake in *how the CLI was invoked* — a malformed `<file>:<line>`
17411
+ * argument, mutually exclusive flags, or an unknown `--project` name. This is
17412
+ * user input, not a react-doctor bug, so `isExpectedUserError` routes it
17413
+ * through `handleUserError`: a clean, single-line message with no Sentry
17414
+ * report and no "Something went wrong, open a prefilled issue" block.
17415
+ *
17416
+ * The `message` is rendered verbatim, so it must read as a complete,
17417
+ * human-readable sentence that tells the user how to fix their invocation.
17418
+ */
17419
+ var CliInputError = class extends Error {
17420
+ name = "CliInputError";
17421
+ };
17422
+ //#endregion
17423
+ //#region src/cli/utils/resolve-cli-categories.ts
17424
+ const categoryByLowercase = new Map(DIAGNOSTIC_CATEGORY_BUCKETS.map((category) => [category.toLowerCase(), category]));
17425
+ const knownCategoryList = DIAGNOSTIC_CATEGORY_BUCKETS.join(", ");
17426
+ const splitCategoryFlagValue = (value) => value.split(",").map((category) => category.trim()).filter((category) => category.length > 0);
17427
+ const resolveCliCategories = (categoryFlag) => {
17428
+ const rawCategoryValues = categoryFlag === void 0 ? [] : Array.isArray(categoryFlag) ? categoryFlag : [categoryFlag];
17429
+ const resolvedCategories = [];
17430
+ const seenCategories = /* @__PURE__ */ new Set();
17431
+ for (const rawCategoryValue of rawCategoryValues) for (const categoryQuery of splitCategoryFlagValue(rawCategoryValue)) {
17432
+ const matchedCategory = categoryByLowercase.get(categoryQuery.toLowerCase());
17433
+ if (matchedCategory === void 0) throw new CliInputError(`Unknown category "${categoryQuery}". Expected one of: ${knownCategoryList}.`);
17434
+ if (!seenCategories.has(matchedCategory)) {
17435
+ seenCategories.add(matchedCategory);
17436
+ resolvedCategories.push(matchedCategory);
17437
+ }
17438
+ }
17439
+ if (rawCategoryValues.length > 0 && resolvedCategories.length === 0) throw new CliInputError(`--category requires one of: ${knownCategoryList}.`);
17440
+ return resolvedCategories.length > 0 ? resolvedCategories : void 0;
17441
+ };
17442
+ //#endregion
17443
+ //#region src/cli/utils/scan-result-cache.ts
17444
+ const CACHE_DISABLED_VALUES = new Set(["1", "true"]);
17445
+ const TOOLCHAIN_PACKAGE_SPECIFIERS = [
17446
+ "oxlint",
17447
+ "oxlint/package.json",
17448
+ "oxlint-plugin-react-doctor",
17449
+ "deslop-js/package.json",
17450
+ "eslint-plugin-react-hooks/package.json"
17451
+ ];
17452
+ const bundledRequire = createRequire(import.meta.url);
17453
+ const isRecord$1 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
17454
+ const normalizeForStableJson = (value) => {
17455
+ if (value === null) return null;
17456
+ if (value === void 0) return void 0;
17457
+ const valueType = typeof value;
17458
+ if (valueType === "string" || valueType === "number" || valueType === "boolean") return value;
17459
+ if (valueType === "bigint" || valueType === "function" || valueType === "symbol") throw new Error("Unsupported cache key value");
17460
+ if (Array.isArray(value)) return value.map((item) => {
17461
+ const normalized = normalizeForStableJson(item);
17462
+ return normalized === void 0 ? null : normalized;
17463
+ });
17464
+ const prototype = Object.getPrototypeOf(value);
17465
+ if (prototype !== Object.prototype && prototype !== null) throw new Error("Unsupported cache key object");
17466
+ const record = value;
17467
+ const normalizedRecord = {};
17468
+ for (const key of Object.keys(record).sort()) {
17469
+ const normalized = normalizeForStableJson(record[key]);
17470
+ if (normalized !== void 0) normalizedRecord[key] = normalized;
17471
+ }
17472
+ return normalizedRecord;
17473
+ };
17474
+ const stringifyStableJson = (value) => {
17475
+ try {
17476
+ return JSON.stringify(normalizeForStableJson(value));
17477
+ } catch {
17478
+ return null;
17479
+ }
17480
+ };
17481
+ const hashString = (value) => crypto.createHash("sha1").update(value).digest("hex");
17482
+ const runGit$1 = (directory, args) => {
17483
+ try {
17484
+ return execFileSync("git", [...args], {
17485
+ cwd: directory,
17486
+ encoding: "utf8",
17487
+ stdio: [
17488
+ "ignore",
17489
+ "pipe",
17490
+ "ignore"
17491
+ ]
17492
+ }).trim();
17493
+ } catch {
17494
+ return null;
17495
+ }
17496
+ };
17497
+ const readHeadSha = (projectDirectory) => runGit$1(projectDirectory, ["rev-parse", "HEAD"]);
17498
+ const isWorktreeClean = (projectDirectory) => {
17499
+ const status = runGit$1(projectDirectory, [
17500
+ "status",
17501
+ "--porcelain=v1",
17502
+ "--untracked-files=normal"
17503
+ ]);
17504
+ return status !== null && status.length === 0;
17505
+ };
17506
+ const hasHiddenTrackedFileState = (projectDirectory) => {
17507
+ const output = runGit$1(projectDirectory, ["ls-files", "-v"]);
17508
+ if (output === null) return true;
17509
+ return output.split("\n").some((line) => line.length > 0 && line[0] !== "H");
17510
+ };
17511
+ const resolveCacheFilePath = (projectDirectory) => {
17512
+ const nodeModulesDirectory = path.join(projectDirectory, "node_modules");
17513
+ if (fs.existsSync(nodeModulesDirectory)) return path.join(nodeModulesDirectory, ".cache", "react-doctor", "scan-cache.json");
17514
+ const projectHash = hashString(projectDirectory).slice(0, 16);
17515
+ return path.join(os.tmpdir(), "react-doctor-cache", `scan-${projectHash}.json`);
17516
+ };
17517
+ const readPersistedCache = (cacheFilePath) => {
17518
+ try {
17519
+ const parsed = JSON.parse(fs.readFileSync(cacheFilePath, "utf8"));
17520
+ if (!isRecord$1(parsed) || parsed.version !== 1) return {
17521
+ version: 1,
17522
+ entries: []
17523
+ };
17524
+ if (!Array.isArray(parsed.entries)) return {
17525
+ version: 1,
17526
+ entries: []
17527
+ };
17528
+ const entries = [];
17529
+ for (const entry of parsed.entries) {
17530
+ if (!isRecord$1(entry) || typeof entry.key !== "string" || typeof entry.createdAtMs !== "number") continue;
17531
+ if (!isRecord$1(entry.payload) || !Array.isArray(entry.payload.diagnostics)) continue;
17532
+ entries.push(entry);
17533
+ }
17534
+ return {
17535
+ version: 1,
17536
+ entries
17537
+ };
17538
+ } catch {
17539
+ return {
17540
+ version: 1,
17541
+ entries: []
17542
+ };
17543
+ }
17544
+ };
17545
+ const writePersistedCache = (cacheFilePath, cache) => {
17546
+ try {
17547
+ fs.mkdirSync(path.dirname(cacheFilePath), { recursive: true });
17548
+ const tempPath = `${cacheFilePath}.${process.pid}.tmp`;
17549
+ fs.writeFileSync(tempPath, JSON.stringify(cache));
17550
+ fs.renameSync(tempPath, cacheFilePath);
17551
+ } catch {
17552
+ return;
17553
+ }
17554
+ };
17555
+ const isScanResultCacheDisabled = () => CACHE_DISABLED_VALUES.has(process.env.REACT_DOCTOR_NO_CACHE?.toLowerCase() ?? "");
17556
+ const resolveProjectIdentity = (projectDirectory) => {
17557
+ try {
17558
+ return fs.realpathSync.native(projectDirectory);
17559
+ } catch {
17560
+ return path.resolve(projectDirectory);
17561
+ }
17562
+ };
17563
+ const fileFingerprint = (filePath) => {
17564
+ try {
17565
+ const stat = fs.statSync(filePath);
17566
+ return `${filePath}:${stat.mtimeMs}:${stat.size}`;
17567
+ } catch {
17568
+ return null;
17569
+ }
17570
+ };
17571
+ const resolveToolchainFingerprint = (nodeBinaryPath) => {
17572
+ const fingerprints = [];
17573
+ if (nodeBinaryPath !== null) {
17574
+ const fingerprint = fileFingerprint(nodeBinaryPath);
17575
+ if (fingerprint !== null) fingerprints.push(`node=${fingerprint}`);
17576
+ }
17577
+ for (const specifier of TOOLCHAIN_PACKAGE_SPECIFIERS) try {
17578
+ const fingerprint = fileFingerprint(bundledRequire.resolve(specifier));
17579
+ if (fingerprint !== null) fingerprints.push(`${specifier}=${fingerprint}`);
17580
+ } catch {
17581
+ continue;
17582
+ }
17583
+ return fingerprints;
17584
+ };
17585
+ const buildScanResultCacheKey = (input) => {
17586
+ if (isScanResultCacheDisabled()) return null;
17587
+ if (!isWorktreeClean(input.projectDirectory)) return null;
17588
+ if (hasHiddenTrackedFileState(input.projectDirectory)) return null;
17589
+ const headSha = readHeadSha(input.projectDirectory);
17590
+ if (headSha === null) return null;
17591
+ if (stringifyStableJson(input.userConfig) === null) return null;
17592
+ const cacheKeyJson = stringifyStableJson({
17593
+ schemaVersion: 1,
17594
+ projectIdentity: resolveProjectIdentity(input.projectDirectory),
17595
+ headSha,
17596
+ reactDoctorVersion: input.version,
17597
+ nodeVersion: process.version,
17598
+ toolchainFingerprint: resolveToolchainFingerprint(input.nodeBinaryPath),
17599
+ configFingerprint: computeConfigFingerprint(input.projectDirectory, input.version),
17600
+ hasConfigOverride: input.hasConfigOverride,
17601
+ configSourceDirectory: input.configSourceDirectory,
17602
+ userConfig: input.userConfig,
17603
+ engineOptions: {
17604
+ lint: input.options.lint,
17605
+ deadCode: input.options.deadCode,
17606
+ includePaths: [...input.options.includePaths].sort(),
17607
+ customRulesOnly: input.options.customRulesOnly,
17608
+ respectInlineDisables: input.options.respectInlineDisables,
17609
+ warnings: input.options.warnings,
17610
+ adoptExistingLintConfig: input.options.adoptExistingLintConfig,
17611
+ ignoredTags: [...input.options.ignoredTags].sort(),
17612
+ concurrency: input.options.concurrency,
17613
+ baselineRef: input.options.baseline?.ref,
17614
+ noScore: input.options.noScore,
17615
+ isCi: input.options.isCi,
17616
+ suppressRendering: input.options.suppressRendering
17617
+ }
17618
+ });
17619
+ return cacheKeyJson === null ? null : hashString(cacheKeyJson);
17620
+ };
17621
+ const createScanResultCache = (projectDirectory) => {
17622
+ const cacheFilePath = resolveCacheFilePath(projectDirectory);
17623
+ const persistedCache = readPersistedCache(cacheFilePath);
17624
+ const entries = /* @__PURE__ */ new Map();
17625
+ for (const entry of persistedCache.entries) entries.set(entry.key, entry);
17626
+ const persist = () => {
17627
+ writePersistedCache(cacheFilePath, {
17628
+ version: 1,
17629
+ entries: [...entries.values()].sort((firstEntry, secondEntry) => secondEntry.createdAtMs - firstEntry.createdAtMs).slice(0, 20)
17630
+ });
17631
+ };
17632
+ return {
17633
+ lookup: (key) => entries.get(key)?.payload ?? null,
17634
+ store: (key, payload) => {
17635
+ entries.set(key, {
17636
+ key,
17637
+ createdAtMs: Date.now(),
17638
+ payload
17639
+ });
17640
+ persist();
17641
+ }
17642
+ };
17643
+ };
17644
+ const shouldStoreScanPayload = (payload) => !payload.didLintFail && !payload.didDeadCodeFail && payload.lintPartialFailures.length === 0;
17645
+ //#endregion
17240
17646
  //#region src/inspect.ts
17241
17647
  const silentConsole = makeNoopConsole();
17242
17648
  const runConsole = (effect) => {
17243
17649
  Effect.runSync(effect);
17244
17650
  };
17651
+ const recordOnboardingCompletion = (options) => {
17652
+ const forceOnboarding = isOnboardingForced();
17653
+ if (shouldRecordOnboarding({
17654
+ paceOnboardingSections: !options.silent && !options.scoreOnly && !options.suppressRendering && !options.verbose && canAnimateOnboarding(process.stdout) && (forceOnboarding || !hasCompletedOnboarding()),
17655
+ forceOnboarding,
17656
+ verbose: options.verbose,
17657
+ isNonInteractiveEnvironment: options.isNonInteractiveEnvironment
17658
+ })) markOnboardingComplete();
17659
+ };
17660
+ const formatCategorySelection = (categoryFilters) => [...categoryFilters].join(", ");
17245
17661
  const buildIgnoredTags = (userConfig) => {
17246
17662
  const tags = /* @__PURE__ */ new Set();
17247
17663
  if (userConfig?.ignore?.tags) for (const tag of userConfig.ignore.tags) tags.add(tag);
@@ -17262,6 +17678,7 @@ const mergeInspectOptions = (inputOptions, userConfig) => ({
17262
17678
  share: userConfig?.share ?? true,
17263
17679
  respectInlineDisables: inputOptions.respectInlineDisables ?? userConfig?.respectInlineDisables ?? true,
17264
17680
  warnings: inputOptions.warnings ?? userConfig?.warnings ?? true,
17681
+ categoryFilters: new Set(resolveCliCategories(inputOptions.categoryFilters) ?? []),
17265
17682
  adoptExistingLintConfig: userConfig?.adoptExistingLintConfig ?? true,
17266
17683
  ignoredTags: buildIgnoredTags(userConfig),
17267
17684
  outputSurface: inputOptions.outputSurface ?? "cli",
@@ -17348,6 +17765,7 @@ const runBaselineComparison = async (params) => {
17348
17765
  hasConfigOverride: true,
17349
17766
  userConfig: params.userConfig,
17350
17767
  configSourceDirectory: null,
17768
+ projectInfoOverride: params.headProjectInfo,
17351
17769
  shouldSkipLint: !params.options.lint || !params.resolvedNodeBinaryPath,
17352
17770
  shouldRunDeadCode: false,
17353
17771
  shouldComputeScore: false,
@@ -17394,6 +17812,40 @@ const runInspectWithRuntime = async (directory, options, userConfig, hasConfigOv
17394
17812
  const isDiffMode = options.includePaths.length > 0;
17395
17813
  const resolvedNodeBinaryPath = await resolveOxlintNode(options.lint, options.scoreOnly || options.silent);
17396
17814
  const lintBindingMissing = options.lint && !resolvedNodeBinaryPath;
17815
+ const cacheKey = buildScanResultCacheKey({
17816
+ projectDirectory: directory,
17817
+ version: VERSION,
17818
+ nodeBinaryPath: resolvedNodeBinaryPath,
17819
+ options,
17820
+ userConfig,
17821
+ hasConfigOverride,
17822
+ configSourceDirectory
17823
+ });
17824
+ const scanResultCache = cacheKey === null ? null : createScanResultCache(directory);
17825
+ const cachedPayload = cacheKey === null ? null : scanResultCache?.lookup(cacheKey) ?? null;
17826
+ if (cachedPayload) {
17827
+ recordSentryProjectContext(cachedPayload.project, rootSentrySpan);
17828
+ recordCount(METRIC.projectDetected, 1);
17829
+ await renderCachedProjectDetection({
17830
+ payload: cachedPayload,
17831
+ options,
17832
+ userConfig,
17833
+ isDiffMode
17834
+ });
17835
+ const baselineDegraded = Boolean(options.baseline) && isDiffMode && cachedPayload.baselineDelta === void 0;
17836
+ const result = await renderAndRecordScan({
17837
+ payload: cachedPayload,
17838
+ options,
17839
+ userConfig,
17840
+ hasCustomConfig: userConfig !== null,
17841
+ startTime,
17842
+ rootSentrySpan,
17843
+ scanMode: cachedPayload.baselineDelta ? "baseline" : isDiffMode ? "diff" : "full",
17844
+ baselineDegraded
17845
+ });
17846
+ recordOnboardingCompletion(options);
17847
+ return result;
17848
+ }
17397
17849
  const shouldShowProgressSpinners = !options.isCiOrCodingAgentEnvironment && !options.silent && !options.scoreOnly && options.lint && Boolean(resolvedNodeBinaryPath);
17398
17850
  const layers = buildRuntimeLayers({
17399
17851
  directory,
@@ -17447,6 +17899,7 @@ const runInspectWithRuntime = async (directory, options, userConfig, hasConfigOv
17447
17899
  directory,
17448
17900
  options,
17449
17901
  userConfig,
17902
+ headProjectInfo: output.project,
17450
17903
  headDiagnostics: output.diagnostics,
17451
17904
  resolvedNodeBinaryPath,
17452
17905
  baselineRef: options.baseline.ref
@@ -17458,12 +17911,7 @@ const runInspectWithRuntime = async (directory, options, userConfig, hasConfigOv
17458
17911
  }
17459
17912
  const baselineDegraded = Boolean(options.baseline) && isDiffMode && baselineDelta === void 0;
17460
17913
  const score = didLintFail ? null : output.score;
17461
- const elapsedMilliseconds = performance.now() - startTime;
17462
- const forceOnboarding = isOnboardingForced();
17463
- const paceOnboardingSections = !options.silent && !options.scoreOnly && !options.suppressRendering && !options.verbose && canAnimateOnboarding(process.stdout) && (forceOnboarding || !hasCompletedOnboarding());
17464
- const finalizeInput = {
17465
- options,
17466
- elapsedMilliseconds,
17914
+ const payload = {
17467
17915
  diagnostics: inspectDiagnostics,
17468
17916
  score,
17469
17917
  project: output.project,
@@ -17477,39 +17925,77 @@ const runInspectWithRuntime = async (directory, options, userConfig, hasConfigOv
17477
17925
  scannedFileCount: output.scannedFileCount,
17478
17926
  scannedFilePaths: output.scannedFilePaths,
17479
17927
  scanElapsedMilliseconds: output.scanElapsedMilliseconds,
17480
- baselineDelta
17928
+ baselineDelta,
17929
+ lintFailureReasonKind: lintBindingMissing ? "native-binding-missing" : output.lintFailureReasonKind
17481
17930
  };
17482
- const result = await Effect.runPromise(finalizeAndRender(finalizeInput).pipe(options.silent ? Effect.provideService(Console.Console, silentConsole) : (program) => program));
17483
- if (shouldRecordOnboarding({
17484
- paceOnboardingSections,
17485
- forceOnboarding,
17486
- verbose: options.verbose,
17487
- isNonInteractiveEnvironment: options.isNonInteractiveEnvironment
17488
- })) markOnboardingComplete();
17489
- const scanMode = baselineDelta ? "baseline" : isDiffMode ? "diff" : "full";
17931
+ if (cacheKey !== null && scanResultCache !== null && shouldStoreScanPayload(payload)) scanResultCache.store(cacheKey, payload);
17932
+ const result = await renderAndRecordScan({
17933
+ payload,
17934
+ options,
17935
+ userConfig,
17936
+ hasCustomConfig: userConfig !== null,
17937
+ startTime,
17938
+ rootSentrySpan,
17939
+ scanMode: baselineDelta ? "baseline" : isDiffMode ? "diff" : "full",
17940
+ baselineDegraded
17941
+ });
17942
+ recordOnboardingCompletion(options);
17943
+ return result;
17944
+ };
17945
+ const runMaybeSilent = (effect, silent) => silent ? effect.pipe(Effect.provideService(Console.Console, silentConsole)) : effect;
17946
+ const renderCachedProjectDetection = async (input) => {
17947
+ if (input.options.scoreOnly || input.options.suppressRendering) return;
17948
+ await Effect.runPromise(runMaybeSilent(printProjectDetection({
17949
+ projectInfo: input.payload.project,
17950
+ userConfig: input.userConfig,
17951
+ isDiffMode: input.isDiffMode,
17952
+ includePaths: input.options.includePaths,
17953
+ lintSourceFileCount: input.payload.scannedFileCount
17954
+ }), input.options.silent));
17955
+ };
17956
+ const renderAndRecordScan = async (input) => {
17957
+ const finalizeInput = {
17958
+ options: input.options,
17959
+ elapsedMilliseconds: performance.now() - input.startTime,
17960
+ diagnostics: input.payload.diagnostics,
17961
+ score: input.payload.score,
17962
+ project: input.payload.project,
17963
+ userConfig: input.payload.userConfig,
17964
+ didLintFail: input.payload.didLintFail,
17965
+ lintFailureReason: input.payload.lintFailureReason,
17966
+ lintPartialFailures: input.payload.lintPartialFailures,
17967
+ didDeadCodeFail: input.payload.didDeadCodeFail,
17968
+ deadCodeFailureReason: input.payload.deadCodeFailureReason,
17969
+ directory: input.payload.directory,
17970
+ scannedFileCount: input.payload.scannedFileCount,
17971
+ scannedFilePaths: input.payload.scannedFilePaths,
17972
+ scanElapsedMilliseconds: input.payload.scanElapsedMilliseconds,
17973
+ baselineDelta: input.payload.baselineDelta
17974
+ };
17975
+ const result = await Effect.runPromise(runMaybeSilent(finalizeAndRender(finalizeInput), input.options.silent));
17490
17976
  recordScanMetrics({
17491
17977
  result,
17492
- mode: scanMode,
17493
- baselineDegraded,
17494
- parallel: options.concurrency !== void 0,
17495
- workerCount: options.concurrency,
17496
- lint: options.lint,
17497
- deadCode: options.deadCode,
17498
- scoreOnly: options.scoreOnly,
17499
- noScore: options.noScore,
17500
- didLintFail,
17501
- lintFailureReasonKind: lintBindingMissing ? "native-binding-missing" : output.lintFailureReasonKind,
17502
- didDeadCodeFail: output.didDeadCodeFail
17978
+ mode: input.scanMode,
17979
+ baselineDegraded: input.baselineDegraded,
17980
+ parallel: input.options.concurrency !== void 0,
17981
+ workerCount: input.options.concurrency,
17982
+ lint: input.options.lint,
17983
+ deadCode: input.options.deadCode,
17984
+ scoreOnly: input.options.scoreOnly,
17985
+ noScore: input.options.noScore,
17986
+ didLintFail: input.payload.didLintFail,
17987
+ lintFailureReasonKind: input.payload.lintFailureReasonKind,
17988
+ didDeadCodeFail: input.payload.didDeadCodeFail
17503
17989
  });
17504
- recordRunEvent(rootSentrySpan, {
17505
- ...buildRunEventConfig(options, userConfig, userConfig !== null),
17990
+ recordRunEvent(input.rootSentrySpan, {
17991
+ ...buildRunEventConfig(input.options, input.userConfig, input.hasCustomConfig),
17506
17992
  result,
17507
- mode: scanMode,
17508
- gateExempt: baselineDegraded,
17509
- didLintFail,
17510
- lintFailureReasonKind: lintBindingMissing ? "native-binding-missing" : output.lintFailureReasonKind,
17511
- lintPartialFailureCount: output.lintPartialFailures.length,
17512
- didDeadCodeFail: output.didDeadCodeFail
17993
+ mode: input.scanMode,
17994
+ gateExempt: input.baselineDegraded,
17995
+ didLintFail: input.payload.didLintFail,
17996
+ lintFailureReasonKind: input.payload.lintFailureReasonKind,
17997
+ lintPartialFailureCount: input.payload.lintPartialFailures.length,
17998
+ didDeadCodeFail: input.payload.didDeadCodeFail
17513
17999
  });
17514
18000
  return result;
17515
18001
  };
@@ -17545,14 +18031,16 @@ const finalizeAndRender = (input) => Effect.gen(function* () {
17545
18031
  const animateRender = !options.silent && !options.verbose && canAnimateOnboarding(process.stdout);
17546
18032
  const pause = onboardingSectionPause(animateRender);
17547
18033
  const surfaceDiagnostics = filterDiagnosticsForSurface([...diagnostics], options.outputSurface, userConfig);
18034
+ const printedDiagnostics = filterDiagnosticsByCategories(surfaceDiagnostics, options.categoryFilters);
17548
18035
  const demotedDiagnosticCount = diagnostics.length - surfaceDiagnostics.length;
17549
18036
  const lintSourceFileCount = options.includePaths.length > 0 ? options.includePaths.length : project.sourceFileCount;
17550
- if (surfaceDiagnostics.length === 0) {
18037
+ if (printedDiagnostics.length === 0) {
17551
18038
  yield* pause;
17552
18039
  if (hasSkippedChecks) {
17553
18040
  const skippedLabel = skippedChecks.join(" and ");
17554
18041
  yield* Console.warn(highlighter.warn(`No issues detected, but ${skippedLabel} checks failed — results are incomplete.`));
17555
- } else if (demotedDiagnosticCount > 0) yield* Console.log(highlighter.success(`No issues found! (${demotedDiagnosticCount} demoted from the ${options.outputSurface} surface — see config.surfaces.)`));
18042
+ } else if (options.categoryFilters.size > 0) yield* Console.log(highlighter.success(`No issues found in category ${formatCategorySelection(options.categoryFilters)}!`));
18043
+ else if (demotedDiagnosticCount > 0) yield* Console.log(highlighter.success(`No issues found! (${demotedDiagnosticCount} demoted from the ${options.outputSurface} surface — see config.surfaces.)`));
17556
18044
  else yield* Console.log(highlighter.success("No issues found!"));
17557
18045
  yield* Console.log("");
17558
18046
  yield* pause;
@@ -17565,20 +18053,20 @@ const finalizeAndRender = (input) => Effect.gen(function* () {
17565
18053
  }
17566
18054
  yield* pause;
17567
18055
  yield* Console.log("");
17568
- yield* printDiagnostics([...surfaceDiagnostics], options.verbose, directory, buildRulePriorityMap([score]), isCodingAgentEnvironment(), {
18056
+ yield* printDiagnostics([...printedDiagnostics], options.verbose, directory, buildRulePriorityMap([score]), isCodingAgentEnvironment(), {
17569
18057
  sectionPause: pause,
17570
18058
  animateCountUp: animateRender
17571
18059
  });
17572
18060
  if (options.isNonInteractiveEnvironment && options.outputSurface !== "prComment") yield* printAgentGuidance();
17573
- if (demotedDiagnosticCount > 0) {
18061
+ if (options.categoryFilters.size === 0 && demotedDiagnosticCount > 0) {
17574
18062
  yield* Console.log(highlighter.gray(` ${demotedDiagnosticCount} demoted from the ${options.outputSurface} surface (e.g. design cleanup) — run \`npx react-doctor@latest .\` locally for the full list.`));
17575
18063
  yield* Console.log("");
17576
18064
  }
17577
- const potentialScore = score ? yield* Effect.promise(() => computeProjectedScore([...surfaceDiagnostics], [...surfaceDiagnostics], score)) : null;
18065
+ const potentialScore = score ? yield* Effect.promise(() => computeProjectedScore([...printedDiagnostics], [...surfaceDiagnostics], score)) : null;
17578
18066
  const shouldShowShareLink = !options.noScore && options.share && !options.isCi;
17579
18067
  yield* pause;
17580
18068
  yield* printSummary({
17581
- diagnostics: [...surfaceDiagnostics],
18069
+ diagnostics: [...printedDiagnostics],
17582
18070
  elapsedMilliseconds,
17583
18071
  scoreResult: score,
17584
18072
  potentialScore,
@@ -17594,7 +18082,7 @@ const finalizeAndRender = (input) => Effect.gen(function* () {
17594
18082
  }
17595
18083
  yield* pause;
17596
18084
  yield* printFooter({
17597
- diagnostics: [...surfaceDiagnostics],
18085
+ diagnostics: [...printedDiagnostics],
17598
18086
  scoreResult: score,
17599
18087
  projectName: project.projectName,
17600
18088
  isOffline: !shouldShowShareLink
@@ -17725,21 +18213,6 @@ const handleUserError = (error, options = {}) => {
17725
18213
  process.exitCode = 1;
17726
18214
  };
17727
18215
  //#endregion
17728
- //#region src/cli/utils/cli-input-error.ts
17729
- /**
17730
- * A mistake in *how the CLI was invoked* — a malformed `<file>:<line>`
17731
- * argument, mutually exclusive flags, or an unknown `--project` name. This is
17732
- * user input, not a react-doctor bug, so `isExpectedUserError` routes it
17733
- * through `handleUserError`: a clean, single-line message with no Sentry
17734
- * report and no "Something went wrong, open a prefilled issue" block.
17735
- *
17736
- * The `message` is rendered verbatim, so it must read as a complete,
17737
- * human-readable sentence that tells the user how to fix their invocation.
17738
- */
17739
- var CliInputError = class extends Error {
17740
- name = "CliInputError";
17741
- };
17742
- //#endregion
17743
18216
  //#region src/cli/utils/is-expected-user-error.ts
17744
18217
  /**
17745
18218
  * Whether `error` is an expected, user-actionable failure — the user's project
@@ -18041,37 +18514,20 @@ const buildWorkflowContent = () => `# React Doctor — finds security, performan
18041
18514
  name: React Doctor
18042
18515
 
18043
18516
  on:
18517
+ # Scans the PR's changed files and posts a sticky summary comment listing only the new issues introduced relative to the merge base of the target branch.
18044
18518
  pull_request:
18045
18519
  types: [opened, synchronize, reopened, ready_for_review]
18046
- # Scans \`main\` on every push so you get a health-score trend on the
18047
- # default branch — useful for tracking the overall number commit-by-commit
18048
- # and catching regressions that slipped past PR review. PR-specific steps
18049
- # (the sticky summary comment) are skipped automatically on \`push\` events.
18050
- # Comment this block out if you only want PR-time scans.
18520
+ # Scans \`main\` on every push to track the health-score trend and catch regressions that slipped past PR review.
18051
18521
  push:
18052
18522
  branches: [main]
18053
18523
 
18054
18524
  permissions:
18055
- # \`actions/checkout\` needs this to read the repo source.
18056
18525
  contents: read
18057
- # Two uses: (1) reads the PR's changed-file list so the scan only checks
18058
- # what the PR touched (faster, scoped to the diff), and (2) posts/updates
18059
- # the sticky React Doctor summary comment on the PR. Downgrade \`write\` to
18060
- # \`read\` to keep the changed-file scan but disable comment posting.
18061
18526
  pull-requests: write
18062
- # The sticky-comment step uses GitHub's \`issues.createComment\` /
18063
- # \`issues.updateComment\` endpoints — those are the same APIs that back PR
18064
- # comments (PRs are issues under the hood). Not exercised on \`push\`
18065
- # events, so safe to drop if you only run on \`main\`.
18066
18527
  issues: write
18067
- # Lets the action publish a commit status with the score + error/warning
18068
- # counts (links to the run). This is how a \`push\` to \`main\` surfaces its
18069
- # result, since the PR comment is skipped off pull requests. Drop it to
18070
- # disable the status (or set \`commit-status: false\` below).
18071
18528
  statuses: write
18072
18529
 
18073
- # Cancels any in-flight scan for the same PR (or branch, on push) the moment
18074
- # a new commit arrives, so reviewers only ever see the latest run.
18530
+ # Cancels any in-flight scan for the same PR (or branch, on push) the moment a new commit arrives, so reviewers only ever see the latest run.
18075
18531
  concurrency:
18076
18532
  group: react-doctor-\${{ github.event.pull_request.number || github.ref }}
18077
18533
  cancel-in-progress: true
@@ -19301,29 +19757,6 @@ const getSkillSourceDirectory = () => {
19301
19757
  const distDirectory = path$1.dirname(fileURLToPath(import.meta.url));
19302
19758
  return path$1.join(distDirectory, "skills", SKILL_NAME);
19303
19759
  };
19304
- const findBundledSiblingSkills = (primarySkillDir) => {
19305
- const skillsParent = path$1.dirname(primarySkillDir);
19306
- if (!fs$1.existsSync(skillsParent)) return [];
19307
- const resolvedPrimary = path$1.resolve(primarySkillDir);
19308
- return fs$1.readdirSync(skillsParent, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => ({
19309
- name: entry.name,
19310
- source: path$1.join(skillsParent, entry.name)
19311
- })).filter((sibling) => path$1.resolve(sibling.source) !== resolvedPrimary && fs$1.existsSync(path$1.join(sibling.source, SKILL_MANIFEST_FILE)));
19312
- };
19313
- const installBundledSiblingSkills = async (primarySkillDir, agents, projectRoot) => {
19314
- const installedSkillNames = [];
19315
- for (const sibling of findBundledSiblingSkills(primarySkillDir)) {
19316
- const result = await installSkillsFromSource({
19317
- source: sibling.source,
19318
- agents: [...agents],
19319
- cwd: projectRoot,
19320
- mode: "copy"
19321
- });
19322
- if (result.failed.length > 0) throw new Error(result.failed.map((failure) => `${getSkillAgentConfig(failure.agent).displayName}: ${failure.error}`).join("\n"));
19323
- if (result.skills.length > 0) installedSkillNames.push(sibling.name);
19324
- }
19325
- return installedSkillNames;
19326
- };
19327
19760
  const canInstallNativeAgentHooks = (agents) => agents.some((agent) => agent === "claude-code" || agent === "cursor");
19328
19761
  const installReactDoctorSkillStep = async (sourceDir, selectedAgents, projectRoot) => {
19329
19762
  const installSpinner = spinner(`Installing ${SKILL_NAME} skill...`).start();
@@ -19341,12 +19774,6 @@ const installReactDoctorSkillStep = async (sourceDir, selectedAgents, projectRoo
19341
19774
  installSpinner.fail(`Failed to install ${SKILL_NAME} skill.`);
19342
19775
  throw error;
19343
19776
  }
19344
- try {
19345
- const installedSiblingSkills = await installBundledSiblingSkills(sourceDir, selectedAgents, projectRoot);
19346
- if (installedSiblingSkills.length > 0) cliLogger.dim(` Also installed the ${installedSiblingSkills.join(", ")} skill.`);
19347
- } catch {
19348
- cliLogger.dim(" Skipped bundled sibling skills (install error).");
19349
- }
19350
19777
  };
19351
19778
  const installReactDoctorGitHookStep = (gitHookTarget) => {
19352
19779
  const hookSpinner = spinner("Installing React Doctor pre-commit hook...").start();
@@ -19490,7 +19917,6 @@ const runInstallReactDoctor = async (options = {}) => {
19490
19917
  cliLogger.log(`Dry run — would install ${SKILL_NAME} skill for:`);
19491
19918
  for (const agent of selectedAgents) cliLogger.dim(` - ${getSkillAgentConfig(agent).displayName}`);
19492
19919
  cliLogger.dim(` Source: ${sourceDir}`);
19493
- for (const sibling of findBundledSiblingSkills(sourceDir)) cliLogger.dim(` Also installs skill: ${sibling.name}`);
19494
19920
  cliLogger.dim(" Package script: doctor (or react-doctor if doctor exists)");
19495
19921
  cliLogger.dim(" Dev dependency: react-doctor");
19496
19922
  if (shouldInstallGitHook) cliLogger.dim(` Git hook: ${gitHookPath}`);
@@ -19975,8 +20401,9 @@ const findLowestScoredScan = (completedScans) => {
19975
20401
  };
19976
20402
  const printMultiProjectSummary = (input) => Effect.gen(function* () {
19977
20403
  const { completedScans, userConfig, verbose, isOffline, projectName } = input;
20404
+ const categoryFilters = input.categoryFilters ?? /* @__PURE__ */ new Set();
19978
20405
  const animateRender = !verbose && canAnimateOnboarding(process.stdout);
19979
- const surfaceDiagnostics = filterDiagnosticsForSurface(completedScans.flatMap((scan) => scan.result.diagnostics), "cli", userConfig);
20406
+ const displayDiagnostics = filterDiagnosticsByCategories(filterDiagnosticsForSurface(completedScans.flatMap((scan) => scan.result.diagnostics), "cli", userConfig), categoryFilters);
19980
20407
  const projectRootByDiagnostic = /* @__PURE__ */ new WeakMap();
19981
20408
  for (const scan of completedScans) for (const diagnostic of scan.result.diagnostics) projectRootByDiagnostic.set(diagnostic, scan.result.project.rootDirectory);
19982
20409
  const resolveDiagnosticSourceRoot = (diagnostic) => projectRootByDiagnostic.get(diagnostic) ?? "";
@@ -19990,29 +20417,30 @@ const printMultiProjectSummary = (input) => Effect.gen(function* () {
19990
20417
  const totalScannedFileCount = uniqueScannedFilePaths.size + fileCountFromScansWithoutPaths;
19991
20418
  const totalScanElapsedMilliseconds = completedScans.reduce((sum, scan) => sum + (scan.result.scanElapsedMilliseconds ?? scan.result.elapsedMilliseconds), 0);
19992
20419
  yield* Console.log(`${highlighter.success("✔")} Scanned ${totalScannedFileCount} ${totalScannedFileCount === 1 ? "file" : "files"} in ${formatElapsedTime(totalScanElapsedMilliseconds)}`);
19993
- if (surfaceDiagnostics.length > 0) {
20420
+ if (displayDiagnostics.length > 0) {
19994
20421
  yield* Console.log("");
19995
- yield* printDiagnostics(surfaceDiagnostics, verbose, resolveDiagnosticSourceRoot, buildRulePriorityMap(completedScans.map((scan) => scan.result.score)), isCodingAgentEnvironment(), { animateCountUp: animateRender });
20422
+ yield* printDiagnostics(displayDiagnostics, verbose, resolveDiagnosticSourceRoot, buildRulePriorityMap(completedScans.map((scan) => scan.result.score)), isCodingAgentEnvironment(), { animateCountUp: animateRender });
19996
20423
  }
19997
20424
  const lowestScoredScan = findLowestScoredScan(completedScans);
19998
20425
  const aggregateScore = lowestScoredScan?.result.score ?? null;
19999
20426
  const totalSourceFileCount = completedScans.reduce((sum, scan) => sum + scan.result.project.sourceFileCount, 0);
20000
20427
  yield* printSummary({
20001
- diagnostics: surfaceDiagnostics,
20428
+ diagnostics: displayDiagnostics,
20002
20429
  elapsedMilliseconds: completedScans.reduce((sum, scan) => sum + scan.result.elapsedMilliseconds, 0),
20003
20430
  scoreResult: aggregateScore,
20004
- potentialScore: lowestScoredScan ? yield* Effect.promise(() => computeProjectedScore(surfaceDiagnostics, lowestScoredScan.result.diagnostics, lowestScoredScan.result.score)) : null,
20431
+ potentialScore: lowestScoredScan ? yield* Effect.promise(() => computeProjectedScore(displayDiagnostics, filterDiagnosticsForSurface(lowestScoredScan.result.diagnostics, "cli", userConfig), lowestScoredScan.result.score)) : null,
20005
20432
  totalSourceFileCount,
20006
20433
  noScoreMessage: "Score unavailable.",
20007
20434
  verbose,
20008
20435
  animateProjection: animateRender
20009
20436
  });
20010
20437
  const entries = completedScans.map((scan) => {
20011
- const errorCount = scan.result.diagnostics.filter((diagnostic) => diagnostic.severity === "error").length;
20438
+ const projectDiagnostics = filterDiagnosticsByCategories(filterDiagnosticsForSurface([...scan.result.diagnostics], "cli", userConfig), categoryFilters);
20439
+ const errorCount = projectDiagnostics.filter((diagnostic) => diagnostic.severity === "error").length;
20012
20440
  return {
20013
20441
  projectName: scan.result.project.projectName,
20014
20442
  score: scan.result.score?.score ?? null,
20015
- issueCount: scan.result.diagnostics.length,
20443
+ issueCount: projectDiagnostics.length,
20016
20444
  errorCount
20017
20445
  };
20018
20446
  });
@@ -20020,7 +20448,7 @@ const printMultiProjectSummary = (input) => Effect.gen(function* () {
20020
20448
  yield* Console.log("");
20021
20449
  for (const entry of entries) yield* Console.log(buildSummaryLine(entry, longestProjectNameLength));
20022
20450
  yield* printFooter({
20023
- diagnostics: surfaceDiagnostics,
20451
+ diagnostics: displayDiagnostics,
20024
20452
  scoreResult: aggregateScore,
20025
20453
  projectName,
20026
20454
  isOffline
@@ -20110,7 +20538,8 @@ const resolveCliInspectOptions = (flags, userConfig) => {
20110
20538
  noScore: flags.score === false || flags.telemetry === false || (userConfig?.noScore ?? false),
20111
20539
  isCi: isCiEnvironment(),
20112
20540
  silent: Boolean(flags.json),
20113
- concurrency: resolveParallelFlag(flags.parallel)
20541
+ concurrency: resolveParallelFlag(flags.parallel),
20542
+ categoryFilters: resolveCliCategories(flags.category)
20114
20543
  };
20115
20544
  };
20116
20545
  //#endregion
@@ -20363,6 +20792,16 @@ const validateModeFlags = (flags) => {
20363
20792
  };
20364
20793
  //#endregion
20365
20794
  //#region src/cli/commands/inspect.ts
20795
+ const filterCompletedScansByCategories = (completedScans, categoryFilters) => {
20796
+ if (categoryFilters.size === 0) return [...completedScans];
20797
+ return completedScans.map((scan) => ({
20798
+ ...scan,
20799
+ result: {
20800
+ ...scan.result,
20801
+ diagnostics: filterDiagnosticsByCategories(scan.result.diagnostics, categoryFilters)
20802
+ }
20803
+ }));
20804
+ };
20366
20805
  /**
20367
20806
  * Post-scan finalization shared by the staged-arm and project-loop
20368
20807
  * paths of `inspectAction`: emit the JSON report (when in JSON mode)
@@ -20375,6 +20814,7 @@ const finalizeScans = (input) => {
20375
20814
  const baselineComputed = input.completedScans.length > 0 && input.completedScans.every((scan) => scan.result.baselineDelta !== void 0);
20376
20815
  const baselineDegraded = input.baselineIntended && !baselineComputed;
20377
20816
  const mode = baselineDegraded ? "diff" : input.mode;
20817
+ const jsonCompletedScans = filterCompletedScansByCategories(input.completedScans, input.categoryFilters);
20378
20818
  if (input.isJsonMode) {
20379
20819
  const baseline = baselineComputed && baselineDeltas.length > 0 ? {
20380
20820
  baseRef: baselineDeltas[0].baseRef,
@@ -20386,7 +20826,7 @@ const finalizeScans = (input) => {
20386
20826
  directory: input.resolvedDirectory,
20387
20827
  mode,
20388
20828
  diff: input.diff,
20389
- scans: input.completedScans,
20829
+ scans: jsonCompletedScans,
20390
20830
  totalElapsedMilliseconds: performance.now() - input.startTime,
20391
20831
  baseline
20392
20832
  }));
@@ -20460,6 +20900,7 @@ const inspectAction = async (directory, flags) => {
20460
20900
  await Effect.runPromise(playWelcomeScene({ speedMultiplier: isReturningUser ? 2 : 1 }));
20461
20901
  } else Effect.runSync(printBrandedHeader);
20462
20902
  const scanOptions = resolveCliInspectOptions(flags, userConfig);
20903
+ const categoryFilters = new Set(scanOptions.categoryFilters ?? []);
20463
20904
  const skipPrompts = shouldSkipPrompts({
20464
20905
  yes: flags.yes,
20465
20906
  json: flags.json
@@ -20520,6 +20961,7 @@ const inspectAction = async (directory, flags) => {
20520
20961
  isJsonMode,
20521
20962
  isScoreOnly,
20522
20963
  flags,
20964
+ categoryFilters,
20523
20965
  userConfig,
20524
20966
  resolvedDirectory,
20525
20967
  startTime
@@ -20579,6 +21021,7 @@ const inspectAction = async (directory, flags) => {
20579
21021
  const shouldShowShareLink = !scanOptions.noScore && (userConfig?.share ?? true) && !scanOptions.isCi;
20580
21022
  await Effect.runPromise(printMultiProjectSummary({
20581
21023
  completedScans,
21024
+ categoryFilters,
20582
21025
  userConfig,
20583
21026
  verbose: Boolean(flags.verbose),
20584
21027
  isOffline: !shouldShowShareLink,
@@ -20594,14 +21037,15 @@ const inspectAction = async (directory, flags) => {
20594
21037
  isJsonMode,
20595
21038
  isScoreOnly,
20596
21039
  flags,
21040
+ categoryFilters,
20597
21041
  userConfig,
20598
21042
  resolvedDirectory,
20599
21043
  startTime
20600
21044
  });
20601
- const surfaceDiagnostics = filterDiagnosticsForSurface(allDiagnostics, scanOptions.outputSurface ?? "cli", userConfig);
20602
- if (!isQuiet && !skipPrompts && process.stdout.isTTY === true && !isCiOrCodingAgentEnvironment() && surfaceDiagnostics.length > 0) {
21045
+ const selectedSurfaceDiagnostics = filterDiagnosticsByCategories(filterDiagnosticsForSurface(allDiagnostics, scanOptions.outputSurface ?? "cli", userConfig), categoryFilters);
21046
+ if (!isQuiet && !skipPrompts && process.stdout.isTTY === true && !isCiOrCodingAgentEnvironment() && selectedSurfaceDiagnostics.length > 0) {
20603
21047
  await handoffToAgent({
20604
- diagnostics: surfaceDiagnostics,
21048
+ diagnostics: selectedSurfaceDiagnostics,
20605
21049
  projectName: path$1.basename(resolvedDirectory),
20606
21050
  rootDirectory: resolvedDirectory,
20607
21051
  interactive: true
@@ -21032,7 +21476,7 @@ const rulesListAction = async (options) => {
21032
21476
  });
21033
21477
  const catalog = buildRuleCatalog();
21034
21478
  const config = validateConfigTypes((await resolveRuleConfigTarget(resolveProjectRoot(options))).config);
21035
- const categoryFilter = options.category?.toLowerCase();
21479
+ const categoryFilter = typeof options.category === "string" ? options.category.toLowerCase() : void 0;
21036
21480
  const frameworkFilter = options.framework?.toLowerCase();
21037
21481
  const rows = catalog.filter((entry) => {
21038
21482
  if (categoryFilter && entry.category.toLowerCase() !== categoryFilter) return false;
@@ -21395,6 +21839,7 @@ const ROOT_FLAG_SPEC = {
21395
21839
  "--yes"
21396
21840
  ]),
21397
21841
  longOptionsWithRequiredValues: new Set([
21842
+ "--category",
21398
21843
  "--changed-files-from",
21399
21844
  "--blocking",
21400
21845
  "--fail-on",
@@ -21551,6 +21996,7 @@ ${formatExampleLines([
21551
21996
  ["react-doctor ./apps/web", "scan a specific directory"],
21552
21997
  ["react-doctor --diff main", "scan only files changed vs. main"],
21553
21998
  ["react-doctor --staged", "scan staged files (pre-commit hook)"],
21999
+ ["react-doctor --category Security", "show only one diagnostic category"],
21554
22000
  ["react-doctor --blocking warning", "fail CI on warnings too (default: error)"],
21555
22001
  ["react-doctor --json > report.json", "write a machine-readable report"],
21556
22002
  ["react-doctor why src/App.tsx:42", "explain why a rule fired there"],
@@ -21579,7 +22025,8 @@ ${formatExampleLines([
21579
22025
  ${highlighter.dim("Learn more:")}
21580
22026
  ${highlighter.info(CANONICAL_GITHUB_URL)}
21581
22027
  `;
21582
- const program = new Command().name("react-doctor").description("Diagnose React codebase health").version(VERSION, "-v, --version", "display the version number").argument("[directory]", "project directory to scan", ".").option("--lint", "enable linting").option("--no-lint", "skip linting").option("--dead-code", "enable dead-code analysis (default)").option("--no-dead-code", "skip dead-code analysis (unused files / exports / dependencies, circular imports)").option("--verbose", "show every rule and per-file details (default shows top 3 rules)").option("--score", "output only the score").option("--json", "output a single structured JSON report (suppresses other output)").option("--json-compact", "with --json, emit compact JSON (no indentation)").option("-y, --yes", "skip prompts, scan all workspace projects").option("--no-parallel", "lint serially with one worker (default: parallel across CPU cores; set the worker count with REACT_DOCTOR_PARALLEL)").option("--project <name>", "select workspace project (comma-separated for multiple)").option("--diff [base]", "scan only files changed vs base branch (pass `false` to force a full scan, overriding config)").addOption(new Option$1("--changed-files-from <file>", "scan source files listed in a newline-delimited changed-files file").hideHelp()).option("--no-score", "skip the score API, the share URL, and crash reporting").option("--no-telemetry", "alias for --no-score (skip the score API, share URL, and crash reporting)").option("--staged", "scan only staged (git index) files for pre-commit hooks").option("--blocking <level>", "severity that fails CI: error (default), warning, or none (advisory)").addOption(new Option$1("--fail-on <level>", "[deprecated] alias for --blocking <level>").hideHelp()).option("--no-respect-inline-disables", "audit mode: neutralize inline lint suppressions before scanning").option("--warnings", "show warning-severity diagnostics (default)").option("--no-warnings", "hide warning-severity diagnostics (errors only)").option("--color", "force colored output").option("--no-color", "disable colored output (also honors NO_COLOR)").addHelpText("after", renderRootHelpEpilog);
22028
+ const collectCategoryOption = (value, previousValues) => [...previousValues ?? [], value];
22029
+ const program = new Command().name("react-doctor").description("Diagnose React codebase health").version(VERSION, "-v, --version", "display the version number").argument("[directory]", "project directory to scan", ".").option("--lint", "enable linting").option("--no-lint", "skip linting").option("--dead-code", "enable dead-code analysis (default)").option("--no-dead-code", "skip dead-code analysis (unused files / exports / dependencies, circular imports)").option("--verbose", "show every rule and per-file details (default shows top 3 rules)").option("--score", "output only the score").option("--json", "output a single structured JSON report (suppresses other output)").option("--json-compact", "with --json, emit compact JSON (no indentation)").option("-y, --yes", "skip prompts, scan all workspace projects").option("--no-parallel", "lint serially with one worker (default: parallel across CPU cores; set the worker count with REACT_DOCTOR_PARALLEL)").option("--project <name>", "select workspace project (comma-separated for multiple)").option("--diff [base]", "scan only files changed vs base branch (pass `false` to force a full scan, overriding config)").addOption(new Option$1("--changed-files-from <file>", "scan source files listed in a newline-delimited changed-files file").hideHelp()).option("--no-score", "skip the score API, the share URL, and crash reporting").addOption(new Option$1("--category <category>", "only show diagnostics in a category (repeatable; e.g. Security)").argParser(collectCategoryOption)).option("--no-telemetry", "alias for --no-score (skip the score API, share URL, and crash reporting)").option("--staged", "scan only staged (git index) files for pre-commit hooks").option("--blocking <level>", "severity that fails CI: error (default), warning, or none (advisory)").addOption(new Option$1("--fail-on <level>", "[deprecated] alias for --blocking <level>").hideHelp()).option("--no-respect-inline-disables", "audit mode: neutralize inline lint suppressions before scanning").option("--warnings", "show warning-severity diagnostics (default)").option("--no-warnings", "hide warning-severity diagnostics (errors only)").option("--color", "force colored output").option("--no-color", "disable colored output (also honors NO_COLOR)").addHelpText("after", renderRootHelpEpilog);
21583
22030
  program.action(inspectAction);
21584
22031
  program.command("why <location>").description("Explain why a rule fired (or why a suppression didn't apply) at a file:line").option("--project <name>", "select workspace project (comma-separated for multiple)").option("-c, --cwd <cwd>", "working directory", process.cwd()).option("--color", "force colored output").option("--no-color", "disable colored output (also honors NO_COLOR)").action((location, options) => whyAction(location, options));
21585
22032
  program.command("install").alias("setup").description("Install the react-doctor skill into your coding agents and optional git hook").option("-y, --yes", "skip prompts, install for all detected agents").option("--dry-run", "show what would be installed without writing files").option("--agent-hooks", "install native non-blocking agent hooks for Claude Code and Cursor").option("-c, --cwd <cwd>", "working directory", process.cwd()).option("--color", "force colored output").option("--no-color", "disable colored output (also honors NO_COLOR)").addHelpText("after", renderInstallHelpEpilog).action(installAction);
@@ -21622,4 +22069,4 @@ Promise.resolve().then(() => assertNoRemovedFlags(process.argv)).then(() => prog
21622
22069
  export {};
21623
22070
 
21624
22071
  //# sourceMappingURL=cli.js.map
21625
- //# debugId=92822f58-92ef-58d5-8850-2746c0b48fc0
22072
+ //# debugId=8f832498-1354-594d-b3a2-3688f3cf18d5