react-doctor 0.9.12-dev.28a1a9f → 0.9.12-dev.3eda608

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +27 -0
  2. package/dist/active-run-trace-dlIZeEvb.js +18 -0
  3. package/dist/active-scan-abort-registry-DwG6tSPy.js +28 -0
  4. package/dist/{build-section-divider-CdnczCsb.js → build-section-divider-I2zZDzJ9.js} +8 -22
  5. package/dist/{ci-CvrWkFyG.js → ci-DAWNYwqh.js} +12 -11
  6. package/dist/cli.js +76 -24
  7. package/dist/{design-C6QoD6j5.js → design-CT-fWB1q.js} +4 -4
  8. package/dist/{devtools-D8NTVj81.js → devtools-BiC-AP3B.js} +3 -3
  9. package/dist/{exit-gracefully-dQBRJxyW.js → exit-gracefully-BFTG5jEM.js} +15 -9
  10. package/dist/get-east-asian-width-Cglw13G7.js +444 -0
  11. package/dist/{report-error-DspMW6A2.js → handle-error-wVABvSAi.js} +6 -61
  12. package/dist/index.d.ts +32 -0
  13. package/dist/index.js +76 -2
  14. package/dist/{inspect-CEYHtLuK.js → inspect-BimAQ5xM.js} +16 -15
  15. package/dist/{install-BPQG8X-S.js → install-Oi0h_G7g.js} +9 -8
  16. package/dist/{install-doctor-script-BZJlaCgz.js → install-doctor-script-02_POH23.js} +6 -441
  17. package/dist/{install-github-workflow-DQIDvKig.js → install-github-workflow-CDDxuboB.js} +6 -6
  18. package/dist/{install-react-doctor-C3iiSm4r.js → install-react-doctor-CTsuBvs7.js} +8 -8
  19. package/dist/{run-scan-app-lYmDIiT4.js → jsx-runtime-KCzhtnA2.js} +280 -2774
  20. package/dist/{print-branded-header-B594Zejh.js → print-branded-header-Btnndqn7.js} +4 -4
  21. package/dist/prompt-runtime-scan-url-CkdYtR0M.js +240 -0
  22. package/dist/{read-object-file-CIVH-Cg-.js → read-object-file-DhRQQnN-.js} +4 -4
  23. package/dist/{record-metric-CFPfyOEW.js → record-metric-Bca1TzEP.js} +95 -8
  24. package/dist/report-error-89sVIL94.js +64 -0
  25. package/dist/{report-workflow-result-GxDOhexG.js → report-workflow-result-CA8lTeDk.js} +5 -5
  26. package/dist/{resolve-scope-CNV3HRNo.js → resolve-scope-poO8hFkD.js} +6 -6
  27. package/dist/{rules-C1Nt63By.js → rules-B16IRDyg.js} +6 -6
  28. package/dist/run-scan-app-NI3PasUA.js +2508 -0
  29. package/dist/runtime-scan/browser-probe.iife.js +855 -0
  30. package/dist/runtime-scan-B9Nytu3v.js +770 -0
  31. package/dist/sanitize-runtime-url-pzQIwyc8.js +76 -0
  32. package/dist/{scan-D-Y1Qifl.js → scan-DoM4T1ov.js} +10 -22
  33. package/dist/{should-fail-scan-gate-XdfNPXf9.js → should-fail-scan-gate-CFyk-8U3.js} +12 -111
  34. package/dist/{should-skip-prompts-DXyhnzjP.js → should-skip-prompts--6z1nvz1.js} +4 -4
  35. package/dist/should-use-tui-6f8qLHfp.js +25 -0
  36. package/dist/skills/improve-threejs/SKILL.md +102 -0
  37. package/dist/skills/performance/SKILL.md +113 -0
  38. package/dist/skills/react-doctor/SKILL.md +6 -0
  39. package/dist/{unref-stdin-CwYEtpri.js → telemetry-runtime-AGGMneW6.js} +5 -23
  40. package/dist/unref-stdin-BKT_s38a.js +12 -0
  41. package/dist/{version-tT7fsrFN.js → version-Nk1e-_N3.js} +4 -4
  42. package/dist/{why-4B0HPeQG.js → why-BujUNbke.js} +4 -4
  43. package/dist/with-run-span-Yaips-em.js +110 -0
  44. package/package.json +5 -4
