Skip to content

feat: Add read_lints tool#11828

Open
kels-ng wants to merge 1 commit intoRooCodeInc:mainfrom
kels-ng:lint_tool
Open

feat: Add read_lints tool#11828
kels-ng wants to merge 1 commit intoRooCodeInc:mainfrom
kels-ng:lint_tool

Conversation

@kels-ng
Copy link

@kels-ng kels-ng commented Mar 2, 2026

Add read_lints tool

Related GitHub Issue

Closes: #11827

Roo Code Task Context (Optional)

None.

Description

This PR adds a read_lints tool so the assistant can query linter errors and warnings from the workspace, similar to Cursor’s ReadLints.

  • Tool behavior: Optional paths (file or directory). When omitted, lints are limited to files edited in the current task; when provided, lints are limited to those paths. Uses existing diagnosticsToProblemsString and respects includeDiagnosticMessages and maxDiagnosticMessages from extension state.
  • Edited-file tracking: Task gets editedFilePaths and recordEditedFile(relPath). DiffViewProvider calls recordEditedFile after successful saveDirectly and saveChanges so “edited only” mode is accurate.
  • Integration: New native tool definition and ReadLintsTool handler; registration in native-tools index, presentAssistantMessage (including tool description for streaming), and NativeToolCallParser (with coerceStringArray for paths). Added to toolNames, TOOL_GROUPS.read, NativeToolArgs, and TOOL_DISPLAY_NAMES.

No approval UX for read_lints (read-only, like list_files / read_file).

Test Procedure

  • Unit tests: src/core/tools/__tests__/readLintsTool.spec.ts — six cases: no paths + no edited files → “no files edited yet” message; no paths + edited files → diagnostics filtered to those files; includeDiagnosticMessages: false → “No errors or warnings”; with paths → diagnostics for requested file; empty diagnostics → “No errors or warnings”; severity filter → only Error and Warning passed to diagnosticsToProblemsString.
  • How to run: From repo root, run tests for the roo-cline package (e.g. pnpm exec vitest run core/tools/__tests__/readLintsTool.spec.ts from the src directory). Full typecheck: pnpm run check-types.
  • Manual check: Start a task, edit a file via Roo, then trigger read_lints with no args and confirm only that file’s lints appear; call read_lints with a specific path and confirm only that path’s lints appear.

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: New and/or updated tests have been added to cover my changes (if applicable).
  • Documentation Impact: I have considered if my changes require documentation updates (see "Documentation Updates" section below).
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Screenshots / Videos

No UI changes. Tool appears in chat as a tool call (e.g. [read_lints] or [read_lints for paths]) and returns text with diagnostics.

Documentation Updates

  • No documentation updates are required.

Additional Notes

  • Reuses diagnosticsToProblemsString from src/integrations/diagnostics; no new dependencies.
  • Path normalization uses path.relative(cwd, ...).toPosix() so edited-file matching is consistent across platforms.

Get in Touch

kels9009

Interactively review PR in Roo Code Cloud

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. Enhancement New feature or request labels Mar 2, 2026
Integrate the read_lints tool into the assistant message handling and native tool call parser. Update task management to track edited file paths for read_lints functionality. Enhance tool parameter definitions and ensure proper registration in the native tools index.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement New feature or request size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ENHANCEMENT] Add Lint Tool

1 participant