react-doctor 0.2.18-dev.d594f69 → 0.2.18-dev.e3b106e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +213 -15
- package/dist/index.js +4 -2
- package/package.json +3 -3
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]="
|
|
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]="9cef6163-49df-51ef-9157-780c4c678e81")}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";
|
|
@@ -36,13 +36,13 @@ import * as ts from "typescript";
|
|
|
36
36
|
import { gzipSync } from "node:zlib";
|
|
37
37
|
import * as Sentry from "@sentry/node";
|
|
38
38
|
import { performance } from "node:perf_hooks";
|
|
39
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
39
40
|
import * as Tracer from "effect/Tracer";
|
|
40
41
|
import * as Exit from "effect/Exit";
|
|
41
42
|
import { stripVTControlCharacters } from "node:util";
|
|
42
43
|
import tty from "node:tty";
|
|
43
44
|
import { codeFrameColumns } from "@babel/code-frame";
|
|
44
45
|
import Conf from "conf";
|
|
45
|
-
import { createHash, randomUUID } from "node:crypto";
|
|
46
46
|
import basePrompts from "prompts";
|
|
47
47
|
import { SKILL_MANIFEST_FILE, detectInstalledSkillAgents, getSkillAgentConfig, getSkillAgentTypes, installSkillsFromSource } from "agent-install";
|
|
48
48
|
import { fileURLToPath } from "node:url";
|
|
@@ -11099,6 +11099,7 @@ const calculateScore = async (diagnostics, options = {}) => {
|
|
|
11099
11099
|
...typeof options.metadata?.sourceFileCount === "number" ? { sourceFileCount: options.metadata.sourceFileCount } : {},
|
|
11100
11100
|
...options.metadata?.defaultBranch ? { defaultBranch: options.metadata.defaultBranch } : {},
|
|
11101
11101
|
...options.metadata?.doctorVersion ? { doctorVersion: options.metadata.doctorVersion } : {},
|
|
11102
|
+
...options.metadata?.runId ? { runId: options.metadata.runId } : {},
|
|
11102
11103
|
...options.metadata?.githubEventName ? { githubEventName: options.metadata.githubEventName } : {},
|
|
11103
11104
|
...options.metadata?.githubActorAssociation ? { githubActorAssociation: options.metadata.githubActorAssociation } : {},
|
|
11104
11105
|
...options.metadata?.githubViewerPermission ? { githubViewerPermission: options.metadata.githubViewerPermission } : {}
|
|
@@ -11338,6 +11339,7 @@ const runInspect = (input, hooks = {}) => Effect.gen(function* () {
|
|
|
11338
11339
|
sourceFileCount: project.sourceFileCount,
|
|
11339
11340
|
...defaultBranch !== null ? { defaultBranch } : {},
|
|
11340
11341
|
...input.doctorVersion !== void 0 ? { doctorVersion: input.doctorVersion } : {},
|
|
11342
|
+
...input.runId !== void 0 ? { runId: input.runId } : {},
|
|
11341
11343
|
...githubActionsScoreMetadata,
|
|
11342
11344
|
...githubViewerPermission !== null ? { githubViewerPermission } : {}
|
|
11343
11345
|
};
|
|
@@ -11794,6 +11796,14 @@ const CI_PROVIDER_BY_ENVIRONMENT_VARIABLE = [
|
|
|
11794
11796
|
["TRAVIS", "travis"],
|
|
11795
11797
|
["DRONE", "drone"]
|
|
11796
11798
|
];
|
|
11799
|
+
const GITHUB_ACTION_MARKER_ENVIRONMENT_VARIABLE = "REACT_DOCTOR_GITHUB_ACTION";
|
|
11800
|
+
const ACTION_INPUT_ENVIRONMENT_VARIABLES = {
|
|
11801
|
+
failOn: "REACT_DOCTOR_ACTION_FAIL_ON",
|
|
11802
|
+
nonBlocking: "REACT_DOCTOR_ACTION_NON_BLOCKING",
|
|
11803
|
+
comment: "REACT_DOCTOR_ACTION_COMMENT",
|
|
11804
|
+
annotations: "REACT_DOCTOR_ACTION_ANNOTATIONS",
|
|
11805
|
+
version: "REACT_DOCTOR_ACTION_VERSION"
|
|
11806
|
+
};
|
|
11797
11807
|
const CODING_AGENT_BY_ENVIRONMENT_VARIABLE = [
|
|
11798
11808
|
["CLAUDECODE", "claude-code"],
|
|
11799
11809
|
["CLAUDE_CODE", "claude-code"],
|
|
@@ -11820,6 +11830,9 @@ const detectCiProvider = () => {
|
|
|
11820
11830
|
for (const [environmentVariable, provider] of CI_PROVIDER_BY_ENVIRONMENT_VARIABLE) if (process.env[environmentVariable]) return provider;
|
|
11821
11831
|
return isCiFlagSet(process.env.CI) ? "unknown" : null;
|
|
11822
11832
|
};
|
|
11833
|
+
const isOfficialGithubAction = () => Boolean(process.env[GITHUB_ACTION_MARKER_ENVIRONMENT_VARIABLE]);
|
|
11834
|
+
const detectCiEventName = () => process.env.GITHUB_EVENT_NAME?.trim() || null;
|
|
11835
|
+
const detectRunnerOs = () => process.env.RUNNER_OS?.trim() || null;
|
|
11823
11836
|
const detectCodingAgentFromValue = () => {
|
|
11824
11837
|
for (const environmentVariable of CODING_AGENT_ENVIRONMENT_VALUE_VARIABLES) {
|
|
11825
11838
|
const value = process.env[environmentVariable]?.toLowerCase();
|
|
@@ -11934,7 +11947,7 @@ const makeNoopConsole = () => ({
|
|
|
11934
11947
|
});
|
|
11935
11948
|
//#endregion
|
|
11936
11949
|
//#region src/cli/utils/version.ts
|
|
11937
|
-
const VERSION = "0.2.18-dev.
|
|
11950
|
+
const VERSION = "0.2.18-dev.e3b106e";
|
|
11938
11951
|
//#endregion
|
|
11939
11952
|
//#region src/cli/utils/json-mode.ts
|
|
11940
11953
|
let context = null;
|
|
@@ -12007,6 +12020,13 @@ const writeJsonErrorReport = (error) => {
|
|
|
12007
12020
|
}
|
|
12008
12021
|
};
|
|
12009
12022
|
//#endregion
|
|
12023
|
+
//#region src/cli/utils/run-id.ts
|
|
12024
|
+
let cachedRunId;
|
|
12025
|
+
const getRunId = () => {
|
|
12026
|
+
cachedRunId ??= randomUUID();
|
|
12027
|
+
return cachedRunId;
|
|
12028
|
+
};
|
|
12029
|
+
//#endregion
|
|
12010
12030
|
//#region src/cli/utils/scrub-sensitive-text.ts
|
|
12011
12031
|
const HOME_DIRECTORY = os.homedir();
|
|
12012
12032
|
const USER_HOME_PATTERNS = [/[A-Za-z]:[\\/]Users[\\/][^\\/]+/gi, /(?:\/Users\/|\/home\/)[^/\\]+/gi];
|
|
@@ -12061,6 +12081,7 @@ const buildRunContext = () => {
|
|
|
12061
12081
|
const userArguments = process.argv.slice(2);
|
|
12062
12082
|
return {
|
|
12063
12083
|
version: VERSION,
|
|
12084
|
+
runId: getRunId(),
|
|
12064
12085
|
origin: detectOrigin(),
|
|
12065
12086
|
command: detectCommand(userArguments),
|
|
12066
12087
|
argv: scrubSensitivePaths(userArguments.join(" ")),
|
|
@@ -12071,6 +12092,8 @@ const buildRunContext = () => {
|
|
|
12071
12092
|
arch: process.arch,
|
|
12072
12093
|
ci: isCiEnvironment(),
|
|
12073
12094
|
ciProvider: detectCiProvider(),
|
|
12095
|
+
eventName: detectCiEventName(),
|
|
12096
|
+
viaAction: isOfficialGithubAction(),
|
|
12074
12097
|
codingAgent: detectCodingAgent(),
|
|
12075
12098
|
interactive: !isNonInteractiveEnvironment(),
|
|
12076
12099
|
jsonMode: isJsonModeActive(),
|
|
@@ -12139,6 +12162,8 @@ const buildSentryScope = (runContext = buildRunContext()) => {
|
|
|
12139
12162
|
command: runContext.command,
|
|
12140
12163
|
ci: runContext.ci,
|
|
12141
12164
|
ciProvider: runContext.ciProvider,
|
|
12165
|
+
eventName: runContext.eventName,
|
|
12166
|
+
viaAction: runContext.viaAction,
|
|
12142
12167
|
codingAgent: runContext.codingAgent,
|
|
12143
12168
|
interactive: runContext.interactive,
|
|
12144
12169
|
jsonMode: runContext.jsonMode,
|
|
@@ -12280,13 +12305,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
|
|
|
12280
12305
|
* uploads source-map artifacts under, so stack frames symbolicate. Honors the
|
|
12281
12306
|
* standard `SENTRY_RELEASE` override.
|
|
12282
12307
|
*/
|
|
12283
|
-
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.2.18-dev.
|
|
12308
|
+
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.2.18-dev.e3b106e`;
|
|
12284
12309
|
/**
|
|
12285
12310
|
* Deployment environment shown in Sentry's environment filter. Defaults to
|
|
12286
12311
|
* `production` for tagged releases and `development` for dev/unbuilt versions,
|
|
12287
12312
|
* overridable via the standard `SENTRY_ENVIRONMENT` env var.
|
|
12288
12313
|
*/
|
|
12289
|
-
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.2.18-dev.
|
|
12314
|
+
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.2.18-dev.e3b106e") ? "development" : "production");
|
|
12290
12315
|
/**
|
|
12291
12316
|
* Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
|
|
12292
12317
|
* (set to `0` to disable tracing) and falls back to
|
|
@@ -15743,6 +15768,152 @@ const recordScanMetrics = (input) => {
|
|
|
15743
15768
|
});
|
|
15744
15769
|
};
|
|
15745
15770
|
//#endregion
|
|
15771
|
+
//#region src/cli/utils/should-fail-for-diagnostics.ts
|
|
15772
|
+
const shouldFailForDiagnostics = (diagnostics, failOnLevel) => {
|
|
15773
|
+
if (failOnLevel === "none") return false;
|
|
15774
|
+
if (failOnLevel === "warning") return diagnostics.length > 0;
|
|
15775
|
+
return diagnostics.some((diagnostic) => diagnostic.severity === "error");
|
|
15776
|
+
};
|
|
15777
|
+
//#endregion
|
|
15778
|
+
//#region src/cli/utils/build-run-event.ts
|
|
15779
|
+
const FAIL_ON_LEVELS = new Set([
|
|
15780
|
+
"error",
|
|
15781
|
+
"warning",
|
|
15782
|
+
"none"
|
|
15783
|
+
]);
|
|
15784
|
+
const readEnvBoolean = (name) => {
|
|
15785
|
+
const value = process.env[name];
|
|
15786
|
+
if (value === void 0) return null;
|
|
15787
|
+
return value.toLowerCase() === "true" || value === "1";
|
|
15788
|
+
};
|
|
15789
|
+
const resolveVersionPin = (versionInput) => {
|
|
15790
|
+
if (versionInput === void 0 || versionInput.trim() === "") return null;
|
|
15791
|
+
if (versionInput === "latest") return "latest";
|
|
15792
|
+
if (/^(\.\.?\/|\/)/.test(versionInput)) return "local";
|
|
15793
|
+
return "pinned";
|
|
15794
|
+
};
|
|
15795
|
+
const resolveTelemetryFailOn = (userConfig) => {
|
|
15796
|
+
const fromAction = process.env[ACTION_INPUT_ENVIRONMENT_VARIABLES.failOn];
|
|
15797
|
+
if (fromAction !== void 0 && FAIL_ON_LEVELS.has(fromAction)) return fromAction;
|
|
15798
|
+
return userConfig?.failOn ?? "none";
|
|
15799
|
+
};
|
|
15800
|
+
const toCategoryKey = (category) => category.toLowerCase().replace(/[^a-z0-9]+/g, "_");
|
|
15801
|
+
const buildOutcomeAttributes = (input) => {
|
|
15802
|
+
if (input.result === void 0) {
|
|
15803
|
+
const error = input.error;
|
|
15804
|
+
const known = isReactDoctorError(error);
|
|
15805
|
+
return {
|
|
15806
|
+
outcome: "error",
|
|
15807
|
+
exitCode: 1,
|
|
15808
|
+
knownError: known,
|
|
15809
|
+
errorTag: known ? error.reason._tag : error instanceof Error ? error.name : null
|
|
15810
|
+
};
|
|
15811
|
+
}
|
|
15812
|
+
const result = input.result;
|
|
15813
|
+
const summary = summarizeDiagnostics(result.diagnostics);
|
|
15814
|
+
const failOnLevel = resolveTelemetryFailOn(input.userConfig);
|
|
15815
|
+
const gateDiagnostics = filterDiagnosticsForSurface(result.diagnostics, "ciFailure", input.userConfig);
|
|
15816
|
+
const wouldBlock = !input.scoreOnly && shouldFailForDiagnostics(gateDiagnostics, failOnLevel);
|
|
15817
|
+
const hasSkippedChecks = result.skippedChecks.length > 0;
|
|
15818
|
+
const isClean = result.diagnostics.length === 0 && !hasSkippedChecks;
|
|
15819
|
+
const outcome = wouldBlock ? "blocked" : isClean ? "clean" : "ok";
|
|
15820
|
+
const firings = summarizeRuleFirings(result.diagnostics);
|
|
15821
|
+
const countByRule = /* @__PURE__ */ new Map();
|
|
15822
|
+
const countByCategory = /* @__PURE__ */ new Map();
|
|
15823
|
+
for (const firing of firings) {
|
|
15824
|
+
countByRule.set(firing.rule, (countByRule.get(firing.rule) ?? 0) + firing.count);
|
|
15825
|
+
countByCategory.set(firing.category, (countByCategory.get(firing.category) ?? 0) + firing.count);
|
|
15826
|
+
}
|
|
15827
|
+
let topRule = null;
|
|
15828
|
+
let topRuleCount = 0;
|
|
15829
|
+
for (const [rule, count] of countByRule) if (count > topRuleCount) {
|
|
15830
|
+
topRule = rule;
|
|
15831
|
+
topRuleCount = count;
|
|
15832
|
+
}
|
|
15833
|
+
const attributes = {
|
|
15834
|
+
outcome,
|
|
15835
|
+
exitCode: wouldBlock ? 1 : 0,
|
|
15836
|
+
wouldBlock,
|
|
15837
|
+
failOn: failOnLevel,
|
|
15838
|
+
scanClean: isClean,
|
|
15839
|
+
totalDiagnostics: summary.totalDiagnosticCount,
|
|
15840
|
+
errorCount: summary.errorCount,
|
|
15841
|
+
warningCount: summary.warningCount,
|
|
15842
|
+
affectedFiles: summary.affectedFileCount,
|
|
15843
|
+
distinctRulesFired: countByRule.size,
|
|
15844
|
+
topRule,
|
|
15845
|
+
scannedFileCount: result.scannedFileCount ?? null,
|
|
15846
|
+
elapsedMs: result.elapsedMilliseconds,
|
|
15847
|
+
scanPhaseMs: result.scanElapsedMilliseconds ?? null,
|
|
15848
|
+
score: result.score ? result.score.score : null,
|
|
15849
|
+
scoreLabel: result.score ? result.score.label : null,
|
|
15850
|
+
scoreAvailable: result.score !== null,
|
|
15851
|
+
skippedCheckCount: result.skippedChecks.length,
|
|
15852
|
+
didLintFail: input.didLintFail ?? null,
|
|
15853
|
+
lintFailureReasonKind: input.lintFailureReasonKind ?? null,
|
|
15854
|
+
lintPartialFailureCount: input.lintPartialFailureCount ?? null,
|
|
15855
|
+
didDeadCodeFail: input.didDeadCodeFail ?? null
|
|
15856
|
+
};
|
|
15857
|
+
for (const [category, count] of countByCategory) attributes[`diag.category.${toCategoryKey(category)}`] = count;
|
|
15858
|
+
return attributes;
|
|
15859
|
+
};
|
|
15860
|
+
const buildCiAttributes = () => {
|
|
15861
|
+
const { githubActorAssociation } = resolveGithubActionsScoreMetadata();
|
|
15862
|
+
return {
|
|
15863
|
+
actorAssociation: githubActorAssociation ?? null,
|
|
15864
|
+
runnerOs: detectRunnerOs(),
|
|
15865
|
+
nonBlocking: readEnvBoolean(ACTION_INPUT_ENVIRONMENT_VARIABLES.nonBlocking),
|
|
15866
|
+
comment: readEnvBoolean(ACTION_INPUT_ENVIRONMENT_VARIABLES.comment),
|
|
15867
|
+
annotations: readEnvBoolean(ACTION_INPUT_ENVIRONMENT_VARIABLES.annotations),
|
|
15868
|
+
versionPin: resolveVersionPin(process.env[ACTION_INPUT_ENVIRONMENT_VARIABLES.version])
|
|
15869
|
+
};
|
|
15870
|
+
};
|
|
15871
|
+
const buildConfigAttributes = (input) => {
|
|
15872
|
+
const ruleOverrides = input.userConfig?.rules ?? {};
|
|
15873
|
+
const ruleKeys = Object.keys(ruleOverrides);
|
|
15874
|
+
return {
|
|
15875
|
+
mode: input.mode,
|
|
15876
|
+
parallel: input.parallel,
|
|
15877
|
+
workerCount: input.workerCount ?? null,
|
|
15878
|
+
lint: input.lint,
|
|
15879
|
+
deadCode: input.deadCode,
|
|
15880
|
+
scoreOnly: input.scoreOnly,
|
|
15881
|
+
noScore: input.noScore,
|
|
15882
|
+
respectInlineDisables: input.respectInlineDisables,
|
|
15883
|
+
showWarnings: input.showWarnings,
|
|
15884
|
+
ignoredTagCount: input.ignoredTagCount,
|
|
15885
|
+
hasCustomConfig: input.hasCustomConfig,
|
|
15886
|
+
rulesConfigured: ruleKeys.length,
|
|
15887
|
+
rulesDisabled: ruleKeys.filter((key) => ruleOverrides[key] === "off").length
|
|
15888
|
+
};
|
|
15889
|
+
};
|
|
15890
|
+
/**
|
|
15891
|
+
* Projects a scan into the flat attribute set for its root span — the canonical
|
|
15892
|
+
* per-scan "wide event". Pure and exported so the projection (outcome
|
|
15893
|
+
* precedence, rule/category rollups, CI knobs, config shape) is unit-testable
|
|
15894
|
+
* without a live Sentry client. `null` values are dropped so absent signals
|
|
15895
|
+
* never become misleading `"null"` attributes. The run + project base context
|
|
15896
|
+
* (version, command, ci/provider, framework, …) is already on the span from
|
|
15897
|
+
* `withSentryRunSpan` / `recordSentryProjectContext`, so this adds only what
|
|
15898
|
+
* those don't carry.
|
|
15899
|
+
*/
|
|
15900
|
+
const buildRunEventAttributes = (input) => toSpanAttributes({
|
|
15901
|
+
...buildConfigAttributes(input),
|
|
15902
|
+
...buildCiAttributes(),
|
|
15903
|
+
...buildOutcomeAttributes(input)
|
|
15904
|
+
});
|
|
15905
|
+
/**
|
|
15906
|
+
* Stamps the wide-event attributes onto the run's root span. A guarded no-op
|
|
15907
|
+
* when tracing is off (no `rootSpan`) and swallow-on-throw, so telemetry can
|
|
15908
|
+
* never break the run.
|
|
15909
|
+
*/
|
|
15910
|
+
const recordRunEvent = (rootSpan, input) => {
|
|
15911
|
+
if (!rootSpan) return;
|
|
15912
|
+
try {
|
|
15913
|
+
rootSpan.setAttributes(buildRunEventAttributes(input));
|
|
15914
|
+
} catch {}
|
|
15915
|
+
};
|
|
15916
|
+
//#endregion
|
|
15746
15917
|
//#region src/cli/utils/build-no-score-message.ts
|
|
15747
15918
|
const ENTERPRISE_CONTACT_HINT = `Want something custom to your company? Contact us at ${ENTERPRISE_CONTACT_URL}.`;
|
|
15748
15919
|
const buildNoScoreMessage = (isScoreDisabled) => {
|
|
@@ -16047,7 +16218,7 @@ const buildRuleDetailBlock = (ruleKey, ruleDiagnostics, resolveSourceRoot, rende
|
|
|
16047
16218
|
const fixRecipeLine = formatFixRecipeLine(representative);
|
|
16048
16219
|
if (fixRecipeLine) lines.push(highlighter.gray(`${TOP_ERROR_DETAIL_INDENT}${fixRecipeLine}`));
|
|
16049
16220
|
}
|
|
16050
|
-
const renderCodeFrame = severity === "error"
|
|
16221
|
+
const renderCodeFrame = severity === "error";
|
|
16051
16222
|
const sites = renderEverySite ? ruleDiagnostics : [representative];
|
|
16052
16223
|
for (const cluster of clusterNearbyDiagnostics(sites)) lines.push(...buildDiagnosticClusterLines(cluster, resolveSourceRoot, renderCodeFrame));
|
|
16053
16224
|
return lines;
|
|
@@ -16673,6 +16844,19 @@ const mergeInspectOptions = (inputOptions, userConfig) => ({
|
|
|
16673
16844
|
suppressRendering: inputOptions.suppressRendering ?? false,
|
|
16674
16845
|
concurrency: inputOptions.concurrency
|
|
16675
16846
|
});
|
|
16847
|
+
const buildRunEventConfig = (options, userConfig, hasCustomConfig) => ({
|
|
16848
|
+
parallel: options.concurrency !== void 0,
|
|
16849
|
+
workerCount: options.concurrency,
|
|
16850
|
+
lint: options.lint,
|
|
16851
|
+
deadCode: options.deadCode,
|
|
16852
|
+
scoreOnly: options.scoreOnly,
|
|
16853
|
+
noScore: options.noScore,
|
|
16854
|
+
respectInlineDisables: options.respectInlineDisables,
|
|
16855
|
+
showWarnings: options.warnings,
|
|
16856
|
+
ignoredTagCount: options.ignoredTags.size,
|
|
16857
|
+
hasCustomConfig,
|
|
16858
|
+
userConfig
|
|
16859
|
+
});
|
|
16676
16860
|
const inspect = async (directory, inputOptions = {}) => {
|
|
16677
16861
|
const startTime = performance.now();
|
|
16678
16862
|
resetSentryRunState();
|
|
@@ -16694,7 +16878,18 @@ const inspect = async (directory, inputOptions = {}) => {
|
|
|
16694
16878
|
const wasSpinnerSilent = isSpinnerSilent();
|
|
16695
16879
|
if (options.silent) setSpinnerSilent(true);
|
|
16696
16880
|
try {
|
|
16697
|
-
const result = await withSentryRunSpan((rootSentrySpan) =>
|
|
16881
|
+
const result = await withSentryRunSpan(async (rootSentrySpan) => {
|
|
16882
|
+
try {
|
|
16883
|
+
return await runInspectWithRuntime(scanDirectory, options, userConfig, hasConfigOverride, configSourceDirectory, startTime, rootSentrySpan);
|
|
16884
|
+
} catch (error) {
|
|
16885
|
+
recordRunEvent(rootSentrySpan, {
|
|
16886
|
+
...buildRunEventConfig(options, userConfig, userConfig !== null),
|
|
16887
|
+
mode: options.includePaths.length > 0 ? "diff" : "full",
|
|
16888
|
+
error
|
|
16889
|
+
});
|
|
16890
|
+
throw error;
|
|
16891
|
+
}
|
|
16892
|
+
});
|
|
16698
16893
|
resetSentryRunState();
|
|
16699
16894
|
return result;
|
|
16700
16895
|
} finally {
|
|
@@ -16729,6 +16924,7 @@ const runInspectWithRuntime = async (directory, options, userConfig, hasConfigOv
|
|
|
16729
16924
|
runDeadCode: options.deadCode,
|
|
16730
16925
|
isCi: options.isCi,
|
|
16731
16926
|
doctorVersion: VERSION,
|
|
16927
|
+
runId: getRunId(),
|
|
16732
16928
|
resolveLocalGithubViewerPermission: !options.noScore,
|
|
16733
16929
|
suppressScanSummary: options.suppressRendering
|
|
16734
16930
|
}, { beforeLint: (projectInfo, lintIncludePaths) => Effect.gen(function* () {
|
|
@@ -16792,6 +16988,15 @@ const runInspectWithRuntime = async (directory, options, userConfig, hasConfigOv
|
|
|
16792
16988
|
lintFailureReasonKind: lintBindingMissing ? "native-binding-missing" : output.lintFailureReasonKind,
|
|
16793
16989
|
didDeadCodeFail: output.didDeadCodeFail
|
|
16794
16990
|
});
|
|
16991
|
+
recordRunEvent(rootSentrySpan, {
|
|
16992
|
+
...buildRunEventConfig(options, userConfig, userConfig !== null),
|
|
16993
|
+
result,
|
|
16994
|
+
mode: isDiffMode ? "diff" : "full",
|
|
16995
|
+
didLintFail,
|
|
16996
|
+
lintFailureReasonKind: lintBindingMissing ? "native-binding-missing" : output.lintFailureReasonKind,
|
|
16997
|
+
lintPartialFailureCount: output.lintPartialFailures.length,
|
|
16998
|
+
didDeadCodeFail: output.didDeadCodeFail
|
|
16999
|
+
});
|
|
16795
17000
|
return result;
|
|
16796
17001
|
};
|
|
16797
17002
|
const finalizeAndRender = (input) => Effect.gen(function* () {
|
|
@@ -19043,13 +19248,6 @@ const runExplain = async (fileLineArgument, context) => {
|
|
|
19043
19248
|
}
|
|
19044
19249
|
};
|
|
19045
19250
|
//#endregion
|
|
19046
|
-
//#region src/cli/utils/should-fail-for-diagnostics.ts
|
|
19047
|
-
const shouldFailForDiagnostics = (diagnostics, failOnLevel) => {
|
|
19048
|
-
if (failOnLevel === "none") return false;
|
|
19049
|
-
if (failOnLevel === "warning") return diagnostics.length > 0;
|
|
19050
|
-
return diagnostics.some((diagnostic) => diagnostic.severity === "error");
|
|
19051
|
-
};
|
|
19052
|
-
//#endregion
|
|
19053
19251
|
//#region src/cli/utils/validate-mode-flags.ts
|
|
19054
19252
|
const validateModeFlags = (flags) => {
|
|
19055
19253
|
const coercedDiff = coerceDiffValue(flags.diff);
|
|
@@ -20244,4 +20442,4 @@ program.parseAsync(argv).then(() => flushSentry()).catch(async (error) => {
|
|
|
20244
20442
|
export {};
|
|
20245
20443
|
|
|
20246
20444
|
//# sourceMappingURL=cli.js.map
|
|
20247
|
-
//# debugId=
|
|
20445
|
+
//# debugId=9cef6163-49df-51ef-9157-780c4c678e81
|
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]="
|
|
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]="57d81746-a846-5f9f-a2db-54b118de6334")}catch(e){}}();
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import * as Schema from "effect/Schema";
|
|
5
5
|
import * as fs$1 from "node:fs";
|
|
@@ -8032,6 +8032,7 @@ const calculateScore = async (diagnostics, options = {}) => {
|
|
|
8032
8032
|
...typeof options.metadata?.sourceFileCount === "number" ? { sourceFileCount: options.metadata.sourceFileCount } : {},
|
|
8033
8033
|
...options.metadata?.defaultBranch ? { defaultBranch: options.metadata.defaultBranch } : {},
|
|
8034
8034
|
...options.metadata?.doctorVersion ? { doctorVersion: options.metadata.doctorVersion } : {},
|
|
8035
|
+
...options.metadata?.runId ? { runId: options.metadata.runId } : {},
|
|
8035
8036
|
...options.metadata?.githubEventName ? { githubEventName: options.metadata.githubEventName } : {},
|
|
8036
8037
|
...options.metadata?.githubActorAssociation ? { githubActorAssociation: options.metadata.githubActorAssociation } : {},
|
|
8037
8038
|
...options.metadata?.githubViewerPermission ? { githubViewerPermission: options.metadata.githubViewerPermission } : {}
|
|
@@ -8271,6 +8272,7 @@ const runInspect = (input, hooks = {}) => Effect.gen(function* () {
|
|
|
8271
8272
|
sourceFileCount: project.sourceFileCount,
|
|
8272
8273
|
...defaultBranch !== null ? { defaultBranch } : {},
|
|
8273
8274
|
...input.doctorVersion !== void 0 ? { doctorVersion: input.doctorVersion } : {},
|
|
8275
|
+
...input.runId !== void 0 ? { runId: input.runId } : {},
|
|
8274
8276
|
...githubActionsScoreMetadata,
|
|
8275
8277
|
...githubViewerPermission !== null ? { githubViewerPermission } : {}
|
|
8276
8278
|
};
|
|
@@ -8727,4 +8729,4 @@ const toJsonReport = (result, options) => buildJsonReport({
|
|
|
8727
8729
|
export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, diagnose, filterSourceFiles, getDiffInfo, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
|
|
8728
8730
|
|
|
8729
8731
|
//# sourceMappingURL=index.js.map
|
|
8730
|
-
//# debugId=
|
|
8732
|
+
//# debugId=57d81746-a846-5f9f-a2db-54b118de6334
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-doctor",
|
|
3
|
-
"version": "0.2.18-dev.
|
|
3
|
+
"version": "0.2.18-dev.e3b106e",
|
|
4
4
|
"description": "Diagnose and fix React codebases for security, performance, correctness, accessibility, bundle-size, and architecture issues",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"accessibility",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"agent-install": "0.0.5",
|
|
56
56
|
"conf": "^15.1.0",
|
|
57
57
|
"confbox": "^0.2.4",
|
|
58
|
-
"deslop-js": "^0.0.
|
|
58
|
+
"deslop-js": "^0.0.15",
|
|
59
59
|
"effect": "4.0.0-beta.70",
|
|
60
60
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
61
61
|
"jiti": "^2.7.0",
|
|
@@ -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.18-dev.
|
|
66
|
+
"oxlint-plugin-react-doctor": "0.2.18-dev.e3b106e"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@types/babel__code-frame": "^7.27.0",
|