react-doctor 0.2.15-dev.17e722e → 0.2.15-dev.3fae9dd

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 (3) hide show
  1. package/README.md +3 -3
  2. package/dist/cli.js +19 -283
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -96,14 +96,14 @@ Prefer JSON? Use `doctor.config.json`:
96
96
 
97
97
  ## Telemetry
98
98
 
99
- The CLI reports crashes, basic run traces, and anonymous usage counters to [Sentry](https://sentry.io) to help us fix bugs and prioritize what to build. Events and metrics include the version, platform, Node version, how the CLI was invoked (which command, package manager, and whether it ran locally vs. CI vs. a coding agent), the detected project shape (framework, React version, TypeScript, project size — never the contents of your files), which rules fired (rule names only, e.g. `react-doctor/no-array-index-as-key`, with counts — never your code or specific findings), and de-minified stack traces.
99
+ The CLI reports crashes and basic run traces to [Sentry](https://sentry.io) to help us fix bugs. Events include the version, platform, Node version, how the CLI was invoked (which command, package manager, and whether it ran locally vs. CI vs. a coding agent), the detected project shape (framework, React version, TypeScript, project size — never the contents of your files), and de-minified stack traces.
100
100
 
101
101
  Telemetry is **anonymized** before it leaves your machine: no IP address is collected, your hostname and machine name are stripped, your OS username is removed from every path (your home directory is replaced with `~`), captured local variables are dropped, and known secrets/API keys/emails are masked. No source code or diagnostic findings are sent.
102
102
 
103
103
  Opt out at any time:
104
104
 
105
- - `npx react-doctor@latest --no-telemetry` disables Sentry entirely (crash reporting, tracing, and usage counters) for that run, alongside the hosted score API.
106
- - `SENTRY_TRACES_SAMPLE_RATE=0` keeps crash reporting and usage counters but turns off performance tracing.
105
+ - `npx react-doctor@latest --no-telemetry` disables Sentry entirely (crash reporting and tracing) for that run, alongside the hosted score API.
106
+ - `SENTRY_TRACES_SAMPLE_RATE=0` keeps crash reporting but turns off performance tracing.
107
107
 
108
108
  ## Contributing
109
109
 
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]="bd9bed01-711f-553b-b228-212598cc6e87")}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]="d012dbb2-27e9-5092-9eab-c7fa4573f0b2")}catch(e){}}();
3
3
  import { createRequire } from "node:module";
4
4
  import { execFileSync, spawn, spawnSync } from "node:child_process";
5
5
  import * as Path from "node:path";
@@ -11760,33 +11760,6 @@ const STAGED_FILES_TEMP_DIR_PREFIX = "react-doctor-staged-";
11760
11760
  const INTERNAL_ERROR_JSON_FALLBACK = "{\"schemaVersion\":1,\"ok\":false,\"error\":{\"message\":\"Internal error\",\"name\":\"Error\",\"chain\":[]}}\n";
11761
11761
  const SENTRY_FLUSH_TIMEOUT_MS = 2e3;
11762
11762
  const NANOSECONDS_PER_SECOND = 1000000000n;
11763
- const METRIC = {
11764
- cliInvoked: "cli.invoked",
11765
- cliError: "cli.error",
11766
- projectDetected: "project.detected",
11767
- scanCompleted: "scan.completed",
11768
- scanDuration: "scan.duration",
11769
- scanPhaseDuration: "scan.phase_duration",
11770
- scanFiles: "scan.files",
11771
- scanScore: "scan.score",
11772
- scanClean: "scan.clean",
11773
- scanCheckSkipped: "scan.check_skipped",
11774
- ruleFired: "rule.fired",
11775
- lintFailed: "lint.failed",
11776
- deadCodeFailed: "deadcode.failed",
11777
- scoreUnavailable: "score.unavailable",
11778
- oxlintWorkers: "oxlint.workers",
11779
- agentHandoff: "agent.handoff",
11780
- agentInstallHintShown: "agent.install_hint_shown",
11781
- installCompleted: "install.completed",
11782
- installAgent: "install.agent",
11783
- installGitHook: "install.git_hook",
11784
- installWorkflow: "install.workflow",
11785
- installAgentHooks: "install.agent_hooks",
11786
- installDependency: "install.dependency",
11787
- rulesChanged: "rules.changed",
11788
- rulesQueried: "rules.queried"
11789
- };
11790
11763
  //#endregion
11791
11764
  //#region src/cli/utils/noop-console.ts
