react-doctor 0.5.1-dev.038aaf7 → 0.5.1-dev.0a9d583

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]="60598d2a-66c7-5091-a013-028926866fbd")}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]="5c7334de-5fd1-50a7-bb75-1a17b3b54e4e")}catch(e){}}();
3
3
  import { createRequire } from "node:module";
4
4
  import * as NodeChildProcess from "node:child_process";
5
5
  import { execFile, execFileSync, spawn, spawnSync } from "node:child_process";
@@ -22356,6 +22356,7 @@ var Diagnostic = class extends Class("Diagnostic")({
22356
22356
  endLine: optional(Number$1),
22357
22357
  endColumn: optional(Number$1),
22358
22358
  category: String$1,
22359
+ fileContext: optional(Literals(["test", "story"])),
22359
22360
  suppressionHint: optional(String$1),
22360
22361
  relatedLocations: optional(ArraySchema(DiagnosticRelatedLocation))
22361
22362
  }) {};
@@ -37767,8 +37768,10 @@ const isFileIgnoredByPatterns = (filePath, rootDirectory, patterns) => {
37767
37768
  const relativePath = toRelativePath(filePath, rootDirectory);
37768
37769
  return patterns.some((pattern) => pattern.test(relativePath));
37769
37770
  };
37771
+ const SCRIPT_EXTENSION_FRAGMENT = "[cm]?[jt]sx?";
37772
+ const STORY_FILE_SUFFIX_PATTERN = new RegExp(`\\.(?:stories|story)\\.(?:${SCRIPT_EXTENSION_FRAGMENT})$`);
37773
+ const TEST_FILE_SUFFIX_PATTERN = new RegExp(`\\.(?:test|spec|fixture|fixtures)\\.(?:${SCRIPT_EXTENSION_FRAGMENT})$`);
37770
37774
  const TEST_FILE_DIRECTORY_PATTERN = /(?:^|\/)(?:__tests__|__test__|tests|test|__mocks__|cypress|e2e|playwright)\//;
37771
- const TEST_FILE_SUFFIX_PATTERN = /\.(?:test|spec|stories|story|fixture|fixtures)\.(?:[cm]?[jt]sx?)$/;
37772
37775
  const FIXTURE_PROJECT_PATTERN = /\/(?:fixtures|__fixtures__)\//;
37773
37776
  const SOURCE_ROOT_PATTERN = /\/(?:src|app|lib|components|pages|features|modules|packages|apps|frontend|client)\//g;
37774
37777
  const stripAboveSourceRoot = (relativePath) => {
@@ -37779,12 +37782,23 @@ const stripAboveSourceRoot = (relativePath) => {
37779
37782
  if (lastIdx >= 0) return relativePath.slice(lastIdx);
37780
37783
  return relativePath.slice(fixtureMatch.index + fixtureMatch[0].length - 1);
37781
37784
  };
37782
- const isTestFilePath = (relativePath) => {
37783
- if (relativePath.length === 0) return false;
37785
+ /**
37786
+ * Classifies where a file sits relative to shipped code. A finding in a
37787
+ * `.stories.tsx` or `.spec.ts` file never runs in front of users, so
37788
+ * renderers label those sites instead of framing them as production
37789
+ * impact (`rn-no-raw-text` in a spec doesn't say users crash).
37790
+ *
37791
+ * `"story"` is the `.stories.*` / `.story.*` suffix; `"test"` is the
37792
+ * test/spec/fixture suffixes and test directories; `"production"` is
37793
+ * the default.
37794
+ */
37795
+ const classifyFileContext = (relativePath) => {
37796
+ if (relativePath.length === 0) return "production";
37784
37797
  const forwardSlashed = relativePath.replaceAll("\\", "/");
37785
- if (TEST_FILE_SUFFIX_PATTERN.test(forwardSlashed)) return true;
37798
+ if (STORY_FILE_SUFFIX_PATTERN.test(forwardSlashed)) return "story";
37799
+ if (TEST_FILE_SUFFIX_PATTERN.test(forwardSlashed)) return "test";
37786
37800
  const scoped = stripAboveSourceRoot(forwardSlashed);
37787
- return TEST_FILE_DIRECTORY_PATTERN.test(scoped);
37801
+ return TEST_FILE_DIRECTORY_PATTERN.test(scoped) ? "test" : "production";
37788
37802
  };
37789
37803
  /**
37790
37804
  * Resolves the user-configured severity override for a rule.
@@ -38004,6 +38018,8 @@ const collectStringSet = (values) => {
38004
38018
  * 5. `rn-no-raw-text` suppression via configured `textComponents` and
38005
38019
  * `rawTextWrapperComponents` (config-driven JSX enclosure checks)
38006
38020
  * 6. inline suppressions (`// react-doctor-disable-next-line ...`)
38021
+ * 7. file-context stamping (`fileContext: "test" | "story"` on
38022
+ * survivors in non-production files, so renderers can label them)
38007
38023
  *
38008
38024
  * Returns `null` when the diagnostic is dropped, the (possibly
38009
38025
  * severity-restamped) diagnostic otherwise.
@@ -38023,7 +38039,7 @@ const buildDiagnosticPipeline = (input) => {
38023
38039
  const hasTextComponents = textComponentNames.size > 0;
38024
38040
  const hasRawTextWrappers = rawTextWrapperComponentNames.size > 0;
38025
38041
  const fileLinesCache = /* @__PURE__ */ new Map();
38026
- const testFileCache = /* @__PURE__ */ new Map();
38042
+ const fileContextCache = /* @__PURE__ */ new Map();
38027
38043
  const libraryFileCache = /* @__PURE__ */ new Map();
38028
38044
  const isLibraryFile = (filePath) => {
38029
38045
  let cached = libraryFileCache.get(filePath);
@@ -38040,11 +38056,11 @@ const buildDiagnosticPipeline = (input) => {
38040
38056
  fileLinesCache.set(filePath, lines);
38041
38057
  return lines;
38042
38058
  };
38043
- const isTest = (filePath) => {
38044
- let cached = testFileCache.get(filePath);
38059
+ const getFileContext = (filePath) => {
38060
+ let cached = fileContextCache.get(filePath);
38045
38061
  if (cached === void 0) {
38046
- cached = isTestFilePath(filePath);
38047
- testFileCache.set(filePath, cached);
38062
+ cached = classifyFileContext(filePath);
38063
+ fileContextCache.set(filePath, cached);
38048
38064
  }
38049
38065
  return cached;
38050
38066
  };
@@ -38053,7 +38069,7 @@ const buildDiagnosticPipeline = (input) => {
38053
38069
  const rule = reactDoctorPlugin.rules[diagnostic.rule];
38054
38070
  if (!rule?.tags?.includes("test-noise")) return false;
38055
38071
  if (rule.tags.includes("migration-hint")) return false;
38056
- return isTest(diagnostic.filePath);
38072
+ return getFileContext(diagnostic.filePath) !== "production";
38057
38073
  };
38058
38074
  const isRuleIgnored = (ruleIdentifier) => {
38059
38075
  for (const ignored of ignoredRules) if (isSameRuleKey(ignored, ruleIdentifier)) return true;
@@ -38110,6 +38126,11 @@ const buildDiagnosticPipeline = (input) => {
38110
38126
  };
38111
38127
  }
38112
38128
  }
38129
+ const fileContext = getFileContext(current.filePath);
38130
+ if (fileContext !== "production") current = {
38131
+ ...current,
38132
+ fileContext
38133
+ };
38113
38134
  return current;
38114
38135
  } };
38115
38136
  };
@@ -41711,8 +41732,18 @@ const shouldSuppressLocalUseHookDiagnostic = (diagnostic, rootDirectory) => {
41711
41732
  return bindingResolution !== null && !bindingResolution.isReactUseBinding;
41712
41733
  };
41713
41734
  const FILEPATH_WITH_LOCATION_PATTERN = /\S+\.\w+:\d+:\d+[\s\S]*$/;
41735
+ const LEADING_SEVERITY_LABEL_PATTERN = /^(?:Error|Warning):\s*/;
41736
+ const TRAILING_PERIOD_PATTERN = /\.$/;
41714
41737
  const REACT_COMPILER_TITLE = "React Compiler can't optimize this";
