react-doctor 0.9.12 → 0.9.13-dev.fd23edc
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/README.md +34 -1
- package/bin/react-doctor.js +1 -9
- package/dist/active-run-trace-dlIZeEvb.js +18 -0
- package/dist/active-scan-abort-registry-DwG6tSPy.js +28 -0
- package/dist/{build-section-divider-BsQvH-7I.js → build-section-divider-CUtO-gXD.js} +10 -25
- package/dist/{ci-B4x4RjKD.js → ci-DjilJaw4.js} +13 -12
- package/dist/cli.js +121 -41
- package/dist/{design-A48PNCf_.js → design-CXLKbARh.js} +4 -4
- package/dist/{devtools-DPRVRu3S.js → devtools-CC2PAZ85.js} +4 -4
- package/dist/{exit-gracefully-Bk531kS-.js → exit-gracefully-DTLgxZZ5.js} +15 -9
- package/dist/get-east-asian-width-Bv2TD3Xj.js +444 -0
- package/dist/{report-error-Pb2uO8EG.js → handle-error-BqaqFvmc.js} +18 -68
- package/dist/index.d.ts +53 -42
- package/dist/index.js +55119 -54689
- package/dist/{inspect-CwH84aSA.js → inspect-BIfnzKGq.js} +44 -33
- package/dist/{install-doctor-script-DLayXS7q.js → install-doctor-script-B1U08lUD.js} +7 -449
- package/dist/{install-github-workflow-Goz-KFqb.js → install-github-workflow-CkOl0wCn.js} +10 -6
- package/dist/{install-sFN_w425.js → install-nhJ65X-y.js} +9 -8
- package/dist/{install-react-doctor-Bq7dfEBI.js → install-react-doctor-Dm35Egex.js} +47 -45
- package/dist/{run-scan-app-DXBMW54J.js → jsx-runtime-C1t3eR6p.js} +281 -2759
- package/dist/path-format-DnHpmJwG.js +9 -0
- package/dist/{print-branded-header-D_J8Qdsj.js → print-branded-header-qOJiGkuW.js} +4 -4
- package/dist/project-analysis-worker.d.ts +1 -0
- package/dist/project-analysis-worker.js +51901 -0
- package/dist/prompt-runtime-scan-url-m88LMtMP.js +240 -0
- package/dist/{read-object-file-Hk79zI91.js → read-object-file-Cv41FpZo.js} +4 -4
- package/dist/{record-metric-CsQXJewH.js → record-metric-u8youmM2.js} +3257 -6019
- package/dist/report-error-CkFgxJTQ.js +64 -0
- package/dist/{report-workflow-result-6n_wSqzA.js → report-workflow-result-Wh1SQuOu.js} +5 -5
- package/dist/{resolve-scope-DP6rYlNO.js → resolve-scope-CHCpJtks.js} +8 -10
- package/dist/{rules-BnIZ4Fq_.js → rules-C30QFptP.js} +6 -6
- package/dist/run-scan-app-yTBDucJ3.js +2511 -0
- package/dist/runtime-scan/browser-probe.iife.js +855 -0
- package/dist/runtime-scan-VH25Yf8H.js +770 -0
- package/dist/sanitize-runtime-url-crVHbQlW.js +76 -0
- package/dist/scan-CNSRWEtJ.js +47 -0
- package/dist/semver-DFtnEmN-.js +3219 -0
- package/dist/{should-fail-scan-gate-DzZuTxim.js → should-fail-scan-gate-Cw6KeoRT.js} +160 -184
- package/dist/{should-skip-prompts-D1GWG2qN.js → should-skip-prompts-B5zkkkKR.js} +4 -4
- package/dist/should-use-tui-S9255AG_.js +25 -0
- package/dist/skills/improve-threejs/SKILL.md +102 -0
- package/dist/skills/performance/SKILL.md +113 -0
- package/dist/skills/react-doctor/SKILL.md +6 -0
- package/dist/{unref-stdin-0a_0uwC6.js → telemetry-runtime-B2rpGWMl.js} +57 -33
- package/dist/unref-stdin-SK3WfwxS.js +12 -0
- package/dist/{version-Bo5QDp7F.js → version-KQbGQSGN.js} +4 -4
- package/dist/{why-BFYbtnm8.js → why-B-l2qTCV.js} +4 -4
- package/dist/with-run-span-Dk1M8cnH.js +110 -0
- package/package.json +9 -10
- package/dist/chunk-q7NCDQ7-.js +0 -28
- package/dist/lsp.js +0 -81145
- package/dist/scan-CnnXz78m.js +0 -53
|
@@ -1,17 +1,19 @@
|
|
|
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]="
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { n as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { a as
|
|
14
|
-
import {
|
|
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]="6035757c-5992-5ac9-b221-3286f4e948e6")}catch(e){}}();
|
|
3
|
+
import { An as gen, At as discoverSupportedSubprojects, Bt as getDiffInfo, Cr as messageFromUnknown, F as STAGED_FILES_TEMP_DIR_PREFIX, Fn as provide$1, Gn as provide, H as isDebugFlagEnabled, I as STAGED_SNAPSHOT_ADDITIONAL_CONFIG_FILENAMES, Jt as isPathInsideDirectory, K as isCiOrCodingAgentEnvironment, Kt as highlighter, Lt as getBaselineDiffPlan, Pt as findLegacyConfig, Rn as runPromise, Rt as getChangedLineRanges, Sr as isPlainObject, T as METRIC, Wt as hasSupportedFrameworkOrLibrary, X as Git, _ as VERSION, _r as STAGED_FILES_PROJECT_CONFIG_FILENAMES, br as isErrnoException, er as CANONICAL_GITHUB_URL, f as setJsonReportDirectory, fn as resolveScanTarget, g as writeJsonReport, h as writeJsonErrorReport, ht as buildJsonReport, in as mapWithConcurrency, kt as detectAiTrainingEnvironment, n as recordDistribution, nn as listWorkspacePackages, p as setJsonReportMode, q as isCodingAgentEnvironment, sn as remainingDeadlineBudgetMs, t as recordCount, u as enableJsonMode, ut as StagedFiles, yn as toRelativePath, z as CliInputError } from "./record-metric-u8youmM2.js";
|
|
4
|
+
import { n as shutdownTelemetry, r as isExpectedUserError } from "./telemetry-runtime-B2rpGWMl.js";
|
|
5
|
+
import { r as flushSentry } from "./build-section-divider-CUtO-gXD.js";
|
|
6
|
+
import { n as handleUserError, t as handleError } from "./handle-error-BqaqFvmc.js";
|
|
7
|
+
import { t as reportErrorToSentry } from "./report-error-CkFgxJTQ.js";
|
|
8
|
+
import { t as toForwardSlashes } from "./path-format-DnHpmJwG.js";
|
|
9
|
+
import { A as runGitRaw, M as cliLogger, c as spinner, i as hasDoctorScript, n as findNearestPackageDirectory, o as isSpinnerSilent, s as setSpinnerSilent } from "./install-doctor-script-B1U08lUD.js";
|
|
10
|
+
import { a as readReactDoctorWorkflow, c as workflowUsesV1Action, i as isReactDoctorWorkflowInstalled, l as prompts, s as upgradeWorkflowActionToV2 } from "./install-github-workflow-CkOl0wCn.js";
|
|
11
|
+
import { c as openWorkflowPullRequest, i as warnDeprecatedDiff, l as stageWorkflowFile, r as resolveScope, s as resolveBlockingLevel, t as finalizeScope } from "./resolve-scope-CHCpJtks.js";
|
|
12
|
+
import { t as shouldSkipPrompts } from "./should-skip-prompts-B5zkkkKR.js";
|
|
13
|
+
import { A as inspect, B as filterDiagnosticsByCategories, C as CLI_AGENT_BINARIES, D as collectProjectSourceFileCounts, E as buildHandoffPayload, H as buildEmptyReportMessage, L as printDiagnosticsDump, M as printHeadlessReport, O as deduplicateProjectScans, S as detectLaunchableAgents, T as launchCliAgent, _ as resolveWorkspaceDeadCodeOwner, a as validateModeFlags, b as countUniqueScannedFiles, d as resolveProjectScan, f as resolveProjectChangedLineRanges, g as retryMissingProjectScores, h as resolveProjectRelativeDirectory, i as validateIncludeUntrackedScope, j as resolveMergeBaseRef, k as createInvocationInspect, l as selectProjects, m as resolveProjectSourceFilePaths, n as formatSkippedProjectsMessage, o as projectManifestChanged, p as resolveProjectDiffIncludePaths, s as partitionProjectScanOutcomes, t as shouldFailScanGate, u as buildCodeFrame, v as resolveCliInspectOptions, w as copyToClipboard, x as setUpGitHubActions, y as filterScansForSurface } from "./should-fail-scan-gate-Cw6KeoRT.js";
|
|
14
|
+
import { a as recordGate, i as readPreference, o as runMigrations, p as SETUP_HINT_EVENT, r as isGatePending, s as writePreference, u as HANDOFF_TARGET_PREFERENCE_ID } from "./report-workflow-result-Wh1SQuOu.js";
|
|
15
|
+
import { a as askUpgradeActionVersion, c as recordCiPromptDecision, i as installReactDoctorAgentHooks, l as hasHandledActionUpgrade, o as askAddToGitHubActions, r as findAgentsWithOutdatedReactDoctorHooks, s as hasHandledCiPrompt, t as getSkillSourceDirectory, u as recordActionUpgradeDecision } from "./install-react-doctor-Dm35Egex.js";
|
|
16
|
+
import { t as readObjectFile } from "./read-object-file-Cv41FpZo.js";
|
|
15
17
|
import * as path$1 from "node:path";
|
|
16
18
|
import * as fs$1 from "node:fs";
|
|
17
19
|
import { tmpdir } from "node:os";
|
|
@@ -315,17 +317,18 @@ const PROJECT_MIGRATIONS = [
|
|
|
315
317
|
},
|
|
316
318
|
{
|
|
317
319
|
id: "agent-hooks-sh-to-mjs",
|
|
320
|
+
version: 2,
|
|
318
321
|
scope: "project",
|
|
319
322
|
run: ({ projectRoot }) => {
|
|
320
323
|
if (projectRoot === void 0) return false;
|
|
321
|
-
const agents =
|
|
324
|
+
const agents = findAgentsWithOutdatedReactDoctorHooks(projectRoot);
|
|
322
325
|
if (agents.length === 0) return false;
|
|
323
326
|
installReactDoctorAgentHooks({
|
|
324
327
|
projectRoot,
|
|
325
328
|
agents
|
|
326
329
|
});
|
|
327
|
-
cliLogger.success(`
|
|
328
|
-
cliLogger.dim("
|
|
330
|
+
cliLogger.success(`Moved React Doctor agent hooks to end-of-turn checks (${agents.join(", ")})`);
|
|
331
|
+
cliLogger.dim(" Hooks now scan changed and untracked files once when the agent stops. Review and commit the change.");
|
|
329
332
|
cliLogger.break();
|
|
330
333
|
return true;
|
|
331
334
|
}
|
|
@@ -474,7 +477,7 @@ const buildDiagnosticIssueUrl = (input) => {
|
|
|
474
477
|
const findOwningProjectDirectory = (rootDirectory, filePath) => {
|
|
475
478
|
const absoluteFile = path$1.isAbsolute(filePath) ? filePath : path$1.resolve(rootDirectory, filePath);
|
|
476
479
|
const workspacePackages = listWorkspacePackages(rootDirectory);
|
|
477
|
-
const candidates = workspacePackages.length > 0 ? workspacePackages :
|
|
480
|
+
const candidates = workspacePackages.length > 0 ? workspacePackages : discoverSupportedSubprojects(rootDirectory);
|
|
478
481
|
if (candidates.length === 0) return rootDirectory;
|
|
479
482
|
let bestMatch = null;
|
|
480
483
|
for (const candidate of candidates) {
|
|
@@ -1092,11 +1095,11 @@ const runStagedInspect = async (input) => {
|
|
|
1092
1095
|
};
|
|
1093
1096
|
//#endregion
|
|
1094
1097
|
//#region src/cli/commands/inspect.ts
|
|
1095
|
-
const
|
|
1098
|
+
const buildFileSelectionDiffInfo = (filePaths) => ({
|
|
1096
1099
|
currentBranch: process.env.GITHUB_HEAD_REF?.trim() || null,
|
|
1097
1100
|
baseBranch: process.env.GITHUB_BASE_REF?.trim() || "pull request target",
|
|
1098
1101
|
baseSha: process.env.REACT_DOCTOR_BASE_SHA?.trim() || void 0,
|
|
1099
|
-
changedFiles,
|
|
1102
|
+
changedFiles: [...filePaths],
|
|
1100
1103
|
isCurrentChanges: false
|
|
1101
1104
|
});
|
|
1102
1105
|
const hasScanDeadlineExpired = (scanDeadlineEpochMs) => scanDeadlineEpochMs !== void 0 && remainingDeadlineBudgetMs(scanDeadlineEpochMs) === 0;
|
|
@@ -1183,7 +1186,7 @@ const maybeMigrateLegacyConfig = async (requestedDirectory, { isQuiet, isStaged
|
|
|
1183
1186
|
if (!(!isQuiet && !isStaged && process.stdout.isTTY === true && !isCiOrCodingAgentEnvironment())) return;
|
|
1184
1187
|
await runProjectMigrations(requestedDirectory);
|
|
1185
1188
|
};
|
|
1186
|
-
const inspectAction = async (directory, flags, invocationCommand = "inspect") => {
|
|
1189
|
+
const inspectAction = async (directory, flags, invocationCommand = "inspect", selectedFilePaths) => {
|
|
1187
1190
|
const isScoreOnly = Boolean(flags.score);
|
|
1188
1191
|
const isJsonMode = Boolean(flags.json);
|
|
1189
1192
|
const isQuiet = isScoreOnly || isJsonMode;
|
|
@@ -1260,14 +1263,15 @@ const inspectAction = async (directory, flags, invocationCommand = "inspect") =>
|
|
|
1260
1263
|
}
|
|
1261
1264
|
const projectDirectories = await selectProjects(resolvedDirectory, flags.project, skipPrompts, userConfig?.projects);
|
|
1262
1265
|
const projectSelectionCompletedTime = performance.now();
|
|
1263
|
-
|
|
1264
|
-
|
|
1266
|
+
const hasPositionalFileSelection = selectedFilePaths !== void 0;
|
|
1267
|
+
let providedFilesDiffInfo = hasPositionalFileSelection ? buildFileSelectionDiffInfo(selectedFilePaths) : flags.changedFilesFrom ? buildFileSelectionDiffInfo(readChangedFilesFrom(path$1.resolve(flags.changedFilesFrom))) : null;
|
|
1268
|
+
if (providedFilesDiffInfo !== null && requestedDirectory !== resolvedDirectory) {
|
|
1265
1269
|
const relativeProjectDirectory = resolveProjectRelativeDirectory(requestedDirectory, resolvedDirectory);
|
|
1266
1270
|
if (relativeProjectDirectory) {
|
|
1267
1271
|
const projectPrefix = `${relativeProjectDirectory}/`;
|
|
1268
|
-
|
|
1269
|
-
...
|
|
1270
|
-
changedFiles:
|
|
1272
|
+
providedFilesDiffInfo = {
|
|
1273
|
+
...providedFilesDiffInfo,
|
|
1274
|
+
changedFiles: providedFilesDiffInfo.changedFiles.flatMap((filePath) => {
|
|
1271
1275
|
return filePath.startsWith(projectPrefix) ? [filePath.slice(projectPrefix.length)] : [];
|
|
1272
1276
|
})
|
|
1273
1277
|
};
|
|
@@ -1275,7 +1279,11 @@ const inspectAction = async (directory, flags, invocationCommand = "inspect") =>
|
|
|
1275
1279
|
}
|
|
1276
1280
|
const requestedScope = resolveScope(flags, userConfig);
|
|
1277
1281
|
const includeUntracked = flags.includeUntracked ?? false;
|
|
1278
|
-
const scopeRequest =
|
|
1282
|
+
const scopeRequest = hasPositionalFileSelection ? {
|
|
1283
|
+
scope: "files",
|
|
1284
|
+
base: void 0,
|
|
1285
|
+
usedDeprecatedDiff: false
|
|
1286
|
+
} : requestedScope.scope === void 0 && providedFilesDiffInfo !== null ? {
|
|
1279
1287
|
...requestedScope,
|
|
1280
1288
|
scope: "changed"
|
|
1281
1289
|
} : requestedScope;
|
|
@@ -1283,8 +1291,8 @@ const inspectAction = async (directory, flags, invocationCommand = "inspect") =>
|
|
|
1283
1291
|
scanStartupSpinner = !isQuiet ? spinner("Scanning...").start() : null;
|
|
1284
1292
|
if (scanStartupSpinner !== null) recordDistribution(METRIC.scanFeedbackDelay, performance.now() - projectSelectionCompletedTime, { unit: "millisecond" });
|
|
1285
1293
|
const wantsDiffMode = scopeRequest.scope !== void 0 && scopeRequest.scope !== "full";
|
|
1286
|
-
const shouldDetectDiff =
|
|
1287
|
-
const diffInfo =
|
|
1294
|
+
const shouldDetectDiff = providedFilesDiffInfo === null && (wantsDiffMode || scopeRequest.scope === void 0 && !skipPrompts && !isQuiet);
|
|
1295
|
+
const diffInfo = providedFilesDiffInfo ?? (shouldDetectDiff ? await getDiffInfo(resolvedDirectory, scopeRequest.base, includeUntracked) : null);
|
|
1288
1296
|
scanStartupSpinner?.stop();
|
|
1289
1297
|
scanStartupSpinner = null;
|
|
1290
1298
|
const scope = await finalizeScope({
|
|
@@ -1295,7 +1303,7 @@ const inspectAction = async (directory, flags, invocationCommand = "inspect") =>
|
|
|
1295
1303
|
});
|
|
1296
1304
|
scanStartupSpinner = !isQuiet ? spinner("Scanning...").start() : null;
|
|
1297
1305
|
const isDiffMode = scope !== "full";
|
|
1298
|
-
const comparisonBaseRef = isDiffMode && diffInfo && !diffInfo.isCurrentChanges ? diffInfo.baseSha ? await resolveMergeBaseRef(resolvedDirectory, diffInfo.baseSha) : diffInfo.diffBaseRef ?? await resolveMergeBaseRef(resolvedDirectory, diffInfo.baseBranch) : null;
|
|
1306
|
+
const comparisonBaseRef = isDiffMode && diffInfo && !diffInfo.isCurrentChanges && !hasPositionalFileSelection ? diffInfo.baseSha ? await resolveMergeBaseRef(resolvedDirectory, diffInfo.baseSha) : diffInfo.diffBaseRef ?? await resolveMergeBaseRef(resolvedDirectory, diffInfo.baseBranch) : null;
|
|
1299
1307
|
const baselineRef = scope === "changed" ? comparisonBaseRef : null;
|
|
1300
1308
|
const baselineDiffPlan = baselineRef === null ? null : await getBaselineDiffPlan(resolvedDirectory, baselineRef);
|
|
1301
1309
|
const linesBaseRef = diffInfo?.isCurrentChanges ? "HEAD" : comparisonBaseRef;
|
|
@@ -1313,7 +1321,10 @@ const inspectAction = async (directory, flags, invocationCommand = "inspect") =>
|
|
|
1313
1321
|
}
|
|
1314
1322
|
setJsonReportMode(baselineRef ? "baseline" : isDiffMode ? "diff" : "full");
|
|
1315
1323
|
if (isDiffMode && diffInfo && !isQuiet) {
|
|
1316
|
-
if (
|
|
1324
|
+
if (hasPositionalFileSelection) {
|
|
1325
|
+
const fileLabel = diffInfo.changedFiles.length === 1 ? "file" : "files";
|
|
1326
|
+
cliLogger.log(`Scanning ${diffInfo.changedFiles.length} selected ${fileLabel}`);
|
|
1327
|
+
} else if (diffInfo.isCurrentChanges) cliLogger.log("Scanning uncommitted changes");
|
|
1317
1328
|
else {
|
|
1318
1329
|
const currentBranchLabel = diffInfo.currentBranch ?? "(detached HEAD)";
|
|
1319
1330
|
cliLogger.log(`Scanning changes: ${highlighter.info(currentBranchLabel)} → ${highlighter.info(diffInfo.baseBranch)}`);
|
|
@@ -1328,7 +1339,7 @@ const inspectAction = async (directory, flags, invocationCommand = "inspect") =>
|
|
|
1328
1339
|
projectDirectories: projectScans.map((projectScan) => projectScan.directory),
|
|
1329
1340
|
isRootDeadCodeEnabled: scanOptions.deadCode ?? rootProjectScan?.config?.deadCode ?? true
|
|
1330
1341
|
});
|
|
1331
|
-
if (workspaceDeadCodeOwner !== null) recordCount(METRIC.
|
|
1342
|
+
if (workspaceDeadCodeOwner !== null) recordCount(METRIC.scanWorkspaceMaintainabilityShared, 1, { projectCount: projectScans.length });
|
|
1332
1343
|
const projectScanExecutionContext = {
|
|
1333
1344
|
flags,
|
|
1334
1345
|
resolvedDirectory,
|
|
@@ -1439,5 +1450,5 @@ const inspectAction = async (directory, flags, invocationCommand = "inspect") =>
|
|
|
1439
1450
|
//#endregion
|
|
1440
1451
|
export { warnDeprecatedFailOn as n, runProjectMigrations as r, inspectAction as t };
|
|
1441
1452
|
|
|
1442
|
-
//# sourceMappingURL=inspect-
|
|
1443
|
-
//# debugId=
|
|
1453
|
+
//# sourceMappingURL=inspect-BIfnzKGq.js.map
|
|
1454
|
+
//# debugId=6035757c-5992-5ac9-b221-3286f4e948e6
|