11792
11765
  /**
@@ -11828,7 +11801,7 @@ const makeNoopConsole = () => ({
11828
11801
  });
11829
11802
  //#endregion
11830
11803
  //#region src/cli/utils/version.ts
11831
- const VERSION = "0.2.15-dev.17e722e";
11804
+ const VERSION = "0.2.15-dev.3fae9dd";
11832
11805
  //#endregion
11833
11806
  //#region src/cli/utils/json-mode.ts
11834
11807
  let context = null;
@@ -12052,20 +12025,13 @@ const buildSentryScope = (runContext = buildRunContext()) => {
12052
12025
  };
12053
12026
  };
12054
12027
  //#endregion
12055
- //#region src/cli/utils/anonymize-text.ts
12056
- /**
12057
- * Free-text fields can carry both a home-directory path (the OS username) and a
12058
- * secret/email echoed from user code, so run both scrubbers: strip the username
12059
- * from paths, then mask any known credential/PII shape. Shared by the Sentry
12060
- * event scrubber ({@link scrubSentryEvent}) and metric scrubber
12061
- * ({@link scrubSentryMetric}).
12062
- */
12028
+ //#region src/cli/utils/scrub-sentry-event.ts
12063
12029
  const anonymizeText = (text) => redactSensitiveText(scrubSensitivePaths(text));
12064
12030
  /**
12065
12031
  * Recursively rewrites every string within an arbitrary value (object / array /
12066
12032
  * primitive) through {@link anonymizeText}, mutating in place. Used to sweep the
12067
- * unstructured corners of a Sentry payload (event contexts/extra/tags, breadcrumb
12068
- * data, span attributes, metric attributes) where a path or secret could hide.
12033
+ * unstructured corners of an event (contexts, extra, tags, breadcrumb data,
12034
+ * span attributes) where a path or secret could hide.
12069
12035
  */
