Skip to content

Feat: CLI Summary - #17

Merged
JosephMaynard merged 8 commits into
masterfrom
feat/cli-summery
Mar 1, 2026
Merged

JosephMaynard merged 8 commits into
masterfrom
feat/cli-summery

Conversation

@JosephMaynard

@JosephMaynard JosephMaynard commented Mar 1, 2026 •

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Added a --no-report mode so analyses can run without producing or auto-opening HTML/JSON artifacts; CLI prints a textual summary instead.
    • CLI now shows colorized status lines and a structured per-run summary.
  • Behavior

    • Listing, audit and outdated operations can skip writing temporary or output files when reporting is disabled; summary/output shapes adapt accordingly.
  • Documentation

    • README updated with --no-report guidance, temp-file notes, CLI summary, and expanded JSON output examples.

@coderabbitai

coderabbitai Bot commented Mar 1, 2026 •

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a CLI flag --no-report and threads a persist/no-persist toggle through CLI and runner modules so analysis can run without writing HTML/JSON or .dependency-radar artifacts; also adds CLI summary rendering, colorized status output, and spinner enhancements.

Changes

Cohort / File(s) Summary
Documentation
README.md
Adds --no-report usage, notes --keep-temp interaction, expands CLI summary and JSON schema example.
CLI core & UI
src/cli.ts
Adds noReport to CliOptions, imports AggregatedData, extends arg parsing/help, adds color/spinner utilities, builds/prints run summaries, and gates auto-open and artifact emission when noReport is set.
Import graph runner
src/runners/importGraphRunner.ts
Adds options/persist flag to runImportGraph; disk writes (output/error) and returned file are conditional on persistence.
Package audit runner
src/runners/npmAudit.ts
Adds options.persistToDisk to runPackageAudit; success/failure diagnostic writes and returned file are conditional on persistence.
npm ls runner
src/runners/npmLs.ts
Adds persistToDisk?: boolean to LsProgressOptions; run paths (lockfile, normalize, pnpm fallback, Yarn) now conditionally write diagnostics/results and include file only when persisted; adds helpers buildLsCommand, runPnpmLsWithFallback, splitYarnLabel.
Outdated runner
src/runners/npmOutdated.ts
Adds options.persistToDisk to runPackageOutdated; all write and returned file behavior is conditional on persistence; updates docs/comments accordingly.

Sequence Diagram(s)

sequenceDiagram
  participant CLI
  participant Aggregator
  participant Runner as "Runner(s)"
  participant Disk as "Disk (.dependency-radar/)"
  participant User

  CLI->>Aggregator: parse options (includes --no-report)
  Aggregator->>Runner: run tasks with persistToDisk flag
  alt persistToDisk = true
    Runner->>Disk: write JSON/HTML/artifacts
    Runner-->>Aggregator: result + file path
  else persistToDisk = false
    Runner-->>Aggregator: result (no file)
  end
  Aggregator->>CLI: buildCliSummary(AggregatedData)
  CLI-->>User: print summary & status (colorized)
Loading

Estimated Code Review Effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly Related PRs

Poem

🐰 I hopped through logs with gentle paws,
Scanned the shrubs without leaving claws,
No HTML blooms, no JSON trail—
Just quiet data on a transient veil,
A tidy radar, carrot-sweet applause 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Feat: CLI Summary' is vague and does not clearly describe the specific changes or main objectives of the pull request. Consider making the title more specific, such as 'Add CLI summary output and --no-report flag' to better convey the main changes and scope of the pull request.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 87.50% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/cli-summery

Comment @coderabbitai help to get the list of available commands and usage tips.

@JosephMaynard JosephMaynard changed the title Feat/cli summery Feat: CLI Summery Mar 1, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (3)
src/runners/npmOutdated.ts (1)

102-107: Consider standardizing runner persistence APIs on an options object.

