react-doctor 0.5.8-dev.5774deb → 0.5.8-dev.5893a56

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/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- MIT License
1
+ Modified MIT License
2
2
 
3
3
  Copyright (c) 2026 Million Software, Inc.
4
4
 
@@ -19,3 +19,16 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
22
+
23
+ Our only modification is that the following uses require prior written
24
+ permission from the copyright holder. To request permission, contact
25
+ founders@million.dev.
26
+
27
+ 1. Using the Software, its source code, or any derivative works thereof, in
28
+ whole or in part, as training, fine-tuning, or evaluation data, or as input
29
+ to any automated pipeline for training or improving any machine learning
30
+ model or AI system.
31
+
32
+ 2. Selling the Software, or offering it to third parties as a paid, hosted, or
33
+ managed product or service (including any commercial API or SaaS offering)
34
+ whose value derives entirely or substantially from the Software.
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]="498477a7-1f41-5ecb-9999-c48cfef57259")}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]="eb7a01bc-f737-5207-b430-b8fee7a1895f")}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";
@@ -44730,6 +44730,61 @@ const computeConfigFingerprint = (projectDirectory, version) => {
44730
44730
  }
44731
44731
  return crypto.createHash("sha1").update(parts.join("|")).digest("hex");
44732
44732
  };
44733
+ const AI_TRAINING_ENV_VARS = [
44734
+ ["HF_DATASETS_CACHE", "huggingface"],
44735
+ ["HF_HOME", "huggingface"],
44736
+ ["HUGGINGFACE_HUB_CACHE", "huggingface"],
44737
+ ["SPACE_ID", "huggingface-spaces"],
44738
+ ["CUDA_VISIBLE_DEVICES", "cuda"],
44739
+ ["NVIDIA_VISIBLE_DEVICES", "nvidia"],
44740
+ ["ROCR_VISIBLE_DEVICES", "rocm"],
44741
+ ["TPU_NAME", "google-tpu"],
44742
+ ["WANDB_RUN_ID", "wandb"],
44743
+ ["WANDB_SWEEP_ID", "wandb"],
44744
+ ["MLFLOW_RUN_ID", "mlflow"],
44745
+ ["MLFLOW_TRACKING_URI", "mlflow"],
44746
+ ["COMET_EXPERIMENT_KEY", "comet"],
44747
+ ["NEPTUNE_RUN_ID", "neptune"],
44748
+ ["CLEARML_TASK_ID", "clearml"],
44749
+ ["DVC_STAGE", "dvc"],
44750
+ ["RAY_WORKER_PROCESS", "ray"],
44751
+ ["RAY_ADDRESS", "ray"],
44752
+ ["MUJOCO_GL", "mujoco"],
44753
+ ["MUJOCO_PATH", "mujoco"],
44754
+ ["GYM_DISABLE_ENV_CHECKER", "gymnasium"],
44755
+ ["SM_TRAINING_ENV", "sagemaker"],
44756
+ ["TRAINING_JOB_ARN", "sagemaker"],
44757
+ ["SAGEMAKER_BASE_DIR", "sagemaker"],
44758
+ ["AZUREML_RUN_ID", "azure-ml"],
44759
+ ["AZURE_ML_MODEL_DIR", "azure-ml"],
44760
+ ["CLOUD_ML_PROJECT_ID", "vertex-ai"],
44761
+ ["VERTEX_AI_LOG_LEVEL", "vertex-ai"],
44762
+ ["DET_MASTER", "determined-ai"],
44763
+ ["LIGHTNING_USER_ID", "lightning-ai"],
44764
+ ["FLYTE_INTERNAL_EXECUTION_ID", "flyte"],
44765
+ ["ARGO_WORKFLOW_NAME", "argo-workflows"],
44766
+ ["KFP_POD_NAME", "kubeflow-pipelines"],
44767
+ ["KAGGLE_KERNEL_RUN_TYPE", "kaggle"],
44768
+ ["COLAB_BACKEND_VERSION", "google-colab"],
44769
+ ["DATABRICKS_RUNTIME_VERSION", "databricks"],
44770
+ ["DAYTONA_WS_ID", "daytona"],
44771
+ ["DAYTONA_WS_NAME", "daytona"],
44772
+ ["E2B_SANDBOX_ID", "e2b"],
44773
+ ["MODAL_FUNCTION_ID", "modal"],
44774
+ ["MODAL_TASK_ID", "modal"],
44775
+ ["RUNPOD_POD_ID", "runpod"],
44776
+ ["REPLICATE_USERNAME", "replicate"],
44777
+ ["VAST_CONTAINERLABEL", "vast-ai"],
44778
+ ["HARBOR_URL", "harbor"],
44779
+ ["HARBOR_HOSTNAME", "harbor"],
44780
+ ["SWE_BENCH_TASK", "swe-bench"],
44781
+ ["SWEBENCH_TASK", "swe-bench"],
44782
+ ["SWE_AGENT_MODEL", "swe-agent"]
44783
+ ];
44784
+ const detectAiTrainingEnvironment = () => {
44785
+ for (const [envVar, label] of AI_TRAINING_ENV_VARS) if (process.env[envVar]) return label;
44786
+ return null;
44787
+ };
44733
44788
  const groupBy = (items, keyFn) => {
44734
44789
  const groups = /* @__PURE__ */ new Map();
44735
44790
  for (const item of items) {
@@ -44815,7 +44870,25 @@ const CI_PROVIDER_BY_ENVIRONMENT_VARIABLE = [
44815
44870
  ["TEAMCITY_VERSION", "teamcity"],
44816
44871
  ["BITBUCKET_BUILD_NUMBER", "bitbucket"],
44817
44872
  ["TRAVIS", "travis"],
44818
- ["DRONE", "drone"]
44873
+ ["DRONE", "drone"],
44874
+ ["SEMAPHORE", "semaphore"],
44875
+ ["APPVEYOR", "appveyor"],
44876
+ ["HARNESS_BUILD_ID", "harness"],
44877
+ ["BUDDY", "buddy"],
44878
+ ["CF_BUILD_ID", "codefresh"],
44879
+ ["NETLIFY", "netlify"],
44880
+ ["RAILWAY_SERVICE_ID", "railway"],
44881
+ ["VERCEL", "vercel"],
44882
+ ["CM_BUILD_ID", "codemagic"],
44883
+ ["PROW_JOB_ID", "prow"],
44884
+ ["AGOLA_GIT_REF", "agola"],
44885
+ ["CIRRUS_CI", "cirrus-ci"],
44886
+ ["BLACKSMITH_STICKYDISK_TOKEN", "blacksmith"],
44887
+ ["WARPBUILD_RUNNER_VERIFICATION_TOKEN", "warpbuild"],
44888
+ ["NSC_CACHE_PATH", "namespace"],
44889
+ ["UBICLOUD_CACHE_URL", "ubicloud"],
44890
+ ["RENDER", "render"],
44891
+ ["FLY_APP_NAME", "fly-io"]
44819
44892
  ];
44820
44893
  const GITHUB_ACTION_MARKER_ENVIRONMENT_VARIABLE = "REACT_DOCTOR_GITHUB_ACTION";
44821
44894
  const ACTION_INPUT_ENVIRONMENT_VARIABLES = {
@@ -44833,7 +44906,10 @@ const CODING_AGENT_BY_ENVIRONMENT_VARIABLE = [
44833
44906
  ["CODEX_SANDBOX_NETWORK_DISABLED", "codex"],
44834
44907
  ["OPENCODE", "opencode"],
44835
44908
  ["GOOSE_TERMINAL", "goose"],
44836
- ["AMP_THREAD_ID", "amp"]
44909
+ ["AMP_THREAD_ID", "amp"],
44910
+ ["CLINE_ACTIVE", "cline"],
44911
+ ["AUGMENT_AGENT", "augment"],
44912
+ ["TRAE_AI_SHELL_ID", "trae-ai"]
44837
44913
  ];
44838
44914
  const GENERIC_CODING_AGENT_ENVIRONMENT_VARIABLES = ["AGENT_SESSION_ID", "AGENT_THREAD_ID"];
44839
44915
  const CODING_AGENT_ENVIRONMENT_VALUE_VARIABLES = ["AGENT"];
@@ -44982,7 +45058,9 @@ const METRIC = {
44982
45058
  lspSessionStarted: "lsp.session.started",
44983
45059
  lspScanCompleted: "lsp.scan.completed",
44984
45060
  lspScanDuration: "lsp.scan.duration",
44985
- lspScanDiagnostics: "lsp.scan.diagnostics"
45061
+ lspScanDiagnostics: "lsp.scan.diagnostics",
45062
+ aiTrainingWarningShown: "ai.training.warning_shown",
45063
+ jsonOutUsed: "json.out_used"
44986
45064
  };
44987
45065
  //#endregion
44988
45066
  //#region src/cli/utils/noop-console.ts
@@ -45025,7 +45103,7 @@ const makeNoopConsole = () => ({
45025
45103
  });
45026
45104
  //#endregion
45027
45105
  //#region src/cli/utils/version.ts
45028
- const VERSION = "0.5.8-dev.5774deb";
45106
+ const VERSION = "0.5.8-dev.5893a56";
45029
45107
  //#endregion
45030
45108
  //#region src/cli/utils/json-mode.ts
45031
45109
  let context = null;
@@ -45063,12 +45141,13 @@ const installSilentConsole = () => {
45063
45141
  "trace"
45064
45142
  ]) target[key] = source[key];
45065
45143
  };
45066
- const enableJsonMode = ({ compact, directory }) => {
45144
+ const enableJsonMode = ({ compact, directory, outputFile }) => {
45067
45145
  context = {
45068
45146
  compact,
45069
45147
  directory,
45070
45148
  startTime: performance$1.now(),
45071
- mode: "full"
45149
+ mode: "full",
45150
+ outputFile: outputFile ?? null
45072
45151
  };
45073
45152
  installSilentConsole();
45074
45153
  };
@@ -45081,7 +45160,11 @@ const setJsonReportMode = (mode) => {
45081
45160
  };
45082
45161
  const writeJsonReport = (report) => {
45083
45162
  const serialized = context?.compact ? JSON.stringify(report) : JSON.stringify(report, null, 2);
45084
- process.stdout.write(`${serialized}\n`);
45163
+ if (context?.outputFile) {
45164
+ const resolvedPath = Path.resolve(context.outputFile);
45165
+ NFS.mkdirSync(Path.dirname(resolvedPath), { recursive: true });
45166
+ NFS.writeFileSync(resolvedPath, `${serialized}\n`);
45167
+ } else process.stdout.write(`${serialized}\n`);
45085
45168
  };
45086
45169
  const writeJsonErrorReport = (error, sentryEventId) => {
45087
45170
  if (!context) return;
@@ -45389,13 +45472,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
45389
45472
  * uploads source-map artifacts under, so stack frames symbolicate. Honors the
45390
45473
  * standard `SENTRY_RELEASE` override.
45391
45474
  */
45392
- const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.5.8-dev.5774deb`;
45475
+ const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.5.8-dev.5893a56`;
45393
45476
  /**
45394
45477
  * Deployment environment shown in Sentry's environment filter. Defaults to
45395
45478
  * `production` for tagged releases and `development` for dev/unbuilt versions,
45396
45479
  * overridable via the standard `SENTRY_ENVIRONMENT` env var.
45397
45480
  */
45398
- const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.5.8-dev.5774deb") ? "development" : "production");
45481
+ const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.5.8-dev.5893a56") ? "development" : "production");
45399
45482
  /**
45400
45483
  * Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
45401
45484
  * (set to `0` to disable tracing) and falls back to
@@ -48991,6 +49074,25 @@ const shouldBlockCi = (diagnostics, blockingLevel) => {
48991
49074
  */
48992
49075
  const toCategoryKey = (category) => category.toLowerCase().replace(/[^a-z0-9]+/g, "_");
48993
49076
  //#endregion
49077
+ //#region src/cli/utils/with-namespace.ts
49078
+ /**
49079
+ * Prefixes every key in a flat attribute group with `namespace.`, so a logical
49080
+ * group (scan config, diagnostics rollup, score, …) carries one dotted
49081
+ * namespace applied in a single place rather than hand-spelled into each key —
49082
+ * which is how the wide event drifted into a flat, half-namespaced soup. The
49083
+ * dotted prefix is what makes the attributes tree up in Sentry's attribute
49084
+ * browser and stay group-/filter-/aggregate-able in the Spans dataset.
49085
+ *
49086
+ * Value types are preserved verbatim (numbers stay numbers so Sentry infers a
49087
+ * numeric attribute and `p75(...)`/`avg(...)` work; `null` is kept so
49088
+ * `toSpanAttributes` can drop absent signals rather than coerce them).
49089
+ */
49090
+ const withNamespace = (namespace, attributes) => {
49091
+ const namespaced = {};
49092
+ for (const [key, value] of Object.entries(attributes)) namespaced[`${namespace}.${key}`] = value;
49093
+ return namespaced;
49094
+ };
49095
+ //#endregion
48994
49096
  //#region src/cli/utils/build-run-event.ts
48995
49097
  const readEnvBoolean = (name) => {
48996
49098
  const value = process.env[name];
@@ -49012,12 +49114,12 @@ const buildOutcomeAttributes = (input) => {
49012
49114
  if (input.result === void 0) {
49013
49115
  const error = input.error;
49014
49116
  const known = isReactDoctorError(error);
49015
- return {
49016
- outcome: "error",
49117
+ return withNamespace("outcome", {
49118
+ status: "error",
49017
49119
  exitCode: 1,
49018
49120
  knownError: known,
49019
49121
  errorTag: known ? error.reason._tag : error instanceof Error ? error.name : null
49020
- };
49122
+ });
49021
49123
  }
49022
49124
  const result = input.result;
49023
49125
  const summary = summarizeDiagnostics(result.diagnostics);
@@ -49051,66 +49153,82 @@ const buildOutcomeAttributes = (input) => {
49051
49153
  }
49052
49154
  let fixGroupedFindings = 0;
49053
49155
  for (const count of findingsPerFixGroup.values()) fixGroupedFindings += count;
49156
+ const categoryRollup = {};
49157
+ for (const [category, count] of countByCategory) categoryRollup[`category.${toCategoryKey(category)}`] = count;
49054
49158
  const attributes = {
49055
- outcome,
49056
- exitCode: wouldBlock ? 1 : 0,
49057
- wouldBlock,
49058
- blocking: blockingLevel,
49059
- scanClean: isClean,
49060
- totalDiagnostics: summary.totalDiagnosticCount,
49061
- errorCount: summary.errorCount,
49062
- warningCount: summary.warningCount,
49063
- affectedFiles: summary.affectedFileCount,
49064
- diagnosticsInTestFiles,
49065
- diagnosticsInStoryFiles,
49066
- distinctRulesFired: countByRule.size,
49067
- "diag.fixGroups": findingsPerFixGroup.size,
49068
- "diag.fixGroupedFindings": fixGroupedFindings,
49069
- topRule,
49070
- "migration.largestRuleBucketFiles": largestRuleBucket ? largestRuleBucket.fileCount : null,
49071
- "migration.largestRuleBucketSites": largestRuleBucket ? largestRuleBucket.siteCount : null,
49072
- "migration.largestRuleBucketRule": largestRuleBucket ? largestRuleBucket.ruleKey : null,
49073
- scannedFileCount: result.scannedFileCount ?? null,
49074
- lintCacheHitFiles: result.lintCacheHitFileCount ?? null,
49075
- lintCacheTotalFiles: result.lintCacheTotalFileCount ?? null,
49076
- lintCacheHitRatio: result.lintCacheTotalFileCount != null && result.lintCacheTotalFileCount > 0 ? (result.lintCacheHitFileCount ?? 0) / result.lintCacheTotalFileCount : null,
49077
- elapsedMs: result.elapsedMilliseconds,
49078
- scanPhaseMs: result.scanElapsedMilliseconds ?? null,
49079
- score: result.score ? result.score.score : null,
49080
- scoreLabel: result.score ? result.score.label : null,
49081
- scoreAvailable: result.score !== null,
49082
- skippedCheckCount: result.skippedChecks.length,
49083
- didLintFail: input.didLintFail ?? null,
49084
- lintFailureReasonKind: input.lintFailureReasonKind ?? null,
49085
- lintPartialFailureCount: input.lintPartialFailureCount ?? null,
49086
- lintDroppedFileCount: input.lintDroppedFileCount ?? null,
49087
- didDeadCodeFail: input.didDeadCodeFail ?? null,
49088
- supplyChainOverlapTimedOut: input.supplyChainOverlapTimedOut ?? null,
49089
- deadCodeOverlapped: input.deadCodeOverlapped ?? null
49090
- };
49091
- for (const [category, count] of countByCategory) attributes[`diag.category.${toCategoryKey(category)}`] = count;
49092
- if (result.baselineDelta) {
49093
- attributes["baseline.new"] = summary.totalDiagnosticCount;
49094
- attributes["baseline.fixed"] = result.baselineDelta.fixedCount;
49095
- attributes["baseline.baseTotal"] = result.baselineDelta.baseTotalCount;
49096
- attributes["baseline.degraded"] = false;
49097
- } else if (input.gateExempt) attributes["baseline.degraded"] = true;
49159
+ ...withNamespace("outcome", {
49160
+ status: outcome,
49161
+ exitCode: wouldBlock ? 1 : 0,
49162
+ wouldBlock,
49163
+ blocking: blockingLevel,
49164
+ clean: isClean,
49165
+ skippedChecks: result.skippedChecks.length
49166
+ }),
49167
+ ...withNamespace("diag", {
49168
+ total: summary.totalDiagnosticCount,
49169
+ errors: summary.errorCount,
49170
+ warnings: summary.warningCount,
49171
+ affectedFiles: summary.affectedFileCount,
49172
+ inTestFiles: diagnosticsInTestFiles,
49173
+ inStoryFiles: diagnosticsInStoryFiles,
49174
+ distinctRules: countByRule.size,
49175
+ topRule,
49176
+ fixGroups: findingsPerFixGroup.size,
49177
+ fixGroupedFindings,
49178
+ ...categoryRollup
49179
+ }),
49180
+ ...withNamespace("score", {
49181
+ value: result.score ? result.score.score : null,
49182
+ label: result.score ? result.score.label : null,
49183
+ available: result.score !== null
49184
+ }),
49185
+ ...withNamespace("lint", {
49186
+ failed: input.didLintFail ?? null,
49187
+ failureReasonKind: input.lintFailureReasonKind ?? null,
49188
+ partialFailureCount: input.lintPartialFailureCount ?? null,
49189
+ droppedFileCount: input.lintDroppedFileCount ?? null,
49190
+ cacheHitFiles: result.lintCacheHitFileCount ?? null,
49191
+ cacheTotalFiles: result.lintCacheTotalFileCount ?? null,
49192
+ cacheHitRatio: result.lintCacheTotalFileCount != null && result.lintCacheTotalFileCount > 0 ? (result.lintCacheHitFileCount ?? 0) / result.lintCacheTotalFileCount : null
49193
+ }),
49194
+ ...withNamespace("deadCode", {
49195
+ failed: input.didDeadCodeFail ?? null,
49196
+ overlapped: input.deadCodeOverlapped ?? null
49197
+ }),
49198
+ ...withNamespace("supplyChain", { overlapTimedOut: input.supplyChainOverlapTimedOut ?? null }),
49199
+ ...withNamespace("timing", {
49200
+ elapsedMs: result.elapsedMilliseconds,
49201
+ scanMs: result.scanElapsedMilliseconds ?? null
49202
+ }),
49203
+ ...withNamespace("migration", {
49204
+ largestRuleBucketFiles: largestRuleBucket ? largestRuleBucket.fileCount : null,
49205
+ largestRuleBucketSites: largestRuleBucket ? largestRuleBucket.siteCount : null,
49206
+ largestRuleBucketRule: largestRuleBucket ? largestRuleBucket.ruleKey : null
49207
+ })
49208
+ };
49209
+ if (result.baselineDelta) Object.assign(attributes, withNamespace("baseline", {
49210
+ new: summary.totalDiagnosticCount,
49211
+ fixed: result.baselineDelta.fixedCount,
49212
+ baseTotal: result.baselineDelta.baseTotalCount,
49213
+ degraded: false
49214
+ }));
49215
+ else if (input.gateExempt) attributes["baseline.degraded"] = true;
49098
49216
  return attributes;
49099
49217
  };
49100
- const buildCiAttributes = () => {
49218
+ const buildActionAttributes = () => {
49101
49219
  const { githubActorAssociation } = resolveGithubActionsScoreMetadata();
49102
- return {
49220
+ return withNamespace("action", {
49103
49221
  actorAssociation: githubActorAssociation ?? null,
49104
49222
  runnerOs: detectRunnerOs(),
49105
49223
  comment: readEnvBoolean(ACTION_INPUT_ENVIRONMENT_VARIABLES.comment),
49106
49224
  reviewComments: readEnvBoolean(ACTION_INPUT_ENVIRONMENT_VARIABLES.reviewComments),
49107
49225
  versionPin: resolveVersionPin(process.env[ACTION_INPUT_ENVIRONMENT_VARIABLES.version])
49108
- };
49226
+ });
49109
49227
  };
49110
- const buildConfigAttributes = (input) => {
49228
+ const buildScanAttributes = (input) => {
49111
49229
  const ruleOverrides = input.userConfig?.rules ?? {};
49112
49230
  const ruleKeys = Object.keys(ruleOverrides);
49113
- return {
49231
+ return withNamespace("scan", {
49114
49232
  mode: input.mode,
49115
49233
  scope: input.scope,
49116
49234
  parallel: input.parallel,
@@ -49125,12 +49243,18 @@ const buildConfigAttributes = (input) => {
49125
49243
  ignoredTagCount: input.ignoredTagCount,
49126
49244
  hasCustomConfig: input.hasCustomConfig,
49127
49245
  rulesConfigured: ruleKeys.length,
49128
- rulesDisabled: ruleKeys.filter((key) => ruleOverrides[key] === "off").length
49129
- };
49246
+ rulesDisabled: ruleKeys.filter((key) => ruleOverrides[key] === "off").length,
49247
+ fileCount: input.result?.scannedFileCount ?? null
49248
+ });
49130
49249
  };
49131
49250
  /**
49132
- * Projects a scan into the flat attribute set for its root span — the canonical
49133
- * per-scan "wide event". Pure and exported so the projection (outcome
49251
+ * Projects a scan into the namespaced attribute set for its root span — the
49252
+ * canonical per-scan "wide event". Every attribute carries a dotted namespace
49253
+ * that groups it by concept (`scan.*` config, `action.*` CI knobs, `outcome.*`
49254
+ * verdict, `diag.*` findings, `score.*`, `lint.*`, `deadCode.*`,
49255
+ * `supplyChain.*`, `timing.*`, `migration.*`, `baseline.*`) so the attributes
49256
+ * tree up in Sentry's attribute browser and stay filter-/group-/aggregate-able
49257
+ * in the Spans dataset. Pure and exported so the projection (outcome
49134
49258
  * precedence, rule/category rollups, CI knobs, config shape) is unit-testable
49135
49259
  * without a live Sentry client. `null` values are dropped so absent signals
49136
49260
  * never become misleading `"null"` attributes. The run + project base context
@@ -49139,8 +49263,8 @@ const buildConfigAttributes = (input) => {
49139
49263
  * those don't carry.
49140
49264
  */
49141
49265
  const buildRunEventAttributes = (input) => toSpanAttributes({
49142
- ...buildConfigAttributes(input),
49143
- ...buildCiAttributes(),
49266
+ ...buildScanAttributes(input),
49267
+ ...buildActionAttributes(),
49144
49268
  ...buildOutcomeAttributes(input)
49145
49269
  });
49146
49270
  /**
@@ -52135,10 +52259,11 @@ const rememberInstallAgents = (agents, options = {}) => writePreference(INSTALL_
52135
52259
  const CLAUDE_AGENT = "claude-code";
52136
52260
  const CURSOR_AGENT = "cursor";
52137
52261
  const CLAUDE_SETTINGS_RELATIVE_PATH = ".claude/settings.json";
52138
- const CLAUDE_HOOK_RELATIVE_PATH = ".claude/hooks/react-doctor.sh";
52139
- const CLAUDE_HOOK_COMMAND = "sh \"$CLAUDE_PROJECT_DIR/.claude/hooks/react-doctor.sh\"";
52262
+ const CLAUDE_HOOK_RELATIVE_PATH = ".claude/hooks/react-doctor.mjs";
52263
+ const CLAUDE_HOOK_COMMAND = "node \"$CLAUDE_PROJECT_DIR/.claude/hooks/react-doctor.mjs\"";
52140
52264
  const CURSOR_HOOKS_RELATIVE_PATH = ".cursor/hooks.json";
52141
- const CURSOR_HOOK_RELATIVE_PATH = ".cursor/hooks/react-doctor.sh";
52265
+ const CURSOR_HOOK_RELATIVE_PATH = ".cursor/hooks/react-doctor.mjs";
52266
+ const CURSOR_HOOK_COMMAND = "node .cursor/hooks/react-doctor.mjs";
52142
52267
  const CURSOR_HOOK_MATCHER = "Write|Edit|MultiEdit|ApplyPatch";
52143
52268
  const CURSOR_HOOKS_SCHEMA_VERSION = 1;
52144
52269
  const isSupportedAgent = (agent) => agent === CLAUDE_AGENT || agent === CURSOR_AGENT;
@@ -52170,7 +52295,6 @@ const writeJsonFileWithDirectoryCheck = (filePath, value) => {
52170
52295
  const writeHookScript = (filePath) => {
52171
52296
  ensureDirectoryExists(Path.dirname(filePath));
52172
52297
  NFS.writeFileSync(filePath, buildAgentHookScript());
52173
- NFS.chmodSync(filePath, 493);
52174
52298
  };
52175
52299
  const hasClaudeHookCommand = (groups) => groups.some((group) => (group.hooks ?? []).some((hook) => hook.command === CLAUDE_HOOK_COMMAND));
52176
52300
  const installClaudeHook = (projectRoot) => {
@@ -52191,7 +52315,7 @@ const installClaudeHook = (projectRoot) => {
52191
52315
  writeHookScript(hookPath);
52192
52316
  return [settingsPath, hookPath];
52193
52317
  };
52194
- const hasCursorHookCommand = (handlers) => handlers.some((handler) => handler.command === CURSOR_HOOK_RELATIVE_PATH);
52318
+ const hasCursorHookCommand = (handlers) => handlers.some((handler) => handler.command === CURSOR_HOOK_COMMAND);
52195
52319
  const installCursorHook = (projectRoot) => {
52196
52320
  const configPath = Path.join(projectRoot, CURSOR_HOOKS_RELATIVE_PATH);
52197
52321
  const hookPath = Path.join(projectRoot, CURSOR_HOOK_RELATIVE_PATH);
@@ -52199,7 +52323,7 @@ const installCursorHook = (projectRoot) => {
52199
52323
  const hooks = { ...config.hooks ?? {} };
52200
52324
  const postToolUseHooks = [...hooks.postToolUse ?? []];
52201
52325
  if (!hasCursorHookCommand(postToolUseHooks)) postToolUseHooks.push({
52202
- command: CURSOR_HOOK_RELATIVE_PATH,
52326
+ command: CURSOR_HOOK_COMMAND,
52203
52327
  matcher: CURSOR_HOOK_MATCHER,
52204
52328
  timeout: 120
52205
52329
  });
@@ -52213,102 +52337,111 @@ const installCursorHook = (projectRoot) => {
52213
52337
  return [configPath, hookPath];
52214
52338
  };
52215
52339
  const buildAgentHookScript = () => [
52216
- "#!/bin/sh",
52217
- "set -u",
52340
+ "import { readFileSync, writeFileSync, unlinkSync } from 'node:fs';",
52341
+ "import { tmpdir } from 'node:os';",
52342
+ "import { join, dirname } from 'node:path';",
52343
+ "import { fileURLToPath } from 'node:url';",
52344
+ "import { spawnSync } from 'node:child_process';",
52218
52345
  "",
52219
- "input_file=$(mktemp \"${TMPDIR:-/tmp}/react-doctor-agent-hook.XXXXXX\")",
52220
- "output_file=$(mktemp \"${TMPDIR:-/tmp}/react-doctor-agent-hook-output.XXXXXX\")",
52221
- "trap 'rm -f \"$input_file\" \"$output_file\"' EXIT",
52222
- "cat > \"$input_file\"",
52346
+ "const __filename = fileURLToPath(import.meta.url);",
52347
+ "const __dirname = dirname(__filename);",
52223
52348
  "",
52224
- "script_dir=$(CDPATH= cd \"$(dirname \"$0\")\" && pwd)",
52225
- "project_root=${CLAUDE_PROJECT_DIR:-}",
52226
- "if [ -z \"$project_root\" ]; then",
52227
- " project_root=$(CDPATH= cd \"$script_dir/../..\" && pwd)",
52228
- "fi",
52229
- "if ! cd \"$project_root\"; then",
52230
- " exit 0",
52231
- "fi",
52349
+ "const EDIT_TOOL_NAMES = new Set(['Edit', 'Write', 'MultiEdit', 'NotebookEdit', 'ApplyPatch']);",
52232
52350
  "",
52233
- "should_scan() {",
52234
- " if ! command -v node >/dev/null 2>&1; then",
52235
- " return 0",
52236
- " fi",
52351
+ "const readStdin = () => {",
52352
+ " try {",
52353
+ " return readFileSync(0, 'utf8');",
52354
+ " } catch {",
52355
+ " return '';",
52356
+ " }",
52357
+ "};",
52237
52358
  "",
52238
- " node - \"$input_file\" <<'NODE'",
52239
- "const fs = require('node:fs');",
52240
- "const inputPath = process.argv[2];",
52241
- "const editToolNames = new Set(['Edit', 'Write', 'MultiEdit', 'NotebookEdit', 'ApplyPatch']);",
52242
- "try {",
52243
- " const input = JSON.parse(fs.readFileSync(inputPath, 'utf8') || '{}');",
52359
+ "const shouldScan = (input) => {",
52244
52360
  " const eventName = input.hook_event_name || input.eventName || input.event_name;",
52245
52361
  " if (eventName === 'PostToolBatch') {",
52246
52362
  " const toolCalls = Array.isArray(input.tool_calls) ? input.tool_calls : [];",
52247
- " process.exit(toolCalls.some((toolCall) => editToolNames.has(toolCall.tool_name)) ? 0 : 10);",
52363
+ " return toolCalls.some((toolCall) => EDIT_TOOL_NAMES.has(toolCall.tool_name));",
52248
52364
  " }",
52249
52365
  " const toolName = input.tool_name || input.toolName || input.tool;",
52250
- " process.exit(!toolName || editToolNames.has(toolName) ? 0 : 10);",
52251
- "} catch {",
52252
- " process.exit(0);",
52253
- "}",
52254
- "NODE",
52255
- "}",
52366
+ " return !toolName || EDIT_TOOL_NAMES.has(toolName);",
52367
+ "};",
52256
52368
  "",
52257
- "run_react_doctor() {",
52258
- " if [ -x ./node_modules/.bin/react-doctor ]; then",
52259
- " ./node_modules/.bin/react-doctor --verbose --scope changed --blocking warning --no-score",
52260
- " return",
52261
- " fi",
52369
+ "const runReactDoctor = (outputPath) => {",
52370
+ " // Each candidate is a single shell command string (not an args array):",
52371
+ " // `shell: true` is required to run the Windows `.cmd` shims, and an args",
52372
+ " // array with `shell: true` trips Node's DEP0190. A missing command exits",
52373
+ " // 127 via the shell (no ENOENT error), so fall through on that. With no",
52374
+ " // runner found, exit 0 silently — stdout is parsed as the hook's JSON.",
52375
+ " const commands = [",
52376
+ " './node_modules/.bin/react-doctor --verbose --scope changed --blocking warning --no-score',",
52377
+ " 'react-doctor --verbose --scope changed --blocking warning --no-score',",
52378
+ " 'pnpm dlx react-doctor@latest --verbose --scope changed --blocking warning --no-score',",
52379
+ " 'npx --yes react-doctor@latest --verbose --scope changed --blocking warning --no-score',",
52380
+ " ];",
52262
52381
  "",
52263
- " if command -v react-doctor >/dev/null 2>&1; then",
52264
- " react-doctor --verbose --scope changed --blocking warning --no-score",
52265
- " return",
52266
- " fi",
52382
+ " for (const command of commands) {",
52383
+ " const result = spawnSync(command, { encoding: 'utf8', shell: true });",
52384
+ " if (result.error?.code === 'ENOENT' || result.status === 127) continue;",
52385
+ " try {",
52386
+ " writeFileSync(outputPath, (result.stdout || '') + (result.stderr || ''));",
52387
+ " } catch {}",
52388
+ " return result.status;",
52389
+ " }",
52267
52390
  "",
52268
- " if command -v pnpm >/dev/null 2>&1; then",
52269
- " pnpm dlx react-doctor@latest --verbose --scope changed --blocking warning --no-score",
52270
- " return",
52271
- " fi",
52391
+ " return 0;",
52392
+ "};",
52272
52393
  "",
52273
- " if command -v npx >/dev/null 2>&1; then",
52274
- " npx --yes react-doctor@latest --verbose --scope changed --blocking warning --no-score",
52275
- " return",
52276
- " fi",
52394
+ "const cleanup = (...paths) => {",
52395
+ " for (const path of paths) {",
52396
+ " try { unlinkSync(path); } catch {}",
52397
+ " }",
52398
+ "};",
52277
52399
  "",
52278
- " printf '%s\\n' 'react-doctor: command not found; skipping agent hook scan.'",
52279
- " return 0",
52280
- "}",
52400
+ "const main = () => {",
52401
+ " let input;",
52402
+ " try {",
52403
+ " const stdinContent = readStdin();",
52404
+ " input = JSON.parse(stdinContent || '{}');",
52405
+ " } catch {",
52406
+ " input = {};",
52407
+ " }",
52281
52408
  "",
52282
- "if ! should_scan; then",
52283
- " exit 0",
52284
- "fi",
52409
+ " if (!shouldScan(input)) {",
52410
+ " process.exit(0);",
52411
+ " }",
52285
52412
  "",
52286
- "if run_react_doctor > \"$output_file\" 2>&1; then",
52287
- " exit 0",
52288
- "fi",
52413
+ " const projectRoot = process.env.CLAUDE_PROJECT_DIR || join(__dirname, '../..');",
52414
+ " const outputPath = join(tmpdir(), `react-doctor-agent-hook-output-${process.pid}.txt`);",
52289
52415
  "",
52290
- "node - \"$input_file\" \"$output_file\" <<'NODE'",
52291
- "const fs = require('node:fs');",
52292
- "const inputPath = process.argv[2];",
52293
- "const outputPath = process.argv[3];",
52294
- "const readInput = () => {",
52295
52416
  " try {",
52296
- " return JSON.parse(fs.readFileSync(inputPath, 'utf8') || '{}');",
52417
+ " process.chdir(projectRoot);",
52297
52418
  " } catch {",
52298
- " return {};",
52419
+ " process.exit(0);",
52420
+ " }",
52421
+ "",
52422
+ " const scanResult = runReactDoctor(outputPath);",
52423
+ " if (scanResult === 0) {",
52424
+ " cleanup(outputPath);",
52425
+ " process.exit(0);",
52426
+ " }",
52427
+ "",
52428
+ " const scanOutput = readFileSync(outputPath, 'utf8').trim();",
52429
+ " cleanup(outputPath);",
52430
+ "",
52431
+ " if (!scanOutput) {",
52432
+ " process.exit(0);",
52433
+ " }",
52434
+ "",
52435
+ " const message = `React Doctor found issues in the changed files. Review this output and fix the regressions before finishing. For confirmed issues that cannot be fixed now, create GitHub issues with the rule, file/line, confidence, impact, and proposed fix.\\n\\n${scanOutput}`;",
52436
+ "",
52437
+ " if (input.hook_event_name === 'PostToolBatch') {",
52438
+ " console.log(JSON.stringify({ hookSpecificOutput: { hookEventName: 'PostToolBatch', additionalContext: message } }));",
52439
+ " } else {",
52440
+ " console.log(JSON.stringify({ additional_context: message }));",
52299
52441
  " }",
52300
52442
  "};",
52301
- "const input = readInput();",
52302
- "const scanOutput = fs.readFileSync(outputPath, 'utf8').trim();",
52303
- "if (!scanOutput) process.exit(0);",
52304
- "const message = `React Doctor found issues in the changed files. Review this output and fix the regressions before finishing. For confirmed issues that cannot be fixed now, create GitHub issues with the rule, file/line, confidence, impact, and proposed fix.\\n\\n${scanOutput}`;",
52305
- "if (input.hook_event_name === 'PostToolBatch') {",
52306
- " console.log(JSON.stringify({ hookSpecificOutput: { hookEventName: 'PostToolBatch', additionalContext: message } }));",
52307
- "} else {",
52308
- " console.log(JSON.stringify({ additional_context: message }));",
52309
- "}",
52310
- "NODE",
52311
- ""
52443
+ "",
52444
+ "main();"
52312
52445
  ].join("\n");
52313
52446
  const installReactDoctorAgentHooks = (options) => {
52314
52447
  const installedAgents = [];
@@ -53134,6 +53267,26 @@ const CLI_AGENT_AUTO_FLAGS = {
53134
53267
  codex: ["--yolo"],
53135
53268
  cursor: ["--force"]
53136
53269
  };
53270
+ const resolveCursorBundledNode = () => {
53271
+ if (!isWindows) return null;
53272
+ const localAppData = process.env.LOCALAPPDATA;
53273
+ if (!localAppData) return null;
53274
+ const cursorAgentRoot = Path.join(localAppData, "cursor-agent", "versions");
53275
+ try {
53276
+ const versions = NFS.readdirSync(cursorAgentRoot);
53277
+ if (versions.length === 0) return null;
53278
+ const sortedVersions = versions.sort((a, b) => b.localeCompare(a, void 0, { numeric: true }));
53279
+ for (const version of sortedVersions) try {
53280
+ const bundledNodePath = Path.join(cursorAgentRoot, version, "node.exe");
53281
+ const entryScriptPath = Path.join(cursorAgentRoot, version, "index.js");
53282
+ if (NFS.statSync(bundledNodePath).isFile() && NFS.statSync(entryScriptPath).isFile()) return {
53283
+ command: bundledNodePath,
53284
+ args: [entryScriptPath]
53285
+ };
53286
+ } catch {}
53287
+ } catch {}
53288
+ return null;
53289
+ };
53137
53290
  const resolveWindowsCmdEntryScript = (command) => {
53138
53291
  if (!isWindows) return null;
53139
53292
  const pathDirectories = (process.env.PATH ?? "").split(Path.delimiter).filter(Boolean);
@@ -53153,11 +53306,10 @@ const resolveWindowsCmdEntryScript = (command) => {
53153
53306
  }
53154
53307
  return null;
53155
53308
  };
53156
- const spawnAgent = (command, args, cwd, shell = false) => new Promise((resolve, reject) => {
53309
+ const spawnAgent = (command, args, cwd) => new Promise((resolve, reject) => {
53157
53310
  const child = spawn(command, [...args], {
53158
53311
  cwd,
53159
- stdio: "inherit",
53160
- shell
53312
+ stdio: "inherit"
53161
53313
  });
53162
53314
  child.on("error", reject);
53163
53315
  child.on("close", (code) => resolve(code ?? 0));
@@ -53166,6 +53318,10 @@ const launchCliAgent = async (agentId, prompt, cwd) => {
53166
53318
  const binary = CLI_AGENT_BINARIES[agentId];
53167
53319
  const agentArgs = [...CLI_AGENT_AUTO_FLAGS[agentId], prompt];
53168
53320
  if (isWindows) {
53321
+ if (agentId === "cursor") {
53322
+ const cursorResolution = resolveCursorBundledNode();
53323
+ if (cursorResolution) return spawnAgent(cursorResolution.command, [...cursorResolution.args, ...agentArgs], cwd);
53324
+ }
53169
53325
  const entryScript = resolveWindowsCmdEntryScript(binary);
53170
53326
  if (entryScript) return spawnAgent(process.execPath, [entryScript, ...agentArgs], cwd);
53171
53327
  }
@@ -54184,6 +54340,17 @@ const warnDeprecatedFailOn = (flags, userConfig) => {
54184
54340
  cliLogger.warn(`${source} is deprecated; rename it to ${replacement}.`);
54185
54341
  };
54186
54342
  //#endregion
54343
+ //#region src/cli/utils/warn-ai-training-environment.ts
54344
+ let didWarnAiTraining = false;
54345
+ const warnIfAiTrainingEnvironment = () => {
54346
+ if (didWarnAiTraining) return;
54347
+ const detected = detectAiTrainingEnvironment();
54348
+ if (detected === null) return;
54349
+ didWarnAiTraining = true;
54350
+ process.stderr.write(`${highlighter.warn("react-doctor detected use in an AI or ML pipeline. This use requires written permission under the react-doctor license — contact founders@million.dev to request access.")}\n`);
54351
+ recordCount(METRIC.aiTrainingWarningShown, 1, { environment: detected });
54352
+ };
54353
+ //#endregion
54187
54354
  //#region src/cli/utils/validate-mode-flags.ts
54188
54355
  const usedDiffAlias = (flags) => flags.diff !== void 0 && flags.diff !== false && flags.diff !== "false" && flags.diff !== "";
54189
54356
  const usedScope = (flags) => typeof flags.scope === "string" && flags.scope.length > 0;
@@ -54267,10 +54434,14 @@ const inspectAction = async (directory, flags) => {
54267
54434
  const isQuiet = isScoreOnly || isJsonMode;
54268
54435
  const requestedDirectory = Path.resolve(directory);
54269
54436
  const startTime = performance$1.now();
54270
- if (isJsonMode) enableJsonMode({
54271
- compact: Boolean(flags.jsonCompact),
54272
- directory: requestedDirectory
54273
- });
54437
+ if (isJsonMode) {
54438
+ enableJsonMode({
54439
+ compact: Boolean(flags.jsonCompact),
54440
+ directory: requestedDirectory,
54441
+ outputFile: flags.jsonOut
54442
+ });
54443
+ if (flags.jsonOut) recordCount(METRIC.jsonOutUsed, 1);
54444
+ }
54274
54445
  recordCount(METRIC.cliInvoked, 1, { command: "inspect" });
54275
54446
  try {
54276
54447
  validateModeFlags(flags);
@@ -54284,6 +54455,7 @@ const inspectAction = async (directory, flags) => {
54284
54455
  setJsonReportDirectory(resolvedDirectory);
54285
54456
  warnDeprecatedFailOn(flags, userConfig);
54286
54457
  warnDeprecatedDiff(flags, userConfig);
54458
+ warnIfAiTrainingEnvironment();
54287
54459
  if (scanTarget.didRedirectViaRootDir && !isQuiet) {
54288
54460
  cliLogger.dim(`Redirected to ${highlighter.info(toRelativePath(resolvedDirectory, requestedDirectory))} via react-doctor config "rootDir".`);
54289
54461
  cliLogger.break();
@@ -55207,6 +55379,14 @@ const applyColorPreference = (argv, env = process.env) => {
55207
55379
  setColorEnabled(enabled);
55208
55380
  };
55209
55381
  //#endregion
55382
+ //#region src/cli/utils/ensure-windows-utf8-console.ts
55383
+ const ensureWindowsUtf8Console = () => {
55384
+ if (process.platform !== "win32" || !process.stdout.isTTY) return;
55385
+ try {
55386
+ execFileSync("chcp.com", ["65001"], { stdio: "ignore" });
55387
+ } catch {}
55388
+ };
55389
+ //#endregion
55210
55390
  //#region src/cli/utils/exit-gracefully.ts
55211
55391
  const exitGracefully = () => {
55212
55392
  try {
@@ -55349,6 +55529,7 @@ const ROOT_FLAG_SPEC = {
55349
55529
  "--category",
55350
55530
  "--changed-files-from",
55351
55531
  "--blocking",
55532
+ "--json-out",
55352
55533
  "--output-dir",
55353
55534
  "--fail-on",
55354
55535
  "--project",
@@ -55539,7 +55720,7 @@ ${highlighter.dim("Learn more:")}
55539
55720
  ${highlighter.info(CANONICAL_GITHUB_URL)}
55540
55721
  `;
55541
55722
  const collectCategoryOption = (value, previousValues) => [...previousValues ?? [], value];
55542
- 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("--debug", "force a Sentry trace and print its id at the end (paste it into a bug report)").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("--color", "force colored output").option("--no-color", "disable colored output (also honors NO_COLOR)").addHelpText("after", renderRootHelpEpilog);
55723
+ 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("--debug", "force a Sentry trace and print its id at the end (paste it into a bug report)").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("--json-out <path>", "with --json, write the report to a file instead of stdout").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("--color", "force colored output").option("--no-color", "disable colored output (also honors NO_COLOR)").addHelpText("after", renderRootHelpEpilog);
55543
55724
  program.action(inspectAction);
55544
55725
  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));
55545
55726
  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);
@@ -55564,6 +55745,7 @@ if (process.argv.includes("-V") && !strippedArgv.includes("-V")) {
55564
55745
  process.exit(0);
55565
55746
  }
55566
55747
  applyColorPreference(strippedArgv);
55748
+ ensureWindowsUtf8Console();
55567
55749
  const argv = normalizeHelpInvocation(strippedArgv, knownCommands);
55568
55750
  Promise.resolve().then(() => assertNoRemovedFlags(process.argv)).then(() => program.parseAsync(argv)).then(() => flushSentry()).catch(async (error) => {
55569
55751
  const isUserError = isExpectedUserError(error);
@@ -55582,4 +55764,4 @@ Promise.resolve().then(() => assertNoRemovedFlags(process.argv)).then(() => prog
55582
55764
  export {};
55583
55765
 
55584
55766
  //# sourceMappingURL=cli.js.map
55585
- //# debugId=498477a7-1f41-5ecb-9999-c48cfef57259
55767
+ //# debugId=eb7a01bc-f737-5207-b430-b8fee7a1895f
package/dist/index.d.ts CHANGED
@@ -9726,7 +9726,7 @@ interface InspectResult {
9726
9726
  * Per-file lint cache outcome: files served from cache, and total files
9727
9727
  * considered. Both absent when the cache was off or bypassed (audit mode,
9728
9728
  * adopted `extends`, user plugins). The CLI projects these onto the Sentry
9729
- * wide event as `lintCacheHitRatio`.
9729
+ * wide event as `lint.cacheHitRatio`.
9730
9730
  */
9731
9731
  lintCacheHitFileCount?: number | null;
9732
9732
  lintCacheTotalFileCount?: number | null;
@@ -10123,7 +10123,7 @@ declare const summarizeDiagnostics: (diagnostics: Diagnostic[], worstScore?: num
10123
10123
  * untouched so the loader sees the same plain object either way.
10124
10124
  */
10125
10125
  declare const defineConfig: (config: ReactDoctorConfig) => ReactDoctorConfig; //#endregion
10126
- //#region src/utils/group-by.d.ts
10126
+ //#region src/utils/detect-ai-training-environment.d.ts
10127
10127
  //#endregion
10128
10128
  //#region ../api/dist/index.d.ts
10129
10129
  //#region src/diagnose.d.ts
package/dist/index.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]="b9d1a98e-f5ec-5357-a08b-f84864fdfa20")}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]="9807b1bf-1e62-5421-ad35-d1f4129c1538")}catch(e){}}();
3
3
  import { r as __toESM$1, t as __commonJSMin$1 } from "./chunk-N93fKeF6.js";