@@ -0,0 +1,76 @@
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]="4fa89084-3ebd-5265-9b14-3d23f504971a")}catch(e){}}();
3
+ import { z as CliInputError } from "./record-metric-Bca1TzEP.js";
4
+ //#region src/cli/runtime-scan/constants.ts
5
+ const RUNTIME_SCAN_MAX_COMPONENT_EVENTS = 2e3;
6
+ const RUNTIME_SCAN_MAX_SNAPSHOT_PAYLOAD_BYTES = 5 * 1024 * 1024;
7
+ const RUNTIME_SCAN_MAX_SNAPSHOT_BYTES = RUNTIME_SCAN_MAX_SNAPSHOT_PAYLOAD_BYTES - 64 * 1024;
8
+ Math.floor(RUNTIME_SCAN_MAX_SNAPSHOT_BYTES / 3);
9
+ const RUNTIME_SCAN_MAX_TRACE_BYTES = 512 * 1024 * 1024;
10
+ const RUNTIME_SCAN_MAX_STRING_LENGTH = 4096;
11
+ const RUNTIME_SCAN_LAYOUT_THRASH_RATIO = .25;
12
+ const RUNTIME_SCAN_MAX_RECORDING_DURATION_MS = 300 * 1e3;
13
+ const RUNTIME_SCAN_SNAPSHOT_TIMEOUT_MS = 1e4;
14
+ const RUNTIME_SCAN_LOCAL_DEV_PORTS = [
15
+ 1234,
16
+ ...Array.from({ length: 11 }, (_unusedValue, portOffset) => 3e3 + portOffset),
17
+ ...Array.from({ length: 11 }, (_unusedValue, portOffset) => 4e3 + portOffset),
18
+ 4173,
19
+ 4200,
20
+ 4321,
21
+ ...Array.from({ length: 11 }, (_unusedValue, portOffset) => 5e3 + portOffset),
22
+ ...Array.from({ length: 11 }, (_unusedValue, portOffset) => 5173 + portOffset),
23
+ ...Array.from({ length: 11 }, (_unusedValue, portOffset) => 8e3 + portOffset),
24
+ ...Array.from({ length: 11 }, (_unusedValue, portOffset) => 8080 + portOffset),
25
+ 8888
26
+ ];
27
+ const RUNTIME_SCAN_BROWSER_WIDTH_PX = 1440;
28
+ const RUNTIME_SCAN_TRACE_FILE_EXTENSION = ".json.gz";
29
+ const RUNTIME_SCAN_TRACING_COMPLETE_TIMEOUT_MS = 1e4;
30
+ const RUNTIME_SCAN_PROBE_RELATIVE_PATH = "runtime-scan/browser-probe.iife.js";
31
+ const RUNTIME_SCAN_PROBE_SNAPSHOT_BINDING_NAME_PLACEHOLDER = "__REACT_DOCTOR_RUNTIME_SCAN_CAPTURE__";
32
+ const RUNTIME_SCAN_PROBE_SNAPSHOT_ATTRIBUTE_NAME_PLACEHOLDER = "data-react-doctor-runtime-scan-snapshot";
33
+ const RUNTIME_SCAN_PROBE_SNAPSHOT_TOKEN_PLACEHOLDER = "__REACT_DOCTOR_RUNTIME_SCAN_TOKEN__";
34
+ const RUNTIME_SCAN_SAFE_CDP_PAGE_URLS = [
35
+ "about:blank",
36
+ "chrome://newtab/",
37
+ "chrome://new-tab-page/"
38
+ ];
39
+ const RUNTIME_SCAN_CONTROL_CHARACTERS_PATTERN = /[\u0000-\u001f\u007f-\u009f]/g;
40
+ const RUNTIME_SCAN_TRACE_CATEGORIES = [
41
+ "-*",
42
+ "blink.console",
43
+ "blink.user_timing",
44
+ "devtools.timeline",
45
+ "disabled-by-default-devtools.timeline",
46
+ "disabled-by-default-devtools.timeline.invalidationTracking",
47
+ "disabled-by-default-devtools.timeline.frame",
48
+ "disabled-by-default-devtools.timeline.stack",
49
+ "disabled-by-default-v8.cpu_profiler",
50
+ "disabled-by-default-v8.cpu_profiler.hires",
51
+ "latencyInfo",
52
+ "loading",
53
+ "v8",
54
+ "v8.execute"
55
+ ];
56
+ //#endregion
57
+ //#region src/cli/runtime-scan/sanitize-runtime-url.ts
58
+ const sanitizeRuntimeUrl = (rawUrl) => {
59
+ let parsedUrl;
60
+ try {
61
+ parsedUrl = new URL(rawUrl);
62
+ } catch {
63
+ throw new CliInputError(`Expected an absolute http(s) URL, received "${rawUrl}".`);
64
+ }
65
+ if (parsedUrl.protocol !== "http:" && parsedUrl.protocol !== "https:") throw new CliInputError(`Expected an http(s) URL, received "${parsedUrl.protocol}".`);
66
+ parsedUrl.username = "";
67
+ parsedUrl.password = "";
68
+ parsedUrl.search = "";
69
+ parsedUrl.hash = "";
70
+ return parsedUrl.href;
71
+ };
72
+ //#endregion
73
+ export { RUNTIME_SCAN_SNAPSHOT_TIMEOUT_MS as _, RUNTIME_SCAN_LOCAL_DEV_PORTS as a, RUNTIME_SCAN_TRACING_COMPLETE_TIMEOUT_MS as b, RUNTIME_SCAN_MAX_SNAPSHOT_BYTES as c, RUNTIME_SCAN_MAX_TRACE_BYTES as d, RUNTIME_SCAN_PROBE_RELATIVE_PATH as f, RUNTIME_SCAN_SAFE_CDP_PAGE_URLS as g, RUNTIME_SCAN_PROBE_SNAPSHOT_TOKEN_PLACEHOLDER as h, RUNTIME_SCAN_LAYOUT_THRASH_RATIO as i, RUNTIME_SCAN_MAX_SNAPSHOT_PAYLOAD_BYTES as l, RUNTIME_SCAN_PROBE_SNAPSHOT_BINDING_NAME_PLACEHOLDER as m, RUNTIME_SCAN_BROWSER_WIDTH_PX as n, RUNTIME_SCAN_MAX_COMPONENT_EVENTS as o, RUNTIME_SCAN_PROBE_SNAPSHOT_ATTRIBUTE_NAME_PLACEHOLDER as p, RUNTIME_SCAN_CONTROL_CHARACTERS_PATTERN as r, RUNTIME_SCAN_MAX_RECORDING_DURATION_MS as s, sanitizeRuntimeUrl as t, RUNTIME_SCAN_MAX_STRING_LENGTH as u, RUNTIME_SCAN_TRACE_CATEGORIES as v, RUNTIME_SCAN_TRACE_FILE_EXTENSION as y };
74
+
75
+ //# sourceMappingURL=sanitize-runtime-url-pzQIwyc8.js.map
76
+ //# debugId=4fa89084-3ebd-5265-9b14-3d23f504971a
@@ -1,29 +1,17 @@
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]="21a71b3c-82e6-55b4-b8b4-bff714ffdee2")}catch(e){}}();
3
- import { dn as resolveScanTarget, t as recordCount, w as METRIC, z as isNonInteractiveEnvironment } from "./record-metric-CFPfyOEW.js";
4
- import { i as warnDeprecatedDiff } from "./resolve-scope-CNV3HRNo.js";
5
- import { _ as resolveCliInspectOptions, i as validateModeFlags } from "./should-fail-scan-gate-XdfNPXf9.js";
6
- import { n as warnDeprecatedFailOn, r as runProjectMigrations, t as inspectAction } from "./inspect-CEYHtLuK.js";
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]="38a32dd8-58a3-5181-b522-6780f7079edd")}catch(e){}}();
3
+ import { T as METRIC, fn as resolveScanTarget, t as recordCount } from "./record-metric-Bca1TzEP.js";
4
+ import { i as warnDeprecatedDiff } from "./resolve-scope-poO8hFkD.js";
5
+ import { _ as resolveCliInspectOptions, i as validateModeFlags } from "./should-fail-scan-gate-CFyk-8U3.js";
6
+ import { n as warnDeprecatedFailOn, r as runProjectMigrations, t as inspectAction } from "./inspect-BimAQ5xM.js";
7
+ import { n as shouldUseTui, r as resolveTuiEnvironment } from "./should-use-tui-6f8qLHfp.js";
7
8
  import path from "node:path";
8
- //#region src/cli/utils/should-use-tui.ts
9
- const shouldUseTui = (input) => {
10
- if (input.isNonInteractiveEnvironment || !input.stdinIsTty || !input.stdoutIsTty || !input.supportsRawMode || input.nodeMajorVersion < 22 || input.terminalName === "dumb") return false;
11
- const flags = input.flags;
12
- return !(flags.score === true || flags.json === true || flags.jsonCompact === true || flags.jsonOut !== void 0 || flags.staged === true || flags.changedFilesFrom !== void 0);
13
- };
14
- //#endregion
15
9
  //#region src/cli/commands/scan.ts
