@remylagerweij/vue-doctor 2.0.1 → 2.0.2

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 CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
- import { a as logger, c as getToolVersions, d as loadConfig, i as configureLogger, l as mapWithConcurrency, n as diagnose, o as output, r as createKnipSession, s as highlighter, t as NoVueDependencyError, u as createPrivateTempDirectory } from "./diagnose-BdHGmTpm.js";
2
+ import { a as logger, c as getToolVersions, d as loadConfig, i as configureLogger, l as mapWithConcurrency, n as diagnose, o as output, r as createKnipSession, s as highlighter, t as NoVueDependencyError, u as createPrivateTempDirectory } from "./diagnose-DCDjxRw-.js";
3
3
  import { _ as getCanonicalRuleId, d as PLUGIN_NAME, f as RULE_REGISTRY, i as createBaseline, l as ruleIdOf, n as DEFAULT_BASELINE_FILENAME, o as writeBaseline, y as getRuleMeta } from "./baseline-BKB_9B33.js";
4
4
  import { n as isMonorepoRoot } from "./find-monorepo-root-DePS93uu.js";
5
- import { c as listWorkspacePackages, f as MILLISECONDS_PER_SECOND, g as VERSION$1, i as getRootPackage, n as discoverVueSubprojects, r as formatFrameworkName, t as discoverProject } from "./discover-project-Bgz3pq6f.js";
6
- import { a as filterSourceFiles, c as EXIT_CODES, d as evaluateGate, l as FAIL_ON_VALUES, n as registerExplainCommand, o as getDiffInfo, r as registerRulesCommand, s as docsUrl, u as GATE_SCOPE_VALUES } from "./rules-BTNz1N64.js";
5
+ import { c as listWorkspacePackages, f as MILLISECONDS_PER_SECOND, g as VERSION$1, i as getRootPackage, n as discoverVueSubprojects, r as formatFrameworkName, t as discoverProject } from "./discover-project-DrQCWqKC.js";
6
+ import { a as filterSourceFiles, c as EXIT_CODES, d as evaluateGate, l as FAIL_ON_VALUES, n as registerExplainCommand, o as getDiffInfo, r as registerRulesCommand, s as docsUrl, u as GATE_SCOPE_VALUES } from "./rules-B9fi0v2a.js";
7
7
  import { n as REPORT_SCHEMA_URL, t as REPORT_FORMAT } from "./constants-CeYU52R7.js";
8
8
  import fs from "node:fs";
9
9
  import path from "node:path";
@@ -579,6 +579,10 @@ const toTrustedUrl = (url, trustedBaseUrl) => {
579
579
  /** Keeps only characters that are safe inside an HTML comment marker (no `-`, so `-->` cannot occur). */
580
580
  const sanitizeMarkerId = (id) => id.replace(/[^A-Za-z0-9_.:]/g, "");
581
581
  const SUMMARY_MARKER = "<!-- vue-doctor:summary -->";
582
+ /** Sticky summary marker for one scanned directory; the repository root keeps the unscoped marker. */
583
+ const summaryMarker = (scope = "") => scope ? `<!-- vue-doctor:summary:${sanitizeMarkerScope(scope)} -->` : SUMMARY_MARKER;
584
+ /** Keeps a repository path usable inside an HTML comment marker. */
585
+ const sanitizeMarkerScope = (scope) => scope.replace(/[^A-Za-z0-9_./@-]/g, "");
582
586
  const DEFAULT_MAX_FINDINGS = 50;
583
587
  const DEFAULT_MAX_FINDINGS_PER_RULE = 10;
584
588
  /** Room kept for the "not shown" notice and closing tags when the findings list is cut. */
@@ -616,11 +620,11 @@ const renderCategoryTable = (project) => {
616
620
  ""
617
621
  ];
618
622
  };