This runner uses a positional boolean while other runners use { persistToDisk }; unifying reduces call-site mistakes and keeps runner contracts consistent.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/runners/npmOutdated.ts` around lines 102 - 107, The runPackageOutdated
function currently accepts a positional boolean for persistence; change its
signature to accept an options object (e.g., replace the positional parameter
with options: { persistToDisk?: boolean } = {}) and default persistToDisk to
true inside that options object, update references inside runPackageOutdated to
use options.persistToDisk, and update all callers of runPackageOutdated to pass
an options object ({ persistToDisk }) instead of a positional boolean to match
other runners' APIs.
README.md (1)

224-229: Add one line about --keep-temp with --no-report.

Consider adding a short note that --keep-temp has no effect when --no-report is set, so users don’t expect .dependency-radar/ output in that mode.

Based on learnings, "Temporary files in .dependency-radar/ may contain dependency metadata; avoid committing them and remove unless debugging with --keep-temp."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@README.md` around lines 224 - 229, Update the README section showing "npx
dependency-radar --no-report" to add a single-line note stating that the
--keep-temp flag has no effect when --no-report is used and that temporary files
in .dependency-radar/ may contain dependency metadata and should not be
committed (remove them unless debugging with --keep-temp); place this sentence
directly beneath the example so readers immediately see the caveat.
src/runners/npmLs.ts (1)

24-32: Update the function contract docs for conditional file output.

The current comment still implies file is always present; now it’s conditional on options.persistToDisk !== false.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/runners/npmLs.ts` around lines 24 - 32, Update the function JSDoc to
state that `file` is conditional: when `options.persistToDisk === false` the
returned object will omit `file` (or set it to undefined), otherwise `file` is
the path written to disk; keep the rest of the return description for `data` and
`error` intact and reference `options.persistToDisk` and the `data`, `file`,
`error` fields so callers understand the conditional presence of `file`.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/cli.ts`:
- Around line 1241-1243: The code counts a dependency as "unused" when
importUsage is missing because it uses a falsy check; change the condition to
only treat an explicitly false importUsage as unused. Update the if in
src/cli.ts (the block using dep.usage.direct, dep.usage.scope and
dep.usage.importUsage) so the last clause is dep.usage.importUsage === false
(and keep the existing dep.usage.direct and dep.usage.scope === "runtime"
checks) to avoid inflating metrics when importUsage is undefined.

---

Nitpick comments:
In `@README.md`:
- Around line 224-229: Update the README section showing "npx dependency-radar
--no-report" to add a single-line note stating that the --keep-temp flag has no
effect when --no-report is used and that temporary files in .dependency-radar/
may contain dependency metadata and should not be committed (remove them unless
debugging with --keep-temp); place this sentence directly beneath the example so
readers immediately see the caveat.

In `@src/runners/npmLs.ts`:
- Around line 24-32: Update the function JSDoc to state that `file` is
conditional: when `options.persistToDisk === false` the returned object will
omit `file` (or set it to undefined), otherwise `file` is the path written to
disk; keep the rest of the return description for `data` and `error` intact and
reference `options.persistToDisk` and the `data`, `file`, `error` fields so
callers understand the conditional presence of `file`.

In `@src/runners/npmOutdated.ts`:
- Around line 102-107: The runPackageOutdated function currently accepts a
positional boolean for persistence; change its signature to accept an options
object (e.g., replace the positional parameter with options: { persistToDisk?:
boolean } = {}) and default persistToDisk to true inside that options object,
update references inside runPackageOutdated to use options.persistToDisk, and
update all callers of runPackageOutdated to pass an options object ({
persistToDisk }) instead of a positional boolean to match other runners' APIs.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0b9eaf1 and 3adf207.