16
10
  const runScanCommand = async (input) => {
17
11
  if (input.flags.cache === false) process.env.REACT_DOCTOR_NO_CACHE = "1";
18
- const nodeMajorVersion = Number(process.versions.node.split(".")[0]);
19
12
  if (!shouldUseTui({
20
13
  flags: input.flags,
21
- isNonInteractiveEnvironment: isNonInteractiveEnvironment(),
22
- nodeMajorVersion,
23
- stdinIsTty: process.stdin.isTTY === true,
24
- stdoutIsTty: process.stdout.isTTY === true,
25
- supportsRawMode: typeof process.stdin.setRawMode === "function",
26
- terminalName: process.env.TERM
14
+ ...resolveTuiEnvironment()
27
15
  })) {
28
16
  await inspectAction(input.directory, input.flags, input.invocationCommand);
29
17
  return;
@@ -34,7 +22,7 @@ const runScanCommand = async (input) => {
34
22
  warnDeprecatedFailOn(input.flags, scanTarget.userConfig);
35
23
  warnDeprecatedDiff(input.flags, scanTarget.userConfig);
36
24
  recordCount(METRIC.cliInvoked, 1, { command: input.invocationCommand });
37
- const { runScanApp } = await import("./run-scan-app-lYmDIiT4.js");
25
+ const { runScanApp } = await import("./run-scan-app-NI3PasUA.js");
38
26
  const { shouldFail } = await runScanApp({
39
27
  directory: input.directory,
40
28
  scanTarget,
@@ -49,5 +37,5 @@ const runScanCommand = async (input) => {
49
37
  //#endregion
50
38
  export { runScanCommand };
51
39
 
52
- //# sourceMappingURL=scan-D-Y1Qifl.js.map
53
- //# debugId=21a71b3c-82e6-55b4-b8b4-bff714ffdee2
40
+ //# sourceMappingURL=scan-DoM4T1ov.js.map
41
+ //# debugId=38a32dd8-58a3-5181-b522-6780f7079edd
@@ -1,12 +1,14 @@
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]="49eb03b4-ad5f-5d68-8511-ef63da81d36d")}catch(e){}}();
3
- import { $ as Maintainability, $t as listSourceFiles, An as makeSpan, At as filterDiagnosticsForSurface, Bn as try_, Ct as computeConfigFingerprint, Dn as decodeUnknownSync, Dt as createOxlintSpawnSlots, E as NANOSECONDS_PER_MILLISECOND, En as Diagnostic, Et as createNodeReadFileLinesSync, Fn as provideContext, G as isCiOrCodingAgentEnvironment, Gn as succeed, Gt as highlighter, H as ACTION_INPUT_ENVIRONMENT_VARIABLES, Ht as hasPublishedFixRecipe, In as provideService, J as Files, Jn as fail, Kt as isMonorepoRoot, Ln as runPromise, Mn as orElseSucceed, Mt as filterSourceFiles, Nn as promise, Pn as provide, Q as Linter, R as CliInputError, Rn as runSync, Rt as getDiagnosticRuleIdentity, Sn as error, St as collectSourceFileCountsByDirectory, Tn as warn, Tt as countOptInProjectRuleSelections, U as detectRunnerOs, Un as mergeAll, Vt as groupBy, W as isCiEnvironment, Wt as hashFileContents, Xn as ParentSpan, Y as Git, Yn as void_, Yt as isReactDoctorError, Z as LintPartialFailures, Zt as isScanComplete, _ as makeNoopConsole, _n as summarizeDiagnostics, _t as buildSkippedChecks, an as mergeReactDoctorConfigs, at as Project, bn as yieldToEventLoop, br as isFile, bt as classifyFileContext, c as setSentryProjectInfo, cn as resolveLintBatchOrdering, cr as GIT_SHOW_MAX_BUFFER_BYTES, ct as SidecarLintCacheEnabled, d as isJsonModeActive, dn as resolveScanTarget, dr as JSX_FILE_PATTERN, en as listSourceFilesCooperative, er as CI_URL, et as NodeResolver, fn as restoreLegacyThrow, fr as MILLISECONDS_PER_SECOND, g as VERSION, gn as shouldUseMaintainabilityLayer, gt as buildRuleSeverityControls, ht as buildRuleDocsUrl, in as materializeSourceTree, ir as DIAGNOSTIC_CATEGORY_BUCKETS, it as Progress, jn as map, jt as filterPathsOutsideDirectories, k as SCAN_RESULT_CACHE_FILENAME, kn as gen, kt as discoverSupportedSubprojects, l as getRunId, ln as resolveReactDoctorCacheDir, lr as HTML_FILE_PATTERN, mr as SHARE_BASE_URL, n as recordDistribution, nt as OxlintSpawnSlots, o as buildSentryScope, on as remainingDeadlineBudgetMs, or as ENTERPRISE_CONTACT_URL, ot as Reporter, pn as runInspect, pr as OXLINT_NODE_REQUIREMENT, pt as atomicWriteJson, q as Config, qt as isPathInsideDirectory, r as toSpanAttributes, rn as mapWithConcurrency, rt as PerFileLintCacheEnabled, s as buildSentryProjectContext, sn as resolveGithubActionsScoreMetadata, st as Score, t as recordCount, tn as listWorkspacePackages, tt as OxlintConcurrency, un as resolveScanConcurrency, ur as JSX_DUPLICATION_SOURCE_FILE_PATTERN, ut as SupplyChain, vr as isDirectory, vt as calculateScore, w as METRIC, wn as log, wt as computeDiagnosticDelta, x as BASELINE_FILES_TEMP_DIR_PREFIX, xn as Console, yt as canonicalizeUserRuleKey, z as isNonInteractiveEnvironment, zn as sync } from "./record-metric-CFPfyOEW.js";
4
- import { a as setActiveRunTrace, i as recordRunTraceId, o as getTelemetryContext } from "./unref-stdin-CwYEtpri.js";
5
- import { n as buildFooterLinkLines, r as activeScanAbortRegistry, t as buildSectionDivider } from "./build-section-divider-CdnczCsb.js";
6
- import { D as getPackageJsonPath, L as cliLogger, O as isRecord, P as runGit, a as installReactDoctorScriptStep, c as spinner, n as findNearestPackageDirectory, o as isSpinnerSilent, s as setSpinnerSilent } from "./install-doctor-script-BZJlaCgz.js";
7
- import { d as detectDefaultBranch, l as prompts, r as installReactDoctorWorkflow, u as isCommandAvailable } from "./install-github-workflow-DQIDvKig.js";
8
- import { a as isValidBlockingLevel, c as openWorkflowPullRequest, l as stageWorkflowFile, o as pickBlockingLevel, u as toForwardSlashes } from "./resolve-scope-CNV3HRNo.js";
9
- import { h as detectAvailableAgents, t as reportWorkflowResult } from "./report-workflow-result-GxDOhexG.js";
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]="597e61bb-0148-5da3-84f8-eccaeb67de20")}catch(e){}}();
3
+ import { $ as Linter, A as SCAN_RESULT_CACHE_FILENAME, An as gen, At as discoverSupportedSubprojects, B as isNonInteractiveEnvironment, Bn as sync, Cn as error, Ct as collectSourceFileCountsByDirectory, Dn as Diagnostic, Dt as createNodeReadFileLinesSync, En as warn, Et as countOptInProjectRuleSelections, Fn as provide, G as isCiEnvironment, Gt as hashFileContents, Ht as groupBy, In as provideContext, J as Config, Jt as isPathInsideDirectory, K as isCiOrCodingAgentEnvironment, Kn as succeed, Kt as highlighter, Ln as provideService, Mn as map, Mt as filterPathsOutsideDirectories, Nn as orElseSucceed, Nt as filterSourceFiles, On as decodeUnknownSync, Ot as createOxlintSpawnSlots, Pn as promise, Q as LintPartialFailures, Qt as isScanComplete, Rn as runPromise, S as BASELINE_FILES_TEMP_DIR_PREFIX, Sn as Console, T as METRIC, Tn as log, Tt as computeDiagnosticDelta, U as ACTION_INPUT_ENVIRONMENT_VARIABLES, Ut as hasPublishedFixRecipe, Vn as try_, W as detectRunnerOs, Wn as mergeAll, X as Git, Xt as isReactDoctorError, Y as Files, Zn as ParentSpan, _ as VERSION, _n as shouldUseMaintainabilityLayer, _t as buildRuleSeverityControls, an as materializeSourceTree, ar as DIAGNOSTIC_CATEGORY_BUCKETS, at as Progress, bt as canonicalizeUserRuleKey, cn as resolveGithubActionsScoreMetadata, ct as Score, d as isJsonModeActive, dn as resolveScanConcurrency, dr as JSX_DUPLICATION_SOURCE_FILE_PATTERN, dt as SupplyChain, en as listSourceFiles, et as Maintainability, fn as resolveScanTarget, fr as JSX_FILE_PATTERN, gt as buildRuleDocsUrl, hr as SHARE_BASE_URL, in as mapWithConcurrency, it as PerFileLintCacheEnabled, jt as filterDiagnosticsForSurface, l as getRunId, ln as resolveLintBatchOrdering, lr as GIT_SHOW_MAX_BUFFER_BYTES, lt as SidecarLintCacheEnabled, mn as runInspect, mr as OXLINT_NODE_REQUIREMENT, mt as atomicWriteJson, n as recordDistribution, nn as listWorkspacePackages, nt as OxlintConcurrency, on as mergeReactDoctorConfigs, ot as Project, pn as restoreLegacyThrow, pr as MILLISECONDS_PER_SECOND, qt as isMonorepoRoot, r as toSpanAttributes, rt as OxlintSpawnSlots, sn as remainingDeadlineBudgetMs, sr as ENTERPRISE_CONTACT_URL, st as Reporter, t as recordCount, tn as listSourceFilesCooperative, tr as CI_URL, tt as NodeResolver, un as resolveReactDoctorCacheDir, ur as HTML_FILE_PATTERN, v as makeNoopConsole, vn as summarizeDiagnostics, vt as buildSkippedChecks, wt as computeConfigFingerprint, xn as yieldToEventLoop, xr as isFile, xt as classifyFileContext, yr as isDirectory, yt as calculateScore, z as CliInputError, zn as runSync, zt as getDiagnosticRuleIdentity } from "./record-metric-Bca1TzEP.js";
4
+ import { t as getTelemetryContext } from "./telemetry-runtime-AGGMneW6.js";
5
+ import { n as buildFooterLinkLines, t as buildSectionDivider } from "./build-section-divider-I2zZDzJ9.js";
6
+ import { t as activeScanAbortRegistry } from "./active-scan-abort-registry-DwG6tSPy.js";
7
+ import { A as runGit, C as getPackageJsonPath, N as cliLogger, a as installReactDoctorScriptStep, c as spinner, n as findNearestPackageDirectory, o as isSpinnerSilent, s as setSpinnerSilent, w as isRecord } from "./install-doctor-script-02_POH23.js";
8
+ import { d as detectDefaultBranch, l as prompts, r as installReactDoctorWorkflow, u as isCommandAvailable } from "./install-github-workflow-CDDxuboB.js";
9
+ import { a as isValidBlockingLevel, c as openWorkflowPullRequest, l as stageWorkflowFile, o as pickBlockingLevel, u as toForwardSlashes } from "./resolve-scope-poO8hFkD.js";
10
+ import { n as resetSentryRunState, r as withRunSpan, t as recordSentryProjectContext } from "./with-run-span-Yaips-em.js";
11
+ import { h as detectAvailableAgents, t as reportWorkflowResult } from "./report-workflow-result-CA8lTeDk.js";
10
12
  import { createRequire } from "node:module";
