react-doctor 0.2.15-dev.bf4c21e → 0.2.16-dev.114893e
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 +366 -247
- package/dist/index.js +78 -70
- 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]="005f503a-c838-5177-8bea-002799f23989")}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
|
|
@@ -8362,6 +8362,100 @@ const checkReducedMotion = (rootDirectory) => {
|
|
|
8362
8362
|
if (result.status === 0) return [];
|
|
8363
8363
|
return [MISSING_REDUCED_MOTION_DIAGNOSTIC];
|
|
8364
8364
|
};
|
|
8365
|
+
var import_picocolors = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
8366
|
+
let p = process || {}, argv = p.argv || [], env = p.env || {};
|
|
8367
|
+
let isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
|
|
8368
|
+
let formatter = (open, close, replace = open) => (input) => {
|
|
8369
|
+
let string = "" + input, index = string.indexOf(close, open.length);
|
|
8370
|
+
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
8371
|
+
};
|
|
8372
|
+
let replaceClose = (string, close, replace, index) => {
|
|
8373
|
+
let result = "", cursor = 0;
|
|
8374
|
+
do {
|
|
8375
|
+
result += string.substring(cursor, index) + replace;
|
|
8376
|
+
cursor = index + close.length;
|
|
8377
|
+
index = string.indexOf(close, cursor);
|
|
8378
|
+
} while (~index);
|
|
8379
|
+
return result + string.substring(cursor);
|
|
8380
|
+
};
|
|
8381
|
+
let createColors = (enabled = isColorSupported) => {
|
|
8382
|
+
let f = enabled ? formatter : () => String;
|
|
8383
|
+
return {
|
|
8384
|
+
isColorSupported: enabled,
|
|
8385
|
+
reset: f("\x1B[0m", "\x1B[0m"),
|
|
8386
|
+
bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
8387
|
+
dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
8388
|
+
italic: f("\x1B[3m", "\x1B[23m"),
|
|
8389
|
+
underline: f("\x1B[4m", "\x1B[24m"),
|
|
8390
|
+
inverse: f("\x1B[7m", "\x1B[27m"),
|
|
8391
|
+
hidden: f("\x1B[8m", "\x1B[28m"),
|
|
8392
|
+
strikethrough: f("\x1B[9m", "\x1B[29m"),
|
|
8393
|
+
black: f("\x1B[30m", "\x1B[39m"),
|
|
8394
|
+
red: f("\x1B[31m", "\x1B[39m"),
|
|
8395
|
+
green: f("\x1B[32m", "\x1B[39m"),
|
|
8396
|
+
yellow: f("\x1B[33m", "\x1B[39m"),
|
|
8397
|
+
blue: f("\x1B[34m", "\x1B[39m"),
|
|
8398
|
+
magenta: f("\x1B[35m", "\x1B[39m"),
|
|
8399
|
+
cyan: f("\x1B[36m", "\x1B[39m"),
|
|
8400
|
+
white: f("\x1B[37m", "\x1B[39m"),
|
|
8401
|
+
gray: f("\x1B[90m", "\x1B[39m"),
|
|
8402
|
+
bgBlack: f("\x1B[40m", "\x1B[49m"),
|
|
8403
|
+
bgRed: f("\x1B[41m", "\x1B[49m"),
|
|
8404
|
+
bgGreen: f("\x1B[42m", "\x1B[49m"),
|
|
8405
|
+
bgYellow: f("\x1B[43m", "\x1B[49m"),
|
|
8406
|
+
bgBlue: f("\x1B[44m", "\x1B[49m"),
|
|
8407
|
+
bgMagenta: f("\x1B[45m", "\x1B[49m"),
|
|
8408
|
+
bgCyan: f("\x1B[46m", "\x1B[49m"),
|
|
8409
|
+
bgWhite: f("\x1B[47m", "\x1B[49m"),
|
|
8410
|
+
blackBright: f("\x1B[90m", "\x1B[39m"),
|
|
8411
|
+
redBright: f("\x1B[91m", "\x1B[39m"),
|
|
8412
|
+
greenBright: f("\x1B[92m", "\x1B[39m"),
|
|
8413
|
+
yellowBright: f("\x1B[93m", "\x1B[39m"),
|
|
8414
|
+
blueBright: f("\x1B[94m", "\x1B[39m"),
|
|
8415
|
+
magentaBright: f("\x1B[95m", "\x1B[39m"),
|
|
8416
|
+
cyanBright: f("\x1B[96m", "\x1B[39m"),
|
|
8417
|
+
whiteBright: f("\x1B[97m", "\x1B[39m"),
|
|
8418
|
+
bgBlackBright: f("\x1B[100m", "\x1B[49m"),
|
|
8419
|
+
bgRedBright: f("\x1B[101m", "\x1B[49m"),
|
|
8420
|
+
bgGreenBright: f("\x1B[102m", "\x1B[49m"),
|
|
8421
|
+
bgYellowBright: f("\x1B[103m", "\x1B[49m"),
|
|
8422
|
+
bgBlueBright: f("\x1B[104m", "\x1B[49m"),
|
|
8423
|
+
bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
|
|
8424
|
+
bgCyanBright: f("\x1B[106m", "\x1B[49m"),
|
|
8425
|
+
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
|
|
8426
|
+
};
|
|
8427
|
+
};
|
|
8428
|
+
module.exports = createColors();
|
|
8429
|
+
module.exports.createColors = createColors;
|
|
8430
|
+
})))(), 1);
|
|
8431
|
+
const highlighter = {
|
|
8432
|
+
error: import_picocolors.default.red,
|
|
8433
|
+
warn: import_picocolors.default.yellow,
|
|
8434
|
+
info: import_picocolors.default.cyan,
|
|
8435
|
+
success: import_picocolors.default.green,
|
|
8436
|
+
dim: import_picocolors.default.dim,
|
|
8437
|
+
gray: import_picocolors.default.gray,
|
|
8438
|
+
bold: import_picocolors.default.bold
|
|
8439
|
+
};
|
|
8440
|
+
/**
|
|
8441
|
+
* Override picocolors' automatic color detection. picocolors decides
|
|
8442
|
+
* once, at import time, from `NO_COLOR` / `FORCE_COLOR` / `TERM` / TTY.
|
|
8443
|
+
* This lets the CLI honor an explicit `--color` / `--no-color` flag
|
|
8444
|
+
* (clig.dev, Output: "Disable color … if the user requested it") by
|
|
8445
|
+
* swapping in a fresh set of formatters. Call it before any colored
|
|
8446
|
+
* output is produced. Every call site reads `highlighter.<method>` at
|
|
8447
|
+
* call time, so reassigning the properties propagates everywhere.
|
|
8448
|
+
*/
|
|
8449
|
+
const setColorEnabled = (enabled) => {
|
|
8450
|
+
const colors = import_picocolors.default.createColors(enabled);
|
|
8451
|
+
highlighter.error = colors.red;
|
|
8452
|
+
highlighter.warn = colors.yellow;
|
|
8453
|
+
highlighter.info = colors.cyan;
|
|
8454
|
+
highlighter.success = colors.green;
|
|
8455
|
+
highlighter.dim = colors.dim;
|
|
8456
|
+
highlighter.gray = colors.gray;
|
|
8457
|
+
highlighter.bold = colors.bold;
|
|
8458
|
+
};
|
|
8365
8459
|
const computeJsxIncludePaths = (includePaths) => includePaths.length > 0 ? includePaths.filter((filePath) => JSX_FILE_PATTERN.test(filePath)) : void 0;
|
|
8366
8460
|
const LINGUIST_ATTRIBUTE_PATTERN = /^linguist-(?:vendored|generated)(?:=([a-zA-Z0-9]+))?$/i;
|
|
8367
8461
|
const FALSY_VALUES = new Set([
|
|
@@ -11193,7 +11287,7 @@ const runInspect = (input, hooks = {}) => Effect.gen(function* () {
|
|
|
11193
11287
|
reason: null
|
|
11194
11288
|
});
|
|
11195
11289
|
const scanConcurrency = yield* OxlintConcurrency;
|
|
11196
|
-
const workerCountSuffix = scanConcurrency > 1 ? `
|
|
11290
|
+
const workerCountSuffix = scanConcurrency > 1 ? ` ${highlighter.dim(`[~${scanConcurrency} workers]`)}` : "";
|
|
11197
11291
|
const scanProgress = yield* progressService.start("Scanning...");
|
|
11198
11292
|
const scanStartTime = Date.now();
|
|
11199
11293
|
let lastReportedTotalFileCount = 0;
|
|
@@ -11662,100 +11756,6 @@ const getDiffInfo = (directory, explicitBaseBranch) => Effect.runPromise(Effect.
|
|
|
11662
11756
|
};
|
|
11663
11757
|
}).pipe(Effect.provide(Git.layerNode)));
|
|
11664
11758
|
const filterSourceFiles = (filePaths) => filePaths.filter(isLintableSourceFile);
|
|
11665
|
-
var import_picocolors = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
11666
|
-
let p = process || {}, argv = p.argv || [], env = p.env || {};
|
|
11667
|
-
let isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
|
|
11668
|
-
let formatter = (open, close, replace = open) => (input) => {
|
|
11669
|
-
let string = "" + input, index = string.indexOf(close, open.length);
|
|
11670
|
-
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
11671
|
-
};
|
|
11672
|
-
let replaceClose = (string, close, replace, index) => {
|
|
11673
|
-
let result = "", cursor = 0;
|
|
11674
|
-
do {
|
|
11675
|
-
result += string.substring(cursor, index) + replace;
|
|
11676
|
-
cursor = index + close.length;
|
|
11677
|
-
index = string.indexOf(close, cursor);
|
|
11678
|
-
} while (~index);
|
|
11679
|
-
return result + string.substring(cursor);
|
|
11680
|
-
};
|
|
11681
|
-
let createColors = (enabled = isColorSupported) => {
|
|
11682
|
-
let f = enabled ? formatter : () => String;
|
|
11683
|
-
return {
|
|
11684
|
-
isColorSupported: enabled,
|
|
11685
|
-
reset: f("\x1B[0m", "\x1B[0m"),
|
|
11686
|
-
bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
11687
|
-
dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
11688
|
-
italic: f("\x1B[3m", "\x1B[23m"),
|
|
11689
|
-
underline: f("\x1B[4m", "\x1B[24m"),
|
|
11690
|
-
inverse: f("\x1B[7m", "\x1B[27m"),
|
|
11691
|
-
hidden: f("\x1B[8m", "\x1B[28m"),
|
|
11692
|
-
strikethrough: f("\x1B[9m", "\x1B[29m"),
|
|
11693
|
-
black: f("\x1B[30m", "\x1B[39m"),
|
|
11694
|
-
red: f("\x1B[31m", "\x1B[39m"),
|
|
11695
|
-
green: f("\x1B[32m", "\x1B[39m"),
|
|
11696
|
-
yellow: f("\x1B[33m", "\x1B[39m"),
|
|
11697
|
-
blue: f("\x1B[34m", "\x1B[39m"),
|
|
11698
|
-
magenta: f("\x1B[35m", "\x1B[39m"),
|
|
11699
|
-
cyan: f("\x1B[36m", "\x1B[39m"),
|
|
11700
|
-
white: f("\x1B[37m", "\x1B[39m"),
|
|
11701
|
-
gray: f("\x1B[90m", "\x1B[39m"),
|
|
11702
|
-
bgBlack: f("\x1B[40m", "\x1B[49m"),
|
|
11703
|
-
bgRed: f("\x1B[41m", "\x1B[49m"),
|
|
11704
|
-
bgGreen: f("\x1B[42m", "\x1B[49m"),
|
|
11705
|
-
bgYellow: f("\x1B[43m", "\x1B[49m"),
|
|
11706
|
-
bgBlue: f("\x1B[44m", "\x1B[49m"),
|
|
11707
|
-
bgMagenta: f("\x1B[45m", "\x1B[49m"),
|
|
11708
|
-
bgCyan: f("\x1B[46m", "\x1B[49m"),
|
|
11709
|
-
bgWhite: f("\x1B[47m", "\x1B[49m"),
|
|
11710
|
-
blackBright: f("\x1B[90m", "\x1B[39m"),
|
|
11711
|
-
redBright: f("\x1B[91m", "\x1B[39m"),
|
|
11712
|
-
greenBright: f("\x1B[92m", "\x1B[39m"),
|
|
11713
|
-
yellowBright: f("\x1B[93m", "\x1B[39m"),
|
|
11714
|
-
blueBright: f("\x1B[94m", "\x1B[39m"),
|
|
11715
|
-
magentaBright: f("\x1B[95m", "\x1B[39m"),
|
|
11716
|
-
cyanBright: f("\x1B[96m", "\x1B[39m"),
|
|
11717
|
-
whiteBright: f("\x1B[97m", "\x1B[39m"),
|
|
11718
|
-
bgBlackBright: f("\x1B[100m", "\x1B[49m"),
|
|
11719
|
-
bgRedBright: f("\x1B[101m", "\x1B[49m"),
|
|
11720
|
-
bgGreenBright: f("\x1B[102m", "\x1B[49m"),
|
|
11721
|
-
bgYellowBright: f("\x1B[103m", "\x1B[49m"),
|
|
11722
|
-
bgBlueBright: f("\x1B[104m", "\x1B[49m"),
|
|
11723
|
-
bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
|
|
11724
|
-
bgCyanBright: f("\x1B[106m", "\x1B[49m"),
|
|
11725
|
-
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
|
|
11726
|
-
};
|
|
11727
|
-
};
|
|
11728
|
-
module.exports = createColors();
|
|
11729
|
-
module.exports.createColors = createColors;
|
|
11730
|
-
})))(), 1);
|
|
11731
|
-
const highlighter = {
|
|
11732
|
-
error: import_picocolors.default.red,
|
|
11733
|
-
warn: import_picocolors.default.yellow,
|
|
11734
|
-
info: import_picocolors.default.cyan,
|
|
11735
|
-
success: import_picocolors.default.green,
|
|
11736
|
-
dim: import_picocolors.default.dim,
|
|
11737
|
-
gray: import_picocolors.default.gray,
|
|
11738
|
-
bold: import_picocolors.default.bold
|
|
11739
|
-
};
|
|
11740
|
-
/**
|
|
11741
|
-
* Override picocolors' automatic color detection. picocolors decides
|
|
11742
|
-
* once, at import time, from `NO_COLOR` / `FORCE_COLOR` / `TERM` / TTY.
|
|
11743
|
-
* This lets the CLI honor an explicit `--color` / `--no-color` flag
|
|
11744
|
-
* (clig.dev, Output: "Disable color … if the user requested it") by
|
|
11745
|
-
* swapping in a fresh set of formatters. Call it before any colored
|
|
11746
|
-
* output is produced. Every call site reads `highlighter.<method>` at
|
|
11747
|
-
* call time, so reassigning the properties propagates everywhere.
|
|
11748
|
-
*/
|
|
11749
|
-
const setColorEnabled = (enabled) => {
|
|
11750
|
-
const colors = import_picocolors.default.createColors(enabled);
|
|
11751
|
-
highlighter.error = colors.red;
|
|
11752
|
-
highlighter.warn = colors.yellow;
|
|
11753
|
-
highlighter.info = colors.cyan;
|
|
11754
|
-
highlighter.success = colors.green;
|
|
11755
|
-
highlighter.dim = colors.dim;
|
|
11756
|
-
highlighter.gray = colors.gray;
|
|
11757
|
-
highlighter.bold = colors.bold;
|
|
11758
|
-
};
|
|
11759
11759
|
/**
|
|
11760
11760
|
* Canonical URL for a rule's documentation page — its reviewer-tested fix
|
|
11761
11761
|
* recipe rendered for humans — served at
|
|
@@ -11871,6 +11871,8 @@ const isNonInteractiveEnvironment = () => NON_INTERACTIVE_ENVIRONMENT_VARIABLES.
|
|
|
11871
11871
|
//#endregion
|
|
11872
11872
|
//#region src/cli/utils/constants.ts
|
|
11873
11873
|
const STAGED_FILES_TEMP_DIR_PREFIX = "react-doctor-staged-";
|
|
11874
|
+
const WELCOME_EXPLANATION_HOLD_MS = 2e3;
|
|
11875
|
+
const WELCOME_HOLD_MS = 1e3;
|
|
11874
11876
|
const INTERNAL_ERROR_JSON_FALLBACK = "{\"schemaVersion\":1,\"ok\":false,\"error\":{\"message\":\"Internal error\",\"name\":\"Error\",\"chain\":[]}}\n";
|
|
11875
11877
|
const SENTRY_FLUSH_TIMEOUT_MS = 2e3;
|
|
11876
11878
|
const NANOSECONDS_PER_SECOND = 1000000000n;
|
|
@@ -11942,7 +11944,7 @@ const makeNoopConsole = () => ({
|
|
|
11942
11944
|
});
|
|
11943
11945
|
//#endregion
|
|
11944
11946
|
//#region src/cli/utils/version.ts
|
|
11945
|
-
const VERSION = "0.2.
|
|
11947
|
+
const VERSION = "0.2.16-dev.114893e";
|
|
11946
11948
|
//#endregion
|
|
11947
11949
|
//#region src/cli/utils/json-mode.ts
|
|
11948
11950
|
let context = null;
|
|
@@ -12288,13 +12290,13 @@ const isDevVersion = (version) => version === "0.0.0" || version.includes("-");
|
|
|
12288
12290
|
* uploads source-map artifacts under, so stack frames symbolicate. Honors the
|
|
12289
12291
|
* standard `SENTRY_RELEASE` override.
|
|
12290
12292
|
*/
|
|
12291
|
-
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.2.
|
|
12293
|
+
const resolveSentryRelease = () => process.env.SENTRY_RELEASE || `react-doctor@0.2.16-dev.114893e`;
|
|
12292
12294
|
/**
|
|
12293
12295
|
* Deployment environment shown in Sentry's environment filter. Defaults to
|
|
12294
12296
|
* `production` for tagged releases and `development` for dev/unbuilt versions,
|
|
12295
12297
|
* overridable via the standard `SENTRY_ENVIRONMENT` env var.
|
|
12296
12298
|
*/
|
|
12297
|
-
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.2.
|
|
12299
|
+
const resolveSentryEnvironment = () => process.env.SENTRY_ENVIRONMENT || (isDevVersion("0.2.16-dev.114893e") ? "development" : "production");
|
|
12298
12300
|
/**
|
|
12299
12301
|
* Performance-tracing sample rate in `[0, 1]`. Reads `SENTRY_TRACES_SAMPLE_RATE`
|
|
12300
12302
|
* (set to `0` to disable tracing) and falls back to
|
|
@@ -15874,6 +15876,12 @@ const buildCodeFrame = (input) => {
|
|
|
15874
15876
|
});
|
|
15875
15877
|
};
|
|
15876
15878
|
//#endregion
|
|
15879
|
+
//#region src/cli/utils/build-section-divider.ts
|
|
15880
|
+
const buildSectionDivider = () => highlighter.dim(` ${"─".repeat(60)}`);
|
|
15881
|
+
//#endregion
|
|
15882
|
+
//#region src/cli/utils/ease-out-cubic.ts
|
|
15883
|
+
const easeOutCubic = (progress) => 1 - (1 - progress) ** 3;
|
|
15884
|
+
//#endregion
|
|
15877
15885
|
//#region src/cli/utils/indent-multiline-text.ts
|
|
15878
15886
|
const indentMultilineText = (text, linePrefix) => text.split("\n").map((lineText) => `${linePrefix}${lineText}`).join("\n");
|
|
15879
15887
|
//#endregion
|
|
@@ -15913,6 +15921,11 @@ const wrapTextToWidth = (text, width, options = {}) => {
|
|
|
15913
15921
|
return text.split("\n").flatMap((lineText) => wrapLine(lineText, width, breakLongWords));
|
|
15914
15922
|
};
|
|
15915
15923
|
//#endregion
|
|
15924
|
+
//#region src/cli/utils/write-stdout.ts
|
|
15925
|
+
const writeStdout = (text) => Effect.sync(() => {
|
|
15926
|
+
process.stdout.write(text);
|
|
15927
|
+
});
|
|
15928
|
+
//#endregion
|
|
15916
15929
|
//#region src/cli/utils/render-diagnostics.ts
|
|
15917
15930
|
const POINTER = isUnicodeSupported() ? "›" : ">";
|
|
15918
15931
|
const colorizeBySeverity = (text, severity) => severity === "error" ? highlighter.error(text) : highlighter.warn(text);
|
|
@@ -15946,17 +15959,28 @@ const buildCategoryDiagnosticGroups = (diagnostics, rulePriority) => {
|
|
|
15946
15959
|
return categoryGroupA.category.localeCompare(categoryGroupB.category);
|
|
15947
15960
|
});
|
|
15948
15961
|
};
|
|
15949
|
-
const
|
|
15950
|
-
const errorCount = categoryGroup.diagnostics.filter((diagnostic) => diagnostic.severity === "error").length;
|
|
15951
|
-
const warningCount = categoryGroup.diagnostics.filter((diagnostic) => diagnostic.severity === "warning").length;
|
|
15962
|
+
const formatCategoryTallyLine = (tally, errorShown, warningShown) => {
|
|
15952
15963
|
const parts = [];
|
|
15953
|
-
if (errorCount > 0) parts.push(highlighter.error(`${
|
|
15954
|
-
if (warningCount > 0) parts.push(highlighter.warn(highlighter.dim(`${
|
|
15955
|
-
return ` ${highlighter.bold(
|
|
15956
|
-
};
|
|
15964
|
+
if (tally.errorCount > 0) parts.push(highlighter.error(`${errorShown} ${errorShown === 1 ? "error" : "errors"}`));
|
|
15965
|
+
if (tally.warningCount > 0) parts.push(highlighter.warn(highlighter.dim(`${warningShown} ${warningShown === 1 ? "warning" : "warnings"}`)));
|
|
15966
|
+
return ` ${highlighter.bold(tally.category)} ${highlighter.dim(POINTER)} ${parts.join(highlighter.dim(", "))}`;
|
|
15967
|
+
};
|
|
15968
|
+
const buildCategoryTally = (categoryGroup) => ({
|
|
15969
|
+
category: categoryGroup.category,
|
|
15970
|
+
errorCount: categoryGroup.diagnostics.filter((diagnostic) => diagnostic.severity === "error").length,
|
|
15971
|
+
warningCount: categoryGroup.diagnostics.filter((diagnostic) => diagnostic.severity === "warning").length
|
|
15972
|
+
});
|
|
15973
|
+
const buildCategoryTallyLines = (tallies) => tallies.map((tally) => formatCategoryTallyLine(tally, tally.errorCount, tally.warningCount));
|
|
15974
|
+
const printCategoryCountUp = (tallies) => Effect.gen(function* () {
|
|
15975
|
+
for (let frame = 0; frame <= 16; frame += 1) {
|
|
15976
|
+
const fraction = easeOutCubic(frame / 16);
|
|
15977
|
+
const lines = tallies.map((tally) => formatCategoryTallyLine(tally, Math.round(tally.errorCount * fraction), Math.round(tally.warningCount * fraction)));
|
|
15978
|
+
yield* writeStdout(`${frame === 0 ? "" : `\x1b[${tallies.length}A`}\r${lines.join("\n\r")}\n`);
|
|
15979
|
+
if (frame < 16) yield* Effect.sleep(45);
|
|
15980
|
+
}
|
|
15981
|
+
});
|
|
15957
15982
|
const TOP_ERROR_DETAIL_INDENT = " ";
|
|
15958
15983
|
const pickRepresentativeDiagnostic = (ruleDiagnostics) => ruleDiagnostics.find((diagnostic) => diagnostic.line > 0) ?? ruleDiagnostics[0];
|
|
15959
|
-
const isErrorRuleGroup = (ruleDiagnostics) => pickRepresentativeDiagnostic(ruleDiagnostics).severity === "error";
|
|
15960
15984
|
const FRAME_CONTEXT_REACH_LINES = 3;
|
|
15961
15985
|
const clusterNearbyDiagnostics = (diagnostics) => {
|
|
15962
15986
|
const byFile = groupBy(diagnostics, (diagnostic) => diagnostic.filePath);
|
|
@@ -16007,101 +16031,87 @@ const buildDiagnosticClusterLines = (cluster, resolveSourceRoot, renderCodeFrame
|
|
|
16007
16031
|
}
|
|
16008
16032
|
return lines;
|
|
16009
16033
|
};
|
|
16010
|
-
const buildRuleDetailBlock = (ruleKey, ruleDiagnostics, resolveSourceRoot, renderEverySite) => {
|
|
16034
|
+
const buildRuleDetailBlock = (ruleKey, ruleDiagnostics, resolveSourceRoot, renderEverySite, isAgentEnvironment) => {
|
|
16011
16035
|
const representative = pickRepresentativeDiagnostic(ruleDiagnostics);
|
|
16012
16036
|
const { severity } = representative;
|
|
16013
16037
|
const trailingBadge = formatTrailingSiteBadge(ruleDiagnostics.length);
|
|
16014
16038
|
const headline = colorizeBySeverity(`${representative.category}: ${representative.title ?? ruleKey}`, severity);
|
|
16015
|
-
const lines = [` ${colorizeBySeverity(severity === "error" ? "
|
|
16016
|
-
if (
|
|
16017
|
-
if (representative.help) for (const fixLine of wrapTextToWidth(`→ ${representative.help}`, 60, { breakLongWords: false })) lines.push(highlighter.dim(`${TOP_ERROR_DETAIL_INDENT}${fixLine}`));
|
|
16018
|
-
const renderCodeFrame = severity === "error";
|
|
16019
|
-
const sites = renderEverySite ? ruleDiagnostics : [representative];
|
|
16020
|
-
for (const cluster of clusterNearbyDiagnostics(sites)) lines.push(...buildDiagnosticClusterLines(cluster, resolveSourceRoot, renderCodeFrame));
|
|
16021
|
-
return lines;
|
|
16022
|
-
};
|
|
16023
|
-
const WARNING_DETAIL_INDENT = " ";
|
|
16024
|
-
const computeRuleNameColumnWidth = (ruleKeys) => ruleKeys.reduce((widest, ruleKey) => Math.max(widest, ruleKey.length), 36);
|
|
16025
|
-
const padRuleNameToColumn = (ruleName, columnWidth) => ruleName.length >= columnWidth ? ruleName : ruleName + " ".repeat(columnWidth - ruleName.length);
|
|
16026
|
-
const buildWarningHeaderLine = (ruleKey, siteCount, ruleNameColumnWidth) => {
|
|
16027
|
-
const ruleName = formatSiteCountBadge(siteCount).length > 0 ? padRuleNameToColumn(ruleKey, ruleNameColumnWidth) : ruleKey;
|
|
16028
|
-
return ` ${highlighter.warn("⚠")} ${ruleName}${formatTrailingSiteBadge(siteCount)}`;
|
|
16029
|
-
};
|
|
16030
|
-
const buildWarningRuleBlock = (ruleKey, ruleDiagnostics, ruleNameColumnWidth, isAgentEnvironment) => {
|
|
16031
|
-
const representative = pickRepresentativeDiagnostic(ruleDiagnostics);
|
|
16032
|
-
const lines = [buildWarningHeaderLine(ruleKey, ruleDiagnostics.length, ruleNameColumnWidth)];
|
|
16033
|
-
if (!isAgentEnvironment) {
|
|
16039
|
+
const lines = [` ${colorizeBySeverity(severity === "error" ? "✖" : "⚠", severity)} ${headline}${trailingBadge}`];
|
|
16040
|
+
if (renderEverySite && !isAgentEnvironment) {
|
|
16034
16041
|
const learnMoreLine = formatLearnMoreLine(representative);
|
|
16035
|
-
if (learnMoreLine) lines.push(`${
|
|
16042
|
+
if (learnMoreLine) lines.push(`${TOP_ERROR_DETAIL_INDENT}${highlighter.info(learnMoreLine)}`);
|
|
16036
16043
|
}
|
|
16037
|
-
|
|
16038
|
-
if (representative.help)
|
|
16039
|
-
if (isAgentEnvironment) {
|
|
16044
|
+
if (!renderEverySite) for (const explanationLine of wrapTextToWidth(representative.message, 60, { breakLongWords: false })) lines.push(`${TOP_ERROR_DETAIL_INDENT}${explanationLine}`);
|
|
16045
|
+
if (representative.help) for (const fixLine of wrapTextToWidth(`→ ${representative.help}`, 60, { breakLongWords: false })) lines.push(highlighter.dim(`${TOP_ERROR_DETAIL_INDENT}${fixLine}`));
|
|
16046
|
+
if (renderEverySite && isAgentEnvironment) {
|
|
16040
16047
|
const fixRecipeLine = formatFixRecipeLine(representative);
|
|
16041
|
-
if (fixRecipeLine) lines.push(highlighter.gray(`${
|
|
16042
|
-
}
|
|
16043
|
-
for (const [filePath, sites] of buildVerboseSiteMap(ruleDiagnostics)) {
|
|
16044
|
-
if (sites.length === 0) {
|
|
16045
|
-
lines.push(highlighter.gray(`${WARNING_DETAIL_INDENT}${filePath}`));
|
|
16046
|
-
continue;
|
|
16047
|
-
}
|
|
16048
|
-
for (const site of sites) {
|
|
16049
|
-
lines.push(highlighter.gray(`${WARNING_DETAIL_INDENT}${filePath}:${site.line}`));
|
|
16050
|
-
if (site.suppressionHint) lines.push(highlighter.gray(`${WARNING_DETAIL_INDENT} ↳ ${site.suppressionHint}`));
|
|
16051
|
-
}
|
|
16048
|
+
if (fixRecipeLine) lines.push(highlighter.gray(`${TOP_ERROR_DETAIL_INDENT}${fixRecipeLine}`));
|
|
16052
16049
|
}
|
|
16050
|
+
const renderCodeFrame = severity === "error" || renderEverySite;
|
|
16051
|
+
const sites = renderEverySite ? ruleDiagnostics : [representative];
|
|
16052
|
+
for (const cluster of clusterNearbyDiagnostics(sites)) lines.push(...buildDiagnosticClusterLines(cluster, resolveSourceRoot, renderCodeFrame));
|
|
16053
16053
|
return lines;
|
|
16054
16054
|
};
|
|
16055
16055
|
const selectErrorRuleGroups = (diagnostics, rulePriority) => buildSortedRuleGroups(diagnostics.filter((diagnostic) => diagnostic.severity === "error"), rulePriority);
|
|
16056
16056
|
const selectTopErrorRuleGroups = (diagnostics, limit, rulePriority) => selectErrorRuleGroups(diagnostics, rulePriority).slice(0, limit);
|
|
16057
|
-
const
|
|
16058
|
-
const
|
|
16059
|
-
|
|
16057
|
+
const buildOverflowSummaryLine = (diagnostics, rulePriority) => {
|
|
16058
|
+
const errorRuleGroups = selectErrorRuleGroups(diagnostics, rulePriority);
|
|
16059
|
+
const shownErrorRuleCount = Math.min(3, errorRuleGroups.length);
|
|
16060
|
+
if (diagnostics.length <= shownErrorRuleCount) return void 0;
|
|
16061
|
+
const hiddenErrorRuleCount = errorRuleGroups.length - shownErrorRuleCount;
|
|
16062
|
+
const warningCount = diagnostics.filter((diagnostic) => diagnostic.severity === "warning").length;
|
|
16063
|
+
const parts = [];
|
|
16064
|
+
if (hiddenErrorRuleCount > 0) {
|
|
16065
|
+
const ruleNoun = hiddenErrorRuleCount === 1 ? "rule" : "rules";
|
|
16066
|
+
parts.push(highlighter.bold(highlighter.error(`+${hiddenErrorRuleCount} more ${ruleNoun}`)));
|
|
16067
|
+
}
|
|
16068
|
+
if (warningCount > 0) {
|
|
16069
|
+
const warningNoun = warningCount === 1 ? "warning" : "warnings";
|
|
16070
|
+
parts.push(highlighter.bold(highlighter.warn(`+${warningCount} optional ${warningNoun}`)));
|
|
16071
|
+
}
|
|
16072
|
+
const command = highlighter.bold(highlighter.info("npx react-doctor@latest --verbose"));
|
|
16073
|
+
return ` ${parts.length > 0 ? `${parts.join(highlighter.dim(" and "))} ${highlighter.dim("- run")}` : highlighter.dim("Run")} ${command} ${highlighter.dim("for details")}`;
|
|
16060
16074
|
};
|
|
16061
16075
|
const getTopErrorRuleKeys = (diagnostics, limit, rulePriority) => new Set(selectTopErrorRuleGroups(diagnostics, limit, rulePriority).map(([ruleKey]) => ruleKey));
|
|
16062
|
-
const
|
|
16063
|
-
const
|
|
16064
|
-
|
|
16065
|
-
|
|
16066
|
-
|
|
16076
|
+
const buildTopErrorsSection = (diagnostics, resolveSourceRoot, rulePriority) => {
|
|
16077
|
+
const topRuleGroups = selectErrorRuleGroups(diagnostics, rulePriority).slice(0, 3);
|
|
16078
|
+
if (topRuleGroups.length === 0) return {
|
|
16079
|
+
lines: [],
|
|
16080
|
+
blockOffsets: []
|
|
16081
|
+
};
|
|
16067
16082
|
const lines = [
|
|
16068
|
-
|
|
16083
|
+
buildSectionDivider(),
|
|
16069
16084
|
` ${highlighter.bold(`Top ${topRuleGroups.length} ${topRuleGroups.length === 1 ? "error" : "errors"} you should fix`)}`,
|
|
16070
16085
|
""
|
|
16071
16086
|
];
|
|
16087
|
+
const blockOffsets = [];
|
|
16072
16088
|
for (const [ruleKey, ruleDiagnostics] of topRuleGroups) {
|
|
16073
|
-
|
|
16089
|
+
blockOffsets.push(lines.length);
|
|
16090
|
+
lines.push(...buildRuleDetailBlock(ruleKey, ruleDiagnostics, resolveSourceRoot, false, false));
|
|
16074
16091
|
lines.push("");
|
|
16075
16092
|
}
|
|
16076
|
-
|
|
16077
|
-
|
|
16078
|
-
|
|
16079
|
-
|
|
16080
|
-
const warningDiagnostics = diagnostics.filter((diagnostic) => diagnostic.severity === "warning");
|
|
16081
|
-
if (warningDiagnostics.length === 0) return [];
|
|
16082
|
-
const sortedRuleGroups = buildSortedRuleGroups(warningDiagnostics, rulePriority);
|
|
16083
|
-
const shownRuleGroups = sortedRuleGroups.slice(0, 10);
|
|
16084
|
-
const hiddenRuleCount = sortedRuleGroups.length - shownRuleGroups.length;
|
|
16085
|
-
const ruleNameColumnWidth = computeRuleNameColumnWidth(shownRuleGroups.map(([ruleKey]) => ruleKey));
|
|
16086
|
-
const lines = [
|
|
16087
|
-
highlighter.dim(` ${"─".repeat(60)}`),
|
|
16088
|
-
` ${highlighter.bold(`${warningDiagnostics.length} ${warningDiagnostics.length === 1 ? "warning" : "warnings"}`)}`,
|
|
16089
|
-
""
|
|
16090
|
-
];
|
|
16091
|
-
for (const [ruleKey, ruleDiagnostics] of shownRuleGroups) lines.push(buildWarningHeaderLine(ruleKey, ruleDiagnostics.length, ruleNameColumnWidth));
|
|
16092
|
-
if (hiddenRuleCount > 0) lines.push(buildMoreRulesLine(hiddenRuleCount, "warnings", highlighter.warn));
|
|
16093
|
-
return lines;
|
|
16093
|
+
return {
|
|
16094
|
+
lines,
|
|
16095
|
+
blockOffsets
|
|
16096
|
+
};
|
|
16094
16097
|
};
|
|
16095
|
-
const buildCategoryBreakdownLines = (diagnostics, rulePriority) => buildCategoryDiagnosticGroups(diagnostics, rulePriority).map(buildCompactCategoryLine);
|
|
16096
16098
|
const joinSections = (...sections) => {
|
|
16097
16099
|
const lines = [];
|
|
16100
|
+
const sectionStarts = [];
|
|
16098
16101
|
for (const section of sections) {
|
|
16099
|
-
if (section.length === 0)
|
|
16102
|
+
if (section.length === 0) {
|
|
16103
|
+
sectionStarts.push(null);
|
|
16104
|
+
continue;
|
|
16105
|
+
}
|
|
16100
16106
|
if (lines.length > 0) lines.push("");
|
|
16107
|
+
sectionStarts.push(lines.length);
|
|
16101
16108
|
lines.push(...section);
|
|
16102
16109
|
}
|
|
16103
16110
|
if (lines.length > 0 && lines[lines.length - 1] !== "") lines.push("");
|
|
16104
|
-
return
|
|
16111
|
+
return {
|
|
16112
|
+
lines,
|
|
16113
|
+
sectionStarts
|
|
16114
|
+
};
|
|
16105
16115
|
};
|
|
16106
16116
|
const buildCountsSummaryLines = (diagnostics) => {
|
|
16107
16117
|
const totalIssueCount = diagnostics.length;
|
|
@@ -16116,19 +16126,36 @@ const buildCountsSummaryLines = (diagnostics) => {
|
|
|
16116
16126
|
* single Effect.forEach over Console.log so failures or fiber
|
|
16117
16127
|
* interruption produce predictable partial output.
|
|
16118
16128
|
*/
|
|
16119
|
-
const printDiagnostics = (diagnostics, isVerbose, sourceRoot, rulePriority, isAgentEnvironment = false) => Effect.gen(function* () {
|
|
16129
|
+
const printDiagnostics = (diagnostics, isVerbose, sourceRoot, rulePriority, isAgentEnvironment = false, onboarding = {}) => Effect.gen(function* () {
|
|
16130
|
+
const sectionPause = onboarding.sectionPause ?? Effect.void;
|
|
16131
|
+
const animateCountUp = onboarding.animateCountUp ?? false;
|
|
16120
16132
|
const resolveSourceRoot = typeof sourceRoot === "function" ? sourceRoot : () => sourceRoot;
|
|
16121
16133
|
let detailLines;
|
|
16122
|
-
|
|
16123
|
-
|
|
16124
|
-
const
|
|
16125
|
-
|
|
16126
|
-
|
|
16127
|
-
|
|
16128
|
-
|
|
16134
|
+
let topErrorBlockOffsets = [];
|
|
16135
|
+
if (!isVerbose) {
|
|
16136
|
+
const topErrors = buildTopErrorsSection(diagnostics, resolveSourceRoot, rulePriority);
|
|
16137
|
+
detailLines = topErrors.lines;
|
|
16138
|
+
topErrorBlockOffsets = topErrors.blockOffsets;
|
|
16139
|
+
} else detailLines = buildSortedRuleGroups(diagnostics, rulePriority).flatMap(([ruleKey, ruleDiagnostics]) => {
|
|
16140
|
+
return [...buildRuleDetailBlock(ruleKey, ruleDiagnostics, resolveSourceRoot, true, isAgentEnvironment), ""];
|
|
16141
|
+
});
|
|
16142
|
+
const overflowLine = isVerbose ? void 0 : buildOverflowSummaryLine(diagnostics, rulePriority);
|
|
16143
|
+
const categoryTallies = buildCategoryDiagnosticGroups(diagnostics, rulePriority).map(buildCategoryTally);
|
|
16144
|
+
const categoryLines = buildCategoryTallyLines(categoryTallies);
|
|
16145
|
+
const { lines, sectionStarts } = joinSections(categoryLines, buildCountsSummaryLines(diagnostics), detailLines, overflowLine ? [overflowLine] : []);
|
|
16146
|
+
const [categoryStart, , detailStart] = sectionStarts;
|
|
16147
|
+
const pauseBeforeLineIndices = detailStart == null ? /* @__PURE__ */ new Set() : new Set(topErrorBlockOffsets.map((offset) => detailStart + offset));
|
|
16148
|
+
let lineIndex = 0;
|
|
16149
|
+
while (lineIndex < lines.length) {
|
|
16150
|
+
if (animateCountUp && lineIndex === categoryStart && categoryLines.length > 0) {
|
|
16151
|
+
yield* printCategoryCountUp(categoryTallies);
|
|
16152
|
+
lineIndex += categoryLines.length;
|
|
16153
|
+
continue;
|
|
16154
|
+
}
|
|
16155
|
+
if (pauseBeforeLineIndices.has(lineIndex)) yield* sectionPause;
|
|
16156
|
+
yield* Console.log(lines[lineIndex]);
|
|
16157
|
+
lineIndex += 1;
|
|
16129
16158
|
}
|
|
16130
|
-
const lines = joinSections(buildCategoryBreakdownLines(diagnostics, rulePriority), buildCountsSummaryLines(diagnostics), detailLines, isVerbose ? [] : buildWarningsListLines(diagnostics, rulePriority));
|
|
16131
|
-
for (const line of lines) yield* Console.log(line);
|
|
16132
16159
|
});
|
|
16133
16160
|
const formatElapsedTime = (elapsedMilliseconds) => {
|
|
16134
16161
|
if (elapsedMilliseconds < 1e3) return `${Math.round(elapsedMilliseconds)}ms`;
|
|
@@ -16166,6 +16193,44 @@ const computeProjectedScore = async (topErrorSource, rescoreSource, currentScore
|
|
|
16166
16193
|
if (!potentialScore || potentialScore.score <= currentScore.score) return null;
|
|
16167
16194
|
return potentialScore.score;
|
|
16168
16195
|
};
|
|
16196
|
+
const FORCE_ONBOARDING_ENV_VAR = "REACT_DOCTOR_FORCE_ONBOARDING";
|
|
16197
|
+
const FALSY_FLAG_VALUES = new Set([
|
|
16198
|
+
"",
|
|
16199
|
+
"0",
|
|
16200
|
+
"false"
|
|
16201
|
+
]);
|
|
16202
|
+
const isOnboardingForced = (environment = process.env) => {
|
|
16203
|
+
const value = environment[FORCE_ONBOARDING_ENV_VAR];
|
|
16204
|
+
return value !== void 0 && !FALSY_FLAG_VALUES.has(value.toLowerCase());
|
|
16205
|
+
};
|
|
16206
|
+
const onboardingSectionPause = (shouldPace) => shouldPace ? Effect.sleep(850) : Effect.void;
|
|
16207
|
+
const shouldRecordOnboarding = (input) => input.paceOnboardingSections && !input.forceOnboarding && !input.verbose && !input.isNonInteractiveEnvironment;
|
|
16208
|
+
const canAnimateOnboarding = (stream = process.stdout) => {
|
|
16209
|
+
if (!(stream.isTTY === true && (stream.columns ?? 0) > 0 && process.env.TERM !== "dumb")) return false;
|
|
16210
|
+
return isOnboardingForced() || !isCiEnvironment();
|
|
16211
|
+
};
|
|
16212
|
+
//#endregion
|
|
16213
|
+
//#region src/cli/utils/onboarding-state.ts
|
|
16214
|
+
const GLOBAL_CONFIG_PROJECT_NAME$1 = "react-doctor";
|
|
16215
|
+
const ONBOARDED_AT_KEY = "onboardedAt";
|
|
16216
|
+
const getOnboardingStore = (options = {}) => new Conf({
|
|
16217
|
+
projectName: GLOBAL_CONFIG_PROJECT_NAME$1,
|
|
16218
|
+
cwd: options.cwd
|
|
16219
|
+
});
|
|
16220
|
+
const hasCompletedOnboarding = (options = {}) => {
|
|
16221
|
+
try {
|
|
16222
|
+
return typeof getOnboardingStore(options).get(ONBOARDED_AT_KEY) === "string";
|
|
16223
|
+
} catch {
|
|
16224
|
+
return true;
|
|
16225
|
+
}
|
|
16226
|
+
};
|
|
16227
|
+
const markOnboardingComplete = (options = {}) => {
|
|
16228
|
+
try {
|
|
16229
|
+
const store = getOnboardingStore(options);
|
|
16230
|
+
if (typeof store.get(ONBOARDED_AT_KEY) === "string") return;
|
|
16231
|
+
store.set(ONBOARDED_AT_KEY, (/* @__PURE__ */ new Date()).toISOString());
|
|
16232
|
+
} catch {}
|
|
16233
|
+
};
|
|
16169
16234
|
//#endregion
|
|
16170
16235
|
//#region src/cli/utils/render-project-detection.ts
|
|
16171
16236
|
const printProjectDetection = (_input) => Effect.void;
|
|
@@ -16182,8 +16247,6 @@ const RAINBOW_HUE_SHIFT_PER_FRAME = 9;
|
|
|
16182
16247
|
const RAINBOW_GRADIENT_WIDTH = 80;
|
|
16183
16248
|
const RAINBOW_OKLCH_LIGHTNESS = .638;
|
|
16184
16249
|
const RAINBOW_OKLCH_CHROMA = .129;
|
|
16185
|
-
const easeOutCubic = (progress) => 1 - (1 - progress) ** 3;
|
|
16186
|
-
const sleep = (milliseconds) => Effect.promise(() => new Promise((resolve) => setTimeout(resolve, milliseconds)));
|
|
16187
16250
|
const buildScoreBarSegments = (filledCount) => {
|
|
16188
16251
|
const emptyCount = 50 - filledCount;
|
|
16189
16252
|
return {
|
|
@@ -16253,9 +16316,6 @@ const buildFaceRenderedLines = (score) => {
|
|
|
16253
16316
|
const colorize = (text) => colorizeByScore(text, score);
|
|
16254
16317
|
return buildRawFaceLines(score).map(colorize);
|
|
16255
16318
|
};
|
|
16256
|
-
const writeScoreHeaderLine = (line) => Effect.sync(() => {
|
|
16257
|
-
process.stdout.write(line);
|
|
16258
|
-
});
|
|
16259
16319
|
const buildScoreLine = (displayScore, finalScore, label) => {
|
|
16260
16320
|
const scoreNumber = colorizeByScore(`${displayScore}`, finalScore);
|
|
16261
16321
|
const scoreLabel = colorizeByScore(label, finalScore);
|
|
@@ -16294,37 +16354,37 @@ const printAnimatedScore = (scoreFaceLine, barFaceLine, score, label, potentialS
|
|
|
16294
16354
|
const progress = easeOutCubic(frame / 40);
|
|
16295
16355
|
const animatedScore = Math.round(score * progress);
|
|
16296
16356
|
if (isPerfectScore) {
|
|
16297
|
-
yield*
|
|
16357
|
+
yield* writeStdout(`${frame === 0 ? "" : "\x1B[4A"}\r${buildRainbowScoreHeaderFrame({
|
|
16298
16358
|
score,
|
|
16299
16359
|
displayScore: animatedScore,
|
|
16300
16360
|
label,
|
|
16301
16361
|
frame
|
|
16302
16362
|
})}`);
|
|
16303
|
-
if (frame < 40) yield* sleep(50);
|
|
16363
|
+
if (frame < 40) yield* Effect.sleep(50);
|
|
16304
16364
|
continue;
|
|
16305
16365
|
}
|
|
16306
16366
|
const animatedScoreLine = buildScoreLine(animatedScore, score, label);
|
|
16307
16367
|
const animatedBarLine = frame === 40 && potentialScore !== void 0 ? buildProjectedScoreBar(score, potentialScore) : buildScoreBar(animatedScore, score);
|
|
16308
|
-
yield*
|
|
16309
|
-
if (frame < 40) yield* sleep(50);
|
|
16368
|
+
yield* writeStdout(`${frame === 0 ? "" : "\x1B[2A"}\r${buildScoreHeaderLine(scoreFaceLine, animatedScoreLine)}\n\r${buildScoreHeaderLine(barFaceLine, animatedBarLine)}\n`);
|
|
16369
|
+
if (frame < 40) yield* Effect.sleep(50);
|
|
16310
16370
|
}
|
|
16311
16371
|
if (!isPerfectScore) return;
|
|
16312
16372
|
for (let frame = 0; frame < 16; frame += 1) {
|
|
16313
|
-
yield*
|
|
16373
|
+
yield* writeStdout(`\x1b[4A\r${buildRainbowScoreHeaderFrame({
|
|
16314
16374
|
score,
|
|
16315
16375
|
displayScore: score,
|
|
16316
16376
|
label,
|
|
16317
16377
|
frame
|
|
16318
16378
|
})}`);
|
|
16319
|
-
yield* sleep(50);
|
|
16379
|
+
yield* Effect.sleep(50);
|
|
16320
16380
|
}
|
|
16321
|
-
yield*
|
|
16381
|
+
yield* writeStdout(`\x1b[4A\r${buildFinalPerfectScoreHeaderFrame(score, label, 16)}\x1b[2A`);
|
|
16322
16382
|
});
|
|
16323
16383
|
const printScoreHeader = (scoreResult, potentialScore) => Effect.gen(function* () {
|
|
16324
16384
|
const isPerfectScore = scoreResult.score === 100;
|
|
16325
16385
|
const renderedFaceLines = buildFaceRenderedLines(scoreResult.score);
|
|
16326
16386
|
const rawFaceLines = buildRawFaceLines(scoreResult.score);
|
|
16327
|
-
const shouldAnimate = !isSpinnerSilent() &&
|
|
16387
|
+
const shouldAnimate = !isSpinnerSilent() && canAnimateOnboarding(process.stdout);
|
|
16328
16388
|
const displayScore = shouldAnimate ? 0 : scoreResult.score;
|
|
16329
16389
|
const rightColumnLines = [
|
|
16330
16390
|
buildScoreLine(displayScore, scoreResult.score, scoreResult.label),
|
|
@@ -16350,9 +16410,19 @@ const printScoreHeader = (scoreResult, potentialScore) => Effect.gen(function* (
|
|
|
16350
16410
|
}));
|
|
16351
16411
|
yield* Console.log("");
|
|
16352
16412
|
if (shouldAnimate) {
|
|
16353
|
-
yield*
|
|
16413
|
+
yield* writeStdout("\x1B[5A");
|
|
16354
16414
|
yield* printAnimatedScore(renderedFaceLines[0], renderedFaceLines[1], scoreResult.score, scoreResult.label, potentialScore);
|
|
16355
|
-
yield*
|
|
16415
|
+
yield* writeStdout("\x1B[3B");
|
|
16416
|
+
}
|
|
16417
|
+
});
|
|
16418
|
+
const animateScoreProjection = (scoreResult, potentialScore, linesBelowBar) => Effect.gen(function* () {
|
|
16419
|
+
if (scoreResult.score === 100 || potentialScore <= scoreResult.score) return;
|
|
16420
|
+
const barFaceLine = buildFaceRenderedLines(scoreResult.score)[1] ?? "";
|
|
16421
|
+
for (let frame = 1; frame <= 16; frame += 1) {
|
|
16422
|
+
const progress = easeOutCubic(frame / 16);
|
|
16423
|
+
const displayedPotential = scoreResult.score + (potentialScore - scoreResult.score) * progress;
|
|
16424
|
+
yield* writeStdout(`\x1b[${linesBelowBar}A\r${buildScoreHeaderLine(barFaceLine, buildProjectedScoreBar(scoreResult.score, displayedPotential))}\x1b[${linesBelowBar}B\r`);
|
|
16425
|
+
if (frame < 16) yield* Effect.sleep(35);
|
|
16356
16426
|
}
|
|
16357
16427
|
});
|
|
16358
16428
|
const printBrandingOnlyHeader = Effect.gen(function* () {
|
|
@@ -16387,23 +16457,30 @@ const buildShareUrl = (diagnostics, scoreResult, projectName) => {
|
|
|
16387
16457
|
if (affectedFileCount > 0) params.set("f", String(affectedFileCount));
|
|
16388
16458
|
return `${SHARE_BASE_URL}?${params.toString()}`;
|
|
16389
16459
|
};
|
|
16390
|
-
const
|
|
16391
|
-
|
|
16392
|
-
|
|
16393
|
-
const message = diagnostics.some((diagnostic) => diagnostic.severity === "warning") ? `Run ${command} to see each warning explained with its fix` : `Run ${command} to see each issue explained with its fix`;
|
|
16394
|
-
yield* Console.log(highlighter.dim(` Tip: ${message}`));
|
|
16395
|
-
});
|
|
16396
|
-
const printDocsNote = () => Effect.gen(function* () {
|
|
16460
|
+
const printFooter = (input) => Effect.gen(function* () {
|
|
16461
|
+
yield* Console.log("");
|
|
16462
|
+
yield* Console.log(buildSectionDivider());
|
|
16397
16463
|
yield* Console.log("");
|
|
16464
|
+
if (!input.isOffline) {
|
|
16465
|
+
const shareUrl = buildShareUrl(input.diagnostics, input.scoreResult, input.projectName);
|
|
16466
|
+
yield* Console.log(` ${highlighter.bold("Share:")} ${highlighter.info(shareUrl)}`);
|
|
16467
|
+
yield* Console.log(highlighter.dim(" Tell others how you did on socials"));
|
|
16468
|
+
yield* Console.log("");
|
|
16469
|
+
}
|
|
16398
16470
|
yield* Console.log(` ${highlighter.bold("Docs:")} ${highlighter.info(DOCS_URL)}`);
|
|
16399
|
-
yield* Console.log(highlighter.dim("
|
|
16471
|
+
yield* Console.log(highlighter.dim(" Learn more about fixing issues, setting up CI/CD, and configuring rules with a config file"));
|
|
16472
|
+
yield* Console.log("");
|
|
16473
|
+
yield* Console.log(` ${highlighter.bold("GitHub:")} ${highlighter.info(CANONICAL_GITHUB_URL)}`);
|
|
16474
|
+
yield* Console.log(highlighter.dim(" Report issues and star the repository!"));
|
|
16400
16475
|
});
|
|
16401
16476
|
const printSummary = (input) => Effect.gen(function* () {
|
|
16402
16477
|
if (input.scoreResult) {
|
|
16403
|
-
|
|
16478
|
+
const animateProjection = Boolean(input.animateProjection) && input.potentialScore != null && !input.verbose;
|
|
16479
|
+
yield* printScoreHeader(input.scoreResult, animateProjection ? void 0 : input.potentialScore ?? void 0);
|
|
16404
16480
|
if (input.potentialScore != null) {
|
|
16405
16481
|
const improvement = input.potentialScore - input.scoreResult.score;
|
|
16406
16482
|
yield* Console.log(highlighter.gray(" You could improve ") + colorizeByScore(`+${improvement}%`, input.potentialScore) + highlighter.gray(` by fixing the top 3 issues`));
|
|
16483
|
+
if (animateProjection) yield* animateScoreProjection(input.scoreResult, input.potentialScore, 5);
|
|
16407
16484
|
}
|
|
16408
16485
|
} else yield* printNoScoreHeader(input.noScoreMessage);
|
|
16409
16486
|
const diagnosticsDirectory = yield* Effect.try({
|
|
@@ -16411,12 +16488,6 @@ const printSummary = (input) => Effect.gen(function* () {
|
|
|
16411
16488
|
catch: (cause) => cause
|
|
16412
16489
|
}).pipe(Effect.orElseSucceed(() => null));
|
|
16413
16490
|
if (diagnosticsDirectory !== null && input.verbose) yield* Console.log(highlighter.gray(` Full diagnostics written to ${diagnosticsDirectory}`));
|
|
16414
|
-
if (!input.isOffline) {
|
|
16415
|
-
yield* Console.log("");
|
|
16416
|
-
const shareUrl = buildShareUrl(input.diagnostics, input.scoreResult, input.projectName);
|
|
16417
|
-
yield* Console.log(` ${highlighter.bold("Share:")} ${highlighter.info(shareUrl)}`);
|
|
16418
|
-
yield* Console.log("");
|
|
16419
|
-
}
|
|
16420
16491
|
});
|
|
16421
16492
|
//#endregion
|
|
16422
16493
|
//#region src/cli/utils/cli-logger.ts
|
|
@@ -16677,9 +16748,12 @@ const runInspectWithRuntime = async (directory, options, userConfig, hasConfigOv
|
|
|
16677
16748
|
else runConsole(Console.error(highlighter.error(lintFailureReason)));
|
|
16678
16749
|
const inspectDiagnostics = output.diagnostics;
|
|
16679
16750
|
const score = didLintFail ? null : output.score;
|
|
16751
|
+
const elapsedMilliseconds = performance.now() - startTime;
|
|
16752
|
+
const forceOnboarding = isOnboardingForced();
|
|
16753
|
+
const paceOnboardingSections = !options.silent && !options.scoreOnly && !options.suppressRendering && !options.verbose && canAnimateOnboarding(process.stdout) && (forceOnboarding || !hasCompletedOnboarding());
|
|
16680
16754
|
const finalizeInput = {
|
|
16681
16755
|
options,
|
|
16682
|
-
elapsedMilliseconds
|
|
16756
|
+
elapsedMilliseconds,
|
|
16683
16757
|
diagnostics: inspectDiagnostics,
|
|
16684
16758
|
score,
|
|
16685
16759
|
project: output.project,
|
|
@@ -16695,6 +16769,12 @@ const runInspectWithRuntime = async (directory, options, userConfig, hasConfigOv
|
|
|
16695
16769
|
scanElapsedMilliseconds: output.scanElapsedMilliseconds
|
|
16696
16770
|
};
|
|
16697
16771
|
const result = await Effect.runPromise(finalizeAndRender(finalizeInput).pipe(options.silent ? Effect.provideService(Console.Console, silentConsole) : (program) => program));
|
|
16772
|
+
if (shouldRecordOnboarding({
|
|
16773
|
+
paceOnboardingSections,
|
|
16774
|
+
forceOnboarding,
|
|
16775
|
+
verbose: options.verbose,
|
|
16776
|
+
isNonInteractiveEnvironment: options.isNonInteractiveEnvironment
|
|
16777
|
+
})) markOnboardingComplete();
|
|
16698
16778
|
recordScanMetrics({
|
|
16699
16779
|
result,
|
|
16700
16780
|
mode: isDiffMode ? "diff" : "full",
|
|
@@ -16738,16 +16818,20 @@ const finalizeAndRender = (input) => Effect.gen(function* () {
|
|
|
16738
16818
|
else yield* Console.log(highlighter.gray(noScoreMessage));
|
|
16739
16819
|
return buildResult();
|
|
16740
16820
|
}
|
|
16821
|
+
const animateRender = !options.silent && !options.verbose && canAnimateOnboarding(process.stdout);
|
|
16822
|
+
const pause = onboardingSectionPause(animateRender);
|
|
16741
16823
|
const surfaceDiagnostics = filterDiagnosticsForSurface([...diagnostics], options.outputSurface, userConfig);
|
|
16742
16824
|
const demotedDiagnosticCount = diagnostics.length - surfaceDiagnostics.length;
|
|
16743
16825
|
const lintSourceFileCount = options.includePaths.length > 0 ? options.includePaths.length : project.sourceFileCount;
|
|
16744
16826
|
if (surfaceDiagnostics.length === 0) {
|
|
16827
|
+
yield* pause;
|
|
16745
16828
|
if (hasSkippedChecks) {
|
|
16746
16829
|
const skippedLabel = skippedChecks.join(" and ");
|
|
16747
16830
|
yield* Console.warn(highlighter.warn(`No issues detected, but ${skippedLabel} checks failed — results are incomplete.`));
|
|
16748
16831
|
} else if (demotedDiagnosticCount > 0) yield* Console.log(highlighter.success(`No issues found! (${demotedDiagnosticCount} demoted from the ${options.outputSurface} surface — see config.surfaces.)`));
|
|
16749
16832
|
else yield* Console.log(highlighter.success("No issues found!"));
|
|
16750
16833
|
yield* Console.log("");
|
|
16834
|
+
yield* pause;
|
|
16751
16835
|
if (hasSkippedChecks) {
|
|
16752
16836
|
yield* printBrandingOnlyHeader;
|
|
16753
16837
|
yield* Console.log(highlighter.gray(" Score not shown — some checks could not complete."));
|
|
@@ -16755,8 +16839,12 @@ const finalizeAndRender = (input) => Effect.gen(function* () {
|
|
|
16755
16839
|
else yield* printNoScoreHeader(noScoreMessage);
|
|
16756
16840
|
return buildResult();
|
|
16757
16841
|
}
|
|
16842
|
+
yield* pause;
|
|
16758
16843
|
yield* Console.log("");
|
|
16759
|
-
yield* printDiagnostics([...surfaceDiagnostics], options.verbose, directory, buildRulePriorityMap([score]), isCodingAgentEnvironment()
|
|
16844
|
+
yield* printDiagnostics([...surfaceDiagnostics], options.verbose, directory, buildRulePriorityMap([score]), isCodingAgentEnvironment(), {
|
|
16845
|
+
sectionPause: pause,
|
|
16846
|
+
animateCountUp: animateRender
|
|
16847
|
+
});
|
|
16760
16848
|
if (options.isNonInteractiveEnvironment && options.outputSurface !== "prComment") yield* printAgentGuidance();
|
|
16761
16849
|
if (demotedDiagnosticCount > 0) {
|
|
16762
16850
|
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.`));
|
|
@@ -16764,24 +16852,29 @@ const finalizeAndRender = (input) => Effect.gen(function* () {
|
|
|
16764
16852
|
}
|
|
16765
16853
|
const potentialScore = score ? yield* Effect.promise(() => computeProjectedScore([...surfaceDiagnostics], [...surfaceDiagnostics], score)) : null;
|
|
16766
16854
|
const shouldShowShareLink = !options.noScore && options.share && !options.isCi;
|
|
16855
|
+
yield* pause;
|
|
16767
16856
|
yield* printSummary({
|
|
16768
16857
|
diagnostics: [...surfaceDiagnostics],
|
|
16769
16858
|
elapsedMilliseconds,
|
|
16770
16859
|
scoreResult: score,
|
|
16771
16860
|
potentialScore,
|
|
16772
|
-
projectName: project.projectName,
|
|
16773
16861
|
totalSourceFileCount: lintSourceFileCount,
|
|
16774
16862
|
noScoreMessage,
|
|
16775
|
-
|
|
16776
|
-
|
|
16863
|
+
verbose: options.verbose,
|
|
16864
|
+
animateProjection: animateRender
|
|
16777
16865
|
});
|
|
16778
16866
|
if (hasSkippedChecks) {
|
|
16779
16867
|
const skippedLabel = skippedChecks.join(" and ");
|
|
16780
16868
|
yield* Console.log("");
|
|
16781
16869
|
yield* Console.warn(highlighter.warn(` Note: ${skippedLabel} checks failed — score may be incomplete.`));
|
|
16782
16870
|
}
|
|
16783
|
-
yield*
|
|
16784
|
-
yield*
|
|
16871
|
+
yield* pause;
|
|
16872
|
+
yield* printFooter({
|
|
16873
|
+
diagnostics: [...surfaceDiagnostics],
|
|
16874
|
+
scoreResult: score,
|
|
16875
|
+
projectName: project.projectName,
|
|
16876
|
+
isOffline: !shouldShowShareLink
|
|
16877
|
+
});
|
|
16785
16878
|
return buildResult();
|
|
16786
16879
|
});
|
|
16787
16880
|
//#endregion
|
|
@@ -18218,7 +18311,6 @@ const copyToClipboard = (text) => {
|
|
|
18218
18311
|
//#endregion
|
|
18219
18312
|
//#region src/cli/utils/handoff-to-agent.ts
|
|
18220
18313
|
const CLIPBOARD_CHOICE = "clipboard";
|
|
18221
|
-
const PRINT_CHOICE = "print";
|
|
18222
18314
|
const SKIP_CHOICE = "skip";
|
|
18223
18315
|
const printPayload = (payload) => {
|
|
18224
18316
|
cliLogger.break();
|
|
@@ -18232,10 +18324,11 @@ const detectLaunchableAgents = async () => {
|
|
|
18232
18324
|
};
|
|
18233
18325
|
const handoffToAgent = async (input) => {
|
|
18234
18326
|
if (!input.interactive || input.diagnostics.length === 0) return;
|
|
18327
|
+
cliLogger.break();
|
|
18235
18328
|
const { handoffTarget } = await prompts({
|
|
18236
18329
|
type: "select",
|
|
18237
18330
|
name: "handoffTarget",
|
|
18238
|
-
message: "
|
|
18331
|
+
message: "Would you like to spawn an agent to fix these issues?",
|
|
18239
18332
|
choices: [
|
|
18240
18333
|
...(await detectLaunchableAgents()).map((agentId) => ({
|
|
18241
18334
|
title: getSkillAgentConfig(agentId).displayName,
|
|
@@ -18247,11 +18340,6 @@ const handoffToAgent = async (input) => {
|
|
|
18247
18340
|
description: "Paste into any agent or chat",
|
|
18248
18341
|
value: CLIPBOARD_CHOICE
|
|
18249
18342
|
},
|
|
18250
|
-
{
|
|
18251
|
-
title: "Print prompt",
|
|
18252
|
-
description: "Show the prompt below",
|
|
18253
|
-
value: PRINT_CHOICE
|
|
18254
|
-
},
|
|
18255
18343
|
{
|
|
18256
18344
|
title: "Skip",
|
|
18257
18345
|
description: "Don't hand off",
|
|
@@ -18263,7 +18351,6 @@ const handoffToAgent = async (input) => {
|
|
|
18263
18351
|
let handoffOutcome = "launch";
|
|
18264
18352
|
if (handoffTarget === void 0) handoffOutcome = "cancel";
|
|
18265
18353
|
else if (handoffTarget === SKIP_CHOICE) handoffOutcome = "skip";
|
|
18266
|
-
else if (handoffTarget === PRINT_CHOICE) handoffOutcome = "print";
|
|
18267
18354
|
else if (handoffTarget === CLIPBOARD_CHOICE) handoffOutcome = "clipboard";
|
|
18268
18355
|
recordCount(METRIC.agentHandoff, 1, {
|
|
18269
18356
|
outcome: handoffOutcome,
|
|
@@ -18275,10 +18362,6 @@ const handoffToAgent = async (input) => {
|
|
|
18275
18362
|
diagnostics: input.diagnostics,
|
|
18276
18363
|
projectName: input.projectName
|
|
18277
18364
|
});
|
|
18278
|
-
if (handoffTarget === PRINT_CHOICE) {
|
|
18279
|
-
printPayload(payload);
|
|
18280
|
-
return;
|
|
18281
|
-
}
|
|
18282
18365
|
if (handoffTarget === CLIPBOARD_CHOICE) {
|
|
18283
18366
|
if (await copyToClipboard(payload)) cliLogger.log("Copied the prompt to your clipboard.");
|
|
18284
18367
|
else printPayload(payload);
|
|
@@ -18395,6 +18478,35 @@ const printBrandedHeader = Effect.gen(function* () {
|
|
|
18395
18478
|
yield* Console.log("");
|
|
18396
18479
|
});
|
|
18397
18480
|
//#endregion
|
|
18481
|
+
//#region src/cli/utils/render-welcome.ts
|
|
18482
|
+
const HAPPY_FACE_LINES = [
|
|
18483
|
+
"┌─────┐",
|
|
18484
|
+
"│ ◠ ◠ │",
|
|
18485
|
+
"│ ▽ │",
|
|
18486
|
+
"└─────┘"
|
|
18487
|
+
];
|
|
18488
|
+
const typeLine = (linePrefix, text, style) => Effect.gen(function* () {
|
|
18489
|
+
const characters = [...text];
|
|
18490
|
+
for (let length = 1; length <= characters.length; length += 1) {
|
|
18491
|
+
yield* writeStdout(`\r${linePrefix}${style(characters.slice(0, length).join(""))}\x1b[K`);
|
|
18492
|
+
yield* Effect.sleep(32);
|
|
18493
|
+
}
|
|
18494
|
+
});
|
|
18495
|
+
const playWelcomeScene = () => Effect.gen(function* () {
|
|
18496
|
+
const face = HAPPY_FACE_LINES.map((line) => highlighter.success(line));
|
|
18497
|
+
const mouthPrefix = ` ${face[2] ?? ""} `;
|
|
18498
|
+
yield* writeStdout(`\n${face.map((line) => ` ${line}`).join("\n")}\n`);
|
|
18499
|
+
yield* writeStdout("\x1B[3A");
|
|
18500
|
+
yield* typeLine(` ${face[1] ?? ""} `, "Welcome to React Doctor", (fragment) => highlighter.bold(fragment));
|
|
18501
|
+
yield* Effect.sleep(500);
|
|
18502
|
+
yield* writeStdout("\x1B[1B");
|
|
18503
|
+
yield* typeLine(mouthPrefix, "I diagnose your React code for bugs, security & performance.", (fragment) => highlighter.dim(fragment));
|
|
18504
|
+
yield* Effect.sleep(WELCOME_EXPLANATION_HOLD_MS);
|
|
18505
|
+
yield* typeLine(mouthPrefix, "Let's scan your codebase...", (fragment) => highlighter.dim(fragment));
|
|
18506
|
+
yield* Effect.sleep(WELCOME_HOLD_MS);
|
|
18507
|
+
yield* writeStdout("\x1B[3A\r\x1B[0J");
|
|
18508
|
+
});
|
|
18509
|
+
//#endregion
|
|
18398
18510
|
//#region src/cli/utils/report-error.ts
|
|
18399
18511
|
/**
|
|
18400
18512
|
* Sends an error to Sentry — enriched with a fresh snapshot of the current run
|
|
@@ -18491,7 +18603,7 @@ const findLowestScoredScan = (completedScans) => {
|
|
|
18491
18603
|
return scoredScans.reduce((worst, scan) => scan.result.score.score < worst.result.score.score ? scan : worst);
|
|
18492
18604
|
};
|
|
18493
18605
|
const printMultiProjectSummary = (input) => Effect.gen(function* () {
|
|
18494
|
-
const { completedScans, userConfig, verbose } = input;
|
|
18606
|
+
const { completedScans, userConfig, verbose, isOffline, projectName } = input;
|
|
18495
18607
|
const surfaceDiagnostics = filterDiagnosticsForSurface(completedScans.flatMap((scan) => scan.result.diagnostics), "cli", userConfig);
|
|
18496
18608
|
const projectRootByDiagnostic = /* @__PURE__ */ new WeakMap();
|
|
18497
18609
|
for (const scan of completedScans) for (const diagnostic of scan.result.diagnostics) projectRootByDiagnostic.set(diagnostic, scan.result.project.rootDirectory);
|
|
@@ -18518,10 +18630,8 @@ const printMultiProjectSummary = (input) => Effect.gen(function* () {
|
|
|
18518
18630
|
elapsedMilliseconds: completedScans.reduce((sum, scan) => sum + scan.result.elapsedMilliseconds, 0),
|
|
18519
18631
|
scoreResult: aggregateScore,
|
|
18520
18632
|
potentialScore: lowestScoredScan ? yield* Effect.promise(() => computeProjectedScore(surfaceDiagnostics, lowestScoredScan.result.diagnostics, lowestScoredScan.result.score)) : null,
|
|
18521
|
-
projectName: completedScans.map((scan) => scan.result.project.projectName).join(", "),
|
|
18522
18633
|
totalSourceFileCount,
|
|
18523
18634
|
noScoreMessage: "Score unavailable.",
|
|
18524
|
-
isOffline: true,
|
|
18525
18635
|
verbose
|
|
18526
18636
|
});
|
|
18527
18637
|
const entries = completedScans.map((scan) => {
|
|
@@ -18536,9 +18646,12 @@ const printMultiProjectSummary = (input) => Effect.gen(function* () {
|
|
|
18536
18646
|
const longestProjectNameLength = Math.max(...entries.map((entry) => entry.projectName.length));
|
|
18537
18647
|
yield* Console.log("");
|
|
18538
18648
|
for (const entry of entries) yield* Console.log(buildSummaryLine(entry, longestProjectNameLength));
|
|
18539
|
-
yield*
|
|
18540
|
-
|
|
18541
|
-
|
|
18649
|
+
yield* printFooter({
|
|
18650
|
+
diagnostics: surfaceDiagnostics,
|
|
18651
|
+
scoreResult: aggregateScore,
|
|
18652
|
+
projectName,
|
|
18653
|
+
isOffline
|
|
18654
|
+
});
|
|
18542
18655
|
});
|
|
18543
18656
|
//#endregion
|
|
18544
18657
|
//#region src/cli/utils/prompt-install-setup.ts
|
|
@@ -18855,7 +18968,7 @@ const runExplain = async (fileLineArgument, context) => {
|
|
|
18855
18968
|
}
|
|
18856
18969
|
for (const diagnostic of matchingDiagnostics) {
|
|
18857
18970
|
const ruleIdentifier = `${diagnostic.plugin}/${diagnostic.rule}`;
|
|
18858
|
-
const severitySymbol = diagnostic.severity === "error" ? "
|
|
18971
|
+
const severitySymbol = diagnostic.severity === "error" ? "✖" : "⚠";
|
|
18859
18972
|
const colorizedRule = colorizeRuleByDiagnostic(ruleIdentifier, diagnostic.severity);
|
|
18860
18973
|
const severityLabel = colorizeRuleByDiagnostic(diagnostic.severity, diagnostic.severity);
|
|
18861
18974
|
cliLogger.log(`${severitySymbol} ${colorizedRule} ${highlighter.dim(`(${severityLabel})`)} — ${diagnostic.message}`);
|
|
@@ -18974,7 +19087,8 @@ const inspectAction = async (directory, flags) => {
|
|
|
18974
19087
|
});
|
|
18975
19088
|
return;
|
|
18976
19089
|
}
|
|
18977
|
-
if (!isQuiet) Effect.
|
|
19090
|
+
if (!isQuiet) if ((isOnboardingForced() || !hasCompletedOnboarding()) && canAnimateOnboarding(process.stdout)) await Effect.runPromise(playWelcomeScene());
|
|
19091
|
+
else Effect.runSync(printBrandedHeader);
|
|
18978
19092
|
const scanOptions = resolveCliInspectOptions(flags, userConfig);
|
|
18979
19093
|
const skipPrompts = shouldSkipPrompts({
|
|
18980
19094
|
yes: flags.yes,
|
|
@@ -19089,11 +19203,16 @@ const inspectAction = async (directory, flags) => {
|
|
|
19089
19203
|
});
|
|
19090
19204
|
if (!isQuiet && !isMultiProject) cliLogger.break();
|
|
19091
19205
|
}
|
|
19092
|
-
if (!isQuiet && isMultiProject && completedScans.length > 0)
|
|
19093
|
-
|
|
19094
|
-
|
|
19095
|
-
|
|
19096
|
-
|
|
19206
|
+
if (!isQuiet && isMultiProject && completedScans.length > 0) {
|
|
19207
|
+
const shouldShowShareLink = !scanOptions.noScore && (userConfig?.share ?? true) && !scanOptions.isCi;
|
|
19208
|
+
await Effect.runPromise(printMultiProjectSummary({
|
|
19209
|
+
completedScans,
|
|
19210
|
+
userConfig,
|
|
19211
|
+
verbose: Boolean(flags.verbose),
|
|
19212
|
+
isOffline: !shouldShowShareLink,
|
|
19213
|
+
projectName: path.basename(resolvedDirectory)
|
|
19214
|
+
}));
|
|
19215
|
+
}
|
|
19097
19216
|
finalizeScans({
|
|
19098
19217
|
diagnostics: allDiagnostics,
|
|
19099
19218
|
completedScans,
|
|
@@ -20038,4 +20157,4 @@ program.parseAsync(argv).then(() => flushSentry()).catch(async (error) => {
|
|
|
20038
20157
|
export {};
|
|
20039
20158
|
|
|
20040
20159
|
//# sourceMappingURL=cli.js.map
|
|
20041
|
-
//# debugId=
|
|
20160
|
+
//# debugId=005f503a-c838-5177-8bea-002799f23989
|
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]="a56b86f0-1c28-52ae-9677-12f5e67df34f")}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";
|
|
@@ -5312,6 +5312,81 @@ const checkReducedMotion = (rootDirectory) => {
|
|
|
5312
5312
|
if (result.status === 0) return [];
|
|
5313
5313
|
return [MISSING_REDUCED_MOTION_DIAGNOSTIC];
|
|
5314
5314
|
};
|
|
5315
|
+
var import_picocolors = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
5316
|
+
let p = process || {}, argv = p.argv || [], env = p.env || {};
|
|
5317
|
+
let isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
|
|
5318
|
+
let formatter = (open, close, replace = open) => (input) => {
|
|
5319
|
+
let string = "" + input, index = string.indexOf(close, open.length);
|
|
5320
|
+
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
5321
|
+
};
|
|
5322
|
+
let replaceClose = (string, close, replace, index) => {
|
|
5323
|
+
let result = "", cursor = 0;
|
|
5324
|
+
do {
|
|
5325
|
+
result += string.substring(cursor, index) + replace;
|
|
5326
|
+
cursor = index + close.length;
|
|
5327
|
+
index = string.indexOf(close, cursor);
|
|
5328
|
+
} while (~index);
|
|
5329
|
+
return result + string.substring(cursor);
|
|
5330
|
+
};
|
|
5331
|
+
let createColors = (enabled = isColorSupported) => {
|
|
5332
|
+
let f = enabled ? formatter : () => String;
|
|
5333
|
+
return {
|
|
5334
|
+
isColorSupported: enabled,
|
|
5335
|
+
reset: f("\x1B[0m", "\x1B[0m"),
|
|
5336
|
+
bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
5337
|
+
dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
5338
|
+
italic: f("\x1B[3m", "\x1B[23m"),
|
|
5339
|
+
underline: f("\x1B[4m", "\x1B[24m"),
|
|
5340
|
+
inverse: f("\x1B[7m", "\x1B[27m"),
|
|
5341
|
+
hidden: f("\x1B[8m", "\x1B[28m"),
|
|
5342
|
+
strikethrough: f("\x1B[9m", "\x1B[29m"),
|
|
5343
|
+
black: f("\x1B[30m", "\x1B[39m"),
|
|
5344
|
+
red: f("\x1B[31m", "\x1B[39m"),
|
|
5345
|
+
green: f("\x1B[32m", "\x1B[39m"),
|
|
5346
|
+
yellow: f("\x1B[33m", "\x1B[39m"),
|
|
5347
|
+
blue: f("\x1B[34m", "\x1B[39m"),
|
|
5348
|
+
magenta: f("\x1B[35m", "\x1B[39m"),
|
|
5349
|
+
cyan: f("\x1B[36m", "\x1B[39m"),
|
|
5350
|
+
white: f("\x1B[37m", "\x1B[39m"),
|
|
5351
|
+
gray: f("\x1B[90m", "\x1B[39m"),
|
|
5352
|
+
bgBlack: f("\x1B[40m", "\x1B[49m"),
|
|
5353
|
+
bgRed: f("\x1B[41m", "\x1B[49m"),
|
|
5354
|
+
bgGreen: f("\x1B[42m", "\x1B[49m"),
|
|
5355
|
+
bgYellow: f("\x1B[43m", "\x1B[49m"),
|
|
5356
|
+
bgBlue: f("\x1B[44m", "\x1B[49m"),
|
|
5357
|
+
bgMagenta: f("\x1B[45m", "\x1B[49m"),
|
|
5358
|
+
bgCyan: f("\x1B[46m", "\x1B[49m"),
|
|
5359
|
+
bgWhite: f("\x1B[47m", "\x1B[49m"),
|
|
5360
|
+
blackBright: f("\x1B[90m", "\x1B[39m"),
|
|
5361
|
+
redBright: f("\x1B[91m", "\x1B[39m"),
|
|
5362
|
+
greenBright: f("\x1B[92m", "\x1B[39m"),
|
|
5363
|
+
yellowBright: f("\x1B[93m", "\x1B[39m"),
|
|
5364
|
+
blueBright: f("\x1B[94m", "\x1B[39m"),
|
|
5365
|
+
magentaBright: f("\x1B[95m", "\x1B[39m"),
|
|
5366
|
+
cyanBright: f("\x1B[96m", "\x1B[39m"),
|
|
5367
|
+
whiteBright: f("\x1B[97m", "\x1B[39m"),
|
|
5368
|
+
bgBlackBright: f("\x1B[100m", "\x1B[49m"),
|
|
5369
|
+
bgRedBright: f("\x1B[101m", "\x1B[49m"),
|
|
5370
|
+
bgGreenBright: f("\x1B[102m", "\x1B[49m"),
|
|
5371
|
+
bgYellowBright: f("\x1B[103m", "\x1B[49m"),
|
|
5372
|
+
bgBlueBright: f("\x1B[104m", "\x1B[49m"),
|
|
5373
|
+
bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
|
|
5374
|
+
bgCyanBright: f("\x1B[106m", "\x1B[49m"),
|
|
5375
|
+
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
|
|
5376
|
+
};
|
|
5377
|
+
};
|
|
5378
|
+
module.exports = createColors();
|
|
5379
|
+
module.exports.createColors = createColors;
|
|
5380
|
+
})))(), 1);
|
|
5381
|
+
const highlighter = {
|
|
5382
|
+
error: import_picocolors.default.red,
|
|
5383
|
+
warn: import_picocolors.default.yellow,
|
|
5384
|
+
info: import_picocolors.default.cyan,
|
|
5385
|
+
success: import_picocolors.default.green,
|
|
5386
|
+
dim: import_picocolors.default.dim,
|
|
5387
|
+
gray: import_picocolors.default.gray,
|
|
5388
|
+
bold: import_picocolors.default.bold
|
|
5389
|
+
};
|
|
5315
5390
|
const computeJsxIncludePaths = (includePaths) => includePaths.length > 0 ? includePaths.filter((filePath) => JSX_FILE_PATTERN.test(filePath)) : void 0;
|
|
5316
5391
|
const LINGUIST_ATTRIBUTE_PATTERN = /^linguist-(?:vendored|generated)(?:=([a-zA-Z0-9]+))?$/i;
|
|
5317
5392
|
const FALSY_VALUES = new Set([
|
|
@@ -8146,7 +8221,7 @@ const runInspect = (input, hooks = {}) => Effect.gen(function* () {
|
|
|
8146
8221
|
reason: null
|
|
8147
8222
|
});
|
|
8148
8223
|
const scanConcurrency = yield* OxlintConcurrency;
|
|
8149
|
-
const workerCountSuffix = scanConcurrency > 1 ? `
|
|
8224
|
+
const workerCountSuffix = scanConcurrency > 1 ? ` ${highlighter.dim(`[~${scanConcurrency} workers]`)}` : "";
|
|
8150
8225
|
const scanProgress = yield* progressService.start("Scanning...");
|
|
8151
8226
|
const scanStartTime = Date.now();
|
|
8152
8227
|
let lastReportedTotalFileCount = 0;
|
|
@@ -8591,73 +8666,6 @@ const getDiffInfo = (directory, explicitBaseBranch) => Effect.runPromise(Effect.
|
|
|
8591
8666
|
};
|
|
8592
8667
|
}).pipe(Effect.provide(Git.layerNode)));
|
|
8593
8668
|
const filterSourceFiles = (filePaths) => filePaths.filter(isLintableSourceFile);
|
|
8594
|
-
var import_picocolors = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
8595
|
-
let p = process || {}, argv = p.argv || [], env = p.env || {};
|
|
8596
|
-
let isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
|
|
8597
|
-
let formatter = (open, close, replace = open) => (input) => {
|
|
8598
|
-
let string = "" + input, index = string.indexOf(close, open.length);
|
|
8599
|
-
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
8600
|
-
};
|
|
8601
|
-
let replaceClose = (string, close, replace, index) => {
|
|
8602
|
-
let result = "", cursor = 0;
|
|
8603
|
-
do {
|
|
8604
|
-
result += string.substring(cursor, index) + replace;
|
|
8605
|
-
cursor = index + close.length;
|
|
8606
|
-
index = string.indexOf(close, cursor);
|
|
8607
|
-
} while (~index);
|
|
8608
|
-
return result + string.substring(cursor);
|
|
8609
|
-
};
|
|
8610
|
-
let createColors = (enabled = isColorSupported) => {
|
|
8611
|
-
let f = enabled ? formatter : () => String;
|
|
8612
|
-
return {
|
|
8613
|
-
isColorSupported: enabled,
|
|
8614
|
-
reset: f("\x1B[0m", "\x1B[0m"),
|
|
8615
|
-
bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
8616
|
-
dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
8617
|
-
italic: f("\x1B[3m", "\x1B[23m"),
|
|
8618
|
-
underline: f("\x1B[4m", "\x1B[24m"),
|
|
8619
|
-
inverse: f("\x1B[7m", "\x1B[27m"),
|
|
8620
|
-
hidden: f("\x1B[8m", "\x1B[28m"),
|
|
8621
|
-
strikethrough: f("\x1B[9m", "\x1B[29m"),
|
|
8622
|
-
black: f("\x1B[30m", "\x1B[39m"),
|
|
8623
|
-
red: f("\x1B[31m", "\x1B[39m"),
|
|
8624
|
-
green: f("\x1B[32m", "\x1B[39m"),
|
|
8625
|
-
yellow: f("\x1B[33m", "\x1B[39m"),
|
|
8626
|
-
blue: f("\x1B[34m", "\x1B[39m"),
|
|
8627
|
-
magenta: f("\x1B[35m", "\x1B[39m"),
|
|
8628
|
-
cyan: f("\x1B[36m", "\x1B[39m"),
|
|
8629
|
-
white: f("\x1B[37m", "\x1B[39m"),
|
|
8630
|
-
gray: f("\x1B[90m", "\x1B[39m"),
|
|
8631
|
-
bgBlack: f("\x1B[40m", "\x1B[49m"),
|
|
8632
|
-
bgRed: f("\x1B[41m", "\x1B[49m"),
|
|
8633
|
-
bgGreen: f("\x1B[42m", "\x1B[49m"),
|
|
8634
|
-
bgYellow: f("\x1B[43m", "\x1B[49m"),
|
|
8635
|
-
bgBlue: f("\x1B[44m", "\x1B[49m"),
|
|
8636
|
-
bgMagenta: f("\x1B[45m", "\x1B[49m"),
|
|
8637
|
-
bgCyan: f("\x1B[46m", "\x1B[49m"),
|
|
8638
|
-
bgWhite: f("\x1B[47m", "\x1B[49m"),
|
|
8639
|
-
blackBright: f("\x1B[90m", "\x1B[39m"),
|
|
8640
|
-
redBright: f("\x1B[91m", "\x1B[39m"),
|
|
8641
|
-
greenBright: f("\x1B[92m", "\x1B[39m"),
|
|
8642
|
-
yellowBright: f("\x1B[93m", "\x1B[39m"),
|
|
8643
|
-
blueBright: f("\x1B[94m", "\x1B[39m"),
|
|
8644
|
-
magentaBright: f("\x1B[95m", "\x1B[39m"),
|
|
8645
|
-
cyanBright: f("\x1B[96m", "\x1B[39m"),
|
|
8646
|
-
whiteBright: f("\x1B[97m", "\x1B[39m"),
|
|
8647
|
-
bgBlackBright: f("\x1B[100m", "\x1B[49m"),
|
|
8648
|
-
bgRedBright: f("\x1B[101m", "\x1B[49m"),
|
|
8649
|
-
bgGreenBright: f("\x1B[102m", "\x1B[49m"),
|
|
8650
|
-
bgYellowBright: f("\x1B[103m", "\x1B[49m"),
|
|
8651
|
-
bgBlueBright: f("\x1B[104m", "\x1B[49m"),
|
|
8652
|
-
bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
|
|
8653
|
-
bgCyanBright: f("\x1B[106m", "\x1B[49m"),
|
|
8654
|
-
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
|
|
8655
|
-
};
|
|
8656
|
-
};
|
|
8657
|
-
module.exports = createColors();
|
|
8658
|
-
module.exports.createColors = createColors;
|
|
8659
|
-
})))(), 1);
|
|
8660
|
-
import_picocolors.default.red, import_picocolors.default.yellow, import_picocolors.default.cyan, import_picocolors.default.green, import_picocolors.default.dim, import_picocolors.default.gray, import_picocolors.default.bold;
|
|
8661
8669
|
/**
|
|
8662
8670
|
* Back-compat alias: the streaming pipeline holds its caches in
|
|
8663
8671
|
* per-pipeline closures that are garbage-collected when the pipeline
|
|
@@ -8734,4 +8742,4 @@ const toJsonReport = (result, options) => buildJsonReport({
|
|
|
8734
8742
|
export { AmbiguousProjectError, NoReactDependencyError, NotADirectoryError, PackageJsonNotFoundError, ProjectNotFoundError, ReactDoctorError, buildJsonReport, buildJsonReportError, clearCaches, diagnose, filterSourceFiles, getDiffInfo, isProjectDiscoveryError, isReactDoctorError, summarizeDiagnostics, toJsonReport };
|
|
8735
8743
|
|
|
8736
8744
|
//# sourceMappingURL=index.js.map
|
|
8737
|
-
//# debugId=
|
|
8745
|
+
//# debugId=a56b86f0-1c28-52ae-9677-12f5e67df34f
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-doctor",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.16-dev.114893e",
|
|
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.16-dev.114893e"
|
|
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/
|
|
75
|
-
"@react-doctor/
|
|
74
|
+
"@react-doctor/api": "0.2.16",
|
|
75
|
+
"@react-doctor/core": "0.2.16"
|
|
76
76
|
},
|
|
77
77
|
"engines": {
|
|
78
78
|
"node": "^20.19.0 || >=22.12.0"
|