12070
12036
  const anonymizeInPlace = (value) => {
12071
12037
  if (Array.isArray(value)) {
@@ -12083,8 +12049,6 @@ const anonymizeInPlace = (value) => {
12083
12049
  else anonymizeInPlace(inner);
12084
12050
  }
12085
12051
  };
12086
- //#endregion
12087
- //#region src/cli/utils/scrub-sentry-event.ts
12088
12052
  /**
12089
12053
  * Anonymizes a Sentry event (error or transaction) before it leaves the
12090
12054
  * machine. Strips identity the SDK attaches automatically — the IP-bearing
@@ -12132,27 +12096,6 @@ const scrubSentryEvent = (event) => {
12132
12096
  }
12133
12097
  };
12134
12098
  //#endregion
12135
- //#region src/cli/utils/scrub-sentry-metric.ts
12136
- /**
12137
- * Anonymizes a Sentry metric before it leaves the machine, mirroring
12138
- * {@link scrubSentryEvent}. Drops the `server.address` default attribute (the
12139
- * hostname) and scrubs home-directory paths + known secrets/emails from every
12140
- * remaining attribute value (metric names are our own constants, so they're
12141
- * left intact to avoid splitting a series). Returns `null` on any failure so an
12142
- * un-anonymized metric is never sent. Wired into `beforeSendMetric`.
12143
- */
12144
- const scrubSentryMetric = (metric) => {
12145
- try {
12146
- if (metric.attributes) {
12147
- delete metric.attributes["server.address"];
12148
- anonymizeInPlace(metric.attributes);
12149
- }
12150
- return metric;
12151
- } catch {
12152
- return null;
12153
- }
12154
- };
12155
- //#endregion
12156
12099
  //#region src/instrument.ts
12157
12100
  let isInitialized = false;
12158
12101
  let resolvedTracesSampleRate = 0;
@@ -12174,13 +12117,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
12174
12117
  * uploads source-map artifacts under, so stack frames symbolicate. Honors the
12175
12118
  * standard `SENTRY_RELEASE` override.
12176
12119
  */
12177
- const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.2.15-dev.17e722e`;
12120
+ const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.2.15-dev.3fae9dd`;
12178
12121
  /**
12179
12122
  * Deployment environment shown in Sentry's environment filter. Defaults to
12180
12123
  * `production` for tagged releases and `development` for dev/unbuilt versions,
12181
12124
  * overridable via the standard `SENTRY_ENVIRONMENT` env var.
12182
12125
  */
12183
- const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.2.15-dev.17e722e") ? "development" : "production");
12126
+ const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.2.15-dev.3fae9dd") ? "development" : "production");
12184
12127
  /**
12185
12128
  * Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
12186
12129
  * (set to `0` to disable tracing) and falls back to
@@ -12248,8 +12191,7 @@ const initializeSentry = () => {
12248
12191
  contexts
12249
12192
  },
12250
12193
  beforeSend: (event) => scrubSentryEvent(event),
12251
- beforeSendTransaction: (event) => scrubSentryEvent(event),
12252
- beforeSendMetric: (metric) => scrubSentryMetric(metric)
12194
+ beforeSendTransaction: (event) => scrubSentryEvent(event)
12253
12195
  });
12254
12196
  };
12255
12197
  //#endregion
@@ -15521,122 +15463,6 @@ const recordSentryProjectContext = (projectInfo, rootSpan) => {
15521
15463
  rootSpan?.setAttributes(toSpanAttributes(buildSentryProjectContext(projectInfo).tags));
15522
15464
  };
15523
15465
  //#endregion
15524
- //#region src/cli/utils/record-metric.ts
15525
- const cleanAttributes = (attributes) => {
15526
- const cleaned = {};
15527
- if (!attributes) return cleaned;
15528
- for (const [key, value] of Object.entries(attributes)) if (value !== null && value !== void 0) cleaned[key] = value;
15529
- return cleaned;
15530
- };
15531
- const withRunAttributes = (attributes) => ({
15532
- ...toSpanAttributes(buildSentryScope().tags),
15533
- ...cleanAttributes(attributes)
15534
- });
15535
- /**
15536
- * Emits a Sentry counter. A guarded, swallow-on-throw no-op unless the CLI's
15537
- * Sentry SDK is live, so it's inert under `--no-score`, tests, and the
15538
- * programmatic `@react-doctor/api` library (none of which initialize Sentry).
15539
- * Metrics flow independently of performance tracing, so counters are still
15540
- * recorded when `SENTRY_TRACES_SAMPLE_RATE=0`.
15541
- */
15542
- const recordCount = (name, value = 1, attributes) => {
15543
- if (!Sentry.isInitialized()) return;
15544
- try {
15545
- Sentry.metrics.count(name, value, { attributes: withRunAttributes(attributes) });
15546
- } catch {}
15547
- };
15548
- /**
15549
- * Emits a Sentry distribution (value ranges — durations, sizes, scores). Same
15550
- * gating and run-attribute handling as {@link recordCount}.
15551
- */
15552
- const recordDistribution = (name, value, options = {}) => {
15553
- if (!Sentry.isInitialized()) return;
15554
- try {
15555
- Sentry.metrics.distribution(name, value, {
15556
- unit: options.unit,
15557
- attributes: withRunAttributes(options.attributes)
15558
- });
15559
- } catch {}
15560
- };
15561
- //#endregion
15562
- //#region src/cli/utils/record-scan-metrics.ts
15563
- /**
15564
- * Aggregates diagnostics into per-`(rule, severity)` firing counts, reusing the
15565
- * canonical `getDiagnosticRuleIdentity` so the `<plugin>/<rule>` key and
15566
- * category match every other rule-keyed surface. Pure and exported so the
15567
- * bucketing is unit-testable without an active Sentry client (the emit helpers
15568
- * no-op under tests). Grouping the emitted `rule.fired` counter by `category`
15569
- * or `severity` in Sentry reproduces a coarser breakdown.
15570
- */
15571
- const summarizeRuleFirings = (diagnostics) => {
15572
- const firings = /* @__PURE__ */ new Map();
15573
- for (const diagnostic of diagnostics) {
15574
- const { ruleKey, category } = getDiagnosticRuleIdentity(diagnostic);
15575
- const firingKey = `${ruleKey}\u0000${diagnostic.severity}`;
15576
- const existing = firings.get(firingKey);
15577
- firings.set(firingKey, existing ? {
15578
- ...existing,
15579
- count: existing.count + 1
15580
- } : {
15581
- rule: ruleKey,
15582
- plugin: diagnostic.plugin,
15583
- category,
15584
- severity: diagnostic.severity,
15585
- count: 1
15586
- });
15587
- }
15588
- return [...firings.values()];
15589
- };
15590
- /**
15591
- * Emits the per-scan engineering + product counters/distributions for one
15592
- * `inspect()` run (fires once per project in a workspace scan). Every emission
15593
- * is a no-op unless Sentry is live, and the shared run/project attributes ride
15594
- * along from the global scope, so call sites only pass scan-specific dimensions.
15595
- */
15596
- const recordScanMetrics = (input) => {
15597
- const { result } = input;
15598
- const hasSkippedChecks = result.skippedChecks.length > 0;
15599
- recordCount(METRIC.scanCompleted, 1, {
15600
- mode: input.mode,
15601
- lint: input.lint,
15602
- deadCode: input.deadCode,
15603
- parallel: input.parallel,
15604
- scoreOnly: input.scoreOnly,
15605
- didLintFail: input.didLintFail,
15606
- didDeadCodeFail: input.didDeadCodeFail,
15607
- hasSkippedChecks
15608
- });
15609
- recordDistribution(METRIC.scanDuration, result.elapsedMilliseconds, {
15610
- unit: "millisecond",
15611
- attributes: {
15612
- mode: input.mode,
15613
- parallel: input.parallel,
15614
- scoreOnly: input.scoreOnly
15615
- }
15616
- });
15617
- if (result.scanElapsedMilliseconds !== void 0) recordDistribution(METRIC.scanPhaseDuration, result.scanElapsedMilliseconds, {
15618
- unit: "millisecond",
15619
- attributes: { mode: input.mode }
15620
- });
15621
- if (result.scannedFileCount !== void 0) recordDistribution(METRIC.scanFiles, result.scannedFileCount, { attributes: { mode: input.mode } });
15622
- if (input.workerCount !== void 0) recordDistribution(METRIC.oxlintWorkers, input.workerCount, { attributes: { mode: input.mode } });
15623
- for (const firing of summarizeRuleFirings(result.diagnostics)) recordCount(METRIC.ruleFired, firing.count, {
15624
- rule: firing.rule,
15625
- plugin: firing.plugin,
15626
- category: firing.category,
15627
- severity: firing.severity
15628
- });
15629
- if (result.diagnostics.length === 0 && !hasSkippedChecks) recordCount(METRIC.scanClean, 1, { mode: input.mode });
15630
- if (result.score) recordDistribution(METRIC.scanScore, result.score.score, { attributes: { mode: input.mode } });
15631
- else if (!input.noScore && !input.didLintFail) recordCount(METRIC.scoreUnavailable, 1, { mode: input.mode });
15632
- if (input.didLintFail) recordCount(METRIC.lintFailed, 1, { reasonKind: input.lintFailureReasonKind });
15633
- if (input.didDeadCodeFail) recordCount(METRIC.deadCodeFailed, 1);
15634
- for (const check of result.skippedChecks) recordCount(METRIC.scanCheckSkipped, 1, {
15635
- check,
15636
- reason: result.skippedCheckReasons?.[check] ?? null
15637
- });
15638
- };
15639
- //#endregion
15640
15466
  //#region src/cli/utils/build-no-score-message.ts
15641
15467
  const ENTERPRISE_CONTACT_HINT = `Want something custom to your company? Contact us at ${ENTERPRISE_CONTACT_URL}.`;
15642
15468
  const buildNoScoreMessage = (isScoreDisabled) => {
@@ -16544,7 +16370,6 @@ const runInspectWithRuntime = async (directory, options, userConfig, hasConfigOv
16544
16370
  suppressScanSummary: options.suppressRendering
16545
16371
  }, { beforeLint: (projectInfo, lintIncludePaths) => Effect.gen(function* () {
16546
16372
  recordSentryProjectContext(projectInfo, rootSentrySpan);
16547
- recordCount(METRIC.projectDetected, 1);
16548
16373
  if (options.scoreOnly || options.suppressRendering) return;
16549
16374
  const lintSourceFileCount = lintIncludePaths?.length ?? projectInfo.sourceFileCount;
16550
16375
  yield* printProjectDetection({
@@ -16580,21 +16405,7 @@ const runInspectWithRuntime = async (directory, options, userConfig, hasConfigOv
16580
16405
  scannedFilePaths: output.scannedFilePaths,
16581
16406
  scanElapsedMilliseconds: output.scanElapsedMilliseconds
16582
16407
  };
16583
- const result = await Effect.runPromise(finalizeAndRender(finalizeInput).pipe(options.silent ? Effect.provideService(Console.Console, silentConsole) : (program) => program));
16584
- recordScanMetrics({
16585
- result,
16586
- mode: isDiffMode ? "diff" : "full",
16587
- parallel: options.concurrency !== void 0,
16588
- workerCount: options.concurrency,
16589
- lint: options.lint,
16590
- deadCode: options.deadCode,
16591
- scoreOnly: options.scoreOnly,
16592
- noScore: options.noScore,
16593
- didLintFail,
16594
- lintFailureReasonKind: lintBindingMissing ? "native-binding-missing" : output.lintFailureReasonKind,
16595
- didDeadCodeFail: output.didDeadCodeFail
16596
- });
16597
- return result;
16408
+ return await Effect.runPromise(finalizeAndRender(finalizeInput).pipe(options.silent ? Effect.provideService(Console.Console, silentConsole) : (program) => program));
16598
16409
  };
16599
16410
  const finalizeAndRender = (input) => Effect.gen(function* () {
16600
16411
  const { options, elapsedMilliseconds, diagnostics, score, project, userConfig, didLintFail, lintFailureReason, lintPartialFailures, didDeadCodeFail, deadCodeFailureReason, directory, scannedFileCount, scannedFilePaths, scanElapsedMilliseconds } = input;
@@ -17786,17 +17597,11 @@ const installReactDoctorPackageSetup = async (projectRoot, dependencyRunner) =>
17786
17597
  projectRoot,
17787
17598
  runner: dependencyRunner
17788
17599
  });
17789
- recordCount(METRIC.installDependency, 1, {
17790
- status: dependencyResult.dependencyStatus,
17791
- reason: dependencyResult.dependencyReason ?? null,
17792
- packageManager: detectPackageManager(projectRoot)
17793
- });
17794
17600
  if (dependencyResult.dependencyStatus === "skipped") {
17795
17601
  dependencySpinner.fail(formatDependencyInstallMessage(dependencyResult));
17796
- return dependencyResult;
17602
+ return;
17797
17603
  }
17798
17604
  dependencySpinner.succeed(formatDependencyInstallMessage(dependencyResult));
17799
- return dependencyResult;
17800
17605
  } catch (error) {
17801
17606
  dependencySpinner.fail("Failed to install React Doctor package.");
17802
17607
  throw error;
@@ -17964,7 +17769,7 @@ const runInstallReactDoctor = async (options = {}) => {
17964
17769
  } catch {
17965
17770
  cliLogger.dim(" Skipped bundled sibling skills (install error).");
17966
17771
  }
17967
- const dependencyResult = await installReactDoctorPackageSetup(projectRoot, options.installDependencyRunner);
17772
+ await installReactDoctorPackageSetup(projectRoot, options.installDependencyRunner);
17968
17773
  if (shouldInstallGitHook && gitHookTarget !== null && gitHookTarget !== void 0) {
17969
17774
  const hookSpinner = spinner("Installing React Doctor pre-commit hook...").start();
17970
17775
  try {
@@ -17975,7 +17780,6 @@ const runInstallReactDoctor = async (options = {}) => {
17975
17780
  hooksPathConfig: gitHookTarget.hooksPathConfig
17976
17781
  });
17977
17782
  hookSpinner.succeed(formatGitHookInstallMessage(hookResult));
17978
- recordCount(METRIC.installGitHook, 1, { kind: hookResult.kind });
17979
17783
  } catch (error) {
17980
17784
  hookSpinner.fail("Failed to install React Doctor pre-commit hook.");
17981
17785
  throw error;
@@ -17989,10 +17793,7 @@ const runInstallReactDoctor = async (options = {}) => {
17989
17793
  agents: selectedAgents
17990
17794
  });
17991
17795
  if (hookResult.installedAgents.length === 0) hookSpinner.succeed("No supported native agent hook targets selected.");
17992
- else {
17993
- hookSpinner.succeed(`React Doctor agent hooks installed for ${hookResult.installedAgents.map((agent) => getSkillAgentConfig(agent).displayName).join(", ")}.`);
17994
- recordCount(METRIC.installAgentHooks, 1, { agentsCount: hookResult.installedAgents.length });
17995
- }
17796
+ else hookSpinner.succeed(`React Doctor agent hooks installed for ${hookResult.installedAgents.map((agent) => getSkillAgentConfig(agent).displayName).join(", ")}.`);
17996
17797
  } catch (error) {
17997
17798
  hookSpinner.fail("Failed to install React Doctor agent hooks.");
17998
17799
  throw error;
@@ -18004,21 +17805,11 @@ const runInstallReactDoctor = async (options = {}) => {
18004
17805
  try {
18005
17806
  writeFileSync(workflowTargetPath, buildWorkflowContent());
18006
17807
  workflowSpinner.succeed(`GitHub Actions workflow added at ${path.relative(projectRoot, workflowTargetPath)}.`);
18007
- recordCount(METRIC.installWorkflow, 1);
18008
17808
  } catch (error) {
18009
17809
  workflowSpinner.fail("Failed to add GitHub Actions workflow.");
18010
17810
  throw error;
18011
17811
  }
18012
17812
  }
18013
- recordCount(METRIC.installCompleted, 1, {
18014
- agentsCount: selectedAgents.length,
18015
- gitHook: shouldInstallGitHook,
18016
- agentHooks: shouldInstallAgentHooks,
18017
- workflow: shouldInstallWorkflow,
18018
- dependencyStatus: dependencyResult.dependencyStatus,
18019
- packageManager: detectPackageManager(projectRoot)
18020
- });
18021
- for (const agent of selectedAgents) recordCount(METRIC.installAgent, 1, { agent });
18022
17813
  };
18023
17814
  //#endregion
18024
17815
  //#region src/cli/utils/install-skill-for-agent.ts
@@ -18131,16 +17922,6 @@ const handoffToAgent = async (input) => {
18131
17922
  ],
18132
17923
  initial: 0
18133
17924
  }, { onCancel: () => true });
18134
- let handoffOutcome = "launch";
18135
- if (handoffTarget === void 0) handoffOutcome = "cancel";
18136
- else if (handoffTarget === SKIP_CHOICE) handoffOutcome = "skip";
18137
- else if (handoffTarget === PRINT_CHOICE) handoffOutcome = "print";
18138
- else if (handoffTarget === CLIPBOARD_CHOICE) handoffOutcome = "clipboard";
18139
- recordCount(METRIC.agentHandoff, 1, {
18140
- outcome: handoffOutcome,
18141
- agent: handoffOutcome === "launch" ? handoffTarget : void 0,
18142
- diagnosticsCount: input.diagnostics.length
18143
- });
18144
17925
  if (handoffTarget === void 0 || handoffTarget === SKIP_CHOICE) return;
18145
17926
  const payload = buildHandoffPayload({
18146
17927
  diagnostics: input.diagnostics,
@@ -18286,13 +18067,6 @@ const reportErrorToSentry = async (error) => {
18286
18067
  if (!Sentry.isInitialized()) return void 0;
18287
18068
  try {
18288
18069
  const { tags, contexts } = buildSentryScope();
18289
- let reason = "unknown";
18290
- if (isReactDoctorError(error)) reason = error.reason._tag;
18291
- else if (error instanceof Error) reason = error.name;
18292
- recordCount(METRIC.cliError, 1, {
18293
- command: typeof tags.command === "string" ? tags.command : void 0,
18294
- reason
18295
- });
18296
18070
  const runTrace = getActiveRunTrace();
18297
18071
  const eventId = Sentry.withScope((scope) => {
18298
18072
  for (const [name, context] of Object.entries(contexts)) scope.setContext(name, context);
@@ -18838,7 +18612,6 @@ const inspectAction = async (directory, flags) => {
18838
18612
  compact: Boolean(flags.jsonCompact),
18839
18613
  directory: requestedDirectory
18840
18614
  });
18841
- recordCount(METRIC.cliInvoked, 1, { command: "inspect" });
18842
18615
  try {
18843
18616
  validateModeFlags(flags);
18844
18617
  maybeMigrateLegacyConfig(requestedDirectory, {
@@ -19016,10 +18789,7 @@ const inspectAction = async (directory, flags) => {
19016
18789
  isJsonMode,
19017
18790
  isScoreOnly,
19018
18791
  isStaged: Boolean(flags.staged)
19019
- })) {
19020
- printAgentInstallHint();
19021
- recordCount(METRIC.agentInstallHintShown, 1);
19022
- }
18792
+ })) printAgentInstallHint();
19023
18793
  }
19024
18794
  } catch (error) {
19025
18795
  const sentryEventId = await reportErrorToSentry(error);
@@ -19034,7 +18804,6 @@ const inspectAction = async (directory, flags) => {
19034
18804
  //#endregion
19035
18805
  //#region src/cli/commands/install.ts
19036
18806
  const installAction = async (options, command) => {
19037
- recordCount(METRIC.cliInvoked, 1, { command: "install" });
19038
18807
  Effect.runSync(printBrandedHeader);
19039
18808
  try {
19040
18809
  const parentOptions = command?.parent?.opts?.();
@@ -19355,7 +19124,6 @@ const SEVERITY_VALUES = [
19355
19124
  "warn",
19356
19125
  "error"
19357
19126
  ];
19358
- const recordRulesInvocation = () => recordCount(METRIC.cliInvoked, 1, { command: "rules" });
19359
19127
  const resolveProjectRoot = (options) => {
19360
19128
  const requestedDirectory = path.resolve(options.cwd ?? process.cwd());
19361
19129
  return findNearestPackageDirectory(requestedDirectory) ?? requestedDirectory;
@@ -19398,11 +19166,6 @@ const reportManualEdit = (target, nextConfig) => {
19398
19166
  process.exitCode = 1;
19399
19167
  };
19400
19168
  const rulesListAction = async (options) => {
19401
- recordRulesInvocation();
19402
- recordCount(METRIC.rulesQueried, 1, {
19403
- subcommand: "list",
19404
- hadFilter: Boolean(options.category || options.tag || options.framework || options.configured)
19405
- });
19406
19169
  const catalog = buildRuleCatalog();
19407
19170
  const config = validateConfigTypes((await resolveRuleConfigTarget(resolveProjectRoot(options))).config);
19408
19171
  const categoryFilter = options.category?.toLowerCase();
@@ -19434,8 +19197,6 @@ const rulesListAction = async (options) => {
19434
19197
  cliLogger.log(renderRuleCatalog(rows));
19435
19198
  };
19436
19199
  const rulesExplainAction = async (ruleQuery, options) => {
19437
- recordRulesInvocation();
19438
- recordCount(METRIC.rulesQueried, 1, { subcommand: "explain" });
19439
19200
  const entry = findRuleInCatalog(buildRuleCatalog(), ruleQuery);
19440
19201
  if (!entry) {
19441
19202
  reportRuleNotFound(ruleQuery);
@@ -19463,7 +19224,7 @@ const rulesExplainAction = async (ruleQuery, options) => {
19463
19224
  effective
19464
19225
  }));
19465
19226
  };
19466
- const setRuleSeverityAndReport = async (entry, severity, options, action) => {
19227
+ const setRuleSeverityAndReport = async (entry, severity, options) => {
19467
19228
  const { target, nextConfig, written } = await applyConfigChange(options, (config) => setRuleSeverity(config, entry.key, severity));
19468
19229
  if (!written) {
19469
19230
  reportManualEdit(target, nextConfig);
@@ -19471,14 +19232,8 @@ const setRuleSeverityAndReport = async (entry, severity, options, action) => {
19471
19232
  }
19472
19233
  cliLogger.success(`Set ${entry.key} → ${severity}`);
19473
19234
  cliLogger.dim(` Updated ${describeTargetPath(target)}`);
19474
- recordCount(METRIC.rulesChanged, 1, {
19475
- action,
19476
- severity,
19477
- target: entry.key
19478
- });
19479
19235
  };
19480
19236
  const rulesSetAction = async (ruleQuery, severityValue, options) => {
19481
- recordRulesInvocation();
19482
19237
  const severity = parseSeverity(severityValue);
19483
19238
  if (!severity) {
19484
19239
  reportInvalidSeverity(severityValue);
@@ -19489,17 +19244,16 @@ const rulesSetAction = async (ruleQuery, severityValue, options) => {
19489
19244
  reportRuleNotFound(ruleQuery);
19490
19245
  return;
19491
19246
  }
19492
- await setRuleSeverityAndReport(entry, severity, options, "set");
19247
+ await setRuleSeverityAndReport(entry, severity, options);
19493
19248
  };
19494
19249
  const rulesEnableAction = async (ruleQuery, options) => {
19495
- recordRulesInvocation();
19496
19250
  const entry = findRuleInCatalog(buildRuleCatalog(), ruleQuery);
19497
19251
  if (!entry) {
19498
19252
  reportRuleNotFound(ruleQuery);
19499
19253
  return;
19500
19254
  }
19501
19255
  if (options.severity === void 0) {
19502
- await setRuleSeverityAndReport(entry, entry.defaultSeverity, options, "enable");
19256
+ await setRuleSeverityAndReport(entry, entry.defaultSeverity, options);
19503
19257
  return;
19504
19258
  }
19505
19259
  const severity = parseSeverity(options.severity);
@@ -19512,19 +19266,17 @@ const rulesEnableAction = async (ruleQuery, options) => {
19512
19266
  process.exitCode = 1;
19513
19267
  return;
19514
19268
  }
19515
- await setRuleSeverityAndReport(entry, severity, options, "enable");
19269
+ await setRuleSeverityAndReport(entry, severity, options);
19516
19270
  };
19517
19271
  const rulesDisableAction = async (ruleQuery, options) => {
19518
- recordRulesInvocation();
19519
19272
  const entry = findRuleInCatalog(buildRuleCatalog(), ruleQuery);
19520
19273
  if (!entry) {
19521
19274
  reportRuleNotFound(ruleQuery);
19522
19275
  return;
19523
19276
  }
19524
- await setRuleSeverityAndReport(entry, "off", options, "disable");
19277
+ await setRuleSeverityAndReport(entry, "off", options);
19525
19278
  };
19526
19279
  const rulesCategoryAction = async (categoryQuery, severityValue, options) => {
19527
- recordRulesInvocation();
19528
19280
  const severity = parseSeverity(severityValue);
19529
19281
  if (!severity) {
19530
19282
  reportInvalidSeverity(severityValue);
@@ -19545,14 +19297,8 @@ const rulesCategoryAction = async (categoryQuery, severityValue, options) => {
19545
19297
  }
19546
19298
  cliLogger.success(`Set category "${matchedCategory}" → ${severity}`);
19547
19299
  cliLogger.dim(` Updated ${describeTargetPath(target)}`);
19548
- recordCount(METRIC.rulesChanged, 1, {
19549
- action: "category",
19550
- severity,
19551
- target: matchedCategory
19552
- });
19553
19300
  };
19554
19301
  const rulesIgnoreTagAction = async (tag, options) => {
19555
- recordRulesInvocation();
19556
19302
  const knownTags = listRuleTags(buildRuleCatalog());
19557
19303
  if (!knownTags.includes(tag)) {
19558
19304
  cliLogger.error(`Unknown tag "${tag}".`);
@@ -19567,13 +19313,8 @@ const rulesIgnoreTagAction = async (tag, options) => {
19567
19313
  }
19568
19314
  cliLogger.success(`Ignoring tag "${tag}" (rules with this tag are skipped before linting)`);
19569
19315
  cliLogger.dim(` Updated ${describeTargetPath(target)}`);
19570
- recordCount(METRIC.rulesChanged, 1, {
19571
- action: "ignoreTag",
19572
- target: tag
19573
- });
19574
19316
  };
19575
19317
  const rulesUnignoreTagAction = async (tag, options) => {
19576
- recordRulesInvocation();
19577
19318
  const target = await resolveRuleConfigTarget(resolveProjectRoot(options));
19578
19319
  if (!(target.config.ignore?.tags ?? []).includes(tag)) {
19579
19320
  cliLogger.dim(`Tag "${tag}" was not being ignored; nothing to change.`);
@@ -19587,10 +19328,6 @@ const rulesUnignoreTagAction = async (tag, options) => {
19587
19328
  }
19588
19329
  cliLogger.success(`Tag "${tag}" is no longer ignored`);
19589
19330
  cliLogger.dim(` Updated ${describeTargetPath(target)}`);
19590
- recordCount(METRIC.rulesChanged, 1, {
19591
- action: "unignoreTag",
19592
- target: tag
19593
- });
19594
19331
  };
19595
19332
  //#endregion
19596
19333
  //#region src/cli/commands/version.ts
@@ -19603,7 +19340,6 @@ const rulesUnignoreTagAction = async (tag, options) => {
19603
19340
  */
19604
19341
  const buildVersionString = () => `react-doctor/${VERSION} ${process.platform}-${process.arch} node-${process.version}`;
19605
19342
  const versionAction = () => {
19606
- recordCount(METRIC.cliInvoked, 1, { command: "version" });
19607
19343
  process.stdout.write(`${buildVersionString()}\n`);
19608
19344
  };
19609
19345
  //#endregion
@@ -19921,4 +19657,4 @@ program.parseAsync(argv).then(() => flushSentry()).catch(async (error) => {
19921
19657
  export {};
19922
19658
 
19923
19659
  //# sourceMappingURL=cli.js.map
19924
- //# debugId=bd9bed01-711f-553b-b228-212598cc6e87
19660
+ //# debugId=d012dbb2-27e9-5092-9eab-c7fa4573f0b2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-doctor",
3
- "version": "0.2.15-dev.17e722e",
3
+ "version": "0.2.15-dev.3fae9dd",
4
4
  "description": "Diagnose and fix React codebases for security, performance, correctness, accessibility, bundle-size, and architecture issues",
5
5
  "keywords": [
6
6
  "accessibility",
@@ -63,7 +63,7 @@
63
63
  "oxlint": "^1.66.0",
64
64
  "prompts": "^2.4.2",
65
65
  "typescript": ">=5.0.4 <7",
66
- "oxlint-plugin-react-doctor": "0.2.15-dev.17e722e"
66
+ "oxlint-plugin-react-doctor": "0.2.15-dev.3fae9dd"
67
67
  },
68
68
  "devDependencies": {
69
69
  "@types/babel__code-frame": "^7.27.0",