11
13
  import { spawn } from "node:child_process";
12
14
  import * as path$1 from "node:path";
@@ -102,107 +104,6 @@ const buildRuntimeLayers = (input) => {
102
104
  return input.oxlintSpawnSlots === void 0 ? layersWithConcurrency : mergeAll(layersWithConcurrency, succeed(OxlintSpawnSlots, input.oxlintSpawnSlots));
103
105
  };
104
106
  //#endregion
105
- //#region src/cli/utils/with-run-span.ts
106
- /**
107
- * Ends the run span without letting a telemetry failure change the run's
108
- * outcome — the invariant every other emit site here already holds.
109
- *
110
- * The failure path is the reason this matters most: a throw from `end` there
111
- * would replace the user's original scan error, so a project-config mistake
112
- * could surface as an exporter stack trace, be reclassified as a crash, and get
113
- * reported as one.
114
- */
115
- const endSpanSafely = (span, exit) => {
116
- try {
117
- span.end(BigInt(Date.now()) * NANOSECONDS_PER_MILLISECOND, exit);
118
- } catch {}
119
- };
120
- /**
121
- * Clears the module-level run-scoped telemetry state — the current scanned
122
- * project and the active run trace. `inspect()` calls this at the start of every
123
- * run and again after a clean one, so a prior or just-finished scan can't attach
124
- * its project tags / trace to a later run or to a non-scan error (e.g.
125
- * inspectAction's post-loop finalize/handoff steps). A thrown scan error skips
126
- * the post-run reset, leaving the state for the command catch to attribute and
127
- * link the crash. Concurrent batch members (`concurrentScan`) never touch this
128
- * state — they neither write nor reset it. Safe to call when telemetry is off
129
- * (the refs are read only when an event is built).
130
- */
131
- const resetSentryRunState = () => {
132
- setSentryProjectInfo(null);
133
- setActiveRunTrace(null);
134
- };
135
- /**
136
- * Runs an inspect invocation inside a root span so each `react-doctor` run is a
137
- * first-class trace with timing and the run snapshot as attributes. The span is
138
- * handed to `run` so the scan's Effect spans parent under it and so the wide
139
- * event can be stamped onto it once the outcome is known.
140
- *
141
- * A no-op pass-through when telemetry is off (`--no-telemetry`, tests, or an
142
- * unconfigured build) — `run` receives `undefined` and no span is created, so
143
- * there's no added exit latency.
144
- *
145
- * The span is created against the shared telemetry context rather than a
146
- * freshly-provided layer, so it lives in the same tracer as the scan program's
147
- * spans; see `telemetry-runtime.ts` for why that matters. It is started and
148
- * ended manually because the body it wraps is a promise-returning imperative
149
- * function, not an Effect — the same shape the Sentry inactive span had.
150
- *
151
- * While the span runs, its trace context is recorded as the active run trace so
152
- * `reportErrorToSentry` can attach a crash thrown during the scan back to this
153
- * trace (errors surface in the command catch, after the span has ended).
154
- *
155
- * A `concurrentScan` (one member of the CLI's multi-project pool) still gets its
156
- * own root span, but skips recording the active run trace — the module-level
157
- * handle has single-scan semantics, and overlapping writers would link a crash
158
- * to an arbitrary sibling's trace.
159
- */
160
- const withRunSpan = async (run, options = {}) => {
161
- const telemetryContext = getTelemetryContext();
162
- if (telemetryContext === null) return run(void 0);
163
- const { tags } = buildSentryScope();
164
- const command = typeof tags.command === "string" ? tags.command : "inspect";
165
- let rootSpan;
166
- try {
167
- rootSpan = runSync(makeSpan(`react-doctor ${command}`, { attributes: toSpanAttributes(tags) }).pipe(provideContext(telemetryContext)));
168
- } catch {
169
- return run(void 0);
170
- }
171
- recordRunTraceId(rootSpan.traceId);
172
- if (options.concurrentScan !== true) setActiveRunTrace({
173
- traceId: rootSpan.traceId,
174
- spanId: rootSpan.spanId,
175
- sampled: rootSpan.sampled
176
- });
177
- try {
178
- const result = await run(rootSpan);
179
- endSpanSafely(rootSpan, void_);
180
- return result;
181
- } catch (error) {
182
- endSpanSafely(rootSpan, fail(error));
183
- throw error;
184
- }
185
- };
186
- /**
187
- * Records the scanned project (discovered in the `beforeLint` hook): remembers
188
- * it for the lazy Sentry error-capture path (`buildSentryScope` folds it into
189
- * exception events) and for per-emit metric attributes, and sets it on the run's
190
- * root span so the trace carries the project shape too. Always cheap — the span
191
- * attributes are skipped when `rootSpan` is absent (telemetry off), and storing
192
- * the info is a plain assignment.
193
- *
194
- * A `concurrentScan` only sets the span attributes: the module-level project ref
195
- * has single-scan semantics, and overlapping writers would stamp events and
196
- * metrics with an arbitrary sibling's project. Wide events keep full attribution
197
- * (they ride the span); per-emit metrics simply omit the project shape during a
198
- * concurrent batch (absent, never wrong).
199
- */
200
- const recordSentryProjectContext = (projectInfo, rootSpan, options = {}) => {
201
- if (options.concurrentScan !== true) setSentryProjectInfo(projectInfo);
202
- if (rootSpan === void 0) return;
203
- for (const [key, value] of Object.entries(toSpanAttributes(buildSentryProjectContext(projectInfo).tags))) rootSpan.attribute(key, value);
204
- };
205
- //#endregion
206
107
  //#region src/cli/utils/diagnostic-grouping.ts