⛔ Files ignored due to path filters (5)
  • dist/cli.js is excluded by !**/dist/**
  • dist/runners/importGraphRunner.js is excluded by !**/dist/**
  • dist/runners/npmAudit.js is excluded by !**/dist/**
  • dist/runners/npmLs.js is excluded by !**/dist/**
  • dist/runners/npmOutdated.js is excluded by !**/dist/**
📒 Files selected for processing (6)
  • README.md
  • src/cli.ts
  • src/runners/importGraphRunner.ts
  • src/runners/npmAudit.ts
  • src/runners/npmLs.ts
  • src/runners/npmOutdated.ts

Comment thread src/cli.ts Outdated
Comment on lines +1241 to +1243
if (dep.usage.direct && dep.usage.scope === "runtime" && !dep.usage.importUsage) {
unusedInstalledDeps += 1;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Avoid treating missing import-usage data as “unused dependency.”

This currently counts dependencies as unused when importUsage is absent, which can happen from unavailable/partial import graph data and inflate the metric.

💡 Proposed fix
-    if (dep.usage.direct && dep.usage.scope === "runtime" && !dep.usage.importUsage) {
+    const importFileCount = dep.usage.importUsage?.fileCount;
+    if (
+      dep.usage.direct &&
+      dep.usage.scope === "runtime" &&
+      typeof importFileCount === "number" &&
+      importFileCount === 0
+    ) {
       unusedInstalledDeps += 1;
     }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (dep.usage.direct && dep.usage.scope === "runtime" && !dep.usage.importUsage) {
unusedInstalledDeps += 1;
}
const importFileCount = dep.usage.importUsage?.fileCount;
if (
dep.usage.direct &&
dep.usage.scope === "runtime" &&
typeof importFileCount === "number" &&
importFileCount === 0
) {
unusedInstalledDeps += 1;
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/cli.ts` around lines 1241 - 1243, The code counts a dependency as
"unused" when importUsage is missing because it uses a falsy check; change the
condition to only treat an explicitly false importUsage as unused. Update the if
in src/cli.ts (the block using dep.usage.direct, dep.usage.scope and
dep.usage.importUsage) so the last clause is dep.usage.importUsage === false
(and keep the existing dep.usage.direct and dep.usage.scope === "runtime"
checks) to avoid inflating metrics when importUsage is undefined.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
src/cli.ts (1)

1246-1252: ⚠️ Potential issue | 🟡 Minor

Make unused-dependency counting explicit with fileCount === 0.

On Line 1250, using !dep.usage.importUsage can still blur “unknown” vs “unused”. Prefer counting only when a numeric import file count is explicitly zero.

💡 Suggested fix
-    if (
-      options.importGraphComplete &&
-      dep.usage.direct &&
-      dep.usage.scope === "runtime" &&
-      !dep.usage.importUsage
-    ) {
+    const importFileCount = dep.usage.importUsage?.fileCount;
+    if (
+      options.importGraphComplete &&
+      dep.usage.direct &&
+      dep.usage.scope === "runtime" &&
+      typeof importFileCount === "number" &&
+      importFileCount === 0
+    ) {
       unusedInstalledDeps += 1;
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/cli.ts` around lines 1246 - 1252, The current unused-dependency increment
uses a truthy check (!dep.usage.importUsage) which conflates "unknown" with
"unused"; change the condition in the block that updates unusedInstalledDeps to
explicitly test that importUsage.fileCount is numeric zero (e.g., use
dep.usage.importUsage?.fileCount === 0) so only dependencies with a known import
file count of 0 are counted; keep the other conditions
(options.importGraphComplete, dep.usage.direct, dep.usage.scope === "runtime")
unchanged and still reference unusedInstalledDeps, dep.usage.direct,
dep.usage.scope, and options.importGraphComplete when locating the code to
modify.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@src/cli.ts`:
- Around line 1246-1252: The current unused-dependency increment uses a truthy
check (!dep.usage.importUsage) which conflates "unknown" with "unused"; change
the condition in the block that updates unusedInstalledDeps to explicitly test
that importUsage.fileCount is numeric zero (e.g., use
dep.usage.importUsage?.fileCount === 0) so only dependencies with a known import
file count of 0 are counted; keep the other conditions
(options.importGraphComplete, dep.usage.direct, dep.usage.scope === "runtime")
unchanged and still reference unusedInstalledDeps, dep.usage.direct,
dep.usage.scope, and options.importGraphComplete when locating the code to
modify.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3adf207 and 1250b1c.

⛔ Files ignored due to path filters (3)
  • dist/cli.js is excluded by !**/dist/**
  • dist/runners/npmLs.js is excluded by !**/dist/**
  • dist/runners/npmOutdated.js is excluded by !**/dist/**
📒 Files selected for processing (4)
  • README.md
  • src/cli.ts
  • src/runners/npmLs.ts
  • src/runners/npmOutdated.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/runners/npmOutdated.ts
  • README.md

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
src/cli.ts (1)

1260-1265: ⚠️ Potential issue | 🟡 Minor

Don’t count unknown import-usage as “unused.”

On Line 1264, !dep.usage.importUsage treats missing/unknown usage as unused and can inflate unusedInstalledDeps. This concern was already raised in prior review feedback and still appears unresolved.

💡 Proposed fix
-    if (
-      options.importGraphComplete &&
-      dep.usage.direct &&
-      dep.usage.scope === "runtime" &&
-      !dep.usage.importUsage
-    ) {
+    const importFileCount = dep.usage.importUsage?.fileCount;
+    if (
+      options.importGraphComplete &&
+      dep.usage.direct &&
+      dep.usage.scope === "runtime" &&
+      typeof importFileCount === "number" &&
+      importFileCount === 0
+    ) {
       unusedInstalledDeps += 1;
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/cli.ts` around lines 1260 - 1265, The condition treating missing/unknown
import usage as unused should be tightened: instead of using
!dep.usage.importUsage (which treats undefined/null as false), only count a
dependency as unused when importUsage is explicitly false; update the
conditional that uses options.importGraphComplete && dep.usage.direct &&
dep.usage.scope === "runtime" && !dep.usage.importUsage to check
dep.usage.importUsage === false, so unknown/missing values are not included in
unusedInstalledDeps.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/cli.ts`:
- Line 1366: Replace the expression-bodied forEach call on blockerDetails with a
for...of loop to satisfy the useIterableCallbackReturn lint rule: iterate over
blockerDetails using for (const line of blockerDetails) and call
console.log(line) inside the loop body so the callback is not an
expression-returning function; update the code where
blockerDetails.forEach((line) => console.log(line)) is present.

---

Duplicate comments:
In `@src/cli.ts`:
- Around line 1260-1265: The condition treating missing/unknown import usage as
unused should be tightened: instead of using !dep.usage.importUsage (which
treats undefined/null as false), only count a dependency as unused when
importUsage is explicitly false; update the conditional that uses
options.importGraphComplete && dep.usage.direct && dep.usage.scope === "runtime"
&& !dep.usage.importUsage to check dep.usage.importUsage === false, so
unknown/missing values are not included in unusedInstalledDeps.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1250b1c and e17e089.

⛔ Files ignored due to path filters (1)
  • dist/cli.js is excluded by !**/dist/**
📒 Files selected for processing (2)
  • README.md
  • src/cli.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • README.md

Comment thread src/cli.ts Outdated
@JosephMaynard JosephMaynard changed the title Feat: CLI Summery Feat: CLI Summary Mar 1, 2026
@coderabbitai

coderabbitai Bot commented Mar 1, 2026 •

Copy link
Copy Markdown
Contributor

Note

Docstrings generation - SUCCESS
Generated docstrings and committed to branch feat/cli-summery (commit: 441c2b61e001299214a88c8dbdc25831e7c8f113)

Docstrings generation was requested by @JosephMaynard.

The following files were modified:

* `src/cli.ts`
* `src/runners/importGraphRunner.ts`
* `src/runners/npmAudit.ts`
* `src/runners/npmLs.ts`
* `src/runners/npmOutdated.ts`

These file types are not supported:
* `README.md`

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (1)
src/cli.ts (1)

1341-1347: ⚠️ Potential issue | 🟡 Minor

Avoid counting unknown import-usage as unused dependencies.

This still treats absent importUsage as unused, which can inflate unusedInstalledDeps. Count only explicit “unused” signals.

💡 Suggested fix
-    if (
-      options.importGraphComplete &&
-      dep.usage.direct &&
-      dep.usage.scope === "runtime" &&
-      !dep.usage.importUsage
-    ) {
+    const importUsage = dep.usage.importUsage;
+    const importFileCount =
+      importUsage && typeof importUsage === "object"
+        ? (importUsage as { fileCount?: number }).fileCount
+        : undefined;
+    const explicitlyUnused =
+      importUsage === false ||
+      (typeof importFileCount === "number" && importFileCount === 0);
+    if (
+      options.importGraphComplete &&
+      dep.usage.direct &&
+      dep.usage.scope === "runtime" &&
+      explicitlyUnused
+    ) {
       unusedInstalledDeps += 1;
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/cli.ts` around lines 1341 - 1347, The current conditional in src/cli.ts
increments unusedInstalledDeps when importUsage is missing; change it to only
count explicit "unused" signals by adding a strict check for
dep.usage.importUsage === "unused" (while keeping options.importGraphComplete,
dep.usage.direct, and dep.usage.scope === "runtime" checks) so unknown/absent
importUsage values are excluded from unusedInstalledDeps increments.
🧹 Nitpick comments (1)
src/runners/npmAudit.ts (1)

84-90: Consider using an options object for consistency with other runners.

This function uses a positional boolean persistToDisk = true, while runPackageOutdated uses options: { persistToDisk?: boolean } and runNpmLs uses LsProgressOptions. Positional booleans reduce readability at call sites (e.g., runPackageAudit(path, temp, 'npm', undefined, false)).

♻️ Suggested refactor to align with other runners
+type AuditOptions = {
+  yarnVersion?: string;
+  persistToDisk?: boolean;
+};
+
 export async function runPackageAudit(
   projectPath: string,
   tempDir: string,
   tool: "npm" | "pnpm" | "yarn",
-  yarnVersion?: string,
-  persistToDisk = true,
+  options: AuditOptions = {},
 ): Promise<ToolResult<any>> {
+  const persistToDisk = options.persistToDisk !== false;
   const targetFile = path.join(tempDir, `${tool}-audit.json`);
   try {
-    const { cmd, args, lockFiles } = buildAuditCommand(tool, yarnVersion);
+    const { cmd, args, lockFiles } = buildAuditCommand(tool, options.yarnVersion);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/runners/npmAudit.ts` around lines 84 - 90, The runPackageAudit function
currently accepts a positional boolean persistToDisk; change its signature to
take an options object (e.g., options?: { persistToDisk?: boolean }) to match
runPackageOutdated and LsProgressOptions usage, update internal references
inside runPackageAudit to read options.persistToDisk with a default of true, and
update any call sites that pass the positional boolean (e.g., calls to
runPackageAudit(..., false)) to pass an options object { persistToDisk: false }
so call-site readability is preserved; keep the tool, yarnVersion, and other
parameters unchanged aside from switching the final boolean into the options
object.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/cli.ts`:
- Line 1412: The summary output prints "Licence mismatches" with British
spelling; change that literal to use the project's standard "License" spelling
so the console.log in this area prints `${bullet} License mismatches:
${summary.licenseMismatches}` instead of "Licence". Locate the console.log call
that emits the summary string (the line with `${bullet} Licence mismatches`) and
update the displayed label only, leaving the summary.licenseMismatches variable
intact.

In `@src/runners/npmLs.ts`:
- Around line 102-111: The JSDoc comment above the runPnpmLsWithFallback
function is missing the closing "*/", causing a syntax error; fix it by adding
the terminating "*/" immediately before the async function declaration for
runPnpmLsWithFallback (or otherwise close the JSDoc block so the comment ends)
so the function signature async function runPnpmLsWithFallback(projectPath:
string, targetFile: string, options: LsProgressOptions):
Promise<ToolResult<any>> is valid and the file compiles.

