Skip to content

fix: address GitSniff warnings from PRs #8 and #10#13

Merged
evansantos merged 1 commit intomainfrom
fix/gitsniff-warnings-pr8-pr10
Feb 19, 2026
Merged

fix: address GitSniff warnings from PRs #8 and #10#13
evansantos merged 1 commit intomainfrom
fix/gitsniff-warnings-pr8-pr10

Conversation

@evansantos
Copy link
Copy Markdown
Owner

@evansantos evansantos commented Feb 19, 2026

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)?.enabled with typed Record<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 any unsafe cast

Typed routingTier as ComplexityTier | undefined in RequestMetric interface. Removed as any from metrics adapter — now uses ?? nullish coalescing.

🟡 Warning 3: JSON.stringify for complex content blocks

Content blocks (arrays) are now handled by extracting .text or .content from each block instead of blindly stringifying. Falls back to String() for unknown types.

Bonus: Removed redundant null guard (PR #10 info)

Removed if (!msg) continue from classification message loop — slice(-3) always returns defined elements.

Files Changed

  • src/index.ts

Closes #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

  • Correctly type configuration parameters for routing to prevent bypassing type checks.
  • Update routingTier to ComplexityTier | undefined in RequestMetric interface and remove unsafe type assertions.
  • Refactor message content processing to extract text from complex content blocks (arrays) more reliably.
  • Remove a redundant null guard in the message processing loop, simplifying the code.
  • Improve overall type safety and robustness of the SlimClaw plugin configuration and message handling.

Review Score: Excellent 🟢

Tip

No major issues found. Safe to merge.

Open in Dashboard

🐕 Reviewed by GitSniff

- 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
Copy link
Copy Markdown

@gitsniff gitsniff bot left a comment

Choose a reason for hiding this comment

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

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

@evansantos evansantos merged commit 33b0f03 into main Feb 19, 2026
6 checks passed
@evansantos evansantos deleted the fix/gitsniff-warnings-pr8-pr10 branch February 19, 2026 20:35
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.

Remove redundant null guard in classification message loop

1 participant