207
108
  const buildRulePriorityMap = (scores) => {
208
109
  const rulePriority = /* @__PURE__ */ new Map();
@@ -3096,5 +2997,5 @@ const shouldFailScanGate = (input) => {
3096
2997
  //#endregion
3097
2998
  export { resolveMergeBaseRef as A, buildNoScoreMessage as B, copyToClipboard as C, deduplicateProjectScans as D, collectProjectSourceFileCounts as E, printFooter as F, formatFixRecipeLine as G, hasLintHardFailure as H, printDiagnosticsDump as I, formatLearnMoreLine as K, formatDiagnosticSite as L, pluralize as M, formatSkippedCheckLabel as N, createInvocationInspect as O, formatElapsedTime as P, hasIncompleteScoreAnalysis as R, CLI_AGENT_BINARIES as S, buildHandoffPayload as T, buildRulePriorityMap as U, buildEmptyReportMessage as V, buildSortedRuleGroups as W, resolveCliInspectOptions as _, projectManifestChanged as a, setUpGitHubActions as b, selectProjects as c, resolveProjectChangedLineRanges as d, resolveProjectDiffIncludePaths as f, resolveWorkspaceDeadCodeOwner as g, retryMissingProjectScores as h, validateModeFlags as i, printHeadlessReport as j, inspect as k, buildCodeFrame as l, resolveProjectRelativeDirectory as m, formatSkippedProjectsMessage as n, partitionProjectScanOutcomes as o, resolveProjectSourceFilePaths as p, validateIncludeUntrackedScope as r, discoverWorkspacePackages as s, shouldFailScanGate as t, resolveProjectScan as u, filterScansForSurface as v, launchCliAgent as w, detectLaunchableAgents as x, countUniqueScannedFiles as y, filterDiagnosticsByCategories as z };
3098
2999
 
3099
- //# sourceMappingURL=should-fail-scan-gate-XdfNPXf9.js.map
3100
- //# debugId=49eb03b4-ad5f-5d68-8511-ef63da81d36d
3000
+ //# sourceMappingURL=should-fail-scan-gate-CFyk-8U3.js.map
3001
+ //# debugId=597e61bb-0148-5da3-84f8-eccaeb67de20
@@ -1,10 +1,10 @@
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]="bddc3436-2d02-5749-b77f-2c6cab9f26fa")}catch(e){}}();
3
- import { z as isNonInteractiveEnvironment } from "./record-metric-CFPfyOEW.js";
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]="4ce19044-71b6-58ee-b4af-b09c53789d90")}catch(e){}}();
3
+ import { B as isNonInteractiveEnvironment } from "./record-metric-Bca1TzEP.js";
4
4
  //#region src/cli/utils/should-skip-prompts.ts
5
5
  const shouldSkipPrompts = (input = {}) => Boolean(input.yes) || Boolean(input.json) || isNonInteractiveEnvironment() || !process.stdin.isTTY;
6
6
  //#endregion
7
7
  export { shouldSkipPrompts as t };
8
8
 