619
- const renderProjectSummary = (project, heading, docsBaseUrl) => {
623
+ const renderProjectSummary = (project, heading, docsBaseUrl, scope = "") => {
620
624
  const { score } = project;
621
625
  const lines = [];
622
626
  const scoreText = `${scoreIcon(score.value)} **${score.value}/100** (${escapeMarkdown(score.label)})`;
623
- if (heading === null) lines.push(`## 🩺 Vue Doctor: ${scoreText}`, "");
627
+ if (heading === null) lines.push(`## 🩺 Vue Doctor${scope ? ` (${markdownCode(scope)})` : ""}: ${scoreText}`, "");
624
628
  else lines.push(`### ${escapeMarkdown(heading)}: ${scoreText}`, "");
625
629
  if (score.cap) lines.push(`> **Score capped at ${score.cap.value}** (${score.rawScore} before the cap) because of a ${CAP_REASONS[score.cap.reason]} in ${markdownCode(score.cap.ruleId)}.`, "");
626
630
  const counts = [plural$1(project.summary.errors, "error"), plural$1(project.summary.warnings, "warning")];
@@ -648,8 +652,8 @@ const renderProjectSummary = (project, heading, docsBaseUrl) => {
648
652
  const renderMarkdownSummary = (report, options = {}) => {
649
653
  const docsBaseUrl = options.docsBaseUrl ?? "https://remylagerweij.github.io/vue-doctor";
650
654
  const lines = [];
651
- if (options.stickyMarker) lines.push(SUMMARY_MARKER, "");
652
- if (report.projects.length === 1) lines.push(...renderProjectSummary(report.projects[0], null, docsBaseUrl));
655
+ if (options.stickyMarker) lines.push(summaryMarker(options.scope), "");
656
+ if (report.projects.length === 1) lines.push(...renderProjectSummary(report.projects[0], null, docsBaseUrl, options.scope));
653
657
  else {
654
658
  lines.push(`## 🩺 Vue Doctor: ${plural$1(report.summary.projects, "project")}`, "", `${plural$1(report.summary.errors, "error")} · ${plural$1(report.summary.warnings, "warning")}`, "");
655
659
  for (const project of report.projects) lines.push(...renderProjectSummary(project, project.name, docsBaseUrl));
@@ -1824,8 +1828,8 @@ const createBatchProgressReporter = async (options) => {
1824
1828
  //#region src/scan.ts
1825
1829
  const printProjectDetection = (projectInfo, isDiffMode, includePaths) => {
1826
1830
  const lines = [];
1827
- const title = `${pc.bold(pc.green("Vue Doctor"))} ${pc.dim("v2.0.1")}`;
1828
- lines.push(createFramedLine(`Vue Doctor v2.0.1`, title));
1831
+ const title = `${pc.bold(pc.green("Vue Doctor"))} ${pc.dim("v2.0.2")}`;
1832
+ lines.push(createFramedLine(`Vue Doctor v2.0.2`, title));
1829
1833
  const vueVersionDisplay = projectInfo.vueVersion ? `Vue ${projectInfo.vueVersion}` : "Vue";
1830
1834
  const frameworkDisplay = formatFrameworkName(projectInfo.framework);
1831
1835
  const projectLine = `${projectInfo.projectName} · ${frameworkDisplay} · ${vueVersionDisplay}`;
@@ -2172,6 +2176,14 @@ var GitHubClient = class {
2172
2176
  };
2173
2177
  //#endregion
2174
2178
  //#region src/ci/feedback.ts
2179
+ const SCOPE_MARKER_PREFIX = "<!-- vue-doctor:scope:";
2180
+ const normalizeScope = (prefix = "") => prefix.split("/").filter((part) => part !== "" && part !== ".").join("/");
2181
+ const scopeMarker = (scope) => `${SCOPE_MARKER_PREFIX}${sanitizeMarkerScope(scope)} -->`;
2182
+ /** The scanned directory a review comment belongs to; comments without a scope marker belong to the repository root. */
2183
+ const extractScope = (body) => {
2184
+ const match = body.match(/<!-- vue-doctor:scope:([^\s]*) -->/);
2185
+ return match ? match[1] : "";
2186
+ };
2175
2187
  /**
2176
2188
  * Extracts the marker ID from a comment body if present.
2177
2189
  */
@@ -2182,8 +2194,9 @@ const extractFindingMarker = (body) => {
2182
2194
  /**
2183
2195
  * Groups findings according to the specified grouping mode.
2184
2196
  */
2185
- const groupFindings = (findings, grouping, agentPrompt) => {
2197
+ const groupFindings = (findings, grouping, agentPrompt, scope = "") => {
2186
2198
  if (findings.length === 0) return [];
2199
+ const withScope = (body) => scope ? `${body.trimEnd()}\n${scopeMarker(scope)}\n` : body;
2187
2200
  if (grouping === "finding") return findings.map((finding) => {
2188
2201
  const markerId = sanitizeMarkerId(finding.fingerprint || `${finding.file}:${finding.line}:${finding.ruleId}`);
2189
2202
  const body = renderMarkdownFinding(finding, {
@@ -2197,7 +2210,7 @@ const groupFindings = (findings, grouping, agentPrompt) => {
2197
2210
  line: Math.max(1, finding.line),
2198
2211
  ruleId: finding.ruleId,
2199
2212
  findings: [finding],
2200
- body
2213
+ body: withScope(body)
2201
2214
  };
2202
2215
  });
2203
2216
  const groups = /* @__PURE__ */ new Map();
@@ -2229,7 +2242,7 @@ const groupFindings = (findings, grouping, agentPrompt) => {
2229
2242
  line: Math.max(1, first.line),
2230
2243
  ruleId: first.ruleId,
2231
2244
  findings: groupList,
2232
- body: lines.join("\n") + "\n"
2245
+ body: withScope(lines.join("\n") + "\n")
2233
2246
  });
2234
2247
  }
2235
2248
  return commentGroups;
@@ -2239,11 +2252,14 @@ const groupFindings = (findings, grouping, agentPrompt) => {
2239
2252
  */
2240
2253
  const postStickySummary = async (client, options, report) => {
2241
2254
  if (!options.pullNumber) return;
2255
+ const scope = normalizeScope(options.sourceRootPrefix);
2242
2256
  const summaryMarkdown = renderMarkdownSummary(report, {
2243
2257
  stickyMarker: true,
2244
- collapseFindings: true
2258
+ collapseFindings: true,
2259
+ scope
2245
2260
  });
2246
- const existing = (await client.listIssueComments(options.owner, options.repo, options.pullNumber)).find((c) => c.body?.includes(SUMMARY_MARKER));
2261
+ const marker = summaryMarker(scope);
2262
+ const existing = (await client.listIssueComments(options.owner, options.repo, options.pullNumber)).find((c) => c.body?.includes(marker));
2247
2263
  if (existing) {
2248
2264
  if (existing.body !== summaryMarkdown) {
2249
2265
  logger.log(`Updating sticky summary comment #${existing.id}...`);
@@ -2260,17 +2276,18 @@ const postStickySummary = async (client, options, report) => {
2260
2276
  const postReviewComments = async (client, options, report) => {
2261
2277
  if (!options.pullNumber) return;
2262
2278
  const prefix = options.sourceRootPrefix ?? "";
2279
+ const scope = normalizeScope(prefix);
2263
2280
  const allFindings = report.projects.flatMap((p) => p.findings.map((finding) => ({
2264
2281
  ...finding,
2265
2282
  file: toRepoPath(prefix, p.root, finding.file)
2266
2283
  })));
2267
- const activeGroups = groupFindings(allFindings, options.grouping, options.agentPrompt).slice(0, options.maxComments);
2284
+ const activeGroups = groupFindings(allFindings, options.grouping, options.agentPrompt, scope).slice(0, options.maxComments);
2268
2285
  const activeMarkers = new Set(activeGroups.map((g) => g.marker));
2269
2286
  const existingComments = await client.listReviewComments(options.owner, options.repo, options.pullNumber);
2270
2287
  const trackedComments = /* @__PURE__ */ new Map();
2271
2288
  for (const c of existingComments) {
2272
2289
  const marker = extractFindingMarker(c.body);
2273
- if (marker) trackedComments.set(marker, {
2290
+ if (marker && extractScope(c.body) === scope) trackedComments.set(marker, {
2274
2291
  id: c.id,
2275
2292
  body: c.body
2276
2293
  });
@@ -2961,7 +2978,7 @@ const registerInitCommand = (program) => {
2961
2978
  const projectDir = path.resolve(directoryArg);
2962
2979
  const isInteractive = Boolean(process.stdin.isTTY) && !options.yes;
2963
2980
  const clack = isInteractive ? await import("@clack/prompts") : null;
2964
- const { discoverProject, formatFrameworkName } = await import("./discover-project-CDEFT0XH.js");
2981
+ const { discoverProject, formatFrameworkName } = await import("./discover-project-DhOxGanX.js");
2965
2982
  const { isMonorepoRoot } = await import("./find-monorepo-root-DhN-SSup.js");
2966
2983
  const projectInfo = discoverProject(projectDir);
2967
2984
  if (isInteractive && clack) {
@@ -3148,7 +3165,7 @@ const registerInitCommand = (program) => {
3148
3165
  if (spinner) spinner.start("Scanning project to record baseline snapshot...");
3149
3166
  else logger.log("Scanning project to record baseline snapshot...");
3150
3167
  try {
3151
- const { diagnose } = await import("./diagnose-CGPcvfhI.js");
3168
+ const { diagnose } = await import("./diagnose-CfTVpINk.js");
3152
3169
  const { createBaseline, writeBaseline } = await import("./baseline-CvI0x3dv.js");
3153
3170
  const baselineData = createBaseline((await diagnose(projectDir, { baseline: null })).diagnostics);
3154
3171
  writeBaseline(path.join(projectDir, baselineFileName), baselineData);
@@ -3168,13 +3185,13 @@ const registerInitCommand = (program) => {
3168
3185
  //#region src/commands/mcp.ts
3169
3186
  const registerMcpCommand = (program) => {
3170
3187
  program.command("mcp").description("Start Model Context Protocol (MCP) server over stdio for AI agents").action(async () => {
3171
- const { McpServer } = await import("./server-BdR8FjL9.js");
3188
+ const { McpServer } = await import("./server-B2KIHhnE.js");
3172
3189
  new McpServer().startStdio();
3173
3190
  });
3174
3191
  };
3175
3192
  //#endregion
3176
3193
  //#region src/program.ts
3177
- const VERSION = "2.0.1";
3194
+ const VERSION = "2.0.2";
3178
3195
  const parseScore = (value) => {
3179
3196
  const score = Number(value);
3180
3197
  if (!Number.isInteger(score) || score < 0 || score > 100) throw new InvalidArgumentError("Expected an integer between 0 and 100.");
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import { n as diagnose } from "./diagnose-DCDjxRw-.js";
3
+ export { diagnose };
@@ -2,7 +2,7 @@
2
2
  import { S as CUSTOM_TEMPLATE_RULES, a as readBaseline, b as toDiagnosticRule, c as resolveRuleKey, d as PLUGIN_NAME, g as createTemplateRuleConfig, h as createOxlintConfig, l as ruleIdOf, m as createCustomTemplateRuleConfig, r as applyBaseline, s as createRuleIdReporter, u as AUDIT_RULES, v as getEnabledFsRules, x as CUSTOM_TEMPLATE_PLUGIN_NAME, y as getRuleMeta } from "./baseline-BKB_9B33.js";
3
3
  import { i as normalizeRelativePath, n as isInsideAnyDirectory, r as listProjectSourceFiles, t as LINTABLE_FILE_PATTERN } from "./list-source-files-CUakQejy.js";
4
4
  import { n as isMonorepoRoot, r as readPackageJson, t as findMonorepoRoot } from "./find-monorepo-root-DePS93uu.js";
5
- import { _ as VUE_FILE_PATTERN, c as listWorkspacePackages, d as ERROR_RULE_PENALTY, o as listNestedWorkspaceDirectories, p as OXLINT_NODE_REQUIREMENT, s as listWorkspaceDirectories, t as discoverProject, v as WARNING_RULE_PENALTY } from "./discover-project-Bgz3pq6f.js";
5
+ import { _ as VUE_FILE_PATTERN, c as listWorkspacePackages, d as ERROR_RULE_PENALTY, o as listNestedWorkspaceDirectories, p as OXLINT_NODE_REQUIREMENT, s as listWorkspaceDirectories, t as discoverProject, v as WARNING_RULE_PENALTY } from "./discover-project-DrQCWqKC.js";
6
6
  import { createRequire } from "node:module";
7
7
  import fs from "node:fs";
8
8
  import path from "node:path";
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import { r as formatFrameworkName, t as discoverProject } from "./discover-project-Bgz3pq6f.js";
2
+ import { r as formatFrameworkName, t as discoverProject } from "./discover-project-DrQCWqKC.js";
3
3
  export { discoverProject, formatFrameworkName };
@@ -13,7 +13,7 @@ const SPAWN_ARGS_MAX_LENGTH_CHARS = 24e3;
13
13
  const DEFAULT_BRANCH_CANDIDATES = ["main", "master"];
14
14
  const ERROR_RULE_PENALTY = 1.5;
15
15
  const WARNING_RULE_PENALTY = .75;
16
- const VERSION = "2.0.1";
16
+ const VERSION = "2.0.2";
17
17
  const OXLINT_NODE_REQUIREMENT = "^22.12.0 || >=24.0.0";
18
18
  //#endregion
19
19
  //#region src/utils/discover-project.ts
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import { a as logger } from "./diagnose-BdHGmTpm.js";
2
+ import { a as logger } from "./diagnose-DCDjxRw-.js";
3
3
  import { _ as getCanonicalRuleId, f as RULE_REGISTRY, p as categorySlug } from "./baseline-BKB_9B33.js";
4
- import { l as DEFAULT_BRANCH_CANDIDATES, m as SOURCE_FILE_PATTERN, u as DOCS_BASE_URL } from "./discover-project-Bgz3pq6f.js";
4
+ import { l as DEFAULT_BRANCH_CANDIDATES, m as SOURCE_FILE_PATTERN, u as DOCS_BASE_URL } from "./discover-project-DrQCWqKC.js";
5
5
  import fs from "node:fs";
6
6
  import path from "node:path";
7
7
  import { spawnSync } from "node:child_process";
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import { n as diagnose } from "./diagnose-BdHGmTpm.js";
2
+ import { n as diagnose } from "./diagnose-DCDjxRw-.js";
3
3
  import { _ as getCanonicalRuleId, f as RULE_REGISTRY } from "./baseline-BKB_9B33.js";
4
- import { g as VERSION } from "./discover-project-Bgz3pq6f.js";
5
- import { a as filterSourceFiles, i as toRuleInfo, o as getDiffInfo, t as findRuleMeta } from "./rules-BTNz1N64.js";
4
+ import { g as VERSION } from "./discover-project-DrQCWqKC.js";
5
+ import { a as filterSourceFiles, i as toRuleInfo, o as getDiffInfo, t as findRuleMeta } from "./rules-B9fi0v2a.js";
6
6
  import path from "node:path";
7
7
  import readline from "node:readline";
8
8
  //#region src/mcp/server.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remylagerweij/vue-doctor",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "Diagnose and fix performance issues in your Vue.js app",
5
5
  "keywords": [
6
6
  "diagnostics",
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import { n as diagnose } from "./diagnose-BdHGmTpm.js";
3
- export { diagnose };