react-doctor 0.5.6-dev.1e260c5 → 0.5.6-dev.3f7d0e7
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 +137 -23
- 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]="ad091b20-c3e2-5c96-93ac-9a910745a035")}catch(e){}}();
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import * as NodeChildProcess from "node:child_process";
|
|
5
5
|
import { execFile, execFileSync, spawn, spawnSync } from "node:child_process";
|
|
@@ -14,7 +14,7 @@ import * as OS from "node:os";
|
|
|
14
14
|
import os, { tmpdir } from "node:os";
|
|
15
15
|
import { parseJSON5 } from "confbox";
|
|
16
16
|
import * as NodeUrl from "node:url";
|
|
17
|
-
import { fileURLToPath } from "node:url";
|
|
17
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
18
18
|
import { createJiti } from "jiti";
|
|
19
19
|
import * as Crypto from "node:crypto";
|
|
20
20
|
import crypto, { createHash, randomUUID } from "node:crypto";
|
|
@@ -43872,7 +43872,7 @@ const FALSY_CI_FLAG_VALUES = new Set([
|
|
|
43872
43872
|
"false"
|
|
43873
43873
|
]);
|
|
43874
43874
|
const isCiFlagSet = (value) => value !== void 0 && !FALSY_CI_FLAG_VALUES.has(value.toLowerCase());
|
|
43875
|
-
const isCiEnvironment = () => CI_ENVIRONMENT_VARIABLES.some((environmentVariable) => Boolean(
|
|
43875
|
+
const isCiEnvironment = (env = process.env) => CI_ENVIRONMENT_VARIABLES.some((environmentVariable) => Boolean(env[environmentVariable])) || isCiFlagSet(env.CI);
|
|
43876
43876
|
const detectCiProvider = () => {
|
|
43877
43877
|
for (const [environmentVariable, provider] of CI_PROVIDER_BY_ENVIRONMENT_VARIABLE) if (process.env[environmentVariable]) return provider;
|
|
43878
43878
|
return isCiFlagSet(process.env.CI) ? "unknown" : null;
|
|
@@ -43897,6 +43897,42 @@ const detectCodingAgent = () => {
|
|
|
43897
43897
|
const isCodingAgentEnvironment = () => detectCodingAgent() !== null;
|
|
43898
43898
|
const isCiOrCodingAgentEnvironment = () => isCiEnvironment() || isCodingAgentEnvironment();
|
|
43899
43899
|
//#endregion
|
|
43900
|
+
//#region src/cli/utils/detect-terminal-kind.ts
|
|
43901
|
+
const TERMINAL_BY_TERM_PROGRAM = [
|
|
43902
|
+
["vscode", "vscode"],
|
|
43903
|
+
["iTerm.app", "iterm"],
|
|
43904
|
+
["Apple_Terminal", "apple-terminal"],
|
|
43905
|
+
["WezTerm", "wezterm"],
|
|
43906
|
+
["ghostty", "ghostty"],
|
|
43907
|
+
["Hyper", "hyper"],
|
|
43908
|
+
["Tabby", "tabby"],
|
|
43909
|
+
["rio", "rio"]
|
|
43910
|
+
];
|
|
43911
|
+
/**
|
|
43912
|
+
* Best-effort label for the terminal emulator / editor hosting the CLI,
|
|
43913
|
+
* derived from terminal-identity env vars. Recorded as the `terminalKind` run
|
|
43914
|
+
* tag so we can see where React Doctor is actually run (nvim, VS Code, iTerm,
|
|
43915
|
+
* …) — the split Sentry can't otherwise see. Low-cardinality and free of any
|
|
43916
|
+
* username/path/secret, so it's safe as a tag. Editor terminals (nvim/vim)
|
|
43917
|
+
* win over the outer emulator because that's the surface a user is reading in;
|
|
43918
|
+
* "ci" marks a run with no interactive terminal; "unknown" when nothing matches.
|
|
43919
|
+
*/
|
|
43920
|
+
const detectTerminalKind = (env = process.env) => {
|
|
43921
|
+
if (env.NVIM) return "neovim";
|
|
43922
|
+
if (env.VIM_TERMINAL) return "vim";
|
|
43923
|
+
const termProgram = env.TERM_PROGRAM;
|
|
43924
|
+
if (termProgram) {
|
|
43925
|
+
for (const [marker, label] of TERMINAL_BY_TERM_PROGRAM) if (termProgram === marker) return label;
|
|
43926
|
+
}
|
|
43927
|
+
if (env.KITTY_WINDOW_ID || env.TERM === "xterm-kitty") return "kitty";
|
|
43928
|
+
if (env.WT_SESSION) return "windows-terminal";
|
|
43929
|
+
if (env.ALACRITTY_WINDOW_ID || env.TERM === "alacritty") return "alacritty";
|
|
43930
|
+
if (env.VTE_VERSION) return "vte";
|
|
43931
|
+
if (env.TMUX) return "tmux";
|
|
43932
|
+
if (isCiEnvironment(env)) return "ci";
|
|
43933
|
+
return "unknown";
|
|
43934
|
+
};
|
|
43935
|
+
//#endregion
|
|
43900
43936
|
//#region src/cli/utils/is-git-hook-environment.ts
|
|
43901
43937
|
const isGitHookEnvironment = () => Boolean(process.env.GIT_DIR);
|
|
43902
43938
|
//#endregion
|
|
@@ -44004,7 +44040,7 @@ const makeNoopConsole = () => ({
|
|
|
44004
44040
|
});
|
|
44005
44041
|
//#endregion
|
|
44006
44042
|
//#region src/cli/utils/version.ts
|
|
44007
|
-
const VERSION = "0.5.6-dev.
|
|
44043
|
+
const VERSION = "0.5.6-dev.3f7d0e7";
|
|
44008
44044
|
//#endregion
|
|
44009
44045
|
//#region src/cli/utils/json-mode.ts
|
|
44010
44046
|
let context = null;
|
|
@@ -44154,6 +44190,7 @@ const buildRunContext = () => {
|
|
|
44154
44190
|
viaAction: isOfficialGithubAction(),
|
|
44155
44191
|
codingAgent: detectCodingAgent(),
|
|
44156
44192
|
interactive: !isNonInteractiveEnvironment(),
|
|
44193
|
+
terminalKind: detectTerminalKind(),
|
|
44157
44194
|
jsonMode: isJsonModeActive(),
|
|
44158
44195
|
invokedVia: detectInvokedVia()
|
|
44159
44196
|
};
|
|
@@ -44224,6 +44261,7 @@ const buildSentryScope = (runContext = buildRunContext()) => {
|
|
|
44224
44261
|
viaAction: runContext.viaAction,
|
|
44225
44262
|
codingAgent: runContext.codingAgent,
|
|
44226
44263
|
interactive: runContext.interactive,
|
|
44264
|
+
terminalKind: runContext.terminalKind,
|
|
44227
44265
|
jsonMode: runContext.jsonMode,
|
|
44228
44266
|
invokedVia: runContext.invokedVia,
|
|
44229
44267
|
nodeMajor: runContext.nodeMajor
|
|
@@ -44362,13 +44400,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
|
|
|
44362
44400
|
* uploads source-map artifacts under, so stack frames symbolicate. Honors the
|
|
44363
44401
|
* standard `SENTRY_RELEASE` override.
|
|
44364
44402
|
*/
|
|
44365
|
-
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.5.6-dev.
|
|
44403
|
+
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.5.6-dev.3f7d0e7`;
|
|
44366
44404
|
/**
|
|
44367
44405
|
* Deployment environment shown in Sentry's environment filter. Defaults to
|
|
44368
44406
|
* `production` for tagged releases and `development` for dev/unbuilt versions,
|
|
44369
44407
|
* overridable via the standard `SENTRY_ENVIRONMENT` env var.
|
|
44370
44408
|
*/
|
|
44371
|
-
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.5.6-dev.
|
|
44409
|
+
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.5.6-dev.3f7d0e7") ? "development" : "production");
|
|
44372
44410
|
/**
|
|
44373
44411
|
* Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
|
|
44374
44412
|
* (set to `0` to disable tracing) and falls back to
|
|
@@ -48225,6 +48263,15 @@ const boxText = (content, innerWidth) => {
|
|
|
48225
48263
|
].join("\n");
|
|
48226
48264
|
};
|
|
48227
48265
|
//#endregion
|
|
48266
|
+
//#region src/cli/utils/resolve-absolute-path.ts
|
|
48267
|
+
/**
|
|
48268
|
+
* Resolves a diagnostic's `filePath` (relative to its project root, or
|
|
48269
|
+
* already absolute) to an absolute path. Shared by the code-frame reader and
|
|
48270
|
+
* the terminal hyperlink builder so both turn a relative path into the same
|
|
48271
|
+
* on-disk location.
|
|
48272
|
+
*/
|
|
48273
|
+
const resolveAbsolutePath = (filePath, rootDirectory) => Path.isAbsolute(filePath) ? filePath : Path.resolve(rootDirectory || ".", filePath);
|
|
48274
|
+
//#endregion
|
|
48228
48275
|
//#region src/cli/utils/build-code-frame.ts
|
|
48229
48276
|
/**
|
|
48230
48277
|
* Renders a syntax-highlighted source excerpt around a diagnostic site
|
|
@@ -48235,7 +48282,7 @@ const boxText = (content, innerWidth) => {
|
|
|
48235
48282
|
*/
|
|
48236
48283
|
const buildCodeFrame = (input) => {
|
|
48237
48284
|
if (input.line <= 0) return null;
|
|
48238
|
-
const absolutePath =
|
|
48285
|
+
const absolutePath = resolveAbsolutePath(input.filePath, input.rootDirectory);
|
|
48239
48286
|
let source;
|
|
48240
48287
|
try {
|
|
48241
48288
|
source = NFS.readFileSync(absolutePath, "utf8");
|
|
@@ -48275,6 +48322,16 @@ const resolveMeasureWidth = (reservedColumns = 0) => resolveClampedWidth({
|
|
|
48275
48322
|
const DIVIDER_INDENT = " ";
|
|
48276
48323
|
const buildSectionDivider = () => highlighter.dim(`${DIVIDER_INDENT}${"─".repeat(resolveMeasureWidth(2))}`);
|
|
48277
48324
|
//#endregion
|
|
48325
|
+
//#region src/cli/utils/format-hyperlink.ts
|
|
48326
|
+
const OSC = "\x1B]";
|
|
48327
|
+
const ST = "\x1B\\";
|
|
48328
|
+
/**
|
|
48329
|
+
* Wraps `text` in an OSC 8 hyperlink pointing at `uri`. The visible characters
|
|
48330
|
+
* are exactly `text`; the link is carried in escape sequences a capable
|
|
48331
|
+
* terminal turns into a click target.
|
|
48332
|
+
*/
|
|
48333
|
+
const formatHyperlink = (text, uri) => `${OSC}8;;${uri}${ST}${text}${OSC}8;;${ST}`;
|
|
48334
|
+
//#endregion
|
|
48278
48335
|
//#region src/cli/utils/indent-multiline-text.ts
|
|
48279
48336
|
const indentMultilineText = (text, linePrefix) => text.split("\n").map((lineText) => `${linePrefix}${lineText}`).join("\n");
|
|
48280
48337
|
//#endregion
|
|
@@ -48428,17 +48485,23 @@ const clusterNearbyDiagnostics = (diagnostics) => {
|
|
|
48428
48485
|
}
|
|
48429
48486
|
return clusters;
|
|
48430
48487
|
};
|
|
48431
|
-
const
|
|
48488
|
+
const formatClusterLocationText = (cluster) => {
|
|
48489
|
+
const { filePath } = cluster.diagnostics[0];
|
|
48490
|
+
if (cluster.startLine <= 0) return filePath;
|
|
48491
|
+
if (cluster.endLine > cluster.startLine) return `${filePath}:${cluster.startLine}-${cluster.endLine}`;
|
|
48492
|
+
return `${filePath}:${cluster.startLine}`;
|
|
48493
|
+
};
|
|
48494
|
+
const formatClusterLocation = (cluster, resolveSourceRoot, hyperlinks) => {
|
|
48432
48495
|
const lead = cluster.diagnostics[0];
|
|
48433
48496
|
const contextTag = formatFileContextTag(lead);
|
|
48434
|
-
|
|
48435
|
-
if (
|
|
48436
|
-
return `${lead.filePath
|
|
48497
|
+
const location = formatClusterLocationText(cluster);
|
|
48498
|
+
if (!hyperlinks) return `${location}${contextTag}`;
|
|
48499
|
+
return `${formatHyperlink(location, pathToFileURL(resolveAbsolutePath(lead.filePath, resolveSourceRoot(lead))).href)}${contextTag}`;
|
|
48437
48500
|
};
|
|
48438
|
-
const buildDiagnosticClusterLines = (cluster, resolveSourceRoot, renderCodeFrame) => {
|
|
48501
|
+
const buildDiagnosticClusterLines = (cluster, resolveSourceRoot, renderCodeFrame, hyperlinks) => {
|
|
48439
48502
|
const lead = cluster.diagnostics[0];
|
|
48440
48503
|
const isMultiSite = cluster.diagnostics.length > 1;
|
|
48441
|
-
const lines = ["", highlighter.gray(`${TOP_ERROR_DETAIL_INDENT}${formatClusterLocation(cluster)}`)];
|
|
48504
|
+
const lines = ["", highlighter.gray(`${TOP_ERROR_DETAIL_INDENT}${formatClusterLocation(cluster, resolveSourceRoot, hyperlinks)}`)];
|
|
48442
48505
|
const codeFrame = renderCodeFrame ? buildCodeFrame({
|
|
48443
48506
|
filePath: lead.filePath,
|
|
48444
48507
|
line: cluster.startLine,
|
|
@@ -48457,7 +48520,7 @@ const buildDiagnosticClusterLines = (cluster, resolveSourceRoot, renderCodeFrame
|
|
|
48457
48520
|
}
|
|
48458
48521
|
return lines;
|
|
48459
48522
|
};
|
|
48460
|
-
const buildRuleDetailBlock = (ruleKey, ruleDiagnostics, resolveSourceRoot, renderEverySite, isAgentEnvironment) => {
|
|
48523
|
+
const buildRuleDetailBlock = (ruleKey, ruleDiagnostics, resolveSourceRoot, renderEverySite, isAgentEnvironment, hyperlinks) => {
|
|
48461
48524
|
const representative = pickRepresentativeDiagnostic(ruleDiagnostics);
|
|
48462
48525
|
const { severity } = representative;
|
|
48463
48526
|
const trailingBadge = formatTrailingSiteBadge(ruleDiagnostics.length);
|
|
@@ -48477,7 +48540,7 @@ const buildRuleDetailBlock = (ruleKey, ruleDiagnostics, resolveSourceRoot, rende
|
|
|
48477
48540
|
}
|
|
48478
48541
|
const renderCodeFrame = severity === "error";
|
|
48479
48542
|
const sites = renderEverySite ? ruleDiagnostics : [representative];
|
|
48480
|
-
if (!(isCollapsedWarningGroup && representative.help.includes(representative.filePath))) for (const cluster of clusterNearbyDiagnostics(sites)) lines.push(...buildDiagnosticClusterLines(cluster, resolveSourceRoot, renderCodeFrame));
|
|
48543
|
+
if (!(isCollapsedWarningGroup && representative.help.includes(representative.filePath))) for (const cluster of clusterNearbyDiagnostics(sites)) lines.push(...buildDiagnosticClusterLines(cluster, resolveSourceRoot, renderCodeFrame, hyperlinks));
|
|
48481
48544
|
return lines;
|
|
48482
48545
|
};
|
|
48483
48546
|
const selectErrorRuleGroups = (diagnostics, rulePriority) => buildSortedRuleGroups(diagnostics.filter((diagnostic) => diagnostic.severity === "error"), rulePriority);
|
|
@@ -48490,7 +48553,7 @@ const buildOverflowSummaryLine = (diagnostics, rulePriority) => {
|
|
|
48490
48553
|
return ` ${highlighter.dim("Run")} ${command} ${highlighter.dim("to list every error and warning")}`;
|
|
48491
48554
|
};
|
|
48492
48555
|
const getTopErrorRuleKeys = (diagnostics, limit, rulePriority) => new Set(selectTopErrorRuleGroups(diagnostics, limit, rulePriority).map(([ruleKey]) => ruleKey));
|
|
48493
|
-
const buildTopErrorsSection = (diagnostics, resolveSourceRoot, rulePriority) => {
|
|
48556
|
+
const buildTopErrorsSection = (diagnostics, resolveSourceRoot, hyperlinks, rulePriority) => {
|
|
48494
48557
|
const topRuleGroups = selectErrorRuleGroups(diagnostics, rulePriority).slice(0, 3);
|
|
48495
48558
|
if (topRuleGroups.length === 0) return {
|
|
48496
48559
|
lines: [],
|
|
@@ -48500,7 +48563,7 @@ const buildTopErrorsSection = (diagnostics, resolveSourceRoot, rulePriority) =>
|
|
|
48500
48563
|
const blockOffsets = [];
|
|
48501
48564
|
for (const [ruleKey, ruleDiagnostics] of topRuleGroups) {
|
|
48502
48565
|
blockOffsets.push(lines.length);
|
|
48503
|
-
lines.push(...buildRuleDetailBlock(ruleKey, ruleDiagnostics, resolveSourceRoot, false, false));
|
|
48566
|
+
lines.push(...buildRuleDetailBlock(ruleKey, ruleDiagnostics, resolveSourceRoot, false, false, hyperlinks));
|
|
48504
48567
|
lines.push("");
|
|
48505
48568
|
}
|
|
48506
48569
|
return {
|
|
@@ -48538,18 +48601,18 @@ const buildOverviewHeaderLines = (diagnostics) => {
|
|
|
48538
48601
|
* single Effect.forEach over Console.log so failures or fiber
|
|
48539
48602
|
* interruption produce predictable partial output.
|
|
48540
48603
|
*/
|
|
48541
|
-
const printDiagnostics = (diagnostics, isVerbose, sourceRoot, rulePriority, isAgentEnvironment = false, onboarding = {}) => gen(function* () {
|
|
48604
|
+
const printDiagnostics = (diagnostics, isVerbose, sourceRoot, rulePriority, isAgentEnvironment = false, onboarding = {}, hyperlinks = false) => gen(function* () {
|
|
48542
48605
|
const sectionPause = onboarding.sectionPause ?? void_;
|
|
48543
48606
|
const animateCountUp = onboarding.animateCountUp ?? false;
|
|
48544
48607
|
const resolveSourceRoot = typeof sourceRoot === "function" ? sourceRoot : () => sourceRoot;
|
|
48545
48608
|
let detailLines;
|
|
48546
48609
|
let topErrorBlockOffsets = [];
|
|
48547
48610
|
if (!isVerbose) {
|
|
48548
|
-
const topErrors = buildTopErrorsSection(diagnostics, resolveSourceRoot, rulePriority);
|
|
48611
|
+
const topErrors = buildTopErrorsSection(diagnostics, resolveSourceRoot, hyperlinks, rulePriority);
|
|
48549
48612
|
detailLines = topErrors.lines;
|
|
48550
48613
|
topErrorBlockOffsets = topErrors.blockOffsets;
|
|
48551
48614
|
} else detailLines = buildSortedRuleGroups(diagnostics, rulePriority).flatMap(([ruleKey, ruleDiagnostics]) => {
|
|
48552
|
-
return [...buildRuleDetailBlock(ruleKey, ruleDiagnostics, resolveSourceRoot, true, isAgentEnvironment), ""];
|
|
48615
|
+
return [...buildRuleDetailBlock(ruleKey, ruleDiagnostics, resolveSourceRoot, true, isAgentEnvironment, hyperlinks), ""];
|
|
48553
48616
|
});
|
|
48554
48617
|
const overflowLine = isVerbose ? void 0 : buildOverflowSummaryLine(diagnostics, rulePriority);
|
|
48555
48618
|
const categoryTallies = buildCategoryDiagnosticGroups(diagnostics, rulePriority).map(buildCategoryTally);
|
|
@@ -48610,6 +48673,48 @@ const computeProjectedScore = async (topErrorSource, rescoreSource, currentScore
|
|
|
48610
48673
|
//#endregion
|
|
48611
48674
|
//#region src/cli/utils/filter-diagnostics-by-categories.ts
|
|
48612
48675
|
const filterDiagnosticsByCategories = (diagnostics, categories) => categories.size === 0 ? [...diagnostics] : diagnostics.filter((diagnostic) => categories.has(diagnostic.category));
|
|
48676
|
+
//#endregion
|
|
48677
|
+
//#region src/cli/utils/supports-hyperlinks.ts
|
|
48678
|
+
const HYPERLINK_CAPABLE_TERM_PROGRAMS = new Set([
|
|
48679
|
+
"iTerm.app",
|
|
48680
|
+
"WezTerm",
|
|
48681
|
+
"vscode",
|
|
48682
|
+
"Hyper",
|
|
48683
|
+
"ghostty",
|
|
48684
|
+
"Tabby",
|
|
48685
|
+
"rio"
|
|
48686
|
+
]);
|
|
48687
|
+
const parseVteVersion = (raw) => {
|
|
48688
|
+
const parsed = Number.parseInt(raw ?? "", 10);
|
|
48689
|
+
return Number.isNaN(parsed) ? 0 : parsed;
|
|
48690
|
+
};
|
|
48691
|
+
/**
|
|
48692
|
+
* Whether `stream` is a terminal that renders OSC 8 hyperlinks. Auto-detected
|
|
48693
|
+
* from terminal-identity env vars; the de-facto `FORCE_HYPERLINK` env var
|
|
48694
|
+
* overrides detection (`FORCE_HYPERLINK=0`/`false` forces off, any other value
|
|
48695
|
+
* forces on), mirroring how the ecosystem's terminal libraries gate the same
|
|
48696
|
+
* feature. Off for non-TTYs, `TERM=dumb`, and CI (whose log viewers render the
|
|
48697
|
+
* raw escape rather than a link). Unknown terminals default to off.
|
|
48698
|
+
*/
|
|
48699
|
+
const supportsHyperlinks = (stream = process.stdout, env = process.env) => {
|
|
48700
|
+
const forced = env.FORCE_HYPERLINK;
|
|
48701
|
+
if (forced !== void 0 && forced !== "") return forced !== "0" && forced.toLowerCase() !== "false";
|
|
48702
|
+
if (stream.isTTY !== true) return false;
|
|
48703
|
+
if (env.TERM === "dumb") return false;
|
|
48704
|
+
if (isCiEnvironment(env)) return false;
|
|
48705
|
+
if (env.WT_SESSION) return true;
|
|
48706
|
+
if (env.KITTY_WINDOW_ID || env.TERM === "xterm-kitty") return true;
|
|
48707
|
+
if (parseVteVersion(env.VTE_VERSION) >= 5e3) return true;
|
|
48708
|
+
return Boolean(env.TERM_PROGRAM && HYPERLINK_CAPABLE_TERM_PROGRAMS.has(env.TERM_PROGRAM));
|
|
48709
|
+
};
|
|
48710
|
+
//#endregion
|
|
48711
|
+
//#region src/cli/utils/should-render-hyperlinks.ts
|
|
48712
|
+
/**
|
|
48713
|
+
* Whether to emit OSC 8 clickable `file:line` locations for this run: a
|
|
48714
|
+
* hyperlink-capable terminal AND not a coding agent (whose output parsers
|
|
48715
|
+
* would choke on the escape sequences).
|
|
48716
|
+
*/
|
|
48717
|
+
const shouldRenderHyperlinks = (stream = process.stdout) => supportsHyperlinks(stream) && !isCodingAgentEnvironment();
|
|
48613
48718
|
const FORCE_ONBOARDING_ENV_VAR = "REACT_DOCTOR_FORCE_ONBOARDING";
|
|
48614
48719
|
const FALSY_FLAG_VALUES = new Set([
|
|
48615
48720
|
"",
|
|
@@ -49707,6 +49812,7 @@ const finalizeAndRender = (input) => gen(function* () {
|
|
|
49707
49812
|
}
|
|
49708
49813
|
const animateRender = !options.silent && !options.verbose && canAnimateOnboarding(process.stdout);
|
|
49709
49814
|
const pause = onboardingSectionPause(animateRender);
|
|
49815
|
+
const useHyperlinks = shouldRenderHyperlinks(process.stdout);
|
|
49710
49816
|
const demotedDiagnosticCount = diagnostics.length - surfaceDiagnostics.length;
|
|
49711
49817
|
const lintSourceFileCount = options.includePaths.length > 0 ? options.includePaths.length : project.sourceFileCount;
|
|
49712
49818
|
if (printedDiagnostics.length === 0) {
|
|
@@ -49732,7 +49838,7 @@ const finalizeAndRender = (input) => gen(function* () {
|
|
|
49732
49838
|
yield* printDiagnostics([...printedDiagnostics], options.verbose, directory, buildRulePriorityMap([score]), isCodingAgentEnvironment(), {
|
|
49733
49839
|
sectionPause: pause,
|
|
49734
49840
|
animateCountUp: animateRender
|
|
49735
|
-
});
|
|
49841
|
+
}, useHyperlinks);
|
|
49736
49842
|
if (options.isNonInteractiveEnvironment && options.outputSurface !== "prComment") yield* printAgentGuidance();
|
|
49737
49843
|
if (options.categoryFilters.size === 0 && demotedDiagnosticCount > 0) {
|
|
49738
49844
|
yield* log(highlighter.gray(` ${demotedDiagnosticCount} demoted from the ${options.outputSurface} surface (e.g. design cleanup) — run \`npx react-doctor@latest .\` locally for the full list.`));
|
|
@@ -52132,7 +52238,7 @@ const printMultiProjectSummary = (input) => gen(function* () {
|
|
|
52132
52238
|
yield* log(`${highlighter.success("✔")} Scanned ${totalScannedFileCount} ${totalScannedFileCount === 1 ? "file" : "files"} in ${formatElapsedTime(totalElapsedMilliseconds)}`);
|
|
52133
52239
|
if (displayDiagnostics.length > 0) {
|
|
52134
52240
|
yield* log("");
|
|
52135
|
-
yield* printDiagnostics(displayDiagnostics, verbose, resolveDiagnosticSourceRoot, buildRulePriorityMap(completedScans.map((scan) => scan.result.score)), isCodingAgentEnvironment(), { animateCountUp: animateRender });
|
|
52241
|
+
yield* printDiagnostics(displayDiagnostics, verbose, resolveDiagnosticSourceRoot, buildRulePriorityMap(completedScans.map((scan) => scan.result.score)), isCodingAgentEnvironment(), { animateCountUp: animateRender }, shouldRenderHyperlinks(process.stdout));
|
|
52136
52242
|
}
|
|
52137
52243
|
const lowestScoredScan = findLowestScoredScan(completedScans);
|
|
52138
52244
|
const aggregateScore = lowestScoredScan?.result.score ?? null;
|
|
@@ -52606,6 +52712,14 @@ const runExplain = async (fileLineArgument, context) => {
|
|
|
52606
52712
|
const colorizedRule = colorizeRuleByDiagnostic(ruleIdentifier, diagnostic.severity);
|
|
52607
52713
|
const severityLabel = colorizeRuleByDiagnostic(diagnostic.severity, diagnostic.severity);
|
|
52608
52714
|
cliLogger.log(`${severitySymbol} ${colorizedRule} ${highlighter.dim(`(${severityLabel})`)} — ${diagnostic.message}`);
|
|
52715
|
+
const codeFrame = buildCodeFrame({
|
|
52716
|
+
filePath: diagnostic.filePath,
|
|
52717
|
+
line: diagnostic.line,
|
|
52718
|
+
column: diagnostic.column,
|
|
52719
|
+
endLine: diagnostic.endLine,
|
|
52720
|
+
rootDirectory: targetDirectory
|
|
52721
|
+
});
|
|
52722
|
+
if (codeFrame) cliLogger.log(indentMultilineText(codeFrame, " "));
|
|
52609
52723
|
if (diagnostic.category) cliLogger.dim(` Category: ${diagnostic.category}`);
|
|
52610
52724
|
if (diagnostic.help) cliLogger.dim(` ${diagnostic.help}`);
|
|
52611
52725
|
cliLogger.dim(` If this needs follow-up or looks like a false positive, open: ${buildDiagnosticIssueUrl({
|
|
@@ -54010,4 +54124,4 @@ Promise.resolve().then(() => assertNoRemovedFlags(process.argv)).then(() => prog
|
|
|
54010
54124
|
export {};
|
|
54011
54125
|
|
|
54012
54126
|
//# sourceMappingURL=cli.js.map
|
|
54013
|
-
//# debugId=
|
|
54127
|
+
//# debugId=ad091b20-c3e2-5c96-93ac-9a910745a035
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-doctor",
|
|
3
|
-
"version": "0.5.6-dev.
|
|
3
|
+
"version": "0.5.6-dev.3f7d0e7",
|
|
4
4
|
"description": "Your agent writes bad React. This catches it",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"accessibility",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"vscode-languageserver": "^9.0.1",
|
|
65
65
|
"vscode-languageserver-textdocument": "^1.0.12",
|
|
66
66
|
"vscode-uri": "^3.1.0",
|
|
67
|
-
"oxlint-plugin-react-doctor": "0.5.6-dev.
|
|
67
|
+
"oxlint-plugin-react-doctor": "0.5.6-dev.3f7d0e7"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@types/babel__code-frame": "^7.27.0",
|
|
@@ -73,8 +73,8 @@
|
|
|
73
73
|
"commander": "^14.0.3",
|
|
74
74
|
"ora": "^9.4.0",
|
|
75
75
|
"@react-doctor/api": "0.5.6",
|
|
76
|
-
"@react-doctor/
|
|
77
|
-
"@react-doctor/
|
|
76
|
+
"@react-doctor/language-server": "0.5.6",
|
|
77
|
+
"@react-doctor/core": "0.5.6"
|
|
78
78
|
},
|
|
79
79
|
"engines": {
|
|
80
80
|
"node": "^20.19.0 || >=22.13.0"
|