9
- //# sourceMappingURL=should-skip-prompts-DXyhnzjP.js.map
10
- //# debugId=bddc3436-2d02-5749-b77f-2c6cab9f26fa
9
+ //# sourceMappingURL=should-skip-prompts--6z1nvz1.js.map
10
+ //# debugId=4ce19044-71b6-58ee-b4af-b09c53789d90
@@ -0,0 +1,25 @@
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]="82fa3464-9ed7-5664-923c-4fdc351ae452")}catch(e){}}();
3
+ import { B as isNonInteractiveEnvironment } from "./record-metric-Bca1TzEP.js";
4
+ //#region src/cli/utils/resolve-tui-environment.ts
5
+ const resolveTuiEnvironment = (outputIsTty = process.stdout.isTTY === true) => ({
6
+ isNonInteractiveEnvironment: isNonInteractiveEnvironment(),
7
+ nodeMajorVersion: Number(process.versions.node.split(".")[0]),
8
+ outputIsTty,
9
+ stdinIsTty: process.stdin.isTTY === true,
10
+ supportsRawMode: typeof process.stdin.setRawMode === "function",
11
+ terminalName: process.env.TERM
12
+ });
13
+ //#endregion
14
+ //#region src/cli/utils/should-use-tui.ts
15
+ const isTuiEnvironmentSupported = (input) => !input.isNonInteractiveEnvironment && input.stdinIsTty && input.outputIsTty && input.supportsRawMode && input.nodeMajorVersion >= 22 && input.terminalName !== "dumb";
16
+ const shouldUseTui = (input) => {
17
+ if (!isTuiEnvironmentSupported(input)) return false;
18
+ const flags = input.flags;
19
+ return !(flags.score === true || flags.json === true || flags.jsonCompact === true || flags.jsonOut !== void 0 || flags.staged === true || flags.changedFilesFrom !== void 0);
20
+ };
21
+ //#endregion
22
+ export { shouldUseTui as n, resolveTuiEnvironment as r, isTuiEnvironmentSupported as t };
23
+
24
+ //# sourceMappingURL=should-use-tui-6f8qLHfp.js.map
25
+ //# debugId=82fa3464-9ed7-5664-923c-4fdc351ae452
@@ -0,0 +1,102 @@
1
+ ---
2
+ name: improve-threejs
3
+ description: Audit and fix Three.js and React Three Fiber apps for frame-loop performance, GPU memory leaks, scene-graph correctness, and visual defects like z-fighting, shadow acne, wrong color space, and broken resize handling. Uses React Doctor as the scanning engine plus a visual rubric checked against rendered output. Use when the user asks to improve, audit, scan, or clean up a Three.js, R3F, react-three-fiber, drei, or WebGL app, or types `/improve-threejs`.
4
+ ---
5
+
6
+ # Improve Three.js
7
+
8
+ Audits a Three.js or React Three Fiber (R3F) codebase and fixes what hurts most: work that runs every frame, GPU resources that never get disposed, scene-graph objects rebuilt on every render, and visual defects the user can see. React Doctor supplies the machine-verified code scan; this skill supplies the frame-loop judgment and the visual inspection a general React scanner lacks.
9
+
10
+ The core principle: severity follows the render loop. Code inside `useFrame` or a `requestAnimationFrame` callback runs 60 times per second, so a minor inefficiency there outweighs a major one in a settings panel. Rank every finding by where it runs, not by the rule's default severity.
11
+
12
+ ## Workflow
13
+
14
+ ### Step 1: Recon
15
+
16
+ Identify the stack before scanning: plain Three.js or R3F, which helper libraries are in use (drei, postprocessing, rapier), and where the render loop lives (`useFrame` hooks, `requestAnimationFrame`, the `<Canvas frameloop>` setting).
17
+
18
+ Build a hot-path map: every `useFrame` body, every RAF callback, every pointer-move handler. These files get the strictest review in Step 3.
19
+
20
+ ### Step 2: Scan
21
+
22
+ Run React Doctor read-only to collect structured evidence:
23
+
24
+ ```bash
25
+ npx react-doctor@latest --verbose
26
+ ```
27
+
28
+ For a regression check after making changes, run with `--scope changed` and confirm the score did not drop.
29
+
30
+ ### Step 3: Triage by frame-loop leverage
31
+
32
+ Re-rank the scanner's findings using the hot-path map, then hunt for the Three.js-specific problems the scanner cannot see. Confirm every finding at its `file:line` before reporting it.
33
+
34
+ **HIGH severity, runs every frame or leaks GPU memory:**
35
+
36
+ - **Allocation inside `useFrame`**: `new Vector3()`, `new Color()`, or fresh arrays passed to Three.js APIs each frame. Fix: hoist a scratch object to module scope or `useMemo`, then mutate it in place
37
+ - **`setState` inside `useFrame`**: re-renders the React tree on every frame. Fix: mutate refs directly; reserve state for discrete changes like selection or visibility
38
+ - **Missing disposal**: geometries, materials, textures, or render targets created imperatively and never disposed. Fix: call `dispose()` in the cleanup function, or move the object into R3F's declarative tree so it owns the lifecycle
39
+ - **Object reconstruction in render**: geometry or material instances created without `useMemo`, or inline `args` arrays whose identity changes each render, forcing R3F to rebuild the underlying object
40
+
41
+ **MEDIUM severity, per-render or per-interaction waste:**
42
+
43
+ - **Unstable scene-graph props**: inline `new THREE.Vector3()` or fresh material objects as props (plain arrays like `position={[x, y, z]}` are fine; R3F handles them)
44
+ - **Missing instancing**: hundreds of identical meshes rendered individually instead of through `<Instances>` or `InstancedMesh`
45
+ - **Wasted frames**: `frameloop="always"` on a scene that only changes on interaction. Fix: `frameloop="demand"` plus `invalidate()`
46
+ - **Uncached asset loading**: textures and models loaded outside `useLoader`, `useTexture`, or `useGLTF`, losing caching and Suspense integration
47
+
48
+ **LOW severity, hygiene:** React Doctor findings on non-canvas UI code, missing `<Preload>`, oversized textures.
49
+
50
+ ### Step 4: Visual audit
51
+
52
+ Inspect what the scene actually renders. Every visual finding needs evidence: a screenshot, a frame capture, or a reproduced observation, never a guess from reading source. When a dev server and browser are available, load the app, capture the first stable frame, then capture again after moving the camera and interacting. When no browser is available, check the code-level causes listed below and label each finding as inferred from source.
53
+
54
+ Apply the mini rubric. A row fails only when the evidence shows the failure condition:
55
+
56
+ | Area | Check | Fail when |
57
+ | --- | --- | --- |
58
+ | Render sanity | The scene reaches a stable frame after load | Black canvas, WebGL context errors, or content that never appears |
59
+ | Geometry | Move the camera along seams, edges, and boundaries | Gaps, missing faces, visible backfaces, or two surfaces flickering at the same depth (z-fighting) |
60
+ | Transparency and depth | Cross depth-order boundaries with overlapping or transmissive surfaces | Wrong sort order, halos, opaque surfaces that should transmit, or flicker at grazing angles |
61
+ | Textures | View mapped surfaces close, far, and at grazing angles | Missing textures, stretching, seams, moiré, shimmer, or washed-out colors from a wrong color space |
62
+ | Materials and lighting | Change light and view direction on lit surfaces | Surfaces that ignore light direction, or reflective metals with no environment to reflect |
63
+ | Shadows | Move casters, receivers, and the light through their range | Acne, detached or floating shadows, flicker at rest, or shadows that outlive their caster |
64
+ | Camera | Follow the primary subject through movement and transitions | Subject leaves frame, camera clips into geometry, or foreground blocks the play area |
65
+ | Scale and contact | Compare object scale and resting contact against surroundings | Objects float above, sink into, or intersect their support surface, or sit at implausible scale |
66
+ | Image stability | Pan the camera slowly at supported resolutions | Silhouettes, thin geometry, or highlights that crawl, sparkle, or ghost |
67
+ | Resize and DPR | Change viewport size, zoom, and device pixel ratio | Distortion, blur, stretched output, or content leaving the viewport |
68
+
69
+ Each rubric row has a small set of usual code-level causes. Check these first when a row fails:
70
+
71
+ - **Washed-out or too-dark colors**: `renderer.outputColorSpace` not set to `SRGBColorSpace`, color textures missing `texture.colorSpace = SRGBColorSpace`, or a data texture (normal, roughness) wrongly marked sRGB
72
+ - **Z-fighting**: coplanar geometry needing `polygonOffset` or a position nudge, or a near plane set far too small for the scene scale
73
+ - **Shadow acne or floating shadows**: `shadow.bias` and `shadow.normalBias` untuned, or a shadow camera frustum far larger than the scene
74
+ - **Blurry or stretched canvas**: renderer size not synced to canvas CSS size, `setPixelRatio` never called, or a resize handler that forgets `camera.updateProjectionMatrix()`
75
+ - **Black metals**: `metalness: 1` with no `scene.environment` set
76
+ - **Transparency sorting glitches**: large transparent meshes needing `depthWrite: false`, manual `renderOrder`, or a split into smaller meshes
77
+ - **Shimmer and crawl**: missing texture anisotropy, antialiasing disabled, or thin geometry needing thicker forms
78
+
79
+ ### Step 5: Fix
80
+
81
+ Fix in severity order: HIGH performance findings and failed visual rows first. When a finding maps to a React Doctor rule, fetch the canonical recipe instead of improvising:
82
+
83
+ ```text
84
+ https://www.react.doctor/prompts/rules/<plugin>/<rule>.md
85
+ ```
86
+
87
+ For Three.js-specific findings, apply the fix named in the triage list or the cause list above.
88
+
89
+ ### Step 6: Validate
90
+
91
+ Run `npx react-doctor@latest --verbose --scope changed` and confirm the score did not regress. Re-check every visual rubric row that failed, using the same viewpoint and interaction as the original evidence, and confirm it now passes. Then verify behavior: the scene renders, animations play, and interactions respond. If browser dev tools are available, watch the memory profile while orbiting an idle scene; a rising heap during idle means a disposal leak survived.
92
+
93
+ ## Checks the scanner always misses
94
+
95
+ Review these by hand on every audit:
96
+
97
+ - `dispose()` coverage for every imperatively created GPU resource
98
+ - Allocations and `setState` inside `useFrame` and RAF callbacks
99
+ - Event listeners and `ResizeObserver`s on the canvas or window without cleanup
100
+ - Raycasting against the full scene on every pointer move instead of a filtered target list
101
+ - Shadows or postprocessing enabled globally when one part of the scene needs them
102
+ - Color space configuration on the renderer and every color texture
@@ -0,0 +1,113 @@
1
+ ---
2
+ name: performance
3
+ description: Diagnose React runtime performance with React Doctor traces, live render outlines, Long Animation Frames, interaction timing, and component render evidence. Use when invoked as `/performance` for a slow interaction, unexpected re-renders, or a measured before-and-after comparison.
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ # Diagnose React runtime performance
8
+
9
+ Measure one reproducible interaction, connect browser work to React renders, and report only conclusions supported by the trace.
10
+
11
+ ## Define the interaction
12
+
13
+ Before recording:
14
+
15
+ 1. Identify the target URL
16
+ 2. Write the exact actions to reproduce
17
+ 3. Choose the expected result
18
+ 4. Confirm whether authentication is required
19
+
20
+ Use a production build when available. Development builds add framework work that can distort render and script timings. If you must measure a development build, label that limitation in the report.
21
+
22
+ ## Record the trace
23
+
24
+ Run the scan in an interactive terminal:
25
+
26
+ ```bash
27
+ npx react-doctor@latest scan http://localhost:3000 --format json
28
+ ```
29
+
30
+ React Doctor opens an isolated Chrome profile. Perform the planned interaction while purple outlines identify rendered components. Press Enter after the interaction settles; recordings stop automatically after five minutes.
31
+
32
+ Interactive users can omit the URL and choose a detected localhost app or enter another URL. Agents must always pass the explicit URL so automated runs never wait for input.
33
+
34
+ For an authenticated session, connect through the Chrome DevTools Protocol (CDP):
35
+
36
+ ```bash
37
+ npx react-doctor@latest scan https://app.example.com \
38
+ --cdp http://127.0.0.1:9222 \
39
+ --format json
40
+ ```
41
+
42
+ Use a dedicated debug profile for CDP because Chrome tracing is browser-wide. Sign in, close every non-blank tab, and then start the scan. React Doctor closes leftover blank tabs before tracing. Never request cookies, copy a browser profile, or close an externally managed browser.
43
+
44
+ The compressed `.json.gz` trace can contain URLs, source paths, and application behavior. Keep it local unless an upload is explicitly approved.
45
+
46
+ ## Read the report
47
+
48
+ Evaluate the report in this order:
49
+
50
+ 1. **Capture support**: confirm React detection, build type, React tracks, and Long Animation Frame support
51
+ 2. **User impact**: inspect the worst interaction, total blocking duration, Largest Contentful Paint (LCP), and Cumulative Layout Shift (CLS)
52
+ 3. **Browser work**: inspect long frames and script hotspots for event handling, JavaScript, style, layout, and paint cost
53
+ 4. **React work**: inspect component render count, total self time, and maximum self time
54
+ 5. **Capture limits**: read every warning, especially dropped event counts
55
+
56
+ Follow these interpretation rules:
57
+
58
+ - A high render count is evidence, not a defect. Pair it with duration and user impact
59
+ - Generated chunk names identify browser work, not the owning source component
60
+ - A slow interaction can be browser-bound even when every component render is cheap
61
+ - Repeated Event Timing records with one interaction identifier represent one interaction
62
+ - Dropped component events make hotspot totals incomplete
63
+ - Use purple labels to identify the active subtree, then use recorded timings to set severity
64
+
65
+ ## Connect measurements to source
66
+
67
+ Search the repository for measured component display names and event handlers. Confirm that each candidate runs in the recorded flow before reporting it.
68
+
69
+ Open the DevTools trace when the summary cannot explain a long frame. Correlate the interaction timestamp with script tasks, style or layout work, React tracks, and paint. Do not infer causality from neighboring timestamps alone.
70
+
71
+ ## Report findings
72
+
73
+ Use this structure:
74
+
75
+ ```markdown
76
+ ## Flow tested
77
+
78
+ tested_url, build_type, and exact_interaction
79
+
80
+ ## Verdict
81
+
82
+ one_evidence_backed_paragraph
83
+
84
+ ## Evidence
85
+
86
+ | Signal | Measurement | Interpretation |
87
+ | ----------------- | ---------------------------: | --------------- |
88
+ | Worst interaction | duration_ms | measured_cause |
89
+ | Total blocking | duration_ms | measured_scope |
90
+ | Top component | render_count and duration_ms | measured_impact |
91
+
92
+ ## Findings
93
+
94
+ 1. `path/to/component.tsx:42`: measured_problem, evidence, and smallest_fix
95
+
96
+ ## Limits
97
+
98
+ capture_warnings, missing_support, or environmental_caveats
99
+ ```
100
+
101
+ Do not pad the report with static lint findings. Include source findings only when runtime evidence connects them to the tested flow.
102
+
103
+ ## Validate a fix
104
+
105
+ Do not edit code unless code changes are requested. After a fix:
106
+
107
+ 1. Rebuild with the same mode
108
+ 2. Record the same interaction at the same viewport
109
+ 3. Run three before and three after samples when timing variance could change the conclusion
110
+ 4. Compare medians for interaction, blocking, and component duration
111
+ 5. Confirm behavior and accessibility did not regress
112
+
113
+ Reject improvements that only move work outside the recorded window or disable useful behavior.
@@ -22,6 +22,12 @@ Run `npx react-doctor@latest --verbose` (the default `--scope full`) to scan the
22
22
 