4
4
  import { createRequire } from "node:module";
5
5
  import * as NFS from "node:fs";
@@ -41411,6 +41411,61 @@ const clearAutoSuppressionCaches = () => {};
41411
41411
  * untouched so the loader sees the same plain object either way.
41412
41412
  */
41413
41413
  const defineConfig = (config) => config;
41414
+ const AI_TRAINING_ENV_VARS = [
41415
+ ["HF_DATASETS_CACHE", "huggingface"],
41416
+ ["HF_HOME", "huggingface"],
41417
+ ["HUGGINGFACE_HUB_CACHE", "huggingface"],
41418
+ ["SPACE_ID", "huggingface-spaces"],
41419
+ ["CUDA_VISIBLE_DEVICES", "cuda"],
41420
+ ["NVIDIA_VISIBLE_DEVICES", "nvidia"],
41421
+ ["ROCR_VISIBLE_DEVICES", "rocm"],
41422
+ ["TPU_NAME", "google-tpu"],
41423
+ ["WANDB_RUN_ID", "wandb"],
41424
+ ["WANDB_SWEEP_ID", "wandb"],
41425
+ ["MLFLOW_RUN_ID", "mlflow"],
41426
+ ["MLFLOW_TRACKING_URI", "mlflow"],
41427
+ ["COMET_EXPERIMENT_KEY", "comet"],
41428
+ ["NEPTUNE_RUN_ID", "neptune"],
41429
+ ["CLEARML_TASK_ID", "clearml"],
41430
+ ["DVC_STAGE", "dvc"],
41431
+ ["RAY_WORKER_PROCESS", "ray"],
41432
+ ["RAY_ADDRESS", "ray"],
41433
+ ["MUJOCO_GL", "mujoco"],
41434
+ ["MUJOCO_PATH", "mujoco"],
41435
+ ["GYM_DISABLE_ENV_CHECKER", "gymnasium"],
41436
+ ["SM_TRAINING_ENV", "sagemaker"],
41437
+ ["TRAINING_JOB_ARN", "sagemaker"],
41438
+ ["SAGEMAKER_BASE_DIR", "sagemaker"],
41439
+ ["AZUREML_RUN_ID", "azure-ml"],
41440
+ ["AZURE_ML_MODEL_DIR", "azure-ml"],
41441
+ ["CLOUD_ML_PROJECT_ID", "vertex-ai"],
41442
+ ["VERTEX_AI_LOG_LEVEL", "vertex-ai"],
41443
+ ["DET_MASTER", "determined-ai"],
41444
+ ["LIGHTNING_USER_ID", "lightning-ai"],
41445
+ ["FLYTE_INTERNAL_EXECUTION_ID", "flyte"],
41446
+ ["ARGO_WORKFLOW_NAME", "argo-workflows"],
41447
+ ["KFP_POD_NAME", "kubeflow-pipelines"],
41448
+ ["KAGGLE_KERNEL_RUN_TYPE", "kaggle"],
41449
+ ["COLAB_BACKEND_VERSION", "google-colab"],
41450
+ ["DATABRICKS_RUNTIME_VERSION", "databricks"],
41451
+ ["DAYTONA_WS_ID", "daytona"],
41452
+ ["DAYTONA_WS_NAME", "daytona"],
41453
+ ["E2B_SANDBOX_ID", "e2b"],
41454
+ ["MODAL_FUNCTION_ID", "modal"],
41455
+ ["MODAL_TASK_ID", "modal"],
41456
+ ["RUNPOD_POD_ID", "runpod"],
41457
+ ["REPLICATE_USERNAME", "replicate"],
41458
+ ["VAST_CONTAINERLABEL", "vast-ai"],
41459
+ ["HARBOR_URL", "harbor"],
41460
+ ["HARBOR_HOSTNAME", "harbor"],
41461
+ ["SWE_BENCH_TASK", "swe-bench"],
41462
+ ["SWEBENCH_TASK", "swe-bench"],
41463
+ ["SWE_AGENT_MODEL", "swe-agent"]
41464
+ ];
41465
+ const detectAiTrainingEnvironment = () => {
41466
+ for (const [envVar, label] of AI_TRAINING_ENV_VARS) if (process.env[envVar]) return label;
41467
+ return null;
41468
+ };
41414
41469
  const unionValues = (baseValues, overrideValues) => [...new Set([...baseValues, ...overrideValues])];
