react-doctor 0.2.16 → 0.2.17-dev.5614b32
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 +224 -63
- package/dist/index.js +2 -2
- package/package.json +4 -4
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]="f83fc141-ff41-5c96-8a8e-f4ea0399b0f2")}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";
|
|
@@ -41,11 +41,11 @@ import * as Exit from "effect/Exit";
|
|
|
41
41
|
import { stripVTControlCharacters } from "node:util";
|
|
42
42
|
import tty from "node:tty";
|
|
43
43
|
import { codeFrameColumns } from "@babel/code-frame";
|
|
44
|
+
import Conf from "conf";
|
|
44
45
|
import { createHash, randomUUID } from "node:crypto";
|
|
45
46
|
import basePrompts from "prompts";
|
|
46
47
|
import { SKILL_MANIFEST_FILE, detectInstalledSkillAgents, getSkillAgentConfig, getSkillAgentTypes, installSkillsFromSource } from "agent-install";
|
|
47
48
|
import { fileURLToPath } from "node:url";
|
|
48
|
-
import Conf from "conf";
|
|
49
49
|
import { generateCode, loadFile, writeFile } from "magicast";
|
|
50
50
|
import { getConfigFromVariableDeclaration, getDefaultExportOptions } from "magicast/helpers";
|
|
51
51
|
//#region \0rolldown/runtime.js
|
|
@@ -6299,7 +6299,7 @@ const MILLISECONDS_PER_SECOND = 1e3;
|
|
|
6299
6299
|
const SCORE_API_URL = "https://www.react.doctor/api/score";
|
|
6300
6300
|
const ENTERPRISE_CONTACT_URL = "https://react.doctor/enterprise";
|
|
6301
6301
|
const SHARE_BASE_URL = "https://react.doctor/share";
|
|
6302
|
-
const DOCS_URL = "https://
|
|
6302
|
+
const DOCS_URL = "https://react.doctor/docs";
|
|
6303
6303
|
const DOCS_RULES_BASE_URL = `${DOCS_URL}/rules`;
|
|
6304
6304
|
const FETCH_TIMEOUT_MS = 1e4;
|
|
6305
6305
|
const GITHUB_VIEWER_PERMISSION_TIMEOUT_MS = 2e3;
|
|
@@ -11759,7 +11759,7 @@ const filterSourceFiles = (filePaths) => filePaths.filter(isLintableSourceFile);
|
|
|
11759
11759
|
/**
|
|
11760
11760
|
* Canonical URL for a rule's documentation page — its reviewer-tested fix
|
|
11761
11761
|
* recipe rendered for humans — served at
|
|
11762
|
-
* `https://
|
|
11762
|
+
* `https://react.doctor/docs/rules/<plugin>/<rule>`. The CLI links here
|
|
11763
11763
|
* from its fix-recipe directive so each fix follows the canonical recipe
|
|
11764
11764
|
* instead of being improvised per diagnostic.
|
|
11765
11765
|
*/
|
|
@@ -11851,6 +11851,9 @@ const detectCodingAgent = () => {
|
|
|
11851
11851
|
const isCodingAgentEnvironment = () => detectCodingAgent() !== null;
|
|
11852
11852
|
const isCiOrCodingAgentEnvironment = () => isCiEnvironment() || isCodingAgentEnvironment();
|
|
11853
11853
|
//#endregion
|
|
11854
|
+
//#region src/cli/utils/is-git-hook-environment.ts
|
|
11855
|
+
const isGitHookEnvironment = () => Boolean(process.env.GIT_DIR);
|
|
11856
|
+
//#endregion
|
|
11854
11857
|
//#region src/cli/utils/is-non-interactive-environment.ts
|
|
11855
11858
|
const NON_INTERACTIVE_ENVIRONMENT_VARIABLES = [
|
|
11856
11859
|
"CI",
|
|
@@ -11871,6 +11874,9 @@ const isNonInteractiveEnvironment = () => NON_INTERACTIVE_ENVIRONMENT_VARIABLES.
|
|
|
11871
11874
|
//#endregion
|
|
11872
11875
|
//#region src/cli/utils/constants.ts
|
|
11873
11876
|
const STAGED_FILES_TEMP_DIR_PREFIX = "react-doctor-staged-";
|
|
11877
|
+
const WELCOME_EXPLANATION_HOLD_MS = 2e3;
|
|
11878
|
+
const WELCOME_HOLD_MS = 1e3;
|
|
11879
|
+
const CATEGORY_COUNTUP_SETTLE_HOLD_MS = 1e3;
|
|
11874
11880
|
const INTERNAL_ERROR_JSON_FALLBACK = "{\"schemaVersion\":1,\"ok\":false,\"error\":{\"message\":\"Internal error\",\"name\":\"Error\",\"chain\":[]}}\n";
|
|
11875
11881
|
const SENTRY_FLUSH_TIMEOUT_MS = 2e3;
|
|
11876
11882
|
const NANOSECONDS_PER_SECOND = 1000000000n;
|
|
@@ -11942,7 +11948,7 @@ const makeNoopConsole = () => ({
|
|
|
11942
11948
|
});
|
|
11943
11949
|
//#endregion
|
|
11944
11950
|
//#region src/cli/utils/version.ts
|
|
11945
|
-
const VERSION = "0.2.
|
|
11951
|
+
const VERSION = "0.2.17-dev.5614b32";
|
|
11946
11952
|
//#endregion
|
|
11947
11953
|
//#region src/cli/utils/json-mode.ts
|
|
11948
11954
|
let context = null;
|
|
@@ -12044,7 +12050,7 @@ const detectNodeMajor = () => {
|
|
|
12044
12050
|
return Number.isNaN(major) ? 0 : major;
|
|
12045
12051
|
};
|
|
12046
12052
|
const detectOrigin = () => {
|
|
12047
|
-
if (
|
|
12053
|
+
if (isGitHookEnvironment()) return "git-hook";
|
|
12048
12054
|
if (isCodingAgentEnvironment()) return "agent";
|
|
12049
12055
|
if (isCiEnvironment()) return "ci";
|
|
12050
12056
|
return "cli";
|
|
@@ -12288,13 +12294,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
|
|
|
12288
12294
|
* uploads source-map artifacts under, so stack frames symbolicate. Honors the
|
|
12289
12295
|
* standard `SENTRY_RELEASE` override.
|
|
12290
12296
|
*/
|
|
12291
|
-
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.2.
|
|
12297
|
+
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.2.17-dev.5614b32`;
|
|
12292
12298
|
/**
|
|
12293
12299
|
* Deployment environment shown in Sentry's environment filter. Defaults to
|
|
12294
12300
|
* `production` for tagged releases and `development` for dev/unbuilt versions,
|
|
12295
12301
|
* overridable via the standard `SENTRY_ENVIRONMENT` env var.
|
|
12296
12302
|
*/
|
|
12297
|
-
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.2.
|
|
12303
|
+
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.2.17-dev.5614b32") ? "development" : "production");
|
|
12298
12304
|
/**
|
|
12299
12305
|
* Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
|
|
12300
12306
|
* (set to `0` to disable tracing) and falls back to
|
|
@@ -15916,6 +15922,11 @@ const wrapTextToWidth = (text, width, options = {}) => {
|
|
|
15916
15922
|
return text.split("\n").flatMap((lineText) => wrapLine(lineText, width, breakLongWords));
|
|
15917
15923
|
};
|
|
15918
15924
|
//#endregion
|
|
15925
|
+
//#region src/cli/utils/write-stdout.ts
|
|
15926
|
+
const writeStdout = (text) => Effect.sync(() => {
|
|
15927
|
+
process.stdout.write(text);
|
|
15928
|
+
});
|
|
15929
|
+
//#endregion
|
|
15919
15930
|
//#region src/cli/utils/render-diagnostics.ts
|
|
15920
15931
|
const POINTER = isUnicodeSupported() ? "›" : ">";
|
|
15921
15932
|
const colorizeBySeverity = (text, severity) => severity === "error" ? highlighter.error(text) : highlighter.warn(text);
|
|
@@ -15949,14 +15960,39 @@ const buildCategoryDiagnosticGroups = (diagnostics, rulePriority) => {
|
|
|
15949
15960
|
return categoryGroupA.category.localeCompare(categoryGroupB.category);
|
|
15950
15961
|
});
|
|
15951
15962
|
};
|
|
15952
|
-
const
|
|
15953
|
-
const errorCount = categoryGroup.diagnostics.filter((diagnostic) => diagnostic.severity === "error").length;
|
|
15954
|
-
const warningCount = categoryGroup.diagnostics.filter((diagnostic) => diagnostic.severity === "warning").length;
|
|
15963
|
+
const formatCategoryTallyLine = (tally, errorShown, warningShown) => {
|
|
15955
15964
|
const parts = [];
|
|
15956
|
-
if (errorCount > 0) parts.push(highlighter.error(`${
|
|
15957
|
-
if (warningCount > 0) parts.push(highlighter.warn(highlighter.dim(`${
|
|
15958
|
-
return ` ${highlighter.bold(
|
|
15965
|
+
if (tally.errorCount > 0) parts.push(highlighter.error(`${errorShown} ${errorShown === 1 ? "error" : "errors"}`));
|
|
15966
|
+
if (tally.warningCount > 0) parts.push(highlighter.warn(highlighter.dim(`${warningShown} ${warningShown === 1 ? "warning" : "warnings"}`)));
|
|
15967
|
+
return ` ${highlighter.bold(tally.category)} ${highlighter.dim(POINTER)} ${parts.join(highlighter.dim(", "))}`;
|
|
15968
|
+
};
|
|
15969
|
+
const buildCategoryTally = (categoryGroup) => ({
|
|
15970
|
+
category: categoryGroup.category,
|
|
15971
|
+
errorCount: categoryGroup.diagnostics.filter((diagnostic) => diagnostic.severity === "error").length,
|
|
15972
|
+
warningCount: categoryGroup.diagnostics.filter((diagnostic) => diagnostic.severity === "warning").length
|
|
15973
|
+
});
|
|
15974
|
+
const buildCategoryTallyLines = (tallies) => tallies.map((tally) => formatCategoryTallyLine(tally, tally.errorCount, tally.warningCount));
|
|
15975
|
+
const buildPartiallyRevealedTallyLines = (tallies, revealedUnitCount) => {
|
|
15976
|
+
let remainingToReveal = revealedUnitCount;
|
|
15977
|
+
return tallies.map((tally) => {
|
|
15978
|
+
const errorShown = Math.min(tally.errorCount, remainingToReveal);
|
|
15979
|
+
remainingToReveal -= errorShown;
|
|
15980
|
+
const warningShown = Math.min(tally.warningCount, remainingToReveal);
|
|
15981
|
+
remainingToReveal -= warningShown;
|
|
15982
|
+
return formatCategoryTallyLine(tally, errorShown, warningShown);
|
|
15983
|
+
});
|
|
15959
15984
|
};
|
|
15985
|
+
const printCategoryCountUp = (tallies) => Effect.gen(function* () {
|
|
15986
|
+
const totalUnitCount = tallies.reduce((sum, tally) => sum + tally.errorCount + tally.warningCount, 0);
|
|
15987
|
+
const unitsPerStep = Math.max(1, Math.ceil(totalUnitCount / 24));
|
|
15988
|
+
for (let revealedUnitCount = 0; revealedUnitCount < totalUnitCount; revealedUnitCount += unitsPerStep) {
|
|
15989
|
+
const lines = buildPartiallyRevealedTallyLines(tallies, revealedUnitCount);
|
|
15990
|
+
yield* writeStdout(`${revealedUnitCount === 0 ? "" : `\x1b[${tallies.length}A`}\r${lines.join("\n\r")}\n`);
|
|
15991
|
+
yield* Effect.sleep(70);
|
|
15992
|
+
}
|
|
15993
|
+
yield* writeStdout(`${totalUnitCount === 0 ? "" : `\x1b[${tallies.length}A`}\r${buildCategoryTallyLines(tallies).join("\n\r")}\n`);
|
|
15994
|
+
yield* Effect.sleep(CATEGORY_COUNTUP_SETTLE_HOLD_MS);
|
|
15995
|
+
});
|
|
15960
15996
|
const TOP_ERROR_DETAIL_INDENT = " ";
|
|
15961
15997
|
const pickRepresentativeDiagnostic = (ruleDiagnostics) => ruleDiagnostics.find((diagnostic) => diagnostic.line > 0) ?? ruleDiagnostics[0];
|
|
15962
15998
|
const FRAME_CONTEXT_REACH_LINES = 3;
|
|
@@ -16014,7 +16050,7 @@ const buildRuleDetailBlock = (ruleKey, ruleDiagnostics, resolveSourceRoot, rende
|
|
|
16014
16050
|
const { severity } = representative;
|
|
16015
16051
|
const trailingBadge = formatTrailingSiteBadge(ruleDiagnostics.length);
|
|
16016
16052
|
const headline = colorizeBySeverity(`${representative.category}: ${representative.title ?? ruleKey}`, severity);
|
|
16017
|
-
const lines = [` ${colorizeBySeverity(severity === "error" ? "
|
|
16053
|
+
const lines = [` ${colorizeBySeverity(severity === "error" ? "✖" : "⚠", severity)} ${headline}${trailingBadge}`];
|
|
16018
16054
|
if (renderEverySite && !isAgentEnvironment) {
|
|
16019
16055
|
const learnMoreLine = formatLearnMoreLine(representative);
|
|
16020
16056
|
if (learnMoreLine) lines.push(`${TOP_ERROR_DETAIL_INDENT}${highlighter.info(learnMoreLine)}`);
|
|
@@ -16048,33 +16084,48 @@ const buildOverflowSummaryLine = (diagnostics, rulePriority) => {
|
|
|
16048
16084
|
parts.push(highlighter.bold(highlighter.warn(`+${warningCount} optional ${warningNoun}`)));
|
|
16049
16085
|
}
|
|
16050
16086
|
const command = highlighter.bold(highlighter.info("npx react-doctor@latest --verbose"));
|
|
16051
|
-
return ` ${parts.length > 0 ? `${parts.join(highlighter.dim(" and "))} ${highlighter.dim("
|
|
16087
|
+
return ` ${parts.length > 0 ? `${parts.join(highlighter.dim(" and "))} ${highlighter.dim("- run")}` : highlighter.dim("Run")} ${command} ${highlighter.dim("for details")}`;
|
|
16052
16088
|
};
|
|
16053
16089
|
const getTopErrorRuleKeys = (diagnostics, limit, rulePriority) => new Set(selectTopErrorRuleGroups(diagnostics, limit, rulePriority).map(([ruleKey]) => ruleKey));
|
|
16054
|
-
const
|
|
16090
|
+
const buildTopErrorsSection = (diagnostics, resolveSourceRoot, rulePriority) => {
|
|
16055
16091
|
const topRuleGroups = selectErrorRuleGroups(diagnostics, rulePriority).slice(0, 3);
|
|
16056
|
-
if (topRuleGroups.length === 0) return
|
|
16092
|
+
if (topRuleGroups.length === 0) return {
|
|
16093
|
+
lines: [],
|
|
16094
|
+
blockOffsets: []
|
|
16095
|
+
};
|
|
16057
16096
|
const lines = [
|
|
16058
16097
|
buildSectionDivider(),
|
|
16059
16098
|
` ${highlighter.bold(`Top ${topRuleGroups.length} ${topRuleGroups.length === 1 ? "error" : "errors"} you should fix`)}`,
|
|
16060
16099
|
""
|
|
16061
16100
|
];
|
|
16101
|
+
const blockOffsets = [];
|
|
16062
16102
|
for (const [ruleKey, ruleDiagnostics] of topRuleGroups) {
|
|
16103
|
+
blockOffsets.push(lines.length);
|
|
16063
16104
|
lines.push(...buildRuleDetailBlock(ruleKey, ruleDiagnostics, resolveSourceRoot, false, false));
|
|
16064
16105
|
lines.push("");
|
|
16065
16106
|
}
|
|
16066
|
-
return
|
|
16107
|
+
return {
|
|
16108
|
+
lines,
|
|
16109
|
+
blockOffsets
|
|
16110
|
+
};
|
|
16067
16111
|
};
|
|
16068
|
-
const buildCategoryBreakdownLines = (diagnostics, rulePriority) => buildCategoryDiagnosticGroups(diagnostics, rulePriority).map(buildCompactCategoryLine);
|
|
16069
16112
|
const joinSections = (...sections) => {
|
|
16070
16113
|
const lines = [];
|
|
16114
|
+
const sectionStarts = [];
|
|
16071
16115
|
for (const section of sections) {
|
|
16072
|
-
if (section.length === 0)
|
|
16116
|
+
if (section.length === 0) {
|
|
16117
|
+
sectionStarts.push(null);
|
|
16118
|
+
continue;
|
|
16119
|
+
}
|
|
16073
16120
|
if (lines.length > 0) lines.push("");
|
|
16121
|
+
sectionStarts.push(lines.length);
|
|
16074
16122
|
lines.push(...section);
|
|
16075
16123
|
}
|
|
16076
16124
|
if (lines.length > 0 && lines[lines.length - 1] !== "") lines.push("");
|
|
16077
|
-
return
|
|
16125
|
+
return {
|
|
16126
|
+
lines,
|
|
16127
|
+
sectionStarts
|
|
16128
|
+
};
|
|
16078
16129
|
};
|
|
16079
16130
|
const buildCountsSummaryLines = (diagnostics) => {
|
|
16080
16131
|
const totalIssueCount = diagnostics.length;
|
|
@@ -16089,16 +16140,36 @@ const buildCountsSummaryLines = (diagnostics) => {
|
|
|
16089
16140
|
* single Effect.forEach over Console.log so failures or fiber
|
|
16090
16141
|
* interruption produce predictable partial output.
|
|
16091
16142
|
*/
|
|
16092
|
-
const printDiagnostics = (diagnostics, isVerbose, sourceRoot, rulePriority, isAgentEnvironment = false) => Effect.gen(function* () {
|
|
16143
|
+
const printDiagnostics = (diagnostics, isVerbose, sourceRoot, rulePriority, isAgentEnvironment = false, onboarding = {}) => Effect.gen(function* () {
|
|
16144
|
+
const sectionPause = onboarding.sectionPause ?? Effect.void;
|
|
16145
|
+
const animateCountUp = onboarding.animateCountUp ?? false;
|
|
16093
16146
|
const resolveSourceRoot = typeof sourceRoot === "function" ? sourceRoot : () => sourceRoot;
|
|
16094
16147
|
let detailLines;
|
|
16095
|
-
|
|
16096
|
-
|
|
16148
|
+
let topErrorBlockOffsets = [];
|
|
16149
|
+
if (!isVerbose) {
|
|
16150
|
+
const topErrors = buildTopErrorsSection(diagnostics, resolveSourceRoot, rulePriority);
|
|
16151
|
+
detailLines = topErrors.lines;
|
|
16152
|
+
topErrorBlockOffsets = topErrors.blockOffsets;
|
|
16153
|
+
} else detailLines = buildSortedRuleGroups(diagnostics, rulePriority).flatMap(([ruleKey, ruleDiagnostics]) => {
|
|
16097
16154
|
return [...buildRuleDetailBlock(ruleKey, ruleDiagnostics, resolveSourceRoot, true, isAgentEnvironment), ""];
|
|
16098
16155
|
});
|
|
16099
16156
|
const overflowLine = isVerbose ? void 0 : buildOverflowSummaryLine(diagnostics, rulePriority);
|
|
16100
|
-
const
|
|
16101
|
-
|
|
16157
|
+
const categoryTallies = buildCategoryDiagnosticGroups(diagnostics, rulePriority).map(buildCategoryTally);
|
|
16158
|
+
const categoryLines = buildCategoryTallyLines(categoryTallies);
|
|
16159
|
+
const { lines, sectionStarts } = joinSections(categoryLines, buildCountsSummaryLines(diagnostics), detailLines, overflowLine ? [overflowLine] : []);
|
|
16160
|
+
const [categoryStart, , detailStart] = sectionStarts;
|
|
16161
|
+
const pauseBeforeLineIndices = detailStart == null ? /* @__PURE__ */ new Set() : new Set(topErrorBlockOffsets.map((offset) => detailStart + offset));
|
|
16162
|
+
let lineIndex = 0;
|
|
16163
|
+
while (lineIndex < lines.length) {
|
|
16164
|
+
if (animateCountUp && lineIndex === categoryStart && categoryLines.length > 0) {
|
|
16165
|
+
yield* printCategoryCountUp(categoryTallies);
|
|
16166
|
+
lineIndex += categoryLines.length;
|
|
16167
|
+
continue;
|
|
16168
|
+
}
|
|
16169
|
+
if (pauseBeforeLineIndices.has(lineIndex)) yield* sectionPause;
|
|
16170
|
+
yield* Console.log(lines[lineIndex]);
|
|
16171
|
+
lineIndex += 1;
|
|
16172
|
+
}
|
|
16102
16173
|
});
|
|
16103
16174
|
const formatElapsedTime = (elapsedMilliseconds) => {
|
|
16104
16175
|
if (elapsedMilliseconds < 1e3) return `${Math.round(elapsedMilliseconds)}ms`;
|
|
@@ -16136,6 +16207,45 @@ const computeProjectedScore = async (topErrorSource, rescoreSource, currentScore
|
|
|
16136
16207
|
if (!potentialScore || potentialScore.score <= currentScore.score) return null;
|
|
16137
16208
|
return potentialScore.score;
|
|
16138
16209
|
};
|
|
16210
|
+
const FORCE_ONBOARDING_ENV_VAR = "REACT_DOCTOR_FORCE_ONBOARDING";
|
|
16211
|
+
const FALSY_FLAG_VALUES = new Set([
|
|
16212
|
+
"",
|
|
16213
|
+
"0",
|
|
16214
|
+
"false"
|
|
16215
|
+
]);
|
|
16216
|
+
const isOnboardingForced = (environment = process.env) => {
|
|
16217
|
+
const value = environment[FORCE_ONBOARDING_ENV_VAR];
|
|
16218
|
+
return value !== void 0 && !FALSY_FLAG_VALUES.has(value.toLowerCase());
|
|
16219
|
+
};
|
|
16220
|
+
const onboardingSectionPause = (shouldPace) => shouldPace ? Effect.sleep(850) : Effect.void;
|
|
16221
|
+
const shouldRecordOnboarding = (input) => input.paceOnboardingSections && !input.forceOnboarding && !input.verbose && !input.isNonInteractiveEnvironment;
|
|
16222
|
+
const canAnimateOnboarding = (stream = process.stdout) => {
|
|
16223
|
+
if (!(stream.isTTY === true && (stream.columns ?? 0) > 0 && process.env.TERM !== "dumb")) return false;
|
|
16224
|
+
if (isOnboardingForced()) return true;
|
|
16225
|
+
return !isGitHookEnvironment() && !isCiEnvironment();
|
|
16226
|
+
};
|
|
16227
|
+
//#endregion
|
|
16228
|
+
//#region src/cli/utils/onboarding-state.ts
|
|
16229
|
+
const GLOBAL_CONFIG_PROJECT_NAME$1 = "react-doctor";
|
|
16230
|
+
const ONBOARDED_AT_KEY = "onboardedAt";
|
|
16231
|
+
const getOnboardingStore = (options = {}) => new Conf({
|
|
16232
|
+
projectName: GLOBAL_CONFIG_PROJECT_NAME$1,
|
|
16233
|
+
cwd: options.cwd
|
|
16234
|
+
});
|
|
16235
|
+
const hasCompletedOnboarding = (options = {}) => {
|
|
16236
|
+
try {
|
|
16237
|
+
return typeof getOnboardingStore(options).get(ONBOARDED_AT_KEY) === "string";
|
|
16238
|
+
} catch {
|
|
16239
|
+
return true;
|
|
16240
|
+
}
|
|
16241
|
+
};
|
|
16242
|
+
const markOnboardingComplete = (options = {}) => {
|
|
16243
|
+
try {
|
|
16244
|
+
const store = getOnboardingStore(options);
|
|
16245
|
+
if (typeof store.get(ONBOARDED_AT_KEY) === "string") return;
|
|
16246
|
+
store.set(ONBOARDED_AT_KEY, (/* @__PURE__ */ new Date()).toISOString());
|
|
16247
|
+
} catch {}
|
|
16248
|
+
};
|
|
16139
16249
|
//#endregion
|
|
16140
16250
|
//#region src/cli/utils/render-project-detection.ts
|
|
16141
16251
|
const printProjectDetection = (_input) => Effect.void;
|
|
@@ -16147,13 +16257,14 @@ const colorizeByScore = (text, score) => {
|
|
|
16147
16257
|
return highlighter.error(text);
|
|
16148
16258
|
};
|
|
16149
16259
|
//#endregion
|
|
16260
|
+
//#region src/cli/utils/ease-out-cubic.ts
|
|
16261
|
+
const easeOutCubic = (progress) => 1 - (1 - progress) ** 3;
|
|
16262
|
+
//#endregion
|
|
16150
16263
|
//#region src/cli/utils/render-score-header.ts
|
|
16151
16264
|
const RAINBOW_HUE_SHIFT_PER_FRAME = 9;
|
|
16152
16265
|
const RAINBOW_GRADIENT_WIDTH = 80;
|
|
16153
16266
|
const RAINBOW_OKLCH_LIGHTNESS = .638;
|
|
16154
16267
|
const RAINBOW_OKLCH_CHROMA = .129;
|
|
16155
|
-
const easeOutCubic = (progress) => 1 - (1 - progress) ** 3;
|
|
16156
|
-
const sleep = (milliseconds) => Effect.promise(() => new Promise((resolve) => setTimeout(resolve, milliseconds)));
|
|
16157
16268
|
const buildScoreBarSegments = (filledCount) => {
|
|
16158
16269
|
const emptyCount = 50 - filledCount;
|
|
16159
16270
|
return {
|
|
@@ -16223,9 +16334,6 @@ const buildFaceRenderedLines = (score) => {
|
|
|
16223
16334
|
const colorize = (text) => colorizeByScore(text, score);
|
|
16224
16335
|
return buildRawFaceLines(score).map(colorize);
|
|
16225
16336
|
};
|
|
16226
|
-
const writeScoreHeaderLine = (line) => Effect.sync(() => {
|
|
16227
|
-
process.stdout.write(line);
|
|
16228
|
-
});
|
|
16229
16337
|
const buildScoreLine = (displayScore, finalScore, label) => {
|
|
16230
16338
|
const scoreNumber = colorizeByScore(`${displayScore}`, finalScore);
|
|
16231
16339
|
const scoreLabel = colorizeByScore(label, finalScore);
|
|
@@ -16264,37 +16372,37 @@ const printAnimatedScore = (scoreFaceLine, barFaceLine, score, label, potentialS
|
|
|
16264
16372
|
const progress = easeOutCubic(frame / 40);
|
|
16265
16373
|
const animatedScore = Math.round(score * progress);
|
|
16266
16374
|
if (isPerfectScore) {
|
|
16267
|
-
yield*
|
|
16375
|
+
yield* writeStdout(`${frame === 0 ? "" : "\x1B[4A"}\r${buildRainbowScoreHeaderFrame({
|
|
16268
16376
|
score,
|
|
16269
16377
|
displayScore: animatedScore,
|
|
16270
16378
|
label,
|
|
16271
16379
|
frame
|
|
16272
16380
|
})}`);
|
|
16273
|
-
if (frame < 40) yield* sleep(50);
|
|
16381
|
+
if (frame < 40) yield* Effect.sleep(50);
|
|
16274
16382
|
continue;
|
|
16275
16383
|
}
|
|
16276
16384
|
const animatedScoreLine = buildScoreLine(animatedScore, score, label);
|
|
16277
16385
|
const animatedBarLine = frame === 40 && potentialScore !== void 0 ? buildProjectedScoreBar(score, potentialScore) : buildScoreBar(animatedScore, score);
|
|
16278
|
-
yield*
|
|
16279
|
-
if (frame < 40) yield* sleep(50);
|
|
16386
|
+
yield* writeStdout(`${frame === 0 ? "" : "\x1B[2A"}\r${buildScoreHeaderLine(scoreFaceLine, animatedScoreLine)}\n\r${buildScoreHeaderLine(barFaceLine, animatedBarLine)}\n`);
|
|
16387
|
+
if (frame < 40) yield* Effect.sleep(50);
|
|
16280
16388
|
}
|
|
16281
16389
|
if (!isPerfectScore) return;
|
|
16282
16390
|
for (let frame = 0; frame < 16; frame += 1) {
|
|
16283
|
-
yield*
|
|
16391
|
+
yield* writeStdout(`\x1b[4A\r${buildRainbowScoreHeaderFrame({
|
|
16284
16392
|
score,
|
|
16285
16393
|
displayScore: score,
|
|
16286
16394
|
label,
|
|
16287
16395
|
frame
|
|
16288
16396
|
})}`);
|
|
16289
|
-
yield* sleep(50);
|
|
16397
|
+
yield* Effect.sleep(50);
|
|
16290
16398
|
}
|
|
16291
|
-
yield*
|
|
16399
|
+
yield* writeStdout(`\x1b[4A\r${buildFinalPerfectScoreHeaderFrame(score, label, 16)}\x1b[2A`);
|
|
16292
16400
|
});
|
|
16293
16401
|
const printScoreHeader = (scoreResult, potentialScore) => Effect.gen(function* () {
|
|
16294
16402
|
const isPerfectScore = scoreResult.score === 100;
|
|
16295
16403
|
const renderedFaceLines = buildFaceRenderedLines(scoreResult.score);
|
|
16296
16404
|
const rawFaceLines = buildRawFaceLines(scoreResult.score);
|
|
16297
|
-
const shouldAnimate = !isSpinnerSilent() &&
|
|
16405
|
+
const shouldAnimate = !isSpinnerSilent() && canAnimateOnboarding(process.stdout);
|
|
16298
16406
|
const displayScore = shouldAnimate ? 0 : scoreResult.score;
|
|
16299
16407
|
const rightColumnLines = [
|
|
16300
16408
|
buildScoreLine(displayScore, scoreResult.score, scoreResult.label),
|
|
@@ -16320,9 +16428,19 @@ const printScoreHeader = (scoreResult, potentialScore) => Effect.gen(function* (
|
|
|
16320
16428
|
}));
|
|
16321
16429
|
yield* Console.log("");
|
|
16322
16430
|
if (shouldAnimate) {
|
|
16323
|
-
yield*
|
|
16431
|
+
yield* writeStdout("\x1B[5A");
|
|
16324
16432
|
yield* printAnimatedScore(renderedFaceLines[0], renderedFaceLines[1], scoreResult.score, scoreResult.label, potentialScore);
|
|
16325
|
-
yield*
|
|
16433
|
+
yield* writeStdout("\x1B[3B");
|
|
16434
|
+
}
|
|
16435
|
+
});
|
|
16436
|
+
const animateScoreProjection = (scoreResult, potentialScore, linesBelowBar) => Effect.gen(function* () {
|
|
16437
|
+
if (scoreResult.score === 100 || potentialScore <= scoreResult.score) return;
|
|
16438
|
+
const barFaceLine = buildFaceRenderedLines(scoreResult.score)[1] ?? "";
|
|
16439
|
+
for (let frame = 1; frame <= 16; frame += 1) {
|
|
16440
|
+
const progress = easeOutCubic(frame / 16);
|
|
16441
|
+
const displayedPotential = scoreResult.score + (potentialScore - scoreResult.score) * progress;
|
|
16442
|
+
yield* writeStdout(`\x1b[${linesBelowBar}A\r${buildScoreHeaderLine(barFaceLine, buildProjectedScoreBar(scoreResult.score, displayedPotential))}\x1b[${linesBelowBar}B\r`);
|
|
16443
|
+
if (frame < 16) yield* Effect.sleep(35);
|
|
16326
16444
|
}
|
|
16327
16445
|
});
|
|
16328
16446
|
const printBrandingOnlyHeader = Effect.gen(function* () {
|
|
@@ -16375,10 +16493,12 @@ const printFooter = (input) => Effect.gen(function* () {
|
|
|
16375
16493
|
});
|
|
16376
16494
|
const printSummary = (input) => Effect.gen(function* () {
|
|
16377
16495
|
if (input.scoreResult) {
|
|
16378
|
-
|
|
16496
|
+
const animateProjection = Boolean(input.animateProjection) && input.potentialScore != null && !input.verbose;
|
|
16497
|
+
yield* printScoreHeader(input.scoreResult, animateProjection ? void 0 : input.potentialScore ?? void 0);
|
|
16379
16498
|
if (input.potentialScore != null) {
|
|
16380
16499
|
const improvement = input.potentialScore - input.scoreResult.score;
|
|
16381
16500
|
yield* Console.log(highlighter.gray(" You could improve ") + colorizeByScore(`+${improvement}%`, input.potentialScore) + highlighter.gray(` by fixing the top 3 issues`));
|
|
16501
|
+
if (animateProjection) yield* animateScoreProjection(input.scoreResult, input.potentialScore, 5);
|
|
16382
16502
|
}
|
|
16383
16503
|
} else yield* printNoScoreHeader(input.noScoreMessage);
|
|
16384
16504
|
const diagnosticsDirectory = yield* Effect.try({
|
|
@@ -16646,9 +16766,12 @@ const runInspectWithRuntime = async (directory, options, userConfig, hasConfigOv
|
|
|
16646
16766
|
else runConsole(Console.error(highlighter.error(lintFailureReason)));
|
|
16647
16767
|
const inspectDiagnostics = output.diagnostics;
|
|
16648
16768
|
const score = didLintFail ? null : output.score;
|
|
16769
|
+
const elapsedMilliseconds = performance.now() - startTime;
|
|
16770
|
+
const forceOnboarding = isOnboardingForced();
|
|
16771
|
+
const paceOnboardingSections = !options.silent && !options.scoreOnly && !options.suppressRendering && !options.verbose && canAnimateOnboarding(process.stdout) && (forceOnboarding || !hasCompletedOnboarding());
|
|
16649
16772
|
const finalizeInput = {
|
|
16650
16773
|
options,
|
|
16651
|
-
elapsedMilliseconds
|
|
16774
|
+
elapsedMilliseconds,
|
|
16652
16775
|
diagnostics: inspectDiagnostics,
|
|
16653
16776
|
score,
|
|
16654
16777
|
project: output.project,
|
|
@@ -16664,6 +16787,12 @@ const runInspectWithRuntime = async (directory, options, userConfig, hasConfigOv
|
|
|
16664
16787
|
scanElapsedMilliseconds: output.scanElapsedMilliseconds
|
|
16665
16788
|
};
|
|
16666
16789
|
const result = await Effect.runPromise(finalizeAndRender(finalizeInput).pipe(options.silent ? Effect.provideService(Console.Console, silentConsole) : (program) => program));
|
|
16790
|
+
if (shouldRecordOnboarding({
|
|
16791
|
+
paceOnboardingSections,
|
|
16792
|
+
forceOnboarding,
|
|
16793
|
+
verbose: options.verbose,
|
|
16794
|
+
isNonInteractiveEnvironment: options.isNonInteractiveEnvironment
|
|
16795
|
+
})) markOnboardingComplete();
|
|
16667
16796
|
recordScanMetrics({
|
|
16668
16797
|
result,
|
|
16669
16798
|
mode: isDiffMode ? "diff" : "full",
|
|
@@ -16707,16 +16836,20 @@ const finalizeAndRender = (input) => Effect.gen(function* () {
|
|
|
16707
16836
|
else yield* Console.log(highlighter.gray(noScoreMessage));
|
|
16708
16837
|
return buildResult();
|
|
16709
16838
|
}
|
|
16839
|
+
const animateRender = !options.silent && !options.verbose && canAnimateOnboarding(process.stdout);
|
|
16840
|
+
const pause = onboardingSectionPause(animateRender);
|
|
16710
16841
|
const surfaceDiagnostics = filterDiagnosticsForSurface([...diagnostics], options.outputSurface, userConfig);
|
|
16711
16842
|
const demotedDiagnosticCount = diagnostics.length - surfaceDiagnostics.length;
|
|
16712
16843
|
const lintSourceFileCount = options.includePaths.length > 0 ? options.includePaths.length : project.sourceFileCount;
|
|
16713
16844
|
if (surfaceDiagnostics.length === 0) {
|
|
16845
|
+
yield* pause;
|
|
16714
16846
|
if (hasSkippedChecks) {
|
|
16715
16847
|
const skippedLabel = skippedChecks.join(" and ");
|
|
16716
16848
|
yield* Console.warn(highlighter.warn(`No issues detected, but ${skippedLabel} checks failed — results are incomplete.`));
|
|
16717
16849
|
} else if (demotedDiagnosticCount > 0) yield* Console.log(highlighter.success(`No issues found! (${demotedDiagnosticCount} demoted from the ${options.outputSurface} surface — see config.surfaces.)`));
|
|
16718
16850
|
else yield* Console.log(highlighter.success("No issues found!"));
|
|
16719
16851
|
yield* Console.log("");
|
|
16852
|
+
yield* pause;
|
|
16720
16853
|
if (hasSkippedChecks) {
|
|
16721
16854
|
yield* printBrandingOnlyHeader;
|
|
16722
16855
|
yield* Console.log(highlighter.gray(" Score not shown — some checks could not complete."));
|
|
@@ -16724,8 +16857,12 @@ const finalizeAndRender = (input) => Effect.gen(function* () {
|
|
|
16724
16857
|
else yield* printNoScoreHeader(noScoreMessage);
|
|
16725
16858
|
return buildResult();
|
|
16726
16859
|
}
|
|
16860
|
+
yield* pause;
|
|
16727
16861
|
yield* Console.log("");
|
|
16728
|
-
yield* printDiagnostics([...surfaceDiagnostics], options.verbose, directory, buildRulePriorityMap([score]), isCodingAgentEnvironment()
|
|
16862
|
+
yield* printDiagnostics([...surfaceDiagnostics], options.verbose, directory, buildRulePriorityMap([score]), isCodingAgentEnvironment(), {
|
|
16863
|
+
sectionPause: pause,
|
|
16864
|
+
animateCountUp: animateRender
|
|
16865
|
+
});
|
|
16729
16866
|
if (options.isNonInteractiveEnvironment && options.outputSurface !== "prComment") yield* printAgentGuidance();
|
|
16730
16867
|
if (demotedDiagnosticCount > 0) {
|
|
16731
16868
|
yield* Console.log(highlighter.gray(` ${demotedDiagnosticCount} demoted from the ${options.outputSurface} surface (e.g. design cleanup) — run \`npx react-doctor@latest .\` locally for the full list.`));
|
|
@@ -16733,6 +16870,7 @@ const finalizeAndRender = (input) => Effect.gen(function* () {
|
|
|
16733
16870
|
}
|
|
16734
16871
|
const potentialScore = score ? yield* Effect.promise(() => computeProjectedScore([...surfaceDiagnostics], [...surfaceDiagnostics], score)) : null;
|
|
16735
16872
|
const shouldShowShareLink = !options.noScore && options.share && !options.isCi;
|
|
16873
|
+
yield* pause;
|
|
16736
16874
|
yield* printSummary({
|
|
16737
16875
|
diagnostics: [...surfaceDiagnostics],
|
|
16738
16876
|
elapsedMilliseconds,
|
|
@@ -16740,13 +16878,15 @@ const finalizeAndRender = (input) => Effect.gen(function* () {
|
|
|
16740
16878
|
potentialScore,
|
|
16741
16879
|
totalSourceFileCount: lintSourceFileCount,
|
|
16742
16880
|
noScoreMessage,
|
|
16743
|
-
verbose: options.verbose
|
|
16881
|
+
verbose: options.verbose,
|
|
16882
|
+
animateProjection: animateRender
|
|
16744
16883
|
});
|
|
16745
16884
|
if (hasSkippedChecks) {
|
|
16746
16885
|
const skippedLabel = skippedChecks.join(" and ");
|
|
16747
16886
|
yield* Console.log("");
|
|
16748
16887
|
yield* Console.warn(highlighter.warn(` Note: ${skippedLabel} checks failed — score may be incomplete.`));
|
|
16749
16888
|
}
|
|
16889
|
+
yield* pause;
|
|
16750
16890
|
yield* printFooter({
|
|
16751
16891
|
diagnostics: [...surfaceDiagnostics],
|
|
16752
16892
|
scoreResult: score,
|
|
@@ -18189,7 +18329,6 @@ const copyToClipboard = (text) => {
|
|
|
18189
18329
|
//#endregion
|
|
18190
18330
|
//#region src/cli/utils/handoff-to-agent.ts
|
|
18191
18331
|
const CLIPBOARD_CHOICE = "clipboard";
|
|
18192
|
-
const PRINT_CHOICE = "print";
|
|
18193
18332
|
const SKIP_CHOICE = "skip";
|
|
18194
18333
|
const printPayload = (payload) => {
|
|
18195
18334
|
cliLogger.break();
|
|
@@ -18207,7 +18346,7 @@ const handoffToAgent = async (input) => {
|
|
|
18207
18346
|
const { handoffTarget } = await prompts({
|
|
18208
18347
|
type: "select",
|
|
18209
18348
|
name: "handoffTarget",
|
|
18210
|
-
message: "
|
|
18349
|
+
message: "Would you like to spawn an agent to fix these issues?",
|
|
18211
18350
|
choices: [
|
|
18212
18351
|
...(await detectLaunchableAgents()).map((agentId) => ({
|
|
18213
18352
|
title: getSkillAgentConfig(agentId).displayName,
|
|
@@ -18219,11 +18358,6 @@ const handoffToAgent = async (input) => {
|
|
|
18219
18358
|
description: "Paste into any agent or chat",
|
|
18220
18359
|
value: CLIPBOARD_CHOICE
|
|
18221
18360
|
},
|
|
18222
|
-
{
|
|
18223
|
-
title: "Print prompt",
|
|
18224
|
-
description: "Show the prompt below",
|
|
18225
|
-
value: PRINT_CHOICE
|
|
18226
|
-
},
|
|
18227
18361
|
{
|
|
18228
18362
|
title: "Skip",
|
|
18229
18363
|
description: "Don't hand off",
|
|
@@ -18235,7 +18369,6 @@ const handoffToAgent = async (input) => {
|
|
|
18235
18369
|
let handoffOutcome = "launch";
|
|
18236
18370
|
if (handoffTarget === void 0) handoffOutcome = "cancel";
|
|
18237
18371
|
else if (handoffTarget === SKIP_CHOICE) handoffOutcome = "skip";
|
|
18238
|
-
else if (handoffTarget === PRINT_CHOICE) handoffOutcome = "print";
|
|
18239
18372
|
else if (handoffTarget === CLIPBOARD_CHOICE) handoffOutcome = "clipboard";
|
|
18240
18373
|
recordCount(METRIC.agentHandoff, 1, {
|
|
18241
18374
|
outcome: handoffOutcome,
|
|
@@ -18247,10 +18380,6 @@ const handoffToAgent = async (input) => {
|
|
|
18247
18380
|
diagnostics: input.diagnostics,
|
|
18248
18381
|
projectName: input.projectName
|
|
18249
18382
|
});
|
|
18250
|
-
if (handoffTarget === PRINT_CHOICE) {
|
|
18251
|
-
printPayload(payload);
|
|
18252
|
-
return;
|
|
18253
|
-
}
|
|
18254
18383
|
if (handoffTarget === CLIPBOARD_CHOICE) {
|
|
18255
18384
|
if (await copyToClipboard(payload)) cliLogger.log("Copied the prompt to your clipboard.");
|
|
18256
18385
|
else printPayload(payload);
|
|
@@ -18367,6 +18496,35 @@ const printBrandedHeader = Effect.gen(function* () {
|
|
|
18367
18496
|
yield* Console.log("");
|
|
18368
18497
|
});
|
|
18369
18498
|
//#endregion
|
|
18499
|
+
//#region src/cli/utils/render-welcome.ts
|
|
18500
|
+
const HAPPY_FACE_LINES = [
|
|
18501
|
+
"┌─────┐",
|
|
18502
|
+
"│ ◠ ◠ │",
|
|
18503
|
+
"│ ▽ │",
|
|
18504
|
+
"└─────┘"
|
|
18505
|
+
];
|
|
18506
|
+
const typeLine = (linePrefix, text, style) => Effect.gen(function* () {
|
|
18507
|
+
const characters = [...text];
|
|
18508
|
+
for (let length = 1; length <= characters.length; length += 1) {
|
|
18509
|
+
yield* writeStdout(`\r${linePrefix}${style(characters.slice(0, length).join(""))}\x1b[K`);
|
|
18510
|
+
yield* Effect.sleep(32);
|
|
18511
|
+
}
|
|
18512
|
+
});
|
|
18513
|
+
const playWelcomeScene = () => Effect.gen(function* () {
|
|
18514
|
+
const face = HAPPY_FACE_LINES.map((line) => highlighter.success(line));
|
|
18515
|
+
const mouthPrefix = ` ${face[2] ?? ""} `;
|
|
18516
|
+
yield* writeStdout(`\n${face.map((line) => ` ${line}`).join("\n")}\n`);
|
|
18517
|
+
yield* writeStdout("\x1B[3A");
|
|
18518
|
+
yield* typeLine(` ${face[1] ?? ""} `, "Welcome to React Doctor", (fragment) => highlighter.bold(fragment));
|
|
18519
|
+
yield* Effect.sleep(500);
|
|
18520
|
+
yield* writeStdout("\x1B[1B");
|
|
18521
|
+
yield* typeLine(mouthPrefix, "I diagnose your React code for bugs, security & performance.", (fragment) => highlighter.dim(fragment));
|
|
18522
|
+
yield* Effect.sleep(WELCOME_EXPLANATION_HOLD_MS);
|
|
18523
|
+
yield* typeLine(mouthPrefix, "Let's scan your codebase...", (fragment) => highlighter.dim(fragment));
|
|
18524
|
+
yield* Effect.sleep(WELCOME_HOLD_MS);
|
|
18525
|
+
yield* writeStdout("\x1B[3A\r\x1B[0J");
|
|
18526
|
+
});
|
|
18527
|
+
//#endregion
|
|
18370
18528
|
//#region src/cli/utils/report-error.ts
|
|
18371
18529
|
/**
|
|
18372
18530
|
* Sends an error to Sentry — enriched with a fresh snapshot of the current run
|
|
@@ -18464,6 +18622,7 @@ const findLowestScoredScan = (completedScans) => {
|
|
|
18464
18622
|
};
|
|
18465
18623
|
const printMultiProjectSummary = (input) => Effect.gen(function* () {
|
|
18466
18624
|
const { completedScans, userConfig, verbose, isOffline, projectName } = input;
|
|
18625
|
+
const animateRender = !verbose && canAnimateOnboarding(process.stdout);
|
|
18467
18626
|
const surfaceDiagnostics = filterDiagnosticsForSurface(completedScans.flatMap((scan) => scan.result.diagnostics), "cli", userConfig);
|
|
18468
18627
|
const projectRootByDiagnostic = /* @__PURE__ */ new WeakMap();
|
|
18469
18628
|
for (const scan of completedScans) for (const diagnostic of scan.result.diagnostics) projectRootByDiagnostic.set(diagnostic, scan.result.project.rootDirectory);
|
|
@@ -18480,7 +18639,7 @@ const printMultiProjectSummary = (input) => Effect.gen(function* () {
|
|
|
18480
18639
|
yield* Console.log(`${highlighter.success("✔")} Scanned ${totalScannedFileCount} ${totalScannedFileCount === 1 ? "file" : "files"} in ${formatElapsedTime(totalScanElapsedMilliseconds)}`);
|
|
18481
18640
|
if (surfaceDiagnostics.length > 0) {
|
|
18482
18641
|
yield* Console.log("");
|
|
18483
|
-
yield* printDiagnostics(surfaceDiagnostics, verbose, resolveDiagnosticSourceRoot, buildRulePriorityMap(completedScans.map((scan) => scan.result.score)), isCodingAgentEnvironment());
|
|
18642
|
+
yield* printDiagnostics(surfaceDiagnostics, verbose, resolveDiagnosticSourceRoot, buildRulePriorityMap(completedScans.map((scan) => scan.result.score)), isCodingAgentEnvironment(), { animateCountUp: animateRender });
|
|
18484
18643
|
}
|
|
18485
18644
|
const lowestScoredScan = findLowestScoredScan(completedScans);
|
|
18486
18645
|
const aggregateScore = lowestScoredScan?.result.score ?? null;
|
|
@@ -18492,7 +18651,8 @@ const printMultiProjectSummary = (input) => Effect.gen(function* () {
|
|
|
18492
18651
|
potentialScore: lowestScoredScan ? yield* Effect.promise(() => computeProjectedScore(surfaceDiagnostics, lowestScoredScan.result.diagnostics, lowestScoredScan.result.score)) : null,
|
|
18493
18652
|
totalSourceFileCount,
|
|
18494
18653
|
noScoreMessage: "Score unavailable.",
|
|
18495
|
-
verbose
|
|
18654
|
+
verbose,
|
|
18655
|
+
animateProjection: animateRender
|
|
18496
18656
|
});
|
|
18497
18657
|
const entries = completedScans.map((scan) => {
|
|
18498
18658
|
const errorCount = scan.result.diagnostics.filter((diagnostic) => diagnostic.severity === "error").length;
|
|
@@ -18828,7 +18988,7 @@ const runExplain = async (fileLineArgument, context) => {
|
|
|
18828
18988
|
}
|
|
18829
18989
|
for (const diagnostic of matchingDiagnostics) {
|
|
18830
18990
|
const ruleIdentifier = `${diagnostic.plugin}/${diagnostic.rule}`;
|
|
18831
|
-
const severitySymbol = diagnostic.severity === "error" ? "
|
|
18991
|
+
const severitySymbol = diagnostic.severity === "error" ? "✖" : "⚠";
|
|
18832
18992
|
const colorizedRule = colorizeRuleByDiagnostic(ruleIdentifier, diagnostic.severity);
|
|
18833
18993
|
const severityLabel = colorizeRuleByDiagnostic(diagnostic.severity, diagnostic.severity);
|
|
18834
18994
|
cliLogger.log(`${severitySymbol} ${colorizedRule} ${highlighter.dim(`(${severityLabel})`)} — ${diagnostic.message}`);
|
|
@@ -18947,7 +19107,8 @@ const inspectAction = async (directory, flags) => {
|
|
|
18947
19107
|
});
|
|
18948
19108
|
return;
|
|
18949
19109
|
}
|
|
18950
|
-
if (!isQuiet) Effect.
|
|
19110
|
+
if (!isQuiet) if ((isOnboardingForced() || !hasCompletedOnboarding()) && canAnimateOnboarding(process.stdout)) await Effect.runPromise(playWelcomeScene());
|
|
19111
|
+
else Effect.runSync(printBrandedHeader);
|
|
18951
19112
|
const scanOptions = resolveCliInspectOptions(flags, userConfig);
|
|
18952
19113
|
const skipPrompts = shouldSkipPrompts({
|
|
18953
19114
|
yes: flags.yes,
|
|
@@ -20016,4 +20177,4 @@ program.parseAsync(argv).then(() => flushSentry()).catch(async (error) => {
|
|
|
20016
20177
|
export {};
|
|
20017
20178
|
|
|
20018
20179
|
//# sourceMappingURL=cli.js.map
|
|
20019
|
-
//# debugId=
|
|
20180
|
+
//# debugId=f83fc141-ff41-5c96-8a8e-f4ea0399b0f2
|
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]="de59ec3d-8219-56e6-b16a-5aed5d046e99")}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";
|
|
@@ -8742,4 +8742,4 @@ const toJsonReport = (result, options) => buildJsonReport({
|
|
|
8742
8742
|
export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, diagnose, filterSourceFiles, getDiffInfo, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
|
|
8743
8743
|
|
|
8744
8744
|
//# sourceMappingURL=index.js.map
|
|
8745
|
-
//# debugId=
|
|
8745
|
+
//# debugId=de59ec3d-8219-56e6-b16a-5aed5d046e99
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-doctor",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.17-dev.5614b32",
|
|
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.
|
|
66
|
+
"oxlint-plugin-react-doctor": "0.2.17-dev.5614b32"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@types/babel__code-frame": "^7.27.0",
|
|
@@ -71,8 +71,8 @@
|
|
|
71
71
|
"@xterm/headless": "^6.0.0",
|
|
72
72
|
"commander": "^14.0.3",
|
|
73
73
|
"ora": "^9.4.0",
|
|
74
|
-
"@react-doctor/api": "0.2.
|
|
75
|
-
"@react-doctor/core": "0.2.
|
|
74
|
+
"@react-doctor/api": "0.2.17",
|
|
75
|
+
"@react-doctor/core": "0.2.17"
|
|
76
76
|
},
|
|
77
77
|
"engines": {
|
|
78
78
|
"node": "^20.19.0 || >=22.12.0"
|