41715
- const REACT_COMPILER_MESSAGE = "This component misses React Compiler's automatic memoization & re-renders more than it should. Rewrite the flagged code so the compiler can optimize it.";
41738
+ const REACT_COMPILER_TODO_TITLE = "React Compiler doesn't support this syntax";
41739
+ const REACT_COMPILER_IMPACT = "This component misses React Compiler's automatic memoization & re-renders more than it should";
41740
+ const REACT_COMPILER_ACTION = "Rewrite the flagged code so the compiler can optimize it.";
41741
+ const REACT_COMPILER_GENERIC_MESSAGE = `${REACT_COMPILER_IMPACT}. ${REACT_COMPILER_ACTION}`;
41742
+ const buildReactCompilerMessage = (reasonSummary) => {
41743
+ const normalizedSummary = reasonSummary.replace(TRAILING_PERIOD_PATTERN, "");
41744
+ if (!normalizedSummary) return REACT_COMPILER_GENERIC_MESSAGE;
41745
+ return `${REACT_COMPILER_IMPACT}: ${normalizedSummary}. ${REACT_COMPILER_ACTION}`;
41746
+ };
41716
41747
  const PLUGIN_CATEGORY_MAP = {
41717
41748
  react: "Bugs",
41718
41749
  "react-hooks": "Bugs",
@@ -41739,7 +41770,10 @@ const getRuleRecommendation = (ruleName, project) => {
41739
41770
  };
41740
41771
  const getRuleCategory = (ruleName) => reactDoctorPlugin.rules[ruleName]?.category;
41741
41772
  const getRuleTitle = (ruleName) => reactDoctorPlugin.rules[ruleName]?.title;
41742
- const resolveDiagnosticTitle = (plugin, rule) => plugin === "react-hooks-js" ? REACT_COMPILER_TITLE : getRuleTitle(rule);
41773
+ const resolveDiagnosticTitle = (plugin, rule) => {
41774
+ if (plugin !== "react-hooks-js") return getRuleTitle(rule);
41775
+ return rule === "todo" ? REACT_COMPILER_TODO_TITLE : REACT_COMPILER_TITLE;
41776
+ };
41743
41777
  const cleanDiagnosticMessage = (message, help, plugin, rule, project) => {
41744
41778
  const cleaned = resolveCleanedDiagnostic(typeof message === "string" ? message : "", typeof help === "string" ? help : "", plugin, rule, project);
41745
41779
  return {
@@ -41748,10 +41782,19 @@ const cleanDiagnosticMessage = (message, help, plugin, rule, project) => {
41748
41782
  };
41749
41783
  };
41750
41784
  const resolveCleanedDiagnostic = (message, help, plugin, rule, project) => {
41751
- if (plugin === "react-hooks-js") return {
41752
- message: REACT_COMPILER_MESSAGE,
41753
- help: appendReanimatedSharedValueHint(message.replace(FILEPATH_WITH_LOCATION_PATTERN, "").trim() || help, rule, project)
41754
- };
41785
+ if (plugin === "react-hooks-js") {
41786
+ const bailoutReason = message.replace(FILEPATH_WITH_LOCATION_PATTERN, "").trim().replace(LEADING_SEVERITY_LABEL_PATTERN, "").trim();
41787
+ if (rule === "todo") return {
41788
+ message: REACT_COMPILER_GENERIC_MESSAGE,
41789
+ help: appendReanimatedSharedValueHint(bailoutReason || help, rule, project)
41790
+ };
41791
+ const [reasonSummary = "", ...reasonDetailLines] = bailoutReason.split("\n");
41792
+ const reasonDetail = reasonDetailLines.join("\n").trim();
41793
+ return {
41794
+ message: buildReactCompilerMessage(reasonSummary.trim()),
41795
+ help: appendReanimatedSharedValueHint(reasonDetail || help, rule, project)
41796
+ };
41797
+ }
41755
41798
  return {
41756
41799
  message: message.replace(FILEPATH_WITH_LOCATION_PATTERN, "").trim() || message,
41757
41800
  help: help || getRuleRecommendation(rule, project) || ""
@@ -42418,7 +42461,7 @@ const ScoreApiResponseSchema = Struct({
42418
42461
  })))
42419
42462
  });
42420
42463
  const parseScoreResult = (value) => getOrNull(decodeUnknownOption(ScoreApiResponseSchema)(value));
42421
- const stripFilePaths = (diagnostics) => diagnostics.map(({ filePath: _filePath, ...rest }) => rest);
42464
+ const stripLocalFileFields = (diagnostics) => diagnostics.map(({ filePath: _filePath, fileContext: _fileContext, ...rest }) => rest);
42422
42465
  const isAbortError = (error) => error instanceof Error && (error.name === "AbortError" || error.name === "TimeoutError");