41415
41470
  const mergeIgnores = (baseIgnore, overrideIgnore) => {
41416
41471
  const mergedIgnore = {
@@ -41455,6 +41510,12 @@ const mergeReactDoctorConfigs = (baseConfig, overrideConfig) => {
41455
41510
  };
41456
41511
  //#endregion
41457
41512
  //#region ../api/dist/index.js
41513
+ let didWarnAiTraining = false;
41514
+ const warnIfAiTrainingEnvironment = () => {
41515
+ if (didWarnAiTraining || detectAiTrainingEnvironment() === null) return;
41516
+ didWarnAiTraining = true;
41517
+ console.warn("[react-doctor] Use in an AI or ML pipeline requires written permission under the react-doctor license. Contact founders@million.dev to request access.");
41518
+ };
41458
41519
  const buildDiagnoseLayer = (config, configOverrideTarget) => {
41459
41520
  const configLayer = configOverrideTarget === void 0 ? Config.layerNode : Config.layerOf({
41460
41521
  config,
@@ -41492,6 +41553,7 @@ const outputToDiagnoseResult = (output, elapsedMilliseconds) => {
41492
41553
  };
41493
41554
  };
41494
41555
  const diagnoseDirectory = async (directory, options) => {
41556
+ warnIfAiTrainingEnvironment();
41495
41557
  const startTime = globalThis.performance.now();
41496
41558
  const scanTarget = await resolveScanTarget(directory);
41497
41559
  return outputToDiagnoseResult(await runPromise(restoreLegacyThrow(buildInspectProgram(scanTarget, options).pipe(provide(buildDiagnoseLayer(scanTarget.userConfig)), provide(layerOtlp)))), globalThis.performance.now() - startTime);
@@ -41538,6 +41600,7 @@ const diagnoseProject = async (projectDefinition, baseOptions, batchConfig) => {
41538
41600
  }
41539
41601
  };
41540
41602
  const diagnoseProjectBatch = async (input) => {
41603
+ warnIfAiTrainingEnvironment();
41541
41604
  const startTime = globalThis.performance.now();
41542
41605
  const { projects, concurrency, config: batchConfig, ...baseOptions } = input;
41543
41606
  const projectResults = await mapWithConcurrency(projects, concurrency ?? 4, (projectDefinition) => diagnoseProject(projectDefinition, baseOptions, batchConfig));
@@ -41582,4 +41645,4 @@ const toJsonReport = (result, options) => buildJsonReport({
41582
41645
  export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, defineConfig, diagnose, filterSourceFiles, getDiffInfo, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
41583
41646
 
41584
41647
  //# sourceMappingURL=index.js.map
41585
- //# debugId=b9d1a98e-f5ec-5357-a08b-f84864fdfa20
41648
+ //# debugId=9807b1bf-1e62-5421-ad35-d1f4129c1538
package/dist/lsp.js CHANGED
@@ -43046,7 +43046,9 @@ const METRIC = {
43046
43046
  lspSessionStarted: "lsp.session.started",
43047
43047
  lspScanCompleted: "lsp.scan.completed",
43048
43048
  lspScanDuration: "lsp.scan.duration",
43049
- lspScanDiagnostics: "lsp.scan.diagnostics"
43049
+ lspScanDiagnostics: "lsp.scan.diagnostics",
43050
+ aiTrainingWarningShown: "ai.training.warning_shown",
43051
+ jsonOutUsed: "json.out_used"
43050
43052
  };
43051
43053
  //#endregion
43052
43054
  //#region src/cli/utils/to-category-key.ts
@@ -43363,5 +43365,5 @@ const startLanguageServer = () => {
43363
43365
  };
43364
43366
  //#endregion
43365
43367
  export { startLanguageServer };
43366
- !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]="bb5309e5-ce90-551d-bf0a-7db0ea302f24")}catch(e){}}();
43367
- //# debugId=bb5309e5-ce90-551d-bf0a-7db0ea302f24
43368
+ !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]="c5b6c740-461d-5f65-a993-9e6d35ad9113")}catch(e){}}();
43369
+ //# debugId=c5b6c740-461d-5f65-a993-9e6d35ad9113
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-doctor",
3
- "version": "0.5.8-dev.5774deb",
3
+ "version": "0.5.8-dev.5893a56",
4
4
  "description": "Your agent writes bad React. This catches it",