23
23
  Run `npx react-doctor@latest design --verbose`. This selects only design-tagged UI composition, typography, interaction, accessibility, and motion rules, including focused rules that remain opt-in during a general health scan.
24
24
 
25
+ ## For runtime performance problems:
26
+
27
+ Run `npx react-doctor@latest scan <url> --format json` in an interactive terminal. React Doctor opens an isolated system Chrome profile, records a DevTools trace while the user reproduces the slow interaction, and flashes purple outlines with component names as React renders. It stops when they press Enter. Read the structured summary first, then inspect the returned local `.json.gz` trace for CPU, browser, and React component evidence.
28
+
29
+ If the user needs their authenticated browser state, use `--cdp <remote-debugging-url>`. This requires Chrome to already be running with remote debugging. Never ask for cookies or copy the user's browser profile. Treat the trace as sensitive local application data and never upload it without explicit permission.
30
+
25
31
  ## /doctor — full local triage workflow
26
32
 
27
33
  When the user types `/doctor`, says "run react doctor", or asks for a full triage / cleanup pass (not just a regression check), fetch the canonical local-triage playbook and follow every step in it:
@@ -1,6 +1,6 @@
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]="108f5716-98ff-5383-8562-fb0e773f8470")}catch(e){}}();
3
- import { Hn as buildWithScope, Jt as isProjectDiscoveryError, Kn as close, Ln as runPromise, On as make, Qt as layerObservability, R as CliInputError, Rn as runSync, Sr as messageFromUnknown, Yn as void_, Yt as isReactDoctorError, g as VERSION, i as isTelemetryEnabled, qn as makeUnsafe, yr as isErrnoException } from "./record-metric-CFPfyOEW.js";
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]="4bd3337a-ef61-59c8-a971-1fd015922f4f")}catch(e){}}();
3
+ import { $t as layerObservability, Cr as messageFromUnknown, Jn as makeUnsafe, Rn as runPromise, Un as buildWithScope, Xn as void_, Xt as isReactDoctorError, Yt as isProjectDiscoveryError, _ as VERSION, br as isErrnoException, i as isTelemetryEnabled, kn as make, qn as close, z as CliInputError, zn as runSync } from "./record-metric-Bca1TzEP.js";
4
4
  //#region src/cli/utils/is-environment-error.ts
