Skip to content

refactor: tighten the tool map types - #7555

Merged
viceice merged 1 commit into
mainfrom
refactor/tool-map-types
Sep 30, 2026
Merged

viceice merged 1 commit into
mainfrom
refactor/tool-map-types

Conversation

@viceice

@viceice viceice commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

Changes

ResolverMap and DeprecatedTools are typed without undefined values. Lookups go through the new getToolType, which only matches own keys, so a tool name like constructor no longer resolves to an Object prototype member.

Split out of #7435, which lists these maps.

Context

  • This closes an existing Issue, Closes: #
  • This doesn't close an Issue, but I accept the risk that this PR may be closed if maintainers disagree with its opening or implementation

AI assistance disclosure

Did you use AI tools to create any part of this pull request?

  • No — I did not use AI for this contribution.
  • Yes — minimal assistance (e.g., IDE autocomplete, small code completions, grammar fixes).
  • Yes — substantive assistance (AI-generated non‑trivial portions of code, tests, or documentation).
  • Yes — other (please describe):

Code and tests were written by Claude Opus 5.5 and Claude Sonnet 5.5 in Claude Code.

Use of AI in replying to PR comments

Who answers review comments:

  • @username will read and reply directly. Name the account.
  • An agent will draft replies and @viceice will read them before they are posted.
  • Nobody has explicitly committed to replying.

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified tests

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved tool type detection during installation and removal, ensuring only explicitly supported tools are matched.
    • Prevented names that resemble built-in object properties from being mistaken for tools.
    • Version-check failures continue to be treated as errors for recognized pip tools, while checks for other tools are logged and ignored.

Type ResolverMap and DeprecatedTools without undefined values and look them up through getToolType, which only matches own keys.

Co-Authored-By: Claude Opus 5.5 <michael.kriese+claude-code@mend.io>
Co-Authored-By: Claude Sonnet 5.5 <michael.kriese+claude-code@mend.io>
@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: containerbase/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 8843640b-3ddf-4862-8cc1-b3472e5c6cd9

📥 Commits

Reviewing files that changed from the base of the PR and between 32f8797 and b648704.

📒 Files selected for processing (5)
  • src/cli/command/install-tool.ts
  • src/cli/command/uninstall-tool.ts
  • src/cli/install-tool/index.ts
  • src/cli/tools/index.spec.ts
  • src/cli/tools/index.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Tool type lookup now checks map ownership before returning a mapped type. Install and uninstall commands and the pip package check use the new helper.

Changes

Tool type lookup

Layer / File(s) Summary
Define and test own-key lookup
src/cli/tools/index.ts, src/cli/tools/index.spec.ts
The maps now declare mapped values as InstallToolType. The new getToolType helper returns a type only for own keys. Tests cover mapped names, unknown names, and prototype-related keys.
Use safe lookup in tool flows
src/cli/command/install-tool.ts, src/cli/command/uninstall-tool.ts, src/cli/install-tool/index.ts
The install and uninstall commands use getToolType to resolve tool types. The pip package check uses it to identify known pip tools.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to b6487

This refactor stops inherited names such as constructor from resolving as tool types, and existing install, uninstall and pip-check behavior is preserved. No merge-blocking risk is identified.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: tightening the types for the tool maps. It is concise, specific, and related to the full changeset.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 5 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@viceice
viceice enabled auto-merge September 30, 2026 11:24
@viceice
viceice added this pull request to the merge queue Sep 30, 2026
Merged via the queue into main with commit 4a32401 Sep 30, 2026
61 checks passed
@viceice
viceice deleted the refactor/tool-map-types branch September 30, 2026 11:46
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