5
5
  "keywords": [
6
6
  "accessibility",
@@ -20,7 +20,7 @@
20
20
  "bugs": {
21
21
  "url": "https://github.com/millionco/react-doctor/issues"
22
22
  },
23
- "license": "MIT",
23
+ "license": "SEE LICENSE IN LICENSE",
24
24
  "author": "Million Software, Inc",
25
25
  "repository": {
26
26
  "type": "git",
@@ -34,7 +34,8 @@
34
34
  "bin/**",
35
35
  "dist/**/*.js",
36
36
  "dist/**/*.d.ts",
37
- "dist/skills/**"
37
+ "dist/skills/**",
38
+ "LICENSE"
38
39
  ],
39
40
  "type": "module",
40
41
  "sideEffects": false,
@@ -59,12 +60,12 @@
59
60
  "magicast": "^0.5.3",
60
61
  "oxlint": ">=1.66.0 <1.67.0",
61
62
  "prompts": "^2.4.2",
62
- "typescript": ">=5.0.4 <7",
63
+ "typescript": ">=5.0.4 <6",
63
64
  "vscode-languageserver": "^9.0.1",
64
65
  "vscode-languageserver-textdocument": "^1.0.12",
65
66
  "vscode-uri": "^3.1.0",
66
- "oxlint-plugin-react-doctor": "0.5.8-dev.5774deb",
67
- "deslop-js": "0.5.8"
67
+ "deslop-js": "0.5.8",
68
+ "oxlint-plugin-react-doctor": "0.5.8-dev.5893a56"
68
69
  },
69
70
  "devDependencies": {
70
71
  "@types/babel__code-frame": "^7.27.0",