Refactor: dead-code cleanup, dependency upgrades, and Gemini request-shape fix (0.11.2)#101
Merged
Conversation
…ager methods) - Delete 4 orphaned test helper/mock files (~1415 lines, zero references) - Remove unused SecurityManager methods: validateDirectoryPath, isPathAllowed, generateSecureTempPath (also eliminates Windows-incompatible /tmp hardcoding) - Remove unused hasImageExtension from mimeUtils - Drop orphaned tests and now-unused randomBytes import Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Drop unnecessary export from validateImagePath, McpContent, and ErrorWithCode (all consumed only within their own module), shrinking the public API surface. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Drop GeminiGenerationMetadata/GeminiApiParams/GeminiClient aliases that merely renamed the shared ImageClient abstraction types, and use the base types directly. Removes duplicate naming left over from the provider abstraction. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Add 'prepare': 'husky' so git hooks are installed on npm install (previously .husky/ hooks were dormant without a prepare script) - Remove tsx, which was not referenced by any script, source, or CI Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Bump biome, @types/node, vitest tooling, and openai to their latest compatible releases via npm update (lockfile only; ranges unchanged). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Bump typescript ^5.9 -> ^6.0 and lint-staged ^16 -> ^17 - Remove unused baseUrl/paths from tsconfig (src/* alias had zero imports); this also resolves the TS6 baseUrl deprecation error without ignoreDeprecations - Drop tsc-alias, now a no-op build step with no path aliases to rewrite Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The v2 breaking changes are confined to the Interactions API, which this codebase does not use. GenerateContent usage (GoogleGenAI constructor + models.generateContent) is unchanged. Verified via tsc type check against the v2 type definitions, full test suite, and a runtime API-surface smoke test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Add knip devDependency + knip.json declaring bin/install-skills.js as an entry (it is dynamically imported via a computed path in src/index.ts, so static analysis cannot see it) and ignoring the npx-invoked report-missing-dependencies binary - Wire 'check:unused' into check:all and CI so dead code is caught going forward - Remove orphaned .rmdrc.cjs (ts-prune config; ts-prune was never installed and is superseded by knip) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The CI step ran 'npx report-missing-dependencies', a tool that was never a project dependency and provided no working dependency check. knip's check:unused now covers unused/unlisted dependencies, so drop the step and the now-redundant knip ignoreBinaries entry. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Two latent bugs were hidden by a hand-written GeminiClientInstance interface
that loosely typed the generateContent parameters:
- Google Search grounding (useGoogleSearch) was passed as a top-level 'tools'
field, which is not part of GenerateContentParameters, so the SDK silently
dropped it and grounding never activated.
- The 'balanced' quality preset sent thinkingLevel: 'high' (lowercase), which
does not match the SDK ThinkingLevel enum ('HIGH'), so the thinking config
was silently ignored.
Root cause fix: type the request against the real SDK types
(GenerateContentParameters/GenerateContentConfig, Content, ImageConfig) and use
the ThinkingLevel enum. tools now correctly lives under config.tools, and the
compiler will catch any future drift. Tests assert config.tools and the 'HIGH'
enum value; the genai mock preserves real module exports via importActual.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Summary
A refactoring pass that removes dead code, tightens the public API surface, upgrades all dependencies (including majors), adopts knip for ongoing dead-code detection, and fixes two latent Gemini request-shape bugs uncovered along the way. Releases
0.11.2.Every step was verified with the full gate (
npm run check:all: lint / format / circular deps / knip / build / tests) staying green, and the Gemini fix was additionally confirmed against the real API.Changes
Dead code & API surface
SecurityManagermethods (validateDirectoryPath,isPathAllowed,generateSecureTempPath) plushasImageExtension. This also eliminates Windows-incompatible/tmphardcoding.validateImagePath,McpContent,ErrorWithCode.GeminiApiParams/GeminiGenerationMetadata/GeminiClient) in favor of the sharedImage*abstraction types.Tooling & dependencies
preparescript (previously dormant) and drop the unusedtsxdevDependency.baseUrl/pathsfrom tsconfig (resolving the TS6 deprecation) and the now-redundanttsc-aliasbuild step.check:alland CI. Removed the orphaned.rmdrc.cjs(ts-prune config) and the deadreport-missing-dependenciesCI step.Fix: Gemini generateContent request shape
A hand-written
GeminiClientInstanceinterface loosely typed the request, hiding two runtime bugs:useGoogleSearchwas sent as a top-leveltoolsfield, which is not part ofGenerateContentParameters— the SDK silently dropped it, so grounding never activated.balancedpreset sentthinkingLevel: 'high'(lowercase), not matching the SDKThinkingLevelenum ('HIGH'), so the thinking config was silently ignored.Root-cause fix: type the request against the real SDK types (
GenerateContentParameters/GenerateContentConfig/Content/ImageConfig) and use theThinkingLevelenum.toolsnow lives underconfig.tools, and the compiler catches future drift. Tests assertconfig.toolsand the'HIGH'value; the genai mock preserves real exports viaimportActual.Verification
npm run check:allgreen (234 tests, lint, format, circular deps, knip, build).quality: 'balanced'+useGoogleSearch: truegenerated successfully with no API error, confirming the new payload shape is accepted end-to-end.🤖 Generated with Claude Code