5
5
  const ENVIRONMENT_ERROR_CODES = new Set([
6
6
  "EACCES",
@@ -197,25 +197,7 @@ const shutdownTelemetry = async () => {
197
197
  return pendingShutdown;
198
198
  };
199
199
  //#endregion
200
- //#region src/cli/utils/active-run-trace.ts
201
- let activeRunTrace = null;
202
- const setActiveRunTrace = (trace) => {
203
- activeRunTrace = trace;
204
- };
205
- const getActiveRunTrace = () => activeRunTrace;
206
- let lastRunTraceId = null;
207
- const recordRunTraceId = (traceId) => {
208
- lastRunTraceId = traceId;
209
- };
210
- const getLastRunTraceId = () => lastRunTraceId;
211
- //#endregion
212
- //#region src/cli/utils/unref-stdin.ts
213
- const unrefStdin = () => {
214
- if (process.stdin.isTTY) return;
215
- process.stdin.unref?.();
216
- };
217
- //#endregion
218
- export { setActiveRunTrace as a, isExpectedUserError as c, recordRunTraceId as i, formatEnvironmentError as l, getActiveRunTrace as n, getTelemetryContext as o, getLastRunTraceId as r, shutdownTelemetry as s, unrefStdin as t, isEnvironmentError as u };
200
+ export { isEnvironmentError as a, formatEnvironmentError as i, shutdownTelemetry as n, isExpectedUserError as r, getTelemetryContext as t };
219
201
 
220
- //# sourceMappingURL=unref-stdin-CwYEtpri.js.map
221
- //# debugId=108f5716-98ff-5383-8562-fb0e773f8470
202
+ //# sourceMappingURL=telemetry-runtime-AGGMneW6.js.map
203
+ //# debugId=4bd3337a-ef61-59c8-a971-1fd015922f4f
@@ -0,0 +1,12 @@
1
+ //#region src/cli/utils/unref-stdin.ts
2
+
3
+ !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]="bb265729-ea99-5b37-b53e-561ac78da6ac")}catch(e){}}();
4
+ const unrefStdin = () => {
5
+ if (process.stdin.isTTY) return;
6
+ process.stdin.unref?.();
7
+ };
8
+ //#endregion
9
+ export { unrefStdin as t };
10
+
11
+ //# sourceMappingURL=unref-stdin-BKT_s38a.js.map
12
+ //# debugId=bb265729-ea99-5b37-b53e-561ac78da6ac