fix: address GitSniff warnings from PRs #8 and #10#13
Merged
evansantos merged 1 commit intomainfrom Feb 19, 2026
Merged
Conversation
- Replace `as any` routing config access with typed Record<string, unknown> - Type routingTier as ComplexityTier instead of string (remove `as any`) - Handle content blocks properly: extract text from arrays instead of JSON.stringify - Remove redundant null guard in classification message loop Closes #12
There was a problem hiding this comment.
Score: Excellent ✅
The PR addresses three warnings identified by GitSniff related to type safety and content handling in src/index.ts. It improves the type checking for configuration parameters, correctly types routingTier to ComplexityTier | undefined, and refactors the message content processing to handle complex content blocks more robustly. Additionally, a redundant null guard is removed. The changes enhance code quality, type safety, and error handling, making the configuration and message processing more reliable.
✅ No issues found. Ready to merge!
Review completed in 29s | Basic Plan | Gemini 2.5 Flash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fixes 3 warnings flagged by GitSniff on PRs #8 and #10.
Fixes
🟡 Warning 1: Routing config bypasses type checking
Replaced
(rawConfig.routing as any)?.enabledwith typedRecord<string, unknown>access and proper validation for each field (boolean check for enabled, typeof check for tiers, Number() for minConfidence, Array.isArray for pinnedModels).🟡 Warning 2:
routingTier as anyunsafe castTyped
routingTierasComplexityTier | undefinedinRequestMetricinterface. Removedas anyfrom metrics adapter — now uses??nullish coalescing.🟡 Warning 3: JSON.stringify for complex content blocks
Content blocks (arrays) are now handled by extracting
.textor.contentfrom each block instead of blindly stringifying. Falls back toString()for unknown types.Bonus: Removed redundant null guard (PR #10 info)
Removed
if (!msg) continuefrom classification message loop —slice(-3)always returns defined elements.Files Changed
src/index.tsCloses #12
🐕 GitSniff Summary
What this PR does
This pull request refines how SlimClaw processes configuration and message content by improving type safety and handling complex data structures more robustly. Specifically, it strengthens the validation of routing configuration parameters, ensures that routing tier information is correctly typed, and enables the system to intelligently extract text from varied message content blocks. These updates lead to a more reliable and error-resistant plugin, especially when dealing with diverse input formats.
Key Changes
routingTiertoComplexityTier | undefinedinRequestMetricinterface and remove unsafe type assertions.Review Score: Excellent 🟢
Tip
No major issues found. Safe to merge.
🐕 Reviewed by GitSniff