react-doctor 0.9.12-dev.a2b460d → 0.9.12-dev.f7efb7d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/bin/react-doctor.js +1 -9
- package/dist/{build-section-divider-Vz879zXD.js → build-section-divider-LBEprrSw.js} +9 -10
- package/dist/{ci-BVYrYekU.js → ci-B80oWpS1.js} +12 -12
- package/dist/cli.js +30 -31
- package/dist/{design-D-TYN_tr.js → design-Doxh3Oua.js} +4 -4
- package/dist/{devtools-DPRVRu3S.js → devtools-D8NTVj81.js} +4 -4
- package/dist/{exit-gracefully-Cjv5kC_l.js → exit-gracefully-Z8iBwlMI.js} +6 -6
- package/dist/index.d.ts +21 -42
- package/dist/index.js +54685 -54554
- package/dist/{inspect-kkvDHKDE.js → inspect-qNFSJB8s.js} +21 -20
- package/dist/{install-ZeYvD9Rw.js → install-CxK6oNgV.js} +8 -8
- package/dist/{install-doctor-script-D58Hr1dM.js → install-doctor-script-rddKhKYf.js} +4 -4
- package/dist/{install-github-workflow-DkMicv8E.js → install-github-workflow-telZkaCp.js} +6 -6
- package/dist/{install-react-doctor-CjgE52al.js → install-react-doctor-DoKoYt2g.js} +47 -45
- package/dist/{print-branded-header-D4QYSu-h.js → print-branded-header-514lsPsP.js} +4 -4
- package/dist/project-analysis-worker.d.ts +1 -0
- package/dist/project-analysis-worker.js +51900 -0
- package/dist/{read-object-file-OFRlvCAL.js → read-object-file-0FXK_1Lr.js} +4 -4
- package/dist/{record-metric-CMe2d1Xv.js → record-metric-DFQYh2Mf.js} +2602 -5677
- package/dist/{report-error-1l7v6_dE.js → report-error-Bg7eABmv.js} +5 -5
- package/dist/{report-workflow-result-EagkH_v9.js → report-workflow-result-Dd3jJHJr.js} +5 -5
- package/dist/{resolve-scope-CMNrOdDf.js → resolve-scope-CsMf2eUG.js} +6 -6
- package/dist/{rules-CzR1qUru.js → rules-Bmw6adjU.js} +6 -6
- package/dist/{run-scan-app-Ciq22jzp.js → run-scan-app-CwcrBTC4.js} +137 -121
- package/dist/{scan-D4m5r4Rs.js → scan-D7bmiqv1.js} +8 -8
- package/dist/semver-DFtnEmN-.js +3219 -0
- package/dist/{should-fail-scan-gate-lMTlhEhE.js → should-fail-scan-gate-Cd68GDY-.js} +151 -83
- package/dist/{should-skip-prompts-mXKZBNCz.js → should-skip-prompts-oFD5z_9E.js} +4 -4
- package/dist/{unref-stdin-Cxhw67r6.js → unref-stdin-C5xln9RW.js} +6 -12
- package/dist/{version-CnvVY2VD.js → version-Bg3OKWjm.js} +4 -4
- package/dist/{why-BktDEhhH.js → why-DPksh2dy.js} +4 -4
- package/package.json +5 -9
- package/dist/chunk-q7NCDQ7-.js +0 -28
- package/dist/lsp.js +0 -81145
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
3
|
-
import {
|
|
4
|
-
import { c as isExpectedUserError, s as shutdownTelemetry } from "./unref-stdin-
|
|
5
|
-
import { i as flushSentry } from "./build-section-divider-
|
|
6
|
-
import { n as handleError, r as handleUserError, t as reportErrorToSentry } from "./report-error-
|
|
7
|
-
import { F as runGitRaw, L as cliLogger, c as spinner, i as hasDoctorScript, n as findNearestPackageDirectory, o as isSpinnerSilent, s as setSpinnerSilent } from "./install-doctor-script-
|
|
8
|
-
import { a as readReactDoctorWorkflow, c as workflowUsesV1Action, i as isReactDoctorWorkflowInstalled, l as prompts, s as upgradeWorkflowActionToV2 } from "./install-github-workflow-
|
|
9
|
-
import { c as openWorkflowPullRequest, i as warnDeprecatedDiff, l as stageWorkflowFile, r as resolveScope, s as resolveBlockingLevel, t as finalizeScope, u as toForwardSlashes } from "./resolve-scope-
|
|
10
|
-
import { t as shouldSkipPrompts } from "./should-skip-prompts-
|
|
11
|
-
import { A as resolveMergeBaseRef,
|
|
12
|
-
import { a as recordGate, i as readPreference, o as runMigrations, p as SETUP_HINT_EVENT, r as isGatePending, s as writePreference, u as HANDOFF_TARGET_PREFERENCE_ID } from "./report-workflow-result-
|
|
13
|
-
import { a as askUpgradeActionVersion, c as recordCiPromptDecision, i as installReactDoctorAgentHooks, l as hasHandledActionUpgrade, o as askAddToGitHubActions, r as
|
|
14
|
-
import { t as readObjectFile } from "./read-object-file-
|
|
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]="235ea341-d734-5c8e-864e-eb64c5680be2")}catch(e){}}();
|
|
3
|
+
import { $n as CANONICAL_GITHUB_URL, F as STAGED_SNAPSHOT_ADDITIONAL_CONFIG_FILENAMES, G as isCiOrCodingAgentEnvironment, Gt as highlighter, It as getBaselineDiffPlan, K as isCodingAgentEnvironment, Ln as runPromise, Lt as getChangedLineRanges, Nt as findLegacyConfig, Ot as detectAiTrainingEnvironment, P as STAGED_FILES_TEMP_DIR_PREFIX, Pn as provide$1, R as CliInputError, Sr as messageFromUnknown, Ut as hasSupportedFrameworkOrLibrary, V as isDebugFlagEnabled, Wn as provide, Y as Git, dn as resolveScanTarget, f as setJsonReportDirectory, g as VERSION, gr as STAGED_FILES_PROJECT_CONFIG_FILENAMES, h as writeJsonReport, kn as gen, kt as discoverSupportedSubprojects, lt as StagedFiles, m as writeJsonErrorReport, mt as buildJsonReport, n as recordDistribution, on as remainingDeadlineBudgetMs, p as setJsonReportMode, qt as isPathInsideDirectory, rn as mapWithConcurrency, t as recordCount, tn as listWorkspacePackages, u as enableJsonMode, vn as toRelativePath, w as METRIC, xr as isPlainObject, yr as isErrnoException, zt as getDiffInfo } from "./record-metric-DFQYh2Mf.js";
|
|
4
|
+
import { c as isExpectedUserError, s as shutdownTelemetry } from "./unref-stdin-C5xln9RW.js";
|
|
5
|
+
import { i as flushSentry } from "./build-section-divider-LBEprrSw.js";
|
|
6
|
+
import { n as handleError, r as handleUserError, t as reportErrorToSentry } from "./report-error-Bg7eABmv.js";
|
|
7
|
+
import { F as runGitRaw, L as cliLogger, c as spinner, i as hasDoctorScript, n as findNearestPackageDirectory, o as isSpinnerSilent, s as setSpinnerSilent } from "./install-doctor-script-rddKhKYf.js";
|
|
8
|
+
import { a as readReactDoctorWorkflow, c as workflowUsesV1Action, i as isReactDoctorWorkflowInstalled, l as prompts, s as upgradeWorkflowActionToV2 } from "./install-github-workflow-telZkaCp.js";
|
|
9
|
+
import { c as openWorkflowPullRequest, i as warnDeprecatedDiff, l as stageWorkflowFile, r as resolveScope, s as resolveBlockingLevel, t as finalizeScope, u as toForwardSlashes } from "./resolve-scope-CsMf2eUG.js";
|
|
10
|
+
import { t as shouldSkipPrompts } from "./should-skip-prompts-oFD5z_9E.js";
|
|
11
|
+
import { A as resolveMergeBaseRef, C as copyToClipboard, D as deduplicateProjectScans, E as collectProjectSourceFileCounts, I as printDiagnosticsDump, O as createInvocationInspect, S as CLI_AGENT_BINARIES, T as buildHandoffPayload, V as buildEmptyReportMessage, _ as resolveCliInspectOptions, a as projectManifestChanged, b as setUpGitHubActions, c as selectProjects, d as resolveProjectChangedLineRanges, f as resolveProjectDiffIncludePaths, g as resolveWorkspaceDeadCodeOwner, h as retryMissingProjectScores, i as validateModeFlags, j as printHeadlessReport, k as inspect, l as buildCodeFrame, m as resolveProjectRelativeDirectory, n as formatSkippedProjectsMessage, o as partitionProjectScanOutcomes, p as resolveProjectSourceFilePaths, r as validateIncludeUntrackedScope, t as shouldFailScanGate, u as resolveProjectScan, v as filterScansForSurface, w as launchCliAgent, x as detectLaunchableAgents, y as countUniqueScannedFiles, z as filterDiagnosticsByCategories } from "./should-fail-scan-gate-Cd68GDY-.js";
|
|
12
|
+
import { a as recordGate, i as readPreference, o as runMigrations, p as SETUP_HINT_EVENT, r as isGatePending, s as writePreference, u as HANDOFF_TARGET_PREFERENCE_ID } from "./report-workflow-result-Dd3jJHJr.js";
|
|
13
|
+
import { a as askUpgradeActionVersion, c as recordCiPromptDecision, i as installReactDoctorAgentHooks, l as hasHandledActionUpgrade, o as askAddToGitHubActions, r as findAgentsWithOutdatedReactDoctorHooks, s as hasHandledCiPrompt, t as getSkillSourceDirectory, u as recordActionUpgradeDecision } from "./install-react-doctor-DoKoYt2g.js";
|
|
14
|
+
import { t as readObjectFile } from "./read-object-file-0FXK_1Lr.js";
|
|
15
15
|
import * as path$1 from "node:path";
|
|
16
16
|
import * as fs$1 from "node:fs";
|
|
17
17
|
import { tmpdir } from "node:os";
|
|
@@ -315,17 +315,18 @@ const PROJECT_MIGRATIONS = [
|
|
|
315
315
|
},
|
|
316
316
|
{
|
|
317
317
|
id: "agent-hooks-sh-to-mjs",
|
|
318
|
+
version: 2,
|
|
318
319
|
scope: "project",
|
|
319
320
|
run: ({ projectRoot }) => {
|
|
320
321
|
if (projectRoot === void 0) return false;
|
|
321
|
-
const agents =
|
|
322
|
+
const agents = findAgentsWithOutdatedReactDoctorHooks(projectRoot);
|
|
322
323
|
if (agents.length === 0) return false;
|
|
323
324
|
installReactDoctorAgentHooks({
|
|
324
325
|
projectRoot,
|
|
325
326
|
agents
|
|
326
327
|
});
|
|
327
|
-
cliLogger.success(`
|
|
328
|
-
cliLogger.dim("
|
|
328
|
+
cliLogger.success(`Moved React Doctor agent hooks to end-of-turn checks (${agents.join(", ")})`);
|
|
329
|
+
cliLogger.dim(" Hooks now scan changed and untracked files once when the agent stops. Review and commit the change.");
|
|
329
330
|
cliLogger.break();
|
|
330
331
|
return true;
|
|
331
332
|
}
|
|
@@ -474,7 +475,7 @@ const buildDiagnosticIssueUrl = (input) => {
|
|
|
474
475
|
const findOwningProjectDirectory = (rootDirectory, filePath) => {
|
|
475
476
|
const absoluteFile = path$1.isAbsolute(filePath) ? filePath : path$1.resolve(rootDirectory, filePath);
|
|
476
477
|
const workspacePackages = listWorkspacePackages(rootDirectory);
|
|
477
|
-
const candidates = workspacePackages.length > 0 ? workspacePackages :
|
|
478
|
+
const candidates = workspacePackages.length > 0 ? workspacePackages : discoverSupportedSubprojects(rootDirectory);
|
|
478
479
|
if (candidates.length === 0) return rootDirectory;
|
|
479
480
|
let bestMatch = null;
|
|
480
481
|
for (const candidate of candidates) {
|
|
@@ -1328,7 +1329,7 @@ const inspectAction = async (directory, flags, invocationCommand = "inspect") =>
|
|
|
1328
1329
|
projectDirectories: projectScans.map((projectScan) => projectScan.directory),
|
|
1329
1330
|
isRootDeadCodeEnabled: scanOptions.deadCode ?? rootProjectScan?.config?.deadCode ?? true
|
|
1330
1331
|
});
|
|
1331
|
-
if (workspaceDeadCodeOwner !== null) recordCount(METRIC.
|
|
1332
|
+
if (workspaceDeadCodeOwner !== null) recordCount(METRIC.scanWorkspaceMaintainabilityShared, 1, { projectCount: projectScans.length });
|
|
1332
1333
|
const projectScanExecutionContext = {
|
|
1333
1334
|
flags,
|
|
1334
1335
|
resolvedDirectory,
|
|
@@ -1439,5 +1440,5 @@ const inspectAction = async (directory, flags, invocationCommand = "inspect") =>
|
|
|
1439
1440
|
//#endregion
|
|
1440
1441
|
export { warnDeprecatedFailOn as n, runProjectMigrations as r, inspectAction as t };
|
|
1441
1442
|
|
|
1442
|
-
//# sourceMappingURL=inspect-
|
|
1443
|
-
//# debugId=
|
|
1443
|
+
//# sourceMappingURL=inspect-qNFSJB8s.js.map
|
|
1444
|
+
//# debugId=235ea341-d734-5c8e-864e-eb64c5680be2
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
3
|
-
import {
|
|
4
|
-
import { c as isExpectedUserError } from "./unref-stdin-
|
|
5
|
-
import { n as handleError, r as handleUserError, t as reportErrorToSentry } from "./report-error-
|
|
6
|
-
import { t as printBrandedHeader } from "./print-branded-header-
|
|
7
|
-
import { n as runInstallReactDoctor } from "./install-react-doctor-
|
|
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]="e0e961cc-9b20-57dc-b714-295ef9f99825")}catch(e){}}();
|
|
3
|
+
import { Rn as runSync, t as recordCount, w as METRIC } from "./record-metric-DFQYh2Mf.js";
|
|
4
|
+
import { c as isExpectedUserError } from "./unref-stdin-C5xln9RW.js";
|
|
5
|
+
import { n as handleError, r as handleUserError, t as reportErrorToSentry } from "./report-error-Bg7eABmv.js";
|
|
6
|
+
import { t as printBrandedHeader } from "./print-branded-header-514lsPsP.js";
|
|
7
|
+
import { n as runInstallReactDoctor } from "./install-react-doctor-DoKoYt2g.js";
|
|
8
8
|
//#region src/cli/commands/install.ts
|
|
9
9
|
const installAction = async (options, command) => {
|
|
10
10
|
recordCount(METRIC.cliInvoked, 1, { command: "install" });
|
|
@@ -28,5 +28,5 @@ const installAction = async (options, command) => {
|
|
|
28
28
|
//#endregion
|
|
29
29
|
export { installAction };
|
|
30
30
|
|
|
31
|
-
//# sourceMappingURL=install-
|
|
32
|
-
//# debugId=
|
|
31
|
+
//# sourceMappingURL=install-CxK6oNgV.js.map
|
|
32
|
+
//# debugId=e0e961cc-9b20-57dc-b714-295ef9f99825
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
3
|
-
import {
|
|
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]="254a3f73-9b97-527c-a085-f2ed257261d8")}catch(e){}}();
|
|
3
|
+
import { Cn as info$1, Gt as highlighter, O as RUN_GIT_MAX_BUFFER_BYTES, Rn as runSync, Sn as error$1, Tn as warn, wn as log, z as isNonInteractiveEnvironment } from "./record-metric-DFQYh2Mf.js";
|
|
4
4
|
import { execFileSync } from "node:child_process";
|
|
5
5
|
import * as path$1 from "node:path";
|
|
6
6
|
import * as fs$1 from "node:fs";
|
|
@@ -3247,5 +3247,5 @@ const installReactDoctorScriptStep = (projectRoot) => {
|
|
|
3247
3247
|
//#endregion
|
|
3248
3248
|
export { packageHasNestedRecordKey as A, SIMPLE_GIT_HOOKS_CONFIG_FILE as C, getPackageJsonPath as D, ensureTrailingNewline as E, runGitRaw as F, writeJsonFile as I, cliLogger as L, readPackageJson as M, resolveGitPath as N, isRecord as O, runGit as P, REACT_DOCTOR_COMMAND as S, VITE_PLUS_HOOKS_PATH as T, LEFTHOOK_CONFIG_FILES as _, installReactDoctorScriptStep as a, OVERCOMMIT_CONFIG_FILE as b, spinner as c, stripAnsi as d, isUnicodeSupported as f, HUSKY_HOOKS_PATH as g, HOOK_RELATIVE_PATH as h, hasDoctorScript as i, packageHasRecordKey as j, packageHasDependency as k, isFullWidth as l, HOOK_FILE_NAME as m, findNearestPackageDirectory as n, isSpinnerSilent as o, chalk as p, hasDoctorDependency as r, setSpinnerSilent as s, DOCTOR_PACKAGE_NAME as t, isWide as u, LEGACY_HOOK_RUNNER_RELATIVE_PATH as v, SIMPLE_GIT_HOOKS_PACKAGE_JSON_KEY as w, PRE_COMMIT_CONFIG_FILE as x, NON_BLOCKING_REACT_DOCTOR_COMMAND as y };
|
|
3249
3249
|
|
|
3250
|
-
//# sourceMappingURL=install-doctor-script-
|
|
3251
|
-
//# debugId=
|
|
3250
|
+
//# sourceMappingURL=install-doctor-script-rddKhKYf.js.map
|
|
3251
|
+
//# debugId=254a3f73-9b97-527c-a085-f2ed257261d8
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
3
|
-
import { C as GH_DEFAULT_BRANCH_PROBE_TIMEOUT_MS } from "./record-metric-
|
|
4
|
-
import { t as unrefStdin } from "./unref-stdin-
|
|
5
|
-
import { L as cliLogger } from "./install-doctor-script-
|
|
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]="9d06439c-2502-56d9-b514-b0fe928306fb")}catch(e){}}();
|
|
3
|
+
import { C as GH_DEFAULT_BRANCH_PROBE_TIMEOUT_MS } from "./record-metric-DFQYh2Mf.js";
|
|
4
|
+
import { t as unrefStdin } from "./unref-stdin-C5xln9RW.js";
|
|
5
|
+
import { L as cliLogger } from "./install-doctor-script-rddKhKYf.js";
|
|
6
6
|
import { createRequire } from "node:module";
|
|
7
7
|
import { execFile } from "node:child_process";
|
|
8
8
|
import * as path$1 from "node:path";
|
|
@@ -263,5 +263,5 @@ const upgradeReactDoctorWorkflowInPlace = (projectRoot) => {
|
|
|
263
263
|
//#endregion
|
|
264
264
|
export { readReactDoctorWorkflow as a, workflowUsesV1Action as c, detectDefaultBranch as d, runCommand as f, isReactDoctorWorkflowInstalled as i, prompts as l, getReactDoctorWorkflowPath as n, upgradeReactDoctorWorkflowInPlace as o, installReactDoctorWorkflow as r, upgradeWorkflowActionToV2 as s, buildWorkflowContent as t, isCommandAvailable as u };
|
|
265
265
|
|
|
266
|
-
//# sourceMappingURL=install-github-workflow-
|
|
267
|
-
//# debugId=
|
|
266
|
+
//# sourceMappingURL=install-github-workflow-telZkaCp.js.map
|
|
267
|
+
//# debugId=9d06439c-2502-56d9-b514-b0fe928306fb
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
3
|
-
import { R as CliInputError, S as CI_TRUST_COMPANIES,
|
|
4
|
-
import { A as packageHasNestedRecordKey, D as getPackageJsonPath, E as ensureTrailingNewline, I as writeJsonFile, L as cliLogger, M as readPackageJson, N as resolveGitPath, O as isRecord, P as runGit, S as REACT_DOCTOR_COMMAND, T as VITE_PLUS_HOOKS_PATH, _ as LEFTHOOK_CONFIG_FILES, a as installReactDoctorScriptStep, b as OVERCOMMIT_CONFIG_FILE, c as spinner, g as HUSKY_HOOKS_PATH, h as HOOK_RELATIVE_PATH, j as packageHasRecordKey, k as packageHasDependency, m as HOOK_FILE_NAME, n as findNearestPackageDirectory, r as hasDoctorDependency, t as DOCTOR_PACKAGE_NAME, v as LEGACY_HOOK_RUNNER_RELATIVE_PATH, x as PRE_COMMIT_CONFIG_FILE, y as NON_BLOCKING_REACT_DOCTOR_COMMAND } from "./install-doctor-script-
|
|
5
|
-
import { a as readReactDoctorWorkflow, c as workflowUsesV1Action, d as detectDefaultBranch, l as prompts, n as getReactDoctorWorkflowPath, o as upgradeReactDoctorWorkflowInPlace, r as installReactDoctorWorkflow } from "./install-github-workflow-
|
|
6
|
-
import { t as shouldSkipPrompts } from "./should-skip-prompts-
|
|
7
|
-
import { a as recordGate, c as ACTION_UPGRADE_EVENT, d as INSTALL_AGENTS_PREFERENCE_ID, h as detectAvailableAgents, i as readPreference, l as CI_PITCH_EVENT, m as computeDefaultSelectedAgents, n as openUrl, r as isGatePending, s as writePreference, t as reportWorkflowResult } from "./report-workflow-result-
|
|
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]="b50f4ab7-d9c5-5dbe-8b22-b3fe852a7489")}catch(e){}}();
|
|
3
|
+
import { Gt as highlighter, R as CliInputError, S as CI_TRUST_COMPANIES, hr as SKILL_NAME, sr as GITHUB_ACTIONS_SETUP_URL, t as recordCount, w as METRIC, yr as isErrnoException } from "./record-metric-DFQYh2Mf.js";
|
|
4
|
+
import { A as packageHasNestedRecordKey, D as getPackageJsonPath, E as ensureTrailingNewline, I as writeJsonFile, L as cliLogger, M as readPackageJson, N as resolveGitPath, O as isRecord, P as runGit, S as REACT_DOCTOR_COMMAND, T as VITE_PLUS_HOOKS_PATH, _ as LEFTHOOK_CONFIG_FILES, a as installReactDoctorScriptStep, b as OVERCOMMIT_CONFIG_FILE, c as spinner, g as HUSKY_HOOKS_PATH, h as HOOK_RELATIVE_PATH, j as packageHasRecordKey, k as packageHasDependency, m as HOOK_FILE_NAME, n as findNearestPackageDirectory, r as hasDoctorDependency, t as DOCTOR_PACKAGE_NAME, v as LEGACY_HOOK_RUNNER_RELATIVE_PATH, x as PRE_COMMIT_CONFIG_FILE, y as NON_BLOCKING_REACT_DOCTOR_COMMAND } from "./install-doctor-script-rddKhKYf.js";
|
|
5
|
+
import { a as readReactDoctorWorkflow, c as workflowUsesV1Action, d as detectDefaultBranch, l as prompts, n as getReactDoctorWorkflowPath, o as upgradeReactDoctorWorkflowInPlace, r as installReactDoctorWorkflow } from "./install-github-workflow-telZkaCp.js";
|
|
6
|
+
import { t as shouldSkipPrompts } from "./should-skip-prompts-oFD5z_9E.js";
|
|
7
|
+
import { a as recordGate, c as ACTION_UPGRADE_EVENT, d as INSTALL_AGENTS_PREFERENCE_ID, h as detectAvailableAgents, i as readPreference, l as CI_PITCH_EVENT, m as computeDefaultSelectedAgents, n as openUrl, r as isGatePending, s as writePreference, t as reportWorkflowResult } from "./report-workflow-result-Dd3jJHJr.js";
|
|
8
8
|
import { execFile } from "node:child_process";
|
|
9
9
|
import * as path$1 from "node:path";
|
|
10
10
|
import * as fs$1 from "node:fs";
|
|
@@ -124,10 +124,10 @@ const CLAUDE_HOOK_COMMAND = "node \"$CLAUDE_PROJECT_DIR/.claude/hooks/react-doct
|
|
|
124
124
|
const CURSOR_HOOKS_RELATIVE_PATH = ".cursor/hooks.json";
|
|
125
125
|
const CURSOR_HOOK_RELATIVE_PATH = ".cursor/hooks/react-doctor.mjs";
|
|
126
126
|
const CURSOR_HOOK_COMMAND = "node .cursor/hooks/react-doctor.mjs";
|
|
127
|
-
const CURSOR_HOOK_MATCHER = "Write|Edit|MultiEdit|ApplyPatch";
|
|
128
127
|
const CURSOR_HOOKS_SCHEMA_VERSION = 1;
|
|
129
128
|
const LEGACY_HOOK_SCRIPT_PATHS = [".claude/hooks/react-doctor.sh", ".cursor/hooks/react-doctor.sh"];
|
|
130
129
|
const isLegacyHookCommand = (command) => typeof command === "string" && LEGACY_HOOK_SCRIPT_PATHS.some((legacyPath) => command.includes(legacyPath));
|
|
130
|
+
const isManagedHookCommand = (command, installedCommand) => command === installedCommand || isLegacyHookCommand(command);
|
|
131
131
|
const isSupportedAgent = (agent) => agent === CLAUDE_AGENT || agent === CURSOR_AGENT;
|
|
132
132
|
const readJsonFile = (filePath, fallback) => {
|
|
133
133
|
if (!fs$1.existsSync(filePath)) return fallback;
|
|
@@ -147,10 +147,12 @@ const readJsonFileSafely = (filePath, fallback) => {
|
|
|
147
147
|
return fallback;
|
|
148
148
|
}
|
|
149
149
|
};
|
|
150
|
-
const
|
|
150
|
+
const findAgentsWithOutdatedReactDoctorHooks = (projectRoot) => {
|
|
151
151
|
const agents = [];
|
|
152
|
-
|
|
153
|
-
if ((
|
|
152
|
+
const settings = readJsonFileSafely(path$1.join(projectRoot, CLAUDE_SETTINGS_RELATIVE_PATH), {});
|
|
153
|
+
if ([...settings.hooks?.PostToolBatch ?? [], ...settings.hooks?.Stop ?? []].some((group) => (group.hooks ?? []).some((hook) => isLegacyHookCommand(hook.command))) || (settings.hooks?.PostToolBatch ?? []).some((group) => (group.hooks ?? []).some((hook) => hook.command === CLAUDE_HOOK_COMMAND))) agents.push(CLAUDE_AGENT);
|
|
154
|
+
const config = readJsonFileSafely(path$1.join(projectRoot, CURSOR_HOOKS_RELATIVE_PATH), {});
|
|
155
|
+
if ([...config.hooks?.postToolUse ?? [], ...config.hooks?.stop ?? []].some((handler) => isLegacyHookCommand(handler.command)) || (config.hooks?.postToolUse ?? []).some((handler) => handler.command === CURSOR_HOOK_COMMAND)) agents.push(CURSOR_AGENT);
|
|
154
156
|
return agents;
|
|
155
157
|
};
|
|
156
158
|
const ensureDirectoryExists = (directoryPath) => {
|
|
@@ -167,62 +169,62 @@ const writeJsonFileWithDirectoryCheck = (filePath, value) => {
|
|
|
167
169
|
ensureDirectoryExists(path$1.dirname(filePath));
|
|
168
170
|
writeJsonFile(filePath, value);
|
|
169
171
|
};
|
|
170
|
-
const writeHookScript = (filePath) => {
|
|
172
|
+
const writeHookScript = (filePath, hookEventName) => {
|
|
171
173
|
ensureDirectoryExists(path$1.dirname(filePath));
|
|
172
|
-
fs$1.writeFileSync(filePath, buildAgentHookScript());
|
|
174
|
+
fs$1.writeFileSync(filePath, buildAgentHookScript(hookEventName));
|
|
173
175
|
try {
|
|
174
176
|
fs$1.rmSync(filePath.replace(/\.mjs$/, ".sh"), { force: true });
|
|
175
177
|
} catch {}
|
|
176
178
|
};
|
|
177
|
-
const hasClaudeHookCommand = (groups) => groups.some((group) => (group.hooks ?? []).some((hook) => hook.command === CLAUDE_HOOK_COMMAND));
|
|
178
179
|
const installClaudeHook = (projectRoot) => {
|
|
179
180
|
const settingsPath = path$1.join(projectRoot, CLAUDE_SETTINGS_RELATIVE_PATH);
|
|
180
181
|
const hookPath = path$1.join(projectRoot, CLAUDE_HOOK_RELATIVE_PATH);
|
|
181
182
|
const settings = readJsonFile(settingsPath, {});
|
|
182
183
|
const hooks = { ...settings.hooks ?? {} };
|
|
183
|
-
const
|
|
184
|
+
const stripManagedHooks = (groups) => groups.flatMap((group) => {
|
|
184
185
|
const groupHooks = group.hooks ?? [];
|
|
185
|
-
const keptHooks = groupHooks.filter((hook) => !
|
|
186
|
+
const keptHooks = groupHooks.filter((hook) => !isManagedHookCommand(hook.command, CLAUDE_HOOK_COMMAND));
|
|
186
187
|
if (keptHooks.length === groupHooks.length) return [group];
|
|
187
188
|
return keptHooks.length > 0 ? [{
|
|
188
189
|
...group,
|
|
189
190
|
hooks: keptHooks
|
|
190
191
|
}] : [];
|
|
191
192
|
});
|
|
192
|
-
|
|
193
|
+
const stopHooks = stripManagedHooks(hooks.Stop ?? []);
|
|
194
|
+
stopHooks.push({ hooks: [{
|
|
193
195
|
type: "command",
|
|
194
196
|
command: CLAUDE_HOOK_COMMAND
|
|
195
197
|
}] });
|
|
196
|
-
hooks.PostToolBatch =
|
|
198
|
+
hooks.PostToolBatch = stripManagedHooks(hooks.PostToolBatch ?? []);
|
|
199
|
+
hooks.Stop = stopHooks;
|
|
197
200
|
writeJsonFileWithDirectoryCheck(settingsPath, {
|
|
198
201
|
...settings,
|
|
199
202
|
hooks
|
|
200
203
|
});
|
|
201
|
-
writeHookScript(hookPath);
|
|
204
|
+
writeHookScript(hookPath, "Stop");
|
|
202
205
|
return [settingsPath, hookPath];
|
|
203
206
|
};
|
|
204
|
-
const hasCursorHookCommand = (handlers) => handlers.some((handler) => handler.command === CURSOR_HOOK_COMMAND);
|
|
205
207
|
const installCursorHook = (projectRoot) => {
|
|
206
208
|
const configPath = path$1.join(projectRoot, CURSOR_HOOKS_RELATIVE_PATH);
|
|
207
209
|
const hookPath = path$1.join(projectRoot, CURSOR_HOOK_RELATIVE_PATH);
|
|
208
210
|
const config = readJsonFile(configPath, {});
|
|
209
211
|
const hooks = { ...config.hooks ?? {} };
|
|
210
|
-
const
|
|
211
|
-
|
|
212
|
+
const stopHooks = (hooks.stop ?? []).filter((handler) => !isManagedHookCommand(handler.command, CURSOR_HOOK_COMMAND));
|
|
213
|
+
stopHooks.push({
|
|
212
214
|
command: CURSOR_HOOK_COMMAND,
|
|
213
|
-
matcher: CURSOR_HOOK_MATCHER,
|
|
214
215
|
timeout: 120
|
|
215
216
|
});
|
|
216
|
-
hooks.postToolUse =
|
|
217
|
+
hooks.postToolUse = (hooks.postToolUse ?? []).filter((handler) => !isManagedHookCommand(handler.command, CURSOR_HOOK_COMMAND));
|
|
218
|
+
hooks.stop = stopHooks;
|
|
217
219
|
writeJsonFileWithDirectoryCheck(configPath, {
|
|
218
220
|
...config,
|
|
219
221
|
version: config.version ?? CURSOR_HOOKS_SCHEMA_VERSION,
|
|
220
222
|
hooks
|
|
221
223
|
});
|
|
222
|
-
writeHookScript(hookPath);
|
|
224
|
+
writeHookScript(hookPath, "stop");
|
|
223
225
|
return [configPath, hookPath];
|
|
224
226
|
};
|
|
225
|
-
const buildAgentHookScript = () => [
|
|
227
|
+
const buildAgentHookScript = (hookEventName) => [
|
|
226
228
|
"import { existsSync, readFileSync, writeFileSync, unlinkSync } from 'node:fs';",
|
|
227
229
|
"import { tmpdir } from 'node:os';",
|
|
228
230
|
"import { join, dirname } from 'node:path';",
|
|
@@ -231,12 +233,12 @@ const buildAgentHookScript = () => [
|
|
|
231
233
|
"",
|
|
232
234
|
"const __filename = fileURLToPath(import.meta.url);",
|
|
233
235
|
"const __dirname = dirname(__filename);",
|
|
236
|
+
`const HOOK_EVENT_NAME = ${JSON.stringify(hookEventName)};`,
|
|
237
|
+
`const MAX_CONTINUATIONS = 1;`,
|
|
234
238
|
"",
|
|
235
239
|
"// --verbose scans on large diffs can exceed spawnSync's 1 MiB default.",
|
|
236
240
|
"const SPAWN_MAX_BUFFER_BYTES = 16 * 1024 * 1024;",
|
|
237
241
|
"",
|
|
238
|
-
"const EDIT_TOOL_NAMES = new Set(['Edit', 'Write', 'MultiEdit', 'NotebookEdit', 'ApplyPatch']);",
|
|
239
|
-
"",
|
|
240
242
|
"const readFileOrEmpty = (source) => {",
|
|
241
243
|
" try {",
|
|
242
244
|
" return readFileSync(source, 'utf8');",
|
|
@@ -246,13 +248,10 @@ const buildAgentHookScript = () => [
|
|
|
246
248
|
"};",
|
|
247
249
|
"",
|
|
248
250
|
"const shouldScan = (input) => {",
|
|
249
|
-
"
|
|
250
|
-
" if (
|
|
251
|
-
"
|
|
252
|
-
"
|
|
253
|
-
" }",
|
|
254
|
-
" const toolName = input.tool_name || input.toolName || input.tool;",
|
|
255
|
-
" return !toolName || EDIT_TOOL_NAMES.has(toolName);",
|
|
251
|
+
" if (HOOK_EVENT_NAME === 'Stop') return !input.stop_hook_active;",
|
|
252
|
+
" if (input.status && input.status !== 'completed') return false;",
|
|
253
|
+
" const loopCount = Number(input.loop_count);",
|
|
254
|
+
" return !Number.isFinite(loopCount) || loopCount < MAX_CONTINUATIONS;",
|
|
256
255
|
"};",
|
|
257
256
|
"",
|
|
258
257
|
"const runReactDoctor = (outputPath) => {",
|
|
@@ -268,11 +267,11 @@ const buildAgentHookScript = () => [
|
|
|
268
267
|
" : './node_modules/.bin/react-doctor';",
|
|
269
268
|
" const commands = [",
|
|
270
269
|
" ...(existsSync(localBin)",
|
|
271
|
-
" ? [localBin + ' --verbose --scope changed --blocking warning --no-score']",
|
|
270
|
+
" ? [localBin + ' --verbose --scope changed --include-untracked --blocking warning --no-score']",
|
|
272
271
|
" : []),",
|
|
273
|
-
" 'react-doctor --verbose --scope changed --blocking warning --no-score',",
|
|
274
|
-
" 'pnpm dlx react-doctor@latest --verbose --scope changed --blocking warning --no-score',",
|
|
275
|
-
" 'npx --yes react-doctor@latest --verbose --scope changed --blocking warning --no-score',",
|
|
272
|
+
" 'react-doctor --verbose --scope changed --include-untracked --blocking warning --no-score',",
|
|
273
|
+
" 'pnpm dlx react-doctor@latest --verbose --scope changed --include-untracked --blocking warning --no-score',",
|
|
274
|
+
" 'npx --yes react-doctor@latest --verbose --scope changed --include-untracked --blocking warning --no-score',",
|
|
276
275
|
" ];",
|
|
277
276
|
"",
|
|
278
277
|
" for (const command of commands) {",
|
|
@@ -331,10 +330,10 @@ const buildAgentHookScript = () => [
|
|
|
331
330
|
"",
|
|
332
331
|
" const message = `React Doctor found issues in the changed files. Review this output and fix the regressions before finishing. For confirmed issues that cannot be fixed now, create GitHub issues with the rule, file/line, confidence, impact, and proposed fix.\\n\\n${scanOutput}`;",
|
|
333
332
|
"",
|
|
334
|
-
" if (
|
|
335
|
-
" console.log(JSON.stringify({
|
|
333
|
+
" if (HOOK_EVENT_NAME === 'Stop') {",
|
|
334
|
+
" console.log(JSON.stringify({ decision: 'block', reason: message }));",
|
|
336
335
|
" } else {",
|
|
337
|
-
" console.log(JSON.stringify({
|
|
336
|
+
" console.log(JSON.stringify({ followup_message: message }));",
|
|
338
337
|
" }",
|
|
339
338
|
"};",
|
|
340
339
|
"",
|
|
@@ -1005,7 +1004,10 @@ const installReactDoctorAgentHooksStep = (projectRoot, selectedAgents) => {
|
|
|
1005
1004
|
if (hookResult.installedAgents.length === 0) hookSpinner.succeed("No supported native agent hook targets selected.");
|
|
1006
1005
|
else {
|
|
1007
1006
|
hookSpinner.succeed(`React Doctor agent hooks installed for ${hookResult.installedAgents.map((agent) => getSkillAgentConfig(agent).displayName).join(", ")}.`);
|
|
1008
|
-
recordCount(METRIC.installAgentHooks, 1, {
|
|
1007
|
+
recordCount(METRIC.installAgentHooks, 1, {
|
|
1008
|
+
agentsCount: hookResult.installedAgents.length,
|
|
1009
|
+
hookEvent: "stop"
|
|
1010
|
+
});
|
|
1009
1011
|
}
|
|
1010
1012
|
} catch (error) {
|
|
1011
1013
|
hookSpinner.fail("Failed to install React Doctor agent hooks.");
|
|
@@ -1148,7 +1150,7 @@ const runInstallReactDoctor = async (options = {}) => {
|
|
|
1148
1150
|
for (const agent of selectedAgents) recordCount(METRIC.installAgent, 1, { agent });
|
|
1149
1151
|
};
|
|
1150
1152
|
//#endregion
|
|
1151
|
-
export { askUpgradeActionVersion as a, recordCiPromptDecision as c, installReactDoctorAgentHooks as i, hasHandledActionUpgrade as l, runInstallReactDoctor as n, askAddToGitHubActions as o,
|
|
1153
|
+
export { askUpgradeActionVersion as a, recordCiPromptDecision as c, installReactDoctorAgentHooks as i, hasHandledActionUpgrade as l, runInstallReactDoctor as n, askAddToGitHubActions as o, findAgentsWithOutdatedReactDoctorHooks as r, hasHandledCiPrompt as s, getSkillSourceDirectory as t, recordActionUpgradeDecision as u };
|
|
1152
1154
|
|
|
1153
|
-
//# sourceMappingURL=install-react-doctor-
|
|
1154
|
-
//# debugId=
|
|
1155
|
+
//# sourceMappingURL=install-react-doctor-DoKoYt2g.js.map
|
|
1156
|
+
//# debugId=b50f4ab7-d9c5-5dbe-8b22-b3fe852a7489
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
3
|
-
import {
|
|
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]="fb0e1f81-6710-503f-ae9b-0cb9eb49424a")}catch(e){}}();
|
|
3
|
+
import { Gt as highlighter, g as VERSION, kn as gen, wn as log } from "./record-metric-DFQYh2Mf.js";
|
|
4
4
|
//#region src/cli/utils/print-branded-header.ts
|
|
5
5
|
/**
|
|
6
6
|
* Single branded line every command prints first when not in JSON
|
|
@@ -18,5 +18,5 @@ const printBrandedHeader = gen(function* () {
|
|
|
18
18
|
//#endregion
|
|
19
19
|
export { printBrandedHeader as t };
|
|
20
20
|
|
|
21
|
-
//# sourceMappingURL=print-branded-header-
|
|
22
|
-
//# debugId=
|
|
21
|
+
//# sourceMappingURL=print-branded-header-514lsPsP.js.map
|
|
22
|
+
//# debugId=fb0e1f81-6710-503f-ae9b-0cb9eb49424a
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|