42423
42466
  const describeFailure = (error) => {
42424
42467
  if (isAbortError(error)) return `timed out after ${FETCH_TIMEOUT_MS / 1e3}s`;
@@ -42431,7 +42474,7 @@ const calculateScore = async (diagnostics, options = {}) => {
42431
42474
  const requestUrl = options.isCi ? `${SCORE_API_URL}?ci=1` : SCORE_API_URL;
42432
42475
  try {
42433
42476
  const compressedBody = gzipSync(JSON.stringify({
42434
- diagnostics: stripFilePaths(diagnostics),
42477
+ diagnostics: stripLocalFileFields(diagnostics),
42435
42478
  ...options.metadata?.repo ? { repo: options.metadata.repo } : {},
42436
42479
  ...options.metadata?.sha ? { sha: options.metadata.sha } : {},
42437
42480
  ...options.metadata?.framework ? { framework: options.metadata.framework } : {},
@@ -43496,6 +43539,48 @@ const groupBy = (items, keyFn) => {
43496
43539
  * a 404. Gate the directive on this predicate.
43497
43540
  */
43498
43541
  const hasPublishedFixRecipe = (diagnostic) => diagnostic.plugin === "react-doctor" && Object.hasOwn(reactDoctorPlugin.rules, diagnostic.rule);
43542
+ const unionValues = (baseValues, overrideValues) => [...new Set([...baseValues, ...overrideValues])];
43543
+ const mergeIgnores = (baseIgnore, overrideIgnore) => {
43544
+ const mergedIgnore = {
43545
+ ...baseIgnore,
43546
+ ...overrideIgnore
43547
+ };
43548
+ if (baseIgnore.rules && overrideIgnore.rules) mergedIgnore.rules = unionValues(baseIgnore.rules, overrideIgnore.rules);
43549
+ if (baseIgnore.files && overrideIgnore.files) mergedIgnore.files = unionValues(baseIgnore.files, overrideIgnore.files);
43550
+ if (baseIgnore.tags && overrideIgnore.tags) mergedIgnore.tags = unionValues(baseIgnore.tags, overrideIgnore.tags);
43551
+ if (baseIgnore.overrides && overrideIgnore.overrides) mergedIgnore.overrides = [...baseIgnore.overrides, ...overrideIgnore.overrides];
43552
+ return mergedIgnore;
43553
+ };
43554
+ /**
43555
+ * Layer one `ReactDoctorConfig` on top of another, additively: `rules` /
43556
+ * `categories` / `supplyChain` merge per key, `ignore` lists union
43557
+ * (`ignore.overrides` concatenate), and every other field is a scalar the
43558
+ * override simply wins on when set. Returns the base unchanged when there
43559
+ * is no override, and vice versa — so callers can thread `null` /
43560
+ * `undefined` through without special-casing.
43561
+ */
43562
+ const mergeReactDoctorConfigs = (baseConfig, overrideConfig) => {
43563
+ if (overrideConfig === void 0) return baseConfig;
43564
+ if (baseConfig === null) return overrideConfig;
43565
+ const mergedConfig = {
43566
+ ...baseConfig,
43567
+ ...overrideConfig
43568
+ };
43569
+ if (baseConfig.rules && overrideConfig.rules) mergedConfig.rules = {
43570
+ ...baseConfig.rules,
43571
+ ...overrideConfig.rules
43572
+ };
43573
+ if (baseConfig.categories && overrideConfig.categories) mergedConfig.categories = {
43574
+ ...baseConfig.categories,
43575
+ ...overrideConfig.categories
43576
+ };
43577
+ if (baseConfig.supplyChain && overrideConfig.supplyChain) mergedConfig.supplyChain = {
43578
+ ...baseConfig.supplyChain,
43579
+ ...overrideConfig.supplyChain
43580
+ };
43581
+ if (baseConfig.ignore && overrideConfig.ignore) mergedConfig.ignore = mergeIgnores(baseConfig.ignore, overrideConfig.ignore);
43582
+ return mergedConfig;
43583
+ };
43499
43584
  //#endregion
43500
43585
  //#region src/cli/utils/is-ci-environment.ts
43501
43586
  const CI_ENVIRONMENT_VARIABLES = [
@@ -43604,6 +43689,8 @@ const METRIC = {
43604
43689
  cliInvoked: "cli.invoked",
43605
43690
  cliError: "cli.error",
43606
43691
  projectDetected: "project.detected",
43692
+ projectPathSelected: "project.path_selected",
43693
+ projectConfigSelected: "project.config_selected",
43607
43694
  scanCompleted: "scan.completed",
43608
43695
  scanDuration: "scan.duration",
43609
43696
  scanPhaseDuration: "scan.phase_duration",
@@ -43673,7 +43760,7 @@ const makeNoopConsole = () => ({
43673
43760
  });
43674
43761
  //#endregion
43675
43762
  //#region src/cli/utils/version.ts
43676
- const VERSION = "0.5.1-dev.038aaf7";
43763
+ const VERSION = "0.5.1-dev.0a9d583";
43677
43764
  //#endregion
43678
43765
  //#region src/cli/utils/json-mode.ts
43679
43766
  let context = null;
@@ -44031,13 +44118,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
44031
44118
  * uploads source-map artifacts under, so stack frames symbolicate. Honors the
44032
44119
  * standard `SENTRY_RELEASE` override.
44033
44120
  */
44034
- const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.5.1-dev.038aaf7`;
44121
+ const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.5.1-dev.0a9d583`;
44035
44122
  /**
44036
44123
  * Deployment environment shown in Sentry's environment filter. Defaults to
44037
44124
  * `production` for tagged releases and `development` for dev/unbuilt versions,
44038
44125
  * overridable via the standard `SENTRY_ENVIRONMENT` env var.
44039
44126
  */
44040
- const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.5.1-dev.038aaf7") ? "development" : "production");
44127
+ const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.5.1-dev.0a9d583") ? "development" : "production");
44041
44128
  /**
44042
44129
  * Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
44043
44130
  * (set to `0` to disable tracing) and falls back to
@@ -47335,12 +47422,13 @@ const toSpanAttributes = (tags) => {
47335
47422
  /**
47336
47423
  * Clears the module-level run-scoped Sentry state — the current scanned project
47337
47424
  * and the active run trace. `inspect()` calls this at the start of every run and
47338
- * again after a clean one (it's invoked once per project in a workspace scan),
47339
- * so a prior or just-finished scan can't attach its project tags / trace to a
47340
- * later run or to a non-scan error (e.g. inspectAction's post-loop
47341
- * finalize/handoff steps). A thrown scan error skips the post-run reset, leaving
47342
- * the state for the command catch to attribute and link the crash. Safe to call
47343
- * when Sentry is off (the refs are read only when an event is built).
47425
+ * again after a clean one, so a prior or just-finished scan can't attach its
47426
+ * project tags / trace to a later run or to a non-scan error (e.g.
47427
+ * inspectAction's post-loop finalize/handoff steps). A thrown scan error skips
47428
+ * the post-run reset, leaving the state for the command catch to attribute and
47429
+ * link the crash. Concurrent batch members (`concurrentScan`) never touch this
47430
+ * state — they neither write nor reset it. Safe to call when Sentry is off (the
47431
+ * refs are read only when an event is built).
47344
47432
  */
47345
47433
  const resetSentryRunState = () => {
47346
47434
  setSentryProjectInfo(null);
@@ -47363,8 +47451,13 @@ const resetSentryRunState = () => {
47363
47451
  * state right after a clean run and at the start of the next one, so the trace
47364
47452
  * is never attached to a non-scan error; on a thrown error the state is left in
47365
47453
  * place for the command catch, then the process exits.
47454
+ *
47455
+ * A `concurrentScan` (one member of the CLI's multi-project pool) still gets
47456
+ * its own root span, but skips recording the active run trace — the module-
47457
+ * level handle has single-scan semantics, and overlapping writers would link a
47458
+ * crash to an arbitrary sibling's trace.
47366
47459
  */
47367
- const withSentryRunSpan = (run) => {
47460
+ const withSentryRunSpan = (run, options = {}) => {
47368
47461
  if (!isSentryTracingEnabled()) return run(void 0);
47369
47462
  const { tags } = buildSentryScope();
47370
47463
  const command = typeof tags.command === "string" ? tags.command : "inspect";
@@ -47373,12 +47466,14 @@ const withSentryRunSpan = (run) => {
47373
47466
  op: "cli.inspect",
47374
47467
  attributes: toSpanAttributes(tags)
47375
47468
  }, (rootSpan) => {
47376
- const spanContext = rootSpan.spanContext();
47377
- setActiveRunTrace({
47378
- traceId: spanContext.traceId,
47379
- spanId: spanContext.spanId,
47380
- sampled: (spanContext.traceFlags & 1) === 1
47381
- });
47469
+ if (options.concurrentScan !== true) {
47470
+ const spanContext = rootSpan.spanContext();
47471
+ setActiveRunTrace({
47472
+ traceId: spanContext.traceId,
47473
+ spanId: spanContext.spanId,
47474
+ sampled: (spanContext.traceFlags & 1) === 1
47475
+ });
47476
+ }
47382
47477
  return run(rootSpan);
47383
47478
  });
47384
47479
  };
@@ -47389,9 +47484,15 @@ const withSentryRunSpan = (run) => {
47389
47484
  * run's root span so the transaction/trace carries the project shape too.
47390
47485
  * Always cheap — the span attribute set is skipped when `rootSpan` is absent
47391
47486
  * (tracing off), and storing the info is a plain assignment.
47487
+ *
47488
+ * A `concurrentScan` only sets the span attributes: the module-level project
47489
+ * ref has single-scan semantics, and overlapping writers would stamp events
47490
+ * and metrics with an arbitrary sibling's project. Wide events keep full
47491
+ * attribution (they ride the span); per-emit metrics simply omit the project
47492
+ * shape during a concurrent batch (absent, never wrong).
47392
47493
  */
47393
- const recordSentryProjectContext = (projectInfo, rootSpan) => {
47394
- setSentryProjectInfo(projectInfo);
47494
+ const recordSentryProjectContext = (projectInfo, rootSpan, options = {}) => {
47495
+ if (options.concurrentScan !== true) setSentryProjectInfo(projectInfo);
47395
47496
  rootSpan?.setAttributes(toSpanAttributes(buildSentryProjectContext(projectInfo).tags));
47396
47497
  };
47397
47498
  //#endregion
@@ -47628,6 +47729,12 @@ const buildOutcomeAttributes = (input) => {
47628
47729
  topRule = rule;
47629
47730
  topRuleCount = count;
47630
47731
  }
47732
+ let diagnosticsInTestFiles = 0;
47733
+ let diagnosticsInStoryFiles = 0;
47734
+ for (const diagnostic of result.diagnostics) {
47735
+ if (diagnostic.fileContext === "test") diagnosticsInTestFiles += 1;
47736
+ if (diagnostic.fileContext === "story") diagnosticsInStoryFiles += 1;
47737
+ }
47631
47738
  const attributes = {
47632
47739
  outcome,
47633
47740
  exitCode: wouldBlock ? 1 : 0,
@@ -47638,6 +47745,8 @@ const buildOutcomeAttributes = (input) => {
47638
47745
  errorCount: summary.errorCount,
47639
47746
  warningCount: summary.warningCount,
47640
47747
  affectedFiles: summary.affectedFileCount,
47748
+ diagnosticsInTestFiles,
47749
+ diagnosticsInStoryFiles,
47641
47750
  distinctRulesFired: countByRule.size,
47642
47751
  topRule,
47643
47752
  scannedFileCount: result.scannedFileCount ?? null,
@@ -47685,6 +47794,7 @@ const buildConfigAttributes = (input) => {
47685
47794
  noScore: input.noScore,
47686
47795
  respectInlineDisables: input.respectInlineDisables,
47687
47796
  showWarnings: input.showWarnings,
47797
+ usedOutputDir: input.usedOutputDir,
47688
47798
  ignoredTagCount: input.ignoredTagCount,
47689
47799
  hasCustomConfig: input.hasCustomConfig,
47690
47800
  rulesConfigured: ruleKeys.length,
@@ -47969,17 +48079,24 @@ const writeStdout = (text) => sync(() => {
47969
48079
  const POINTER = isUnicodeSupported() ? "›" : ">";
47970
48080
  const colorizeBySeverity = (text, severity) => severity === "error" ? highlighter.error(text) : highlighter.warn(text);
47971
48081
  const collectAffectedFiles = (diagnostics) => new Set(diagnostics.map((diagnostic) => diagnostic.filePath));
47972
- const buildVerboseSiteMap = (diagnostics) => {
47973
- const fileSites = /* @__PURE__ */ new Map();
48082
+ const formatFileContextTag = (diagnostic) => diagnostic.fileContext ? ` (${diagnostic.fileContext} file)` : "";
48083
+ const buildVerboseFileEntries = (diagnostics) => {
48084
+ const fileEntries = /* @__PURE__ */ new Map();
47974
48085
  for (const diagnostic of diagnostics) {
47975
- const sites = fileSites.get(diagnostic.filePath) ?? [];
47976
- if (diagnostic.line > 0) sites.push({
48086
+ let entry = fileEntries.get(diagnostic.filePath);
48087
+ if (entry === void 0) {
48088
+ entry = {
48089
+ contextTag: formatFileContextTag(diagnostic),
48090
+ sites: []
48091
+ };
48092
+ fileEntries.set(diagnostic.filePath, entry);
48093
+ }
48094
+ if (diagnostic.line > 0) entry.sites.push({
47977
48095
  line: diagnostic.line,
47978
48096
  suppressionHint: diagnostic.suppressionHint
47979
48097
  });
47980
- fileSites.set(diagnostic.filePath, sites);
47981
48098
  }
47982
- return fileSites;
48099
+ return fileEntries;
47983
48100
  };
47984
48101
  const formatSiteCountBadge = (count) => count > 1 ? `×${count}` : "";
47985
48102
  const formatTrailingSiteBadge = (count) => {
@@ -48068,10 +48185,11 @@ const clusterNearbyDiagnostics = (diagnostics) => {
48068
48185
  return clusters;
48069
48186
  };
48070
48187
  const formatClusterLocation = (cluster) => {
48071
- const { filePath } = cluster.diagnostics[0];
48072
- if (cluster.startLine <= 0) return filePath;
48073
- if (cluster.endLine > cluster.startLine) return `${filePath}:${cluster.startLine}-${cluster.endLine}`;
48074
- return `${filePath}:${cluster.startLine}`;
48188
+ const lead = cluster.diagnostics[0];
48189
+ const contextTag = formatFileContextTag(lead);
48190
+ if (cluster.startLine <= 0) return `${lead.filePath}${contextTag}`;
48191
+ if (cluster.endLine > cluster.startLine) return `${lead.filePath}:${cluster.startLine}-${cluster.endLine}${contextTag}`;
48192
+ return `${lead.filePath}:${cluster.startLine}${contextTag}`;
48075
48193
  };
48076
48194
  const buildDiagnosticClusterLines = (cluster, resolveSourceRoot, renderCodeFrame) => {
48077
48195
  const lead = cluster.diagnostics[0];
@@ -48214,25 +48332,26 @@ const formatElapsedTime = (elapsedMilliseconds) => {
48214
48332
  };
48215
48333
  const formatRuleSummary = (ruleKey, ruleDiagnostics) => {
48216
48334
  const firstDiagnostic = ruleDiagnostics[0];
48335
+ const distinctMessages = [...new Set(ruleDiagnostics.map((diagnostic) => diagnostic.message))];
48217
48336
  const sections = [
48218
48337
  `Rule: ${ruleKey}`,
48219
48338
  `Severity: ${firstDiagnostic.severity}`,
48220
48339
  `Category: ${firstDiagnostic.category}`,
48221
48340
  `Count: ${ruleDiagnostics.length}`,
48222
48341
  "",
48223
- firstDiagnostic.message
48342
+ distinctMessages.join("\n\n")
48224
48343
  ];
48225
48344
  if (firstDiagnostic.help) sections.push("", `Suggestion: ${firstDiagnostic.help}`);
48226
48345
  if (firstDiagnostic.url) sections.push("", `Docs: ${firstDiagnostic.url}`);
48227
48346
  const fixRecipeLine = formatFixRecipeLine(firstDiagnostic);
48228
48347
  if (fixRecipeLine) sections.push("", fixRecipeLine);
48229
48348
  sections.push("", "Files:");
48230
- const fileSites = buildVerboseSiteMap(ruleDiagnostics);
48231
- for (const [filePath, sites] of fileSites) if (sites.length > 0) for (const site of sites) {
48232
- sections.push(` ${filePath}:${site.line}`);
48349
+ const fileEntries = buildVerboseFileEntries(ruleDiagnostics);
48350
+ for (const [filePath, { contextTag, sites }] of fileEntries) if (sites.length > 0) for (const site of sites) {
48351
+ sections.push(` ${filePath}:${site.line}${contextTag}`);
48233
48352
  if (site.suppressionHint) sections.push(` ${site.suppressionHint}`);
48234
48353
  }
48235
- else sections.push(` ${filePath}`);
48354
+ else sections.push(` ${filePath}${contextTag}`);
48236
48355
  return sections.join("\n") + "\n";
48237
48356
  };
48238
48357
  //#endregion
@@ -48502,15 +48621,22 @@ const printNoScoreHeader = (noScoreMessage) => gen(function* () {
48502
48621
  });
48503
48622
  //#endregion
48504
48623
  //#region src/cli/utils/write-diagnostics-directory.ts
48505
- const writeDiagnosticsDirectory = (diagnostics) => {
48506
- const outputDirectory = Path.join(tmpdir(), `react-doctor-${randomUUID()}`);
48507
- NFS.mkdirSync(outputDirectory, { recursive: true });
48508
- for (const [ruleKey, ruleDiagnostics] of buildSortedRuleGroups(diagnostics)) {
48509
- const fileName = ruleKey.replace(/\//g, "--") + ".txt";
48510
- NFS.writeFileSync(Path.join(outputDirectory, fileName), formatRuleSummary(ruleKey, ruleDiagnostics));
48624
+ const ruleDumpFileName = (ruleKey) => ruleKey.replace(/\//g, "--") + ".txt";
48625
+ const readPreviousRuleDumpFileNames = (directory) => {
48626
+ try {
48627
+ const previous = JSON.parse(NFS.readFileSync(Path.join(directory, "diagnostics.json"), "utf8"));
48628
+ return new Set(previous.filter((d) => typeof d?.plugin === "string" && typeof d?.rule === "string").map((d) => ruleDumpFileName(`${d.plugin}/${d.rule}`)));
48629
+ } catch {
48630
+ return /* @__PURE__ */ new Set();
48511
48631
  }
48512
- NFS.writeFileSync(Path.join(outputDirectory, "diagnostics.json"), JSON.stringify(diagnostics));
48513
- return outputDirectory;
48632
+ };
48633
+ const writeDiagnosticsDirectory = (diagnostics, outputDirectory) => {
48634
+ const directory = outputDirectory ? Path.resolve(outputDirectory) : Path.join(tmpdir(), `react-doctor-${randomUUID()}`);
48635
+ if (outputDirectory) for (const fileName of readPreviousRuleDumpFileNames(directory)) NFS.rmSync(Path.join(directory, fileName), { force: true });
48636
+ NFS.mkdirSync(directory, { recursive: true });
48637
+ for (const [ruleKey, ruleDiagnostics] of buildSortedRuleGroups(diagnostics)) NFS.writeFileSync(Path.join(directory, ruleDumpFileName(ruleKey)), formatRuleSummary(ruleKey, ruleDiagnostics));
48638
+ NFS.writeFileSync(Path.join(directory, "diagnostics.json"), JSON.stringify(diagnostics));
48639
+ return directory;
48514
48640
  };
48515
48641
  //#endregion
48516
48642
  //#region src/cli/utils/render-summary.ts
@@ -48547,6 +48673,16 @@ const printFooter = (input) => gen(function* () {
48547
48673
  yield* log(` ${highlighter.bold("GitHub:")} ${highlighter.info(CANONICAL_GITHUB_URL)}`);
48548
48674
  yield* printFooterDescription("Report issues and star the repository!");
48549
48675
  });
48676
+ const printDiagnosticsDump = (diagnostics, outputDirectory, verbose, stream = "stdout") => gen(function* () {
48677
+ const writtenDirectory = yield* try_({
48678
+ try: () => writeDiagnosticsDirectory(diagnostics, outputDirectory),
48679
+ catch: (cause) => cause
48680
+ }).pipe(orElseSucceed(() => null));
48681
+ if (writtenDirectory !== null && (verbose || outputDirectory)) {
48682
+ const pathLine = highlighter.gray(` Full diagnostics written to ${writtenDirectory}`);
48683
+ yield* stream === "stderr" || Boolean(outputDirectory) && isJsonModeActive() ? sync(() => process.stderr.write(`${pathLine}\n`)) : log(pathLine);
48684
+ }
48685
+ });
48550
48686
  const printSummary = (input) => gen(function* () {
48551
48687
  if (input.scoreResult) {
48552
48688
  const animateProjection = Boolean(input.animateProjection) && input.potentialScore != null && !input.verbose;
@@ -48557,11 +48693,7 @@ const printSummary = (input) => gen(function* () {
48557
48693
  if (animateProjection) yield* animateScoreProjection(input.scoreResult, input.potentialScore, 5);
48558
48694
  }
48559
48695
  } else yield* printNoScoreHeader(input.noScoreMessage);
48560
- const diagnosticsDirectory = yield* try_({
48561
- try: () => writeDiagnosticsDirectory(input.diagnostics),
48562
- catch: (cause) => cause
48563
- }).pipe(orElseSucceed(() => null));
48564
- if (diagnosticsDirectory !== null && input.verbose) yield* log(highlighter.gray(` Full diagnostics written to ${diagnosticsDirectory}`));
48696
+ yield* printDiagnosticsDump(input.diagnostics, input.outputDirectory, input.verbose);
48565
48697
  });
48566
48698
  //#endregion
48567
48699
  //#region src/cli/utils/should-auto-select-current-choice.ts
@@ -48951,6 +49083,7 @@ const mergeInspectOptions = (inputOptions, userConfig) => ({
48951
49083
  lint: inputOptions.lint ?? userConfig?.lint ?? true,
48952
49084
  deadCode: inputOptions.deadCode ?? userConfig?.deadCode ?? true,
48953
49085
  verbose: inputOptions.verbose ?? userConfig?.verbose ?? false,
49086
+ outputDirectory: inputOptions.outputDirectory || null,
48954
49087
  scoreOnly: inputOptions.scoreOnly ?? false,
48955
49088
  noScore: inputOptions.noScore ?? userConfig?.noScore ?? false,
48956
49089
  isCi: inputOptions.isCi ?? false,
@@ -48967,6 +49100,7 @@ const mergeInspectOptions = (inputOptions, userConfig) => ({
48967
49100
  ignoredTags: buildIgnoredTags(userConfig),
48968
49101
  outputSurface: inputOptions.outputSurface ?? "cli",
48969
49102
  suppressRendering: inputOptions.suppressRendering ?? false,
49103
+ concurrentScan: inputOptions.concurrentScan ?? false,
48970
49104
  concurrency: inputOptions.concurrency,
48971
49105
  baseline: inputOptions.baseline ?? null,
48972
49106
  changedLineRanges: inputOptions.changedLineRanges ?? null,
@@ -48987,13 +49121,15 @@ const buildRunEventConfig = (options, userConfig, hasCustomConfig) => ({
48987
49121
  noScore: options.noScore,
48988
49122
  respectInlineDisables: options.respectInlineDisables,
48989
49123
  showWarnings: options.warnings,
49124
+ usedOutputDir: options.outputDirectory !== null,
48990
49125
  ignoredTagCount: options.ignoredTags.size,
48991
49126
  hasCustomConfig,
48992
49127
  userConfig
48993
49128
  });
48994
49129
  const inspect = async (directory, inputOptions = {}) => {
48995
49130
  const startTime = performance$1.now();
48996
- resetSentryRunState();
49131
+ const isConcurrentScan = inputOptions.concurrentScan === true;
49132
+ if (!isConcurrentScan) resetSentryRunState();
48997
49133
  const hasConfigOverride = inputOptions.configOverride !== void 0;
48998
49134
  let scanDirectory;
48999
49135
  let userConfig;
@@ -49001,7 +49137,7 @@ const inspect = async (directory, inputOptions = {}) => {
49001
49137
  if (hasConfigOverride) {
49002
49138
  scanDirectory = directory;
49003
49139
  userConfig = inputOptions.configOverride ?? null;
49004
- configSourceDirectory = null;
49140
+ configSourceDirectory = inputOptions.configSourceDirectory ?? null;
49005
49141
  } else {
49006
49142
  const scanTarget = await resolveScanTarget(directory);
49007
49143
  scanDirectory = scanTarget.resolvedDirectory;
@@ -49009,8 +49145,9 @@ const inspect = async (directory, inputOptions = {}) => {
49009
49145
  configSourceDirectory = scanTarget.configSourceDirectory;
49010
49146
  }
49011
49147
  const options = mergeInspectOptions(inputOptions, userConfig);
49148
+ const ownsSpinnerSilence = options.silent && !isConcurrentScan;
49012
49149
  const wasSpinnerSilent = isSpinnerSilent();
49013
- if (options.silent) setSpinnerSilent(true);
49150
+ if (ownsSpinnerSilence) setSpinnerSilent(true);
49014
49151
  try {
49015
49152
  const result = await withSentryRunSpan(async (rootSentrySpan) => {
49016
49153
  try {
@@ -49023,11 +49160,11 @@ const inspect = async (directory, inputOptions = {}) => {
49023
49160
  });
49024
49161
  throw error;
49025
49162
  }
49026
- });
49027
- resetSentryRunState();
49163
+ }, { concurrentScan: isConcurrentScan });
49164
+ if (!isConcurrentScan) resetSentryRunState();
49028
49165
  return result;
49029
49166
  } finally {
49030
- if (options.silent) setSpinnerSilent(wasSpinnerSilent);
49167
+ if (ownsSpinnerSilence) setSpinnerSilent(wasSpinnerSilent);
49031
49168
  }
49032
49169
  };
49033
49170
  /**
@@ -49116,7 +49253,7 @@ const runInspectWithRuntime = async (directory, options, userConfig, hasConfigOv
49116
49253
  const scanResultCache = cacheKey === null ? null : createScanResultCache(directory);
49117
49254
  const cachedPayload = cacheKey === null ? null : scanResultCache?.lookup(cacheKey) ?? null;
49118
49255
  if (cachedPayload) {
49119
- recordSentryProjectContext(cachedPayload.project, rootSentrySpan);
49256
+ recordSentryProjectContext(cachedPayload.project, rootSentrySpan, { concurrentScan: options.concurrentScan });
49120
49257
  recordCount(METRIC.projectDetected, 1);
49121
49258
  await renderCachedProjectDetection({
49122
49259
  payload: cachedPayload,
@@ -49138,7 +49275,7 @@ const runInspectWithRuntime = async (directory, options, userConfig, hasConfigOv
49138
49275
  recordOnboardingCompletion(options);
49139
49276
  return result;
49140
49277
  }
49141
- const shouldShowProgressSpinners = !options.isCiOrCodingAgentEnvironment && !options.silent && !options.scoreOnly && options.lint && Boolean(resolvedNodeBinaryPath);
49278
+ const shouldShowProgressSpinners = !options.isCiOrCodingAgentEnvironment && !options.silent && !options.scoreOnly && !options.suppressRendering && options.lint && Boolean(resolvedNodeBinaryPath);
49142
49279
  const layers = buildRuntimeLayers({
49143
49280
  directory,
49144
49281
  hasConfigOverride,
@@ -49167,7 +49304,7 @@ const runInspectWithRuntime = async (directory, options, userConfig, hasConfigOv
49167
49304
  suppressScanSummary: options.suppressRendering,
49168
49305
  supplyChainManifestChanged: options.supplyChainManifestChanged
49169
49306
  }, { beforeLint: (projectInfo, lintIncludePaths) => gen(function* () {
49170
- recordSentryProjectContext(projectInfo, rootSentrySpan);
49307
+ recordSentryProjectContext(projectInfo, rootSentrySpan, { concurrentScan: options.concurrentScan });
49171
49308
  recordCount(METRIC.projectDetected, 1);
49172
49309
  if (options.scoreOnly || options.suppressRendering) return;
49173
49310
  const lintSourceFileCount = lintIncludePaths?.length ?? projectInfo.sourceFileCount;
@@ -49317,15 +49454,16 @@ const finalizeAndRender = (input) => gen(function* () {
49317
49454
  ...baselineDelta ? { baselineDelta } : {}
49318
49455
  });
49319
49456
  if (options.suppressRendering) return buildResult();
49457
+ const surfaceDiagnostics = filterDiagnosticsForSurface([...diagnostics], options.outputSurface, userConfig);
49458
+ const printedDiagnostics = filterDiagnosticsByCategories(surfaceDiagnostics, options.categoryFilters);
49320
49459
  if (options.scoreOnly) {
49460
+ if (options.outputDirectory !== null) yield* printDiagnosticsDump(printedDiagnostics, options.outputDirectory, false, "stderr");
49321
49461
  if (score) yield* log(`${score.score}`);
49322
- else yield* log(highlighter.gray(noScoreMessage));
49462
+ else yield* error$1(highlighter.gray(noScoreMessage));
49323
49463
  return buildResult();
49324
49464
  }
49325
49465
  const animateRender = !options.silent && !options.verbose && canAnimateOnboarding(process.stdout);
49326
49466
  const pause = onboardingSectionPause(animateRender);
49327
- const surfaceDiagnostics = filterDiagnosticsForSurface([...diagnostics], options.outputSurface, userConfig);
49328
- const printedDiagnostics = filterDiagnosticsByCategories(surfaceDiagnostics, options.categoryFilters);
49329
49467
  const demotedDiagnosticCount = diagnostics.length - surfaceDiagnostics.length;
49330
49468
  const lintSourceFileCount = options.includePaths.length > 0 ? options.includePaths.length : project.sourceFileCount;
49331
49469
  if (printedDiagnostics.length === 0) {
@@ -49343,6 +49481,7 @@ const finalizeAndRender = (input) => gen(function* () {
49343
49481
  yield* log(highlighter.gray(" Score not shown — some checks could not complete."));
49344
49482
  } else if (score) yield* printScoreHeader(score);
49345
49483
  else yield* printNoScoreHeader(noScoreMessage);
49484
+ if (options.outputDirectory !== null) yield* printDiagnosticsDump(printedDiagnostics, options.outputDirectory);
49346
49485
  return buildResult();
49347
49486
  }
49348
49487
  yield* pause;
@@ -49367,6 +49506,7 @@ const finalizeAndRender = (input) => gen(function* () {
49367
49506
  totalSourceFileCount: lintSourceFileCount,
49368
49507
  noScoreMessage,
49369
49508
  verbose: options.verbose,
49509
+ outputDirectory: options.outputDirectory,
49370
49510
  animateProjection: animateRender
49371
49511
  });
49372
49512
  if (hasSkippedChecks) {
@@ -49538,9 +49678,9 @@ const isExpectedUserError = (error) => error instanceof CliInputError || isProje
49538
49678
  //#region src/cli/utils/build-handoff-payload.ts
49539
49679
  const buildHandoffPayload = (input) => {
49540
49680
  const topGroups = buildSortedRuleGroups(input.diagnostics).slice(0, 3);
49541
- let diagnosticsDirectory = null;
49681
+ let outputDirectory = null;
49542
49682
  try {
49543
- diagnosticsDirectory = writeDiagnosticsDirectory([...input.diagnostics]);
49683
+ outputDirectory = writeDiagnosticsDirectory([...input.diagnostics], input.outputDirectory);
49544
49684
  } catch {}
49545
49685
  const lines = [
49546
49686
  "Before fixing anything, first ask me whether I'd like to add React Doctor to CI so every pull request is scanned automatically. Explain that:",
@@ -49567,7 +49707,7 @@ const buildHandoffPayload = (input) => {
49567
49707
  if (remainingFiles > 0) lines.push(` - +${remainingFiles} more files`);
49568
49708
  });
49569
49709
  lines.push("");
49570
- if (diagnosticsDirectory) lines.push(`Full results for all ${input.diagnostics.length} issues (diagnostics.json + a .txt per rule): ${diagnosticsDirectory}`, "");
49710
+ if (outputDirectory) lines.push(`Full results for all ${input.diagnostics.length} issues (diagnostics.json + a .txt per rule): ${outputDirectory}`, "");
49571
49711
  lines.push("Read each file and fix the root cause — don't suppress or silence the rule.", "", "Verify against the real thing, don't assume: confirm each change matches the canonical fix recipe you fetched for that rule, then re-run `npx react-doctor@latest --verbose` and check the issue is actually gone against the real tool before moving on.", "", "Teach me as you go: for every issue you touch, explain it in plain language (no jargon) — what the problem is, why it's a problem, and how serious it is in human terms. Describe the real-world impact and severity concretely (e.g. \"this crashes the page for users on Safari\" vs. \"this is a minor cleanup with no user impact\") so I understand why it matters, not just what changed.", "", "Then work through the rest from the full results above.");
49572
49712
  return lines.join("\n");
49573
49713
  };
@@ -51466,7 +51606,8 @@ const handoffToAgent = async (input) => {
51466
51606
  if (handoffTarget === void 0 || handoffTarget === SKIP_CHOICE) return;
51467
51607
  const payload = buildHandoffPayload({
51468
51608
  diagnostics: input.diagnostics,
51469
- projectName: input.projectName
51609
+ projectName: input.projectName,
51610
+ outputDirectory: input.outputDirectory
51470
51611
  });
51471
51612
  if (handoffTarget === CLIPBOARD_CHOICE) {
51472
51613
  if (await copyToClipboard(payload)) cliLogger.log("Copied the prompt to your clipboard.");
@@ -51687,6 +51828,9 @@ const readChangedFilesFrom = (filePath) => {
51687
51828
  return [...uniqueFiles];
51688
51829
  };
51689
51830
  //#endregion
51831
+ //#region src/cli/utils/filter-scans-for-surface.ts
51832
+ const filterScansForSurface = (completedScans, surface) => completedScans.flatMap((scan) => filterDiagnosticsForSurface([...scan.result.diagnostics], surface, scan.config));
51833
+ //#endregion
51690
51834
  //#region src/cli/utils/render-multi-project-summary.ts
51691
51835
  const getScoreLabel = (score) => {
51692
51836
  if (score >= 75) return "Great";
@@ -51714,10 +51858,10 @@ const findLowestScoredScan = (completedScans) => {
51714
51858
  return scoredScans.reduce((worst, scan) => scan.result.score.score < worst.result.score.score ? scan : worst);
51715
51859
  };
51716
51860
  const printMultiProjectSummary = (input) => gen(function* () {
51717
- const { completedScans, userConfig, verbose, isOffline, projectName } = input;
51861
+ const { completedScans, verbose, isOffline, projectName, totalElapsedMilliseconds } = input;
51718
51862
  const categoryFilters = input.categoryFilters ?? /* @__PURE__ */ new Set();
51719
51863
  const animateRender = !verbose && canAnimateOnboarding(process.stdout);
51720
- const displayDiagnostics = filterDiagnosticsByCategories(filterDiagnosticsForSurface(completedScans.flatMap((scan) => scan.result.diagnostics), "cli", userConfig), categoryFilters);
51864
+ const displayDiagnostics = filterDiagnosticsByCategories(filterScansForSurface(completedScans, "cli"), categoryFilters);
51721
51865
  const projectRootByDiagnostic = /* @__PURE__ */ new WeakMap();
51722
51866
  for (const scan of completedScans) for (const diagnostic of scan.result.diagnostics) projectRootByDiagnostic.set(diagnostic, scan.result.project.rootDirectory);
51723
51867
  const resolveDiagnosticSourceRoot = (diagnostic) => projectRootByDiagnostic.get(diagnostic) ?? "";
@@ -51729,8 +51873,7 @@ const printMultiProjectSummary = (input) => gen(function* () {
51729
51873
  else fileCountFromScansWithoutPaths += scan.result.scannedFileCount ?? scan.result.project.sourceFileCount;
51730
51874
  }
51731
51875
  const totalScannedFileCount = uniqueScannedFilePaths.size + fileCountFromScansWithoutPaths;
51732
- const totalScanElapsedMilliseconds = completedScans.reduce((sum, scan) => sum + (scan.result.scanElapsedMilliseconds ?? scan.result.elapsedMilliseconds), 0);
51733
- yield* log(`${highlighter.success("✔")} Scanned ${totalScannedFileCount} ${totalScannedFileCount === 1 ? "file" : "files"} in ${formatElapsedTime(totalScanElapsedMilliseconds)}`);
51876
+ yield* log(`${highlighter.success("✔")} Scanned ${totalScannedFileCount} ${totalScannedFileCount === 1 ? "file" : "files"} in ${formatElapsedTime(totalElapsedMilliseconds)}`);
51734
51877
  if (displayDiagnostics.length > 0) {
51735
51878
  yield* log("");
51736
51879
  yield* printDiagnostics(displayDiagnostics, verbose, resolveDiagnosticSourceRoot, buildRulePriorityMap(completedScans.map((scan) => scan.result.score)), isCodingAgentEnvironment(), { animateCountUp: animateRender });
@@ -51740,16 +51883,17 @@ const printMultiProjectSummary = (input) => gen(function* () {
51740
51883
  const totalSourceFileCount = completedScans.reduce((sum, scan) => sum + scan.result.project.sourceFileCount, 0);
51741
51884
  yield* printSummary({
51742
51885
  diagnostics: displayDiagnostics,
51743
- elapsedMilliseconds: completedScans.reduce((sum, scan) => sum + scan.result.elapsedMilliseconds, 0),
51886
+ elapsedMilliseconds: totalElapsedMilliseconds,
51744
51887
  scoreResult: aggregateScore,
51745
- potentialScore: lowestScoredScan ? yield* promise(() => computeProjectedScore(displayDiagnostics, filterDiagnosticsForSurface(lowestScoredScan.result.diagnostics, "cli", userConfig), lowestScoredScan.result.score)) : null,
51888
+ potentialScore: lowestScoredScan ? yield* promise(() => computeProjectedScore(displayDiagnostics, filterScansForSurface([lowestScoredScan], "cli"), lowestScoredScan.result.score)) : null,
51746
51889
  totalSourceFileCount,
51747
51890
  noScoreMessage: "Score unavailable.",
51748
51891
  verbose,
51892
+ outputDirectory: input.outputDirectory,
51749
51893
  animateProjection: animateRender
51750
51894
  });
51751
51895
  const entries = completedScans.map((scan) => {
51752
- const projectDiagnostics = filterDiagnosticsByCategories(filterDiagnosticsForSurface([...scan.result.diagnostics], "cli", userConfig), categoryFilters);
51896
+ const projectDiagnostics = filterDiagnosticsByCategories(filterScansForSurface([scan], "cli"), categoryFilters);
51753
51897
  const errorCount = projectDiagnostics.filter((diagnostic) => diagnostic.severity === "error").length;
51754
51898
  return {
51755
51899
  projectName: scan.result.project.projectName,
@@ -51846,6 +51990,7 @@ const resolveCliInspectOptions = (flags, userConfig) => {
51846
51990
  lint: flags.lint,
51847
51991
  deadCode: flags.deadCode,
51848
51992
  verbose: flags.verbose,
51993
+ outputDirectory: flags.outputDir,
51849
51994
  respectInlineDisables: flags.respectInlineDisables === false ? false : void 0,
51850
51995
  warnings: wantsWarningGate ? true : flags.warnings,
51851
51996
  scoreOnly: flags.score === true,
@@ -52095,16 +52240,22 @@ const parseFileLineArgument = (rawArgument) => {
52095
52240
  };
52096
52241
  //#endregion
52097
52242
  //#region src/cli/utils/select-projects.ts
52098
- const selectProjects = async (rootDirectory, projectFlag, skipPrompts) => {
52243
+ const selectProjects = async (rootDirectory, projectFlag, skipPrompts, configProjects) => {
52099
52244
  const hasRootPackageJson = isFile(Path.join(rootDirectory, "package.json"));
52100
52245
  let packages = listWorkspacePackages(rootDirectory);
52101
52246
  if (packages.length === 0 && (!hasRootPackageJson || isMonorepoRoot(rootDirectory))) packages = discoverReactSubprojects(rootDirectory);
52247
+ if (projectFlag) return resolveProjectFlag(projectFlag, packages, rootDirectory);
52248
+ const configRequestedNames = (configProjects ?? []).map((requestedName) => requestedName.trim()).filter((requestedName) => requestedName.length > 0);
52249
+ if (configRequestedNames.length > 0) {
52250
+ const resolvedDirectories = resolveRequestedProjects(configRequestedNames, packages, rootDirectory, "config");
52251
+ recordCount(METRIC.projectConfigSelected, resolvedDirectories.length);
52252
+ return resolvedDirectories;
52253
+ }
52102
52254
  if (packages.length === 0) return [rootDirectory];
52103
52255
  if (packages.length === 1) {
52104
52256
  cliLogger.log(`${highlighter.success("✔")} Select projects ${highlighter.dim("›")} ${packages[0].name}`);
52105
52257
  return [packages[0].directory];
52106
52258
  }
52107
- if (projectFlag) return resolveProjectFlag(projectFlag, packages);
52108
52259
  if (skipPrompts) {
52109
52260
  printDiscoveredProjects(packages);
52110
52261
  return packages.map((workspacePackage) => workspacePackage.directory);
@@ -52112,17 +52263,25 @@ const selectProjects = async (rootDirectory, projectFlag, skipPrompts) => {
52112
52263
  return promptProjectSelection(packages, rootDirectory);
52113
52264
  };
52114
52265
  const ALL_PROJECTS_SENTINEL = "*";
52115
- const resolveProjectFlag = (projectFlag, workspacePackages) => {
52266
+ const resolveProjectFlag = (projectFlag, workspacePackages, rootDirectory) => {
52116
52267
  const requestedNames = projectFlag.split(",").map((name) => name.trim()).filter((name) => name.length > 0);
52117
52268
  if (requestedNames.length === 0) throw new CliInputError(`--project "${projectFlag}" did not name any project. Pass a project name, a comma-separated list, or "*" for all.`);
52118
- if (requestedNames.includes(ALL_PROJECTS_SENTINEL)) return workspacePackages.map((workspacePackage) => workspacePackage.directory);
52119
- const resolvedDirectories = [];
52120
- for (const requestedName of requestedNames) {
52269
+ return resolveRequestedProjects(requestedNames, workspacePackages, rootDirectory, "flag");
52270
+ };
52271
+ const resolveRequestedProjects = (requestedNames, workspacePackages, rootDirectory, source) => {
52272
+ if (requestedNames.includes(ALL_PROJECTS_SENTINEL)) return workspacePackages.length > 0 ? workspacePackages.map((workspacePackage) => workspacePackage.directory) : [rootDirectory];
52273
+ const sourceLabel = source === "flag" ? "Project" : "Config \"projects\" entry";
52274
+ return requestedNames.map((requestedName) => {
52121
52275
  const matched = workspacePackages.find((workspacePackage) => workspacePackage.name === requestedName || Path.basename(workspacePackage.directory) === requestedName);
52122
- if (!matched) throw new CliInputError(`Project "${requestedName}" not found. Available: ${workspacePackages.map((workspacePackage) => workspacePackage.name).join(", ")}`);
52123
- resolvedDirectories.push(matched.directory);
52124
- }
52125
- return resolvedDirectories;
52276
+ if (matched) return matched.directory;
52277
+ const candidateDirectory = Path.resolve(rootDirectory, requestedName);
52278
+ if (isDirectory(candidateDirectory)) {
52279
+ recordCount(METRIC.projectPathSelected);
52280
+ return candidateDirectory;
52281
+ }
52282
+ const availableNames = workspacePackages.map((workspacePackage) => workspacePackage.name).join(", ");
52283
+ throw new CliInputError(workspacePackages.length > 0 ? `${sourceLabel} "${requestedName}" is not a workspace project or a directory. Available projects: ${availableNames}` : `${sourceLabel} "${requestedName}" is not a directory under ${rootDirectory}.`);
52284
+ });
52126
52285
  };
52127
52286
  const printDiscoveredProjects = (packages) => {
52128
52287
  cliLogger.log(`${highlighter.success("✔")} Select projects ${highlighter.dim("›")} ${packages.map((workspacePackage) => workspacePackage.name).join(", ")}`);
@@ -52317,7 +52476,7 @@ const finalizeScans = (input) => {
52317
52476
  }));
52318
52477
  }
52319
52478
  if (input.isScoreOnly || baselineDegraded) return;
52320
- if (shouldBlockCi(filterDiagnosticsForSurface(input.diagnostics, "ciFailure", input.userConfig), resolveBlockingLevel(input.flags, input.userConfig))) process.exitCode = 1;
52479
+ if (shouldBlockCi(filterScansForSurface(input.completedScans, "ciFailure"), resolveBlockingLevel(input.flags, input.userConfig))) process.exitCode = 1;
52321
52480
  };
52322
52481
  const buildChangedFilesDiffInfo = (changedFiles) => ({
52323
52482
  currentBranch: process.env.GITHUB_HEAD_REF?.trim() || null,
@@ -52450,7 +52609,6 @@ const inspectAction = async (directory, flags) => {
52450
52609
  filePath: Path.isAbsolute(diagnostic.filePath) ? diagnostic.filePath.replaceAll(snapshot.tempDirectory, () => resolvedDirectory) : diagnostic.filePath
52451
52610
  }));
52452
52611
  finalizeScans({
52453
- diagnostics: remappedDiagnostics,
52454
52612
  completedScans: [{
52455
52613
  directory: resolvedDirectory,
52456
52614
  result: {
@@ -52460,7 +52618,8 @@ const inspectAction = async (directory, flags) => {
52460
52618
  ...scanResult.project,
52461
52619
  rootDirectory: resolvedDirectory
52462
52620
  }
52463
- }
52621
+ },
52622
+ config: userConfig
52464
52623
  }],
52465
52624
  mode: "staged",
52466
52625
  diff: null,
@@ -52478,7 +52637,7 @@ const inspectAction = async (directory, flags) => {
52478
52637
  }
52479
52638
  return;
52480
52639
  }
52481
- const projectDirectories = await selectProjects(resolvedDirectory, flags.project, skipPrompts);
52640
+ const projectDirectories = await selectProjects(resolvedDirectory, flags.project, skipPrompts, userConfig?.projects);
52482
52641
  const changedFilesDiffInfo = flags.changedFilesFrom ? buildChangedFilesDiffInfo(readChangedFilesFrom(Path.resolve(flags.changedFilesFrom))) : null;
52483
52642
  const requestedScope = resolveScope(flags, userConfig);
52484
52643
  const scopeRequest = requestedScope.scope === void 0 && changedFilesDiffInfo !== null ? {
@@ -52516,56 +52675,87 @@ const inspectAction = async (directory, flags) => {
52516
52675
  }
52517
52676
  cliLogger.break();
52518
52677
  }
52519
- const allDiagnostics = [];
52520
52678
  const completedScans = [];
52521
52679
  const isMultiProject = projectDirectories.length > 1;
52522
- const supplyChainEnabled = userConfig?.supplyChain?.enabled !== false;
52523
- for (const projectDirectory of projectDirectories) {
52680
+ const scanProject = async (projectDirectory) => {
52681
+ const projectScanTarget = projectDirectory === resolvedDirectory ? scanTarget : await resolveScanTarget(projectDirectory, { allowAmbiguous: true });
52682
+ const scanDirectory = projectScanTarget.resolvedDirectory;
52683
+ const projectConfig = projectDirectory === resolvedDirectory ? userConfig : mergeReactDoctorConfigs(userConfig, projectScanTarget.userConfig ?? void 0);
52684
+ const projectConfigSourceDirectory = projectScanTarget.userConfig?.plugins === void 0 ? scanTarget.configSourceDirectory : projectScanTarget.configSourceDirectory;
52685
+ const supplyChainEnabled = projectConfig?.supplyChain?.enabled !== false;
52524
52686
  let includePaths;
52525
52687
  let supplyChainManifestChanged = false;
52526
52688
  if (isDiffMode) {
52527
- const changedSourceFiles = diffInfo === null ? [] : resolveProjectDiffIncludePaths(resolvedDirectory, projectDirectory, diffInfo);
52528
- supplyChainManifestChanged = supplyChainEnabled && diffInfo !== null && projectManifestChanged(resolvedDirectory, projectDirectory, diffInfo);
52689
+ const changedSourceFiles = diffInfo === null ? [] : resolveProjectDiffIncludePaths(resolvedDirectory, scanDirectory, diffInfo);
52690
+ supplyChainManifestChanged = supplyChainEnabled && diffInfo !== null && projectManifestChanged(resolvedDirectory, scanDirectory, diffInfo);
52529
52691
  if (changedSourceFiles.length === 0 && !supplyChainManifestChanged) {
52530
52692
  if (!isQuiet) {
52531
- cliLogger.dim(`No changed source files in ${projectDirectory}, skipping.`);
52693
+ cliLogger.dim(`No changed source files in ${scanDirectory}, skipping.`);
52532
52694
  cliLogger.break();
52533
52695
  }
52534
- continue;
52696
+ return null;
52535
52697
  }
52536
52698
  includePaths = [...changedSourceFiles];
52537
52699
  if (supplyChainManifestChanged) includePaths.push("package.json");
52538
52700
  }
52539
52701
  if (!isQuiet && !isMultiProject) cliLogger.dim(" ");
52540
- const scanResult = await inspect(projectDirectory, {
52702
+ const scanResult = await inspect(scanDirectory, {
52541
52703
  ...scanOptions,
52542
52704
  includePaths,
52543
- configOverride: userConfig,
52705
+ configOverride: projectConfig,
52706
+ configSourceDirectory: projectConfigSourceDirectory ?? void 0,
52544
52707
  suppressRendering: isMultiProject,
52708
+ concurrentScan: isMultiProject,
52545
52709
  baseline: baselineRef ? { ref: baselineRef } : void 0,
52546
- changedLineRanges: scope === "lines" && changedLineRanges !== null ? resolveProjectChangedLineRanges(resolvedDirectory, projectDirectory, changedLineRanges) : void 0,
52710
+ changedLineRanges: scope === "lines" && changedLineRanges !== null ? resolveProjectChangedLineRanges(resolvedDirectory, scanDirectory, changedLineRanges) : void 0,
52547
52711
  supplyChainManifestChanged
52548
52712
  });
52549
- allDiagnostics.push(...scanResult.diagnostics);
52550
- completedScans.push({
52551
- directory: projectDirectory,
52552
- result: scanResult
52553
- });
52554
52713
  if (!isQuiet && !isMultiProject) cliLogger.break();
52714
+ return {
52715
+ directory: scanDirectory,
52716
+ result: scanResult,
52717
+ config: projectConfig
52718
+ };
52719
+ };
52720
+ const scanLoopStartTime = performance$1.now();
52721
+ const projectCount = projectDirectories.length;
52722
+ const batchSpinner = isMultiProject && !isQuiet ? spinner(`Scanning ${projectCount} projects…`).start() : null;
52723
+ const ownsBatchSpinnerSilence = isMultiProject && scanOptions.silent === true;
52724
+ const wasSpinnerSilent = isSpinnerSilent();
52725
+ if (ownsBatchSpinnerSilence) setSpinnerSilent(true);
52726
+ let finishedProjectCount = 0;
52727
+ let scanOutcomes;
52728
+ try {
52729
+ scanOutcomes = await mapWithConcurrency(projectDirectories, isMultiProject ? 4 : 1, async (projectDirectory) => {
52730
+ const scanOutcome = await scanProject(projectDirectory);
52731
+ finishedProjectCount += 1;
52732
+ batchSpinner?.update(`Scanning ${projectCount} projects… (${finishedProjectCount}/${projectCount})`);
52733
+ return scanOutcome;
52734
+ });
52735
+ } finally {
52736
+ if (ownsBatchSpinnerSilence) setSpinnerSilent(wasSpinnerSilent);
52737
+ batchSpinner?.stop();
52738
+ }
52739
+ for (const scanOutcome of scanOutcomes) {
52740
+ if (scanOutcome === null) continue;
52741
+ completedScans.push(scanOutcome);
52555
52742
  }
52556
52743
  if (!isQuiet && isMultiProject && completedScans.length > 0) {
52557
52744
  const shouldShowShareLink = !scanOptions.noScore && (userConfig?.share ?? true) && !scanOptions.isCi;
52558
52745
  await runPromise(printMultiProjectSummary({
52559
52746
  completedScans,
52560
52747
  categoryFilters,
52561
- userConfig,
52562
52748
  verbose: Boolean(flags.verbose),
52749
+ outputDirectory: flags.outputDir,
52563
52750
  isOffline: !shouldShowShareLink,
52564
- projectName: Path.basename(resolvedDirectory)
52751
+ projectName: Path.basename(resolvedDirectory),
52752
+ totalElapsedMilliseconds: performance$1.now() - scanLoopStartTime
52565
52753
  }));
52566
52754
  }
52755
+ const selectedSurfaceDiagnostics = filterDiagnosticsByCategories(filterScansForSurface(completedScans, scanOptions.outputSurface ?? "cli"), categoryFilters);
52756
+ const didScansWriteDump = isMultiProject ? !isQuiet && completedScans.length > 0 : completedScans.length > 0;
52757
+ if (flags.outputDir && !didScansWriteDump) await runPromise(printDiagnosticsDump(selectedSurfaceDiagnostics, flags.outputDir, false, isQuiet ? "stderr" : "stdout"));
52567
52758
  finalizeScans({
52568
- diagnostics: allDiagnostics,
52569
52759
  completedScans,
52570
52760
  mode: baselineRef ? "baseline" : isDiffMode ? "diff" : "full",
52571
52761
  diff: isDiffMode ? diffInfo : null,
@@ -52578,13 +52768,13 @@ const inspectAction = async (directory, flags) => {
52578
52768
  resolvedDirectory,
52579
52769
  startTime
52580
52770
  });
52581
- const selectedSurfaceDiagnostics = filterDiagnosticsByCategories(filterDiagnosticsForSurface(allDiagnostics, scanOptions.outputSurface ?? "cli", userConfig), categoryFilters);
52582
52771
  if (!isQuiet && !skipPrompts && process.stdout.isTTY === true && !isCiOrCodingAgentEnvironment() && selectedSurfaceDiagnostics.length > 0) {
52583
52772
  await handoffToAgent({
52584
52773
  diagnostics: selectedSurfaceDiagnostics,
52585
52774
  projectName: Path.basename(resolvedDirectory),
52586
52775
  rootDirectory: resolvedDirectory,
52587
- interactive: true
52776
+ interactive: true,
52777
+ outputDirectory: flags.outputDir
52588
52778
  });
52589
52779
  return;
52590
52780
  }
@@ -53380,6 +53570,7 @@ const ROOT_FLAG_SPEC = {
53380
53570
  "--category",
53381
53571
  "--changed-files-from",
53382
53572
  "--blocking",
53573
+ "--output-dir",
53383
53574
  "--fail-on",
53384
53575
  "--project",
53385
53576
  "--scope"
@@ -53534,6 +53725,7 @@ ${formatExampleLines([
53534
53725
  ["react-doctor", "scan the current project"],
53535
53726
  ["react-doctor ./apps/web", "scan a specific directory"],
53536
53727
  ["react-doctor --diff main", "scan only files changed vs. main"],
53728
+ ["react-doctor --project modules/a,modules/b", "score each module separately (names or paths)"],
53537
53729
  ["react-doctor --staged", "scan staged files (pre-commit hook)"],
53538
53730
  ["react-doctor --category Security", "show only one diagnostic category"],
53539
53731
  ["react-doctor --blocking warning", "fail CI on warnings too (default: error)"],
@@ -53565,9 +53757,9 @@ ${highlighter.dim("Learn more:")}
53565
53757
  ${highlighter.info(CANONICAL_GITHUB_URL)}
53566
53758
  `;
53567
53759
  const collectCategoryOption = (value, previousValues) => [...previousValues ?? [], value];
53568
- 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("--scope <value>", "how much to scan/report: full (default), files, changed (only new issues vs base), or lines (only changed lines)").option("--base <ref>", "base git ref for files/changed/lines scope (auto-detected when omitted)").addOption(new Option("--diff [base]", "[deprecated] alias for --scope changed (pass `false` to force a full scan)").hideHelp()).addOption(new Option("--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("--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("--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("--sfw", "demo: print the Socket.dev supply-chain score of every direct dependency, then exit").option("--color", "force colored output").option("--no-color", "disable colored output (also honors NO_COLOR)").addHelpText("after", renderRootHelpEpilog);
53760
+ 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("--output-dir <dir>", "directory for the full diagnostics dump (default: a temp folder)").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 projects: workspace names or directory paths (comma-separated for multiple); overrides the `projects` config field").option("--scope <value>", "how much to scan/report: full (default), files, changed (only new issues vs base), or lines (only changed lines)").option("--base <ref>", "base git ref for files/changed/lines scope (auto-detected when omitted)").addOption(new Option("--diff [base]", "[deprecated] alias for --scope changed (pass `false` to force a full scan)").hideHelp()).addOption(new Option("--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("--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("--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("--sfw", "demo: print the Socket.dev supply-chain score of every direct dependency, then exit").option("--color", "force colored output").option("--no-color", "disable colored output (also honors NO_COLOR)").addHelpText("after", renderRootHelpEpilog);
53569
53761
  program.action(inspectAction);
53570
- 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));
53762
+ 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 projects: workspace names or directory paths (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));
53571
53763
  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);
53572
53764
  program.command("version").description("show the version with Node and platform info").option("--color", "force colored output").option("--no-color", "disable colored output (also honors NO_COLOR)").action(versionAction);
53573
53765
  const rules = program.command("rules").description("List, explain, and configure which React Doctor rules run");
@@ -53608,4 +53800,4 @@ Promise.resolve().then(() => assertNoRemovedFlags(process.argv)).then(() => prog
53608
53800
  export {};
53609
53801
 
53610
53802
  //# sourceMappingURL=cli.js.map
53611
- //# debugId=60598d2a-66c7-5091-a013-028926866fbd
53803
+ //# debugId=5c7334de-5fd1-50a7-bb75-1a17b3b54e4e