---

Duplicate comments:
In `@src/cli.ts`:
- Around line 1341-1347: The current conditional in src/cli.ts increments
unusedInstalledDeps when importUsage is missing; change it to only count
explicit "unused" signals by adding a strict check for dep.usage.importUsage ===
"unused" (while keeping options.importGraphComplete, dep.usage.direct, and
dep.usage.scope === "runtime" checks) so unknown/absent importUsage values are
excluded from unusedInstalledDeps increments.

---

Nitpick comments:
In `@src/runners/npmAudit.ts`:
- Around line 84-90: The runPackageAudit function currently accepts a positional
boolean persistToDisk; change its signature to take an options object (e.g.,
options?: { persistToDisk?: boolean }) to match runPackageOutdated and
LsProgressOptions usage, update internal references inside runPackageAudit to
read options.persistToDisk with a default of true, and update any call sites
that pass the positional boolean (e.g., calls to runPackageAudit(..., false)) to
pass an options object { persistToDisk: false } so call-site readability is
preserved; keep the tool, yarnVersion, and other parameters unchanged aside from
switching the final boolean into the options object.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e17e089 and 441c2b6.

⛔ Files ignored due to path filters (1)
  • dist/cli.js is excluded by !**/dist/**
📒 Files selected for processing (5)
  • src/cli.ts
  • src/runners/importGraphRunner.ts
  • src/runners/npmAudit.ts
  • src/runners/npmLs.ts
  • src/runners/npmOutdated.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/runners/importGraphRunner.ts

Comment thread src/cli.ts Outdated
Comment thread src/runners/npmLs.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
src/cli.ts (1)

1342-1348: ⚠️ Potential issue | 🟡 Minor

Unused-dependency metric still treats “missing usage data” as unused.

At Line 1346, !dep.usage.importUsage counts deps as unused when usage data is absent, and misses explicit fileCount === 0 objects.

💡 Proposed fix
     if (
       options.importGraphComplete &&
       dep.usage.direct &&
       dep.usage.scope === "runtime" &&
-      !dep.usage.importUsage
+      typeof dep.usage.importUsage?.fileCount === "number" &&
+      dep.usage.importUsage.fileCount === 0
     ) {
       unusedInstalledDeps += 1;
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/cli.ts` around lines 1342 - 1348, The unused-dependency count wrongly
treats absent import usage as unused; update the condition that increments
unusedInstalledDeps (the block using options.importGraphComplete,
dep.usage.direct, dep.usage.scope === "runtime") to only count a dependency as
unused when import usage exists and shows zero files, e.g. require
dep.usage.importUsage to be present and check dep.usage.importUsage.fileCount
=== 0 instead of using !dep.usage.importUsage so missing usage data is not
classified as unused.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@src/cli.ts`:
- Around line 1342-1348: The unused-dependency count wrongly treats absent
import usage as unused; update the condition that increments unusedInstalledDeps
(the block using options.importGraphComplete, dep.usage.direct, dep.usage.scope
=== "runtime") to only count a dependency as unused when import usage exists and
shows zero files, e.g. require dep.usage.importUsage to be present and check
dep.usage.importUsage.fileCount === 0 instead of using !dep.usage.importUsage so
missing usage data is not classified as unused.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 441c2b6 and 74975e1.

⛔ Files ignored due to path filters (5)
  • dist/cli.js is excluded by !**/dist/**
  • dist/runners/importGraphRunner.js is excluded by !**/dist/**
  • dist/runners/npmAudit.js is excluded by !**/dist/**
  • dist/runners/npmLs.js is excluded by !**/dist/**
  • dist/runners/npmOutdated.js is excluded by !**/dist/**
📒 Files selected for processing (3)
  • src/cli.ts
  • src/runners/npmAudit.ts
  • src/runners/npmLs.ts

@JosephMaynard
JosephMaynard merged commit 2c2f192 into master Mar 1, 2026
1 check passed
@JosephMaynard
JosephMaynard deleted the feat/cli-summery branch March 1, 2026 21:17
@coderabbitai coderabbitai Bot mentioned this pull request Mar 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant